🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24998

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

#24998
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:39
132 lines
12927 bytes
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
Technical Details
Message-ID: <179610717631.3146.8845749545812890754@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374738-linux-kernel-netdev=dewy.ru
References: <20261130055736.2306367-3-vikas.gupta@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374738-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 02/10] bnge: add NTUPLE/ARFS VNIC
Date: Tue, 01 Dec 2026 06:39:36 +0000
Organization: Usenet Network
Message-ID: <179610717631.3146.8845749545812890754@kernel.org>
References: <20261130055736.2306367-3-vikas.gupta@broadcom.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1637351"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BKFphEG79pUty7sNNoIBgcoFtSs= sha256:mSihBu4FDRxKBPMOWXxqWcIAA7rmigUuRLudXTKUHN8=
	sha1:NabyI6ypu1cYxr3EoLG0yXMzIzE= sha256:LFHpvbu1crZm6Vy+wHvq/ziPUZePr6tKrkAf6aM9Jpk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 02BDD117264; Tue,  1 Dec 2026 09:39:55 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id E_c601aRX4FH;
	Tue,  1 Dec 2026 09:39:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-374738-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 3AD4B117262; Tue,  1 Dec 2026 09:39:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 43752601E55; Tue,  1 Dec 2026 06:39:42 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796107179;
	b=yiWo6ArcdyomgMSxeFDCzeW0vKRS7RANApicGHCcAobEsAoYTy5XyK6/jtYhfcKr5qT4
	 4Zu2gmWPupLLp83d3Xp5yZGzavCMW/AWLpyeV6CBsPoYvcL46gT2lG+CFNmFYLO4w/41D
	 GwOgH4vw1m9ENjxFawH6HbjKtCmzLUSqYD6D0nmPyjJPOcwgOxLzCp+fhntGxecm0YIAc
	 5tSqwvthi7MAZf6Fr9wdUVGqY8cT0pNCFgcLju6Jvda4Gd5ORMFJhhXVCDCbCy+2xQmCt
	 6LaUncM/3bSQUTAuX0eOVhqWXGy9w/1iQTJb6wbxA7VBxmapcqirKgHeVCrkdNk3bMg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796107179;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=kM0smZOT2zOmY4NamNlcNJYb7cHDsiJuBbWfXC5zdG4=;
	b=U3EhB6gzV9VHwhY90cDZQmbEjPIgv2OSX3rxlphoyurFL3bR7ydOYjQgZgqjbBE5n8zx
	 uqJFS79KlIn0fm6qWbRnizvlqVCvkg0DM05zicUSJejpWbD9CLoJHwLTXH8WF9d9677jr
	 bTRCfVw6+YDkBUgpg8luk1sE4BCCYuIimsLA8owZ+mwYFlet1hSkXu/uNH3BOzkHFoCYZ
	 JbO9QLRoyz8NtM5imYqVLLDpkzx5z4tBI110Q+aqg+yiJOzTGwBY3jfM5s8Wi91lm0POk
	 mvlfrdggAbhD6HHbFPSkZLE+mvkwbJjMfoM8Xuf87yb5dLZ1k17I9Zo/tRqAoEP1oIQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y9qKegtf;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E7F20606A333;
	Tue,  1 Dec 2026 06:39:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y9qKegtf
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796107178;
	b=2xIKxW9iPr2TR8kUouf+UGor6I3wktBWC4Zxtx79SDKxBuAQ0aU//ouUoB0Qkw5aRyZn
	 opi2LzjWfP8F3jfAkShWs+9J0QDUO7DsiSvvAz9LHc82oAh+JErBH6mWXMp+Eru19fa+C
	 TuKuDvb/YpRj6RHpxjT2ljKfZVIJqBzIwWyJrCwNRT55gYCILkQ/YRqJ2Y8xDHrkKqN3K
	 wGi65bKw/dvuLqLq/MjhXrVxrODsrjWQ/MMla4uboAup9cgfOEeaimbcYy2+Is9NXmp3/
	 TWkf3ItwzJ8FQPWzOBBg6/M/aLR1vAQQE1r/Pjie3S3w/izsE+G+niN7qUuI7vk9Bog==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796107178;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=kM0smZOT2zOmY4NamNlcNJYb7cHDsiJuBbWfXC5zdG4=;
	b=bXqRrXL49dpRFdwhFk54roqRG+0bwallo1hfRPYlcV8t7zVXIz/lazoyDC4mm13XgDz2
	 WaHk2sxj5ZlvlMuGn0NJlgvu+WA+NG9ZMpMSQ36XUWa5J+nbBRsaWL1svE9wgx02KdPLM
	 pIpPtxucX/PhphSyae6hQi+cmT24ENR+AV2n1SmicRFctkehzqs4jNOZ5JY9sZcqT9rDE
	 HgDJTqjR+2f3PBe9sv7wCgv5vTAbh5fX2MHTf83TgenOmQEUS5RrHOFLmHSUci5Mcb6gT
	 xlzsqQ/D+Oaz6/jaWMy/+QdzXRfo7fdqLTbihj1ZoHlCp3TpmFGZ1AbQI1EIVxpBNfw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Y9qKegtf;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11648606A31A;
	Tue,  1 Dec 2026 06:39:37 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C85CB1F00893;
	Tue,  1 Dec 2026 06:39:36 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796107177;
	bh=kM0smZOT2zOmY4NamNlcNJYb7cHDsiJuBbWfXC5zdG4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Y9qKegtfoCBuSIxdHSsx6EF4EBfs2q9chPjnItd5bqRNH64PIv5GYWua5PfCQHEYt
	 qLoZjfQM7tDaa8WKMZB8YJ11HODE616fEoV6r8BVdyAXb2/TFA78Xg9qOs7wFCG9h0
	 0pvpmdN/GoY+Z4z7M8Q/6P4cW5aQdYLeX8KsEBP//BG/mpKymetj6SZYKehLN9WRs7
	 77H/FFCyLYoYOXFZ+L0g9bfZTvPuHWcbzIwLcKp02InOZZO+Xrsu7xU6YrekgsZR61
	 3DEZptZOViEtZcfsJS+cPq9ShVigSzuoIz/T4vQaQF68oLJyGWsa4vrYTNJYEweofw
	 Oxu/lcy6sk/Rg==
X-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
X-In-Reply-To: <20261130055736.2306367-3-vikas.gupta@broadcom.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list