[PATCH 2/2] net/bnxt: fix shadow variable warnings

Stephen Hemminger
2026-03-12T00:21:44Z

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