patch 'table: fix variable shadowing' has been queued to stable release 23.11.7
Shani Peretz
shperetz at nvidia.com
Tue Mar 31 08:23:40 CEST 2026
Hi,
FYI, your patch has been queued to stable release 23.11.7
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/05/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/shanipr/dpdk-stable
This queued commit can be viewed at:
https://github.com/shanipr/dpdk-stable/commit/9cfac830fee5f825abfd469275012df0d2f6bf5b
Thanks.
Shani
---
>From 9cfac830fee5f825abfd469275012df0d2f6bf5b 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 88229d8632..e7951c5dfb 100644
--- a/lib/table/rte_lru.h
+++ b/lib/table/rte_lru.h
@@ -45,33 +45,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 f19b0bdb4e..1c9be4e4ea 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 ddfb8c1c8c..425d97bb91 100644
--- a/lib/table/rte_lru_x86.h
+++ b/lib/table/rte_lru_x86.h
@@ -54,9 +54,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 2b5e6bdce1..abcd42a188 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 584c3f2c98..f889bb454a 100644
--- a/lib/table/rte_table_hash_key16.c
+++ b/lib/table/rte_table_hash_key16.c
@@ -1128,12 +1128,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 22b5ca9166..e88bdb8242 100644
--- a/lib/table/rte_table_hash_key32.c
+++ b/lib/table/rte_table_hash_key32.c
@@ -1162,12 +1162,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 bd0ec4aac0..3b1aab46df 100644
--- a/lib/table/rte_table_hash_key8.c
+++ b/lib/table/rte_table_hash_key8.c
@@ -1096,12 +1096,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.43.0
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-03-31 00:32:31.425835774 +0300
+++ 0021-table-fix-variable-shadowing.patch 2026-03-31 00:32:28.667284000 +0300
@@ -1 +1 @@
-From 99c39584343e13aa7f52119bd4e22cc24bb52bdb Mon Sep 17 00:00:00 2001
+From 9cfac830fee5f825abfd469275012df0d2f6bf5b Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 99c39584343e13aa7f52119bd4e22cc24bb52bdb ]
+
@@ -14 +15,0 @@
-Cc: stable at dpdk.org
@@ -30 +31 @@
-index 28aab12923..1436425e16 100644
+index 88229d8632..e7951c5dfb 100644
@@ -33 +34 @@
-@@ -41,33 +41,33 @@ while (0)
+@@ -45,33 +45,33 @@ while (0)
@@ -87 +88 @@
-index f9a4678ee0..817b791b6e 100644
+index f19b0bdb4e..1c9be4e4ea 100644
@@ -115 +116 @@
-index 93f4a136a8..de74513653 100644
+index ddfb8c1c8c..425d97bb91 100644
@@ -118 +119 @@
-@@ -50,9 +50,9 @@ do { \
+@@ -54,9 +54,9 @@ do { \
@@ -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 2b5e6bdce1..abcd42a188 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 584c3f2c98..f889bb454a 100644
@@ -167 +168 @@
-@@ -1133,12 +1133,10 @@ grind_next_buckets:
+@@ -1128,12 +1128,10 @@ grind_next_buckets:
@@ -182 +183 @@
-index 297931a2a5..0963f57828 100644
+index 22b5ca9166..e88bdb8242 100644
@@ -185 +186 @@
-@@ -1167,12 +1167,10 @@ grind_next_buckets:
+@@ -1162,12 +1162,10 @@ grind_next_buckets:
@@ -200 +201 @@
-index 746863082f..5e9dcf10ee 100644
+index bd0ec4aac0..3b1aab46df 100644
@@ -203 +204 @@
-@@ -1101,12 +1101,10 @@ grind_next_buckets:
+@@ -1096,12 +1096,10 @@ grind_next_buckets:
More information about the stable
mailing list