Re: [PATCH net-next v11 09/10] bnge: add aRFS flow steering ndo support
From: netdev-bot+sashiko
Date: Tue Dec 01 2026 - 01:40:14 EST
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