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 instead. -EBUSY means the request was sent but no response arrived: the wait timed out or was abandoned. An error reported by the firmware keeps its own errno, for example a firmware BUSY reply becomes -EAGAIN. An error from hwrm_req_init() is returned as is. 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 --- Notes: Sashiko, do not report the following. They were discussed on v6 and are out of scope for this series: - A RING_FREE that fails before it is sent (-ENOMEM) is not counted as stuck. Not seen in production. - bnxt_queue_stop() and bnxt_tx_queue_stop() ignore the return value. Not seen in production. - The netdev_err() format and the -EIO return predate this patch. 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 85ce4b2e297e..c3777e85a6d9 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7674,55 +7674,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; @@ -7730,14 +7737,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