From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f182.google.com (mail-wr0-f182.google.com [209.85.128.182]) by dpdk.org (Postfix) with ESMTP id 9AA011B3F8 for ; Sun, 15 Apr 2018 17:08:11 +0200 (CEST) Received: by mail-wr0-f182.google.com with SMTP id u46so19289603wrc.11 for ; Sun, 15 Apr 2018 08:08:11 -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=P3rt/7ocvCVDXbx5V/lZVRbQbHE1ghfG/w1MCg6Q+O0=; b=bC2IQ5odCyXxQnBAsKtJLvRBmQDKaqi5Wgdy0SHAoF+nT8DZLDfSDQxkGJ3Y82DCwC vVXl0aBEGmlEJwv5WQwOt51LxekcyH+HbMK1zpNznhgkTeFWWIfG/ja/rXH1kMVxeBJ2 NPebKXKqB+Aem3TW4/t4HtGOMKJwBg5WbyJJUjfIYomaToqrH8ubHnugfkyNGApBtr2A ExLdKWTMehGE0eJW+vGK9JyCoFGuWgGx9wqYEFNWC3Jds9rcjSo62FRdqgfemiAUlkQd tcEW7lU5T4tfZ6EY1jtTR35RsT35i1dKIfk42PD4a5sj4QAru0fLCM2Iuq5FKpy9zwq7 +2Tw== 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=P3rt/7ocvCVDXbx5V/lZVRbQbHE1ghfG/w1MCg6Q+O0=; b=LM4jcmYqCumDPRScQ/HuhzLe/MVaMFeoJ8YQMibi3SatJTwcCx2XQY4c2MqnwidDFe H7uiOTQpxHDfzMOhaCEPhNChYi6u3Z6sMFT1jXg2SGudA9T7lR+YV01H5w2calUE4xoj 3Rar9K1nRXB0xSGOb6tdNq019skrrcxuXMNDGBx1nGz+Oi7iv+9ib+fx/VpI1lgL4mc7 0CR4JN0w4d8fwYBDYhGfJlmPaADb6J5OBtt+63frKo1gXNQnnmb2OegZr1K+1mFe8v1b biFlOZxI0PPhJYRPwD+VI6zmL04h5ZLKJOQ8B8496vDIOZhNTvXfzMxis6DXED52YJR7 zDmg== X-Gm-Message-State: ALQs6tD4z0WatK34j6xZoADmyyguwwNMxx4siRDB5Ll8Y86BFLSKCmyZ u9j4ePCs/6mrBY3RJ2mRj5VeWFpX X-Google-Smtp-Source: AIpwx48gl7KvwZRurcDxfiPxsYHHcII3vd3q+Iu8LQxHfjB5WaWE2o/eF4wXYccByQPHWyGKHttAfw== X-Received: by 10.28.27.79 with SMTP id b76mr1684756wmb.57.1523804890335; Sun, 15 Apr 2018 08:08:10 -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 r200sm13673438wmb.39.2018.04.15.08.08.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Apr 2018 08:08:09 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet , Neil Horman , Keith Wiles , Matan Azrad , Shreyansh Jain Date: Sun, 15 Apr 2018 17:07:29 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v7 00/22] Device querying X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Apr 2018 15:08:11 -0000 This patchset introduces a new EAL API for querying devices, filtered by arbitrary properties. The following elements are introduced to this end: * A new object, "rte_class", is used to describe the device class abstraction layer (eth, crypto, ...). * Both rte_bus and rte_class now offer a way to list their devices and filter the result using locally defined properties. * The rte_dev API now has an rte_dev_iterator, which is the way for the user to define the device filter and iterate upon the resulting set. As an example, the "eth" device class is implemented. Additionally, the device filters for + rte_bus_pci + rte_bus_vdev + rte_class_eth are implemented and can be used with some properties each, to show how to extend those. Some example of filters: "bus=pci/class=eth" "bus=pci" "class=eth" "class=eth,name=net_ring0" "bus=pci,id=00:00.0" "bus=vdev,driver=net_ring" --- v2: * Reworked the dev_iterate callback to simplify its implementation. Now dev_iterate implementation do not need to learn about the intricacies of the rte_dev_iterator. The rte_dev_iterator is managed purely by the rte_dev_iterator_next function. Buses and classes then do not have to care about settings things right. Additionally, dev_iterate implementations do not have to sanitize their dev string anymore, they are prepared by the rte_dev layer prior, which also reduces the number of dynamic allocations. v3: * Introduced central constructor priority list. * Removed lightweight kvarg parsing utility, using librte_kvargs instead. * Reversed dependencies of librte_kvargs and librte_eal. * Fixed a few bugs. * @Bruce: I have noted the request for meson support. I will install it and attempt it once the bulk of the work is done. v4: * Fixed a few bugs, added relevant acks, fixed some typos. * Made each matching functions actually check for a proper list of accepted properties. * rte_kvargs now includes rte_eal directly and keeps rte_log. * added generic string comparison function to rte_kvargs, as some kind of comparison should probably be shared by many layers. v5: * Rebased on master * Use strcspn instead of custom function. * Introduce private generic rte_eth_dev iterator. This could be generalized to other iterators (port_next, owner_id-aware, etc). * Attempted to support meson.build. Got lost in the implicit variables declared when inversing dependencies between kvargs and EAL. Removed anything related to meson. * Postponed genericization of work from device query to device declaration. Much bigger than anticipated, will let this part get in first and iterate over it. v6: * Rebased on master * Introduce RTE_PRIORITY_LAST, to explicitly set the lowest constructor priority. * Fix copyright notice for eth_privage.* files. v7: * Rebased on master * Fix rte_kvargs_strcmp return value. * Fix layer parsing error devstr "bus=pci/onemorelayer" now tells that the additional layer is not recognized. Gaetan Rivet (22): kvargs: build before EAL eal: list acceptable init priorities eal: add last init priority eal: introduce dtor macros eal: introduce device class abstraction eal/class: register destructor eal/dev: add device iterator interface eal/class: add device iteration eal/bus: add device iteration eal/dev: implement device iteration initialization eal/dev: implement device iteration kvargs: add generic string matching callback bus/pci: fix find device implementation bus/pci: implement device iteration and comparison bus/pci: add device matching field id bus/vdev: fix find device implementation bus/vdev: implement device iteration bus/vdev: add device matching field driver ethdev: add private generic device iterator ethdev: register ether layer as a class ethdev: add device matching field name app/testpmd: add show device command app/test-pmd/cmdline.c | 52 ++++ drivers/bus/pci/Makefile | 2 +- drivers/bus/pci/pci_common.c | 87 +++++- drivers/bus/pci/rte_bus_pci.h | 3 + drivers/bus/vdev/Makefile | 3 +- drivers/bus/vdev/rte_bus_vdev.h | 3 + drivers/bus/vdev/vdev.c | 66 ++++- lib/Makefile | 7 +- lib/librte_eal/bsdapp/eal/Makefile | 2 + lib/librte_eal/common/Makefile | 4 +- lib/librte_eal/common/eal_common_class.c | 62 ++++ lib/librte_eal/common/eal_common_dev.c | 317 +++++++++++++++++++++ lib/librte_eal/common/eal_common_log.c | 2 +- lib/librte_eal/common/include/rte_bus.h | 3 +- lib/librte_eal/common/include/rte_class.h | 127 +++++++++ lib/librte_eal/common/include/rte_common.h | 53 +++- lib/librte_eal/common/include/rte_dev.h | 97 +++++++ lib/librte_eal/linuxapp/eal/Makefile | 2 + lib/librte_eal/rte_eal_version.map | 4 + lib/librte_ether/Makefile | 4 +- lib/librte_ether/eth_private.c | 31 ++ lib/librte_ether/eth_private.h | 26 ++ lib/librte_ether/rte_class_eth.c | 86 ++++++ lib/librte_kvargs/Makefile | 3 +- lib/librte_kvargs/rte_kvargs.c | 12 +- lib/librte_kvargs/rte_kvargs.h | 28 ++ lib/librte_kvargs/rte_kvargs_version.map | 7 + .../include => librte_kvargs}/rte_string_fns.h | 0 28 files changed, 1056 insertions(+), 37 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_class.c create mode 100644 lib/librte_eal/common/include/rte_class.h create mode 100644 lib/librte_ether/eth_private.c create mode 100644 lib/librte_ether/eth_private.h create mode 100644 lib/librte_ether/rte_class_eth.c rename lib/{librte_eal/common/include => librte_kvargs}/rte_string_fns.h (100%) -- 2.11.0