Netdev List
 help / color / mirror / Atom feed
From: Joe Damato <joe@dama.to>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, michael.chan@broadcom.com,
	pavan.chebbi@broadcom.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, prashant@broadcom.com, edumazet@google.com,
	horms@kernel.org, selvin.xavier@broadcom.com,
	kalesh-anakkur.purayil@broadcom.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v6 1/5] bnxt_en: return the RING_FREE status to callers
Date: Mon, 23 Nov 2026 13:18:11 -0800	[thread overview]
Message-ID: <awStk4gPo+BvDDuQ@devvm20253.cco0.facebook.com> (raw)
In-Reply-To: <179545865792.3135.13782875077253506018@kernel.org>

On Mon, Nov 23, 2026 at 06:30:57PM +0000, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 (1) · Medium: 1 · Low: 2
> 
> 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] The commit message describes an errno contract that
>   hwrm_ring_free_send_msg() (drivers/net/ethernet/broadcom/bnxt/bnxt.c)…
> - [Low] The commit message says 'No caller acts on it yet, so there is no
>   functional change' but still carries `Fixes: 74608fc98d28`.
> - [Low] In hwrm_ring_free_send_msg()
>   (drivers/net/ethernet/broadcom/bnxt/bnxt.c), the `return -EIO;` left…
> 
> Pre-existing issues:
> - [High] This problem wasn't introduced by this patch, but it is still
>   present at the end of the series.
> 
> --
> 
> bnxt_en: return the RING_FREE status to callers
> 
> This patch makes hwrm_ring_free_send_msg() pass up the errno from the HWRM
> layer on failure. Before, it always returned -EIO. It also changes
> bnxt_hwrm_tx_ring_free(), bnxt_hwrm_rx_ring_free() and
> bnxt_hwrm_rx_agg_ring_free() to return that status, though no caller uses
> it yet.
> 
> > No caller acts on it yet, so there is no functional change.
> >
> > Fixes: 74608fc98d28 ("bnxt_en: Ring free response from close path should use completion ring")
> 
> [Severity: Low]
> This isn't a bug, but is the Fixes tag meant to be here? The commit message
> says there is no functional change. At this commit, every caller of the TX,
> RX and AGG helpers still ignores the return value.
> 
> Later patches in the series carry the same Fixes tag and depend on these
> return values, for example "bnxt_en: stop DMA before releasing rings the
> firmware did not free". If the tag is there so stable takes this patch
> together with them, could the commit message say so?

The fixed tag belongs there, yea, and I think it being there already explains
to stable what the situation is. So, I'm going to pass on this feedback.

> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > index e78cf7ad3cbc8..c3413354e7582 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> > @@ -7673,55 +7673,62 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
> >  	if (rc || error_code) {
> >  		netdev_err(bp->dev, "hwrm_ring_free type %d failed. rc:%x err:%x\n",
> >  			   ring_type, rc, error_code);
> > +		if (rc)
> > +			return rc;
> 
> [Severity: Medium]
> Does the errno returned here match what the commit message describes? The
> message says:
> 
>     Return the errno from hwrm_req_send() instead. -EBUSY means no response
>     arrived: the wait timed out, was abandoned, or the firmware channel is
>     down.
> 
> If the channel is already down, the request never reaches __hwrm_send(),
> because hwrm_ring_free_send_msg() returns success first:

Yes, you are correct that the commit message could be adjusted. If there is a
v7, I will fix the commit message but I am not sure it is worth respinning
this if only the commit message is slightly imprecise.
 
> 	if (BNXT_NO_FW_ACCESS(bp))
> 		return 0;
> 
> So the only channel-down case that comes back as -EBUSY is a FW_FATAL_COND
> that gets set during the wait.
> 
> Some cases where RING_FREE never reaches firmware return -ENOMEM, not
> -EBUSY. The first is hwrm_req_init() failing in __hwrm_req_init():
> 
> 	req_addr = dma_pool_alloc(bp->hwrm_dma_pool, GFP_KERNEL | __GFP_ZERO,
> 				  &dma_handle);
> 	if (!req_addr)
> 		return -ENOMEM;
> 
> The second is __hwrm_send() failing before it sends anything:
> 
> 	token = __hwrm_acquire_token(bp, dst);
> 	if (!token) {
> 		rc = -ENOMEM;
> 		goto exit;
> 	}
> 
> __hwrm_to_stderr() also maps a firmware HWRM_ERR_CODE_NO_BUFFER reply to
> -ENOMEM. A caller therefore can't tell "never sent" from "firmware
> rejected" for that errno. Also, the hwrm_req_init() error is returned here
> as well, not only the errno from hwrm_req_send().
> 
> Later in the series, bnxt_hwrm_ring_free() counts a ring as stuck only
> when the helper returns -EBUSY:
> 
> 	if (bnxt_hwrm_tx_ring_free(bp, &bp->tx_ring[i], close_path) == -EBUSY)
> 		stuck++;
> 
> On the -ENOMEM path, would the ring then be released through
> bnxt_free_mem() without bnxt_stop_dma()? Firmware never got the RING_FREE
> and still owns the ring. The path would be:
> 
> __bnxt_close_nic()->bnxt_shutdown_nic()->bnxt_hwrm_resource_free()->
>   bnxt_hwrm_ring_free()->bnxt_hwrm_tx_ring_free()->
>     hwrm_ring_free_send_msg()->hwrm_req_init() returns -ENOMEM

Yea, I don't buy this one.

This would need a small allocation to fail on the close path. The driver
already released the ring in that case before this series, so nothing gets
worse with this change.

Every RING_FREE failure in the production logs from the cover letter was a
no-response (rc:fffffff0, -EBUSY).

That is the case this series handles.

> >  		return -EIO;
> 
> [Severity: Low]
> Can this return -EIO still be reached?

Probably not, but leaving it is harmless.

> This isn't a bug, but rc is now the errno handed to callers, and the
> netdev_err() above prints it as rc:%x (for example rc:fffffff0). Would %d
> be clearer? The %x format predates this patch. After a timeout or abandon,
> the err:%x value also comes from a response buffer that firmware never
> wrote.

The response buffer is zeroed before the request is sent, so err reads 0 in
that case. That matches the logs (err:0).

> >  	}
> >  	return 0;
> >  }
> 
> [ ... ]
> 
> > -static void bnxt_hwrm_rx_ring_free(struct bnxt *bp,
> > -				   struct bnxt_rx_ring_info *rxr,
> > -				   bool close_path)
> > +static int bnxt_hwrm_rx_ring_free(struct bnxt *bp,
> > +				  struct bnxt_rx_ring_info *rxr,
> > +				  bool close_path)
> >  {
> 
> [ ... ]
> 
> > -	hwrm_ring_free_send_msg(bp, ring,
> > -				RING_FREE_REQ_RING_TYPE_RX,
> > -				close_path ? cmpl_ring_id :
> > -				INVALID_HW_RING_ID);
> > +	rc = hwrm_ring_free_send_msg(bp, ring,
> > +				     RING_FREE_REQ_RING_TYPE_RX,
> > +				     close_path ? cmpl_ring_id :
> > +				     INVALID_HW_RING_ID);
> >  	ring->fw_ring_id = INVALID_HW_RING_ID;
> >  	bp->grp_info[grp_idx].rx_fw_ring_id = INVALID_HW_RING_ID;
> > +	return rc;
> >  }
> 
> [Severity: High]
> This is a pre-existing issue that this patch did not introduce, but it is
> still there at the end of the series.
> 
> bnxt_hwrm_tx_ring_free(), bnxt_hwrm_rx_ring_free() and
> bnxt_hwrm_rx_agg_ring_free() clear fw_ring_id on every path. The RX and AGG
> helpers also clear the grp_info rx_fw_ring_id and agg_fw_ring_id. The queue
> management callers ignore the status these helpers now return.
> 
> bnxt_queue_stop() does:
> 
> 	bnxt_hwrm_rx_ring_free(bp, rxr, false);
> 	bnxt_hwrm_rx_agg_ring_free(bp, rxr, false);
> 	page_pool_disable_direct_recycling(rxr->page_pool);
> 
> It then hands the old ring and page pool to qmem, and ndo_queue_mem_free
> frees them later.
> 
> bnxt_tx_queue_stop() does:
> 
> 	bnxt_hwrm_tx_ring_free(bp, txr, true);
> 	bnxt_hwrm_cp_ring_free(bp, txr->tx_cpr);
> 	bnxt_free_one_tx_ring_skbs(bp, txr, txr->txq_index);
> 
> This unmaps and frees the TX buffers right after an -EBUSY that nobody
> checks.
> 
> If firmware doesn't answer RING_FREE here, can the device keep writing into
> freed RX pages, or keep reading from unmapped TX buffers?
> 
> The close path log in this series shows firmware can keep doing DMA after
> an unanswered RING_FREE (AMD-Vi IO_PAGE_FAULT). However, only the close,
> half-close and init-error paths through bnxt_hwrm_ring_free() were changed
> to stop DMA.
> 
> The RX side is reachable through netdev_rx_queue_restart()->
> bnxt_queue_stop(), for example from the TPH IRQ affinity notifier or from
> binding a devmem or io_uring zcrx queue. The TX side is reachable through
> bnxt_tx_queue_stop() when BNXT_FLAG_SHARED_RINGS or tph_mode is set.
> 

The above is the first item in the "leaving out" section of the cover letter.
It is a real proble, but I haven't seen it in production. Every failure I've
seen was on the close path.

I think fixing the paths mentioned above are a separate series from this one
which addresses an issue I observed.

  reply	other threads:[~2026-11-23 21:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:28 [PATCH net v6 0/5] bnxt_en: Make RING FREE more robust Joe Damato
2026-11-20 15:28 ` [PATCH net v6 1/5] bnxt_en: return the RING_FREE status to callers Joe Damato
2026-11-23 18:30   ` netdev-bot+sashiko
2026-11-23 21:18     ` Joe Damato [this message]
2026-11-20 15:28 ` [PATCH net v6 2/5] bnxt_en: check HWRM response if completion never arrives Joe Damato
2026-11-23 18:30   ` netdev-bot+sashiko
2026-11-20 15:28 ` [PATCH net v6 3/5] bnxt_en: stop DMA before releasing rings the firmware did not free Joe Damato
2026-11-23 18:31   ` netdev-bot+sashiko
2026-11-20 15:28 ` [PATCH net v6 4/5] bnxt_en: refuse to open a device with stopped DMA Joe Damato
2026-11-23 18:31   ` netdev-bot+sashiko
2026-11-20 15:28 ` [PATCH net v6 5/5] bnxt_en: stop the ULP around the reset task Joe Damato
2026-11-23 18:31   ` 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=awStk4gPo+BvDDuQ@devvm20253.cco0.facebook.com \
    --to=joe@dama.to \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=prashant@broadcom.com \
    --cc=selvin.xavier@broadcom.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