Skip to content

Commit 6b6bf60

Browse files
skotur-brcmkuba-moo
authored andcommitted
bnxt_en: Reallocate RX completion ring for TPH support
In order to program the correct Steering Tag during an IRQ affinity change, we need to free/re-allocate the RX completion ring during queue_restart. If TPH is enabled, call FW to free the Rx completion ring and clear the ring entries in queue_stop(). Re-allocate it in queue_start() if TPH is enabled. Note that TPH mode is not enabled in this patch and will be enabled later in the patch series. While modifying bnxt_queue_start(), remove the unnecessary zeroing of rxr->rx_next_cons. It gets overwritten by the clone in bnxt_queue_start(). Remove the rx_reset counter increment since restart is not reset. Add comment to clarify that the ring allocations in queue_start should never fail. 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 4c8e612 commit 6b6bf60

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7426,6 +7426,19 @@ static void bnxt_hwrm_cp_ring_free(struct bnxt *bp,
74267426
ring->fw_ring_id = INVALID_HW_RING_ID;
74277427
}
74287428

7429+
static void bnxt_clear_one_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
7430+
{
7431+
struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
7432+
int i, size = ring->ring_mem.page_size;
7433+
7434+
cpr->cp_raw_cons = 0;
7435+
cpr->toggle = 0;
7436+
7437+
for (i = 0; i < bp->cp_nr_pages; i++)
7438+
if (cpr->cp_desc_ring[i])
7439+
memset(cpr->cp_desc_ring[i], 0, size);
7440+
}
7441+
74297442
static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
74307443
{
74317444
u32 type;
@@ -15623,7 +15636,6 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1562315636
{
1562415637
struct bnxt *bp = netdev_priv(dev);
1562515638
struct bnxt_rx_ring_info *rxr, *clone;
15626-
struct bnxt_cp_ring_info *cpr;
1562715639
struct bnxt_vnic_info *vnic;
1562815640
int i, rc;
1562915641

@@ -15642,20 +15654,27 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1564215654

1564315655
bnxt_copy_rx_ring(bp, rxr, clone);
1564415656

15657+
/* All rings have been reserved and previously allocated.
15658+
* Reallocating with the same parameters should never fail.
15659+
*/
1564515660
rc = bnxt_hwrm_rx_ring_alloc(bp, rxr);
1564615661
if (rc)
1564715662
return rc;
15663+
15664+
if (bp->tph_mode) {
15665+
rc = bnxt_hwrm_cp_ring_alloc_p5(bp, rxr->rx_cpr);
15666+
if (rc)
15667+
goto err_free_hwrm_rx_ring;
15668+
}
15669+
1564815670
rc = bnxt_hwrm_rx_agg_ring_alloc(bp, rxr);
1564915671
if (rc)
15650-
goto err_free_hwrm_rx_ring;
15672+
goto err_free_hwrm_cp_ring;
1565115673

1565215674
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
1565315675
if (bp->flags & BNXT_FLAG_AGG_RINGS)
1565415676
bnxt_db_write(bp, &rxr->rx_agg_db, rxr->rx_agg_prod);
1565515677

15656-
cpr = &rxr->bnapi->cp_ring;
15657-
cpr->sw_stats->rx.rx_resets++;
15658-
1565915678
for (i = 0; i <= BNXT_VNIC_NTUPLE; i++) {
1566015679
vnic = &bp->vnic_info[i];
1566115680

@@ -15672,6 +15691,9 @@ static int bnxt_queue_start(struct net_device *dev, void *qmem, int idx)
1567215691

1567315692
return 0;
1567415693

15694+
err_free_hwrm_cp_ring:
15695+
if (bp->tph_mode)
15696+
bnxt_hwrm_cp_ring_free(bp, rxr->rx_cpr);
1567515697
err_free_hwrm_rx_ring:
1567615698
bnxt_hwrm_rx_ring_free(bp, rxr, false);
1567715699
return rc;
@@ -15696,11 +15718,15 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
1569615718
cancel_work_sync(&rxr->bnapi->cp_ring.dim.work);
1569715719
bnxt_hwrm_rx_ring_free(bp, rxr, false);
1569815720
bnxt_hwrm_rx_agg_ring_free(bp, rxr, false);
15699-
rxr->rx_next_cons = 0;
1570015721
page_pool_disable_direct_recycling(rxr->page_pool);
1570115722
if (bnxt_separate_head_pool())
1570215723
page_pool_disable_direct_recycling(rxr->head_pool);
1570315724

15725+
if (bp->tph_mode) {
15726+
bnxt_hwrm_cp_ring_free(bp, rxr->rx_cpr);
15727+
bnxt_clear_one_cp_ring(bp, rxr->rx_cpr);
15728+
}
15729+
1570415730
memcpy(qmem, rxr, sizeof(*rxr));
1570515731
bnxt_init_rx_ring_struct(bp, qmem);
1570615732

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2410,6 +2410,8 @@ struct bnxt {
24102410
u8 max_q;
24112411
u8 num_tc;
24122412

2413+
u8 tph_mode;
2414+
24132415
unsigned int current_interval;
24142416
#define BNXT_TIMER_INTERVAL HZ
24152417

0 commit comments

Comments
 (0)