From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wr0-f169.google.com (mail-wr0-f169.google.com
 [209.85.128.169]) by dpdk.org (Postfix) with ESMTP id 312952B94
 for <dev@dpdk.org>; Fri,  3 Mar 2017 16:40:25 +0100 (CET)
Received: by mail-wr0-f169.google.com with SMTP id g10so76170764wrg.2
 for <dev@dpdk.org>; Fri, 03 Mar 2017 07:40:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=6wind-com.20150623.gappssmtp.com; s=20150623;
 h=from:to:cc:subject:date:message-id;
 bh=Ol+7cwpVE+87REbfYWg3LALWciVnCB0jhMMHQb/YRoE=;
 b=jfAgpkhlKJPabHgvmzHmKx/lXw/rEaNolFkJuju1UFHtYcEVAlABEdGf8Z3wFPneRI
 22eGQy7Ni1k7n8+SEIMjTwvrcBDiqTOmEgKbmoF1ly8QLPgjJWwTx+7izk2K66WxnACr
 0QLqnpDjzQsxpmpQNO9JGYAbSShLK+27ARNjf+GEapJGTtSeZDonF+YSlT1x950wHwxc
 rmXVGK+RdlTPevGrJS12xgxd4feIucfJbuE9UPPtUVtDXfjSZarfWUrunz0qTXFR7qdT
 c1RL5g2sRlWXX0BR64SGsaceN9vhZmJttTp+bexTUeIYISBDhrJVdF/r7GCF38QFipNj
 eu9Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id;
 bh=Ol+7cwpVE+87REbfYWg3LALWciVnCB0jhMMHQb/YRoE=;
 b=pa8nTc/+C97aRgLj6qDup1YN4O44p1GUm9jmDAjy9AJh35JAaYSN6tC3RruSEtMKYu
 L62DP4GwKT+WQMJrnnBa6W4qv+mthhMv6a07UqvhLFXh8EzMnIQ3GoY6/+ezvUpVuOAc
 TdPYnDoPUfGyAm7BZPP9bhxN/QT8x/6y3fCymF5d7g0Ckcz7cnaNHQJZxHFL2dcCnT1M
 YdNgxfySceGdOGTupwN8lzxEsr/MansCNuvHzjQccO9e6vRJ+bBytYgtsxpQ082Y8dfV
 ndCJ4D+tuownHO1NMZ/kbf3c3Ht9jtt3izBdRq/KYrsxM+Q8JgWXC1QFnSE/JND1R3g7
 Zmdw==
X-Gm-Message-State: AMke39kjx3ATTCknU2xh55XtOI1UDtIM5rgAXnm9EyR4xEZ0pQh4IILljixB6mPAECRol7m1
X-Received: by 10.223.174.73 with SMTP id u9mr3615193wrd.116.1488555624823;
 Fri, 03 Mar 2017 07:40:24 -0800 (PST)
Received: from bidouze.dev.6wind.com (host.78.145.23.62.rev.coltfrance.com.
 [62.23.145.78])
 by smtp.gmail.com with ESMTPSA id k195sm3513175wmd.7.2017.03.03.07.40.24
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Fri, 03 Mar 2017 07:40:24 -0800 (PST)
From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Thomas Monjalon <thomas.monjalon@6wind.com>,
 Jingjing Wu <jingjing.wu@intel.com>
Date: Fri,  3 Mar 2017 16:40:09 +0100
Message-Id: <cover.1488550937.git.gaetan.rivet@6wind.com>
X-Mailer: git-send-email 2.1.4
Subject: [dpdk-dev] [PATCH 0/4] clarify eth_dev state management
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 03 Mar 2017 15:40:25 -0000

1. The hotplug API currently available in DPDK introduces the notion of
   device states (DEV_DETACHED, DEV_ATTACHED). These states are implicit
   and internal to the ethdev layer.

2. Device enumeration and access is done directly, without regard to the
   underlying state of a device. Applications are currently expected to cycle
   through the static rte_eth_devices array. Those using the hotplug API
   (rte_eth_dev_attach(), rte_eth_dev_detach()), are thus expected to deal
   themselves with possible discrepancies internal to the ethdev layer,
   i.e. avoid detached devices if necessary, without the state of the devices
   having been explicitly defined or exposed.

3. The hotplug API itself is not complete and cannot be used without
   introducing some bugs. Detaching a device will introduce inconsistencies in
   the device count, as explained in the related API.
   No function is exposed in the ethdev layer to permit applications to deal
   with it.

This series addresses these issues so that:

1. Applications are not expected to manage the states of their devices, those
   should be kept internal to the ethdev layer.

2. The hotplug API is cleaner, with specific operations from the ethdev layer
   to be used if necessary.

3. Applications that are not interested in hotplug functionality are not concerned
   and do not require any change.

Gaetan Rivet (4):
  ethdev: expose device states
  ethdev: add device iterator
  ethdev: count devices consistently
  app/testpmd: use ethdev iterator to list devices

 app/test-pmd/cmdline.c        | 31 ++++++++++++++---------------
 app/test-pmd/cmdline_flow.c   |  2 +-
 app/test-pmd/config.c         | 12 +++++------
 app/test-pmd/parameters.c     |  4 ++--
 app/test-pmd/testpmd.c        | 44 +++++++++++------------------------------
 app/test-pmd/testpmd.h        |  9 ---------
 lib/librte_ether/rte_ethdev.c | 46 +++++++++++++++++++++++++------------------
 lib/librte_ether/rte_ethdev.h | 37 ++++++++++++++++++++++++++++++----
 8 files changed, 95 insertions(+), 90 deletions(-)

-- 
2.1.4