Netdev List
 help / color / mirror / Atom feed
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, willemb@google.com, horms@kernel.org,
	bjorn@kernel.org, bobbyeshleman@meta.com, almasrymina@google.com,
	daskald@meta.com, netdev@vger.kernel.org
Subject: Re: [PATCH net 1/4] eth: fbnic: restart queues in place when fbnic_queue_stop() fails
Date: Tue, 24 Nov 2026 12:33:42 +0000	[thread overview]
Message-ID: <179552362260.3135.14543564146944003534@kernel.org> (raw)
In-Reply-To: <20261121033215.1020506-2-dimitri.daskalakis1@gmail.com>

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] fbnic_queue_stop()'s new error path relies on a hardware
  guarantee that is never written down or checked.

--

eth: fbnic: restart queues in place when fbnic_queue_stop() fails

When the idle wait in fbnic_queue_stop() times out, this patch no longer
runs fbnic_nv_enable() and fbnic_nv_fill() on the error path. A new
helper, fbnic_nv_reenable(), sets the ring enable bits back without
resetting anything, so the hardware and the driver's ring state resume
in place. The fbnic_nv_enable()/fbnic_nv_fill() calls move from
__fbnic_nv_restart() into fbnic_queue_start().

> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> index 381831b7e1080..c0fe89425430d 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> @@ -2326,6 +2326,50 @@ fbnic_nv_disable(struct fbnic_net *fbn, struct fbnic_napi_vector *nv)

[ ... ]

> +static void
> +fbnic_nv_reenable(struct fbnic_net *fbn, struct fbnic_napi_vector *nv)
> +{
> +	int j, t;
> +
> +	for (t = 0; t < nv->txt_count; t++) {
> +		struct fbnic_q_triad *qt = &nv->qt[t];
> +
> +		if (qt->cmpl.size_mask) {
> +			fbnic_ring_wr32(&qt->cmpl, FBNIC_QUEUE_TIM_MASK, 0);
> +			fbnic_ring_wr32(&qt->cmpl, FBNIC_QUEUE_TCQ_CTL,
> +					FBNIC_QUEUE_TCQ_CTL_ENABLE);
> +		}
> +		fbnic_reenable_twq(&qt->sub1, FBNIC_QUEUE_TWQ1_CTL);
> +		fbnic_reenable_twq(&qt->sub0, FBNIC_QUEUE_TWQ0_CTL);
> +	}
> +
> +	for (j = 0; j < nv->rxt_count; j++, t++) {
> +		struct fbnic_q_triad *qt = &nv->qt[t];
> +		u32 bdq_ctl;
> +
> +		fbnic_ring_wr32(&qt->cmpl, FBNIC_QUEUE_RIM_MASK, 0);
> +		fbnic_ring_wr32(&qt->cmpl, FBNIC_QUEUE_RCQ_CTL,
> +				FBNIC_QUEUE_RCQ_CTL_ENABLE);

[Severity: Medium]
Does this in-place resume rely on hardware behavior that is not
documented or checked anywhere?

The driver keeps all of its ring state across the disable/enable toggle.
That includes head/tail, the TCQ deferred_head, the TWQ0 deferred_meta,
and the partly built Rx frame in qt->cmpl.pkt.

For that state to stay correct, two things have to be true:

  - The device keeps its internal ring pointers and frame-assembly state
    when ENABLE goes 1->0->1 with no RESET.
  - Completion writes that were in flight when the CQ was disabled are
    held back or finished, not dropped.

Nothing on the disable side seems to ensure the second point.
__fbnic_nv_disable() turns off the CQs in the same burst as the
WQs/BDQs, without waiting for the upstream queue to drain:

fbnic_disable_tcq():
	fbnic_ring_wr32(txr, FBNIC_QUEUE_TCQ_CTL, 0);

fbnic_disable_rcq():
	fbnic_ring_wr32(rxr, FBNIC_QUEUE_RCQ_CTL, 0);

Also, err_restart in fbnic_queue_stop() is only reached when an idle bit
did not assert before fbnic_wait_queue_idle() timed out. That is when
the device is most likely in the middle of a descriptor or a frame.

On Rx, fbnic_clean_rcq() picks up from pkt = rcq->pkt. Suppose the RDE
had written the HDR_AL/PAY_AL completions for a frame, but its META
completion was lost while the RCQ was disabled. Would the next frame's
PAY_AL frags then be appended to the stale pkt?

The next frame's HDR_AL would also hit this check in fbnic_pkt_prepare():

	WARN_ON_ONCE(pkt->buff.data_hard_start);

pkt would then be overwritten, leaking the old page references.

On Tx, the cumulative head in the TCDs makes this partly self-healing.
Even so, could the Tx buffers, DMA mappings and BQL bytes stay stuck
until another completion arrives?

The commit message says the HW "resumes from where it stopped". However,
fbnic_csr.h only defines RESET and ENABLE for these CTL registers.

The injected tests cover "HW is idled, but waiting for queues to idle
fails" and "HW never stops (rings left enabled, and wait skipped)".
Neither covers a CQ that was disabled while a completion was actually in
flight.

Could this behavior be confirmed against the hardware documentation and
described in a comment? If that is not possible, other options would be
to disable the CQs only after the WQs/BDQs have gone idle, or to drop
the partial qt->cmpl.pkt state before resuming.

The later patches in this series ("net: add netif_disable_subqueue()",
"eth: fbnic: wait for in-flight xmit in fbnic_queue_stop()" and "eth:
fbnic: wait for both TWQs of a Tx queue to go idle") do not seem to
change fbnic_nv_reenable() or the disable ordering.

> +
> +		bdq_ctl = fbnic_ring_rd32(&qt->sub0, FBNIC_QUEUE_BDQ_CTL);
> +		fbnic_ring_wr32(&qt->sub0, FBNIC_QUEUE_BDQ_CTL,
> +				bdq_ctl | FBNIC_QUEUE_BDQ_CTL_ENABLE);
> +	}
> +
> +	fbnic_wrfl(fbn->fbd);
> +}

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261121033215.1020506-1-dimitri.daskalakis1%40gmail.com

  reply	other threads:[~2026-11-24 12:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21  3:32 [PATCH net 0/4] eth: fbnic: queue stop fixes Dimitri Daskalakis
2026-11-21  3:32 ` [PATCH net 1/4] eth: fbnic: restart queues in place when fbnic_queue_stop() fails Dimitri Daskalakis
2026-11-24 12:33   ` netdev-bot+sashiko [this message]
2026-11-21  3:32 ` [PATCH net 2/4] net: add netif_disable_subqueue() Dimitri Daskalakis
2026-11-24 12:33   ` netdev-bot+sashiko
2026-11-21  3:32 ` [PATCH net 3/4] eth: fbnic: wait for in-flight xmit in fbnic_queue_stop() Dimitri Daskalakis
2026-11-21  3:32 ` [PATCH net 4/4] eth: fbnic: wait for both TWQs of a Tx queue to go idle Dimitri Daskalakis

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=179552362260.3135.14543564146944003534@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=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemb@google.com \
    /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