* [PATCH 1/8] bus/dpaa: fix bus scan for DMA devices
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
@ 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
` (4 subsequent siblings)
5 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [PATCH 2/8] bus/dpaa: fix resource leak in variable dev
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
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
` (3 subsequent siblings)
5 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [PATCH 3/8] common/dpaax: fix IOVA table cleanup
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
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
` (2 subsequent siblings)
5 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [PATCH 4/8] common/dpaax: fix array overrun issue
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
` (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
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
5 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [PATCH 5/8] bus/dpaa: remove redundant file descriptor check
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
` (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
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
5 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [v2 1/7] bus/dpaa: fix bus scan for DMA devices
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
@ 2024-07-05 7:42 ` vanshika.shukla
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
2024-07-05 7:42 ` [v2 2/7] bus/dpaa: fix resource leak in variable dev vanshika.shukla
` (3 subsequent siblings)
4 siblings, 1 reply; 28+ 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] 28+ messages in thread
* [v2 2/7] bus/dpaa: fix resource leak in variable dev
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
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
` (2 subsequent siblings)
4 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [v2 3/7] common/dpaax: fix IOVA table cleanup
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
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
2024-07-05 7:42 ` [v2 5/7] bus/dpaa: remove redundant file descriptor check vanshika.shukla
4 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [v2 4/7] common/dpaax: fix array overrun issue
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
` (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
4 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [v2 5/7] bus/dpaa: remove redundant file descriptor check
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
` (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
4 siblings, 0 replies; 28+ 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] 28+ messages in thread
* [PATCH v3 1/8] bus/dpaa: fix bus scan for DMA devices
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
@ 2024-07-08 7:29 ` vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
` (4 subsequent siblings)
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-08 7:29 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 64b748626b..b8f41ec069 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] 28+ messages in thread
* [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
2024-07-08 7:29 ` [PATCH v3 1/8] " vanshika.shukla
@ 2024-07-08 7:29 ` vanshika.shukla
2024-07-08 13:28 ` David Marchand
2024-07-08 7:29 ` [PATCH v3 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
` (3 subsequent siblings)
5 siblings, 1 reply; 28+ messages in thread
From: vanshika.shukla @ 2024-07-08 7:29 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena, Harman Kalra, David Marchand,
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 b8f41ec069..1f6997c77e 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] 28+ messages in thread
* [PATCH v3 3/8] common/dpaax: fix IOVA table cleanup
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
2024-07-08 7:29 ` [PATCH v3 1/8] " vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-08 7:29 ` vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 4/8] common/dpaax: fix array overrun issue vanshika.shukla
` (2 subsequent siblings)
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-08 7:29 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] 28+ messages in thread
* [PATCH v3 4/8] common/dpaax: fix array overrun issue
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
` (2 preceding siblings ...)
2024-07-08 7:29 ` [PATCH v3 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
@ 2024-07-08 7:29 ` vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-08 7:29 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] 28+ messages in thread
* [PATCH v3 5/8] bus/dpaa: remove redundant file descriptor check
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
` (3 preceding siblings ...)
2024-07-08 7:29 ` [PATCH v3 4/8] common/dpaax: fix array overrun issue vanshika.shukla
@ 2024-07-08 7:29 ` vanshika.shukla
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-08 7:29 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 59e0d641ce..2d805c5bd9 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>
@@ -28,15 +28,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] 28+ messages in thread
* Re: [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev
2024-07-08 7:29 ` [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-08 13:28 ` David Marchand
0 siblings, 0 replies; 28+ messages in thread
From: David Marchand @ 2024-07-08 13:28 UTC (permalink / raw)
To: vanshika.shukla
Cc: dev, Hemant Agrawal, Sachin Saxena, Harman Kalra, Hyong Youb Kim,
stable, Apeksha Gupta
On Mon, Jul 8, 2024 at 9:29 AM <vanshika.shukla@nxp.com> wrote:
>
> 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>
This lgtm.
Was this issue detected by the public CI coverity?
If so, please add a Coverity ID: tag.
--
David Marchand
^ permalink raw reply [flat|nested] 28+ messages in thread
* [v4 1/8] bus/dpaa: fix bus scan for DMA devices
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
@ 2024-07-09 10:04 ` vanshika.shukla
2024-07-09 10:04 ` [v4 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
` (5 subsequent siblings)
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:04 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 64b748626b..b8f41ec069 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] 28+ messages in thread
* [v4 2/8] bus/dpaa: fix resource leak in variable dev
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
2024-07-09 10:04 ` [v4 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
@ 2024-07-09 10:04 ` vanshika.shukla
2024-07-09 10:05 ` [v4 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
` (4 subsequent siblings)
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:04 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena, Harman Kalra, David Marchand,
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.
Coverity issue: CID 373703
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 b8f41ec069..1f6997c77e 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] 28+ messages in thread
* [v4 3/8] common/dpaax: fix IOVA table cleanup
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
2024-07-09 10:04 ` [v4 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-09 10:04 ` [v4 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-09 10:05 ` vanshika.shukla
2024-07-09 10:05 ` [v4 4/8] common/dpaax: fix array overrun issue vanshika.shukla
` (3 subsequent siblings)
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:05 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] 28+ messages in thread
* [v4 4/8] common/dpaax: fix array overrun issue
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
` (2 preceding siblings ...)
2024-07-09 10:05 ` [v4 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
@ 2024-07-09 10:05 ` vanshika.shukla
2024-07-09 10:05 ` [v4 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
` (2 subsequent siblings)
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:05 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] 28+ messages in thread
* [v4 5/8] bus/dpaa: remove redundant file descriptor check
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
` (3 preceding siblings ...)
2024-07-09 10:05 ` [v4 4/8] common/dpaax: fix array overrun issue vanshika.shukla
@ 2024-07-09 10:05 ` vanshika.shukla
2024-07-09 10:05 ` [v4 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:05 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 59e0d641ce..2d805c5bd9 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>
@@ -28,15 +28,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] 28+ messages in thread
* [v4 7/8] net/dpaa: restrict MTU config for shared intf
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
` (4 preceding siblings ...)
2024-07-09 10:05 ` [v4 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
@ 2024-07-09 10:05 ` vanshika.shukla
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
6 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-09 10:05 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena, Jun Yang
Cc: stable, 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
Fixes: e4abd4ff183c ("net/dpaa: support virtual storage profile")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org
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 44bac67803..060b8c678f 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 - 1);
+
+ 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] 28+ messages in thread
* [v5 1/8] bus/dpaa: fix bus scan for DMA devices
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
@ 2024-07-10 8:55 ` vanshika.shukla
2024-07-10 8:55 ` [v5 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
` (4 subsequent siblings)
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 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 64b748626b..b8f41ec069 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] 28+ messages in thread
* [v5 2/8] bus/dpaa: fix resource leak in variable dev
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
2024-07-10 8:55 ` [v5 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
@ 2024-07-10 8:55 ` vanshika.shukla
2024-07-10 8:55 ` [v5 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
` (3 subsequent siblings)
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena, Hyong Youb Kim, Harman Kalra,
David Marchand
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.
Coverity issue: CID 373703
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 b8f41ec069..1f6997c77e 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] 28+ messages in thread
* [v5 3/8] common/dpaax: fix IOVA table cleanup
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
2024-07-10 8:55 ` [v5 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-10 8:55 ` [v5 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
@ 2024-07-10 8:55 ` vanshika.shukla
2024-07-10 8:55 ` [v5 4/8] common/dpaax: fix array overrun issue vanshika.shukla
` (2 subsequent siblings)
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 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] 28+ messages in thread
* [v5 4/8] common/dpaax: fix array overrun issue
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
` (2 preceding siblings ...)
2024-07-10 8:55 ` [v5 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
@ 2024-07-10 8:55 ` vanshika.shukla
2024-07-10 8:55 ` [v5 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-10 8:55 ` [v5 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 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] 28+ messages in thread
* [v5 5/8] bus/dpaa: remove redundant file descriptor check
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
` (3 preceding siblings ...)
2024-07-10 8:55 ` [v5 4/8] common/dpaax: fix array overrun issue vanshika.shukla
@ 2024-07-10 8:55 ` vanshika.shukla
2024-07-10 8:55 ` [v5 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 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
Coverity issue: CID 425715
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 59e0d641ce..2d805c5bd9 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>
@@ -28,15 +28,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] 28+ messages in thread
* [v5 7/8] net/dpaa: restrict MTU config for shared intf
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
` (4 preceding siblings ...)
2024-07-10 8:55 ` [v5 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
@ 2024-07-10 8:55 ` vanshika.shukla
5 siblings, 0 replies; 28+ messages in thread
From: vanshika.shukla @ 2024-07-10 8:55 UTC (permalink / raw)
To: dev, Hemant Agrawal, Sachin Saxena, Jun Yang
Cc: stable, 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
Fixes: e4abd4ff183c ("net/dpaa: support virtual storage profile")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org
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 44bac67803..060b8c678f 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 - 1);
+
+ 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] 28+ messages in thread
end of thread, other threads:[~2024-07-10 8:55 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20240703111644.1523242-1-vanshika.shukla@nxp.com>
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
[not found] ` <20240705074208.1902771-1-vanshika.shukla@nxp.com>
2024-07-05 7:42 ` [v2 1/7] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
[not found] ` <20240708072945.2376209-1-vanshika.shukla@nxp.com>
2024-07-08 7:29 ` [PATCH v3 1/8] " vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-08 13:28 ` David Marchand
2024-07-08 7:29 ` [PATCH v3 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-08 7:29 ` [PATCH v3 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
[not found] ` <20240709100505.2476972-1-vanshika.shukla@nxp.com>
2024-07-09 10:04 ` [v4 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-09 10:04 ` [v4 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-09 10:05 ` [v4 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-09 10:05 ` [v4 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-09 10:05 ` [v4 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-09 10:05 ` [v4 7/8] net/dpaa: restrict MTU config for shared intf vanshika.shukla
[not found] ` <20240710085534.2564668-1-vanshika.shukla@nxp.com>
2024-07-10 8:55 ` [v5 1/8] bus/dpaa: fix bus scan for DMA devices vanshika.shukla
2024-07-10 8:55 ` [v5 2/8] bus/dpaa: fix resource leak in variable dev vanshika.shukla
2024-07-10 8:55 ` [v5 3/8] common/dpaax: fix IOVA table cleanup vanshika.shukla
2024-07-10 8:55 ` [v5 4/8] common/dpaax: fix array overrun issue vanshika.shukla
2024-07-10 8:55 ` [v5 5/8] bus/dpaa: remove redundant file descriptor check vanshika.shukla
2024-07-10 8:55 ` [v5 7/8] net/dpaa: restrict MTU config for shared intf 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
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).