Skip to content

Commit e6ec504

Browse files
Michael Chankuba-moo
authored andcommitted
bnxt_en: Refactor TX ring allocation logic
Add a new bnxt_hwrm_tx_ring_alloc() function to handle allocating a transmit ring. This will be useful later in the series. Reviewed-by: Ajit Khaparde <[email protected]> Reviewed-by: Michal Swiatkowski <[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 0fed290 commit e6ec504

File tree

1 file changed

+15
-7
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7218,6 +7218,20 @@ static int bnxt_hwrm_cp_ring_alloc_p5(struct bnxt *bp,
72187218
return 0;
72197219
}
72207220

7221+
static int bnxt_hwrm_tx_ring_alloc(struct bnxt *bp,
7222+
struct bnxt_tx_ring_info *txr, u32 tx_idx)
7223+
{
7224+
struct bnxt_ring_struct *ring = &txr->tx_ring_struct;
7225+
const u32 type = HWRM_RING_ALLOC_TX;
7226+
int rc;
7227+
7228+
rc = hwrm_ring_alloc_send_msg(bp, ring, type, tx_idx);
7229+
if (rc)
7230+
return rc;
7231+
bnxt_set_db(bp, &txr->tx_db, type, tx_idx, ring->fw_ring_id);
7232+
return 0;
7233+
}
7234+
72217235
static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
72227236
{
72237237
bool agg_rings = !!(bp->flags & BNXT_FLAG_AGG_RINGS);
@@ -7254,23 +7268,17 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
72547268
}
72557269
}
72567270

7257-
type = HWRM_RING_ALLOC_TX;
72587271
for (i = 0; i < bp->tx_nr_rings; i++) {
72597272
struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
7260-
struct bnxt_ring_struct *ring;
7261-
u32 map_idx;
72627273

72637274
if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) {
72647275
rc = bnxt_hwrm_cp_ring_alloc_p5(bp, txr->tx_cpr);
72657276
if (rc)
72667277
goto err_out;
72677278
}
7268-
ring = &txr->tx_ring_struct;
7269-
map_idx = i;
7270-
rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx);
7279+
rc = bnxt_hwrm_tx_ring_alloc(bp, txr, i);
72717280
if (rc)
72727281
goto err_out;
7273-
bnxt_set_db(bp, &txr->tx_db, type, map_idx, ring->fw_ring_id);
72747282
}
72757283

72767284
for (i = 0; i < bp->rx_nr_rings; i++) {

0 commit comments

Comments
 (0)