DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 3/3] net/dpaa: support interface init for multi process
Date: Tue, 25 Jun 2019 16:10:19 +0530	[thread overview]
Message-ID: <20190625104019.19287-3-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20190625104019.19287-1-hemant.agrawal@nxp.com>

From: Akhil Goyal <akhil.goyal@nxp.com>

The existing code is enabling the Tx queues as per
the number of lcore count, which is causing issue
in case of secondary process running on different number
of cores.
This patch fixes the Tx queues to number of DPAA cores,
which helps in using fixed number of Tx queues across
processes access.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 44 ++++++++++++++++++++--------------
 drivers/net/dpaa/dpaa_ethdev.h |  1 +
 2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 4b0027929..adc0bd5ac 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1214,7 +1214,7 @@ static int dpaa_debug_queue_init(struct qman_fq *fq, uint32_t fqid)
 static int
 dpaa_dev_init(struct rte_eth_dev *eth_dev)
 {
-	int num_cores, num_rx_fqs, fqid;
+	int num_rx_fqs, fqid;
 	int loop, ret = 0;
 	int dev_id;
 	struct rte_dpaa_device *dpaa_device;
@@ -1319,23 +1319,22 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_rx_queues = num_rx_fqs;
 
 	/* Initialise Tx FQs.free_rx Have as many Tx FQ's as number of cores */
-	num_cores = rte_lcore_count();
 	dpaa_intf->tx_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) *
-		num_cores, MAX_CACHELINE);
+		MAX_DPAA_CORES, MAX_CACHELINE);
 	if (!dpaa_intf->tx_queues) {
 		DPAA_PMD_ERR("Failed to alloc mem for TX queues\n");
 		ret = -ENOMEM;
 		goto free_rx;
 	}
 
-	for (loop = 0; loop < num_cores; loop++) {
+	for (loop = 0; loop < MAX_DPAA_CORES; loop++) {
 		ret = dpaa_tx_queue_init(&dpaa_intf->tx_queues[loop],
 					 fman_intf);
 		if (ret)
 			goto free_tx;
 		dpaa_intf->tx_queues[loop].dpaa_intf = dpaa_intf;
 	}
-	dpaa_intf->nb_tx_queues = num_cores;
+	dpaa_intf->nb_tx_queues = MAX_DPAA_CORES;
 
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
 	dpaa_debug_queue_init(&dpaa_intf->debug_queues[
@@ -1484,7 +1483,7 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
 		return 0;
 	}
 
-	if (!is_global_init) {
+	if (!is_global_init && (rte_eal_process_type() == RTE_PROC_PRIMARY)) {
 		/* One time load of Qman/Bman drivers */
 		ret = qman_global_init();
 		if (ret) {
@@ -1530,20 +1529,29 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
 		}
 	}
 
-	eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
-	if (eth_dev == NULL)
-		return -ENOMEM;
+	/* In case of secondary process, the device is already configured
+	 * and no further action is required, except portal initialization
+	 * and verifying secondary attachment to port name.
+	 */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		eth_dev = rte_eth_dev_attach_secondary(dpaa_dev->name);
+		if (!eth_dev)
+			return -ENOMEM;
+	} else {
+		eth_dev = rte_eth_dev_allocate(dpaa_dev->name);
+		if (eth_dev == NULL)
+			return -ENOMEM;
 
-	eth_dev->data->dev_private = rte_zmalloc(
-					"ethdev private structure",
-					sizeof(struct dpaa_if),
-					RTE_CACHE_LINE_SIZE);
-	if (!eth_dev->data->dev_private) {
-		DPAA_PMD_ERR("Cannot allocate memzone for port data");
-		rte_eth_dev_release_port(eth_dev);
-		return -ENOMEM;
+		eth_dev->data->dev_private = rte_zmalloc(
+						"ethdev private structure",
+						sizeof(struct dpaa_if),
+						RTE_CACHE_LINE_SIZE);
+		if (!eth_dev->data->dev_private) {
+			DPAA_PMD_ERR("Cannot allocate memzone for port data");
+			rte_eth_dev_release_port(eth_dev);
+			return -ENOMEM;
+		}
 	}
-
 	eth_dev->device = &dpaa_dev->device;
 	dpaa_dev->eth_dev = eth_dev;
 
diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h
index e906a0bec..18bc7dfa8 100644
--- a/drivers/net/dpaa/dpaa_ethdev.h
+++ b/drivers/net/dpaa/dpaa_ethdev.h
@@ -18,6 +18,7 @@
 #include <of.h>
 #include <netcfg.h>
 
+#define MAX_DPAA_CORES			4
 #define DPAA_MBUF_HW_ANNOTATION		64
 #define DPAA_FD_PTA_SIZE		64
 
-- 
2.17.1


  parent reply	other threads:[~2019-06-25 10:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25 10:40 [dpdk-dev] [PATCH 1/3] bus/dpaa: add plug support and rework parse Hemant Agrawal
2019-06-25 10:40 ` [dpdk-dev] [PATCH 2/3] bus/dpaa: update dpaa mempool for secondary process Hemant Agrawal
2019-06-25 10:40 ` Hemant Agrawal [this message]
2019-07-07 21:15 ` [dpdk-dev] [PATCH 1/3] bus/dpaa: add plug support and rework parse 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=20190625104019.19287-3-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /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).