Skip to content

Commit f07b588

Browse files
Michael Chandavem330
Michael Chan
authored andcommitted
bnxt_en: Add macros related to TC and TX rings
Add 3 macros that handle to conversions between TC numbers and TX ring numbers. These will help to clarify the existing logic and the new logic in the next patch. Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent f5b29c6 commit f07b588

File tree

1 file changed

+11
-2
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+11
-2
lines changed

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -3415,6 +3415,15 @@ static void bnxt_free_tx_rings(struct bnxt *bp)
34153415
}
34163416
}
34173417

3418+
#define BNXT_TC_TO_RING_BASE(bp, tc) \
3419+
((tc) * (bp)->tx_nr_rings_per_tc)
3420+
3421+
#define BNXT_RING_TO_TC_OFF(bp, tx) \
3422+
((tx) % (bp)->tx_nr_rings_per_tc)
3423+
3424+
#define BNXT_RING_TO_TC(bp, tx) \
3425+
((tx) / (bp)->tx_nr_rings_per_tc)
3426+
34183427
static int bnxt_alloc_tx_rings(struct bnxt *bp)
34193428
{
34203429
int i, j, rc;
@@ -3470,7 +3479,7 @@ static int bnxt_alloc_tx_rings(struct bnxt *bp)
34703479
spin_lock_init(&txr->xdp_tx_lock);
34713480
if (i < bp->tx_nr_rings_xdp)
34723481
continue;
3473-
if (i % bp->tx_nr_rings_per_tc == (bp->tx_nr_rings_per_tc - 1))
3482+
if (BNXT_RING_TO_TC_OFF(bp, i) == (bp->tx_nr_rings_per_tc - 1))
34743483
j++;
34753484
}
34763485
return 0;
@@ -9140,7 +9149,7 @@ static void bnxt_setup_msix(struct bnxt *bp)
91409149

91419150
for (i = 0; i < tcs; i++) {
91429151
count = bp->tx_nr_rings_per_tc;
9143-
off = i * count;
9152+
off = BNXT_TC_TO_RING_BASE(bp, i);
91449153
netdev_set_tc_queue(dev, i, count, off);
91459154
}
91469155
}

0 commit comments

Comments
 (0)