mirror of https://lore.kernel.org/lkml/
 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 v6 02/10] bnge: add NTUPLE/ARFS VNIC
Date: Tue, 10 Nov 2026 16:19:12 +0000	[thread overview]
Message-ID: <179432755239.994134.11238266136557206975@kernel.org> (raw)
In-Reply-To: <20261106093524.838341-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 optional NTUPLE/aRFS VNIC a hard probe
  requirement, and nothing degrades gracefully when firmware grants too…

--

bnge: add NTUPLE/ARFS VNIC

This patch adds a second VNIC for NTUPLE/aRFS. The VNIC is always
allocated, so the function now needs two VNICs and twice the RSS
contexts. NTUPLE is turned on by default at netdev allocation time, and
bnge_rings_ok() now fails the reservation when fewer than two VNICs, or
too few RSS contexts for both, are granted.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index 21f55ea056f4f..4f4c0a2f40bd2 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c

[ ... ]

>  static u16 bnge_get_total_vnics(struct bnge_dev *bd)
>  {
> -	return 1;
> +	return BNGE_BASE_VNICS;
>  }

[ ... ]

> @@ -222,8 +226,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;
>  }

[ ... ]

> @@ -327,6 +338,10 @@ int bnge_reserve_rings(struct bnge_dev *bd)
>  	bd->rx_nr_rings = rx_rings;
>  	bd->nq_nr_rings = hwr.nq;
>  
> +	/* One ring group per rx ring, so rss_ctx is checked against the final
> +	 * rx ring count.
> +	 */
> +	hwr.grp = rx_rings;
>  	if (!bnge_rings_ok(&hwr))
>  		return -ENOMEM;

[Severity: Medium]
Can a partial grant of RSS contexts or VNICs now stop the device from
probing?

bnge_get_total_vnics() always returns BNGE_BASE_VNICS, whatever the
NETIF_F_NTUPLE / BNGE_NET_EN_NTUPLE state. bnge_rings_ok() now requires
vnic >= 2 and rss_ctx >= 2 * bnge_cal_nr_rss_ctxs(grp). Before this
patch it only needed a non-zero vnic and did not check rss_ctx.

Earlier in bnge_reserve_rings(), rx_rings is trimmed by hwr.grp, by the
stat/nq limits and by bnge_adjust_rings():

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

However, rx_rings is never trimmed to what the granted resv_rsscos_ctxs
can cover. There is also no fallback that drops the NTUPLE VNIC.

The default ring count from _bnge_get_max_rings() also ignores
max_rsscos_ctxs and max_vnics:

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

For example, with 100 default rx rings, bnge_cal_nr_rss_ctxs(100) is 2,
so 4 contexts are needed. If firmware grants 2 or 3, this worked before
the patch (one VNIC, rss_ctx not checked). Now the path is:

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

bnge_net_init_dflt_rings() then sets the tx/rx ring counts to 0 and
returns the error, so probe fails. With rx_rings trimmed to 64, only 2
contexts would have been needed.

A function that gets only one VNIC would also stop probing, even though
NTUPLE is optional and can be turned off.

The commit message says:

    If it grants fewer, bnge_reserve_rings() fails with -ENOMEM and the
    device does not probe, as it would for any other missing ring
    resource.

Is this accurate? The other resources are trimmed to a partial grant
and only fail when the grant is zero. A partial RSS context shortfall
fails outright.

For comparison, bnxt requests the NTUPLE VNIC only when RFS is enabled.
It also clears NTUPLE through bnxt_rfs_capable() when resources are
short. Would something similar work here? Another option would be to
trim rx_rings to what the granted RSS contexts can cover.

This also looks unchanged at the end of the series. The later
bnge_rss_ctx_capable() only covers additional user RSS contexts, and
bnge_rings_ok() and _bnge_get_max_rings() are not changed.

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

  reply	other threads:[~2026-11-10 16:19 UTC|newest]

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

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=179432755239.994134.11238266136557206975@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

all inboxes | Powered by JetHome®