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=1795956408; b=SKE1CeJcaJAij6VU3ealKZ3DKMblFO7eAeAb6Iu50/3RSrG+Jq5JLqf9rxyDL4j4r5Y6 BVV0Ad3GxNwx7m8U3ir0UhgXDFJk2cvql9nA8SP1gtirxQmnoxgf11KnmSWoMW5BAnujp PlAxDV/Js9nj40iHhJQ4afHSyLkf9n2NKK4EqSDZfEihfBnz0VZShMer5ZApAaHLmwtgn XnYBYV4afC2q3c09QzknsaKyzEbPfoLPaJxW17T4GI/rAIEHZiVaxuR3C5GagNOhMLQhg t9Qp7yCkWV2EHh/SF6gjTEbFhpDp6Gi/Es1whAAd7xfP0Tb+ZmQmDkiPgMEiLUFEHmw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795956408; 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=beb7qFqpiCiTl2Xidxaz0U8nucMYyJgNWCYy3b4/PPk=; b=XC/J24E9mj0aUV664berTusX1tGElTfHeuuO0Rb8yBX4qaGFwwKUF91E3YzmHCiRatjw gqoz6+nhwIiUQUz3HO/tbwBE5ppRzoVfFB8AAll65XLcmQ1UpsumpKaoGF8gx88Vehemz HycvEoI0J+domVYV78X6WplUBVOFo0B19R31Js9y5Rd35+GqwZ8iu5yl8DOlEc7mgg7N5 0wuWFNOvXZSaLNy4hZjs0fTTN4e7pUlzv4rybEz2Fb9bkwgI1dlgk6GYa9oZ+aUkmzR+m VgoNWSCT7qp4JG1JgLvMckZpjgpmgjaYbh+oTLey5yh++UadugtZraix6g9KqdekTmA== 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=QUQb3QNT; 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 7A831606A68E; Sun, 29 Nov 2026 12:46:48 +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=QUQb3QNT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E7DF1F00923; Sun, 29 Nov 2026 12:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795956408; bh=beb7qFqpiCiTl2Xidxaz0U8nucMYyJgNWCYy3b4/PPk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=QUQb3QNT3oblBNVSc1836kVndZtOFQlvryOXvtO7tddyeM10Ub2ZKK5Q9l/GggbVT QPS7dWDKR4K/45Yh9616AANby7A8ATtgcQtZGAr2PmNGoAgPUZQMqxBAdK2AzW2dq/ ceDqcFRTi6I30dmlBJDWEOk4UeyyXc3tP7CjlKlrILorhO/W5/1HXD7eOUZyIcQGph /JJbn4HJttqSfhFLw4gBfWklQBuVwH3G3tU/nNAlDJP4A7fDV22sT4V3ZskXTsz/dR YsqS2AL4KnoT/ledDVBLo+YxBoUWxPYsBkd0r3Pe3oD07eJsNiMQpfTC4ahTqn9FnE uaucKLNYuDIVQ== Subject: Re: [PATCH net-next v10 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: Sun, 29 Nov 2026 12:46:46 +0000 Message-ID: <179595640693.3146.16367502250834914716@kernel.org> In-Reply-To: <20261125115434.2080590-9-vikas.gupta@broadcom.com> References: <20261125115434.2080590-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 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/20261125115434.2080590-1-vikas.gupta%40broadcom.com