Re: [PATCH net-next v11 02/10] bnge: add NTUPLE/ARFS VNIC

From: netdev-bot+sashiko

Date: Tue Dec 01 2026 - 01:39:44 EST


Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The patch makes the NTUPLE VNIC mandatory, which doubles the
RSS-context demand, and nothing reduces the RX ring count to fit when…

--

bnge: add NTUPLE/ARFS VNIC

This patch sets up a second VNIC for NTUPLE/aRFS, which brings the total
VNIC count to 2 and doubles the RSS context request. It adds
ndo_fix_features/ndo_set_features handling for NETIF_F_NTUPLE. It also
moves the bnge_rings_ok() check in bnge_reserve_rings() ahead of the ring
count updates.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index 01205b161d822..5207091a72901 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> @@ -206,12 +206,16 @@ int bnge_cal_nr_rss_ctxs(u16 rx_rings)
> static u16 bnge_get_total_rss_ctxs(struct bnge_dev *bd,
> struct bnge_hw_rings *hwr)
> {
> - return bnge_cal_nr_rss_ctxs(hwr->grp);
> + u16 rss_ctx = bnge_cal_nr_rss_ctxs(hwr->grp);
> +
> + rss_ctx *= hwr->vnic;
> +
> + return rss_ctx;
> }

[ ... ]

> static bool bnge_rings_ok(struct bnge_hw_rings *hwr)
> {
> - return hwr->tx && hwr->rx && hwr->nq && hwr->grp && hwr->vnic &&
> - hwr->stat && hwr->cmpl;
> + /* The default and the NTUPLE VNICs each need a full set of RSS
> + * contexts for the final number of ring groups.
> + */
> + return hwr->tx && hwr->rx && hwr->nq && hwr->grp &&
> + hwr->vnic >= BNGE_BASE_VNICS && hwr->stat && hwr->cmpl &&
> + hwr->rss_ctx >= bnge_cal_nr_rss_ctxs(hwr->grp) * BNGE_BASE_VNICS;
> }

[ ... ]

> @@ -347,6 +358,16 @@ int bnge_reserve_rings(struct bnge_dev *bd)
> hwr.rx = rx_rings << 1;
> tx_cp = hwr.tx;
> hwr.nq = sh ? max_t(u16, tx_cp, rx_rings) : tx_cp + rx_rings;
> +
> + /* One ring group per rx ring, so rss_ctx is checked against the final
> + * rx ring count. Fail before the driver ring counts (tx, rx and nq) are
> + * changed, so that a failed call does not leave reduced counts behind
> + * for the next call to find unchanged.
> + */
> + hwr.grp = rx_rings;
> + if (!bnge_rings_ok(&hwr))
> + return -ENOMEM;
> +

[Severity: Medium]
If firmware grants fewer RSS contexts than requested, does this
-ENOMEM now make the device fail to probe even when a smaller rx ring
count would fit?

The number of contexts each VNIC needs grows with the rx ring count,
because it comes from bnge_cal_nr_rss_ctxs(): 1 up to 64 rings, 2 for
65-128, 4 for 129-192, and so on up to 8. With two mandatory VNICs, the
requirement checked in bnge_rings_ok() doubles.

Nothing on the default ring sizing path seems to limit rx rings by
hw_resc->max_rsscos_ctxs or max_vnics. _bnge_get_max_rings() only
clamps by ring groups and table size:

*max_rx = min_t(int, *max_rx, max_ring_grps);
*max_rx = min_t(int, *max_rx, BNGE_MAX_RSS_TABLE_ENTRIES);

At probe, bnge_net_init_dflt_rings() calls bnge_reserve_rings() a second
time. Now that the failure happens before the ring counts change, the
retry uses the same counts and fails the same way. The code then does:

if (rc) {
bd->tx_nr_rings = 0;
bd->rx_nr_rings = 0;
}

and probe fails.

For example, netif_get_num_default_rss_queues() can return more than 64
on a host with many cores. In that case each VNIC needs 2 contexts and
the request is 4. If firmware grants only 2, the function could still run
64 rings on two VNICs, or keep the previous single-VNIC setup at the
original ring count. Instead, it does not probe.

bnge_open() hits the same failure if the ring count is later raised past
one of these context boundaries.

Would it make sense to reduce rx_rings to the largest count the granted
resv_rsscos_ctxs can serve across BNGE_BASE_VNICS, instead of returning
-ENOMEM? Later in the series, bnge_rss_ctx_capable() treats
max_rsscos_ctxs and max_vnics as real limits for user RSS contexts. The
base ring sizing does not use them.

The commit message says:

The NTUPLE/aRFS VNIC is always allocated, so the function needs at
least BNGE_BASE_VNICS (2) VNICs and the matching RSS contexts.
Firmware grants these to every supported function.

Could it also say that the number of RSS contexts needed grows with the
rx ring count, and that rx rings are not reduced to fit the grant?

> bd->tx_nr_rings = hwr.tx;
> if (!bd->num_tc)
> bd->tx_nr_rings_per_tc = bd->tx_nr_rings;

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130055736.2306367-1-vikas.gupta%40broadcom.com