DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH v3 1/3] net/ring: set ethernet device field
Date: Fri,  9 Jun 2017 18:51:18 +0100	[thread overview]
Message-ID: <20170609175120.77652-1-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20170606151008.62680-1-ferruh.yigit@intel.com>

The eth_dev->device link was missing for ring PMD, adding it.

This is to generalize rte_device access from eth_dev.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 drivers/net/ring/rte_eth_ring.c | 33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index d4dce95..6feb137 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -263,7 +263,8 @@ static int
 do_eth_dev_ring_create(const char *name,
 		struct rte_ring * const rx_queues[], const unsigned nb_rx_queues,
 		struct rte_ring *const tx_queues[], const unsigned nb_tx_queues,
-		const unsigned numa_node, enum dev_action action)
+		const unsigned int numa_node, enum dev_action action,
+		struct rte_eth_dev **eth_dev_p)
 {
 	struct rte_eth_dev_data *data = NULL;
 	struct pmd_internals *internals = NULL;
@@ -349,6 +350,8 @@ do_eth_dev_ring_create(const char *name,
 	eth_dev->rx_pkt_burst = eth_ring_rx;
 	eth_dev->tx_pkt_burst = eth_ring_tx;
 
+	*eth_dev_p = eth_dev;
+
 	return data->port_id;
 
 error:
@@ -369,6 +372,8 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 		const unsigned nb_tx_queues,
 		const unsigned numa_node)
 {
+	struct rte_eth_dev *eth_dev = NULL;
+
 	/* do some parameter checking */
 	if (rx_queues == NULL && nb_rx_queues > 0) {
 		rte_errno = EINVAL;
@@ -384,7 +389,8 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
 	}
 
 	return do_eth_dev_ring_create(name, rx_queues, nb_rx_queues,
-			tx_queues, nb_tx_queues, numa_node, DEV_ATTACH);
+			tx_queues, nb_tx_queues, numa_node, DEV_ATTACH,
+			&eth_dev);
 }
 
 int
@@ -396,7 +402,7 @@ rte_eth_from_ring(struct rte_ring *r)
 
 static int
 eth_dev_ring_create(const char *name, const unsigned numa_node,
-		enum dev_action action)
+		enum dev_action action, struct rte_eth_dev **eth_dev)
 {
 	/* rx and tx are so-called from point of view of first port.
 	 * They are inverted from the point of view of second port
@@ -418,7 +424,7 @@ eth_dev_ring_create(const char *name, const unsigned numa_node,
 	}
 
 	if (do_eth_dev_ring_create(name, rxtx, num_rings, rxtx, num_rings,
-		numa_node, action) < 0)
+		numa_node, action, eth_dev) < 0)
 		return -1;
 
 	return 0;
@@ -508,6 +514,7 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 	struct rte_kvargs *kvlist = NULL;
 	int ret = 0;
 	struct node_action_list *info = NULL;
+	struct rte_eth_dev *eth_dev = NULL;
 
 	name = rte_vdev_device_name(dev);
 	params = rte_vdev_device_args(dev);
@@ -515,12 +522,13 @@ 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') {
-		ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE);
+		ret = eth_dev_ring_create(name, rte_socket_id(), DEV_CREATE,
+				&eth_dev);
 		if (ret == -1) {
 			RTE_LOG(INFO, PMD,
 				"Attach to pmd_ring for %s\n", name);
 			ret = eth_dev_ring_create(name, rte_socket_id(),
-						  DEV_ATTACH);
+						  DEV_ATTACH, &eth_dev);
 		}
 	}
 	else {
@@ -530,13 +538,13 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 			RTE_LOG(INFO, PMD, "Ignoring unsupported parameters when creating"
 					" rings-backed ethernet device\n");
 			ret = eth_dev_ring_create(name, rte_socket_id(),
-						  DEV_CREATE);
+						  DEV_CREATE, &eth_dev);
 			if (ret == -1) {
 				RTE_LOG(INFO, PMD,
 					"Attach to pmd_ring for %s\n",
 					name);
 				ret = eth_dev_ring_create(name, rte_socket_id(),
-							  DEV_ATTACH);
+							  DEV_ATTACH, &eth_dev);
 			}
 			return ret;
 		} else {
@@ -560,7 +568,8 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 			for (info->count = 0; info->count < info->total; info->count++) {
 				ret = eth_dev_ring_create(info->list[info->count].name,
 							  info->list[info->count].node,
-							  info->list[info->count].action);
+							  info->list[info->count].action,
+							  &eth_dev);
 				if ((ret == -1) &&
 				    (info->list[info->count].action == DEV_CREATE)) {
 					RTE_LOG(INFO, PMD,
@@ -568,12 +577,16 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 						name);
 					ret = eth_dev_ring_create(name,
 							info->list[info->count].node,
-							DEV_ATTACH);
+							DEV_ATTACH,
+							&eth_dev);
 				}
 			}
 		}
 	}
 
+	if (eth_dev)
+		eth_dev->device = &dev->device;
+
 out_free:
 	rte_kvargs_free(kvlist);
 	rte_free(info);
-- 
2.9.4

  parent reply	other threads:[~2017-06-09 17:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-26 11:15 [dpdk-dev] [PATCH] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-06 15:10 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2017-06-06 15:31   ` Gaëtan Rivet
2017-06-07  4:52   ` Shreyansh Jain
2017-06-07 16:11   ` Jan Blunck
2017-06-09 14:22     ` Ferruh Yigit
2017-06-09 15:49       ` Ferruh Yigit
2017-06-08 20:58   ` Thomas Monjalon
2017-06-09 10:51     ` Ferruh Yigit
2017-06-09 17:51   ` Ferruh Yigit [this message]
2017-06-09 17:51     ` [dpdk-dev] [PATCH v3 2/3] net/ring: create vdev from PMD specific API Ferruh Yigit
2017-06-12 13:25       ` Bruce Richardson
2017-06-12 14:08         ` Ferruh Yigit
2017-06-12 14:19           ` Bruce Richardson
2017-06-12 14:38             ` Ferruh Yigit
2017-06-09 17:51     ` [dpdk-dev] [PATCH v3 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 14:13     ` [dpdk-dev] [PATCH v4 1/3] net/ring: set ethernet device field Ferruh Yigit
2017-06-12 14:13       ` [dpdk-dev] [PATCH v4 2/3] net/ring: use EAL APIs in PMD specific API Ferruh Yigit
2017-06-12 14:20         ` Bruce Richardson
2017-06-12 14:13       ` [dpdk-dev] [PATCH v4 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 15:25       ` [dpdk-dev] [PATCH v5 1/3] net/ring: set ethernet device field Ferruh Yigit
2017-06-12 15:25         ` [dpdk-dev] [PATCH v5 2/3] net/ring: use EAL APIs in PMD specific API Ferruh Yigit
2017-06-12 15:25         ` [dpdk-dev] [PATCH v5 3/3] ethdev: remove driver name from device private data Ferruh Yigit
2017-06-12 15:37         ` [dpdk-dev] [PATCH v5 1/3] net/ring: set ethernet device field Ferruh Yigit

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=20170609175120.77652-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).