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 09/10] bnge: add aRFS flow steering ndo support
Date: Tue, 24 Nov 2026 10:20:36 +0000 [thread overview]
Message-ID: <179551563693.3135.10615302430341667167@kernel.org> (raw)
In-Reply-To: <20261123100746.1975030-10-vikas.gupta@broadcom.com>
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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] In the expire loop of bnge_cfg_ntp_filters() (bnge_filter.c),
the aRFS filter is unlinked with hlist_del_init_rcu() under…
- [Low] This patch adds bnge_rx_flow_steer() and wires it into
bnge_netdev_ops.
- [Low] The concern is that bnge_cfg_one_usr_fltr() rewrites
ntp_fltr->l2_key under ntp_fltr_lock while bnge_rx_flow_steer() reads…
--
bnge: add aRFS flow steering ndo support
This patch adds the ndo_rx_flow_steer callback bnge_rx_flow_steer(). The
callback creates ntuple filters for aRFS, and sp_task programs and expires
them later through bnge_cfg_ntp_filters(). The patch also changes ntuple
filter matching to compare the bound L2 filter by key, not by firmware id.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> index 639c36d571f24..b7261018216bc 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
[ ... ]
> @@ -643,7 +658,11 @@ static void bnge_cfg_one_usr_fltr(struct bnge_net *bn,
> if (fltr->type == BNGE_FLTR_TYPE_NTUPLE) {
> ntp_fltr = container_of(fltr, struct bnge_ntuple_filter, base);
> l2_fltr = bn->vnic_info[BNGE_VNIC_DEFAULT].l2_filters[0];
> + /* bnge_rx_flow_steer() can already run and match this rule */
> + spin_lock_bh(&bn->ntp_fltr_lock);
> ntp_fltr->l2_filter_id = l2_fltr->base.filter_id;
> + ntp_fltr->l2_key = l2_fltr->l2_key;
> + spin_unlock_bh(&bn->ntp_fltr_lock);
[Severity: Low]
This isn't a bug, but is this comment accurate about what the lock
protects?
The reader it mentions runs under RCU only and never takes ntp_fltr_lock:
bnge_rx_flow_steer()
rcu_read_lock()
bnge_lookup_ntp_filter_from_idx()
bnge_fltr_match()
reads f1->l2_key and f2->l2_key
So the spinlock does not serialize this write against that lookup.
In practice the stored value does not seem to change. bnge_netdev_ops has
no .ndo_set_mac_address, so dev_addr stays as set by bnge_init_mac_addr().
l2_filters[0] is always created with the key {dev_addr, vlan 0}, and
bnge_add_ntuple_cls_rule() has already copied that same key into the rule.
Could the lock be dropped here? Otherwise, could the comment be reworded so
it does not suggest the RCU lookup in bnge_rx_flow_steer() is covered?
[ ... ]
> + list_for_each_entry_safe(fltr, tmp, &expire_list, base.list_node) {
> + list_del_init(&fltr->base.list_node);
> + /* Decide again under ntp_fltr_lock: the scan ran without it and
> + * the firmware calls above can take long. Use the rxq and
> + * flow_id that bnge_rx_flow_steer() writes under it. Unlink
> + * here too, so a flow cannot be retargeted onto a filter that
> + * is about to be freed. The firmware free comes after the
> + * unlock.
> + */
> + spin_lock_bh(&bn->ntp_fltr_lock);
> + if (test_bit(BNGE_FLTR_RXQ_UPDATE, &fltr->base.state) ||
> + !rps_may_expire_flow(bn->netdev, fltr->base.rxq,
> + fltr->flow_id, fltr->base.sw_id)) {
> + spin_unlock_bh(&bn->ntp_fltr_lock);
> + continue;
> + }
> + hlist_del_init_rcu(&fltr->base.hlist);
> + spin_unlock_bh(&bn->ntp_fltr_lock);
> +
> + bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr);
> + bnge_del_ntp_filter_rcu(bn, fltr);
[Severity: Medium]
Can this leak the firmware ntuple rule when the free fails?
bnge_hwrm_cfa_ntuple_filter_free() resets filter_id only when the HWRM
send succeeds:
rc = bnge_hwrm_req_send(bd, req);
if (!rc)
fltr->base.filter_id = BNGE_FLTR_ID_INVALID;
return rc;
If bnge_hwrm_req_init() or bnge_hwrm_req_send() fails here, the return
value is ignored. bnge_del_ntp_filter_rcu() then frees the descriptor, and
that descriptor is the only place the driver keeps the firmware filter id.
The hardware rule would keep steering the flow to the old RFS ring. It
would also hold a firmware ntuple slot until the interface is closed.
If the flow is steered again, bnge_rx_flow_steer() creates a new entry.
sp_task then sends a second CFA_NTUPLE_FILTER_ALLOC with the same match
fields. Firmware may reject it, or it may install an overlapping rule.
The update loop earlier in the same function checks this return value and
leaves the rule in place when the free fails:
if (bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr))
continue;
Should the expire path handle a failed free the same way, and not drop the
only copy of the firmware filter id?
> + }
> +#endif
> +}
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index 44637152b075c..de7320521a3e0 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
[ ... ]
> @@ -3442,6 +3591,9 @@ static const struct net_device_ops bnge_netdev_ops = {
> .ndo_features_check = bnge_features_check,
> .ndo_fix_features = bnge_fix_features,
> .ndo_set_features = bnge_set_features,
> +#ifdef CONFIG_RFS_ACCEL
> + .ndo_rx_flow_steer = bnge_rx_flow_steer,
> +#endif
> };
[Severity: Low]
This isn't a bug, but can bnge_rx_flow_steer() be reached at this point in
the series?
set_rps_cpu() in net/core/dev.c calls ndo_rx_flow_steer only when
dev->rx_cpu_rmap is set:
if (!skb_rx_queue_recorded(skb) || !dev->rx_cpu_rmap ||
!(dev->features & NETIF_F_NTUPLE))
goto out;
Nothing in bnge sets rx_cpu_rmap at this commit. Until then the new callback
and the aRFS install, retarget and expire paths in bnge_cfg_ntp_filters()
are dead code.
The next patch in the series, "bnge: add cpu_rmap support for IRQ
affinity", allocates and fills dev->rx_cpu_rmap and turns aRFS on, so the
end state of the series is complete.
Would it help to say in the commit message that aRFS only becomes active
with that follow-up patch?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123100746.1975030-1-vikas.gupta%40broadcom.com
next prev parent 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
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 [this message]
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=179551563693.3135.10615302430341667167@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