[PATCH net v6 1/5] bnxt_en: return the RING_FREE status to callers

From: Joe Damato

Date: Fri Nov 20 2026 - 10:28:50 EST


hwrm_ring_free_send_msg() reports failure to its caller, but always as
-EIO, so a caller cannot tell whether the firmware rejected
HWRM_RING_FREE or never answered it. The TX, RX and AGG ring free
helpers discard the value.

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. An error reported by the firmware keeps its own errno, for example
a firmware BUSY reply becomes -EAGAIN. Return the value from the TX, RX
and AGG ring free helpers.

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")
Signed-off-by: Joe Damato <joe@xxxxxxx>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 50 +++++++++++++----------
1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index e78cf7ad3cbc..c3413354e758 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;
return -EIO;
}
return 0;
}

-static void bnxt_hwrm_tx_ring_free(struct bnxt *bp,
- struct bnxt_tx_ring_info *txr,
- bool close_path)
+static int bnxt_hwrm_tx_ring_free(struct bnxt *bp,
+ struct bnxt_tx_ring_info *txr,
+ bool close_path)
{
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
u32 cmpl_ring_id;
+ int rc;

if (ring->fw_ring_id == INVALID_HW_RING_ID)
- return;
+ return 0;

cmpl_ring_id = close_path ? bnxt_cp_ring_for_tx(bp, txr) :
INVALID_HW_RING_ID;
- hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
- cmpl_ring_id);
+ rc = hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
+ cmpl_ring_id);
ring->fw_ring_id = INVALID_HW_RING_ID;
+ return rc;
}

-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)
{
struct bnxt_ring_struct *ring = &rxr->rx_ring_struct;
u32 grp_idx = rxr->bnapi->index;
u32 cmpl_ring_id;
+ int rc;

if (ring->fw_ring_id == INVALID_HW_RING_ID)
- return;
+ return 0;

cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr);
- 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;
}

-static void bnxt_hwrm_rx_agg_ring_free(struct bnxt *bp,
- struct bnxt_rx_ring_info *rxr,
- bool close_path)
+static int bnxt_hwrm_rx_agg_ring_free(struct bnxt *bp,
+ struct bnxt_rx_ring_info *rxr,
+ bool close_path)
{
struct bnxt_ring_struct *ring = &rxr->rx_agg_ring_struct;
u32 grp_idx = rxr->bnapi->index;
u32 type, cmpl_ring_id;
+ int rc;

if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS)
type = RING_FREE_REQ_RING_TYPE_RX_AGG;
@@ -7729,14 +7736,15 @@ static void bnxt_hwrm_rx_agg_ring_free(struct bnxt *bp,
type = RING_FREE_REQ_RING_TYPE_RX;

if (ring->fw_ring_id == INVALID_HW_RING_ID)
- return;
+ return 0;

cmpl_ring_id = bnxt_cp_ring_for_rx(bp, rxr);
- hwrm_ring_free_send_msg(bp, ring, type,
- close_path ? cmpl_ring_id :
- INVALID_HW_RING_ID);
+ rc = hwrm_ring_free_send_msg(bp, ring, type,
+ close_path ? cmpl_ring_id :
+ INVALID_HW_RING_ID);
ring->fw_ring_id = INVALID_HW_RING_ID;
bp->grp_info[grp_idx].agg_fw_ring_id = INVALID_HW_RING_ID;
+ return rc;
}

static void bnxt_hwrm_cp_ring_free(struct bnxt *bp,
--
2.53.1-Meta