Skip to content

Commit c8a0f76

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Refactor TX ring free logic
Add a new bnxt_hwrm_tx_ring_free() function to handle freeing a HW transmit ring. The new function will also be used in the next patch to free the TX ring in queue_stop. Reviewed-by: Ajit Khaparde <[email protected]> Signed-off-by: Michael Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 6b6bf60 commit c8a0f76

File tree

1 file changed

+19
-14
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+19
-14
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7368,6 +7368,23 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
73687368
return 0;
73697369
}
73707370

7371+
static void bnxt_hwrm_tx_ring_free(struct bnxt *bp,
7372+
struct bnxt_tx_ring_info *txr,
7373+
bool close_path)
7374+
{
7375+
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
7376+
u32 cmpl_ring_id;
7377+
7378+
if (ring->fw_ring_id == INVALID_HW_RING_ID)
7379+
return;
7380+
7381+
cmpl_ring_id = close_path ? bnxt_cp_ring_for_tx(bp, txr) :
7382+
INVALID_HW_RING_ID;
7383+
hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
7384+
cmpl_ring_id);
7385+
ring->fw_ring_id = INVALID_HW_RING_ID;
7386+
}
7387+
73717388
static void bnxt_hwrm_rx_ring_free(struct bnxt *bp,
73727389
struct bnxt_rx_ring_info *rxr,
73737390
bool close_path)
@@ -7447,20 +7464,8 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
74477464
if (!bp->bnapi)
74487465
return;
74497466

7450-
for (i = 0; i < bp->tx_nr_rings; i++) {
7451-
struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
7452-
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
7453-
7454-
if (ring->fw_ring_id != INVALID_HW_RING_ID) {
7455-
u32 cmpl_ring_id = bnxt_cp_ring_for_tx(bp, txr);
7456-
7457-
hwrm_ring_free_send_msg(bp, ring,
7458-
RING_FREE_REQ_RING_TYPE_TX,
7459-
close_path ? cmpl_ring_id :
7460-
INVALID_HW_RING_ID);
7461-
ring->fw_ring_id = INVALID_HW_RING_ID;
7462-
}
7463-
}
7467+
for (i = 0; i < bp->tx_nr_rings; i++)
7468+
bnxt_hwrm_tx_ring_free(bp, &bp->tx_ring[i], close_path);
74647469

74657470
bnxt_cancel_dim(bp);
74667471
for (i = 0; i < bp->rx_nr_rings; i++) {

0 commit comments

Comments
 (0)