From: Gaetan Rivet <gaetan.rivet@6wind.com>
To: dev@dpdk.org
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>,
Jan Blunck <jblunck@infradead.org>
Subject: [PATCH] pci: implement find_device bus operation
Date: Wed, 24 May 2017 17:09:19 +0200 [thread overview]
Message-ID: <a2f90d259a1e4f1a63a27aa82e6aa8d085364914.1495636394.git.gaetan.rivet@6wind.com> (raw)
Signed-off-by: Gaetan Rivet <gaetan.rivet@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/
---
lib/librte_eal/common/eal_common_pci.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c
index b749991..8428006 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -512,10 +512,24 @@ 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(int (*match)(const struct rte_device *dev, const void *data),
+ const void *data)
+{
+ struct rte_pci_device *dev;
+
+ FOREACH_DEVICE_ON_PCIBUS(dev) {
+ if (match(&dev->device, data))
+ 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
next reply other threads:[~2017-05-24 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-24 15:09 Gaetan Rivet [this message]
2017-06-01 10:04 ` [PATCH v2] pci: implement find_device bus operation Gaetan Rivet
2017-06-07 23:54 ` [PATCH v3] " Gaetan Rivet
2017-06-21 14:39 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a2f90d259a1e4f1a63a27aa82e6aa8d085364914.1495636394.git.gaetan.rivet@6wind.com \
--to=gaetan.rivet@6wind.com \
--cc=dev@dpdk.org \
--cc=jblunck@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.