[8/9,v2] bus/dpaa: moving qbman global init to bus

Message ID 20191017124403.26734-9-nipun.gupta@nxp.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series DPAA and FSLMC driver fixes and cleanup |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Nipun Gupta Oct. 17, 2019, 12:44 p.m. UTC
  From: Hemant Agrawal <hemant.agrawal@nxp.com>

DPAA SEC shall be able to work independent of DPAA ETH
driver.
This patch moves qbman init to bus, so that any driver
can use them even when no eth resources are present
or none of the eth devices are probed.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c               | 21 +++++++++++++++++++--
 drivers/bus/dpaa/rte_bus_dpaa_version.map |  2 --
 drivers/crypto/dpaa_sec/dpaa_sec.c        |  8 ++++++++
 drivers/net/dpaa/dpaa_ethdev.c            | 14 --------------
 4 files changed, 27 insertions(+), 18 deletions(-)
  

Comments

Akhil Goyal Oct. 18, 2019, 9:06 a.m. UTC | #1
> 
> From: Hemant Agrawal <hemant.agrawal@nxp.com>
> 
> DPAA SEC shall be able to work independent of DPAA ETH
> driver.
> This patch moves qbman init to bus, so that any driver
> can use them even when no eth resources are present
> or none of the eth devices are probed.
> 
> Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
> ---
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
  

Patch

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index d028ef3be..f27820db3 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -561,8 +561,24 @@  rte_dpaa_bus_probe(void)
 		return 0;
 
 	/* Device list creation is only done once */
-	if (!process_once)
+	if (!process_once) {
 		rte_dpaa_bus_dev_build();
+		if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
+			/* One time load of Qman/Bman drivers */
+			ret = qman_global_init();
+			if (ret) {
+				DPAA_PMD_ERR("QMAN initialization failed: %d",
+					     ret);
+				return ret;
+			}
+			ret = bman_global_init();
+			if (ret) {
+				DPAA_PMD_ERR("BMAN initialization failed: %d",
+					     ret);
+				return ret;
+			}
+		}
+	}
 	process_once = 1;
 
 	/* If no device present on DPAA bus nothing needs to be done */
@@ -600,7 +616,8 @@  rte_dpaa_bus_probe(void)
 			    RTE_DEV_WHITELISTED)) {
 				ret = drv->probe(drv, dev);
 				if (ret) {
-					DPAA_BUS_ERR("Unable to probe.\n");
+					DPAA_BUS_ERR("unable to probe:%s",
+						     dev->name);
 				} else {
 					dev->driver = drv;
 					dev->device.driver = &drv->driver;
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index 97f4f622d..cf428a54d 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -4,7 +4,6 @@  DPDK_17.11 {
 	bman_acquire;
 	bman_free_pool;
 	bman_get_params;
-	bman_global_init;
 	bman_new_pool;
 	bman_query_free_buffers;
 	bman_release;
@@ -48,7 +47,6 @@  DPDK_17.11 {
 	qman_enqueue_multi;
 	qman_fq_fqid;
 	qman_fq_state;
-	qman_global_init;
 	qman_init_fq;
 	qman_poll_dqrr;
 	qman_query_fq_np;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index 1e4f55b11..1db9bc381 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3050,6 +3050,14 @@  cryptodev_dpaa_sec_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
 		}
 	}
 
+	if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+		retval = rte_dpaa_portal_init((void *)1);
+		if (retval) {
+			DPAA_SEC_ERR("Unable to initialize portal");
+			return retval;
+		}
+	}
+
 	/* Invoke PMD device initialization function */
 	retval = dpaa_sec_dev_init(cryptodev);
 	if (retval == 0)
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index caf255d67..16b52b5e1 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1576,20 +1576,6 @@  rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv __rte_unused,
 	}
 
 	if (!is_global_init && (rte_eal_process_type() == RTE_PROC_PRIMARY)) {
-		/* One time load of Qman/Bman drivers */
-		ret = qman_global_init();
-		if (ret) {
-			DPAA_PMD_ERR("QMAN initialization failed: %d",
-				     ret);
-			return ret;
-		}
-		ret = bman_global_init();
-		if (ret) {
-			DPAA_PMD_ERR("BMAN initialization failed: %d",
-				     ret);
-			return ret;
-		}
-
 		if (access("/tmp/fmc.bin", F_OK) == -1) {
 			RTE_LOG(INFO, PMD,
 				"* FMC not configured.Enabling default mode\n");