🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25003

Re: [PATCH net-next v11 09/10] bnge: add aRFS flow steering ndo support

#25003
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:39
125 lines
12630 bytes
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] In the expire loop of bnge_cfg_ntp_filters()
  (bnge_filter.c:835-836), the return value of…

--

bnge: add aRFS flow steering ndo support

This patch adds the ndo_rx_flow_steer callback to bnge. The callback
builds an ntuple filter from the skb flow keys and queues sp_task to
program it in firmware. It also adds bnge_cfg_ntp_filters(), which
installs, retargets and expires aRFS filters from sp_task, and changes
ntuple filter matching to compare the L2 filter by key rather than by
firmware id.

> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> index 639c36d571f24..b7261018216bc 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_filter.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_filter.c

[ ... ]

> @@ -716,3 +735,105 @@ void bnge_clear_usr_fltrs(struct bnge_net *bn)
>  		}
>  	}
>  }
> +
> +void bnge_cfg_ntp_filters(struct bnge_net *bn)
> +{

[ ... ]

> +	/* Free the old HW rule; reinstall it below on the new queue. */
> +	list_for_each_entry_safe(fltr, tmp, &update_list, base.list_node) {
> +		list_del_init(&fltr->base.list_node);
> +		/* If the free fails the rule stays on the old queue. It is not
> +		 * retried, so a firmware that keeps failing is not hit on every
> +		 * tick.
> +		 */
> +		if (bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr))
> +			continue;
> +		clear_bit(BNGE_FLTR_FW_DELETED, &fltr->base.state);
> +		list_add(&fltr->base.list_node, &install_list);
> +	}

[ ... ]

> +	list_for_each_entry_safe(fltr, tmp, &expire_list, base.list_node) {
> +		list_del_init(&fltr->base.list_node);
> +		/* Decide again under ntp_fltr_lock: the scan ran without it and
> +		 * the firmware calls above can take long. Use the rxq and
> +		 * flow_id that bnge_rx_flow_steer() writes under it. Unlink
> +		 * here too, so a flow cannot be retargeted onto a filter that
> +		 * is about to be freed. The firmware free comes after the
> +		 * unlock.
> +		 */
> +		spin_lock_bh(&bn->ntp_fltr_lock);
> +		if (test_bit(BNGE_FLTR_RXQ_UPDATE, &fltr->base.state) ||
> +		    !rps_may_expire_flow(bn->netdev, fltr->base.rxq,
> +					 fltr->flow_id, fltr->base.sw_id)) {
> +			spin_unlock_bh(&bn->ntp_fltr_lock);
> +			continue;
> +		}
> +		hlist_del_init_rcu(&fltr->base.hlist);
> +		spin_unlock_bh(&bn->ntp_fltr_lock);
> +
> +		bnge_hwrm_cfa_ntuple_filter_free(bn->bd, fltr);
> +		bnge_del_ntp_filter_rcu(bn, fltr);
                ^^^^

[Severity: Medium]
What happens to the firmware ntuple rule in the expire loop of
bnge_cfg_ntp_filters() if bnge_hwrm_cfa_ntuple_filter_free() fails?

bnge_hwrm_cfa_ntuple_filter_free() in bnge_hwrm_lib.c only invalidates
filter_id on success:

	rc = bnge_hwrm_req_send(bd, req);
	if (!rc)
		fltr->base.filter_id = BNGE_FLTR_ID_INVALID;
	return rc;

Here the return value is ignored and bnge_del_ntp_filter_rcu() always
runs. That clears sw_id in ntp_fltr_bmap, decrements ntp_fltr_count and
calls kfree_rcu() on the only object that holds the firmware handle.

If bnge_hwrm_req_init() or bnge_hwrm_req_send() fails, does the rule stay
programmed in the CFA table? It would then keep steering the flow to its
old RX ring, and the driver would have no record of it.

Close won't free it either. bnge_hwrm_cfa_ntuple_filter_free() returns 0
when BNGE_STATE_OPEN is clear, so the rule looks like it stays in place
until VNIC teardown.

A later aRFS request for the same flow would send
HWRM_CFA_NTUPLE_FILTER_ALLOC for an identical tuple. Depending on the
firmware, that could be rejected as a duplicate, in which case sp_task
deletes the new entry and the flow can no longer be steered. It could
also install a second rule that conflicts with the first.

The update loop above checks the same return value and keeps the
software entry when the free fails. Should the expire loop handle a
failure the same way, instead of dropping the only record of the
firmware filter?

This path becomes reachable once "bnge: add cpu_rmap support for IRQ
affinity" turns aRFS on.

> +	}
> +#endif
> +}

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130055736.2306367-1-vikas.gupta%40broadcom.com
Technical Details
Message-ID: <179610718537.3146.5243328929678398709@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374744-linux-kernel-netdev=dewy.ru
References: <20261130055736.2306367-10-vikas.gupta@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer05.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374744-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v11 09/10] bnge: add aRFS flow steering ndo support
Date: Tue, 01 Dec 2026 06:39:45 +0000
Organization: Usenet Network
Message-ID: <179610718537.3146.5243328929678398709@kernel.org>
References: <20261130055736.2306367-10-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="1637695"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:G3+TKjZ+wRrcXZ5ADgpJt7G/aQs= sha256:lQpYw99x3ZKfr2sSWxnZpjL0ZpNlejKCwpES7CzlBt8= sha1:kaTpP/Vmzbwg5W19MCySXhp/zOg= sha256:jXUbzTgnCo0RRx0j4ATb7EevVuJL0FkiW7RJrGfc4+w=
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 6925811726B; Tue,  1 Dec 2026 09:40:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, 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 MJn91pIKuGbq; Tue,  1 Dec 2026 09:40:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374744-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id CB75B117265; Tue,  1 Dec 2026 09:40:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 8F99223839; Tue,  1 Dec 2026 06:40:04 +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=1796107188; b=uW2XYvrdVLlkqgvRvE47naoC7FSfD7MNu7QmtA5wBORJZq54nhmlEGVC2q2msqtlgeNm W/6iGkKS547akRVGPEL+Sg7Ik9fWO7m2r9Zyg5vZU5/+O2ql5FTRejPwuXUtHRoQiRvGR sFdcfPWZ6LS02NhA+pVLwkcnvmJgZ2Z5XqfYXyyyRqEf+Pbg3k6/DwK9dMHzhbqBjBayx oZ802HIFLpFjDR4kUNCUIO1+5vObhRDXthvW9bMIC9JOyGj7sEeN/SNFCdexpdApTgxr0 v0yRGVeWepuL8uT9AZlFdF99V9VxbvyoZnFV2bSpzro5Yhe8xvAPCxj47GouukJ7awQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107188; 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=8X7BxYxFRftioOrrdsLuhbAlET/wwofQkd2phMJ0tbU=; b=f/bcx6w+o0n3eP23VM0qd6YXvF9GtZWB2yeRx7q7+ursRJcJRjwC1mSH2vHjQcIYhBHf sy8x7+8c6RTw5a7BTn/ItwTfxBRofRg/xo2WUBftf3/fKRHA+O0EJwMElIEVCbL3im5Fi xxXYfYCnB4X1WoH6aCE/KAjdmb7wKNlssiDaULMa5Wmm76uietmyncyJsVRnq2emUfZXQ VHjIw6vyAAR6m4W8g8cZOROq7RYqDdiUGLHzpEgEsjDI2LOuxmKF5Xc07YZcFxX+SzTiC Jwsn0KSw6p4qM2EVs15jvs0P51WCAcuu7lPmR1hgDu+81PrMeb6C2Zn7HKy7Qmi7v7w==
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=WhnZ3HMp; 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 DFDDB606A697; Tue,  1 Dec 2026 06:39:47 +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=WhnZ3HMp
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=1796107187; b=357fkJyQOLIMsuisnA09WYqVGfV2z/3EhiushE+HhHkdH9f+zZIhqhG9zUVXb6lu9ZoU H8H/F+c6D0F5st943Ofv3rCkMUk40+r/9FF51Y0+C3N0r+jv2Ie0nb8+uWR3qHvOEvxnB jupJpuvdQNmSUFnCzIYRL/e62PIpcJKzvq4kg/hciTEU9sPiU63eGYMGTz4F3i6kvwTL9 LvH8Ylx/QlcFwGo813GkK4d8Z0LZOpHwNQPA46khOB3nYYrtWrFqVQhrb7s2oRNkmIl+9 lf8BxRLIVX+r81SIokv3vHs7oFnkVn2LUB+G42NN9EQl+C9FvbXQ1DdSFD95YZkdNcw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107187; 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=8X7BxYxFRftioOrrdsLuhbAlET/wwofQkd2phMJ0tbU=; b=vNUJUhak2NChqbUd6rRp8zhuxZsgZToWUBiiGR891OMLkV6IaLwni6nMwzKY7GjwsRua Tiy1zFKIpGL0sxKVqyz2n2eurZlaHeHz3qadT25ITEfETuSa4XE5W5a4PjnvlC4sec4Gs MVfH1C4w5k9QAF9j2M2M1+5ZGMsaCjr8SBNx6GcQqbUgMZnYb3ZfrqXlYZFx1ZsqeftdG 5hfPk8OqYIL9/noyy9DPDPtGEJy135yViBI5LZdb3K79OrIjT8Lig2on2zA5Jl2Hovxh+ Q21laTYpRUKmbwp6vZ14JF8dVFr+u3VrrnS/pnLdP7wteEmS/0BLGiqhJuT6jo34Zyw==
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=WhnZ3HMp; 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 0E467606A690; Tue,  1 Dec 2026 06:39:46 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5DF81F00897; Tue,  1 Dec 2026 06:39:45 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796107186; bh=8X7BxYxFRftioOrrdsLuhbAlET/wwofQkd2phMJ0tbU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=WhnZ3HMp6FOZZsyv95MbOEf44Ljpd1jx9iIarE7QlTX3FLh2r2kJ4bZWYWV3Loeok ceLEqlpoxpn5QnBRTqzwDfb7fR/WX/IhoNlRbYbHgHtBV7tI6SagzdDuhsV1RHZcVQ 4cQ7iGJ9xu0ehX2lMnFnPPdxm1KQJc7+byYidC6ZevucROhQQiEjOYkM2bgddUcvVT Sj9aqcc7hkQ3wrlf76a/dtUg8SSyNrdSYy1u3euUDH73QzW8fxAM+hmDHBpPqVqJFj W7vvmaP1kXMn8HEfr3A539MVITyO35zikHfz+SD4Qi7/NVvJldITVraE7qb66wsCjU Y2eTytn5Foudg==
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: <20261130055736.2306367-10-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
X-Received-Bytes: 12371