@@ -3584,11 +3584,11 @@ static int bnxt_alloc_cp_sub_ring(struct bnxt *bp,
35843584static int bnxt_alloc_cp_rings (struct bnxt * bp )
35853585{
35863586 bool sh = !!(bp -> flags & BNXT_FLAG_SHARED_RINGS );
3587- int i , rc , ulp_base_vec , ulp_msix ;
3587+ int i , j , rc , ulp_base_vec , ulp_msix ;
35883588
35893589 ulp_msix = bnxt_get_ulp_msix_num (bp );
35903590 ulp_base_vec = bnxt_get_ulp_msix_base (bp );
3591- for (i = 0 ; i < bp -> cp_nr_rings ; i ++ ) {
3591+ for (i = 0 , j = 0 ; i < bp -> cp_nr_rings ; i ++ ) {
35923592 struct bnxt_napi * bnapi = bp -> bnapi [i ];
35933593 struct bnxt_cp_ring_info * cpr , * cpr2 ;
35943594 struct bnxt_ring_struct * ring ;
@@ -3626,6 +3626,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
36263626 if (rc )
36273627 return rc ;
36283628 cpr2 -> bnapi = bnapi ;
3629+ bp -> rx_ring [i ].rx_cpr = cpr2 ;
36293630 }
36303631 if ((sh && i < bp -> tx_nr_rings ) ||
36313632 (!sh && i >= bp -> rx_nr_rings )) {
@@ -3634,6 +3635,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
36343635 if (rc )
36353636 return rc ;
36363637 cpr2 -> bnapi = bnapi ;
3638+ bp -> tx_ring [j ++ ].tx_cpr = cpr2 ;
36373639 }
36383640 }
36393641 return 0 ;
@@ -4654,6 +4656,8 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
46544656 BNXT_RMEM_RING_PTE_FLAG ;
46554657 rxr -> rx_agg_ring_struct .ring_mem .flags =
46564658 BNXT_RMEM_RING_PTE_FLAG ;
4659+ } else {
4660+ rxr -> rx_cpr = & bp -> bnapi [i ]-> cp_ring ;
46574661 }
46584662 rxr -> bnapi = bp -> bnapi [i ];
46594663 bp -> bnapi [i ]-> rx_ring = & bp -> rx_ring [i ];
@@ -4682,6 +4686,8 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
46824686 if (bp -> flags & BNXT_FLAG_CHIP_P5 )
46834687 txr -> tx_ring_struct .ring_mem .flags =
46844688 BNXT_RMEM_RING_PTE_FLAG ;
4689+ else
4690+ txr -> tx_cpr = & bp -> bnapi [i ]-> cp_ring ;
46854691 txr -> bnapi = bp -> bnapi [j ];
46864692 bp -> bnapi [j ]-> tx_ring = txr ;
46874693 bp -> tx_ring_map [i ] = bp -> tx_nr_rings_xdp + i ;
@@ -5242,28 +5248,18 @@ static u16 bnxt_cp_ring_from_grp(struct bnxt *bp, struct bnxt_ring_struct *ring)
52425248
52435249static u16 bnxt_cp_ring_for_rx (struct bnxt * bp , struct bnxt_rx_ring_info * rxr )
52445250{
5245- if (bp -> flags & BNXT_FLAG_CHIP_P5 ) {
5246- struct bnxt_napi * bnapi = rxr -> bnapi ;
5247- struct bnxt_cp_ring_info * cpr ;
5248-
5249- cpr = & bnapi -> cp_ring .cp_ring_arr [BNXT_RX_HDL ];
5250- return cpr -> cp_ring_struct .fw_ring_id ;
5251- } else {
5251+ if (bp -> flags & BNXT_FLAG_CHIP_P5 )
5252+ return rxr -> rx_cpr -> cp_ring_struct .fw_ring_id ;
5253+ else
52525254 return bnxt_cp_ring_from_grp (bp , & rxr -> rx_ring_struct );
5253- }
52545255}
52555256
52565257static u16 bnxt_cp_ring_for_tx (struct bnxt * bp , struct bnxt_tx_ring_info * txr )
52575258{
5258- if (bp -> flags & BNXT_FLAG_CHIP_P5 ) {
5259- struct bnxt_napi * bnapi = txr -> bnapi ;
5260- struct bnxt_cp_ring_info * cpr ;
5261-
5262- cpr = & bnapi -> cp_ring .cp_ring_arr [BNXT_TX_HDL ];
5263- return cpr -> cp_ring_struct .fw_ring_id ;
5264- } else {
5259+ if (bp -> flags & BNXT_FLAG_CHIP_P5 )
5260+ return txr -> tx_cpr -> cp_ring_struct .fw_ring_id ;
5261+ else
52655262 return bnxt_cp_ring_from_grp (bp , & txr -> tx_ring_struct );
5266- }
52675263}
52685264
52695265static int bnxt_alloc_rss_indir_tbl (struct bnxt * bp )
@@ -6022,12 +6018,10 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
60226018 u32 map_idx ;
60236019
60246020 if (bp -> flags & BNXT_FLAG_CHIP_P5 ) {
6021+ struct bnxt_cp_ring_info * cpr2 = txr -> tx_cpr ;
60256022 struct bnxt_napi * bnapi = txr -> bnapi ;
6026- struct bnxt_cp_ring_info * cpr , * cpr2 ;
60276023 u32 type2 = HWRM_RING_ALLOC_CMPL ;
60286024
6029- cpr = & bnapi -> cp_ring ;
6030- cpr2 = & cpr -> cp_ring_arr [BNXT_TX_HDL ];
60316025 ring = & cpr2 -> cp_ring_struct ;
60326026 ring -> handle = BNXT_TX_HDL ;
60336027 map_idx = bnapi -> index ;
@@ -6062,11 +6056,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
60626056 bnxt_db_write (bp , & rxr -> rx_db , rxr -> rx_prod );
60636057 bp -> grp_info [map_idx ].rx_fw_ring_id = ring -> fw_ring_id ;
60646058 if (bp -> flags & BNXT_FLAG_CHIP_P5 ) {
6065- struct bnxt_cp_ring_info * cpr = & bnapi -> cp_ring ;
6059+ struct bnxt_cp_ring_info * cpr2 = rxr -> rx_cpr ;
60666060 u32 type2 = HWRM_RING_ALLOC_CMPL ;
6067- struct bnxt_cp_ring_info * cpr2 ;
60686061
6069- cpr2 = & cpr -> cp_ring_arr [BNXT_RX_HDL ];
60706062 ring = & cpr2 -> cp_ring_struct ;
60716063 ring -> handle = BNXT_RX_HDL ;
60726064 rc = hwrm_ring_alloc_send_msg (bp , ring , type2 , map_idx );
0 commit comments