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>,
	Kishore Padmanabha <kishore.padmanabha@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: [PATCH 2/2] net/bnxt: fix shadow variable warnings
Date: Wed, 11 Mar 2026 17:20:27 -0700	[thread overview]
Message-ID: <20260312002123.867357-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20260312002123.867357-1-stephen@networkplumber.org>

Fix things flagged as warnings about shadowed variables.
If the variable was harmless overlap then just drop the shadowed
version. For min values case use RTE_MIN3() and RTE_MIN4().

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnxt/bnxt.h        | 6 +++---
 drivers/net/bnxt/bnxt_ethdev.c | 3 +--
 drivers/net/bnxt/bnxt_rxq.c    | 6 ++----
 drivers/net/bnxt/bnxt_txr.c    | 3 ---
 4 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 7515f0564f..8b81c11b32 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -1110,9 +1110,9 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
 	 * max Tx rings == max Rx rings, one stat ctx for each.
 	 */
 	if (BNXT_STINGRAY(bp)) {
-		max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
-					       MAX_STINGRAY_RINGS),
-				       bp->max_stat_ctx / 2U);
+		max_rx_rings = RTE_MIN3(max_rx_rings / 2U,
+					MAX_STINGRAY_RINGS,
+					bp->max_stat_ctx / 2U);
 	} else {
 		max_rx_rings = RTE_MIN(max_rx_rings / 2U,
 				       bp->max_stat_ctx / 2U);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b677f9491d..f033c34aab 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -473,7 +473,7 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 
 	/* Alloc RSS context only if RSS mode is enabled */
 	if (dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS) {
-		int j, nr_ctxs = bnxt_rss_ctxts(bp);
+		unsigned int nr_ctxs = bnxt_rss_ctxts(bp);
 
 		/* RSS table size in P5 is 512.
 		 * Cap max Rx rings to same value
@@ -3560,7 +3560,6 @@ bnxt_rx_descriptor_status_op(void *rx_queue, uint16_t offset)
 	 */
 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 	if (bp->flags & BNXT_FLAG_RX_VECTOR_PKT_MODE) {
-		struct rx_pkt_cmpl *rxcmp;
 		uint32_t cons;
 
 		/* Check status of completion descriptor. */
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 91b3555df6..df9ed391c4 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -98,10 +98,8 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			/* ETH_8/64_POOLs */
 			pools = conf->nb_queue_pools;
 			/* For each pool, allocate MACVLAN CFA rule & VNIC */
-			max_pools = RTE_MIN(bp->max_vnics,
-					    RTE_MIN(bp->max_l2_ctx,
-					    RTE_MIN(bp->max_rsscos_ctx,
-						    RTE_ETH_64_POOLS)));
+			max_pools = RTE_MIN4(bp->max_vnics, bp->max_l2_ctx,
+					    bp->max_rsscos_ctx, RTE_ETH_64_POOLS);
 			PMD_DRV_LOG_LINE(DEBUG,
 				    "pools = %u max_pools = %u",
 				    pools, max_pools);
diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c
index 27758898b0..498778aae0 100644
--- a/drivers/net/bnxt/bnxt_txr.c
+++ b/drivers/net/bnxt/bnxt_txr.c
@@ -179,9 +179,6 @@ bnxt_check_pkt_needs_ts(struct rte_mbuf *m)
 		if (proto == RTE_ETHER_TYPE_ECPRI)
 			return true;
 		if (proto == RTE_ETHER_TYPE_VLAN) {
-			const struct rte_vlan_hdr *vh;
-			struct rte_vlan_hdr vh_copy;
-
 			vh = rte_pktmbuf_read(m, off, sizeof(*vh), &vh_copy);
 			if (unlikely(vh == NULL))
 				return false;
-- 
2.51.0


  parent reply	other threads:[~2026-03-12  0:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  0:20 [PATCH 0/2] net/bnxt: shadow variable warnings Stephen Hemminger
2026-03-12  0:20 ` [PATCH 1/2] eal: add RTE_MIN4 and RTE_MAX4 macros Stephen Hemminger
2026-03-12  0:20 ` Stephen Hemminger [this message]
2026-03-12 22:46   ` [PATCH 2/2] net/bnxt: fix shadow variable warnings Kishore Padmanabha
2026-03-17  8:02   ` Thomas Monjalon
2026-03-18  3:16     ` 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=20260312002123.867357-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=kishore.padmanabha@broadcom.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