๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24145

Re: [PATCH net-next v10 07/10] bnge: add NTUPLE filter infrastructure

#24145
From: netdev-bot+sashiko
Date: Sun, 29 Nov 2026 12:46
148 lines
13048 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] At this commit, the commit message and new comments describe code
  that does not exist yet.
- [Low] Several exported helpers dereference state without NULL checks.

--

bnge: add NTUPLE filter infrastructure

This commit adds the NTUPLE filter data structures, sw_id bitmaps for the
L2 and NTUPLE filters, and HWRM wrappers to allocate and free NTUPLE
filters. It also splits L2 filter deletion into RCU and non-RCU variants
and sets bd->max_fltr to the fixed BNGE_MAX_NTUPLE_FLTRS.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> index 6316f75ca36ea..3ebb3cae4829b 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c

[ ... ]

> @@ -72,10 +227,339 @@ static struct bnge_l2_filter *bnge_alloc_l2_filter(struct bnge_net *bn,

[ ... ]

> +static int bnge_alloc_ntp_fltrs_mem(struct bnge_net *bn)
> +{
> +	struct bnge_dev *bd = bn->bd;
> +	int i, rc = 0;
> +
> +	if (!(bn->priv_flags & BNGE_NET_EN_NTUPLE) || bn->ntp_fltr_bmap)
> +		return 0;

[ ... ]

> +int bnge_insert_ntp_filter(struct bnge_net *bn, struct bnge_ntuple_filter *fltr,
> +			   u32 idx)
> +{
> +	struct bnge_ntuple_filter *f;
> +	struct hlist_head *head;
> +	int bit_id;
> +
> +	spin_lock_bh(&bn->ntp_fltr_lock);
> +
> +	head = &bn->ntp_fltr_hash_tbl[idx];
> +	hlist_for_each_entry(f, head, base.hlist) {
> +		if (bnge_fltr_match(f, fltr)) {
> +			spin_unlock_bh(&bn->ntp_fltr_lock);
> +			return -EEXIST;
> +		}
> +	}
> +
> +	bit_id = bitmap_find_free_region(bn->ntp_fltr_bmap,
> +					 bn->bd->max_fltr, 0);

[Severity: Low]
Should these exported helpers document, or check, that the device must
already be open?

bn->ntp_fltr_bmap is allocated only from bnge_alloc_core()->bnge_fltrs_mem(),
and only when BNGE_NET_EN_NTUPLE is set. It is NULL before the first open,
and bitmap_find_free_region() here would dereference it.

bnge_init_l2_filter() has the same pattern with bn->l2_fltr_bmap. So does
bnge_get_ntp_filter_idx() when it is called with skb == NULL:

	vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT];
	return bnge_toeplitz(bn, fkeys, (void *)vnic->rss_hash_key);

vnic_info is NULL while the device is closed.

In the rest of the series every caller is gated, so these NULL states are
never reached:

  - bnge_srxclsrlins() requires netif_running() and NTUPLE.
  - NTUPLE can only change while the device is down (bnge_fix_features()).
  - bnge_rx_flow_steer() checks BNGE_STATE_OPEN.

Still, nothing in these helpers states that requirement. The lifetime is
also asymmetric: the bitmaps are allocated on open but freed only in
bnge_netdev_free().

[ ... ]

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index f1fcac315380f..58039e6d610ed 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c

[ ... ]

> @@ -3227,6 +3236,20 @@ static void bnge_close_core(struct bnge_net *bn)
>  
>  	bnge_nq0_napi_to_wq(bn);
>  
> +	/* Invalidate user L2 filters now that NAPI is disabled so that
> +	 * subsequent re-enabling during open cannot read a stale or torn
> +	 * filter_id before bnge_cfg_usr_fltrs() completes reallocation.
> +	 */
> +	/* Only the driver's tracking is reset here. The user filters are
> +	 * programmed again by bnge_cfg_usr_fltrs() on the next open.
> +	 */

[Severity: Low]
bnge_cfg_usr_fltrs() does not exist at this commit. It is added later by
"bnge: add NTUPLE filter support in ethtool".

Could the comments and the commit message describe what this patch
provides, or mark these as forward references?

This patch has a few similar references. The commit message says that
max_fltr:

  "with the 128 L2 rules, is the rule count that ethtool reports."

ethtool does not report it until bnge_get_rxnfc() is added later in the
series.

In bnge_cfg_rfs_ring_tbl_idx(), the unchecked xa_load() depends on
validation that is not in the tree yet:

	/* The RSS context was already validated via xa_load() when the
	 * filter was added (bnge_ethtool.c) under netdev instance lock,
	 * so it is always present here.
	 */
	ctx = xa_load(&bd->netdev->ethtool->rss_ctx,
		      fltr->base.fw_vnic_id);
	rss_ctx = ethtool_rxfh_context_priv(ctx);

The same is true in bnge_del_one_rss_ctx():

	/* The kernel ethtool core prevents deleting a busy RSS context via
	 * ethtool_check_rss_ctx_busy().

ethtool_check_rss_ctx_busy() has no effect for a driver without
get_rxnfc, and bnge only gets that later in the series.

All of these are in place by the end of the series, so only the
intermediate commits are affected.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125115434.2080590-1-vikas.gupta%40broadcom.com
Technical Details
Message-ID: <179595640551.3146.18013496733441197654@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373494-linux-kernel-netdev=dewy.ru
References: <20261125115434.2080590-8-vikas.gupta@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-373494-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v10 07/10] bnge: add NTUPLE filter infrastructure
Date: Sun, 29 Nov 2026 12:46:45 +0000
Organization: Usenet Network
Message-ID: <179595640551.3146.18013496733441197654@kernel.org>
References: <20261125115434.2080590-8-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="1169658"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:WWaRL3PmE/OeDVSYkOnVfypNuNY= sha256:D+I30ZT2v3EGDnCcwizABXfqln6t8rBzmaXwWkIsNvE=
	sha1:HG6J2xZXv4aJ5S1buiWNZV5Ocwo= sha256:H47sOGiyi5Y3IIx9easJ1TuRn2pSYVVsYoGtb5Mbqck=
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 71C15125F96; Sun, 29 Nov 2026 15:47:07 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 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]
	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 x8-L6Vzk3sHe;
	Sun, 29 Nov 2026 15:47:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-373494-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 6B471125CEE; Sun, 29 Nov 2026 15:46:54 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 952712575D; Sun, 29 Nov 2026 12:46:49 +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=1795956408;
	b=FoOokkg706/pQ5AgE2tVogQSgtRGikqql9P2hJ9xIP5PyY2CMv3zzQMsOVXUYWBwzcRj
	 T2fDG+QjFgNdBhn/RSVdqP3pAXsR08l7BB08c/EFUK8J+HBkm5dPD9hsTSyvz8/o+kAwK
	 CHsy/P30TkqYPk1QJPNtayd8tIdb+UabGELi4G9SdyX9mzlxrhvd6nbNH2rt72xjz3O1n
	 AdQQ72sdRMCdKpfeFDqhT4Isk7QKgG1U5XnucZxboNojMz3YeP2LSEDrgSNPbwLPqZVjG
	 Lb+WCTolqX7FaKc/vpzAqZIatSgd2dEGYGeS6wfE9P8NxYglD1UtGVJrHGpb6DWF3hw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795956408;
	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=/xmwtNG7O4OoipbjTcmRYxpeehdG+zTDqM2U2Qeq7ZI=;
	b=KEnbfRN37aoOuxWpTUQKTSNxb/0KvroyA1ktGR785hbTdQ8lQ77QjGVdKhSFq9WoVKdw
	 /UpKXegA1eQ5f9nhHNS36F5CmIuf0pPMWPsAEdrax2LJdox78Ds74gE3v/xmCzs36MnxY
	 T72vKIYSF+Exdm2HGpoH5k7IFSxKhfiDi9G6XN+oRLdE/cLb1fOTlLsO/t/kBo7Kzr3cJ
	 OEx7Gy7Fak6goE0vH5hnbnQMB+f3TaXE9QjmIrHlhfg3FHkrNODesJVXyIzCPmPo/VCvZ
	 tRiqkvWCF4bF4/w+o5fFwJh3yzBIdk52dNyEsI1y3qt303raKrYQ9CxVb8pvn0s2heg==
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=dOb9yyQg;
	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 EBABF606A688;
	Sun, 29 Nov 2026 12:46:47 +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=dOb9yyQg
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=1795956407;
	b=o2sV9TzH4fboWWKie6Pj7xV6qHYZlMYcQkNxSGCjWL+o8KcOOuFzIYLJnxyin/DfeBjp
	 s+afxtS3lnw8kX5xq2sVeBOP1TxlEm5hWEuXX0eVh7LbvNx63XTCbzkoKCX8nGm3WJk9n
	 K4Q2qIkcjFhmVynCpCjPfNUx0s1jDEi2ymEwuexradGdCgf/EMgd8R+e5U5mqvIISbON/
	 Dth1Pf/Zkf9Nm4z4B5rr8D+CFkytMgQXvNbiXB7aBrv3MnoNwqYOcFNRJg5hArYoqrHMn
	 J3VNhOTLpypeXi4JOSTY8RVbPqg6QqyRNyakO5coF6PpqVii0ENXmOE9C6p1dqEacnA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795956407;
	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=/xmwtNG7O4OoipbjTcmRYxpeehdG+zTDqM2U2Qeq7ZI=;
	b=utB6KIhSoHbQniTL/3Ug02bMMDUzdOsRs8d7GHi7r1AhObxjww+IH4Uxoo7CDaftIhgj
	 xU52l4ff5GU1coe9yTzt5Fpip5Ibc6GFmNEoBhQHAf5Uw7g29+Z6K4rFcC8nu/W2ut+SN
	 wsV71YZB2S6CDz4+Xyje1iYxHWe9QQ8h/AzKYLJKtC3j2nChOjRTXuzS95sWrkf+FTuBO
	 SV5i5RHsnwVUUSVLv9+DwZ7reEkewsnSSLbhYo5/fIK4ZhpuiPxBtJV7SYHdkAx2rejpP
	 AS3qTHx0NctWkWijVsb+778IvfY3Z60odySfRIdUWkj9PrtsDyQIbFdvNCIXa+UnYtw==
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=dOb9yyQg;
	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 19208606A330;
	Sun, 29 Nov 2026 12:46:46 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2271F000C1;
	Sun, 29 Nov 2026 12:46:45 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795956406;
	bh=/xmwtNG7O4OoipbjTcmRYxpeehdG+zTDqM2U2Qeq7ZI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=dOb9yyQgrDS5MShHCD9b3zrgsUAABB5G8316kYeQVSyVx0YWVUTzTx0bgb28DmvoX
	 aCxyp9axamF4uSHkx9KQzZ8FUZ1hhp7SEDmLwEeHH7ZKhJRDJp5/rcA/nEkajWCAGP
	 Y9SgbMANlZgiE24wwltrbYmDNXESS9VCOn11ROH+1l81KaPEkdaDwq3EEE2XspqAoM
	 8m/dWztDKc8uSp1a/bj9WzczbZDHVVuM6gN2Y/mnL0f8IOwFRd38ujRfHZ5qx9UpZQ
	 3x9UWZDV/LToC20Etuk5l91Uq0TRn6tv99+FPnVaB9t+xEAdSBsi2QbCgdjZBzo5K2
	 z7yDwd7VBWLyg==
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-8-vikas.gupta@broadcom.com>
X-sashiko-severity: Low
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