From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gaetan.rivet@6wind.com>
Received: from mail-wr0-f173.google.com (mail-wr0-f173.google.com
 [209.85.128.173]) by dpdk.org (Postfix) with ESMTP id 5034DFE5
 for <dev@dpdk.org>; Fri, 31 Mar 2017 14:04:55 +0200 (CEST)
Received: by mail-wr0-f173.google.com with SMTP id k6so97653128wre.2
 for <dev@dpdk.org>; Fri, 31 Mar 2017 05:04:55 -0700 (PDT)
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:in-reply-to:references;
 bh=884Ha8BfVTk7I4835ZSoZS6bZTtWeXv2vbIct/+eWw4=;
 b=cQRbdnrl57lYDg/LJKteD0u+w1fz5Amh3j5aBQ65jUkomw/DREnevdn84bKvW8rnD0
 BXDZ+YBsWYoEsKpqcLQ/O68nqe83JDIhr0YH7Z9rMa10TuAp02H002NVvWThbbc70B5K
 OXw785D3nafswSMOHR1yuhVzd1NKmHUGM2klQlRdjWKJUnsuudkgIzPFQWPjrMpG9H23
 U0+J6Qb39OjuawkLh37NMU77mAcccF/KWsoWE73RM5aKSPH9o6hOLGLYra9ZiaMGaOeM
 rth4EaSg2Id4eV+Zw1U/KrtMNprbWCGqVXkAvhnsADPHhEBxyjHV9yFuNUAXDPERSH4l
 Xbpg==
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:in-reply-to
 :references;
 bh=884Ha8BfVTk7I4835ZSoZS6bZTtWeXv2vbIct/+eWw4=;
 b=kbIf5WHhHHR9mBw/g28d+fnWvI5XZTP+k7yly0TZt18/9sbI0b2iwoepoKE4HOZIMZ
 h5Movyq2JHcBAko6EoUbvGuVVS3YbvugBrJ78Vdm2AcD1FaeR+NJUACsHy+lktgqG4WW
 eZcM3M/GU9NrtgmUfdaKdrsWl7+4m3/wW6fMhC8pgBYnQ0m1jpN1qbC5apgklnF7zrX9
 zGWATZlUZY5cZU9+fm3zWVph+GXE9mbwzukv+TZrl1ZZ9WhTr6vCXZlkRZAG9jbgHtM/
 q4i5MwjbdrU7/geDOngB+i3FVSd7IeCq7pUvN5x8PbzRt+yR3IpEEtYE2EdNx3gAwyd1
 I+RA==
X-Gm-Message-State: AFeK/H2Fz5a6vZxfbaL55CEfLOPILaL+A6uPO+I4C2RxHR/UjTqXCkv6Cj5gL24/h8bI8MwR
X-Received: by 10.223.166.244 with SMTP id t107mr2519497wrc.80.1490961895021; 
 Fri, 31 Mar 2017 05:04:55 -0700 (PDT)
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 l41sm6487536wrl.59.2017.03.31.05.04.53
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
 Fri, 31 Mar 2017 05:04:54 -0700 (PDT)
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, 31 Mar 2017 14:04:36 +0200
Message-Id: <cover.1490961533.git.gaetan.rivet@6wind.com>
X-Mailer: git-send-email 2.1.4
In-Reply-To: <cover.1488550937.git.gaetan.rivet@6wind.com>
References: <cover.1488550937.git.gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v2 0/3] 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, 31 Mar 2017 12:04:55 -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.

v1 --> v2:

 * Improved patches consistency, iterator definition in one patch only

 * Removed device count changes, not needed without additional device states.

Gaetan Rivet (3):
  ethdev: expose device states
  ethdev: add device iterator
  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 | 30 +++++++++++++++++------------
 lib/librte_ether/rte_ethdev.h | 31 ++++++++++++++++++++++++++++--
 8 files changed, 82 insertions(+), 81 deletions(-)

-- 
2.1.4