From: netdev-bot+sashiko@kernel.org
To: dimitri.daskalakis1@gmail.com
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
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 [thread overview]
Message-ID: <179501233405.3136.1951462935602133003@kernel.org> (raw)
In-Reply-To: <20261116202957.3601684-2-dimitri.daskalakis1@gmail.com>
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
next prev parent reply other threads:[~2026-11-18 14:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 20:29 [PATCH net 0/4] eth: fbnic: miscellaneous driver fixes Dimitri Daskalakis
2026-11-16 20:29 ` [PATCH net 1/4] eth: fbnic: wait on the correct queues in fbnic_queue_stop() Dimitri Daskalakis
2026-11-18 14:32 ` netdev-bot+sashiko [this message]
2026-11-16 20:29 ` [PATCH net 2/4] eth: fbnic: skip disabled Tx rings when setting the queue NAPI Dimitri Daskalakis
2026-11-16 20:29 ` [PATCH net 3/4] eth: fbnic: skip freed Tx rings in fbnic_get_ts_stats() Dimitri Daskalakis
2026-11-16 20:29 ` [PATCH net 4/4] selftests: drv-net: stats: query timestamping stats while down Dimitri Daskalakis
2026-11-16 22:51 ` Jakub Kicinski
2026-11-16 23:12 ` Dimitri Daskalakis
2026-11-18 14:32 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179501233405.3136.1951462935602133003@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=alexanderduyck@fb.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@kernel.org \
--cc=bobbyeshleman@meta.com \
--cc=daskald@meta.com \
--cc=davem@davemloft.net \
--cc=dimitri.daskalakis1@gmail.com \
--cc=edumazet@kernel.org \
--cc=hmohsin@meta.com \
--cc=horms@kernel.org \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=mike.marciniszyn@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=vadim.fedorenko@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox