Article View: linux.kernel.netdev
Article #21691Re: [PATCH net-next v9 06/10] bnge: remove refcount from L2 filter
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 10:20
Date: Tue, 24 Nov 2026 10:20
107 lines
11690 bytes
11690 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] The commit message does not describe two behaviour changes this
patch makes.
--
bnge: remove refcount from L2 filter
This patch removes the refcount from struct bnge_l2_filter. A filter is
now expected to be removed only by the context that created it. It also
folds the RCU lookup wrapper into bnge_lookup_l2_filter(), and makes
bnge_alloc_l2_filter() return an error when the key is already present.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> index a8bb441ebef9a..6316f75ca36ea 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
[ ... ]
> @@ -13,8 +14,8 @@
>
> void bnge_del_l2_filter(struct bnge_net *bn, struct bnge_l2_filter *fltr)
> {
> - if (!refcount_dec_and_test(&fltr->refcnt))
> - return;
> + netdev_assert_locked_or_invisible(bn->netdev);
> +
> hlist_del_rcu(&fltr->base.hlist);
> kfree_rcu(fltr, base.rcu);
> }
[ ... ]
> -static struct bnge_l2_filter *__bnge_lookup_l2_filter(struct bnge_net *bn,
> - struct bnge_l2_key *key,
> - u32 idx)
> +static struct bnge_l2_filter *bnge_lookup_l2_filter(struct bnge_net *bn,
> + struct bnge_l2_key *key,
> + u32 idx)
> {
> struct bnge_l2_filter *fltr;
> struct hlist_head *head;
>
> + netdev_assert_locked_or_invisible(bn->netdev);
> +
> head = &bn->l2_fltr_hash_tbl[idx];
> - hlist_for_each_entry_rcu(fltr, head, base.hlist) {
> + hlist_for_each_entry(fltr, head, base.hlist) {
[ ... ]
> @@ -75,9 +63,10 @@ static struct bnge_l2_filter *bnge_alloc_l2_filter(struct bnge_net *bn,
>
> idx = jhash2(&key->filter_key, BNGE_L2_KEY_SIZE, bn->hash_seed) &
> BNGE_L2_FLTR_HASH_MASK;
> +
> fltr = bnge_lookup_l2_filter(bn, key, idx);
> if (fltr)
> - return fltr;
> + return ERR_PTR(-EEXIST);
[Severity: Low]
This isn't a bug, but should the commit message describe two behaviour
changes this patch makes? The message only talks about removing the
refcount:
However, going forward, the filter will only be removed by the same
context that created it, making refcount unnecessary.
First, the contract of bnge_alloc_l2_filter() changes. When it found a
duplicate MAC/VLAN key it used to take a reference and return the
existing filter. It now returns ERR_PTR(-EEXIST).
That error would go back through bnge_hwrm_set_vnic_filter() to
bnge_init_chip(), where open fails with "HWRM vnic filter failure", and
to bnge_cfg_rx_mode(). As far as I can tell this branch can't be reached
today, so there is no runtime impact.
Second, lookups of l2_fltr_hash_tbl switch from an RCU walk under
rcu_read_lock() to a plain hlist_for_each_entry(). The new
netdev_assert_locked_or_invisible() calls in bnge_lookup_l2_filter() and
bnge_del_l2_filter() make the netdev instance lock the required
protection.
At this commit nothing documents that rule. The bnge_netdev.h comment
saying l2_fltr_hash_tbl is covered by the netdev instance lock only
appears later in the series.
Could the commit message mention the new -EEXIST return and the move
from RCU to the instance lock for lookup and delete? Other commits in
this series list changes like these explicitly.
>
> fltr = kzalloc_obj(*fltr, gfp);
> if (!fltr)
[ ... ]
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123100746.1975030-1-vikas.gupta%40broadcom.com
Technical Details
Message-ID:
<179551563189.3135.3879694697631182157@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-370222-linux-kernel-netdev=dewy.ruReferences:
<20261123100746.1975030-7-vikas.gupta@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-370222-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v9 06/10] bnge: remove refcount from L2 filter Date: Tue, 24 Nov 2026 10:20:31 +0000 Organization: Usenet Network Message-ID: <179551563189.3135.3879694697631182157@kernel.org> References: <20261123100746.1975030-7-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="4110441"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Am1VtdrJ9ohIipDiQDsIfk3IDJM= sha256:fZSY3ZgrwKaASvL9Q9z2f01ZMdEyBgsm2A6SyNyK5Ec= sha1:Vj83y8nCgwFVR9G1/P9wZu1bbZU= sha256:Pw1ay1vvzC0m5RoZjPT1UVGPW9Bx3hOc1J0btDI8eVw= 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 59E28125DF5; Tue, 24 Nov 2026 13:20:53 +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 85BqwgqItuRm; Tue, 24 Nov 2026 13:20:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-370222-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 51355125DF2; Tue, 24 Nov 2026 13:20:41 +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 E78252098F; Tue, 24 Nov 2026 10:20:35 +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=1795515634; b=ZVFZxXsVlphd2sgenMhTZ91tVkmzbcpk4NmkDLnCRwJvLX3u96/gUVeW+Tk1GKT6WsZC qyH5XMFTtt5qOR7vhzSZX+i5gWU7CCG/Ffhfuj59bnUIo4RxX1Kqw22yCS0INe8G0RGGS hdI3YruRgFAmh/i5tYUHUHuSaiv4HDwPeyXsHhvpkozxNbBLV6XMbYnGFVAOeHtDx2vj7 +amJisTdyTjCIOC/vTn47bY4RoDSCEoI/5tty98ksSLhGo3e1zpR/g77/mugm4mH1d6rw /SKWTSEpail0Vo6HAYHN6BmtVt7wrCSnzQNnz/Qvd0TvnFzNY+agihHz72+32Yf+2BA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795515634; 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=gjDyuTkmmyfYSqD39L2E6i2oyf7DxqDr5MYZav/UbyU=; b=3gKuhiMBrxzG21ApVlxA7fjmMop24ujAA6evCP5O6KiuLC6Uc0Hta7BZOafDLoKgAPgW T+S5fPVhnNf3mN4SWkgGtTjJZ1NLFk5pd4jMGYsZC+l1Q3hpnZu6QgGOUDE+D4X2k9ckK CX5rWUuC7BsWGIGF4aMSxBfk7oFnQBQHUwHh/c/ys1cT31Aye7nI4hPHAVtty44+A4Azc z9WSstzara90i+xGBbzfMM1dUuHD//F2ybwZQIJ8NROOez+jYPc7d/4yqr4PrJwLrJCtB JU6/3tLpuGJs3XzGILsweUHhA8rsbCXuigRyaYPKSktNXxZ+tyvEK/BWPtTvHVUyMJw== 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=IpFqO1P6; 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 81F7B606A69F; Tue, 24 Nov 2026 10:20:34 +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=IpFqO1P6 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=1795515633; b=2D+qmcXRLCVU93/yDlcEdoWIZTzuScohDWWCdkjJzRV453HJB5gRtkuiIuN3Ibsfobkb 90GiPX4tOpZb0ZVnc1cqSHsS0YboQu1a7z9vRZ37rwfg5PKnWa+UGbcbEqxKGof5J6QOD xms/TorHPf3j6viDPVjs5AkT8jX7oqdYCgI9Xrp/zRGU/yNbJdWbaaOtgmkdl4g/pcQ67 xLC0EnUX+/B1a6kVL1pme0tYXWzyZSdS1KPNn6LjkytO8giZ87CRHams1uLwAQIyNl2DX oTo/RDSdWck2ES6gV8uQ06B6JBy+YFqfnrMpunhvyN5zSSdw77sEm9k3ydDkiicaxgw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795515633; 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=gjDyuTkmmyfYSqD39L2E6i2oyf7DxqDr5MYZav/UbyU=; b=4FCqP3sutqF6tvqs7ym7pfknPmHcY84KFQ/LM/lcRen3+TY/rMeIuCWawtJVMboEZMCF 9YnlWoEFLNgdoJbGanBSEWuqejmphr0gYVU5ICwey0BzpmIgQZk1nqQYrbx2CXKzGEOE/ UXys+sXFWdtMU/ZyOSq26vkS7kaSDsDTDupy66ncVPXQPLNtb3VSkH0M4+ESbofGP7QAe BlvB1pyGCu3yeJ4vQvd15XHcN9S6ERqNRSBkQMCDlF2Pmpk0kN8MVrV6+v1DZkNMRwGRE 9Nd+IPdMxaahdFPCgFBovsCY8f2HOW87qAWnMm13ooVlRR/6HfLEL4CMaY7/iYWjjQQ== 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=IpFqO1P6; 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 A2C13606A692; Tue, 24 Nov 2026 10:20:33 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5522F1F000C6; Tue, 24 Nov 2026 10:20:32 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795515633; bh=gjDyuTkmmyfYSqD39L2E6i2oyf7DxqDr5MYZav/UbyU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=IpFqO1P63or12BDYNLZZoaIXfhk2Xse3vdtKdaLPNOFDbXISS0MiCPKMrZ/AafES3 LuS+giDnHIQcfZZ/Z8kIlMR4s4MlSXHZRegQsR/UbzNXKb0SsBOoJaGrX9lyU7+vez 1tkFpH9KWfZ17bgpE1hjh2qoypGssRTDdkrO0kF2oVeKNaje32rGLkNWPaS2DGG7Hy 2v9YfNboqsR9EWolR8f4Tui5U5RGcV61yXPbwoi6o4uCXqIk/58LrGWOoOQniLjizT fw0Y6/YoswKkgMOhNdK1namMRKMDGIaJcJmhSm+iDjMXJKG5mOkcrykvkndEnAEdxt ohvmCm5pe2/YA== 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: <20261123100746.1975030-7-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