All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 1/2] net/ring: refactor to reduce indentation in probe
Date: Fri,  2 Oct 2020 23:47:47 +0100	[thread overview]
Message-ID: <20201002224748.1532530-1-ferruh.yigit@intel.com> (raw)

No functional change.

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

diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index 83c5502123..6d3deaa81a 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -598,85 +598,80 @@ rte_pmd_ring_probe(struct rte_vdev_device *dev)
 	PMD_LOG(INFO, "Initializing pmd_ring for %s", name);
 
 	if (params == NULL || params[0] == '\0') {
-		ret = eth_dev_ring_create(name, dev, rte_socket_id(), DEV_CREATE,
-				&eth_dev);
+		ret = eth_dev_ring_create(name, dev, rte_socket_id(),
+				DEV_CREATE, &eth_dev);
 		if (ret == -1) {
-			PMD_LOG(INFO,
-				"Attach to pmd_ring for %s", name);
+			PMD_LOG(INFO, "Attach to pmd_ring for %s", name);
 			ret = eth_dev_ring_create(name, dev, rte_socket_id(),
-						  DEV_ATTACH, &eth_dev);
+					DEV_ATTACH, &eth_dev);
 		}
-	} else {
-		kvlist = rte_kvargs_parse(params, valid_arguments);
 
-		if (!kvlist) {
-			PMD_LOG(INFO,
-				"Ignoring unsupported parameters when creatingrings-backed ethernet device");
+		return ret;
+	}
+
+	kvlist = rte_kvargs_parse(params, valid_arguments);
+	if (!kvlist) {
+		PMD_LOG(INFO,
+			"Ignoring unsupported parameters when creatingrings-backed ethernet device");
+		ret = eth_dev_ring_create(name, dev, rte_socket_id(),
+				DEV_CREATE, &eth_dev);
+		if (ret == -1) {
+			PMD_LOG(INFO, "Attach to pmd_ring for %s", name);
 			ret = eth_dev_ring_create(name, dev, rte_socket_id(),
-						  DEV_CREATE, &eth_dev);
-			if (ret == -1) {
-				PMD_LOG(INFO,
-					"Attach to pmd_ring for %s",
-					name);
-				ret = eth_dev_ring_create(name, dev, rte_socket_id(),
-							  DEV_ATTACH, &eth_dev);
-			}
-
-			return ret;
+					DEV_ATTACH, &eth_dev);
 		}
 
-		if (rte_kvargs_count(kvlist, ETH_RING_INTERNAL_ARG) == 1) {
-			ret = rte_kvargs_process(kvlist, ETH_RING_INTERNAL_ARG,
-						 parse_internal_args,
-						 &internal_args);
-			if (ret < 0)
-				goto out_free;
-
-			ret = do_eth_dev_ring_create(name, dev,
-				internal_args->rx_queues,
-				internal_args->nb_rx_queues,
-				internal_args->tx_queues,
-				internal_args->nb_tx_queues,
-				internal_args->numa_node,
-				DEV_ATTACH,
+		return ret;
+	}
+
+	if (rte_kvargs_count(kvlist, ETH_RING_INTERNAL_ARG) == 1) {
+		ret = rte_kvargs_process(kvlist, ETH_RING_INTERNAL_ARG,
+					 parse_internal_args,
+					 &internal_args);
+		if (ret < 0)
+			goto out_free;
+
+		ret = do_eth_dev_ring_create(name, dev,
+			internal_args->rx_queues,
+			internal_args->nb_rx_queues,
+			internal_args->tx_queues,
+			internal_args->nb_tx_queues,
+			internal_args->numa_node,
+			DEV_ATTACH,
+			&eth_dev);
+		if (ret >= 0)
+			ret = 0;
+		goto out_free;
+	}
+
+	ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
+	info = rte_zmalloc("struct node_action_list",
+			   sizeof(struct node_action_list) +
+			   (sizeof(struct node_action_pair) * ret),
+			   0);
+	if (!info)
+		goto out_free;
+
+	info->total = ret;
+	info->list = (struct node_action_pair *)(info + 1);
+
+	ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
+				 parse_kvlist, info);
+
+	if (ret < 0)
+		goto out_free;
+
+	for (info->count = 0; info->count < info->total; info->count++) {
+		ret = eth_dev_ring_create(info->list[info->count].name, dev,
+				info->list[info->count].node,
+				info->list[info->count].action,
 				&eth_dev);
-			if (ret >= 0)
-				ret = 0;
-		} else {
-			ret = rte_kvargs_count(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG);
-			info = rte_zmalloc("struct node_action_list",
-					   sizeof(struct node_action_list) +
-					   (sizeof(struct node_action_pair) * ret),
-					   0);
-			if (!info)
-				goto out_free;
-
-			info->total = ret;
-			info->list = (struct node_action_pair *)(info + 1);
-
-			ret = rte_kvargs_process(kvlist, ETH_RING_NUMA_NODE_ACTION_ARG,
-						 parse_kvlist, info);
-
-			if (ret < 0)
-				goto out_free;
-
-			for (info->count = 0; info->count < info->total; info->count++) {
-				ret = eth_dev_ring_create(info->list[info->count].name,
-							  dev,
-							  info->list[info->count].node,
-							  info->list[info->count].action,
-							  &eth_dev);
-				if ((ret == -1) &&
-				    (info->list[info->count].action == DEV_CREATE)) {
-					PMD_LOG(INFO,
-						"Attach to pmd_ring for %s",
-						name);
-					ret = eth_dev_ring_create(name, dev,
-							info->list[info->count].node,
-							DEV_ATTACH,
-							&eth_dev);
-				}
-			}
+		if ((ret == -1) && (info->list[info->count].action == DEV_CREATE)) {
+			PMD_LOG(INFO, "Attach to pmd_ring for %s", name);
+			ret = eth_dev_ring_create(name, dev,
+					info->list[info->count].node,
+					DEV_ATTACH,
+					&eth_dev);
 		}
 	}
 
-- 
2.26.2


             reply	other threads:[~2020-10-02 22:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 22:47 Ferruh Yigit [this message]
2020-10-02 22:47 ` [dpdk-dev] [PATCH 2/2] net/ring: prevent nodeaction arg create multiple ethdev Ferruh Yigit
2021-04-20  1:10 ` [dpdk-dev] [PATCH 1/2] net/ring: refactor to reduce indentation in probe 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=20201002224748.1532530-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 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.