DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform
@ 2020-09-11  7:59 Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 1/8] bus/fslmc: fix atomic queues on nxp lx2 platform Sachin Saxena (OSS)
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

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


Apeksha Gupta (1):
  net/dpaa2: fix check for key size

Nipun Gupta (2):
  bus/dpaa: send error packets to application
  net/dpaa: send error packets to application

Rohit Raj (2):
  bus/fslmc: run secondary debug app without blocklist devices
  bus/dpaa: enhance link status support

Sachin Saxena (2):
  bus/dpaa: RX/TX error queues
  bus/fslmc: fix usage of dpio blocklist flag

Youri Querry (1):
  bus/fslmc: fix atomic queues on nxp lx2 platform

 drivers/bus/dpaa/base/fman/fman_hw.c      |  19 ++++
 drivers/bus/dpaa/base/qbman/process.c     | 123 ++++++++++++++++++--
 drivers/bus/dpaa/include/fman.h           |   2 +
 drivers/bus/dpaa/include/fsl_fman.h       |   5 +
 drivers/bus/dpaa/include/process.h        |  34 +++++-
 drivers/bus/dpaa/rte_bus_dpaa_version.map |   5 +
 drivers/bus/fslmc/fslmc_vfio.c            |  66 ++++++++++-
 drivers/bus/fslmc/qbman/qbman_portal.c    |   3 +-
 drivers/net/dpaa/dpaa_ethdev.c            | 133 ++++++++++++++++++----
 drivers/net/dpaa/dpaa_rxtx.c              | 125 ++++++++++++++++----
 drivers/net/dpaa/dpaa_rxtx.h              |  21 +++-
 drivers/net/dpaa2/dpaa2_flow.c            |   2 +-
 12 files changed, 474 insertions(+), 64 deletions(-)

-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 1/8] bus/fslmc: fix atomic queues on nxp lx2 platform
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 2/8] bus/fslmc: run secondary debug app without blocklist devices Sachin Saxena (OSS)
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: stable

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

Traffic was stalling after few packet while running l2fwd-event
in atomic mode on LX2 platform. It was due to wrong dca setting
while enqueuing packets to EQCR.
This patch fixes the issue by writing correct dca setting.

Fixes: 1b49352f41be ("bus/fslmc: rename portal pi index to consumer index")
Cc: stable@dpdk.org

Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 drivers/bus/fslmc/qbman/qbman_portal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fslmc/qbman/qbman_portal.c b/drivers/bus/fslmc/qbman/qbman_portal.c
index 0a2af7be4..77c9d508c 100644
--- a/drivers/bus/fslmc/qbman/qbman_portal.c
+++ b/drivers/bus/fslmc/qbman/qbman_portal.c
@@ -1201,6 +1201,8 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 				QBMAN_CENA_SWP_EQCR(eqcr_pi & half_mask));
 		memcpy(&p[1], &cl[1], 28);
 		memcpy(&p[8], &fd[i], sizeof(*fd));
+		p[0] = cl[0] | s->eqcr.pi_vb;
+
 		if (flags && (flags[i] & QBMAN_ENQUEUE_FLAG_DCA)) {
 			struct qbman_eq_desc *d = (struct qbman_eq_desc *)p;
 
@@ -1208,7 +1210,6 @@ static int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
 				((flags[i]) & QBMAN_EQCR_DCA_IDXMASK);
 		}
 		eqcr_pi++;
-		p[0] = cl[0] | s->eqcr.pi_vb;
 
 		if (!(eqcr_pi & half_mask))
 			s->eqcr.pi_vb ^= QB_VALID_BIT;
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 2/8] bus/fslmc: run secondary debug app without blocklist devices
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 1/8] bus/fslmc: fix atomic queues on nxp lx2 platform Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 3/8] net/dpaa2: fix check for key size Sachin Saxena (OSS)
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit; +Cc: Sachin Saxena

From: Rohit Raj <rohit.raj@nxp.com>

dpaa2 hw impose limits on some HW access devices like DPMCP(Mnagement
control Port) and DPIO (HW portal). This causes issue in their usages in
shared uses in case of multi-process applications. It can overcome by using
allowlist/blocklist in primary and secondary applications.
However it imposes restrictions on standard debugging apps like
dpdk-procinfo, which can be used to debug any existing application.

This patch introduces reserving extra DPMCP and DPIO to be used by
secondary process if devices are not blocked previously in primary
application.
This leaves the last DPMCP and DPIO for the secondary process usages.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
---
 drivers/bus/fslmc/fslmc_vfio.c | 66 +++++++++++++++++++++++++++++++---
 1 file changed, 61 insertions(+), 5 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c
index 9134ec552..6dd797632 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -802,10 +802,29 @@ fslmc_vfio_process_group(void)
 	int ret;
 	int found_mportal = 0;
 	struct rte_dpaa2_device *dev, *dev_temp;
+	bool is_dpmcp_in_blocklist = false, is_dpio_in_blocklist = false;
+	int dpmcp_count = 0, dpio_count = 0, current_device;
+
+	TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+		if (dev->dev_type == DPAA2_MPORTAL) {
+			dpmcp_count++;
+			if (dev->device.devargs &&
+			    dev->device.devargs->policy == RTE_DEV_BLACKLISTED)
+				is_dpmcp_in_blocklist = true;
+		}
+		if (dev->dev_type == DPAA2_IO) {
+			dpio_count++;
+			if (dev->device.devargs &&
+			    dev->device.devargs->policy == RTE_DEV_BLACKLISTED)
+				is_dpmcp_in_blocklist = true;
+		}
+	}
 
 	/* Search the MCP as that should be initialized first. */
+	current_device = 0;
 	TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
 		if (dev->dev_type == DPAA2_MPORTAL) {
+			current_device++;
 			if (dev->device.devargs &&
 			    dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
 				DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
@@ -815,13 +834,24 @@ fslmc_vfio_process_group(void)
 				continue;
 			}
 
-			ret = fslmc_process_mcp(dev);
-			if (ret) {
-				DPAA2_BUS_ERR("Unable to map MC Portal");
-				return -1;
+			if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+			    !is_dpmcp_in_blocklist) {
+				if (dpmcp_count == 1 ||
+				    current_device != dpmcp_count) {
+					TAILQ_REMOVE(&rte_fslmc_bus.device_list,
+						     dev, next);
+					continue;
+				}
 			}
-			if (!found_mportal)
+
+			if (!found_mportal) {
+				ret = fslmc_process_mcp(dev);
+				if (ret) {
+					DPAA2_BUS_ERR("Unable to map MC Portal");
+					return -1;
+				}
 				found_mportal = 1;
+			}
 
 			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
 			free(dev);
@@ -838,7 +868,10 @@ fslmc_vfio_process_group(void)
 		return -1;
 	}
 
+	current_device = 0;
 	TAILQ_FOREACH_SAFE(dev, &rte_fslmc_bus.device_list, next, dev_temp) {
+		if (dev->dev_type == DPAA2_IO)
+			current_device++;
 		if (dev->device.devargs &&
 		    dev->device.devargs->policy == RTE_DEV_BLACKLISTED) {
 			DPAA2_BUS_LOG(DEBUG, "%s Blacklisted, skipping",
@@ -846,6 +879,14 @@ fslmc_vfio_process_group(void)
 			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
 			continue;
 		}
+		if (rte_eal_process_type() == RTE_PROC_SECONDARY &&
+		    dev->dev_type != DPAA2_ETH &&
+		    dev->dev_type != DPAA2_CRYPTO &&
+		    dev->dev_type != DPAA2_QDMA &&
+		    dev->dev_type != DPAA2_IO) {
+			TAILQ_REMOVE(&rte_fslmc_bus.device_list, dev, next);
+			continue;
+		}
 		switch (dev->dev_type) {
 		case DPAA2_ETH:
 		case DPAA2_CRYPTO:
@@ -882,6 +923,21 @@ fslmc_vfio_process_group(void)
 
 			break;
 		case DPAA2_IO:
+			if (!is_dpio_in_blocklist && dpio_count > 1) {
+				if (rte_eal_process_type() == RTE_PROC_SECONDARY
+				    && current_device != dpio_count) {
+					TAILQ_REMOVE(&rte_fslmc_bus.device_list,
+						     dev, next);
+					break;
+				}
+				if (rte_eal_process_type() == RTE_PROC_PRIMARY
+				    && current_device == dpio_count) {
+					TAILQ_REMOVE(&rte_fslmc_bus.device_list,
+						     dev, next);
+					break;
+				}
+			}
+
 			ret = fslmc_process_iodevices(dev);
 			if (ret) {
 				DPAA2_BUS_DEBUG("Dev (%s) init failed",
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 3/8] net/dpaa2: fix check for key size
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 1/8] bus/fslmc: fix atomic queues on nxp lx2 platform Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 2/8] bus/fslmc: run secondary debug app without blocklist devices Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 4/8] bus/dpaa: RX/TX error queues Sachin Saxena (OSS)
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

From: Apeksha Gupta <apeksha.gupta@nxp.com>

DPAA2 has support for raw flow classification, which can
be used for any protocol rules. This change fixes flow
key pattern length match.

Fixes: 3f881f8d6eb0 ("net/dpaa2: support raw flow classification")

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 drivers/net/dpaa2/dpaa2_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 843021335..29f1f2e65 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -2901,7 +2901,7 @@ dpaa2_configure_flow_raw(struct rte_flow *flow,
 	flow->tc_id = group;
 	flow->tc_index = attr->priority;
 
-	if (prev_key_size < spec->length) {
+	if (prev_key_size <= spec->length) {
 		ret = dpaa2_flow_extract_add_raw(&priv->extract.qos_key_extract,
 						 spec->length);
 		if (ret) {
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 4/8] bus/dpaa: RX/TX error queues
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
                   ` (2 preceding siblings ...)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 3/8] net/dpaa2: fix check for key size Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 5/8] bus/fslmc: fix usage of dpio blocklist flag Sachin Saxena (OSS)
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

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

CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=y

1) Enable TX/RX error queues to check the errors.
2) Display error frame information(payload, status, paresr result).

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
---
 drivers/bus/dpaa/base/fman/fman_hw.c      |  19 ++++
 drivers/bus/dpaa/include/fman.h           |   2 +
 drivers/bus/dpaa/include/fsl_fman.h       |   4 +
 drivers/bus/dpaa/rte_bus_dpaa_version.map |   1 +
 drivers/net/dpaa/dpaa_ethdev.c            |  18 +++-
 drivers/net/dpaa/dpaa_rxtx.c              | 108 +++++++++++++++++++---
 6 files changed, 135 insertions(+), 17 deletions(-)

diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c
index 9ab8e835d..4ab49f785 100644
--- a/drivers/bus/dpaa/base/fman/fman_hw.c
+++ b/drivers/bus/dpaa/base/fman/fman_hw.c
@@ -609,3 +609,22 @@ fman_if_discard_rx_errors(struct fman_if *fm_if)
 	fmbm_rfsdm = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsdm;
 	out_be32(fmbm_rfsdm, 0x010EE3F0);
 }
+
+void
+fman_if_receive_rx_errors(struct fman_if *fm_if,
+	unsigned int err_eq)
+{
+	struct __fman_if *__if = container_of(fm_if, struct __fman_if, __if);
+	unsigned int *fmbm_rcfg, *fmbm_rfsdm, *fmbm_rfsem;
+	unsigned int val;
+
+	fmbm_rcfg = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rcfg;
+	fmbm_rfsdm = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsdm;
+	fmbm_rfsem = &((struct rx_bmi_regs *)__if->bmi_map)->fmbm_rfsem;
+
+	val = in_be32(fmbm_rcfg);
+	out_be32(fmbm_rcfg, val | BMI_PORT_CFG_FDOVR);
+
+	out_be32(fmbm_rfsdm, 0);
+	out_be32(fmbm_rfsem, err_eq);
+}
diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h
index dcf408372..f2b0bf91e 100644
--- a/drivers/bus/dpaa/include/fman.h
+++ b/drivers/bus/dpaa/include/fman.h
@@ -226,6 +226,8 @@ struct memac_regs {
 	uint32_t thm;			/**< 0x37C tx messages counter */
 };
 
+#define BMI_PORT_CFG_FDOVR 0x02000000
+
 struct rx_bmi_regs {
 	uint32_t fmbm_rcfg;		/**< Rx Configuration */
 	uint32_t fmbm_rst;		/**< Rx Status */
diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h
index 6c87c8db0..3b759c365 100644
--- a/drivers/bus/dpaa/include/fsl_fman.h
+++ b/drivers/bus/dpaa/include/fsl_fman.h
@@ -151,6 +151,10 @@ void fman_if_set_dnia(struct fman_if *fm_if, uint32_t nia);
 __rte_internal
 void fman_if_discard_rx_errors(struct fman_if *fm_if);
 
+__rte_internal
+void fman_if_receive_rx_errors(struct fman_if *fm_if,
+	unsigned int err_eq);
+
 __rte_internal
 void fman_if_set_mcast_filter_table(struct fman_if *p);
 
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index f47922c6a..5b97b6eb2 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -44,6 +44,7 @@ INTERNAL {
 	fman_if_stats_get_all;
 	fman_if_stats_reset;
 	fman_ip_rev;
+	fman_if_receive_rx_errors;
 	fsl_qman_fq_portal_create;
 	netcfg_acquire;
 	netcfg_release;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index a077b98c3..ccf0bf1e8 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -47,6 +47,7 @@
 #include <fsl_bman.h>
 #include <fsl_fman.h>
 #include <process.h>
+#include <fmlib/fm_ext.h>
 
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
@@ -1895,11 +1896,19 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	dpaa_intf->nb_tx_queues = MAX_DPAA_CORES;
 
 #ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
-	dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+	ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues[
 		DPAA_DEBUG_FQ_RX_ERROR], fman_intf->fqid_rx_err);
+	if (ret) {
+		DPAA_PMD_ERR("DPAA RX ERROR queue init failed!");
+		goto free_tx;
+	}
 	dpaa_intf->debug_queues[DPAA_DEBUG_FQ_RX_ERROR].dpaa_intf = dpaa_intf;
-	dpaa_debug_queue_init(&dpaa_intf->debug_queues[
+	ret = dpaa_debug_queue_init(&dpaa_intf->debug_queues[
 		DPAA_DEBUG_FQ_TX_ERROR], fman_intf->fqid_tx_err);
+	if (ret) {
+		DPAA_PMD_ERR("DPAA TX ERROR queue init failed!");
+		goto free_tx;
+	}
 	dpaa_intf->debug_queues[DPAA_DEBUG_FQ_TX_ERROR].dpaa_intf = dpaa_intf;
 #endif
 
@@ -1945,7 +1954,12 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 
 	if (!fman_intf->is_shared_mac) {
 		/* Disable RX mode */
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+		fman_if_receive_rx_errors(fman_intf,
+			FM_FD_RX_STATUS_ERR_MASK);
+#else
 		fman_if_discard_rx_errors(fman_intf);
+#endif
 		fman_if_disable_rx(fman_intf);
 		/* Disable promiscuous mode */
 		fman_if_promiscuous_disable(fman_intf);
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 5303c9b76..9715f3ce8 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -58,29 +58,57 @@
 		(_fd)->bpid = _bpid; \
 	} while (0)
 
-#if (defined RTE_LIBRTE_DPAA_DEBUG_DRIVER)
-static void dpaa_display_frame(const struct qm_fd *fd)
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+#define DISPLAY_PRINT printf
+static void dpaa_display_frame_info(const struct qm_fd *fd,
+			uint32_t fqid, bool rx)
 {
 	int ii;
 	char *ptr;
+	struct annotations_t *annot = rte_dpaa_mem_ptov(fd->addr);
+	uint8_t format;
+
+	if (!fd->status) {
+		/* Do not display correct packets.*/
+		return;
+	}
 
-	printf("%s::bpid %x addr %08x%08x, format %d off %d, len %d stat %x\n",
-	       __func__, fd->bpid, fd->addr_hi, fd->addr_lo, fd->format,
+	format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
+				DPAA_FD_FORMAT_SHIFT;
+
+	DISPLAY_PRINT(
+		"fqid %d bpid %d addr 0x%lx, format %d off %d, len %d stat 0x%x\r\n",
+		fqid, fd->bpid, (unsigned long)fd->addr, fd->format,
 		fd->offset, fd->length20, fd->status);
+	if (rx) {
+		ptr = (char *)&annot->parse;
+		DISPLAY_PRINT("RX parser result:\r\n");
+		for (ii = 0; ii < (int)sizeof(struct dpaa_eth_parse_results_t);
+			ii++) {
+			DISPLAY_PRINT("%02x ", ptr[ii]);
+			if (((ii + 1) % 16) == 0)
+				DISPLAY_PRINT("\n");
+		}
+		DISPLAY_PRINT("\n");
+	}
 
-	ptr = (char *)rte_dpaa_mem_ptov(fd->addr);
+	if (unlikely(format == qm_fd_sg)) {
+		/*TBD:S/G display: to be implemented*/
+		return;
+	}
+
+	DISPLAY_PRINT("Frame payload:\r\n");
+	ptr = (char *)annot;
 	ptr += fd->offset;
-	printf("%02x ", *ptr);
-	for (ii = 1; ii < fd->length20; ii++) {
-		printf("%02x ", *ptr);
-		if ((ii % 16) == 0)
+	for (ii = 0; ii < fd->length20; ii++) {
+		DISPLAY_PRINT("%02x ", ptr[ii]);
+		if (((ii + 1) % 16) == 0)
 			printf("\n");
-		ptr++;
 	}
-	printf("\n");
+	DISPLAY_PRINT("\n");
 }
 #else
-#define dpaa_display_frame(a)
+#define dpaa_display_frame_info(a, b, c)
 #endif
 
 static inline void dpaa_slow_parsing(struct rte_mbuf *m __rte_unused,
@@ -377,7 +405,6 @@ dpaa_eth_fd_to_mbuf(const struct qm_fd *fd, uint32_t ifid)
 	DPAA_DP_LOG(DEBUG, " FD--->MBUF off %d len = %d", offset, length);
 
 	/* Ignoring case when format != qm_fd_contig */
-	dpaa_display_frame(fd);
 	ptr = DPAA_MEMPOOL_PTOV(bp_info, qm_fd_addr(fd));
 
 	mbuf = (struct rte_mbuf *)((char *)ptr - bp_info->meta_data_size);
@@ -492,7 +519,6 @@ dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
 
 		fd = &dqrr[i]->fd;
 		dpaa_intf = fq[0]->dpaa_intf;
-
 		format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
 				DPAA_FD_FORMAT_SHIFT;
 		if (unlikely(format == qm_fd_sg)) {
@@ -515,6 +541,7 @@ dpaa_rx_cb_no_prefetch(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
 		mbuf->next = NULL;
 		rte_mbuf_refcnt_set(mbuf, 1);
 		dpaa_eth_packet_info(mbuf, mbuf->buf_addr);
+		dpaa_display_frame_info(fd, fq[0]->fqid, true);
 	}
 }
 
@@ -532,7 +559,6 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
 	for (i = 0; i < num_bufs; i++) {
 		fd = &dqrr[i]->fd;
 		dpaa_intf = fq[0]->dpaa_intf;
-
 		format = (fd->opaque & DPAA_FD_FORMAT_MASK) >>
 				DPAA_FD_FORMAT_SHIFT;
 		if (unlikely(format == qm_fd_sg)) {
@@ -555,6 +581,7 @@ dpaa_rx_cb(struct qman_fq **fq, struct qm_dqrr_entry **dqrr,
 		mbuf->next = NULL;
 		rte_mbuf_refcnt_set(mbuf, 1);
 		dpaa_eth_packet_info(mbuf, mbuf->buf_addr);
+		dpaa_display_frame_info(fd, fq[0]->fqid, true);
 	}
 }
 
@@ -653,6 +680,51 @@ dpaa_rx_cb_atomic(void *event,
 	return qman_cb_dqrr_defer;
 }
 
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+static inline void dpaa_eth_err_queue(
+	struct dpaa_if *dpaa_intf)
+{
+	struct rte_mbuf *mbuf;
+	struct qman_fq *debug_fq;
+	int ret, i;
+	struct qm_dqrr_entry *dq;
+	struct qm_fd *fd;
+
+	if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+		ret = rte_dpaa_portal_init((void *)0);
+		if (ret) {
+			DPAA_PMD_ERR("Failure in affining portal");
+			return;
+		}
+	}
+	for (i = 0; i <= DPAA_DEBUG_FQ_TX_ERROR; i++) {
+		debug_fq = &dpaa_intf->debug_queues[i];
+		ret = qman_set_vdq(debug_fq, 4, QM_VDQCR_EXACT);
+		if (ret)
+			return;
+
+		do {
+			dq = qman_dequeue(debug_fq);
+			if (!dq)
+				continue;
+			fd = &dq->fd;
+			if (i == DPAA_DEBUG_FQ_RX_ERROR)
+				DPAA_PMD_ERR("RX ERROR status: 0x%08x",
+					fd->status);
+			else
+				DPAA_PMD_ERR("TX ERROR status: 0x%08x",
+					fd->status);
+			dpaa_display_frame_info(fd, debug_fq->fqid,
+				i == DPAA_DEBUG_FQ_RX_ERROR);
+
+			mbuf = dpaa_eth_fd_to_mbuf(fd, dpaa_intf->ifid);
+			rte_pktmbuf_free(mbuf);
+			qman_dqrr_consume(debug_fq, dq);
+		} while (debug_fq->flags & QMAN_FQ_STATE_VDQCR);
+	}
+}
+#endif
+
 uint16_t dpaa_eth_queue_rx(void *q,
 			   struct rte_mbuf **bufs,
 			   uint16_t nb_bufs)
@@ -667,6 +739,11 @@ uint16_t dpaa_eth_queue_rx(void *q,
 				rte_eal_process_type() == RTE_PROC_SECONDARY))
 		rte_dpaa_bpid_info = fq->bp_array;
 
+#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+	if (fq->fqid == ((struct dpaa_if *)fq->dpaa_intf)->rx_queues[0].fqid)
+		dpaa_eth_err_queue((struct dpaa_if *)fq->dpaa_intf);
+#endif
+
 	if (likely(fq->is_static))
 		return dpaa_eth_queue_portal_rx(fq, bufs, nb_bufs);
 
@@ -699,6 +776,7 @@ uint16_t dpaa_eth_queue_rx(void *q,
 		if (!dq)
 			continue;
 		bufs[num_rx++] = dpaa_eth_fd_to_mbuf(&dq->fd, ifid);
+		dpaa_display_frame_info(&dq->fd, fq->fqid, true);
 		qman_dqrr_consume(fq, dq);
 	} while (fq->flags & QMAN_FQ_STATE_VDQCR);
 
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 5/8] bus/fslmc: fix usage of dpio blocklist flag
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
                   ` (3 preceding siblings ...)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 4/8] bus/dpaa: RX/TX error queues Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 6/8] bus/dpaa: enhance link status support Sachin Saxena (OSS)
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

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

DPIO object shouldn't be reserved if it is mentioned in blocklist.
Exiting code is not setting the correct flag when such object is found.

Fixes: c904a212646a ("bus/fslmc: run secondary debug app without blocklist devices")

Signed-off-by: Sachin Saxena <sachin.saxena@oss.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 6dd797632..83df83373 100644
--- a/drivers/bus/fslmc/fslmc_vfio.c
+++ b/drivers/bus/fslmc/fslmc_vfio.c
@@ -816,7 +816,7 @@ fslmc_vfio_process_group(void)
 			dpio_count++;
 			if (dev->device.devargs &&
 			    dev->device.devargs->policy == RTE_DEV_BLACKLISTED)
-				is_dpmcp_in_blocklist = true;
+				is_dpio_in_blocklist = true;
 		}
 	}
 
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 6/8] bus/dpaa: enhance link status support
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
                   ` (4 preceding siblings ...)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 5/8] bus/fslmc: fix usage of dpio blocklist flag Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 7/8] bus/dpaa: send error packets to application Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 8/8] net/dpaa: " Sachin Saxena (OSS)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

From: Rohit Raj <rohit.raj@nxp.com>

This patch adds support to get/set link speed, duplex and
autoneg mode status from/to PHY. Enahnce device capabilities
to advertise all supported link speeds according to mac type.

Also enables fallback support for get link status api where
kernel support is mssing.

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 drivers/bus/dpaa/base/qbman/process.c     | 123 +++++++++++++++++++---
 drivers/bus/dpaa/include/process.h        |  34 +++++-
 drivers/bus/dpaa/rte_bus_dpaa_version.map |   3 +
 drivers/net/dpaa/dpaa_ethdev.c            | 113 ++++++++++++++++----
 4 files changed, 241 insertions(+), 32 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 6f7e37957..9bc92681c 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -8,6 +8,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
+#include <rte_ethdev.h>
 
 #include "process.h"
 
@@ -341,30 +342,78 @@ int dpaa_intr_disable(char *if_name)
 	return 0;
 }
 
+#define DPAA_IOCTL_GET_IOCTL_VERSION \
+	_IOR(DPAA_IOCTL_MAGIC, 0x14, int)
+
+int dpaa_get_ioctl_version_number(void)
+{
+	int version_num, ret = check_fd();
+
+	if (ret)
+		return ret;
+
+	ret = ioctl(fd, DPAA_IOCTL_GET_IOCTL_VERSION, &version_num);
+	if (ret) {
+		if (errno == EINVAL) {
+			version_num = 1;
+		} else {
+			printf("Failed to get ioctl version number\n");
+			version_num = -1;
+		}
+	}
+
+	return version_num;
+}
+
 #define DPAA_IOCTL_GET_LINK_STATUS \
 	_IOWR(DPAA_IOCTL_MAGIC, 0x10, struct usdpaa_ioctl_link_status_args)
 
-int dpaa_get_link_status(char *if_name)
+#define DPAA_IOCTL_GET_LINK_STATUS_OLD \
+	_IOWR(DPAA_IOCTL_MAGIC, 0x10, struct usdpaa_ioctl_link_status_args_old)
+
+
+int dpaa_get_link_status(char *if_name, struct rte_eth_link *link)
 {
-	int ret = check_fd();
-	struct usdpaa_ioctl_link_status_args args;
+	int ioctl_version, ret = check_fd();
 
 	if (ret)
 		return ret;
 
-	strcpy(args.if_name, if_name);
-	args.link_status = 0;
+	ioctl_version = dpaa_get_ioctl_version_number();
 
-	ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS, &args);
-	if (ret) {
-		if (errno == EINVAL)
-			printf("Failed to get link status: Not Supported\n");
-		else
+	if (ioctl_version == 2) {
+		struct usdpaa_ioctl_link_status_args args;
+
+		strcpy(args.if_name, if_name);
+
+		ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS, &args);
+		if (ret) {
 			printf("Failed to get link status\n");
-		return ret;
+			return ret;
+		}
+
+		link->link_status = args.link_status;
+		link->link_speed = args.link_speed;
+		link->link_duplex = args.link_duplex;
+		link->link_autoneg = args.link_autoneg;
+	} else {
+		struct usdpaa_ioctl_link_status_args_old args;
+
+		strcpy(args.if_name, if_name);
+
+		ret = ioctl(fd, DPAA_IOCTL_GET_LINK_STATUS_OLD, &args);
+		if (ret) {
+			if (errno == EINVAL)
+				printf("Get link status: Not Supported\n");
+			else
+				printf("Failed to get link status\n");
+			return ret;
+		}
+
+		link->link_status = args.link_status;
 	}
 
-	return args.link_status;
+	return 0;
 }
 
 #define DPAA_IOCTL_UPDATE_LINK_STATUS \
@@ -393,3 +442,53 @@ int dpaa_update_link_status(char *if_name, int link_status)
 
 	return 0;
 }
+
+#define DPAA_IOCTL_UPDATE_LINK_SPEED \
+	_IOW(DPAA_IOCTL_MAGIC, 0x12, struct usdpaa_ioctl_update_link_speed)
+
+int dpaa_update_link_speed(char *if_name, int link_speed, int link_duplex)
+{
+	struct usdpaa_ioctl_update_link_speed args;
+	int ret;
+
+	ret = check_fd();
+	if (ret)
+		return ret;
+
+	strcpy(args.if_name, if_name);
+	args.link_speed = link_speed;
+	args.link_duplex = link_duplex;
+
+	ret = ioctl(fd, DPAA_IOCTL_UPDATE_LINK_SPEED, &args);
+	if (ret) {
+		if (errno == EINVAL)
+			printf("Failed to set link speed: Not Supported\n");
+		else
+			printf("Failed to set link speed\n");
+		return ret;
+	}
+
+	return ret;
+}
+
+#define DPAA_IOCTL_RESTART_LINK_AUTONEG \
+	_IOW(DPAA_IOCTL_MAGIC, 0x13, char *)
+
+int dpaa_restart_link_autoneg(char *if_name)
+{
+	int ret = check_fd();
+
+	if (ret)
+		return ret;
+
+	ret = ioctl(fd, DPAA_IOCTL_RESTART_LINK_AUTONEG, &if_name);
+	if (ret) {
+		if (errno == EINVAL)
+			printf("Failed to restart autoneg: Not Supported\n");
+		else
+			printf("Failed to restart autoneg\n");
+		return ret;
+	}
+
+	return ret;
+}
diff --git a/drivers/bus/dpaa/include/process.h b/drivers/bus/dpaa/include/process.h
index f52ea1635..be52e6f72 100644
--- a/drivers/bus/dpaa/include/process.h
+++ b/drivers/bus/dpaa/include/process.h
@@ -10,6 +10,7 @@
 #define	__PROCESS_H
 
 #include <compat.h>
+#include <rte_ethdev.h>
 
 /* The process device underlies process-wide user/kernel interactions, such as
  * mapping dma_mem memory and providing accompanying ioctl()s. (This isn't used
@@ -86,10 +87,25 @@ int dpaa_intr_enable(char *if_name, int efd);
 __rte_internal
 int dpaa_intr_disable(char *if_name);
 
+struct usdpaa_ioctl_link_status_args_old {
+	/* network device node name */
+	char    if_name[IF_NAME_MAX_LEN];
+	/* link status(ETH_LINK_UP/DOWN) */
+	int     link_status;
+};
+
 struct usdpaa_ioctl_link_status_args {
 	/* network device node name */
 	char    if_name[IF_NAME_MAX_LEN];
+	/* link status(ETH_LINK_UP/DOWN) */
 	int     link_status;
+	/* link speed (ETH_SPEED_NUM_)*/
+	int     link_speed;
+	/* link duplex (ETH_LINK_[HALF/FULL]_DUPLEX)*/
+	int     link_duplex;
+	/* link autoneg (ETH_LINK_AUTONEG/FIXED)*/
+	int     link_autoneg;
+
 };
 
 struct usdpaa_ioctl_update_link_status_args {
@@ -99,10 +115,24 @@ struct usdpaa_ioctl_update_link_status_args {
 	int     link_status;
 };
 
-__rte_internal
-int dpaa_get_link_status(char *if_name);
+struct usdpaa_ioctl_update_link_speed {
+	/* network device node name*/
+	char    if_name[IF_NAME_MAX_LEN];
+	/* link speed (ETH_SPEED_NUM_)*/
+	int     link_speed;
+	/* link duplex (ETH_LINK_[HALF/FULL]_DUPLEX)*/
+	int     link_duplex;
+};
 
+__rte_internal
+int dpaa_get_link_status(char *if_name, struct rte_eth_link *link);
 __rte_internal
 int dpaa_update_link_status(char *if_name, int link_status);
+__rte_internal
+int dpaa_update_link_speed(char *if_name, int speed, int duplex);
+__rte_internal
+int dpaa_restart_link_autoneg(char *if_name);
+__rte_internal
+int dpaa_get_ioctl_version_number(void);
 
 #endif	/*  __PROCESS_H */
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index 5b97b6eb2..26436e9fe 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -8,10 +8,13 @@ INTERNAL {
 	bman_query_free_buffers;
 	bman_release;
 	bman_thread_irq;
+	dpaa_get_ioctl_version_number;
 	dpaa_get_eth_port_cfg;
 	dpaa_get_qm_channel_caam;
 	dpaa_get_qm_channel_pool;
 	dpaa_get_link_status;
+	dpaa_restart_link_autoneg;
+	dpaa_update_link_speed;
 	dpaa_intr_disable;
 	dpaa_intr_enable;
 	dpaa_svr_family;
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index ccf0bf1e8..0c76fa610 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -205,10 +205,12 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	uint64_t rx_offloads = eth_conf->rxmode.offloads;
 	uint64_t tx_offloads = eth_conf->txmode.offloads;
 	struct rte_device *rdev = dev->device;
+	struct rte_eth_link *link = &dev->data->dev_link;
 	struct rte_dpaa_device *dpaa_dev;
 	struct fman_if *fif = dev->process_private;
 	struct __fman_if *__fif;
 	struct rte_intr_handle *intr_handle;
+	int speed, duplex;
 	int ret;
 
 	PMD_INIT_FUNC_TRACE();
@@ -292,6 +294,60 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 			dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC;
 		}
 	}
+
+	/* Wait for link status to get updated */
+	if (!link->link_status)
+		sleep(1);
+
+	/* Configure link only if link is UP*/
+	if (link->link_status) {
+		if (eth_conf->link_speeds == ETH_LINK_SPEED_AUTONEG) {
+			/* Start autoneg only if link is not in autoneg mode */
+			if (!link->link_autoneg)
+				dpaa_restart_link_autoneg(__fif->node_name);
+		} else if (eth_conf->link_speeds & ETH_LINK_SPEED_FIXED) {
+			switch (eth_conf->link_speeds & ~ETH_LINK_SPEED_FIXED) {
+			case ETH_LINK_SPEED_10M_HD:
+				speed = ETH_SPEED_NUM_10M;
+				duplex = ETH_LINK_HALF_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_10M:
+				speed = ETH_SPEED_NUM_10M;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_100M_HD:
+				speed = ETH_SPEED_NUM_100M;
+				duplex = ETH_LINK_HALF_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_100M:
+				speed = ETH_SPEED_NUM_100M;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_1G:
+				speed = ETH_SPEED_NUM_1G;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_2_5G:
+				speed = ETH_SPEED_NUM_2_5G;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			case ETH_LINK_SPEED_10G:
+				speed = ETH_SPEED_NUM_10G;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			default:
+				speed = ETH_SPEED_NUM_NONE;
+				duplex = ETH_LINK_FULL_DUPLEX;
+				break;
+			}
+			/* Set link speed */
+			dpaa_update_link_speed(__fif->node_name, speed, duplex);
+		} else {
+			/* Manual autoneg - custom advertisement speed. */
+			printf("Custom Advertisement speeds not supported\n");
+		}
+	}
+
 	return 0;
 }
 
@@ -377,6 +433,7 @@ static void dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_device *rdev = dev->device;
 	struct rte_dpaa_device *dpaa_dev;
 	struct rte_intr_handle *intr_handle;
+	struct rte_eth_link *link = &dev->data->dev_link;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -386,6 +443,10 @@ static void dpaa_eth_dev_close(struct rte_eth_dev *dev)
 
 	dpaa_eth_dev_stop(dev);
 
+	/* Reset link to autoneg */
+	if (link->link_status && !link->link_autoneg)
+		dpaa_restart_link_autoneg(__fif->node_name);
+
 	if (intr_handle && intr_handle->fd &&
 	    dev->data->dev_conf.intr_conf.lsc != 0) {
 		dpaa_intr_disable(__fif->node_name);
@@ -446,12 +507,24 @@ static int dpaa_eth_dev_info(struct rte_eth_dev *dev,
 	dev_info->flow_type_rss_offloads = DPAA_RSS_OFFLOAD_ALL;
 
 	if (fif->mac_type == fman_mac_1g) {
-		dev_info->speed_capa = ETH_LINK_SPEED_1G;
+		dev_info->speed_capa = ETH_LINK_SPEED_10M_HD
+					| ETH_LINK_SPEED_10M
+					| ETH_LINK_SPEED_100M_HD
+					| ETH_LINK_SPEED_100M
+					| ETH_LINK_SPEED_1G;
 	} else if (fif->mac_type == fman_mac_2_5g) {
-		dev_info->speed_capa = ETH_LINK_SPEED_1G
+		dev_info->speed_capa = ETH_LINK_SPEED_10M_HD
+					| ETH_LINK_SPEED_10M
+					| ETH_LINK_SPEED_100M_HD
+					| ETH_LINK_SPEED_100M
+					| ETH_LINK_SPEED_1G
 					| ETH_LINK_SPEED_2_5G;
 	} else if (fif->mac_type == fman_mac_10g) {
-		dev_info->speed_capa = ETH_LINK_SPEED_1G
+		dev_info->speed_capa = ETH_LINK_SPEED_10M_HD
+					| ETH_LINK_SPEED_10M
+					| ETH_LINK_SPEED_100M_HD
+					| ETH_LINK_SPEED_100M
+					| ETH_LINK_SPEED_1G
 					| ETH_LINK_SPEED_2_5G
 					| ETH_LINK_SPEED_10G;
 	} else {
@@ -548,31 +621,35 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev,
 	struct rte_eth_link *link = &dev->data->dev_link;
 	struct fman_if *fif = dev->process_private;
 	struct __fman_if *__fif = container_of(fif, struct __fman_if, __if);
-	int ret;
+	int ret, ioctl_version;
 
 	PMD_INIT_FUNC_TRACE();
 
-	if (fif->mac_type == fman_mac_1g)
-		link->link_speed = ETH_SPEED_NUM_1G;
-	else if (fif->mac_type == fman_mac_2_5g)
-		link->link_speed = ETH_SPEED_NUM_2_5G;
-	else if (fif->mac_type == fman_mac_10g)
-		link->link_speed = ETH_SPEED_NUM_10G;
-	else
-		DPAA_PMD_ERR("invalid link_speed: %s, %d",
-			     dpaa_intf->name, fif->mac_type);
+	ioctl_version = dpaa_get_ioctl_version_number();
+
 
 	if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) {
-		ret = dpaa_get_link_status(__fif->node_name);
-		if (ret < 0)
+		ret = dpaa_get_link_status(__fif->node_name, link);
+		if (ret)
 			return ret;
-		link->link_status = ret;
 	} else {
 		link->link_status = dpaa_intf->valid;
 	}
 
-	link->link_duplex = ETH_LINK_FULL_DUPLEX;
-	link->link_autoneg = ETH_LINK_AUTONEG;
+	if (ioctl_version < 2) {
+		link->link_duplex = ETH_LINK_FULL_DUPLEX;
+		link->link_autoneg = ETH_LINK_AUTONEG;
+
+		if (fif->mac_type == fman_mac_1g)
+			link->link_speed = ETH_SPEED_NUM_1G;
+		else if (fif->mac_type == fman_mac_2_5g)
+			link->link_speed = ETH_SPEED_NUM_2_5G;
+		else if (fif->mac_type == fman_mac_10g)
+			link->link_speed = ETH_SPEED_NUM_10G;
+		else
+			DPAA_PMD_ERR("invalid link_speed: %s, %d",
+				     dpaa_intf->name, fif->mac_type);
+	}
 
 	DPAA_PMD_INFO("Port %d Link is %s\n", dev->data->port_id,
 		      link->link_status ? "Up" : "Down");
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 7/8] bus/dpaa: send error packets to application
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
                   ` (5 preceding siblings ...)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 6/8] bus/dpaa: enhance link status support Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 8/8] net/dpaa: " Sachin Saxena (OSS)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

From: Nipun Gupta <nipun.gupta@nxp.com>

Api fman_if_set_err_fqid should be marked as internal.

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/dpaa/include/fsl_fman.h       | 1 +
 drivers/bus/dpaa/rte_bus_dpaa_version.map | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/bus/dpaa/include/fsl_fman.h b/drivers/bus/dpaa/include/fsl_fman.h
index 3b759c365..a3cf77f0e 100644
--- a/drivers/bus/dpaa/include/fsl_fman.h
+++ b/drivers/bus/dpaa/include/fsl_fman.h
@@ -111,6 +111,7 @@ __rte_internal
 int fman_if_set_fc_quanta(struct fman_if *fm_if, u16 pause_quanta);
 
 /* Set default error fqid on specific interface */
+__rte_internal
 void fman_if_set_err_fqid(struct fman_if *fm_if, uint32_t err_fqid);
 
 /* Get IC transfer params */
diff --git a/drivers/bus/dpaa/rte_bus_dpaa_version.map b/drivers/bus/dpaa/rte_bus_dpaa_version.map
index 26436e9fe..9bd260121 100644
--- a/drivers/bus/dpaa/rte_bus_dpaa_version.map
+++ b/drivers/bus/dpaa/rte_bus_dpaa_version.map
@@ -36,6 +36,7 @@ INTERNAL {
 	fman_if_promiscuous_enable;
 	fman_if_reset_mcast_filter_table;
 	fman_if_set_bp;
+	fman_if_set_err_fqid;
 	fman_if_set_fc_quanta;
 	fman_if_set_fc_threshold;
 	fman_if_set_fdoff;
-- 
2.28.0


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

* [dpdk-dev] [PATCH v1 8/8] net/dpaa: send error packets to application
  2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
                   ` (6 preceding siblings ...)
  2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 7/8] bus/dpaa: send error packets to application Sachin Saxena (OSS)
@ 2020-09-11  7:59 ` Sachin Saxena (OSS)
  7 siblings, 0 replies; 9+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-11  7:59 UTC (permalink / raw)
  To: dev, ferruh.yigit

From: Nipun Gupta <nipun.gupta@nxp.com>

Send error packets to main queue (rx) to make application
enable to receive error packets.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 10 ++++------
 drivers/net/dpaa/dpaa_rxtx.c   | 17 +++++++++++++----
 drivers/net/dpaa/dpaa_rxtx.h   | 21 +++++++++++++++++++--
 3 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 0c76fa610..d0ac2f987 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -1068,7 +1068,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
 				rxq->fqid, ret);
 		}
 	}
-
+	/* Enable main queue to receive error packets also by default */
+	fman_if_set_err_fqid(fif, rxq->fqid);
 	return 0;
 }
 
@@ -2030,13 +2031,10 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		fman_intf->mac_addr.addr_bytes[5]);
 
 	if (!fman_intf->is_shared_mac) {
-		/* Disable RX mode */
-#ifdef RTE_LIBRTE_DPAA_DEBUG_DRIVER
+		/* Configure error packet handling */
 		fman_if_receive_rx_errors(fman_intf,
 			FM_FD_RX_STATUS_ERR_MASK);
-#else
-		fman_if_discard_rx_errors(fman_intf);
-#endif
+		/* Disable RX mode */
 		fman_if_disable_rx(fman_intf);
 		/* Disable promiscuous mode */
 		fman_if_promiscuous_disable(fman_intf);
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index 9715f3ce8..7aadf8b08 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -125,6 +125,9 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 
 	DPAA_DP_LOG(DEBUG, " Parsing mbuf: %p with annotations: %p", m, annot);
 
+	m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_GOOD |
+		PKT_RX_L4_CKSUM_GOOD;
+
 	switch (prs) {
 	case DPAA_PKT_TYPE_IPV4:
 		m->packet_type = RTE_PTYPE_L2_ETHER |
@@ -199,6 +202,16 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 		m->packet_type = RTE_PTYPE_L2_ETHER |
 			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_SCTP;
 		break;
+	case DPAA_PKT_TYPE_IPV4_CSUM_ERR:
+	case DPAA_PKT_TYPE_IPV6_CSUM_ERR:
+		m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_BAD;
+		break;
+	case DPAA_PKT_TYPE_IPV4_TCP_CSUM_ERR:
+	case DPAA_PKT_TYPE_IPV6_TCP_CSUM_ERR:
+	case DPAA_PKT_TYPE_IPV4_UDP_CSUM_ERR:
+	case DPAA_PKT_TYPE_IPV6_UDP_CSUM_ERR:
+		m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_L4_CKSUM_BAD;
+		break;
 	case DPAA_PKT_TYPE_NONE:
 		m->packet_type = 0;
 		break;
@@ -213,10 +226,6 @@ static inline void dpaa_eth_packet_info(struct rte_mbuf *m, void *fd_virt_addr)
 
 	/* Set the hash values */
 	m->hash.rss = (uint32_t)(annot->hash);
-	/* All packets with Bad checksum are dropped by interface (and
-	 * corresponding notification issued to RX error queues).
-	 */
-	m->ol_flags = PKT_RX_RSS_HASH | PKT_RX_IP_CKSUM_GOOD;
 
 	/* Check if Vlan is present */
 	if (prs & DPAA_PARSE_VLAN_MASK)
diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
index fe8eb6dc7..d9d7e04f5 100644
--- a/drivers/net/dpaa/dpaa_rxtx.h
+++ b/drivers/net/dpaa/dpaa_rxtx.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2017 NXP
+ *   Copyright 2017,2020 NXP
  *
  */
 
@@ -61,7 +61,7 @@
  *		0x8000 - Ethernet type
  *	ShimR & Logical Port ID 0x0000
  */
-#define DPAA_PARSE_MASK			0x00E044ED00800000
+#define DPAA_PARSE_MASK			0x00F044EF00800000
 #define DPAA_PARSE_VLAN_MASK		0x0000000000700000
 
 /* Parsed values (Little Endian) */
@@ -137,6 +137,23 @@
 			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_4_6)
 #define DPAA_PKT_TYPE_TUNNEL_6_4_TCP \
 			(0x0020000000000000 | DPAA_PKT_TYPE_TUNNEL_6_4)
+
+/* Checksum Errors */
+#define DPAA_PKT_IP_CSUM_ERR		0x0000400200000000
+#define DPAA_PKT_L4_CSUM_ERR		0x0010000000000000
+#define DPAA_PKT_TYPE_IPV4_CSUM_ERR \
+			(DPAA_PKT_IP_CSUM_ERR | DPAA_PKT_TYPE_IPV4)
+#define DPAA_PKT_TYPE_IPV6_CSUM_ERR \
+			(DPAA_PKT_IP_CSUM_ERR | DPAA_PKT_TYPE_IPV6)
+#define DPAA_PKT_TYPE_IPV4_TCP_CSUM_ERR \
+			(DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV4_TCP)
+#define DPAA_PKT_TYPE_IPV6_TCP_CSUM_ERR \
+			(DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV6_TCP)
+#define DPAA_PKT_TYPE_IPV4_UDP_CSUM_ERR \
+			(DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV4_UDP)
+#define DPAA_PKT_TYPE_IPV6_UDP_CSUM_ERR \
+			(DPAA_PKT_L4_CSUM_ERR | DPAA_PKT_TYPE_IPV6_UDP)
+
 #define DPAA_PKT_L3_LEN_SHIFT	7
 
 /**
-- 
2.28.0


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

end of thread, other threads:[~2020-09-11  8:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11  7:59 [dpdk-dev] [PATCH v1 0/8] enhancements and fixes for nxp dpaax platform Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 1/8] bus/fslmc: fix atomic queues on nxp lx2 platform Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 2/8] bus/fslmc: run secondary debug app without blocklist devices Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 3/8] net/dpaa2: fix check for key size Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 4/8] bus/dpaa: RX/TX error queues Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 5/8] bus/fslmc: fix usage of dpio blocklist flag Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 6/8] bus/dpaa: enhance link status support Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 7/8] bus/dpaa: send error packets to application Sachin Saxena (OSS)
2020-09-11  7:59 ` [dpdk-dev] [PATCH v1 8/8] net/dpaa: " Sachin Saxena (OSS)

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git