patch 'table: fix variable shadowing' has been queued to stable release 24.11.5
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Fri Feb 20 15:55:15 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.5
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 02/22/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/3cf3fd996e4880b094d7523390bc263845ebc81d
Thanks.
Luca Boccassi
---
>From 3cf3fd996e4880b094d7523390bc263845ebc81d Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Wed, 14 Jan 2026 15:44:21 +0000
Subject: [PATCH] table: fix variable shadowing
[ upstream commit 99c39584343e13aa7f52119bd4e22cc24bb52bdb ]
Building table library with -Wshadow reveals many warnings from shadowed
variables. Fix these by removing definitions, or renaming variables as
appropriate.
Fixes: 0c06fa3bfa8c ("table: support learner tables")
Fixes: d0a00966618b ("table: add exact match SWX table")
Fixes: 1e29a162482c ("table: separate out x86-specific from LRU header")
Fixes: 8aa327214ceb ("table: hash")
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/table/rte_lru.h | 38 +++++++++++++++----------------
lib/table/rte_lru_arm64.h | 14 ++++++------
lib/table/rte_lru_x86.h | 4 ++--
lib/table/rte_swx_table_em.c | 2 --
lib/table/rte_swx_table_learner.c | 4 ++--
lib/table/rte_table_hash_key16.c | 4 +---
lib/table/rte_table_hash_key32.c | 4 +---
lib/table/rte_table_hash_key8.c | 4 +---
8 files changed, 33 insertions(+), 41 deletions(-)
diff --git a/lib/table/rte_lru.h b/lib/table/rte_lru.h
index 28aab12923..1436425e16 100644
--- a/lib/table/rte_lru.h
+++ b/lib/table/rte_lru.h
@@ -41,33 +41,33 @@ while (0)
#define lru_update(bucket, mru_val) \
do { \
- uint64_t x, pos, x0, x1, x2, mask; \
+ uint64_t _x, _pos, _x0, _x1, _x2, _mask; \
\
- x = bucket->lru_list; \
+ _x = bucket->lru_list; \
\
- pos = 4; \
- if ((x >> 48) == ((uint64_t) mru_val)) \
- pos = 3; \
+ _pos = 4; \
+ if ((_x >> 48) == ((uint64_t) mru_val)) \
+ _pos = 3; \
\
- if (((x >> 32) & 0xFFFFLLU) == ((uint64_t) mru_val)) \
- pos = 2; \
+ if (((_x >> 32) & 0xFFFFLLU) == ((uint64_t) mru_val)) \
+ _pos = 2; \
\
- if (((x >> 16) & 0xFFFFLLU) == ((uint64_t) mru_val)) \
- pos = 1; \
+ if (((_x >> 16) & 0xFFFFLLU) == ((uint64_t) mru_val)) \
+ _pos = 1; \
\
- if ((x & 0xFFFFLLU) == ((uint64_t) mru_val)) \
- pos = 0; \
+ if ((_x & 0xFFFFLLU) == ((uint64_t) mru_val)) \
+ _pos = 0; \
\
\
- pos <<= 4; \
- mask = (~0LLU) << pos; \
- x0 = x & (~mask); \
- x1 = (x >> 16) & mask; \
- x2 = (x << (48 - pos)) & (0xFFFFLLU << 48); \
- x = x0 | x1 | x2; \
+ _pos <<= 4; \
+ _mask = (~0LLU) << _pos; \
+ _x0 = _x & (~_mask); \
+ _x1 = (_x >> 16) & _mask; \
+ _x2 = (_x << (48 - _pos)) & (0xFFFFLLU << 48); \
+ _x = _x0 | _x1 | _x2; \
\
- if (pos != 64) \
- bucket->lru_list = x; \
+ if (_pos != 64) \
+ bucket->lru_list = _x; \
} while (0)
#elif (RTE_TABLE_HASH_LRU_STRATEGY == 2) || (RTE_TABLE_HASH_LRU_STRATEGY == 3)
diff --git a/lib/table/rte_lru_arm64.h b/lib/table/rte_lru_arm64.h
index f9a4678ee0..817b791b6e 100644
--- a/lib/table/rte_lru_arm64.h
+++ b/lib/table/rte_lru_arm64.h
@@ -40,16 +40,16 @@ f_lru_pos(uint64_t lru_list)
#define lru_update(bucket, mru_val) \
do { \
- const uint64_t orvals[] = {0xFFFFLLU, 0xFFFFLLU << 16, \
+ const uint64_t _orvals[] = {0xFFFFLLU, 0xFFFFLLU << 16, \
0xFFFFLLU << 32, 0xFFFFLLU << 48, 0LLU}; \
- const uint64_t decs[] = {0x1000100010001LLU, 0}; \
- uint64x1_t lru = vdup_n_u64(bucket->lru_list); \
- uint64x1_t vdec = vdup_n_u64(decs[mru_val>>2]); \
+ const uint64_t _decs[] = {0x1000100010001LLU, 0}; \
+ uint64x1_t _lru = vdup_n_u64(bucket->lru_list); \
+ uint64x1_t _vdec = vdup_n_u64(_decs[mru_val>>2]); \
bucket->lru_list = vget_lane_u64(vreinterpret_u64_u16( \
- vsub_u16(vreinterpret_u16_u64(lru), \
- vreinterpret_u16_u64(vdec))), \
+ vsub_u16(vreinterpret_u16_u64(_lru), \
+ vreinterpret_u16_u64(_vdec))), \
0); \
- bucket->lru_list |= orvals[mru_val]; \
+ bucket->lru_list |= _orvals[mru_val]; \
} while (0)
#endif
diff --git a/lib/table/rte_lru_x86.h b/lib/table/rte_lru_x86.h
index 93f4a136a8..de74513653 100644
--- a/lib/table/rte_lru_x86.h
+++ b/lib/table/rte_lru_x86.h
@@ -50,9 +50,9 @@ do { \
/* Find the minimum value (first zero word, if it's in there) */\
__m128i d = _mm_minpos_epu16(c); \
/* Second word is the index to found word (first word is the value) */\
- unsigned int pos = _mm_extract_epi16(d, 1); \
+ unsigned int _pos = _mm_extract_epi16(d, 1); \
/* move the recently used location to top of list */ \
- __m128i k = _mm_shuffle_epi8(b, *((__m128i *) &masks[2 * pos]));\
+ __m128i k = _mm_shuffle_epi8(b, *((__m128i *) &masks[2 * _pos]));\
/* Finally, update the original list with the reordered data */ \
bucket->lru_list = _mm_extract_epi64(k, 0); \
/* Phwew! */ \
diff --git a/lib/table/rte_swx_table_em.c b/lib/table/rte_swx_table_em.c
index 2f042d74b3..628fb98ec0 100644
--- a/lib/table/rte_swx_table_em.c
+++ b/lib/table/rte_swx_table_em.c
@@ -620,8 +620,6 @@ table_create(struct rte_swx_table_params *params,
return t;
TAILQ_FOREACH(entry, entries, node) {
- int status;
-
status = table_add(t, entry);
if (status) {
table_free(t);
diff --git a/lib/table/rte_swx_table_learner.c b/lib/table/rte_swx_table_learner.c
index 55a3645e06..1d7c9800a4 100644
--- a/lib/table/rte_swx_table_learner.c
+++ b/lib/table/rte_swx_table_learner.c
@@ -404,13 +404,13 @@ rte_swx_table_learner_lookup(void *table,
for (i = 0; i < TABLE_KEYS_PER_BUCKET; i++) {
uint64_t time = b->time[i];
uint32_t sig = b->sig[i];
- uint8_t *key = table_bucket_key_get(t, b, i);
+ uint8_t *k = table_bucket_key_get(t, b, i);
time <<= 32;
if ((time > input_time) &&
(sig == m->input_sig) &&
- t->params.keycmp_func(key, m->input_key, t->params.key_size)) {
+ t->params.keycmp_func(k, m->input_key, t->params.key_size)) {
uint64_t *data = table_bucket_data_get(t, b, i);
/* Hit. */
diff --git a/lib/table/rte_table_hash_key16.c b/lib/table/rte_table_hash_key16.c
index 67b77c16a0..804c1a0ae1 100644
--- a/lib/table/rte_table_hash_key16.c
+++ b/lib/table/rte_table_hash_key16.c
@@ -1132,12 +1132,10 @@ grind_next_buckets:
uint64_t buckets_mask_next = 0;
for ( ; buckets_mask; ) {
- uint64_t pkt_mask;
uint32_t pkt_index;
pkt_index = rte_ctz64(buckets_mask);
- pkt_mask = 1LLU << pkt_index;
- buckets_mask &= ~pkt_mask;
+ buckets_mask &= ~(1LLU << pkt_index);
lookup_grinder(pkt_index, buckets, keys, pkts_mask_out,
entries, buckets_mask_next, f);
diff --git a/lib/table/rte_table_hash_key32.c b/lib/table/rte_table_hash_key32.c
index 1aa86c6a49..27c790af70 100644
--- a/lib/table/rte_table_hash_key32.c
+++ b/lib/table/rte_table_hash_key32.c
@@ -1166,12 +1166,10 @@ grind_next_buckets:
uint64_t buckets_mask_next = 0;
for ( ; buckets_mask; ) {
- uint64_t pkt_mask;
uint32_t pkt_index;
pkt_index = rte_ctz64(buckets_mask);
- pkt_mask = 1LLU << pkt_index;
- buckets_mask &= ~pkt_mask;
+ buckets_mask &= ~(1LLU << pkt_index);
lookup_grinder(pkt_index, buckets, keys, pkts_mask_out,
entries, buckets_mask_next, f);
diff --git a/lib/table/rte_table_hash_key8.c b/lib/table/rte_table_hash_key8.c
index c8d72b333d..3ff6574339 100644
--- a/lib/table/rte_table_hash_key8.c
+++ b/lib/table/rte_table_hash_key8.c
@@ -1100,12 +1100,10 @@ grind_next_buckets:
uint64_t buckets_mask_next = 0;
for ( ; buckets_mask; ) {
- uint64_t pkt_mask;
uint32_t pkt_index;
pkt_index = rte_ctz64(buckets_mask);
- pkt_mask = 1LLU << pkt_index;
- buckets_mask &= ~pkt_mask;
+ buckets_mask &= ~(1LLU << pkt_index);
lookup_grinder(pkt_index, buckets, keys, pkts_mask_out,
entries, buckets_mask_next, f);
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-02-20 14:55:43.869442375 +0000
+++ 0013-table-fix-variable-shadowing.patch 2026-02-20 14:55:43.172190532 +0000
@@ -1 +1 @@
-From 99c39584343e13aa7f52119bd4e22cc24bb52bdb Mon Sep 17 00:00:00 2001
+From 3cf3fd996e4880b094d7523390bc263845ebc81d Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 99c39584343e13aa7f52119bd4e22cc24bb52bdb ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -131 +132 @@
-index 4ec54cb635..c408ea6fc3 100644
+index 2f042d74b3..628fb98ec0 100644
@@ -134 +135 @@
-@@ -621,8 +621,6 @@ table_create(struct rte_swx_table_params *params,
+@@ -620,8 +620,6 @@ table_create(struct rte_swx_table_params *params,
@@ -144 +145 @@
-index 2d61bceeaf..3680bf26c1 100644
+index 55a3645e06..1d7c9800a4 100644
@@ -147 +148 @@
-@@ -411,13 +411,13 @@ rte_swx_table_learner_lookup(void *table,
+@@ -404,13 +404,13 @@ rte_swx_table_learner_lookup(void *table,
@@ -164 +165 @@
-index da24a7985d..5b69106dd7 100644
+index 67b77c16a0..804c1a0ae1 100644
@@ -167 +168 @@
-@@ -1133,12 +1133,10 @@ grind_next_buckets:
+@@ -1132,12 +1132,10 @@ grind_next_buckets:
@@ -182 +183 @@
-index 297931a2a5..0963f57828 100644
+index 1aa86c6a49..27c790af70 100644
@@ -185 +186 @@
-@@ -1167,12 +1167,10 @@ grind_next_buckets:
+@@ -1166,12 +1166,10 @@ grind_next_buckets:
@@ -200 +201 @@
-index 746863082f..5e9dcf10ee 100644
+index c8d72b333d..3ff6574339 100644
@@ -203 +204 @@
-@@ -1101,12 +1101,10 @@ grind_next_buckets:
+@@ -1100,12 +1100,10 @@ grind_next_buckets:
More information about the stable
mailing list