Skip to content

Commit e4afed6

Browse files
author
Shruti Parab
committed
bnxt_en: Refactor TX ring free logic
JIRA: https://issues.redhat.com/browse/RHEL-76565 commit c8a0f76 Author: Michael Chan <michael.chan@broadcom.com> Date: Wed Feb 12 17:12:37 2025 -0800 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 <ajit.khaparde@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Link: https://patch.msgid.link/20250213011240.1640031-10-michael.chan@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Shruti Parab <shruti.parab@broadcom.com>
1 parent e3c24a2 commit e4afed6

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
@@ -7348,6 +7348,23 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
73487348
return 0;
73497349
}
73507350

7351+
static void bnxt_hwrm_tx_ring_free(struct bnxt *bp,
7352+
struct bnxt_tx_ring_info *txr,
7353+
bool close_path)
7354+
{
7355+
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
7356+
u32 cmpl_ring_id;
7357+
7358+
if (ring->fw_ring_id == INVALID_HW_RING_ID)
7359+
return;
7360+
7361+
cmpl_ring_id = close_path ? bnxt_cp_ring_for_tx(bp, txr) :
7362+
INVALID_HW_RING_ID;
7363+
hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_TX,
7364+
cmpl_ring_id);
7365+
ring->fw_ring_id = INVALID_HW_RING_ID;
7366+
}
7367+
73517368
static void bnxt_hwrm_rx_ring_free(struct bnxt *bp,
73527369
struct bnxt_rx_ring_info *rxr,
73537370
bool close_path)
@@ -7427,20 +7444,8 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
74277444
if (!bp->bnapi)
74287445
return;
74297446

7430-
for (i = 0; i < bp->tx_nr_rings; i++) {
7431-
struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
7432-
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
7433-
7434-
if (ring->fw_ring_id != INVALID_HW_RING_ID) {
7435-
u32 cmpl_ring_id = bnxt_cp_ring_for_tx(bp, txr);
7436-
7437-
hwrm_ring_free_send_msg(bp, ring,
7438-
RING_FREE_REQ_RING_TYPE_TX,
7439-
close_path ? cmpl_ring_id :
7440-
INVALID_HW_RING_ID);
7441-
ring->fw_ring_id = INVALID_HW_RING_ID;
7442-
}
7443-
}
7447+
for (i = 0; i < bp->tx_nr_rings; i++)
7448+
bnxt_hwrm_tx_ring_free(bp, &bp->tx_ring[i], close_path);
74447449

74457450
bnxt_cancel_dim(bp);
74467451
for (i = 0; i < bp->rx_nr_rings; i++) {

0 commit comments

Comments
 (0)