From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796481981; b=CUz1e5dA3Oa7N/KCU0oG9JVbMFE2FJ29vBOkS+AOp4q5Z92xnmJSVRQh9O/zaha38Zhc rJx+SkvjYedNfDI6bgCbtg2Cgy7ied0PvpNp0twrYJb5H/SVwDAmb/Sg/+dbg9x7GW5Kl U43up9T6qUSYD+dYPSUNSZDz14ZVnY4zEPAOYfXqaHZggAicjFAa6olED9JqG+wN58Uaj po3vIW3CdgJp0BLWSMQcsrVfFANKs/uYNxTugVQVu62A4Qa4TcBXps3X5LOjzzE2ItqNv REefRrQPA9b9bCJIaqx2N8Y/oNfFa1jXaVpYiHO3bdK2mqMJH2u7/TQA8MGag2agzGw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481981; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=kUs6R+h4kFK8l5gu2XMX1SewD613LSNZn/KhJCd3e+M=; b=GJ+RNU8PAQtN8pgtOPdOPIMdNuIUSfom5aNtzDXCtufUAF5XizoHuSWf6d2DF69Ca3DP nC5XIWg424GAv1+t/3AK3CZlHWODlXvXXx9jOWim9XxNTM9DLMJ9pXlvqW716lfT4r51C V662SXwnHTpF4yTAN7h6TfkMeYD67d5Ts1r9oT6Jx85B9tzUNBLHwPJj38WNSg0FayzXK pPHQq10r3++1zT4HYqnBJZ23TanWvxBx+ZJV7xhuwlah44MJvCV1G9h5dJO/k9c4DyZTS 3uwfV4xA0xC/eBRkQmfwiiQc9KErS4tsvARs1CjTSGeRWuNWhZ2Nk2AeTCajC2dgP+A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HYfyU+q+; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BB52E606A684; Sat, 5 Dec 2026 14:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=HYfyU+q+ Received: by smtp.kernel.org (Postfix) with ESMTPSA id C59841F00A11; Sat, 5 Dec 2026 14:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796481981; bh=kUs6R+h4kFK8l5gu2XMX1SewD613LSNZn/KhJCd3e+M=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=HYfyU+q++hCEigcFM8GJToTVvhAtYd/e2DYHJRCHSghs8b5mWXgKAxaZpowD1s1+6 sI/qjzz6OYwHrN12vwd7ftozO+w+Hs2ytA6tbGvmbyYu3Un53FzHe1hdCf8shvQWh4 ypjk2lahsgHVIn0NMfBPf5m902C3p+BT/dFJ+ZxsC2+7bkIGUP+XNhGubV1TXFik5P /iY11Pl/A+oSY2XmzdDr4HQHIQZriQXxWNUlSzS3gOQ2VMU3LVJKIuIF4fRgL6I8/A q+n0MybU+B2CRCtGKrO1gkZhlbdqItCF9kjarfC+Qak1vYisL36FUg1jRuKsgbmHBu CGF8wMczJHT5Q== Subject: Re: [PATCH net-next v12 08/10] bnge: add NTUPLE filter support in ethtool 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 Date: Sat, 05 Dec 2026 14:46:20 +0000 Message-ID: <179648198035.3146.10955388662827175312@kernel.org> In-Reply-To: <20261201132011.2705569-9-vikas.gupta@broadcom.com> References: <20261201132011.2705569-9-vikas.gupta@broadcom.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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() in drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c ignores the return… - [Low] The commit message says user filters "stay in software while the interface is down" and that "bnge_cfg_usr_fltrs() programs them in… -- bnge: add NTUPLE filter support in ethtool This commit adds ethtool get_rxnfc/set_rxnfc support for ntuple and ETHER_FLOW rules. User rules are kept in software across down/up and programmed in firmware again on open. The unicast address filters now share the L2 filter pool with these rules, and NETIF_F_NTUPLE is 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; > + } [ ... ] > + 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 the firmware fails HWRM_CFA_L2_FILTER_FREE or HWRM_CFA_NTUPLE_FILTER_FREE? bnge_srxclsrldel() drops the return values of bnge_hwrm_l2_filter_free() and bnge_hwrm_cfa_ntuple_filter_free(). It then tears down the software filter anyway, through bnge_del_usr_l2_filter()->bnge_del_l2_filter_rcu() or through bnge_del_ntp_filter_rcu(). Those clear the sw_id bit, unlink the list node and kfree_rcu() the object. Then 0 is returned to user space. bnge_hwrm_l2_filter_free() returns the result of bnge_hwrm_req_send(), so a firmware busy error (-EAGAIN) or an HWRM timeout can reach this point. bnge_cfg_rx_mode() already treats -EAGAIN from the firmware as a transient condition. Once the object is freed, base.filter_id is freed with it, and nothing can release the firmware filter later. At close, bnge_hwrm_clear_usr_l2_fltrs() walks usr_fltr_list, and the node is no longer on it. For an ETHER_FLOW rule, could the leaked filter keep steering the MAC to the NTUPLE VNIC ring after ethtool -n stops listing it? bnge_del_usr_l2_filter() would also program a default VNIC unicast filter for the same MAC while the stale filter may still be active. A leaked ntuple filter would likewise keep steering or dropping the matching flows. bnxt_srxclsrldel() uses the same pattern. Would it be better to return the error and keep the software filter when the firmware free fails? The last patch of the series still has this pattern. bnge_hwrm_clear_usr_l2_fltrs() has a weaker version of the same thing. It clears BNGE_FLTR_VALID before a free whose result is ignored. That is the close path, though, where ignoring release errors is more usual. > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c > index 3ebb3cae4829b..639c36d571f24 100644 > --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c [ ... ] > +static void bnge_cfg_one_usr_fltr(struct bnge_net *bn, > + struct bnge_filter_base *fltr) > +{ > + struct bnge_ntuple_filter *ntp_fltr; > + struct bnge_l2_filter *l2_fltr; > + > + if (list_empty(&fltr->list_node)) > + return; > + > + 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]; > + ntp_fltr->l2_filter_id = l2_fltr->base.filter_id; > + if (bnge_usr_fltr_ring_lost(bn, fltr) || > + bnge_hwrm_cfa_ntuple_filter_alloc(bn->bd, ntp_fltr)) { > + netdev_err(bn->netdev, > + "restoring previously configured ntuple filter id %d failed\n", > + BNGE_MAX_L2_FLTRS + fltr->sw_id); > + bnge_del_ntp_filter_rcu(bn, ntp_fltr); > + } > + } else if (fltr->type == BNGE_FLTR_TYPE_L2) { > + l2_fltr = container_of(fltr, struct bnge_l2_filter, base); > + fltr->fw_vnic_id = bn->vnic_info[BNGE_VNIC_NTUPLE].fw_vnic_id; > + if (bnge_usr_fltr_ring_lost(bn, fltr) || > + bnge_hwrm_l2_filter_alloc(bn->bd, l2_fltr)) { > + netdev_err(bn->netdev, > + "restoring previously configured l2 filter id %d failed\n", > + fltr->sw_id); > + bnge_del_usr_l2_filter(bn, l2_fltr); > + } > + } > +} [Severity: Low] The commit message says: User filters stay in software while the interface is down. bnge_cfg_usr_fltrs() programs them in firmware again on open, and bnge_clear_usr_fltrs() deletes them when NTUPLE is turned off. Should it also say that bnge_cfg_one_usr_fltr() permanently deletes a retained rule that it cannot restore on open? The rule is dropped in two cases. One is when bnge_usr_fltr_ring_lost() reports that the target RX ring no longer exists. The other is when the firmware refuses bnge_hwrm_cfa_ntuple_filter_alloc() or bnge_hwrm_l2_filter_alloc(). The rule then leaves usr_fltr_list, the hash table and the sw_id bitmap, so it disappears from ethtool -n. Only a log message is left, and bnge_open_core() still returns 0 after bnge_cfg_usr_fltrs(). The ring-lost case looks reachable. The ethtool core stops ethtool -L from shrinking below the rings that rules use. However, bnge_reserve_rings() in bnge_resc.c can still lower the ring count at reservation time: dev_warn(bd->dev, "RX rings resv reduced to %d than earlier %d requested\n", rx_rings, bd->rx_nr_rings); ... bd->rx_nr_rings = rx_rings; bnge_check_rss_ctxs_lost() already handles this case for RSS contexts. The commit message covers the other caveats in detail. Could it also note that rules can vanish after a down/up? This behavior is the same in the last patch of the series. -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201132011.2705569-1-vikas.gupta%40broadcom.com