patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 01/20] bus/fslmc: fix to reset portal memory before use
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
@ 2018-12-27  6:22 ` Hemant Agrawal
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 02/20] bus/fslmc: fix the ring mode to use correct cache settings Hemant Agrawal
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, Sachin Saxena, stable

From: Sachin Saxena <sachin.saxena@nxp.com>

Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ce0699842..4fc6efec5 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -369,6 +369,8 @@ dpaa2_create_dpio_device(int vdev_fd,
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
+	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
+
 	if (!dpio_dev->dpio) {
 		DPAA2_BUS_ERR("Memory allocation failure");
 		goto err;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 02/20] bus/fslmc: fix the ring mode to use correct cache settings
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 01/20] bus/fslmc: fix to reset portal memory before use Hemant Agrawal
@ 2018-12-27  6:22 ` Hemant Agrawal
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 03/20] bus/fslmc: fix to use correct physical core for logical core Hemant Agrawal
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, Youri Querry, stable

From: Youri Querry <youri.querry_1@nxp.com>

The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 12 ++++++------
 drivers/bus/fslmc/qbman/qbman_sys.h    |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3380e54f5..bbea37efc 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -683,8 +683,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 				eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -809,8 +809,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -941,8 +941,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index d41af8358..0571097ab 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -55,6 +55,7 @@
 #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
 #define QBMAN_CENA_SWP_VDQCR   0x780
 #define QBMAN_CENA_SWP_EQCR_CI 0x840
+#define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
 
 /* CENA register offsets in memory-backed mode */
 #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 03/20] bus/fslmc: fix to use correct physical core for logical core
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 01/20] bus/fslmc: fix to reset portal memory before use Hemant Agrawal
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 02/20] bus/fslmc: fix the ring mode to use correct cache settings Hemant Agrawal
@ 2018-12-27  6:22 ` Hemant Agrawal
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 04/20] net/dpaa2: fix bad check for not-null Hemant Agrawal
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.

Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 76 ++++++++++++++++++++----
 1 file changed, 63 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 4fc6efec5..ba2e28ce1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -53,6 +53,10 @@ static uint32_t io_space_count;
 /* Variable to store DPAA2 platform type */
 uint32_t dpaa2_svr_family;
 
+/* Physical core id for lcores running on dpaa2. */
+/* DPAA2 only support 1 lcore to 1 phy cpu mapping */
+static unsigned int dpaa2_cpu[RTE_MAX_LCORE];
+
 /* Variable to store DPAA2 DQRR size */
 uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
@@ -92,7 +96,8 @@ dpaa2_core_cluster_sdest(int cpu_id)
 }
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
+static void
+dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int lcoreid)
 {
 #define STRING_LEN	28
 #define COMMAND_LEN	50
@@ -125,7 +130,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 		return;
 	}
 
-	cpu_mask = cpu_mask << rte_lcore_id();
+	cpu_mask = cpu_mask << dpaa2_cpu[lcoreid];
 	snprintf(command, COMMAND_LEN, "echo %X > /proc/irq/%s/smp_affinity",
 		 cpu_mask, token);
 	ret = system(command);
@@ -139,7 +144,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 	fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	struct epoll_event epoll_ev;
 	int eventfd, dpio_epoll_fd, ret;
@@ -176,32 +181,36 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
 	}
 	dpio_dev->epoll_fd = dpio_epoll_fd;
 
-	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id);
+	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, lcoreid);
 
 	return 0;
 }
 #endif
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	int sdest, ret;
+	int cpu_id;
 
 	/* Set the Stashing Destination */
-	if (cpu_id < 0) {
-		cpu_id = rte_get_master_lcore();
-		if (cpu_id < 0) {
+	if (lcoreid < 0) {
+		lcoreid = rte_get_master_lcore();
+		if (lcoreid < 0) {
 			DPAA2_BUS_ERR("Getting CPU Index failed");
 			return -1;
 		}
 	}
+
+	cpu_id = dpaa2_cpu[lcoreid];
+
 	/* Set the STASH Destination depending on Current CPU ID.
 	 * Valid values of SDEST are 4,5,6,7. Where,
 	 */
 
 	sdest = dpaa2_core_cluster_sdest(cpu_id);
-	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
-			dpio_dev->index, cpu_id, sdest);
+	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u lcore id =%u SDEST= %d",
+			dpio_dev->index, cpu_id, lcoreid, sdest);
 
 	ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
 					    dpio_dev->token, sdest);
@@ -211,7 +220,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-	if (dpaa2_dpio_intr_init(dpio_dev)) {
+	if (dpaa2_dpio_intr_init(dpio_dev, lcoreid)) {
 		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
 		return -1;
 	}
@@ -220,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
+struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
 	struct dpaa2_dpio_dev *dpio_dev = NULL;
 	int ret;
@@ -236,7 +245,7 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
 	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu",
 			dpio_dev, dpio_dev->index, syscall(SYS_gettid));
 
-	ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
+	ret = dpaa2_configure_stashing(dpio_dev, lcoreid);
 	if (ret)
 		DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 
@@ -340,6 +349,39 @@ dpaa2_affine_qbman_ethrx_swp(void)
 	}
 }
 
+/*
+ * This checks for not supported lcore mappings as well as get the physical
+ * cpuid for the lcore.
+ * one lcore can only map to 1 cpu i.e. 1@10-14 not supported.
+ * one cpu can be mapped to more than one lcores.
+ */
+static int
+dpaa2_check_lcore_cpuset(void)
+{
+	unsigned int lcore_id, i;
+	int ret = 0;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
+		dpaa2_cpu[lcore_id] = 0xffffffff;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+		for (i = 0; i < RTE_MAX_LCORE; i++) {
+			if (CPU_ISSET(i, &lcore_config[lcore_id].cpuset)) {
+				RTE_LOG(DEBUG, EAL, "lcore id = %u cpu=%u\n",
+					lcore_id, i);
+				if (dpaa2_cpu[lcore_id] != 0xffffffff) {
+					DPAA2_BUS_ERR(
+				    "ERR:lcore map to multi-cpu not supported");
+					ret = -1;
+				} else  {
+					dpaa2_cpu[lcore_id] = i;
+				}
+			}
+		}
+	}
+	return ret;
+}
+
 static int
 dpaa2_create_dpio_device(int vdev_fd,
 			 struct vfio_device_info *obj_info,
@@ -349,6 +391,7 @@ dpaa2_create_dpio_device(int vdev_fd,
 	struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)};
 	struct qbman_swp_desc p_des;
 	struct dpio_attr attr;
+	static int check_lcore_cpuset;
 
 	if (obj_info->num_regions < NUM_DPIO_REGIONS) {
 		DPAA2_BUS_ERR("Not sufficient number of DPIO regions");
@@ -368,6 +411,13 @@ dpaa2_create_dpio_device(int vdev_fd,
 	/* Using single portal  for all devices */
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
+	if (!check_lcore_cpuset) {
+		check_lcore_cpuset = 1;
+
+		if (dpaa2_check_lcore_cpuset() < 0)
+			goto err;
+	}
+
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
 	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 04/20] net/dpaa2: fix bad check for not-null
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
                   ` (2 preceding siblings ...)
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 03/20] bus/fslmc: fix to use correct physical core for logical core Hemant Agrawal
@ 2018-12-27  6:22 ` Hemant Agrawal
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 05/20] bus/fslmc: fix to convert error msg to warning Hemant Agrawal
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

The check !dpaa2->cscn is not correct to check non-null value.

Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index fa71807e6..8d4ea1bca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
 		/* cleanup tx queue cscn */
 		for (i = 0; i < priv->nb_tx_queues; i++) {
 			dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
-			if (!dpaa2_q->cscn)
-				rte_free(dpaa2_q->cscn);
+			rte_free(dpaa2_q->cscn);
 		}
 		/*free memory for all queues (RX+TX) */
 		rte_free(priv->rx_vq[0]);
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 05/20] bus/fslmc: fix to convert error msg to warning
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
                   ` (3 preceding siblings ...)
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 04/20] net/dpaa2: fix bad check for not-null Hemant Agrawal
@ 2018-12-27  6:22 ` Hemant Agrawal
  2018-12-27  6:23 ` [dpdk-stable] [PATCH 06/20] bus/fslmc: fix parse method for bus devices Hemant Agrawal
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:22 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 493b6e5be..ce82a99f6 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -176,7 +176,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group)
 	vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
 		PROT_READ, MAP_SHARED, container_device_fd, 0x6030000);
 	if (vaddr == MAP_FAILED) {
-		DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno);
+		DPAA2_BUS_INFO("Unable to map region (errno = %d)", errno);
 		return -errno;
 	}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 06/20] bus/fslmc: fix parse method for bus devices
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
                   ` (4 preceding siblings ...)
  2018-12-27  6:22 ` [dpdk-stable] [PATCH 05/20] bus/fslmc: fix to convert error msg to warning Hemant Agrawal
@ 2018-12-27  6:23 ` Hemant Agrawal
  2018-12-27  6:23 ` [dpdk-stable] [PATCH 07/20] net/dpaa2: fix device init for secondary process Hemant Agrawal
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

From: Shreyansh Jain <shreyansh.jain@nxp.com>

Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
  dpni.1,key=val
  dpio.2,key=val

when user passed:
  -b fslmc:dpni.1,key=val

This commit fixes this behavior.

Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 89af9385a..565e0148f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016,2018 NXP
  *
  */
 
@@ -227,20 +227,16 @@ static int
 rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
-	char *t_ptr;
-	char *sep = strchr(name, ':');
+	char *t_ptr = NULL, *dname = NULL;
 
-	if (strncmp(name, RTE_STR(FSLMC_BUS_NAME),
-		strlen(RTE_STR(FSLMC_BUS_NAME)))) {
-		return -EINVAL;
-	}
+	/* 'name' is expected to contain name of device, for example, dpio.1,
+	 * dpni.2, etc.
+	 */
 
-	if (!sep) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+	dname = strdup(name);
+	if (!dname)
 		return -EINVAL;
-	}
-
-	t_ptr = (char *)(sep + 1);
+	t_ptr = dname;
 
 	if (strncmp("dpni", t_ptr, 4) &&
 	    strncmp("dpseci", t_ptr, 6) &&
@@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr)
 	    strncmp("dpmcp", t_ptr, 5) &&
 	    strncmp("dpdmai", t_ptr, 6)) {
 		DPAA2_BUS_ERR("Unknown or unsupported device");
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = strchr(name, '.');
 	if (!t_ptr) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = (char *)(t_ptr + 1);
 	if (sscanf(t_ptr, "%hu", &dev_id) <= 0) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
+	free(dname);
 
 	if (addr)
-		strcpy(addr, (char *)(sep + 1));
+		strcpy(addr, name);
+
 	return 0;
+err_out:
+	free(dname);
+	return -EINVAL;
 }
 
 static int
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH 07/20] net/dpaa2: fix device init for secondary process
       [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
                   ` (5 preceding siblings ...)
  2018-12-27  6:23 ` [dpdk-stable] [PATCH 06/20] bus/fslmc: fix parse method for bus devices Hemant Agrawal
@ 2018-12-27  6:23 ` Hemant Agrawal
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
  7 siblings, 0 replies; 21+ messages in thread
From: Hemant Agrawal @ 2018-12-27  6:23 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

In order to support I/O from secondary process, the
burst APIs and OPS APIs shall be mapped/plugged.

Fixes: c147eae01cb3 ("net/dpaa2: introduce NXP DPAA2 driver")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8d4ea1bca..39f85ae7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1918,8 +1918,15 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	PMD_INIT_FUNC_TRACE();
 
 	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		/* In case of secondary, only burst and ops API need to be
+		 * plugged.
+		 */
+		eth_dev->dev_ops = &dpaa2_ethdev_ops;
+		eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
+		eth_dev->tx_pkt_burst = dpaa2_dev_tx;
 		return 0;
+	}
 
 	dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 01/20] bus/fslmc: fix to reset portal memory before use
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
@ 2019-01-11 11:57   ` Shreyansh Jain
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 02/20] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:57 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Sachin Saxena, stable

From: Sachin Saxena <sachin.saxena@nxp.com>

Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ce0699842..4fc6efec5 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -369,6 +369,8 @@ dpaa2_create_dpio_device(int vdev_fd,
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
+	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
+
 	if (!dpio_dev->dpio) {
 		DPAA2_BUS_ERR("Memory allocation failure");
 		goto err;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 02/20] bus/fslmc: fix the ring mode to use correct cache settings
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 01/20] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
@ 2019-01-11 11:57   ` Shreyansh Jain
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 03/20] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:57 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Youri Querry, stable

From: Youri Querry <youri.querry_1@nxp.com>

The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 12 ++++++------
 drivers/bus/fslmc/qbman/qbman_sys.h    |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3380e54f5..bbea37efc 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -683,8 +683,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 				eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -809,8 +809,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -941,8 +941,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index d41af8358..0571097ab 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -55,6 +55,7 @@
 #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
 #define QBMAN_CENA_SWP_VDQCR   0x780
 #define QBMAN_CENA_SWP_EQCR_CI 0x840
+#define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
 
 /* CENA register offsets in memory-backed mode */
 #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 03/20] bus/fslmc: fix to use correct physical core for logical core
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 01/20] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 02/20] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
@ 2019-01-11 11:57   ` Shreyansh Jain
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null Shreyansh Jain
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:57 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.

Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 76 ++++++++++++++++++++----
 1 file changed, 63 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 4fc6efec5..ba2e28ce1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -53,6 +53,10 @@ static uint32_t io_space_count;
 /* Variable to store DPAA2 platform type */
 uint32_t dpaa2_svr_family;
 
+/* Physical core id for lcores running on dpaa2. */
+/* DPAA2 only support 1 lcore to 1 phy cpu mapping */
+static unsigned int dpaa2_cpu[RTE_MAX_LCORE];
+
 /* Variable to store DPAA2 DQRR size */
 uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
@@ -92,7 +96,8 @@ dpaa2_core_cluster_sdest(int cpu_id)
 }
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
+static void
+dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int lcoreid)
 {
 #define STRING_LEN	28
 #define COMMAND_LEN	50
@@ -125,7 +130,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 		return;
 	}
 
-	cpu_mask = cpu_mask << rte_lcore_id();
+	cpu_mask = cpu_mask << dpaa2_cpu[lcoreid];
 	snprintf(command, COMMAND_LEN, "echo %X > /proc/irq/%s/smp_affinity",
 		 cpu_mask, token);
 	ret = system(command);
@@ -139,7 +144,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 	fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	struct epoll_event epoll_ev;
 	int eventfd, dpio_epoll_fd, ret;
@@ -176,32 +181,36 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
 	}
 	dpio_dev->epoll_fd = dpio_epoll_fd;
 
-	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id);
+	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, lcoreid);
 
 	return 0;
 }
 #endif
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	int sdest, ret;
+	int cpu_id;
 
 	/* Set the Stashing Destination */
-	if (cpu_id < 0) {
-		cpu_id = rte_get_master_lcore();
-		if (cpu_id < 0) {
+	if (lcoreid < 0) {
+		lcoreid = rte_get_master_lcore();
+		if (lcoreid < 0) {
 			DPAA2_BUS_ERR("Getting CPU Index failed");
 			return -1;
 		}
 	}
+
+	cpu_id = dpaa2_cpu[lcoreid];
+
 	/* Set the STASH Destination depending on Current CPU ID.
 	 * Valid values of SDEST are 4,5,6,7. Where,
 	 */
 
 	sdest = dpaa2_core_cluster_sdest(cpu_id);
-	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
-			dpio_dev->index, cpu_id, sdest);
+	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u lcore id =%u SDEST= %d",
+			dpio_dev->index, cpu_id, lcoreid, sdest);
 
 	ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
 					    dpio_dev->token, sdest);
@@ -211,7 +220,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-	if (dpaa2_dpio_intr_init(dpio_dev)) {
+	if (dpaa2_dpio_intr_init(dpio_dev, lcoreid)) {
 		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
 		return -1;
 	}
@@ -220,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
+struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
 	struct dpaa2_dpio_dev *dpio_dev = NULL;
 	int ret;
@@ -236,7 +245,7 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
 	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu",
 			dpio_dev, dpio_dev->index, syscall(SYS_gettid));
 
-	ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
+	ret = dpaa2_configure_stashing(dpio_dev, lcoreid);
 	if (ret)
 		DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 
@@ -340,6 +349,39 @@ dpaa2_affine_qbman_ethrx_swp(void)
 	}
 }
 
+/*
+ * This checks for not supported lcore mappings as well as get the physical
+ * cpuid for the lcore.
+ * one lcore can only map to 1 cpu i.e. 1@10-14 not supported.
+ * one cpu can be mapped to more than one lcores.
+ */
+static int
+dpaa2_check_lcore_cpuset(void)
+{
+	unsigned int lcore_id, i;
+	int ret = 0;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
+		dpaa2_cpu[lcore_id] = 0xffffffff;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+		for (i = 0; i < RTE_MAX_LCORE; i++) {
+			if (CPU_ISSET(i, &lcore_config[lcore_id].cpuset)) {
+				RTE_LOG(DEBUG, EAL, "lcore id = %u cpu=%u\n",
+					lcore_id, i);
+				if (dpaa2_cpu[lcore_id] != 0xffffffff) {
+					DPAA2_BUS_ERR(
+				    "ERR:lcore map to multi-cpu not supported");
+					ret = -1;
+				} else  {
+					dpaa2_cpu[lcore_id] = i;
+				}
+			}
+		}
+	}
+	return ret;
+}
+
 static int
 dpaa2_create_dpio_device(int vdev_fd,
 			 struct vfio_device_info *obj_info,
@@ -349,6 +391,7 @@ dpaa2_create_dpio_device(int vdev_fd,
 	struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)};
 	struct qbman_swp_desc p_des;
 	struct dpio_attr attr;
+	static int check_lcore_cpuset;
 
 	if (obj_info->num_regions < NUM_DPIO_REGIONS) {
 		DPAA2_BUS_ERR("Not sufficient number of DPIO regions");
@@ -368,6 +411,13 @@ dpaa2_create_dpio_device(int vdev_fd,
 	/* Using single portal  for all devices */
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
+	if (!check_lcore_cpuset) {
+		check_lcore_cpuset = 1;
+
+		if (dpaa2_check_lcore_cpuset() < 0)
+			goto err;
+	}
+
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
 	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
                     ` (2 preceding siblings ...)
  2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 03/20] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
@ 2019-01-11 11:58   ` Shreyansh Jain
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 05/20] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

The check !dpaa2->cscn is not correct to check non-null value.

Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index fa71807e6..8d4ea1bca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
 		/* cleanup tx queue cscn */
 		for (i = 0; i < priv->nb_tx_queues; i++) {
 			dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
-			if (!dpaa2_q->cscn)
-				rte_free(dpaa2_q->cscn);
+			rte_free(dpaa2_q->cscn);
 		}
 		/*free memory for all queues (RX+TX) */
 		rte_free(priv->rx_vq[0]);
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 05/20] bus/fslmc: fix to convert error msg to warning
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
                     ` (3 preceding siblings ...)
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null Shreyansh Jain
@ 2019-01-11 11:58   ` Shreyansh Jain
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 06/20] bus/fslmc: fix parse method for bus devices Shreyansh Jain
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 493b6e5be..ce82a99f6 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -176,7 +176,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group)
 	vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
 		PROT_READ, MAP_SHARED, container_device_fd, 0x6030000);
 	if (vaddr == MAP_FAILED) {
-		DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno);
+		DPAA2_BUS_INFO("Unable to map region (errno = %d)", errno);
 		return -errno;
 	}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 06/20] bus/fslmc: fix parse method for bus devices
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
                     ` (4 preceding siblings ...)
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 05/20] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
@ 2019-01-11 11:58   ` Shreyansh Jain
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 07/20] net/dpaa2: fix device init for secondary process Shreyansh Jain
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
  dpni.1,key=val
  dpio.2,key=val

when user passed:
  -b fslmc:dpni.1,key=val

This commit fixes this behavior.

Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 89af9385a..565e0148f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016,2018 NXP
  *
  */
 
@@ -227,20 +227,16 @@ static int
 rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
-	char *t_ptr;
-	char *sep = strchr(name, ':');
+	char *t_ptr = NULL, *dname = NULL;
 
-	if (strncmp(name, RTE_STR(FSLMC_BUS_NAME),
-		strlen(RTE_STR(FSLMC_BUS_NAME)))) {
-		return -EINVAL;
-	}
+	/* 'name' is expected to contain name of device, for example, dpio.1,
+	 * dpni.2, etc.
+	 */
 
-	if (!sep) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+	dname = strdup(name);
+	if (!dname)
 		return -EINVAL;
-	}
-
-	t_ptr = (char *)(sep + 1);
+	t_ptr = dname;
 
 	if (strncmp("dpni", t_ptr, 4) &&
 	    strncmp("dpseci", t_ptr, 6) &&
@@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr)
 	    strncmp("dpmcp", t_ptr, 5) &&
 	    strncmp("dpdmai", t_ptr, 6)) {
 		DPAA2_BUS_ERR("Unknown or unsupported device");
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = strchr(name, '.');
 	if (!t_ptr) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = (char *)(t_ptr + 1);
 	if (sscanf(t_ptr, "%hu", &dev_id) <= 0) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
+	free(dname);
 
 	if (addr)
-		strcpy(addr, (char *)(sep + 1));
+		strcpy(addr, name);
+
 	return 0;
+err_out:
+	free(dname);
+	return -EINVAL;
 }
 
 static int
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v2 07/20] net/dpaa2: fix device init for secondary process
       [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
                     ` (5 preceding siblings ...)
  2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 06/20] bus/fslmc: fix parse method for bus devices Shreyansh Jain
@ 2019-01-11 11:58   ` Shreyansh Jain
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
  7 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 11:58 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

In order to support I/O from secondary process, the
burst APIs and OPS APIs shall be mapped/plugged.

Fixes: c147eae01cb3 ("net/dpaa2: introduce NXP DPAA2 driver")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8d4ea1bca..39f85ae7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1918,8 +1918,15 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	PMD_INIT_FUNC_TRACE();
 
 	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		/* In case of secondary, only burst and ops API need to be
+		 * plugged.
+		 */
+		eth_dev->dev_ops = &dpaa2_ethdev_ops;
+		eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
+		eth_dev->tx_pkt_burst = dpaa2_dev_tx;
 		return 0;
+	}
 
 	dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 01/19] bus/fslmc: fix to reset portal memory before use
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 02/19] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
                       ` (5 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Sachin Saxena, stable

From: Sachin Saxena <sachin.saxena@nxp.com>

Uninitialized portal memory is causing unwanted issues.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index ce0699842..4fc6efec5 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -369,6 +369,8 @@ dpaa2_create_dpio_device(int vdev_fd,
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
+	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
+
 	if (!dpio_dev->dpio) {
 		DPAA2_BUS_ERR("Memory allocation failure");
 		goto err;
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 02/19] bus/fslmc: fix the ring mode to use correct cache settings
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 01/19] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 03/19] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
                       ` (4 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Youri Querry, stable

From: Youri Querry <youri.querry_1@nxp.com>

The code was incorrectly using the cache inhibited access.
It shall use cached enabled access for better performance.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 12 ++++++------
 drivers/bus/fslmc/qbman/qbman_sys.h    |  1 +
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 3380e54f5..bbea37efc 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -683,8 +683,8 @@ static int qbman_swp_enqueue_ring_mode_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 				eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -809,8 +809,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
@@ -941,8 +941,8 @@ static int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
 	full_mask = s->eqcr.pi_mask;
 	if (!s->eqcr.available) {
 		eqcr_ci = s->eqcr.ci;
-		s->eqcr.ci = qbman_cinh_read(&s->sys,
-				QBMAN_CENA_SWP_EQCR_CI) & full_mask;
+		s->eqcr.ci = qbman_cena_read_reg(&s->sys,
+				QBMAN_CENA_SWP_EQCR_CI_MEMBACK) & full_mask;
 		s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
 					eqcr_ci, s->eqcr.ci);
 		if (!s->eqcr.available)
diff --git a/drivers/bus/fslmc/qbman/qbman_sys.h b/drivers/bus/fslmc/qbman/qbman_sys.h
index d41af8358..0571097ab 100644
--- a/drivers/bus/fslmc/qbman/qbman_sys.h
+++ b/drivers/bus/fslmc/qbman/qbman_sys.h
@@ -55,6 +55,7 @@
 #define QBMAN_CENA_SWP_RR(vb)  (0x700 + ((uint32_t)(vb) >> 1))
 #define QBMAN_CENA_SWP_VDQCR   0x780
 #define QBMAN_CENA_SWP_EQCR_CI 0x840
+#define QBMAN_CENA_SWP_EQCR_CI_MEMBACK 0x1840
 
 /* CENA register offsets in memory-backed mode */
 #define QBMAN_CENA_SWP_DQRR_MEM(n)  (0x800 + ((uint32_t)(n) << 6))
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 03/19] bus/fslmc: fix to use correct physical core for logical core
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 01/19] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 02/19] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 04/19] net/dpaa2: fix bad check for not-null Shreyansh Jain
                       ` (3 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

Existing code is using the lcore id as the physical core
id. Add code to get the right physical id.

Also, dpaa2 can not support one lcore mapping to multiple cpus,
print err on such cases.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 76 ++++++++++++++++++++----
 1 file changed, 63 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 4fc6efec5..ba2e28ce1 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -53,6 +53,10 @@ static uint32_t io_space_count;
 /* Variable to store DPAA2 platform type */
 uint32_t dpaa2_svr_family;
 
+/* Physical core id for lcores running on dpaa2. */
+/* DPAA2 only support 1 lcore to 1 phy cpu mapping */
+static unsigned int dpaa2_cpu[RTE_MAX_LCORE];
+
 /* Variable to store DPAA2 DQRR size */
 uint8_t dpaa2_dqrr_size;
 /* Variable to store DPAA2 EQCR size */
@@ -92,7 +96,8 @@ dpaa2_core_cluster_sdest(int cpu_id)
 }
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
+static void
+dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id, int lcoreid)
 {
 #define STRING_LEN	28
 #define COMMAND_LEN	50
@@ -125,7 +130,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 		return;
 	}
 
-	cpu_mask = cpu_mask << rte_lcore_id();
+	cpu_mask = cpu_mask << dpaa2_cpu[lcoreid];
 	snprintf(command, COMMAND_LEN, "echo %X > /proc/irq/%s/smp_affinity",
 		 cpu_mask, token);
 	ret = system(command);
@@ -139,7 +144,7 @@ static void dpaa2_affine_dpio_intr_to_respective_core(int32_t dpio_id)
 	fclose(file);
 }
 
-static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
+static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	struct epoll_event epoll_ev;
 	int eventfd, dpio_epoll_fd, ret;
@@ -176,32 +181,36 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev)
 	}
 	dpio_dev->epoll_fd = dpio_epoll_fd;
 
-	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id);
+	dpaa2_affine_dpio_intr_to_respective_core(dpio_dev->hw_id, lcoreid);
 
 	return 0;
 }
 #endif
 
 static int
-dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
+dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int lcoreid)
 {
 	int sdest, ret;
+	int cpu_id;
 
 	/* Set the Stashing Destination */
-	if (cpu_id < 0) {
-		cpu_id = rte_get_master_lcore();
-		if (cpu_id < 0) {
+	if (lcoreid < 0) {
+		lcoreid = rte_get_master_lcore();
+		if (lcoreid < 0) {
 			DPAA2_BUS_ERR("Getting CPU Index failed");
 			return -1;
 		}
 	}
+
+	cpu_id = dpaa2_cpu[lcoreid];
+
 	/* Set the STASH Destination depending on Current CPU ID.
 	 * Valid values of SDEST are 4,5,6,7. Where,
 	 */
 
 	sdest = dpaa2_core_cluster_sdest(cpu_id);
-	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u SDEST= %d",
-			dpio_dev->index, cpu_id, sdest);
+	DPAA2_BUS_DEBUG("Portal= %d  CPU= %u lcore id =%u SDEST= %d",
+			dpio_dev->index, cpu_id, lcoreid, sdest);
 
 	ret = dpio_set_stashing_destination(dpio_dev->dpio, CMD_PRI_LOW,
 					    dpio_dev->token, sdest);
@@ -211,7 +220,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	}
 
 #ifdef RTE_LIBRTE_PMD_DPAA2_EVENTDEV
-	if (dpaa2_dpio_intr_init(dpio_dev)) {
+	if (dpaa2_dpio_intr_init(dpio_dev, lcoreid)) {
 		DPAA2_BUS_ERR("Interrupt registration failed for dpio");
 		return -1;
 	}
@@ -220,7 +229,7 @@ dpaa2_configure_stashing(struct dpaa2_dpio_dev *dpio_dev, int cpu_id)
 	return 0;
 }
 
-struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
+struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int lcoreid)
 {
 	struct dpaa2_dpio_dev *dpio_dev = NULL;
 	int ret;
@@ -236,7 +245,7 @@ struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(int cpu_id)
 	DPAA2_BUS_DEBUG("New Portal %p (%d) affined thread - %lu",
 			dpio_dev, dpio_dev->index, syscall(SYS_gettid));
 
-	ret = dpaa2_configure_stashing(dpio_dev, cpu_id);
+	ret = dpaa2_configure_stashing(dpio_dev, lcoreid);
 	if (ret)
 		DPAA2_BUS_ERR("dpaa2_configure_stashing failed");
 
@@ -340,6 +349,39 @@ dpaa2_affine_qbman_ethrx_swp(void)
 	}
 }
 
+/*
+ * This checks for not supported lcore mappings as well as get the physical
+ * cpuid for the lcore.
+ * one lcore can only map to 1 cpu i.e. 1@10-14 not supported.
+ * one cpu can be mapped to more than one lcores.
+ */
+static int
+dpaa2_check_lcore_cpuset(void)
+{
+	unsigned int lcore_id, i;
+	int ret = 0;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++)
+		dpaa2_cpu[lcore_id] = 0xffffffff;
+
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+		for (i = 0; i < RTE_MAX_LCORE; i++) {
+			if (CPU_ISSET(i, &lcore_config[lcore_id].cpuset)) {
+				RTE_LOG(DEBUG, EAL, "lcore id = %u cpu=%u\n",
+					lcore_id, i);
+				if (dpaa2_cpu[lcore_id] != 0xffffffff) {
+					DPAA2_BUS_ERR(
+				    "ERR:lcore map to multi-cpu not supported");
+					ret = -1;
+				} else  {
+					dpaa2_cpu[lcore_id] = i;
+				}
+			}
+		}
+	}
+	return ret;
+}
+
 static int
 dpaa2_create_dpio_device(int vdev_fd,
 			 struct vfio_device_info *obj_info,
@@ -349,6 +391,7 @@ dpaa2_create_dpio_device(int vdev_fd,
 	struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)};
 	struct qbman_swp_desc p_des;
 	struct dpio_attr attr;
+	static int check_lcore_cpuset;
 
 	if (obj_info->num_regions < NUM_DPIO_REGIONS) {
 		DPAA2_BUS_ERR("Not sufficient number of DPIO regions");
@@ -368,6 +411,13 @@ dpaa2_create_dpio_device(int vdev_fd,
 	/* Using single portal  for all devices */
 	dpio_dev->mc_portal = rte_mcp_ptr_list[MC_PORTAL_INDEX];
 
+	if (!check_lcore_cpuset) {
+		check_lcore_cpuset = 1;
+
+		if (dpaa2_check_lcore_cpuset() < 0)
+			goto err;
+	}
+
 	dpio_dev->dpio = malloc(sizeof(struct fsl_mc_io));
 	memset(dpio_dev->dpio, 0, sizeof(struct fsl_mc_io));
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 04/19] net/dpaa2: fix bad check for not-null
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
                       ` (2 preceding siblings ...)
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 03/19] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 05/19] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
                       ` (2 subsequent siblings)
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

The check !dpaa2->cscn is not correct to check non-null value.

Fixes: 5d9a1e4d23fe ("net/dpaa2: enhance queue memory cleanup")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index fa71807e6..8d4ea1bca 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -311,8 +311,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
 		/* cleanup tx queue cscn */
 		for (i = 0; i < priv->nb_tx_queues; i++) {
 			dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i];
-			if (!dpaa2_q->cscn)
-				rte_free(dpaa2_q->cscn);
+			rte_free(dpaa2_q->cscn);
 		}
 		/*free memory for all queues (RX+TX) */
 		rte_free(priv->rx_vq[0]);
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 05/19] bus/fslmc: fix to convert error msg to warning
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
                       ` (3 preceding siblings ...)
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 04/19] net/dpaa2: fix bad check for not-null Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 06/19] bus/fslmc: fix parse method for bus devices Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 07/19] net/dpaa2: fix device init for secondary process Shreyansh Jain
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Hemant Agrawal, stable

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This is just a information. No need to print
it as a error.

Fixes: ce9efbf5bb09 ("bus/fslmc: support dynamic logging")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 493b6e5be..ce82a99f6 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -176,7 +176,7 @@ static int vfio_map_irq_region(struct fslmc_vfio_group *group)
 	vaddr = (unsigned long *)mmap(NULL, 0x1000, PROT_WRITE |
 		PROT_READ, MAP_SHARED, container_device_fd, 0x6030000);
 	if (vaddr == MAP_FAILED) {
-		DPAA2_BUS_ERR("Unable to map region (errno = %d)", errno);
+		DPAA2_BUS_INFO("Unable to map region (errno = %d)", errno);
 		return -errno;
 	}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 06/19] bus/fslmc: fix parse method for bus devices
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
                       ` (4 preceding siblings ...)
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 05/19] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 07/19] net/dpaa2: fix device init for secondary process Shreyansh Jain
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

Current code expects that bus->parse() would get a string containing
the name of the bus. That is incorrect. bus->parse() is expected
to have strings like:
  dpni.1,key=val
  dpio.2,key=val

when user passed:
  -b fslmc:dpni.1,key=val

This commit fixes this behavior.

Fixes: 50245be05d1a ("bus/fslmc: support device blacklisting")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 89af9385a..565e0148f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2016 NXP
+ *   Copyright 2016,2018 NXP
  *
  */
 
@@ -227,20 +227,16 @@ static int
 rte_fslmc_parse(const char *name, void *addr)
 {
 	uint16_t dev_id;
-	char *t_ptr;
-	char *sep = strchr(name, ':');
+	char *t_ptr = NULL, *dname = NULL;
 
-	if (strncmp(name, RTE_STR(FSLMC_BUS_NAME),
-		strlen(RTE_STR(FSLMC_BUS_NAME)))) {
-		return -EINVAL;
-	}
+	/* 'name' is expected to contain name of device, for example, dpio.1,
+	 * dpni.2, etc.
+	 */
 
-	if (!sep) {
-		DPAA2_BUS_ERR("Incorrect device name observed");
+	dname = strdup(name);
+	if (!dname)
 		return -EINVAL;
-	}
-
-	t_ptr = (char *)(sep + 1);
+	t_ptr = dname;
 
 	if (strncmp("dpni", t_ptr, 4) &&
 	    strncmp("dpseci", t_ptr, 6) &&
@@ -251,24 +247,29 @@ rte_fslmc_parse(const char *name, void *addr)
 	    strncmp("dpmcp", t_ptr, 5) &&
 	    strncmp("dpdmai", t_ptr, 6)) {
 		DPAA2_BUS_ERR("Unknown or unsupported device");
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = strchr(name, '.');
 	if (!t_ptr) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
 
 	t_ptr = (char *)(t_ptr + 1);
 	if (sscanf(t_ptr, "%hu", &dev_id) <= 0) {
 		DPAA2_BUS_ERR("Incorrect device string observed (%s)", t_ptr);
-		return -EINVAL;
+		goto err_out;
 	}
+	free(dname);
 
 	if (addr)
-		strcpy(addr, (char *)(sep + 1));
+		strcpy(addr, name);
+
 	return 0;
+err_out:
+	free(dname);
+	return -EINVAL;
 }
 
 static int
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [dpdk-stable] [PATCH v3 07/19] net/dpaa2: fix device init for secondary process
       [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
                       ` (5 preceding siblings ...)
  2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 06/19] bus/fslmc: fix parse method for bus devices Shreyansh Jain
@ 2019-01-11 12:24     ` Shreyansh Jain
  6 siblings, 0 replies; 21+ messages in thread
From: Shreyansh Jain @ 2019-01-11 12:24 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Shreyansh Jain, stable

In order to support I/O from secondary process, the
burst APIs and OPS APIs shall be mapped/plugged.

Fixes: c147eae01cb3 ("net/dpaa2: introduce NXP DPAA2 driver")
Cc: stable@dpdk.org

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
 drivers/net/dpaa2/dpaa2_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 8d4ea1bca..39f85ae7b 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -1918,8 +1918,15 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
 	PMD_INIT_FUNC_TRACE();
 
 	/* For secondary processes, the primary has done all the work */
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+		/* In case of secondary, only burst and ops API need to be
+		 * plugged.
+		 */
+		eth_dev->dev_ops = &dpaa2_ethdev_ops;
+		eth_dev->rx_pkt_burst = dpaa2_dev_prefetch_rx;
+		eth_dev->tx_pkt_burst = dpaa2_dev_tx;
 		return 0;
+	}
 
 	dpaa2_dev = container_of(dev, struct rte_dpaa2_device, device);
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-01-11 12:24 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20181227062233.30781-1-hemant.agrawal@nxp.com>
2018-12-27  6:22 ` [dpdk-stable] [PATCH 01/20] bus/fslmc: fix to reset portal memory before use Hemant Agrawal
2018-12-27  6:22 ` [dpdk-stable] [PATCH 02/20] bus/fslmc: fix the ring mode to use correct cache settings Hemant Agrawal
2018-12-27  6:22 ` [dpdk-stable] [PATCH 03/20] bus/fslmc: fix to use correct physical core for logical core Hemant Agrawal
2018-12-27  6:22 ` [dpdk-stable] [PATCH 04/20] net/dpaa2: fix bad check for not-null Hemant Agrawal
2018-12-27  6:22 ` [dpdk-stable] [PATCH 05/20] bus/fslmc: fix to convert error msg to warning Hemant Agrawal
2018-12-27  6:23 ` [dpdk-stable] [PATCH 06/20] bus/fslmc: fix parse method for bus devices Hemant Agrawal
2018-12-27  6:23 ` [dpdk-stable] [PATCH 07/20] net/dpaa2: fix device init for secondary process Hemant Agrawal
     [not found] ` <20190111115712.6482-1-shreyansh.jain@nxp.com>
2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 01/20] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 02/20] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
2019-01-11 11:57   ` [dpdk-stable] [PATCH v2 03/20] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 04/20] net/dpaa2: fix bad check for not-null Shreyansh Jain
2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 05/20] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 06/20] bus/fslmc: fix parse method for bus devices Shreyansh Jain
2019-01-11 11:58   ` [dpdk-stable] [PATCH v2 07/20] net/dpaa2: fix device init for secondary process Shreyansh Jain
     [not found]   ` <20190111122305.7133-1-shreyansh.jain@nxp.com>
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 01/19] bus/fslmc: fix to reset portal memory before use Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 02/19] bus/fslmc: fix the ring mode to use correct cache settings Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 03/19] bus/fslmc: fix to use correct physical core for logical core Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 04/19] net/dpaa2: fix bad check for not-null Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 05/19] bus/fslmc: fix to convert error msg to warning Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 06/19] bus/fslmc: fix parse method for bus devices Shreyansh Jain
2019-01-11 12:24     ` [dpdk-stable] [PATCH v3 07/19] net/dpaa2: fix device init for secondary process Shreyansh Jain

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).