[PATCH 17/23] examples/l2fwd-jobstats: fix shadowed variable

Stephen Hemminger stephen at networkplumber.org
Tue Apr 7 05:49:43 CEST 2026


The inner loop across ports was shadowing other definition
of variable i.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 examples/l2fwd-jobstats/main.c      | 6 +++---
 examples/l2fwd-jobstats/meson.build | 1 -
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c
index 036bd4f951..f2c284cebb 100644
--- a/examples/l2fwd-jobstats/main.c
+++ b/examples/l2fwd-jobstats/main.c
@@ -515,7 +515,6 @@ l2fwd_main_loop(void)
 			uint64_t repeats = 0;
 
 			do {
-				uint8_t i;
 				uint64_t now = rte_get_timer_cycles();
 
 				repeats++;
@@ -526,8 +525,9 @@ l2fwd_main_loop(void)
 					rte_memory_order_relaxed);
 				need_manage |= stats_read_pending;
 
-				for (i = 0; i < qconf->n_rx_port && !need_manage; i++)
-					need_manage = qconf->rx_timers[i].expire < now;
+				for (uint16_t port_id = 0;
+				     port_id < qconf->n_rx_port && !need_manage; port_id++)
+					need_manage = qconf->rx_timers[port_id].expire < now;
 
 			} while (!need_manage);
 
diff --git a/examples/l2fwd-jobstats/meson.build b/examples/l2fwd-jobstats/meson.build
index 51da6e277e..d59d3d6555 100644
--- a/examples/l2fwd-jobstats/meson.build
+++ b/examples/l2fwd-jobstats/meson.build
@@ -12,4 +12,3 @@ sources = files(
         'main.c',
 )
 cflags += no_wvla_cflag
-cflags += no_shadow_cflag
-- 
2.53.0



More information about the dev mailing list