All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: implement find_device bus operation
@ 2017-05-24 15:09 Gaetan Rivet
  2017-06-01 10:04 ` [PATCH v2] " Gaetan Rivet
  0 siblings, 1 reply; 4+ messages in thread
From: Gaetan Rivet @ 2017-05-24 15:09 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet, Jan Blunck

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2] pci: implement find_device bus operation
  2017-05-24 15:09 [PATCH] pci: implement find_device bus operation Gaetan Rivet
@ 2017-06-01 10:04 ` Gaetan Rivet
  2017-06-07 23:54   ` [PATCH v3] " Gaetan Rivet
  0 siblings, 1 reply; 4+ messages in thread
From: Gaetan Rivet @ 2017-06-01 10:04 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
v1 --> v2

 * Use the newly defined rte_dev_match_t type

 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 b749991..2ab1d65 100644
--- a/lib/librte_eal/common/eal_common_pci.c
+++ b/lib/librte_eal/common/eal_common_pci.c
@@ -512,10 +512,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_match_t match, 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3] pci: implement find_device bus operation
  2017-06-01 10:04 ` [PATCH v2] " Gaetan Rivet
@ 2017-06-07 23:54   ` Gaetan Rivet
  2017-06-21 14:39     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Gaetan Rivet @ 2017-06-07 23:54 UTC (permalink / raw)
  To: dev; +Cc: Gaetan Rivet

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/

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] pci: implement find_device bus operation
  2017-06-07 23:54   ` [PATCH v3] " Gaetan Rivet
@ 2017-06-21 14:39     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2017-06-21 14:39 UTC (permalink / raw)
  To: Gaetan Rivet; +Cc: dev

08/06/2017 01:54, Gaetan Rivet:
> 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/

Please insert this patch the related series above.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-21 14:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 15:09 [PATCH] pci: implement find_device bus operation Gaetan Rivet
2017-06-01 10:04 ` [PATCH v2] " Gaetan Rivet
2017-06-07 23:54   ` [PATCH v3] " Gaetan Rivet
2017-06-21 14:39     ` Thomas Monjalon

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.