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 v9 06/10] bnge: remove refcount from L2 filter
Date: Tue, 24 Nov 2026 10:20:31 +0000	[thread overview]
Message-ID: <179551563189.3135.3879694697631182157@kernel.org> (raw)
In-Reply-To: <20261123100746.1975030-7-vikas.gupta@broadcom.com>

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

  reply	other threads:[~2026-11-24 10:20 UTC|newest]

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

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=179551563189.3135.3879694697631182157@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®