* [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
@ 2026-04-04 17:19 Weijun Pan
2026-04-06 5:05 ` Hemant Agrawal
2026-04-07 14:09 ` Stephen Hemminger
0 siblings, 2 replies; 6+ messages in thread
From: Weijun Pan @ 2026-04-04 17: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] 6+ messages in thread
* RE: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
@ 2026-04-06 5:05 ` Hemant Agrawal
2026-04-07 14:09 ` Stephen Hemminger
1 sibling, 0 replies; 6+ messages in thread
From: Hemant Agrawal @ 2026-04-06 5:05 UTC (permalink / raw)
To: Weijun Pan, Sachin Saxena, Jun Yang
Cc: dev@dpdk.org, Weijun Pan, stable@dpdk.org
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
2026-04-06 5:05 ` Hemant Agrawal
@ 2026-04-07 14:09 ` Stephen Hemminger
2026-06-10 14:15 ` Thomas Monjalon
1 sibling, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2026-04-07 14:09 UTC (permalink / raw)
To: Weijun Pan
Cc: Hemant Agrawal, Sachin Saxena, Jun Yang, dev, Weijun Pan, stable
On Sat, 4 Apr 2026 12:19:11 -0500
Weijun Pan <wpan3636@gmail.com> wrote:
> 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; \
> } \
> } \
> } \
Why are these not inline functions.
Macros with lower case names are likely place fore confusion like this?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
@ 2026-04-07 14:19 Weijun Pan
0 siblings, 0 replies; 6+ 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] 6+ messages in thread
* Re: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
2026-04-07 14:09 ` Stephen Hemminger
@ 2026-06-10 14:15 ` Thomas Monjalon
2026-06-11 14:11 ` David Marchand
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2026-06-10 14:15 UTC (permalink / raw)
To: Weijun Pan, Hemant Agrawal, Weijun Pan
Cc: dev, Sachin Saxena, Jun Yang, stable, Stephen Hemminger
07/04/2026 16:09, Stephen Hemminger:
> Why are these not inline functions.
> Macros with lower case names are likely place fore confusion like this?
Hemant, Sachin, Weijun, please could you consider this comment?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] bus/fslmc: fix shadowed variables in queue storage macros
2026-06-10 14:15 ` Thomas Monjalon
@ 2026-06-11 14:11 ` David Marchand
0 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2026-06-11 14:11 UTC (permalink / raw)
To: Weijun Pan, Hemant Agrawal, Sachin Saxena
Cc: Weijun Pan, dev, Jun Yang, stable, Thomas Monjalon,
Stephen Hemminger
On Wed, 10 Jun 2026 at 16:16, Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 07/04/2026 16:09, Stephen Hemminger:
> > Why are these not inline functions.
> > Macros with lower case names are likely place fore confusion like this?
>
> Hemant, Sachin, Weijun, please could you consider this comment?
Besides, I understand the intention behind bz 1744 is to re-enable Wshadow.
But after applying this fix, I still see many warnings after re-enabling:
$ git diff
diff --git a/drivers/bus/fslmc/meson.build b/drivers/bus/fslmc/meson.build
index ceae1c6c11..70098ad778 100644
--- a/drivers/bus/fslmc/meson.build
+++ b/drivers/bus/fslmc/meson.build
@@ -6,8 +6,6 @@ if not is_linux
reason = 'only supported on Linux'
endif
-cflags += no_shadow_cflag
-
deps += ['common_dpaax', 'eventdev', 'kvargs']
sources = files(
'fslmc_bus.c',
$ ./devtools/test-meson-builds.sh
...
../../../git/pub/dpdk.org/main/drivers/bus/fslmc/qbman/qbman_portal.c:
In function ‘qbman_swp_enqueue_multiple_cinh_read_direct’:
../../../git/pub/dpdk.org/main/drivers/bus/fslmc/qbman/qbman_portal.c:1092:47:
error: declaration of ‘d’ shadows a parameter [-Werror=shadow]
1092 | struct qbman_eq_desc *d = (struct
qbman_eq_desc *)p;
| ^
../../../git/pub/dpdk.org/main/drivers/bus/fslmc/qbman/qbman_portal.c:1047:45:
note: shadowed declaration is here
1047 | const struct qbman_eq_desc *d,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
../../../git/pub/dpdk.org/main/drivers/bus/fslmc/qbman/qbman_portal.c:
In function ‘qbman_swp_enqueue_multiple_cinh_direct’:
../../../git/pub/dpdk.org/main/drivers/bus/fslmc/qbman/qbman_portal.c:1161:47:
error: declaration of ‘d’ shadows a parameter [-Werror=shadow]
1161 | struct qbman_eq_desc *d = (struct
qbman_eq_desc *)p;
| ^
--
David Marchand
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-11 14:12 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-04 17:19 [PATCH] bus/fslmc: fix shadowed variables in queue storage macros Weijun Pan
2026-04-06 5:05 ` Hemant Agrawal
2026-04-07 14:09 ` Stephen Hemminger
2026-06-10 14:15 ` Thomas Monjalon
2026-06-11 14:11 ` David Marchand
-- strict thread matches above, loose matches on Subject: below --
2026-04-07 14:19 Weijun Pan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.