🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18558

Re: [PATCH net 1/4] eth: fbnic: wait on the correct queues in fbnic_queue_stop()

#18558
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 14:32
119 lines
13035 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] eth: fbnic: fbnic_wait_queue_idle() only polls 128 bits of
  256-bit Tx idle regs
- [Low] This patch changes what `struct fbnic_ring::q_idx` holds for Tx
  completion rings, but the field's comment still describes the old…

--

eth: fbnic: wait on the correct queues in fbnic_queue_stop()

fbnic_queue_stop() now passes cmpl.q_idx to fbnic_wait_queue_idle(), so
each queue triad is checked against its own hardware queue. Before this,
sub0.q_idx was used and every Rx triad was checked against queue 0. The
patch also sets q_idx on Tx completion rings, and the stop/wake loops now
skip disabled Tx rings.

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> index 07d4b2e923627..5efed21e59329 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> @@ -1772,7 +1772,7 @@ static int fbnic_alloc_napi_vector(struct fbnic_dev *fbd, struct fbnic_net *fbn,
>  
>  		/* Configure Tx completion queue */
>  		db = &uc_addr[FBNIC_QUEUE(txq_idx) + FBNIC_QUEUE_TCQ_HEAD];
> -		fbnic_ring_init(&qt->cmpl, db, 0, 0);
> +		fbnic_ring_init(&qt->cmpl, db, txq_idx, 0);

[Severity: Low]
This isn't a bug, but should the comment on struct fbnic_ring::q_idx in
fbnic_txrx.h be updated along with this change? It still says:

	u8 q_idx;			/* Logical netdev ring index */

With this patch, the Tx completion ring's q_idx holds the hardware TCQ
number. fbnic_queue_stop() now relies on that, because
fbnic_wait_queue_idle() uses idx only as a bit position in the QM idle
registers:

	off = idx / 32;
	mask = BIT(idx % 32);

On XDP-only Tx triads (txq_count == 0 in fbnic_alloc_napi_vector(), with
sub0 marked FBNIC_RING_F_DISABLED), no netdev Tx queue has this index. In
the "rx 34 tx 34" example from the commit message the value is 39, but
the netdev has only 34 Tx queues.

Future code that trusts the comment, for example
netdev_get_tx_queue(dev, qt->cmpl.q_idx) or fbn->tx[qt->cmpl.q_idx] on a
Tx triad, would get the wrong queue or none at all. Could the comment say
that q_idx on completion rings is the hardware queue index?

[ ... ]

> @@ -3089,13 +3092,16 @@ static int fbnic_queue_stop(struct net_device *dev, void *qmem, int idx)
>  	napi_disable_locked(&nv->napi);
>  	fbnic_nv_irq_disable(nv);
>  
> -	for (i = 0; i < nv->txt_count; i++)
> +	for (i = 0; i < nv->txt_count; i++) {
> +		if (nv->qt[i].sub0.flags & FBNIC_RING_F_DISABLED)
> +			continue;
>  		netif_stop_subqueue(dev, nv->qt[i].sub0.q_idx);
> +	}
>  	fbnic_nv_disable(fbn, nv);
>  
>  	for (t = 0; t < nv->txt_count + nv->rxt_count; t++) {
>  		err = fbnic_wait_queue_idle(fbn, t >= nv->txt_count,
> -					    nv->qt[t].sub0.q_idx);
> +					    nv->qt[t].cmpl.q_idx);
>  		if (err)
>  			goto err_restart;
>  	}

[Severity: Medium]
Does fbnic_wait_queue_idle() actually wait on the XDP Tx ring here?

The commit message says that in the "rx 34 tx 34" case the vector now
waits on tx 39, the XDP Tx queue of rxq 5's vector. That ring is
qt->sub1, which is TWQ1 of hardware queue 39. qt->sub0 (TWQ0) on the
same triad is marked FBNIC_RING_F_DISABLED. The first Tx triad of every
vector with Rx queues has the same XDP sub1 ring, combined or not.

In fbnic_csr.h, FBNIC_QM_TWQ_IDLE, FBNIC_QM_TQS_IDLE and
FBNIC_QM_TDE_IDLE each have 8 registers. That is 256 bits, enough for
TWQ0 and TWQ1 of all 128 queues. FBNIC_QM_TCQ_IDLE has only 4.
fbnic_wait_queue_idle() derives a single offset and mask from idx:

	off = idx / 32;
	mask = BIT(idx % 32);

It applies those to every Tx register base, so it only reads registers
0..3 of the 256-bit arrays.

If the upper half holds the TWQ1 bits, TWQ1 is never polled.
fbnic_queue_stop() can then go on to fbnic_nv_flush() and clean up the
XDP Tx ring and its buffers while the hardware may still be processing
it. If the bits are interleaved per queue instead, the bit polled for
idx > 0 is not the TWQ0 bit of that queue at all, and we would either
miss the real queue or hit spurious idle timeouts.

The register handling predates this patch. Until now, though, every Rx
triad was checked against queue 0, and this patch makes the XDP-only
triads depend on this wait. How are the TWQ1 idle bits laid out? Should
fbnic_wait_queue_idle() also poll the TWQ1 bit for the TWQ, TQS and
TDE registers, perhaps only when sub1 is not FBNIC_RING_F_DISABLED?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116202957.3601684-1-dimitri.daskalakis1%40gmail.com
Technical Details
Message-ID: <179501233405.3136.1951462935602133003@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366181-linux-kernel-netdev=dewy.ru
References: <20261116202957.3601684-2-dimitri.daskalakis1@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366181-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 1/4] eth: fbnic: wait on the correct queues in
 fbnic_queue_stop()
Date: Wed, 18 Nov 2026 14:32:14 +0000
Organization: Usenet Network
Message-ID: <179501233405.3136.1951462935602133003@kernel.org>
References: <20261116202957.3601684-2-dimitri.daskalakis1@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2617523"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FLigIfkUj6xDBYqA3iTGgA6kdJ8= sha256:7CZAAwm7oegG3NXHIP2KlKnksl2htXes7VojRLCduSs=
	sha1:rOPREEGhg7pBvHuPwzxYwlyP4Vw= sha256:Yjy6rR7rBxil0Lg5SS6fRA5s1TOOefVSSvuL+EYmC1Y=
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 D0A271152D1; Wed, 18 Nov 2026 17:32:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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] 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 SdTTzELalsrx;
	Wed, 18 Nov 2026 17:32:34 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366181-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 4BCEF1152A3; Wed, 18 Nov 2026 17:32:25 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 6234A397CB; Wed, 18 Nov 2026 14:32:17 +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=1795012336;
	b=bU+lCmNcZedz5P9IVOq6z9mqr5DqhXDRzxj7iq00rIspiXE1f22lat1t92N9Io6wmACQ
	 3RGeM8+BbF6LaWs4PJurJTpZJ+ryAl0G8qY4upA+hM0l5QDgtocU2L/NTiPmtDhXnp73l
	 f7F6JFtkAd0OCcpI+iOo/GgLDWjkb82iv7Y7B3WmWTvJh4nfDkPMaQYzxmEHypRhIrgcI
	 WUUhRo0n/j9Vtm5IQdIEeoqUpxFUPOahNc7nawySLldj2Sx/VvscRNSR+Aq9KhykNuDZi
	 yMeDq5VxSaWNfKNu5VkbliM6AZeHMmXqSeVcZGGh1d8AJkYfp8fAdWfXFJRmSj8OaRA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795012336;
	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=e+b32G03EPQJGG4TuFx2MYnPePwUlj3+JM0uGkr6zD4=;
	b=QKvtK+QJSzzwylQ4xxMKEfXZvD0ycXSLtOP4CZtWA5hxXokE8eHWo7nCw2YWy2QAtQ4i
	 aDbyulTuNCXwt/yyXlGMzS+Ay42BBj4iuJEOflkuzbjcsGEm1i6LFCs3oRUgeIU0T7Lxw
	 ZhyEt2RFMdHgFoab0A6tEONPb3r+XaKCadaQlBkfdvwwAtxdRYGSJ+x4aCi5bRI0+o/6l
	 3fyEvxm8FFFy+fCP5ieAyW65DgHtu+ZhR+EYFJtFjw4lbXxRCldS2LLpyNTIY9sOKV+bQ
	 mrPEr3m0cWwy6ZTYeLEhLg2G3iN3ZcXDkdiE3cPju+h61svfvaF+aFOHGBfwsYP1WHQ==
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="Ub6W/pX1";
	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 C4312606A330;
	Wed, 18 Nov 2026 14:32:16 +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=Ub6W/pX1
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=1795012336;
	b=2Hnc8s1j3oLvApM5PRTd73RQU+nRf9g1DeOQJwPs8YP8+fnyj2pk5mVGNd9Dnt/3NSUz
	 9jeTIj6i11ZzHvAzEkkwrZYQISxDC5l1tl9ZK7sAb2tAUOHNzUBCG73zezIvGBsJPc8jl
	 IpaG8ajcwCm0veU/xxtqZdYbSka5F5NWJfTOJpFrj1YShPZQFuoUaAC+F3rUvePOMn10g
	 yl+/ELxS8O8sjZFgGiRU/3H4/Y+SZtQKsXqm6LuX56WfqUxo4j2KY+V3X4RQ10d731//0
	 WLbnEil2nXFGjXX7/jFni25Rtc4+F4eX9fa885j063sLdhFhBAflvS3e7vFMFavimtg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795012336;
	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=e+b32G03EPQJGG4TuFx2MYnPePwUlj3+JM0uGkr6zD4=;
	b=oKgRfNtOlb9cy7hEMMb0RZ0Tjx/GYpHhupG1MvnPV5RJl/EiVM6RjNzQuDw/F5kXmEJf
	 wYCz9seAxOFWj+739k7BA8D5yzjUPjmBcvJSJEbyr8ZKrHSs/7gEz0o+m98rO82XBDGoW
	 vsf7EddI95uVTa/T2UiLVFo/dxLG9RJgJUBeaxzymJ7v/f0t4GfTMo1ZmOnzuAsvvJJnV
	 lrx9iaqxVepWHlLqFTqUdM9RUxGTvExJR3/ARmm8V8GBLJoWKe9INH5SLTYoCPk5aUrES
	 /RCgYvvGbXrsKJjfuYwwfsS1zzDSjiXqVl+GCjH2qEC+B38YlG4OEKtG3KVmYlnDnGA==
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="Ub6W/pX1";
	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 E0AC5606A31C
	for <netdev@vger.kernel.org>; Wed, 18 Nov 2026 14:32:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D7651F000C4;
	Wed, 18 Nov 2026 14:32:14 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795012335;
	bh=e+b32G03EPQJGG4TuFx2MYnPePwUlj3+JM0uGkr6zD4=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Ub6W/pX1mC7IY7rMoMyv4yYYkMN39ZnGKPD9uvdFccWdwD2f/KEfDPbHcddpfhuto
	 L79pa+5P/ZmsAooOBrGpfg0koXGAGU/3B7wxv8jMtP1IbwV1h6zX57876GbSSEHLzf
	 8C58a7pUKYr9HyTtXT3rC2g4ICDxfHZLbnnokbcypK/ZYocICSMhYgrYHpUThN9skX
	 Pp7XNpfZ/ckZ2SBvzr+DcmO9hwRsMzR9VNN/TriXoqOn/QbITGzhceIFlV90SjfjjH
	 zYWdOLa/Ea5A+35IyeiLbW0ZAEsXvuAleCIncw3YlPIH8AbIMKZcMU2isZ4ZkWyY58
	 Obxk5Wq2T1S0w==
X-Cc: davem@davemloft.net, alexanderduyck@fb.com, kuba@kernel.org,
 kernel-team@meta.com, andrew+netdev@lunn.ch, edumazet@kernel.org,
 pabeni@redhat.com, shuah@kernel.org, hmohsin@meta.com,
 mike.marciniszyn@gmail.com, sdf@fomichev.me, bobbyeshleman@meta.com,
 bjorn@kernel.org, leitao@debian.org, horms@kernel.org, almasrymina@google.com,
 vadim.fedorenko@linux.dev, daskald@meta.com, netdev@vger.kernel.org
X-In-Reply-To: <20261116202957.3601684-2-dimitri.daskalakis1@gmail.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