DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
@ 2026-04-07 14:19 Weijun Pan
  2026-04-07 14:19 ` [PATCH] raw/ifpga: replace printf calls with logging Weijun Pan
  2026-06-28 15:25 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Weijun Pan
  0 siblings, 2 replies; 5+ messages in thread
From: Weijun Pan @ 2026-04-07 14:19 UTC (permalink / raw)
  To: Hemant Agrawal, Sachin Saxena, Jun Yang; +Cc: dev, Weijun Pan, stable

The queue storage allocation and free macros declare local variables
named ret and i, which shadow local variables in
rte_dpaa2_create_dpci_device() and trigger -Wshadow warnings.

Rename the macro-local variables to avoid shadowing without changing
behavior.

Bugzilla ID: 1744
Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 28 ++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index e625a5c035..bbeccd8fc3 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -204,33 +204,33 @@ struct swp_active_dqs {
 
 #define dpaa2_queue_storage_alloc(q, num) \
 ({ \
-	int ret = 0, i; \
+	int qs_ret = 0, qs_idx; \
 	\
-	for (i = 0; i < (num); i++) { \
-		(q)->q_storage[i] = rte_zmalloc(NULL, \
+	for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+		(q)->q_storage[qs_idx] = rte_zmalloc(NULL, \
 			sizeof(struct queue_storage_info_t), \
 			RTE_CACHE_LINE_SIZE); \
-		if (!(q)->q_storage[i]) { \
-			ret = -ENOBUFS; \
+		if (!(q)->q_storage[qs_idx]) { \
+			qs_ret = -ENOBUFS; \
 			break; \
 		} \
-		ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
-		if (ret) \
+		qs_ret = dpaa2_alloc_dq_storage((q)->q_storage[qs_idx]); \
+		if (qs_ret) \
 			break; \
 	} \
-	ret; \
+	qs_ret; \
 })
 
 #define dpaa2_queue_storage_free(q, num) \
 ({ \
 	if (q) { \
-		int i; \
+		int qs_idx; \
 		\
-		for (i = 0; i < (num); i++) { \
-			if ((q)->q_storage[i]) { \
-				dpaa2_free_dq_storage((q)->q_storage[i]); \
-				rte_free((q)->q_storage[i]); \
-				(q)->q_storage[i] = NULL; \
+		for (qs_idx = 0; qs_idx < (num); qs_idx++) { \
+			if ((q)->q_storage[qs_idx]) { \
+				dpaa2_free_dq_storage((q)->q_storage[qs_idx]); \
+				rte_free((q)->q_storage[qs_idx]); \
+				(q)->q_storage[qs_idx] = NULL; \
 			} \
 		} \
 	} \
-- 
2.34.1


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

* [PATCH] raw/ifpga: replace printf calls with logging
  2026-04-07 14:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
@ 2026-04-07 14:19 ` Weijun Pan
  2026-06-28 15:25 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Weijun Pan
  1 sibling, 0 replies; 5+ messages in thread
From: Weijun Pan @ 2026-04-07 14:19 UTC (permalink / raw)
  To: Rosen Xu; +Cc: dev, Weijun Pan

The ifpga rawdev driver uses printf() directly for runtime messages.
DPDK drivers should use the logging framework instead of printing
to standard output.

Replace the remaining direct printf() calls in ifpga_rawdev.c with
the driver logging macros.

Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
 drivers/raw/ifpga/ifpga_rawdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 5b9b596435..e004e002b7 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -434,7 +434,7 @@ static int set_surprise_link_check_aer(
 	uint32_t aer_new0, aer_new1;
 
 	if (!ifpga_rdev || !ifpga_rdev->rawdev) {
-		printf("\n device does not exist\n");
+		IFPGA_RAWDEV_PMD_ERR("device does not exist");
 		return -EFAULT;
 	}
 
@@ -491,7 +491,7 @@ static int set_surprise_link_check_aer(
 		if (fd != -1)
 			close(fd);
 
-		printf(">>>>>>Set AER %x,%x %x,%x\n",
+		IFPGA_RAWDEV_PMD_INFO(">>>>>>Set AER %x,%x %x,%x",
 			ifpga_rdev->aer_old[0], ifpga_rdev->aer_old[1],
 			aer_new0, aer_new1);
 
@@ -527,7 +527,7 @@ ifpga_rawdev_gsd_handle(__rte_unused void *param)
 		}
 
 		if (gsd_enable)
-			printf(">>>>>>Pls Shutdown APP\n");
+			IFPGA_RAWDEV_PMD_WARN(">>>>>>Pls Shutdown APP");
 
 		rte_delay_us(100 * MS);
 	}
-- 
2.34.1


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

* [PATCH v2] bus/fslmc: convert queue storage macros to inline functions
  2026-04-07 14:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
  2026-04-07 14:19 ` [PATCH] raw/ifpga: replace printf calls with logging Weijun Pan
@ 2026-06-28 15:25 ` Weijun Pan
  2026-06-29  5:59   ` Hemant Agrawal
  2026-06-29 10:41   ` David Marchand
  1 sibling, 2 replies; 5+ messages in thread
From: Weijun Pan @ 2026-06-28 15:25 UTC (permalink / raw)
  To: dev
  Cc: hemant.agrawal, sachin.saxena, jun.yang, stable, stephen, thomas,
	david.marchand, Weijun Pan

From: Weijun Pan <wpan36@wisc.edu>

The queue storage allocation and free helpers are implemented as macros
which declare local variables in the caller scope. This can cause shadow
warnings when -Wshadow is enabled.

Convert them to static inline functions to avoid macro-local variable
scope issues without changing behavior.

Bugzilla ID: 1744
Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
Cc: jun.yang@nxp.com
Cc: stable@dpdk.org

Signed-off-by: Weijun Pan <wpan36@wisc.edu>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 75 ++++++++++++++-----------
 1 file changed, 42 insertions(+), 33 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index e625a5c035..d09dd5d1f9 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -202,39 +202,48 @@ struct swp_active_dqs {
 	uint64_t reserved[7];
 };
 
-#define dpaa2_queue_storage_alloc(q, num) \
-({ \
-	int ret = 0, i; \
-	\
-	for (i = 0; i < (num); i++) { \
-		(q)->q_storage[i] = rte_zmalloc(NULL, \
-			sizeof(struct queue_storage_info_t), \
-			RTE_CACHE_LINE_SIZE); \
-		if (!(q)->q_storage[i]) { \
-			ret = -ENOBUFS; \
-			break; \
-		} \
-		ret = dpaa2_alloc_dq_storage((q)->q_storage[i]); \
-		if (ret) \
-			break; \
-	} \
-	ret; \
-})
-
-#define dpaa2_queue_storage_free(q, num) \
-({ \
-	if (q) { \
-		int i; \
-		\
-		for (i = 0; i < (num); i++) { \
-			if ((q)->q_storage[i]) { \
-				dpaa2_free_dq_storage((q)->q_storage[i]); \
-				rte_free((q)->q_storage[i]); \
-				(q)->q_storage[i] = NULL; \
-			} \
-		} \
-	} \
-})
+int dpaa2_alloc_dq_storage(struct queue_storage_info_t *q_storage);
+void dpaa2_free_dq_storage(struct queue_storage_info_t *q_storage);
+
+static inline int
+dpaa2_queue_storage_alloc(struct dpaa2_queue *q, int num)
+{
+	int ret = 0, i;
+
+	for (i = 0; i < num; i++) {
+		q->q_storage[i] = rte_zmalloc(NULL,
+			sizeof(struct queue_storage_info_t),
+			RTE_CACHE_LINE_SIZE);
+		if (!q->q_storage[i]) {
+			ret = -ENOBUFS;
+			break;
+		}
+
+		ret = dpaa2_alloc_dq_storage(q->q_storage[i]);
+		if (ret)
+			break;
+	}
+
+	return ret;
+}
+
+static inline void
+dpaa2_queue_storage_free(struct dpaa2_queue *q, int num)
+{
+	int i;
+
+	if (!q)
+		return;
+
+	for (i = 0; i < num; i++) {
+		if (q->q_storage[i]) {
+			dpaa2_free_dq_storage(q->q_storage[i]);
+			rte_free(q->q_storage[i]);
+			q->q_storage[i] = NULL;
+		}
+	}
+}
+
 
 #define NUM_MAX_SWP 64
 
-- 
2.34.1


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

* RE: [PATCH v2] bus/fslmc: convert queue storage macros to inline functions
  2026-06-28 15:25 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Weijun Pan
@ 2026-06-29  5:59   ` Hemant Agrawal
  2026-06-29 10:41   ` David Marchand
  1 sibling, 0 replies; 5+ messages in thread
From: Hemant Agrawal @ 2026-06-29  5:59 UTC (permalink / raw)
  To: Weijun Pan, dev@dpdk.org
  Cc: Sachin Saxena, Jun Yang, stable@dpdk.org,
	stephen@networkplumber.org, thomas@monjalon.net,
	david.marchand@redhat.com, Weijun Pan

Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

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

* Re: [PATCH v2] bus/fslmc: convert queue storage macros to inline functions
  2026-06-28 15:25 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Weijun Pan
  2026-06-29  5:59   ` Hemant Agrawal
@ 2026-06-29 10:41   ` David Marchand
  1 sibling, 0 replies; 5+ messages in thread
From: David Marchand @ 2026-06-29 10:41 UTC (permalink / raw)
  To: Weijun Pan, hemant.agrawal
  Cc: dev, sachin.saxena, jun.yang, stable, stephen, thomas, Weijun Pan

Hello,

Thanks for working on this issue.

On Sun, 28 Jun 2026 at 17:27, Weijun Pan <wpan3636@gmail.com> wrote:
>
> From: Weijun Pan <wpan36@wisc.edu>
>
> The queue storage allocation and free helpers are implemented as macros
> which declare local variables in the caller scope. This can cause shadow
> warnings when -Wshadow is enabled.
>
> Convert them to static inline functions to avoid macro-local variable
> scope issues without changing behavior.
>
> Bugzilla ID: 1744

This bugzilla is about compiling with -Wshadow.

The proposed fix is partial.
As I reported in my previous mail, enabling -Wshadow after the current
patch still shows many build warnings in
drivers/bus/fslmc/qbman/qbman_portal.c.
https://inbox.dpdk.org/dev/CAJFAV8w-VQJb6jM0KgAVP1rJKyUUwiBA6_seOCDwMX47rZmYyA@mail.gmail.com/

Could you work on a complete fix so the bz can be closed?


> Fixes: 12d98eceb8ac ("bus/fslmc: enhance QBMAN DQ storage logic")
> Cc: jun.yang@nxp.com
> Cc: stable@dpdk.org

Afaics, nothing is broken in the current code, why do we *need* to
backport the change?


> Signed-off-by: Weijun Pan <wpan36@wisc.edu>


-- 
David Marchand


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

end of thread, other threads:[~2026-06-29 10:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-07 14:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
2026-04-07 14:19 ` [PATCH] raw/ifpga: replace printf calls with logging Weijun Pan
2026-06-28 15:25 ` [PATCH v2] bus/fslmc: convert queue storage macros to inline functions Weijun Pan
2026-06-29  5:59   ` Hemant Agrawal
2026-06-29 10:41   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox