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 v10 02/10] bnge: add NTUPLE/ARFS VNIC
Date: Sun, 29 Nov 2026 12:46:42 +0000	[thread overview]
Message-ID: <179595640268.3146.9271118388454673823@kernel.org> (raw)
In-Reply-To: <20261125115434.2080590-3-vikas.gupta@broadcom.com>

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] This patch makes the second (NTUPLE/aRFS) VNIC, and twice the
  RSS contexts, a hard probe requirement.

--

bnge: add NTUPLE/ARFS VNIC

This patch adds a second VNIC for NTUPLE/aRFS, which bnge_init_chip()
allocates and configures on every open. bnge_rings_ok() now requires at
least BNGE_BASE_VNICS (2) VNICs and twice the RSS contexts. That check
now runs before the driver ring counts are updated. The patch also 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..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 u16 bnge_get_total_vnics(struct bnge_dev *bd)
>  {
> -	return 1;
> +	return BNGE_BASE_VNICS;
>  }

[ ... ]

> @@ -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;
>  }

[ ... ]

> @@ -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]
Could this cause probe to fail on setups that probed fine before this
patch?

Earlier in bnge_reserve_rings(), rx_rings is clamped to the granted rx
rings and ring groups. It is not clamped to the granted RSS contexts:

	rx_rings = min_t(u16, rx_rings, hwr.grp);

The demand from bnge_cal_nr_rss_ctxs() grows with the rx ring count. It
is 1 context for up to 64 rings, 2 for up to 128, 4 for up to 256, and
capped at 8 beyond that. With two VNICs the request can now reach 16
instead of 8.

bnge_net_init_dflt_rings() takes the default rx ring count from
netif_get_num_default_rss_queues(). bnge_hwrm_func_qcaps() reads
hw_resc->max_rsscos_ctxs and hw_resc->max_vnics, but neither
_bnge_get_max_rings() nor bnge_get_dflt_rings() uses them to size the
rings.

Firmware might grant fewer RSS contexts than requested. One example is a
many-core host where firmware covers one VNIC's contexts but not two.
Firmware might also limit the function to one VNIC. In both cases this
path runs:

bnge_net_init_dflt_config()
  bnge_net_init_dflt_rings()
    bnge_reserve_rings()
      bnge_rings_ok() returns false
      return -ENOMEM

Both reservation attempts in bnge_net_init_dflt_rings() fail this way,
and the probe in bnge_core.c jumps to err_fw_reg. In the RSS context
case, a smaller rx ring count that fits the grant would have worked.

The commit message says:

    Firmware grants these to every supported function. If it grants fewer,
    bnge_reserve_rings() fails with -ENOMEM and the device does not probe,
    so there is no fallback to a single VNIC.

What guarantees this? Nothing in the driver checks it, and
NETIF_F_NTUPLE is not advertised yet at this point in the series.

For comparison, bnxt_rfs_capable() checks the needed VNICs and RSS
contexts against bnxt_get_max_func_vnics(), bnxt_get_max_func_rss_ctxs()
and the reserved values. On a shortfall it disables NTUPLE rather than
failing. bnxt also gates the NTUPLE VNIC on BNXT_SUPPORTS_NTUPLE_VNIC.

Here, the patch removes BNGE_FW_CAP_CFA_RFS_RING_TBL_IDX_V3 from bnge.h,
and bnge_init_chip() calls bnge_alloc_rfs_vnic() with no capability
check.

Would it work to reduce rx_rings to fit the granted rss_ctx, or to fall
back to a single VNIC with NTUPLE off, instead of failing the probe?

This doesn't change by the end of the series. bnge_rings_ok() still
requires BNGE_BASE_VNICS VNICs and twice the RSS contexts, and
bnge_set_dflt_rfs() turns NTUPLE on unconditionally. A later patch adds
bnge_rss_ctx_capable(), which treats max_vnics/max_rss_ctxs as a real
limit for additional RSS contexts. Nothing applies that limit to the two
base VNICs.

> +
>  	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/20261125115434.2080590-1-vikas.gupta%40broadcom.com

  reply	other threads:[~2026-11-29 12:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 11:54 [PATCH net-next v10 00/10] add features to bnge Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-11-29 12:46   ` netdev-bot+sashiko [this message]
2026-11-25 11:54 ` [PATCH net-next v10 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-11-29 12:46   ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-11-29 12:46   ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-11-29 12:46   ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-11-29 12:46   ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-11-29 12:46   ` 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=179595640268.3146.9271118388454673823@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