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 08/10] bnge: add NTUPLE filter support in ethtool
Date: Sun, 29 Nov 2026 12:46:46 +0000 [thread overview]
Message-ID: <179595640693.3146.16367502250834914716@kernel.org> (raw)
In-Reply-To: <20261125115434.2080590-9-vikas.gupta@broadcom.com>
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_srxclsrldel()`
(drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c) ignores the return…
--
bnge: add NTUPLE filter support in ethtool
This patch adds ethtool rxnfc operations so users can manage ntuple and
ETHER_FLOW filters on bnge. User filters are kept in software across
down/up and programmed in firmware again on open. NETIF_F_NTUPLE is now
enabled by default.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c b/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
> index 99a69f16a0a62..77edcd564b619 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c
[ ... ]
> +static int bnge_srxclsrldel(struct bnge_net *bn, struct ethtool_rxnfc *cmd)
> +{
> + struct ethtool_rx_flow_spec *fs = &cmd->fs;
> + struct bnge_filter_base *fltr_base;
> + struct bnge_ntuple_filter *fltr;
> + u32 id = fs->location;
> +
> + rcu_read_lock();
> + fltr_base = bnge_get_one_fltr_rcu(bn, bn->l2_fltr_hash_tbl,
> + BNGE_L2_FLTR_HASH_SIZE, id, 0);
> + if (fltr_base) {
> + struct bnge_l2_filter *l2_fltr;
> +
> + l2_fltr = container_of(fltr_base, struct bnge_l2_filter, base);
> + rcu_read_unlock();
> + /* The firmware filter is gone once the interface is closed. */
> + if (test_bit(BNGE_FLTR_VALID, &l2_fltr->base.state))
> + bnge_hwrm_l2_filter_free(bn->bd, l2_fltr);
> + bnge_del_usr_l2_filter(bn, l2_fltr);
> + return 0;
> + }
> + fltr_base = bnge_get_one_fltr_rcu(bn, bn->ntp_fltr_hash_tbl,
> + BNGE_NTP_FLTR_HASH_SIZE, id,
> + BNGE_MAX_L2_FLTRS);
> + if (!fltr_base) {
> + rcu_read_unlock();
> + return -ENOENT;
> + }
> +
> + fltr = container_of(fltr_base, struct bnge_ntuple_filter, base);
> + if (!(fltr->base.flags & BNGE_ACT_NO_AGING)) {
> + rcu_read_unlock();
> + return -EINVAL;
> + }
> + rcu_read_unlock();
> + bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr);
> + bnge_del_ntp_filter_rcu(bn, fltr);
> + return 0;
> +}
[Severity: Medium]
What happens here if bnge_hwrm_l2_filter_free() or
bnge_hwrm_cfa_ntuple_filter_free() fails? Both return values are ignored.
The software filter is deleted anyway, and 0 is returned to ethtool.
The HWRM free can fail in a few ways: -ENOMEM from bnge_hwrm_req_init(),
-EAGAIN when the firmware is busy, a timeout, or a firmware error. In
every case the rule stays programmed. For example,
bnge_hwrm_cfa_ntuple_filter_free() invalidates filter_id only on success:
rc = bnge_hwrm_req_send(bd, req);
if (!rc)
fltr->base.filter_id = BNGE_FLTR_ID_INVALID;
return rc;
On the ntuple path, bnge_del_ntp_filter_rcu() still unlinks the entry from
ntp_fltr_hash_tbl and usr_fltr_list, and it releases the sw_id. It then
calls kfree_rcu() on the entry, which holds the only copy of the firmware
filter_id.
On the ETHER_FLOW path, bnge_del_usr_l2_filter() removes the entry. It
then calls bnge_hwrm_set_vnic_filter() for the same MAC on the default
VNIC while the old ring-steering L2 filter may still be live in firmware.
That can leave two firmware entries for one MAC. It can also leave a
failed restore, where only a netdev_warn() is logged and the address has
no filter.
After that, ETHTOOL_GRXCLSRLALL no longer lists the rule, and
ETHTOOL_SRXCLSRLDEL returns -ENOENT for it. The user can no longer see or
remove a hardware rule that still steers or drops matching traffic.
The L2 filter is also gone from usr_fltr_list, so
bnge_hwrm_clear_usr_l2_fltrs() never frees it on close:
list_for_each_entry(fltr, &bn->usr_fltr_list, list_node) {
if (fltr->type != BNGE_FLTR_TYPE_L2 ||
!test_and_clear_bit(BNGE_FLTR_VALID, &fltr->state))
continue;
The comment above that function says these filters are freed "in firmware
before that VNIC goes away". Here the firmware L2 filter would outlive the
NTUPLE VNIC it points to.
Would it be better to return the error and keep the software entry when
the firmware free fails, so user space can retry the delete?
bnge_srxclsrldel() also looks unchanged at the end of the series, in
"bnge: add cpu_rmap support for IRQ affinity".
--
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
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 [this message]
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=179595640693.3146.16367502250834914716@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