Article View: linux.kernel.netdev
Article #27408Re: [PATCH net-next v12 08/10] bnge: add NTUPLE filter support in ethtool
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 14:46
Date: Sat, 05 Dec 2026 14:46
177 lines
15103 bytes
15103 bytes
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
Technical Details
Message-ID:
<179648198035.3146.10955388662827175312@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378023-linux-kernel-netdev=dewy.ruReferences:
<20261201132011.2705569-9-vikas.gupta@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378023-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v12 08/10] bnge: add NTUPLE filter support in ethtool Date: Sat, 05 Dec 2026 14:46:20 +0000 Organization: Usenet Network Message-ID: <179648198035.3146.10955388662827175312@kernel.org> References: <20261201132011.2705569-9-vikas.gupta@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3049294"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:P9q66JV2LY6yCVJzrFt4STDabyU= sha256:JDP5zzQNq8GZrbxKcv1aKt35ht3JJhm4TCqwlhMBwro= sha1:jfSLaInjvW4aGELV6tbVa6Ad0K8= sha256:2X8jB+O4OhbzvAU65GOTOq38sCg6CLpP7ut5nGRQh9Q= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 38108117E47; Sat, 5 Dec 2026 17:47:00 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MrvcQun7friT; Sat, 5 Dec 2026 17:46:57 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-378023-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 0C55E117E42; Sat, 5 Dec 2026 17:46:48 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 3EE83607270; Sat, 5 Dec 2026 14:46:48 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796481987; b=HuSAtM+NO/NzY8Cw6H63SJFeVANB/Rg/zCehoAzzIObVDwjZp8Jrx10VwD7t2d7lSfyt SCEq7Avnisz09umvhG44rS/8vDqO2B5LpfeQ9BDLbBxsBagtKME+iK1HtInETZ/ELjzv6 m9qqkwNAHQJFOfOK8tk5AuUGhERAMuZ6f3u/slIOaElRjX6ZFQd1JxFzA22p6gCGJZAtI zrzh4rVakcWTnHvKqm3CiSTU4Oet1rXj7BExtxGTNbkc8JkPulJe1VOY287WyG+drb8lc e39k+AQX+EV9ynQ84O2SS69cTnaf16cJ7H9Qbjl3YUo/5iufb3jw6Zc6ZdNSr5azF2Q== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481987; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=kUs6R+h4kFK8l5gu2XMX1SewD613LSNZn/KhJCd3e+M=; b=OxIS5dDhj6Q8PQ4Qg7FMsxH6zxPcAwbxxhytdflWzhSmCs0vMzwxWY1Z2A86S9w6s+gj Q2eLGVEoeZhjX6EwXXvGW3II0XHkFARHZfDSD+AYqrpEorJ7tywhu1xQ+0u9EMuMPtOP/ U/JX8Q8jqZg1WKyKH5k8+MPZN/vq0Wm9Oeap7W7qp/k5Wo7xaJJeQalsvf1OMNKIaNLBN xnE6rWiY78mSrLdBb0sn3uNRSNoPYCOCgJu02CJ7M7KMDdnV9HDrDqA3k4VZx/kaWBj5Q S+l7QyLFyT5HcJ8nE0VCxepqoEQNOIqcaFR9uGRWCMf3QsMfYGNRgCNH7EdeD6vXpcA== X-ARC-Authentication-Results: i=2; 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=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DF3360A3801; Sat, 5 Dec 2026 14:46:27 +0000 (UTC) X-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+ X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-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== X-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== X-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 X-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) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C59841F00A11; Sat, 5 Dec 2026 14:46:20 +0000 (UTC) X-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== X-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 X-In-Reply-To: <20261201132011.2705569-9-vikas.gupta@broadcom.com> X-sashiko-severity: Medium X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list