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=1795956407; b=o2sV9TzH4fboWWKie6Pj7xV6qHYZlMYcQkNxSGCjWL+o8KcOOuFzIYLJnxyin/DfeBjp s+afxtS3lnw8kX5xq2sVeBOP1TxlEm5hWEuXX0eVh7LbvNx63XTCbzkoKCX8nGm3WJk9n K4Q2qIkcjFhmVynCpCjPfNUx0s1jDEi2ymEwuexradGdCgf/EMgd8R+e5U5mqvIISbON/ Dth1Pf/Zkf9Nm4z4B5rr8D+CFkytMgQXvNbiXB7aBrv3MnoNwqYOcFNRJg5hArYoqrHMn J3VNhOTLpypeXi4JOSTY8RVbPqg6QqyRNyakO5coF6PpqVii0ENXmOE9C6p1dqEacnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795956407; 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=/xmwtNG7O4OoipbjTcmRYxpeehdG+zTDqM2U2Qeq7ZI=; b=utB6KIhSoHbQniTL/3Ug02bMMDUzdOsRs8d7GHi7r1AhObxjww+IH4Uxoo7CDaftIhgj xU52l4ff5GU1coe9yTzt5Fpip5Ibc6GFmNEoBhQHAf5Uw7g29+Z6K4rFcC8nu/W2ut+SN wsV71YZB2S6CDz4+Xyje1iYxHWe9QQ8h/AzKYLJKtC3j2nChOjRTXuzS95sWrkf+FTuBO SV5i5RHsnwVUUSVLv9+DwZ7reEkewsnSSLbhYo5/fIK4ZhpuiPxBtJV7SYHdkAx2rejpP AS3qTHx0NctWkWijVsb+778IvfY3Z60odySfRIdUWkj9PrtsDyQIbFdvNCIXa+UnYtw== 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=dOb9yyQg; 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 19208606A330; Sun, 29 Nov 2026 12:46:46 +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=dOb9yyQg Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB2271F000C1; Sun, 29 Nov 2026 12:46:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795956406; bh=/xmwtNG7O4OoipbjTcmRYxpeehdG+zTDqM2U2Qeq7ZI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=dOb9yyQgrDS5MShHCD9b3zrgsUAABB5G8316kYeQVSyVx0YWVUTzTx0bgb28DmvoX aCxyp9axamF4uSHkx9KQzZ8FUZ1hhp7SEDmLwEeHH7ZKhJRDJp5/rcA/nEkajWCAGP Y9SgbMANlZgiE24wwltrbYmDNXESS9VCOn11ROH+1l81KaPEkdaDwq3EEE2XspqAoM 8m/dWztDKc8uSp1a/bj9WzczbZDHVVuM6gN2Y/mnL0f8IOwFRd38ujRfHZ5qx9UpZQ 3x9UWZDV/LToC20Etuk5l91Uq0TRn6tv99+FPnVaB9t+xEAdSBsi2QbCgdjZBzo5K2 z7yDwd7VBWLyg== Subject: Re: [PATCH net-next v10 07/10] bnge: add NTUPLE filter infrastructure 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:45 +0000 Message-ID: <179595640551.3146.18013496733441197654@kernel.org> In-Reply-To: <20261125115434.2080590-8-vikas.gupta@broadcom.com> References: <20261125115434.2080590-8-vikas.gupta@broadcom.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@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 more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin. Low priority / nit picks for your consideration: - [Low] At this commit, the commit message and new comments describe code that does not exist yet. - [Low] Several exported helpers dereference state without NULL checks. -- bnge: add NTUPLE filter infrastructure This commit adds the NTUPLE filter data structures, sw_id bitmaps for the L2 and NTUPLE filters, and HWRM wrappers to allocate and free NTUPLE filters. It also splits L2 filter deletion into RCU and non-RCU variants and sets bd->max_fltr to the fixed BNGE_MAX_NTUPLE_FLTRS. > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c > index 6316f75ca36ea..3ebb3cae4829b 100644 > --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c [ ... ] > @@ -72,10 +227,339 @@ static struct bnge_l2_filter *bnge_alloc_l2_filter(struct bnge_net *bn, [ ... ] > +static int bnge_alloc_ntp_fltrs_mem(struct bnge_net *bn) > +{ > + struct bnge_dev *bd = bn->bd; > + int i, rc = 0; > + > + if (!(bn->priv_flags & BNGE_NET_EN_NTUPLE) || bn->ntp_fltr_bmap) > + return 0; [ ... ] > +int bnge_insert_ntp_filter(struct bnge_net *bn, struct bnge_ntuple_filter *fltr, > + u32 idx) > +{ > + struct bnge_ntuple_filter *f; > + struct hlist_head *head; > + int bit_id; > + > + spin_lock_bh(&bn->ntp_fltr_lock); > + > + head = &bn->ntp_fltr_hash_tbl[idx]; > + hlist_for_each_entry(f, head, base.hlist) { > + if (bnge_fltr_match(f, fltr)) { > + spin_unlock_bh(&bn->ntp_fltr_lock); > + return -EEXIST; > + } > + } > + > + bit_id = bitmap_find_free_region(bn->ntp_fltr_bmap, > + bn->bd->max_fltr, 0); [Severity: Low] Should these exported helpers document, or check, that the device must already be open? bn->ntp_fltr_bmap is allocated only from bnge_alloc_core()->bnge_fltrs_mem(), and only when BNGE_NET_EN_NTUPLE is set. It is NULL before the first open, and bitmap_find_free_region() here would dereference it. bnge_init_l2_filter() has the same pattern with bn->l2_fltr_bmap. So does bnge_get_ntp_filter_idx() when it is called with skb == NULL: vnic = &bn->vnic_info[BNGE_VNIC_DEFAULT]; return bnge_toeplitz(bn, fkeys, (void *)vnic->rss_hash_key); vnic_info is NULL while the device is closed. In the rest of the series every caller is gated, so these NULL states are never reached: - bnge_srxclsrlins() requires netif_running() and NTUPLE. - NTUPLE can only change while the device is down (bnge_fix_features()). - bnge_rx_flow_steer() checks BNGE_STATE_OPEN. Still, nothing in these helpers states that requirement. The lifetime is also asymmetric: the bitmaps are allocated on open but freed only in bnge_netdev_free(). [ ... ] > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c > index f1fcac315380f..58039e6d610ed 100644 > --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c [ ... ] > @@ -3227,6 +3236,20 @@ static void bnge_close_core(struct bnge_net *bn) > > bnge_nq0_napi_to_wq(bn); > > + /* Invalidate user L2 filters now that NAPI is disabled so that > + * subsequent re-enabling during open cannot read a stale or torn > + * filter_id before bnge_cfg_usr_fltrs() completes reallocation. > + */ > + /* Only the driver's tracking is reset here. The user filters are > + * programmed again by bnge_cfg_usr_fltrs() on the next open. > + */ [Severity: Low] bnge_cfg_usr_fltrs() does not exist at this commit. It is added later by "bnge: add NTUPLE filter support in ethtool". Could the comments and the commit message describe what this patch provides, or mark these as forward references? This patch has a few similar references. The commit message says that max_fltr: "with the 128 L2 rules, is the rule count that ethtool reports." ethtool does not report it until bnge_get_rxnfc() is added later in the series. In bnge_cfg_rfs_ring_tbl_idx(), the unchecked xa_load() depends on validation that is not in the tree yet: /* The RSS context was already validated via xa_load() when the * filter was added (bnge_ethtool.c) under netdev instance lock, * so it is always present here. */ ctx = xa_load(&bd->netdev->ethtool->rss_ctx, fltr->base.fw_vnic_id); rss_ctx = ethtool_rxfh_context_priv(ctx); The same is true in bnge_del_one_rss_ctx(): /* The kernel ethtool core prevents deleting a busy RSS context via * ethtool_check_rss_ctx_busy(). ethtool_check_rss_ctx_busy() has no effect for a driver without get_rxnfc, and bnge only gets that later in the series. All of these are in place by the end of the series, so only the intermediate commits are affected. -- Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125115434.2080590-1-vikas.gupta%40broadcom.com