public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Chas Williams <3chas3@gmail.com>,
	"Min Hu (Connor)" <humin29@huawei.com>
Subject: [PATCH 05/23] examples/bond: fix shadow variable warnings
Date: Mon,  6 Apr 2026 20:49:31 -0700	[thread overview]
Message-ID: <20260407035209.650419-6-stephen@networkplumber.org> (raw)
In-Reply-To: <20260407035209.650419-1-stephen@networkplumber.org>

Fix shadow variable warnings
- remove mbuf_pool parameters since member_port_init() and
  bond_port_init() always called with same pool.
- rename members array used in show command
- make the variables static

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/bond/main.c      | 21 ++++++++++-----------
 examples/bond/meson.build |  1 -
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/examples/bond/main.c b/examples/bond/main.c
index 4e8eeb7a5e..99359cd6fb 100644
--- a/examples/bond/main.c
+++ b/examples/bond/main.c
@@ -96,13 +96,12 @@
 		":%02"PRIx8":%02"PRIx8":%02"PRIx8,	\
 		RTE_ETHER_ADDR_BYTES(&addr))
 
-uint16_t members[RTE_MAX_ETHPORTS];
-uint16_t members_count;
+static uint16_t members[RTE_MAX_ETHPORTS];
+static uint16_t members_count;
+static struct rte_mempool *mbuf_pool;
 
 static uint16_t BOND_PORT = 0xffff;
 
-static struct rte_mempool *mbuf_pool;
-
 static struct rte_eth_conf port_conf = {
 	.rxmode = {
 		.mq_mode = RTE_ETH_MQ_RX_NONE,
@@ -119,7 +118,7 @@ static struct rte_eth_conf port_conf = {
 };
 
 static void
-member_port_init(uint16_t portid, struct rte_mempool *mbuf_pool)
+member_port_init(uint16_t portid)
 {
 	int retval;
 	uint16_t nb_rxd = RTE_RX_DESC_DEFAULT;
@@ -204,7 +203,7 @@ member_port_init(uint16_t portid, struct rte_mempool *mbuf_pool)
 }
 
 static void
-bond_port_init(struct rte_mempool *mbuf_pool)
+bond_port_init(void)
 {
 	int retval;
 	uint8_t i;
@@ -462,10 +461,10 @@ static inline void get_string(struct cmd_send_result *res, char *buf, uint8_t si
 		((unsigned)((unsigned char *)&(res->ip.addr.ipv4))[3])
 		);
 }
+
 void
 cmd_send_parsed(void *parsed_result, __rte_unused struct cmdline *cl, __rte_unused void *data)
 {
-
 	struct cmd_send_result *res = parsed_result;
 	char ip_str[INET6_ADDRSTRLEN];
 
@@ -635,7 +634,7 @@ cmd_quit_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unus
 void
 cmd_show_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unused void *data)
 {
-	uint16_t members[16] = {0};
+	uint16_t act_members[16] = {0};
 	uint8_t len = 16;
 	struct rte_ether_addr addr;
 	uint16_t i;
@@ -658,7 +657,7 @@ cmd_show_parsed(__rte_unused void *parsed_result, struct cmdline *cl, __rte_unus
 	cmdline_printf(cl,
 			"Active_members:%d "
 			"packets received:Tot:%d Arp:%d IPv4:%d\n",
-			rte_eth_bond_active_members_get(BOND_PORT, members, len),
+			rte_eth_bond_active_members_get(BOND_PORT, act_members, len),
 			global_flag_stru_p->port_packets[0],
 			global_flag_stru_p->port_packets[1],
 			global_flag_stru_p->port_packets[2]);
@@ -706,11 +705,11 @@ main(int argc, char *argv[])
 	/* initialize all ports */
 	members_count = nb_ports;
 	RTE_ETH_FOREACH_DEV(i) {
-		member_port_init(i, mbuf_pool);
+		member_port_init(i);
 		members[i] = i;
 	}
 
-	bond_port_init(mbuf_pool);
+	bond_port_init();
 
 	rte_spinlock_init(&global_flag_stru_p->lock);
 
diff --git a/examples/bond/meson.build b/examples/bond/meson.build
index 45389998e4..5a6db9a870 100644
--- a/examples/bond/meson.build
+++ b/examples/bond/meson.build
@@ -11,7 +11,6 @@ allow_experimental_apis = true
 sources = files(
         'main.c',
 )
-cflags += no_shadow_cflag
 
 cmd_h = custom_target('commands_hdr',
         output: 'commands.h',
-- 
2.53.0


  parent reply	other threads:[~2026-04-07  3:52 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07  3:49 [PATCH 00/23] examples: enable -Wshadow across all examples Stephen Hemminger
2026-04-07  3:49 ` [PATCH 01/23] examples/ethtool: fix shadow variable warning Stephen Hemminger
2026-04-07  3:49 ` [PATCH 02/23] examples/eventdev_pipeline: " Stephen Hemminger
2026-04-07  3:49 ` [PATCH 03/23] examples/dma: fix shadow variable warnings Stephen Hemminger
2026-04-07  3:49 ` [PATCH 04/23] examples/packet_ordering: fix shadow variable warning Stephen Hemminger
2026-04-07  3:49 ` Stephen Hemminger [this message]
2026-04-07  3:49 ` [PATCH 06/23] examples/vmdq: " Stephen Hemminger
2026-04-07  3:49 ` [PATCH 07/23] examples/server_node_efd: fix shadowed variable Stephen Hemminger
2026-04-07  3:49 ` [PATCH 08/23] examples/flow_filtering: fix shadowed variables Stephen Hemminger
2026-04-07  3:49 ` [PATCH 09/23] examples/ipsec-secgw: " Stephen Hemminger
2026-04-07  3:49 ` [PATCH 10/23] examples/ip_pipeline: fix shadow variable Stephen Hemminger
2026-04-07  3:49 ` [PATCH 11/23] examples/multi_process: fix shadowed variable Stephen Hemminger
2026-04-07  3:49 ` [PATCH 12/23] examples/vm_power_manage: enable shadow warnings Stephen Hemminger
2026-04-07  3:49 ` [PATCH 13/23] examples/bbdev_app: " Stephen Hemminger
2026-04-07  3:49 ` [PATCH 14/23] examples/ptpclient: fix shadow variable warnings Stephen Hemminger
2026-04-07  3:49 ` [PATCH 15/23] examples/vhost: fix shadow warnings Stephen Hemminger
2026-04-07  3:49 ` [PATCH 16/23] examples/qos_sched: eliminate shadowed variables Stephen Hemminger
2026-04-07  3:49 ` [PATCH 17/23] examples/l2fwd-jobstats: fix shadowed variable Stephen Hemminger
2026-04-07  3:49 ` [PATCH 18/23] examples/l2fwd-crypto: remove no shadow flag Stephen Hemminger
2026-04-07  3:49 ` [PATCH 19/23] examples/l2fwd-event: " Stephen Hemminger
2026-04-07  3:49 ` [PATCH 20/23] examples/l2fwd-keepalive: fix shadow variable warning Stephen Hemminger
2026-04-07  3:49 ` [PATCH 21/23] examples/l3fwd-graph: remove no shadow flag Stephen Hemminger
2026-04-07  3:49 ` [PATCH 22/23] examples/l3fwd: fix shadow variable warnings Stephen Hemminger
2026-04-07  3:49 ` [PATCH 23/23] examples/l3fwd-power: " Stephen Hemminger
2026-04-07  9:22 ` [PATCH 00/23] examples: enable -Wshadow across all examples Bruce Richardson
2026-04-07 15:15 ` [PATCH v2 00/23] examples: fix -Wshadow warnings Stephen Hemminger
2026-04-07 15:15   ` [PATCH v2 01/23] examples/ethtool: resolve shadow variable warnings Stephen Hemminger
2026-04-08  0:32     ` fengchengwen
2026-04-07 15:15   ` [PATCH v2 02/23] examples/eventdev_pipeline: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:15   ` [PATCH v2 03/23] examples/dma: resolve shadow variable warnings Stephen Hemminger
2026-04-08  0:30     ` fengchengwen
2026-04-07 15:16   ` [PATCH v2 04/23] examples/packet_ordering: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 05/23] examples/bond: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 06/23] examples/vmdq: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 07/23] examples/server_node_efd: " Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 08/23] examples/flow_filtering: resolve shadowed variable warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 09/23] examples/ipsec-secgw: " Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 10/23] examples/ip_pipeline: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 11/23] examples/multi_process: resolve shadowed variable warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 12/23] examples/vm_power_manage: enable shadow warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 13/23] examples/bbdev_app: " Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 14/23] examples/ptpclient: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 15/23] examples/vhost: resolve shadow warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 16/23] examples/qos_sched: eliminate shadowed variables Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 17/23] examples/l2fwd-jobstats: resolve shadowed variable Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 18/23] examples/l2fwd-crypto: resolve shadow variable Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 19/23] examples/l2fwd-event: resolve shadowed variable Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 20/23] examples/l2fwd-keepalive: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 21/23] examples/l3fwd-graph: " Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 22/23] examples/l3fwd: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16   ` [PATCH v2 23/23] examples/l3fwd-power: " Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260407035209.650419-6-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=3chas3@gmail.com \
    --cc=dev@dpdk.org \
    --cc=humin29@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox