Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: vikas.gupta@broadcom.com
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com,
	vsrama-krishna.nemani@broadcom.com,
	rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com,
	ajit.khaparde@broadcom.com
Subject: Re: [PATCH net-next v9 02/10] bnge: add NTUPLE/ARFS VNIC
Date: Tue, 24 Nov 2026 10:20:26 +0000	[thread overview]
Message-ID: <179551562631.3135.282811496111712768@kernel.org> (raw)
In-Reply-To: <20261123100746.1975030-3-vikas.gupta@broadcom.com>

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

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

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 two VNICs, each with a full set of RSS
  contexts, a hard requirement for probe.
- [Low] The commit message and the new comment in `bnge_reserve_rings()`
  overstate what a failed reservation preserves, and the message names a…

--

bnge: add NTUPLE/ARFS VNIC

This patch allocates a second VNIC for NTUPLE/aRFS. That brings the VNIC
count to BNGE_BASE_VNICS (2) and doubles the RSS context reservation. It
also moves the bnge_rings_ok() check in bnge_reserve_rings() ahead of the
driver ring count updates, and adds ndo_fix_features/ndo_set_features
handling for NETIF_F_NTUPLE.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index 01205b161d822..1de7905dd9f13 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;
>  }

[ ... ]

> @@ -237,8 +241,12 @@ static void bnge_copy_reserved_rings(struct bnge_dev *bd,
>  
>  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;
>  }

[Severity: Medium]
Can this make probe fail when the firmware's RSS context limit is below the
doubled demand, even though fewer rx rings would have fit?

bnge_cal_nr_rss_ctxs() grows with the rx ring count. It returns 1 context
for up to 64 rings, 2 for 65-128, and so on up to BNGE_RSS_TABLE_MAX_TBL.
bnge_get_total_rss_ctxs() now multiplies that by 2. Before this patch
bnge_rings_ok() did not check rss_ctx at all.

bnge_net_init_dflt_rings() picks the default rx ring count from
netif_get_num_default_rss_queues() and bnge_get_dflt_rings().
_bnge_get_max_rings() never reads hw_resc->max_rsscos_ctxs or
hw_resc->max_vnics, so the demand is never fitted to the context budget.

If the firmware grants fewer contexts, bnge_reserve_rings() returns -ENOMEM
without changing bd->rx_nr_rings. The retry then sends the same demand:

bnge_resc.c:bnge_net_init_dflt_rings() {
    ...
	/* Rings may have been reduced, re-reserve them again */
	if (bnge_need_reserve_rings(bd)) {
		rc = bnge_reserve_rings(bd);
		if (rc && rc != -ENODEV)
			dev_warn(bd->dev, "Fewer rings reservation failed\n");
		bd->tx_nr_rings_per_tc = bd->tx_nr_rings;
	}
	if (rc) {
		bd->tx_nr_rings = 0;
		bd->rx_nr_rings = 0;
	}
    ...
}

bnge_probe_one() then fails. The most likely trigger is a high-core-count
host where the default rx count is above 64.

The commit message says firmware grants these to every supported function,
but the driver never checks that. bnxt handles a shortage of VNICs or RSS
contexts by clearing RFS in bnxt_rfs_capable().

Would it make sense to cut the rx ring count to fit max_rsscos_ctxs, or to
fall back to a single VNIC, rather than failing probe? Later patches in the
series don't add such a fallback either. They only read max_rsscos_ctxs in
bnge_rss_ctx_capable() for additional contexts.

[ ... ]

> @@ -347,6 +358,15 @@ 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 any driver state is changed, so that a
> +	 * retry reserves again instead of finding the failed values in place.
> +	 */
> +	hwr.grp = rx_rings;
> +	if (!bnge_rings_ok(&hwr))
> +		return -ENOMEM;
> +

[Severity: Low]
Is "Fail before any driver state is changed" accurate here? By the time
bnge_rings_ok() runs, this call chain has already completed:

bnge_hwrm_reserve_rings()
  bnge_hwrm_reserve_pf_rings()
    bnge_hwrm_get_rings()

It overwrites bd->hw_resc.resv_* (rx/tx rings, vnics, rsscos_ctxs, cp
rings, stat ctxs, irqs). bnge_aux_set_stat_ctxs(bd, 0) may also have run
earlier in bnge_reserve_rings(). Only bd->tx_nr_rings, bd->rx_nr_rings and
bd->nq_nr_rings are preserved.

The commit message says something similar:

  bnge_reserve_rings() checks bnge_rings_ok() before it changes any
  driver ring count, so a failed reservation leaves the driver state as
  it was. bnge_set_dflt_rings() calls it a second time at probe, the
  retry then reserves again and resets the default indirection table,

There is no bnge_set_dflt_rings() in the bnge driver. That is the bnxt name
(bnxt_set_dflt_rings()). The second call is in bnge_net_init_dflt_rings().

The retry only reserves again because hw_resc changed, so
bnge_need_reserve_rings() sees a mismatch. On an RSS context shortage the
retry sends the same demand, so it just makes a second firmware round trip
before failing the same way.

Could the comment and the commit message be reworded to match?

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

  reply	other threads:[~2026-11-24 10:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:07 [PATCH net-next v9 00/10] add features to bnge Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko [this message]
2026-11-23 10:07 ` [PATCH net-next v9 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-11-23 10:07 ` [PATCH net-next v9 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko
2026-11-23 10:07 ` [PATCH net-next v9 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-11-24 10:20   ` netdev-bot+sashiko

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=179551562631.3135.282811496111712768@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bhargava.marreddy@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=dharmender.garg@broadcom.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rahul-rg.gupta@broadcom.com \
    --cc=rajashekar.hudumula@broadcom.com \
    --cc=vikas.gupta@broadcom.com \
    --cc=vsrama-krishna.nemani@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