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 v11 09/10] bnge: add aRFS flow steering ndo support
Date: Tue, 01 Dec 2026 06:39:45 +0000 [thread overview]
Message-ID: <179610718537.3146.5243328929678398709@kernel.org> (raw)
In-Reply-To: <20261130055736.2306367-10-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] In the expire loop of bnge_cfg_ntp_filters()
(bnge_filter.c:835-836), the return value of…
--
bnge: add aRFS flow steering ndo support
This patch adds the ndo_rx_flow_steer callback to bnge. The callback
builds an ntuple filter from the skb flow keys and queues sp_task to
program it in firmware. It also adds bnge_cfg_ntp_filters(), which
installs, retargets and expires aRFS filters from sp_task, and changes
ntuple filter matching to compare the L2 filter by key rather than 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
[ ... ]
> @@ -716,3 +735,105 @@ void bnge_clear_usr_fltrs(struct bnge_net *bn)
> }
> }
> }
> +
> +void bnge_cfg_ntp_filters(struct bnge_net *bn)
> +{
[ ... ]
> + /* Free the old HW rule; reinstall it below on the new queue. */
> + list_for_each_entry_safe(fltr, tmp, &update_list, base.list_node) {
> + list_del_init(&fltr->base.list_node);
> + /* If the free fails the rule stays on the old queue. It is not
> + * retried, so a firmware that keeps failing is not hit on every
> + * tick.
> + */
> + if (bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr))
> + continue;
> + clear_bit(BNGE_FLTR_FW_DELETED, &fltr->base.state);
> + list_add(&fltr->base.list_node, &install_list);
> + }
[ ... ]
> + 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]
What happens to the firmware ntuple rule in the expire loop of
bnge_cfg_ntp_filters() if bnge_hwrm_cfa_ntuple_filter_free() fails?
bnge_hwrm_cfa_ntuple_filter_free() in bnge_hwrm_lib.c only invalidates
filter_id on success:
rc = bnge_hwrm_req_send(bd, req);
if (!rc)
fltr->base.filter_id = BNGE_FLTR_ID_INVALID;
return rc;
Here the return value is ignored and bnge_del_ntp_filter_rcu() always
runs. That clears sw_id in ntp_fltr_bmap, decrements ntp_fltr_count and
calls kfree_rcu() on the only object that holds the firmware handle.
If bnge_hwrm_req_init() or bnge_hwrm_req_send() fails, does the rule stay
programmed in the CFA table? It would then keep steering the flow to its
old RX ring, and the driver would have no record of it.
Close won't free it either. bnge_hwrm_cfa_ntuple_filter_free() returns 0
when BNGE_STATE_OPEN is clear, so the rule looks like it stays in place
until VNIC teardown.
A later aRFS request for the same flow would send
HWRM_CFA_NTUPLE_FILTER_ALLOC for an identical tuple. Depending on the
firmware, that could be rejected as a duplicate, in which case sp_task
deletes the new entry and the flow can no longer be steered. It could
also install a second rule that conflicts with the first.
The update loop above checks the same return value and keeps the
software entry when the free fails. Should the expire loop handle a
failure the same way, instead of dropping the only record of the
firmware filter?
This path becomes reachable once "bnge: add cpu_rmap support for IRQ
affinity" turns aRFS on.
> + }
> +#endif
> +}
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130055736.2306367-1-vikas.gupta%40broadcom.com
next prev parent reply other threads:[~2026-12-01 6:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 5:57 [PATCH net-next v11 00/10] add features to bnge Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 01/10] bnge: restructure VNIC and filter code Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 02/10] bnge: add NTUPLE/ARFS VNIC Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 03/10] bnge: add helper functions for multi RSS contexts Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 04/10] bnge: add RXFH ethtool support Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 05/10] bnge: add ethtool support to manage RSS contexts Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 06/10] bnge: remove refcount from L2 filter Vikas Gupta
2026-11-30 5:57 ` [PATCH net-next v11 07/10] bnge: add NTUPLE filter infrastructure Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 08/10] bnge: add NTUPLE filter support in ethtool Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-11-30 5:57 ` [PATCH net-next v11 09/10] bnge: add aRFS flow steering ndo support Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko [this message]
2026-11-30 5:57 ` [PATCH net-next v11 10/10] bnge: add cpu_rmap support for IRQ affinity Vikas Gupta
2026-12-01 6:39 ` netdev-bot+sashiko
2026-12-01 10:12 ` Vikas Gupta
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=179610718537.3146.5243328929678398709@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®