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 v10 07/10] bnge: add NTUPLE filter infrastructure
Date: Sun, 29 Nov 2026 12:46:45 +0000 [thread overview]
Message-ID: <179595640551.3146.18013496733441197654@kernel.org> (raw)
In-Reply-To: <20261125115434.2080590-8-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] 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
next prev parent reply other threads:[~2026-11-29 12:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 11:54 [PATCH net-next v10 00/10] add features to bnge Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-11-29 12:46 ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-11-29 12:46 ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-25 11:54 ` [PATCH net-next v10 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-11-29 12:46 ` netdev-bot+sashiko [this message]
2026-11-25 11:54 ` [PATCH net-next v10 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-11-29 12:46 ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-11-29 12:46 ` netdev-bot+sashiko
2026-11-25 11:54 ` [PATCH net-next v10 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-11-29 12:46 ` 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=179595640551.3146.18013496733441197654@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