[dpdk-dev] [PATCH v3] pci: implement find_device bus operation
Gaetan Rivet
gaetan.rivet at 6wind.com
Thu Jun 8 01:54:48 CEST 2017
Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
---
This patch depends on:
bus: attach / detach API
http://dpdk.org/ml/archives/dev/2017-May/066330.html
http://dpdk.org/dev/patchwork/patch/24489/
v1 --> v2
* Use the newly defined rte_dev_match_t type
v2 --> v3
* Use new comparison behavior.
---
lib/librte_eal/common/eal_common_pci.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index 5ae5201..5a8478c 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -483,10 +483,23 @@ rte_pci_remove_device(struct rte_pci_device *pci_dev)
TAILQ_REMOVE(&rte_pci_bus.device_list, pci_dev, next);
}
+static struct rte_device *
+pci_find_device(rte_dev_cmp_t cmp, const void *data)
+{
+ struct rte_pci_device *dev;
+
+ FOREACH_DEVICE_ON_PCIBUS(dev) {
+ if (cmp(&dev->device, data) == 0)
+ return &dev->device;
+ }
+ return NULL;
+}
+
struct rte_pci_bus rte_pci_bus = {
.bus = {
.scan = rte_pci_scan,
.probe = rte_pci_probe,
+ .find_device = pci_find_device,
},
.device_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.device_list),
.driver_list = TAILQ_HEAD_INITIALIZER(rte_pci_bus.driver_list),
--
2.1.4
More information about the dev
mailing list