From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by dpdk.org (Postfix) with ESMTP id 3022F2C01 for ; Wed, 21 Mar 2018 18:16:00 +0100 (CET) Received: by mail-wm0-f54.google.com with SMTP id f19so11169904wmc.0 for ; Wed, 21 Mar 2018 10:16:00 -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=fYm9ieMe6aWiTeficK1wxp6T9GdcIPk5pQDZEd6feXo=; b=nHvq2uGHCfHms1NxKboa+b3MJ/9WaRVOD4tBnibDuoS4LNYkSK7NlIM0A8hfb9Kc1V 0zqA78mp2hlkLyFwvvkiRbD4/h3/TFf6qmttGTMncgtZKb8qxM7Wu9zZxNWP62urQK9b L4DDB6SAPpz2y3EQ9DNcoXukRYcRDC+ya37HWQQaODes5pLSWZskATLfry1CFtWB7r2n z+FV8ZQsQ5pXJXdP8lvSZArVNNl+GyueymS80skUMmsKqkL3nlCbXB3wpGCApL6tMFXb kDEst9rAl56AjY4lYGSuSMj3WbHCh4iaUamQgpOx+NrSQJLNc4AexLQ6v82r8cOjbjQK GTJQ== 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=fYm9ieMe6aWiTeficK1wxp6T9GdcIPk5pQDZEd6feXo=; b=rawpAOTDuoPzQ7D01tXVEF97MEkkS1Yjnxvm9YCjE2TcypN00FQ71RBbKdYyCXR7g2 I/h9Ns1pkcKWODZQtdMSeI5Y5ameITcaJzIfsMY57NLcU3JRvkyX/ICkIxPUs1+sQByP ppcn4kFN5clBpiJ+dp+5pI4tfSnAU1gDzH4Mq5MI/UuvYMQyYa2Yd6fBfQNs2HUbhlYA ZaKDPjDEZUWHbYpMKbVuBHOIi1ayfpNoqSy5GQookKEPMMhv4Toj3E68FX/Es4eoLDqr gUAO2fZyzOqS3WipTK8otraRbqkD8q64+BgJmD/f1uAEhZ9YoygvHK+bFI0yucQ8166M UOag== X-Gm-Message-State: AElRT7G4fP2NDjP7tDZn+r2v8+PUI9P6cEZDCuK6OeiWl2PsYl4IdT7I yCsx1kwpRrBReh99/Z3d7X51cIbX X-Google-Smtp-Source: AG47ELtUNo8dABBIxZK2IZnp2d6Fw9zYvGkg0n6IYJO7yr1QNVoMS58oR0knZu+JxO4WKhUf8vqeOw== X-Received: by 10.28.181.16 with SMTP id e16mr3589497wmf.97.1521652559202; Wed, 21 Mar 2018 10:15:59 -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 l10sm4224101wrf.37.2018.03.21.10.15.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 10:15:58 -0700 (PDT) From: Gaetan Rivet To: dev@dpdk.org Cc: Gaetan Rivet Date: Wed, 21 Mar 2018 18:15:21 +0100 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v2 00/18] 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: Wed, 21 Mar 2018 17:16:00 -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. Gaetan Rivet (18): eal: introduce dtor macros eal: introduce device class abstraction eal/class: register destructor eal: add lightweight kvarg parsing utility 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 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: 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 | 77 ++++++++- drivers/bus/pci/rte_bus_pci.h | 3 + drivers/bus/vdev/Makefile | 2 +- drivers/bus/vdev/rte_bus_vdev.h | 3 + drivers/bus/vdev/vdev.c | 66 +++++++- lib/Makefile | 2 +- lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/common/Makefile | 2 +- lib/librte_eal/common/eal_common_class.c | 62 +++++++ lib/librte_eal/common/eal_common_dev.c | 255 +++++++++++++++++++++++++++++ lib/librte_eal/common/eal_private.h | 34 ++++ lib/librte_eal/common/include/rte_bus.h | 1 + lib/librte_eal/common/include/rte_class.h | 127 ++++++++++++++ lib/librte_eal/common/include/rte_common.h | 23 +++ lib/librte_eal/common/include/rte_dev.h | 95 +++++++++++ lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/rte_eal_version.map | 4 + lib/librte_ether/Makefile | 3 +- lib/librte_ether/rte_class_eth.c | 79 +++++++++ 21 files changed, 875 insertions(+), 19 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/rte_class_eth.c -- 2.11.0