🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24146

Re: [PATCH net-next v10 05/10] bnge: add ethtool support to manage RSS contexts

#24146
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 12:46
133 lines
12658 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] bnge_refill_dflt_rss_ctxs()
  (drivers/net/ethernet/broadcom/bnge/bnge_vnic.c) calls…

--

bnge: add ethtool support to manage RSS contexts

This adds ethtool create/modify/remove callbacks for RSS contexts in the
bnge driver. Each context gets its own VNIC with its own indirection table
and hash key. When the RX ring count changes, user contexts whose tables
no longer fit are deleted, and contexts using the default table are
resized and refilled.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> index c1064e53cfbf8..18f01b41b8cc1 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_resc.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_resc.c

[ ... ]

> @@ -403,7 +422,8 @@ int bnge_reserve_rings(struct bnge_dev *bd)
>  	if (old_rx_rings != bd->hw_resc.resv_rx_rings || rx_changed) {
>  		if (!bd->netdev || indir_lost ||
>  		    !netif_is_rxfh_configured(bd->netdev))
> -			bnge_set_dflt_rss_indir_tbl(bd);
> +			bnge_set_dflt_rss_indir_tbl(bd, NULL);
> +		bnge_refill_dflt_rss_ctxs(bd);
>  	}
>  
>  	/* Notify only now, so the notification reports the new ring count

[ ... ]

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c b/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c
> index a44971a7c74d3..7d587290c33ab 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_vnic.c

[ ... ]

> +void bnge_refill_dflt_rss_ctxs(struct bnge_dev *bd)
> +{
> +	struct ethtool_rxfh_context *ctx;
> +	unsigned long context;
> +	bool resize = false;
> +	u32 tbl_size;
> +
> +	if (!bd->netdev)
> +		return;
> +
> +	tbl_size = bnge_get_rxfh_indir_size(bd);
> +	mutex_lock(&bd->netdev->ethtool->rss_lock);
> +	xa_for_each(&bd->netdev->ethtool->rss_ctx, context, ctx) {
> +		if (ctx->indir_size != tbl_size) {
> +			resize = true;
> +			break;
> +		}
> +	}
> +	mutex_unlock(&bd->netdev->ethtool->rss_lock);
> +
> +	/* bnge_check_rss_ctxs_lost() already dropped every context with a
> +	 * user table when the table size changed, even if the table could
> +	 * have been folded. Only the default contexts are resized here.
> +	 */
> +	if (resize) {
> +		if (ethtool_rxfh_ctxs_can_resize(bd->netdev, tbl_size)) {
> +			dev_warn(bd->dev,
> +				 "RSS contexts cannot be resized to %u entries\n",
> +				 tbl_size);
> +			return;
> +		}
> +		ethtool_rxfh_ctxs_resize(bd->netdev, tbl_size);
> +	}
> +
> +	mutex_lock(&bd->netdev->ethtool->rss_lock);
> +	xa_for_each(&bd->netdev->ethtool->rss_ctx, context, ctx) {
> +		if (!ctx->indir_user_size)
> +			bnge_set_dflt_rss_indir_tbl(bd, ctx);
> +	}
> +	mutex_unlock(&bd->netdev->ethtool->rss_lock);
>  }

[Severity: Medium]

Can netlink RSS listeners be left with a stale view of these contexts
after the ring count changes?

ethtool_rxfh_ctxs_resize() sends ETHTOOL_MSG_RSS_NTF for every context
as soon as it updates ctx->indir_size:

net/ethtool/common.c:ethtool_rxfh_ctxs_resize() {
    ...
	xa_for_each(&dev->ethtool->rss_ctx, context, ctx) {
		ethtool_rxfh_resize(ethtool_rxfh_context_indir(ctx),
				    ctx->indir_size, new_indir_size);
		ctx->indir_size = new_indir_size;
	}
	mutex_unlock(&dev->ethtool->rss_lock);

	xa_for_each(&dev->ethtool->rss_ctx, context, ctx)
		ethtool_rss_notify(dev, ETHTOOL_MSG_RSS_NTF, context);
}

The message is built right away from the context's current table. A
shrink does not touch the data, so the notification still carries the old
i % old_rx_rings spread. That spread can name RX rings that no longer
exist.

The loop that follows then rewrites the default-table contexts with
i % bd->rx_nr_rings. No notification is sent for that final state.

The ring count can also change without crossing a table size boundary
(for example 8 -> 4 rings). In that case resize stays false, and these
contexts are rewritten with no notification at all.

bnge_reserve_rings() sends ethtool_rxfh_indir_lost() for context 0 only
after the table has been reset. Should the notifications for these
contexts also report the refilled tables?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125115434.2080590-1-vikas.gupta%40broadcom.com
Technical Details
Message-ID: <179595640417.3146.10253284095250218376@kernel.org>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373493-linux-kernel-netdev=dewy.ru
References: <20261125115434.2080590-6-vikas.gupta@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373493-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v10 05/10] bnge: add ethtool support to manage
 RSS contexts
Date: Sun, 29 Nov 2026 12:46:44 +0000
Organization: Usenet Network
Message-ID: <179595640417.3146.10253284095250218376@kernel.org>
References: <20261125115434.2080590-6-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="1169711"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:KG/VuX80NEd4DncNIwx8naIQivo= sha256:ZNyrqMJzpRfwn2OpU5dL1IImmO6U2S0VLu5Vs9s7tbg=
	sha1:dxrp8Q1IzJF/BAW0L9JsUEeBko0= sha256:FK8wvV4QmcU7GSI0Jmp/KXgfW7kskv8S3S9Tj/8fD+s=
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 0B4C4125CEE; Sun, 29 Nov 2026 15:47:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 uP-_RomKn_1x;
	Sun, 29 Nov 2026 15:47:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373493-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 1072A125F97; Sun, 29 Nov 2026 15:46:52 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7BCB223E1A; Sun, 29 Nov 2026 12:46:47 +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=1795956406;
	b=CtDfn7ALUzzB3rFyyKsxLp2TZMxCTDDGYjPuFTSGpIpsqoW2hoGg9A4432TY5Pv/8ME7
	 ftJy52hI3yQtkzdSMvxviwbszTh3DvMmpeoZRsuwzSEqCpX25ogKhXEAdtCiRrJx33rZS
	 UE1RLdz4AiuogCe1KpOk8WORLAdNDDmoUY2Mi9yS/EKhPAXylZV51QrgTN7jnlKeDvw7F
	 IVkBwn0w4/WcGH60QrBGSFLQop5L3CBjtqUdyfudKdh2ojlbkq26ikM6GmogKoOr+T2mh
	 J+wtCo1U3v0OIQmoTLqsy2CkjWtkEgsHNUHIZHS0EFbgEaAm3Sm67/c+gXL6rvSKcDQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795956406;
	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=5XKcMLSKHW3MvKLXk92lB1GLST91t1T1hOjuUM7UCOI=;
	b=hf6okXWIQomoC1dczRCKIc28XYWKWUcsJipcLiNyGIGkvCNlFEMAEP1bBVqEqxISThT+
	 sehKqPWAahii0kso+iMnlBFkDPX+g1CN9vG37ABocZSWD4M4O6ZWKFBfh1ZtQVMxgkMk6
	 IsTsXvnlv/0LlCrTkuW/vs55FrzamC2ddbqEO9/xoFpYGS7LJJyDiZmC05odalj50qBST
	 5qvOg9BLXeTeHaxh2q89Ai0KQsyaQHohfRXl+fb+Iyz0+C0UBc7NzYSqhN4i/b/LaEFzw
	 zzB0x9Gxr9F/Pt2mitJIdlAofQ73pPvyXXXKKJWZz1cdCXHHMO//3/EQEqWDOJ0Lf0A==
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=WvkDR5KE;
	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 927B2606A33B;
	Sun, 29 Nov 2026 12:46:46 +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=WvkDR5KE
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=1795956405;
	b=FtGJbcSAbUaFBTIy9E+kbjkwtOD/bVvLk1JAVrvp23/WrQ3jsxyUvYXdH24a/nW145ZG
	 dXC3iLNh5P9duPMPeeqk3suiHyor0Rk0pJuRL4mra3LTLnwgRxJchdDyUUPNbhhrnOEsl
	 yuhIEBNrwsMdroIKvQCKIojl2YhDpdQtUY6K+UKzzc1I7fCvTquf7V4JSNx8VXBaOx8wG
	 aewo/I3Z2YUag54e6fpikA7+T4HmIlMBWObWlrN5di3fqEsW+Csbt5CuBAHM7cMLjtVjf
	 rsclf0Wcq0KapD4t+1QgSAFrxA8ZhLjHNFcWXiMwBoxOW/dqpu1gyT4s9Cn+kTusUXw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795956405;
	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=5XKcMLSKHW3MvKLXk92lB1GLST91t1T1hOjuUM7UCOI=;
	b=3OC4UKijbk5XvsfnxfjalNQC3tvF0sS+ODd3x+30Aht/iWcmuHb8foUGEQ9kealZ7z12
	 EjHE18yWFq4o0vRoZ/X0Xh3gLWdXD5gvhliFXKEnY1yx1/gJcGmXGe860xpo5/+xxld5m
	 2pubtrHBKlHwdh+M/Jgb1Xdfxo2mfmnttfs5epFTj9DRAJ60T8eUnXkIg/7TQfRES3Ug2
	 RHp+m51I8hUsOSueHIDytzHLvm2VXzXqECTg9pra+6QsUbO2IavLphIiaMRdP7XheXRlD
	 Z+v3krmhKOcu2IPJnPKaAZM08Cb1rPZiy0W92TTab21gbYvyZ9mx5EMJ17l5z+uvFoA==
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=WvkDR5KE;
	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 B47F0606A332;
	Sun, 29 Nov 2026 12:46:45 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C411F000C1;
	Sun, 29 Nov 2026 12:46:44 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795956405;
	bh=5XKcMLSKHW3MvKLXk92lB1GLST91t1T1hOjuUM7UCOI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=WvkDR5KECUOl0m5l0pF5ukEh1FLaTyVO6bEgfNhoPFoNyUGrvebr+8BCNDNpiwBiM
	 V0VP8doRFtoiKvbO91csuvVusmTCoGU/fe1VIbVW7DklvDoWxG2mxz74XJg8UouWuO
	 +uqc3+1IUxGhpTAj404o5GHA5v6L2DqcxpiEvvf4/60Q3+1sJLQyNV5XHuTAMPlCen
	 gRiPXDp1AgLWnD98XpGAfJxQ6mm+7lj7uC0hJUOIO/ejWIOykmjLwVFE80o3V90Q+x
	 2E9lPnGnbqOXwfDfG8H2RrqgWeg71QD9tmUi6A52o8D4NuYxH3y1/QNkML0mPhbfOh
	 t5aSoa7bIPQ3A==
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: <20261125115434.2080590-6-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