DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/8] DPAA specific fixes
@ 2024-07-03 11:16 vanshika.shukla
  2024-07-03 11:16 ` [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
                   ` (8 more replies)
  0 siblings, 9 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev

From: Vanshika Shukla <vanshika.shukla@nxp.com>

This series includes fixes for NXP DPAA drivers.

Apeksha Gupta (2):
  bus/dpaa: fix resource leak in variable dev
  common/dpaax: fix array overrun issue

Gagandeep Singh (3):
  bus/dpaa: fix bus scan for DMA devices
  common/dpaax: fix IOVA table cleanup
  bus/dpaa: remove unused code

Rohit Raj (2):
  bus/dpaa: remove redundant file descriptor check
  net/dpaa: restrict MTU config for shared intf

Sachin Saxena (1):
  mempool/dpaax: cache free optimization

 drivers/bus/dpaa/base/qbman/process.c    |  7 ++---
 drivers/bus/dpaa/base/qbman/qman.c       | 31 ----------------------
 drivers/bus/dpaa/dpaa_bus.c              |  5 +++-
 drivers/bus/dpaa/include/fsl_qman.h      | 31 ----------------------
 drivers/bus/dpaa/version.map             |  1 -
 drivers/common/dpaax/dpaax_iova_table.c  | 13 +++++-----
 drivers/mempool/dpaa/dpaa_mempool.c      | 16 +++++++++++-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 15 +++++++++++
 drivers/net/dpaa/dpaa_ethdev.c           | 33 ++++++++++++++++++++++--
 9 files changed, 75 insertions(+), 77 deletions(-)

-- 
2.25.1


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

* [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Gagandeep Singh
  Cc: stable, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

if there is no sec devices available, code is not scanning QDMA dev
This patch fix this problem by adding a goto statement instead
of return in case no sec device available.

Fixes: 583f3732974f ("dma/dpaa: introduce DPAA DMA driver skeleton")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5d4352bb3c..de190eb569 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -221,7 +221,7 @@ dpaa_create_device_list(void)
 
 	if (dpaa_sec_available()) {
 		DPAA_BUS_LOG(INFO, "DPAA SEC devices are not available");
-		return 0;
+		goto qdma_dpaa;
 	}
 
 	/* Creating SEC Devices */
@@ -260,6 +260,7 @@ dpaa_create_device_list(void)
 
 	rte_dpaa_bus.device_count += i;
 
+qdma_dpaa:
 	/* Creating QDMA Device */
 	for (i = 0; i < RTE_DPAA_QDMA_DEVICES; i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
-- 
2.25.1


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

* [PATCH 2/8] bus/dpaa: fix resource leak in variable dev
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
  2024-07-03 11:16 ` [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, David Marchand, Harman Kalra,
	Hyong Youb Kim
  Cc: stable, Apeksha Gupta, Vanshika Shukla

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

Resource leak:
variable dev is going out of scope leaks the storage.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: hkalra@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index de190eb569..6ea27d8fb6 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -188,6 +188,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
@@ -239,6 +240,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
-- 
2.25.1


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

* [PATCH 3/8] common/dpaax: fix IOVA table cleanup
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
  2024-07-03 11:16 ` [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
  2024-07-03 11:16 ` [PATCH 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 4/8] common/dpaax: fix array overrun issue vanshika.shukla
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Gagandeep Singh, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

Fixes incorrect structure free

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index 9daac4bc03..d2a78f4c19 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2023 NXP
  */
 
 #include <rte_memory.h>
@@ -255,10 +255,7 @@ dpaax_iova_table_populate(void)
 void
 dpaax_iova_table_depopulate(void)
 {
-	if (dpaax_iova_table_p == NULL)
-		return;
-
-	rte_free(dpaax_iova_table_p->entries);
+	rte_free(dpaax_iova_table_p);
 	dpaax_iova_table_p = NULL;
 
 	DPAAX_DEBUG("IOVA Table cleaned");
-- 
2.25.1


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

* [PATCH 4/8] common/dpaax: fix array overrun issue
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (2 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Apeksha Gupta, Vanshika Shukla

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

Out-of-bounds read, Overrunning dynamic array nodes at offset corresponding
to index variable j.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index d2a78f4c19..860e702333 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -139,10 +139,12 @@ read_memory_node(unsigned int *count)
 	}
 
 	DPAAX_DEBUG("Device-tree memory node data:");
-	do {
+
+	while (j > 0) {
+		--j;
 		DPAAX_DEBUG("    %08" PRIx64 " %08zu",
 			    nodes[j].addr, nodes[j].len);
-	} while (--j);
+	}
 
 cleanup:
 	close(fd);
-- 
2.25.1


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

* [PATCH 5/8] bus/dpaa: remove redundant file descriptor check
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (3 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 4/8] common/dpaax: fix array overrun issue vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 6/8] bus/dpaa: remove unused code vanshika.shukla
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Rohit Raj, Vanshika Shukla

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

This patch removes the redundant file descriptor check

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/base/qbman/process.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 3504ec97db..3e4622f606 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2011-2016 Freescale Semiconductor Inc.
- * Copyright 2017,2020 NXP
+ * Copyright 2017,2020,2022,2024 NXP
  *
  */
 #include <assert.h>
@@ -27,15 +27,16 @@ static int check_fd(void)
 {
 	int ret;
 
-	if (fd >= 0)
-		return 0;
 	ret = pthread_mutex_lock(&fd_init_lock);
 	assert(!ret);
+
 	/* check again with the lock held */
 	if (fd < 0)
 		fd = open(PROCESS_PATH, O_RDWR);
+
 	ret = pthread_mutex_unlock(&fd_init_lock);
 	assert(!ret);
+
 	return (fd >= 0) ? 0 : -ENODEV;
 }
 
-- 
2.25.1


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

* [PATCH 6/8] bus/dpaa: remove unused code
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (4 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Gagandeep Singh, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

The slow poll code is not being used in DPDK DPAA driver sub-system.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c  | 31 -----------------------------
 drivers/bus/dpaa/include/fsl_qman.h | 31 -----------------------------
 drivers/bus/dpaa/version.map        |  1 -
 3 files changed, 63 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 6d2fbdcf02..d3e236b333 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -69,7 +69,6 @@ struct qman_portal {
 	/* interrupt sources processed by portal_isr(), configurable */
 	unsigned long irq_sources;
 	u32 use_eqcr_ci_stashing;
-	u32 slowpoll;	/* only used when interrupts are off */
 	/* only 1 volatile dequeue at a time */
 	struct qman_fq *vdqcr_owned;
 	u32 sdqcr;
@@ -569,7 +568,6 @@ qman_init_portal(struct qman_portal *portal,
 	INIT_LIST_HEAD(&portal->cgr_cbs);
 	spin_lock_init(&portal->cgr_lock);
 	portal->bits = 0;
-	portal->slowpoll = 0;
 	portal->sdqcr = QM_SDQCR_SOURCE_CHANNELS | QM_SDQCR_COUNT_UPTO3 |
 			QM_SDQCR_DEDICATED_PRECEDENCE | QM_SDQCR_TYPE_PRIO_QOS |
 			QM_SDQCR_TOKEN_SET(0xab) | QM_SDQCR_CHANNELS_DEDICATED;
@@ -1370,35 +1368,6 @@ void qman_dqrr_consume(struct qman_fq *fq,
 	qm_dqrr_next(&p->p);
 }
 
-int qman_poll_dqrr(unsigned int limit)
-{
-	struct qman_portal *p = get_affine_portal();
-	int ret;
-
-	ret = __poll_portal_fast(p, limit);
-	return ret;
-}
-
-void qman_poll(void)
-{
-	struct qman_portal *p = get_affine_portal();
-
-	if ((~p->irq_sources) & QM_PIRQ_SLOW) {
-		if (!(p->slowpoll--)) {
-			u32 is = qm_isr_status_read(&p->p) & ~p->irq_sources;
-			u32 active = __poll_portal_slow(p, is);
-
-			if (active) {
-				qm_isr_status_clear(&p->p, active);
-				p->slowpoll = SLOW_POLL_BUSY;
-			} else
-				p->slowpoll = SLOW_POLL_IDLE;
-		}
-	}
-	if ((~p->irq_sources) & QM_PIRQ_DQRI)
-		__poll_portal_fast(p, FSL_QMAN_POLL_LIMIT);
-}
-
 void qman_stop_dequeues(void)
 {
 	struct qman_portal *p = get_affine_portal();
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index acdfb45ad6..c0677976e8 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1429,37 +1429,6 @@ __rte_internal
 void qman_dqrr_consume(struct qman_fq *fq,
 		       struct qm_dqrr_entry *dq);
 
-/**
- * qman_poll_dqrr - process DQRR (fast-path) entries
- * @limit: the maximum number of DQRR entries to process
- *
- * Use of this function requires that DQRR processing not be interrupt-driven.
- * Ie. the value returned by qman_irqsource_get() should not include
- * QM_PIRQ_DQRI. If the current CPU is sharing a portal hosted on another CPU,
- * this function will return -EINVAL, otherwise the return value is >=0 and
- * represents the number of DQRR entries processed.
- */
-__rte_internal
-int qman_poll_dqrr(unsigned int limit);
-
-/**
- * qman_poll
- *
- * Dispatcher logic on a cpu can use this to trigger any maintenance of the
- * affine portal. There are two classes of portal processing in question;
- * fast-path (which involves demuxing dequeue ring (DQRR) entries and tracking
- * enqueue ring (EQCR) consumption), and slow-path (which involves EQCR
- * thresholds, congestion state changes, etc). This function does whatever
- * processing is not triggered by interrupts.
- *
- * Note, if DQRR and some slow-path processing are poll-driven (rather than
- * interrupt-driven) then this function uses a heuristic to determine how often
- * to run slow-path processing - as slow-path processing introduces at least a
- * minimum latency each time it is run, whereas fast-path (DQRR) processing is
- * close to zero-cost if there is no work to be done.
- */
-void qman_poll(void);
-
 /**
  * qman_stop_dequeues - Stop h/w dequeuing to the s/w portal
  *
diff --git a/drivers/bus/dpaa/version.map b/drivers/bus/dpaa/version.map
index 1a840fd1a5..3f547f75cf 100644
--- a/drivers/bus/dpaa/version.map
+++ b/drivers/bus/dpaa/version.map
@@ -82,7 +82,6 @@ INTERNAL {
 	qman_irqsource_remove;
 	qman_modify_cgr;
 	qman_oos_fq;
-	qman_poll_dqrr;
 	qman_portal_dequeue;
 	qman_portal_poll_rx;
 	qman_query_fq_frm_cnt;
-- 
2.25.1


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

* [PATCH 7/8] net/dpaa: restrict MTU config for shared intf
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (5 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 6/8] bus/dpaa: remove unused code vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-03 11:16 ` [PATCH 8/8] mempool/dpaax: cache free optimization vanshika.shukla
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Rohit Raj, Vanshika Shukla

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

Since DPDK was able to configure mtu in VSP/Shared interface  mode,
it was causing misconfiguration of the hw which further caused crashes.

This patch allow only kernel to config MTU in such cases

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 935a4f2ada..c25576b7c7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -14,6 +14,7 @@
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
+#include <sys/ioctl.h>
 
 #include <rte_string_fns.h>
 #include <rte_byteorder.h>
@@ -165,9 +166,15 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN
 				+ VLAN_TAG_SIZE;
 	uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM;
+	struct fman_if *fif = dev->process_private;
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (fif->is_shared_mac) {
+		DPAA_PMD_ERR("Cannot configure mtu from DPDK in VSP mode.");
+		return -ENOTSUP;
+	}
+
 	/*
 	 * Refuse mtu that requires the support of scattered packets
 	 * when this feature has not been enabled before.
@@ -206,7 +213,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	uint32_t max_rx_pktlen;
 	int speed, duplex;
-	int ret, rx_status;
+	int ret, rx_status, socket_fd;
+	struct ifreq ifr;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -222,6 +230,26 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 				     dpaa_intf->name);
 			return -EHOSTDOWN;
 		}
+
+		socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+		if (socket_fd == -1) {
+			DPAA_PMD_ERR("Cannot open IF socket");
+			return -errno;
+		}
+
+		strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
+			DPAA_PMD_ERR("Cannot get interface mtu");
+			close(socket_fd);
+			return -errno;
+		}
+
+		close(socket_fd);
+		DPAA_PMD_INFO("Using kernel configured mtu size(%u)",
+			     ifr.ifr_mtu);
+
+		eth_conf->rxmode.mtu = ifr.ifr_mtu;
 	}
 
 	/* Rx offloads which are enabled by default */
@@ -249,7 +277,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 		max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
 	}
 
-	fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
+	if (!fif->is_shared_mac)
+		fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
 
 	if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
 		DPAA_PMD_DEBUG("enabling scatter mode");
-- 
2.25.1


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

* [PATCH 8/8] mempool/dpaax: cache free optimization
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (6 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
@ 2024-07-03 11:16 ` vanshika.shukla
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
  8 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-03 11:16 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Vanshika Shukla

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

 - Updates the cache threshold value as per
   the platform specific optimal value.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/mempool/dpaa/dpaa_mempool.c      | 16 +++++++++++++++-
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 15 +++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c
index 0b484b3d9c..3a65ef7d60 100644
--- a/drivers/mempool/dpaa/dpaa_mempool.c
+++ b/drivers/mempool/dpaa/dpaa_mempool.c
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
- *   Copyright 2017,2019 NXP
+ *   Copyright 2017,2019,2023 NXP
  *
  */
 
@@ -51,6 +51,8 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp)
 	struct bman_pool_params params = {
 		.flags = BMAN_POOL_FLAG_DYNAMIC_BPID
 	};
+	unsigned int lcore_id;
+	struct rte_mempool_cache *cache;
 
 	MEMPOOL_INIT_FUNC_TRACE();
 
@@ -118,6 +120,18 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp)
 	rte_memcpy(bp_info, (void *)&rte_dpaa_bpid_info[bpid],
 		   sizeof(struct dpaa_bp_info));
 	mp->pool_data = (void *)bp_info;
+	/* Update per core mempool cache threshold to optimal value which is
+	 * number of buffers that can be released to HW buffer pool in
+	 * a single API call.
+	 */
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+		cache = &mp->local_cache[lcore_id];
+		DPAA_MEMPOOL_DEBUG("lCore %d: cache->flushthresh %d -> %d\n",
+			lcore_id, cache->flushthresh,
+			(uint32_t)(cache->size + DPAA_MBUF_MAX_ACQ_REL));
+		if (cache->flushthresh)
+			cache->flushthresh = cache->size + DPAA_MBUF_MAX_ACQ_REL;
+	}
 
 	DPAA_MEMPOOL_INFO("BMAN pool created for bpid =%d", bpid);
 	return 0;
diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 4c9245cb81..fe82475b10 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -44,6 +44,8 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp)
 	struct dpaa2_bp_info *bp_info;
 	struct dpbp_attr dpbp_attr;
 	uint32_t bpid;
+	unsigned int lcore_id;
+	struct rte_mempool_cache *cache;
 	int ret;
 
 	avail_dpbp = dpaa2_alloc_dpbp_dev();
@@ -132,6 +134,19 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp)
 	DPAA2_MEMPOOL_DEBUG("BP List created for bpid =%d", dpbp_attr.bpid);
 
 	h_bp_list = bp_list;
+	/* Update per core mempool cache threshold to optimal value which is
+	 * number of buffers that can be released to HW buffer pool in
+	 * a single API call.
+	 */
+	for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
+		cache = &mp->local_cache[lcore_id];
+		DPAA2_MEMPOOL_DEBUG("lCore %d: cache->flushthresh %d -> %d\n",
+			lcore_id, cache->flushthresh,
+			(uint32_t)(cache->size + DPAA2_MBUF_MAX_ACQ_REL));
+		if (cache->flushthresh)
+			cache->flushthresh = cache->size + DPAA2_MBUF_MAX_ACQ_REL;
+	}
+
 	return 0;
 err3:
 	rte_free(bp_info);
-- 
2.25.1


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

* [v2 0/7] DPAA specific fixes
  2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
                   ` (7 preceding siblings ...)
  2024-07-03 11:16 ` [PATCH 8/8] mempool/dpaax: cache free optimization vanshika.shukla
@ 2024-07-05  7:42 ` vanshika.shukla
  2024-07-05  7:42   ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
                     ` (6 more replies)
  8 siblings, 7 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev

From: Vanshika Shukla <vanshika.shukla@nxp.com>

This series includes fixes for NXP DPAA drivers.

V2 changes:
Removed "mempool/dpaax: cache free optimization" patch.

Apeksha Gupta (2):
  bus/dpaa: fix resource leak in variable dev
  common/dpaax: fix array overrun issue

Gagandeep Singh (3):
  bus/dpaa: fix bus scan for DMA devices
  common/dpaax: fix IOVA table cleanup
  bus/dpaa: remove unused code

Rohit Raj (2):
  bus/dpaa: remove redundant file descriptor check
  net/dpaa: restrict MTU config for shared intf

 drivers/bus/dpaa/base/qbman/process.c   |  7 +++---
 drivers/bus/dpaa/base/qbman/qman.c      | 31 -----------------------
 drivers/bus/dpaa/dpaa_bus.c             |  5 +++-
 drivers/bus/dpaa/include/fsl_qman.h     | 31 -----------------------
 drivers/bus/dpaa/version.map            |  1 -
 drivers/common/dpaax/dpaax_iova_table.c | 13 +++++-----
 drivers/net/dpaa/dpaa_ethdev.c          | 33 +++++++++++++++++++++++--
 7 files changed, 45 insertions(+), 76 deletions(-)

-- 
2.25.1


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

* [v2 1/7] bus/dpaa: fix bus scan for DMA devices
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 2/7] bus/dpaa: fix resource leak in variable dev vanshika.shukla
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Gagandeep Singh
  Cc: stable, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

if there is no sec devices available, code is not scanning QDMA dev
This patch fix this problem by adding a goto statement instead
of return in case no sec device available.

Fixes: 583f3732974f ("dma/dpaa: introduce DPAA DMA driver skeleton")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index 5d4352bb3c..de190eb569 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -221,7 +221,7 @@ dpaa_create_device_list(void)
 
 	if (dpaa_sec_available()) {
 		DPAA_BUS_LOG(INFO, "DPAA SEC devices are not available");
-		return 0;
+		goto qdma_dpaa;
 	}
 
 	/* Creating SEC Devices */
@@ -260,6 +260,7 @@ dpaa_create_device_list(void)
 
 	rte_dpaa_bus.device_count += i;
 
+qdma_dpaa:
 	/* Creating QDMA Device */
 	for (i = 0; i < RTE_DPAA_QDMA_DEVICES; i++) {
 		dev = calloc(1, sizeof(struct rte_dpaa_device));
-- 
2.25.1


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

* [v2 2/7] bus/dpaa: fix resource leak in variable dev
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
  2024-07-05  7:42   ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 3/7] common/dpaax: fix IOVA table cleanup vanshika.shukla
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, David Marchand, Harman Kalra,
	Hyong Youb Kim
  Cc: stable, Apeksha Gupta, Vanshika Shukla

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

Resource leak:
variable dev is going out of scope leaks the storage.

Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")
Cc: hkalra@marvell.com
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/dpaa_bus.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c
index de190eb569..6ea27d8fb6 100644
--- a/drivers/bus/dpaa/dpaa_bus.c
+++ b/drivers/bus/dpaa/dpaa_bus.c
@@ -188,6 +188,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
@@ -239,6 +240,7 @@ dpaa_create_device_list(void)
 		if (dev->intr_handle == NULL) {
 			DPAA_BUS_LOG(ERR, "Failed to allocate intr handle");
 			ret = -ENOMEM;
+			free(dev);
 			goto cleanup;
 		}
 
-- 
2.25.1


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

* [v2 3/7] common/dpaax: fix IOVA table cleanup
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
  2024-07-05  7:42   ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
  2024-07-05  7:42   ` [v2 2/7] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 4/7] common/dpaax: fix array overrun issue vanshika.shukla
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Gagandeep Singh, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

Fixes incorrect structure free

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index 9daac4bc03..d2a78f4c19 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -1,5 +1,5 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2018 NXP
+ * Copyright 2018-2023 NXP
  */
 
 #include <rte_memory.h>
@@ -255,10 +255,7 @@ dpaax_iova_table_populate(void)
 void
 dpaax_iova_table_depopulate(void)
 {
-	if (dpaax_iova_table_p == NULL)
-		return;
-
-	rte_free(dpaax_iova_table_p->entries);
+	rte_free(dpaax_iova_table_p);
 	dpaax_iova_table_p = NULL;
 
 	DPAAX_DEBUG("IOVA Table cleaned");
-- 
2.25.1


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

* [v2 4/7] common/dpaax: fix array overrun issue
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
                     ` (2 preceding siblings ...)
  2024-07-05  7:42   ` [v2 3/7] common/dpaax: fix IOVA table cleanup vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 5/7] bus/dpaa: remove redundant file descriptor check vanshika.shukla
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Apeksha Gupta, Vanshika Shukla

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

Out-of-bounds read, Overrunning dynamic array nodes at offset corresponding
to index variable j.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index d2a78f4c19..860e702333 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -139,10 +139,12 @@ read_memory_node(unsigned int *count)
 	}
 
 	DPAAX_DEBUG("Device-tree memory node data:");
-	do {
+
+	while (j > 0) {
+		--j;
 		DPAAX_DEBUG("    %08" PRIx64 " %08zu",
 			    nodes[j].addr, nodes[j].len);
-	} while (--j);
+	}
 
 cleanup:
 	close(fd);
-- 
2.25.1


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

* [v2 5/7] bus/dpaa: remove redundant file descriptor check
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
                     ` (3 preceding siblings ...)
  2024-07-05  7:42   ` [v2 4/7] common/dpaax: fix array overrun issue vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 6/7] bus/dpaa: remove unused code vanshika.shukla
  2024-07-05  7:42   ` [v2 7/7] net/dpaa: restrict MTU config for shared intf vanshika.shukla
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena, Shreyansh Jain
  Cc: stable, Rohit Raj, Vanshika Shukla

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

This patch removes the redundant file descriptor check

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/base/qbman/process.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/process.c b/drivers/bus/dpaa/base/qbman/process.c
index 3504ec97db..3e4622f606 100644
--- a/drivers/bus/dpaa/base/qbman/process.c
+++ b/drivers/bus/dpaa/base/qbman/process.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  *
  * Copyright 2011-2016 Freescale Semiconductor Inc.
- * Copyright 2017,2020 NXP
+ * Copyright 2017,2020,2022,2024 NXP
  *
  */
 #include <assert.h>
@@ -27,15 +27,16 @@ static int check_fd(void)
 {
 	int ret;
 
-	if (fd >= 0)
-		return 0;
 	ret = pthread_mutex_lock(&fd_init_lock);
 	assert(!ret);
+
 	/* check again with the lock held */
 	if (fd < 0)
 		fd = open(PROCESS_PATH, O_RDWR);
+
 	ret = pthread_mutex_unlock(&fd_init_lock);
 	assert(!ret);
+
 	return (fd >= 0) ? 0 : -ENODEV;
 }
 
-- 
2.25.1


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

* [v2 6/7] bus/dpaa: remove unused code
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
                     ` (4 preceding siblings ...)
  2024-07-05  7:42   ` [v2 5/7] bus/dpaa: remove redundant file descriptor check vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  2024-07-05  7:42   ` [v2 7/7] net/dpaa: restrict MTU config for shared intf vanshika.shukla
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Gagandeep Singh, Vanshika Shukla

From: Gagandeep Singh <g.singh@nxp.com>

The slow poll code is not being used in DPDK DPAA driver sub-system.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c  | 31 -----------------------------
 drivers/bus/dpaa/include/fsl_qman.h | 31 -----------------------------
 drivers/bus/dpaa/version.map        |  1 -
 3 files changed, 63 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 6d2fbdcf02..d3e236b333 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -69,7 +69,6 @@ struct qman_portal {
 	/* interrupt sources processed by portal_isr(), configurable */
 	unsigned long irq_sources;
 	u32 use_eqcr_ci_stashing;
-	u32 slowpoll;	/* only used when interrupts are off */
 	/* only 1 volatile dequeue at a time */
 	struct qman_fq *vdqcr_owned;
 	u32 sdqcr;
@@ -569,7 +568,6 @@ qman_init_portal(struct qman_portal *portal,
 	INIT_LIST_HEAD(&portal->cgr_cbs);
 	spin_lock_init(&portal->cgr_lock);
 	portal->bits = 0;
-	portal->slowpoll = 0;
 	portal->sdqcr = QM_SDQCR_SOURCE_CHANNELS | QM_SDQCR_COUNT_UPTO3 |
 			QM_SDQCR_DEDICATED_PRECEDENCE | QM_SDQCR_TYPE_PRIO_QOS |
 			QM_SDQCR_TOKEN_SET(0xab) | QM_SDQCR_CHANNELS_DEDICATED;
@@ -1370,35 +1368,6 @@ void qman_dqrr_consume(struct qman_fq *fq,
 	qm_dqrr_next(&p->p);
 }
 
-int qman_poll_dqrr(unsigned int limit)
-{
-	struct qman_portal *p = get_affine_portal();
-	int ret;
-
-	ret = __poll_portal_fast(p, limit);
-	return ret;
-}
-
-void qman_poll(void)
-{
-	struct qman_portal *p = get_affine_portal();
-
-	if ((~p->irq_sources) & QM_PIRQ_SLOW) {
-		if (!(p->slowpoll--)) {
-			u32 is = qm_isr_status_read(&p->p) & ~p->irq_sources;
-			u32 active = __poll_portal_slow(p, is);
-
-			if (active) {
-				qm_isr_status_clear(&p->p, active);
-				p->slowpoll = SLOW_POLL_BUSY;
-			} else
-				p->slowpoll = SLOW_POLL_IDLE;
-		}
-	}
-	if ((~p->irq_sources) & QM_PIRQ_DQRI)
-		__poll_portal_fast(p, FSL_QMAN_POLL_LIMIT);
-}
-
 void qman_stop_dequeues(void)
 {
 	struct qman_portal *p = get_affine_portal();
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index acdfb45ad6..c0677976e8 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1429,37 +1429,6 @@ __rte_internal
 void qman_dqrr_consume(struct qman_fq *fq,
 		       struct qm_dqrr_entry *dq);
 
-/**
- * qman_poll_dqrr - process DQRR (fast-path) entries
- * @limit: the maximum number of DQRR entries to process
- *
- * Use of this function requires that DQRR processing not be interrupt-driven.
- * Ie. the value returned by qman_irqsource_get() should not include
- * QM_PIRQ_DQRI. If the current CPU is sharing a portal hosted on another CPU,
- * this function will return -EINVAL, otherwise the return value is >=0 and
- * represents the number of DQRR entries processed.
- */
-__rte_internal
-int qman_poll_dqrr(unsigned int limit);
-
-/**
- * qman_poll
- *
- * Dispatcher logic on a cpu can use this to trigger any maintenance of the
- * affine portal. There are two classes of portal processing in question;
- * fast-path (which involves demuxing dequeue ring (DQRR) entries and tracking
- * enqueue ring (EQCR) consumption), and slow-path (which involves EQCR
- * thresholds, congestion state changes, etc). This function does whatever
- * processing is not triggered by interrupts.
- *
- * Note, if DQRR and some slow-path processing are poll-driven (rather than
- * interrupt-driven) then this function uses a heuristic to determine how often
- * to run slow-path processing - as slow-path processing introduces at least a
- * minimum latency each time it is run, whereas fast-path (DQRR) processing is
- * close to zero-cost if there is no work to be done.
- */
-void qman_poll(void);
-
 /**
  * qman_stop_dequeues - Stop h/w dequeuing to the s/w portal
  *
diff --git a/drivers/bus/dpaa/version.map b/drivers/bus/dpaa/version.map
index 1a840fd1a5..3f547f75cf 100644
--- a/drivers/bus/dpaa/version.map
+++ b/drivers/bus/dpaa/version.map
@@ -82,7 +82,6 @@ INTERNAL {
 	qman_irqsource_remove;
 	qman_modify_cgr;
 	qman_oos_fq;
-	qman_poll_dqrr;
 	qman_portal_dequeue;
 	qman_portal_poll_rx;
 	qman_query_fq_frm_cnt;
-- 
2.25.1


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

* [v2 7/7] net/dpaa: restrict MTU config for shared intf
  2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
                     ` (5 preceding siblings ...)
  2024-07-05  7:42   ` [v2 6/7] bus/dpaa: remove unused code vanshika.shukla
@ 2024-07-05  7:42   ` vanshika.shukla
  6 siblings, 0 replies; 17+ messages in thread
From: vanshika.shukla @ 2024-07-05  7:42 UTC (permalink / raw)
  To: dev, Hemant Agrawal, Sachin Saxena; +Cc: Rohit Raj, Vanshika Shukla

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

Since DPDK was able to configure mtu in VSP/Shared interface  mode,
it was causing misconfiguration of the hw which further caused crashes.

This patch allow only kernel to config MTU in such cases

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 935a4f2ada..c25576b7c7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -14,6 +14,7 @@
 #include <pthread.h>
 #include <sys/types.h>
 #include <sys/syscall.h>
+#include <sys/ioctl.h>
 
 #include <rte_string_fns.h>
 #include <rte_byteorder.h>
@@ -165,9 +166,15 @@ dpaa_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 	uint32_t frame_size = mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN
 				+ VLAN_TAG_SIZE;
 	uint32_t buffsz = dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM;
+	struct fman_if *fif = dev->process_private;
 
 	PMD_INIT_FUNC_TRACE();
 
+	if (fif->is_shared_mac) {
+		DPAA_PMD_ERR("Cannot configure mtu from DPDK in VSP mode.");
+		return -ENOTSUP;
+	}
+
 	/*
 	 * Refuse mtu that requires the support of scattered packets
 	 * when this feature has not been enabled before.
@@ -206,7 +213,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 	struct rte_intr_handle *intr_handle;
 	uint32_t max_rx_pktlen;
 	int speed, duplex;
-	int ret, rx_status;
+	int ret, rx_status, socket_fd;
+	struct ifreq ifr;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -222,6 +230,26 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 				     dpaa_intf->name);
 			return -EHOSTDOWN;
 		}
+
+		socket_fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+		if (socket_fd == -1) {
+			DPAA_PMD_ERR("Cannot open IF socket");
+			return -errno;
+		}
+
+		strncpy(ifr.ifr_name, dpaa_intf->name, IFNAMSIZ);
+
+		if (ioctl(socket_fd, SIOCGIFMTU, &ifr) < 0) {
+			DPAA_PMD_ERR("Cannot get interface mtu");
+			close(socket_fd);
+			return -errno;
+		}
+
+		close(socket_fd);
+		DPAA_PMD_INFO("Using kernel configured mtu size(%u)",
+			     ifr.ifr_mtu);
+
+		eth_conf->rxmode.mtu = ifr.ifr_mtu;
 	}
 
 	/* Rx offloads which are enabled by default */
@@ -249,7 +277,8 @@ dpaa_eth_dev_configure(struct rte_eth_dev *dev)
 		max_rx_pktlen = DPAA_MAX_RX_PKT_LEN;
 	}
 
-	fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
+	if (!fif->is_shared_mac)
+		fman_if_set_maxfrm(dev->process_private, max_rx_pktlen);
 
 	if (rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) {
 		DPAA_PMD_DEBUG("enabling scatter mode");
-- 
2.25.1


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

end of thread, other threads:[~2024-07-05  7:42 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-03 11:16 [PATCH 0/8] DPAA specific fixes vanshika.shukla
2024-07-03 11:16 ` [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-03 11:16 ` [PATCH 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-03 11:16 ` [PATCH 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-03 11:16 ` [PATCH 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-03 11:16 ` [PATCH 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-03 11:16 ` [PATCH 6/8] bus/dpaa: remove unused code vanshika.shukla
2024-07-03 11:16 ` [PATCH 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
2024-07-03 11:16 ` [PATCH 8/8] mempool/dpaax: cache free optimization vanshika.shukla
2024-07-05  7:42 ` [v2 0/7] DPAA specific fixes vanshika.shukla
2024-07-05  7:42   ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-05  7:42   ` [v2 2/7] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-05  7:42   ` [v2 3/7] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-05  7:42   ` [v2 4/7] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-05  7:42   ` [v2 5/7] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-05  7:42   ` [v2 6/7] bus/dpaa: remove unused code vanshika.shukla
2024-07-05  7:42   ` [v2 7/7] net/dpaa: restrict MTU config for shared intf vanshika.shukla

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