Re: [PATCH net v6 2/5] bnxt_en: check HWRM response if completion never arrives
From: Paolo Abeni
Date: Thu Nov 26 2026 - 06:18:33 EST
On 11/23/26 23:43, Joe Damato wrote:
On Mon, Nov 23, 2026 at 06:30:59PM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:@Pavan, @Michael: there are pending question for you here and elsewhere
Thank you for your contribution! Sashiko AI review found 1 potential
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
index de02d1baa7514..53667c0c38aaf 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c
@@ -582,11 +582,50 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx)
[ ... ]
+ /* The completion was not delivered, but the firmware
+ * may still have freed the ring. Check the response
+ * before giving up and log the state.
+ */
+ resp_seq_id = READ_ONCE(ctx->resp->seq_id);
+ len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
+ if (len && resp_seq_id == ctx->req->seq_id)
+ valid_byte = READ_ONCE(*((u8 *)ctx->resp + len - 1));
+
+ if (!valid_byte) {
+ hwrm_err(bp, ctx,
+ "Resp cmpl intr err msg: 0x%x len:%d seq:0x%x/0x%x\n",
+ req_type, len,
+ le16_to_cpu(resp_seq_id),
+ le16_to_cpu(ctx->req->seq_id));
+ goto exit;
+ }
+
+ /* Read the rest of the response after the valid byte */
+ dma_rmb();
+ if (!(ctx->flags & BNXT_HWRM_CTX_SILENT))
+ netdev_warn(bp->dev,
+ "Resp cmpl intr not delivered, msg: 0x%x completed anyway (len:%d valid:0x%x err:0x%x)\n",
+ req_type, len, valid_byte,
+ le16_to_cpu(ctx->resp->error_code));
+ } else {
+ len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
}
- len = le16_to_cpu(READ_ONCE(ctx->resp->resp_len));
valid = ((u8 *)ctx->resp) + len - 1;
[Severity: Medium]
Is a set valid byte in ctx->resp enough to show that the ring is safe to
free?
The commit message calls this case one where "only the notification was
lost". But the commit in the Fixes: tag, 74608fc98d28, sent the
RING_FREE response to the completion ring so that the completion entry
itself would act as the fence:
"The response will be the last entry in the ring and we can free the
ring after getting the response. This will guarantee no spurious DMA
to freed memory."
The response buffer and the HWRM_DONE completion entry are two separate
device writes. Once token->state is BNXT_HWRM_COMPLETE, the existing
success path reads resp_len without waiting for the valid byte. That
suggests the response buffer is written before the completion entry.
So a set valid byte may not mean that the HWRM_DONE entry has landed. It
also may not mean that the TX/RX completions queued ahead of it on the
same ring have landed.
Agreed. The valid byte shows that the firmware finished HWRM_RING_FREE for
the TX/RX/AGG ring. It does not show that HWRM_DONE was posted to the
completion ring.
Michael, can you confirm that the firmware has stopped DMA for the ring
(other than completions to the completion ring) by the time it writes
the RING_FREE response?
If the response is written before the ring is quiesced, then this patch is
wrong.
in this series, please have a look.
If nobody answer in a few days we will have to toss the series.
@Joe: could the issues be caused by a broken firmware? in such a case
nothing would stop it from doing DMA at the bad time, right?
/P