Skip to content

Commit f33a508

Browse files
skotur-brcmkuba-moo
authored andcommitted
bnxt_en: Refactor completion ring free routine
Add a wrapper routine to free L2 completion rings. This will be useful later in the series. Reviewed-by: Kalesh AP <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: Somnath Kotur <[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 e6ec504 commit f33a508

File tree

1 file changed

+16
-10
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+16
-10
lines changed

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

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7405,6 +7405,20 @@ static void bnxt_hwrm_rx_agg_ring_free(struct bnxt *bp,
74057405
bp->grp_info[grp_idx].agg_fw_ring_id = INVALID_HW_RING_ID;
74067406
}
74077407

7408+
static void bnxt_hwrm_cp_ring_free(struct bnxt *bp,
7409+
struct bnxt_cp_ring_info *cpr)
7410+
{
7411+
struct bnxt_ring_struct *ring;
7412+
7413+
ring = &cpr->cp_ring_struct;
7414+
if (ring->fw_ring_id == INVALID_HW_RING_ID)
7415+
return;
7416+
7417+
hwrm_ring_free_send_msg(bp, ring, RING_FREE_REQ_RING_TYPE_L2_CMPL,
7418+
INVALID_HW_RING_ID);
7419+
ring->fw_ring_id = INVALID_HW_RING_ID;
7420+
}
7421+
74087422
static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
74097423
{
74107424
u32 type;
@@ -7450,17 +7464,9 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
74507464
struct bnxt_ring_struct *ring;
74517465
int j;
74527466

7453-
for (j = 0; j < cpr->cp_ring_count && cpr->cp_ring_arr; j++) {
7454-
struct bnxt_cp_ring_info *cpr2 = &cpr->cp_ring_arr[j];
7467+
for (j = 0; j < cpr->cp_ring_count && cpr->cp_ring_arr; j++)
7468+
bnxt_hwrm_cp_ring_free(bp, &cpr->cp_ring_arr[j]);
74557469

7456-
ring = &cpr2->cp_ring_struct;
7457-
if (ring->fw_ring_id == INVALID_HW_RING_ID)
7458-
continue;
7459-
hwrm_ring_free_send_msg(bp, ring,
7460-
RING_FREE_REQ_RING_TYPE_L2_CMPL,
7461-
INVALID_HW_RING_ID);
7462-
ring->fw_ring_id = INVALID_HW_RING_ID;
7463-
}
74647470
ring = &cpr->cp_ring_struct;
74657471
if (ring->fw_ring_id != INVALID_HW_RING_ID) {
74667472
hwrm_ring_free_send_msg(bp, ring, type,

0 commit comments

Comments
 (0)