[dpdk-dev] [PATCH v3 10/10] net/ring: fix dev handle in eth_dev

Gaetan Rivet gaetan.rivet at 6wind.com
Thu Jun 8 01:53:24 CEST 2017


The ring PMD uses special eth_dev allocators, which cannot be updated to
accept an rte_vdev_device.
Circumvent the limitation and store the rte_device handle in the
rte_eth_dev structure.

Fixes: 050fe6e9ff97 ("drivers/net: use ethdev allocation helper for
vdev")
Cc: stable at dpdk.org

Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
---
 drivers/net/ring/rte_eth_ring.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index d4dce95..2cd32a9 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -515,6 +515,8 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 	RTE_LOG(INFO, PMD, "Initializing pmd_ring for %s\n", name);
 
 	if (params == NULL || params[0] == '\0') {
+		struct rte_eth_dev *eth_dev;
+
 		ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
 		if (ret == -1) {
 			RTE_LOG(INFO, PMD,
@@ -522,6 +524,11 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 			ret = eth_dev_ring_create(name, rte_socket_id(),
 						  DEV_ATTACH);
 		}
+		/* find an ethdev entry */
+		eth_dev = rte_eth_dev_allocated(name);
+		if (eth_dev == NULL)
+			return -ENODEV;
+		eth_dev->device = &dev->device;
 	}
 	else {
 		kvlist = rte_kvargs_parse(params, valid_arguments);
-- 
2.1.4



More information about the dev mailing list