Skip to content

Commit e8f267b

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Improve RX doorbell sequence.
When both RX buffers and RX aggregation buffers have to be replenished at the end of NAPI, post the RX aggregation buffers first before RX buffers. Otherwise, we may run into a situation where there are only RX buffers without RX aggregation buffers for a split second. This will cause the hardware to abort the RX packet and report buffer errors, which will cause unnecessary cleanup by the driver. Ringing the Aggregation ring doorbell first before the RX ring doorbell will prevent some of these buffer errors. Use the same sequence during ring initialization as well. Fixes: 697197e ("bnxt_en: Re-structure doorbells.") Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a46ecb1 commit e8f267b

File tree

1 file changed

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

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,9 +2021,9 @@ static void __bnxt_poll_work_done(struct bnxt *bp, struct bnxt_napi *bnapi)
20212021
if (bnapi->events & BNXT_RX_EVENT) {
20222022
struct bnxt_rx_ring_info *rxr = bnapi->rx_ring;
20232023

2024-
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
20252024
if (bnapi->events & BNXT_AGG_EVENT)
20262025
bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
2026+
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
20272027
}
20282028
bnapi->events = 0;
20292029
}
@@ -5064,6 +5064,7 @@ static void bnxt_set_db(struct bnxt *bp, struct bnxt_db_info *db, u32 ring_type,
50645064

50655065
static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
50665066
{
5067+
bool agg_rings = !!(bp->flags & BNXT_FLAG_AGG_RINGS);
50675068
int i, rc = 0;
50685069
u32 type;
50695070

@@ -5139,7 +5140,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
51395140
if (rc)
51405141
goto err_out;
51415142
bnxt_set_db(bp, &rxr->rx_db, type, map_idx, ring->fw_ring_id);
5142-
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
5143+
/* If we have agg rings, post agg buffers first. */
5144+
if (!agg_rings)
5145+
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
51435146
bp->grp_info[map_idx].rx_fw_ring_id = ring->fw_ring_id;
51445147
if (bp->flags & BNXT_FLAG_CHIP_P5) {
51455148
struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
@@ -5158,7 +5161,7 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
51585161
}
51595162
}
51605163

5161-
if (bp->flags & BNXT_FLAG_AGG_RINGS) {
5164+
if (agg_rings) {
51625165
type = HWRM_RING_ALLOC_AGG;
51635166
for (i = 0; i < bp->rx_nr_rings; i++) {
51645167
struct bnxt_rx_ring_info *rxr = &bp->rx_ring[i];
@@ -5174,6 +5177,7 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
51745177
bnxt_set_db(bp, &rxr->rx_agg_db, type, map_idx,
51755178
ring->fw_ring_id);
51765179
bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
5180+
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
51775181
bp->grp_info[grp_idx].agg_fw_ring_id = ring->fw_ring_id;
51785182
}
51795183
}

0 commit comments

Comments
 (0)