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/2026…%40broadcom.com