Skip to content

Commit 27640ce

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Fix completion ring sizing with TPA enabled.
The current completion ring sizing formula is wrong with TPA enabled. The formula assumes that the number of TPA completions are bound by the RX ring size, but that's not true. TPA_START completions are immediately recycled so they are not bound by the RX ring size. We must add bp->max_tpa to the worst case maximum RX and TPA completions. The completion ring can overflow because of this mistake. This will cause hardware to disable the completion ring when this happens, leading to RX and TX traffic to stall on that ring. This issue is generally exposed only when the RX ring size is set very small. Fix the formula by adding bp->max_tpa to the number of RX completions if TPA is enabled. Fixes: c0c050c ("bnxt_en: New Broadcom ethernet driver."); Reviewed-by: Vasundhara Volam <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ca0c753 commit 27640ce

File tree

1 file changed

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

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,7 +3418,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp)
34183418
*/
34193419
void bnxt_set_ring_params(struct bnxt *bp)
34203420
{
3421-
u32 ring_size, rx_size, rx_space;
3421+
u32 ring_size, rx_size, rx_space, max_rx_cmpl;
34223422
u32 agg_factor = 0, agg_ring_size = 0;
34233423

34243424
/* 8 for CRC and VLAN */
@@ -3474,7 +3474,15 @@ void bnxt_set_ring_params(struct bnxt *bp)
34743474
bp->tx_nr_pages = bnxt_calc_nr_ring_pages(ring_size, TX_DESC_CNT);
34753475
bp->tx_ring_mask = (bp->tx_nr_pages * TX_DESC_CNT) - 1;
34763476

3477-
ring_size = bp->rx_ring_size * (2 + agg_factor) + bp->tx_ring_size;
3477+
max_rx_cmpl = bp->rx_ring_size;
3478+
/* MAX TPA needs to be added because TPA_START completions are
3479+
* immediately recycled, so the TPA completions are not bound by
3480+
* the RX ring size.
3481+
*/
3482+
if (bp->flags & BNXT_FLAG_TPA)
3483+
max_rx_cmpl += bp->max_tpa;
3484+
/* RX and TPA completions are 32-byte, all others are 16-byte */
3485+
ring_size = max_rx_cmpl * 2 + agg_ring_size + bp->tx_ring_size;
34783486
bp->cp_ring_size = ring_size;
34793487

34803488
bp->cp_nr_pages = bnxt_calc_nr_ring_pages(ring_size, CP_DESC_CNT);

0 commit comments

Comments
 (0)