@@ -3584,11 +3584,11 @@ static int bnxt_alloc_cp_sub_ring(struct bnxt *bp,
3584
3584
static int bnxt_alloc_cp_rings (struct bnxt * bp )
3585
3585
{
3586
3586
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 ;
3588
3588
3589
3589
ulp_msix = bnxt_get_ulp_msix_num (bp );
3590
3590
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 ++ ) {
3592
3592
struct bnxt_napi * bnapi = bp -> bnapi [i ];
3593
3593
struct bnxt_cp_ring_info * cpr , * cpr2 ;
3594
3594
struct bnxt_ring_struct * ring ;
@@ -3626,6 +3626,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3626
3626
if (rc )
3627
3627
return rc ;
3628
3628
cpr2 -> bnapi = bnapi ;
3629
+ bp -> rx_ring [i ].rx_cpr = cpr2 ;
3629
3630
}
3630
3631
if ((sh && i < bp -> tx_nr_rings ) ||
3631
3632
(!sh && i >= bp -> rx_nr_rings )) {
@@ -3634,6 +3635,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
3634
3635
if (rc )
3635
3636
return rc ;
3636
3637
cpr2 -> bnapi = bnapi ;
3638
+ bp -> tx_ring [j ++ ].tx_cpr = cpr2 ;
3637
3639
}
3638
3640
}
3639
3641
return 0 ;
@@ -4654,6 +4656,8 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
4654
4656
BNXT_RMEM_RING_PTE_FLAG ;
4655
4657
rxr -> rx_agg_ring_struct .ring_mem .flags =
4656
4658
BNXT_RMEM_RING_PTE_FLAG ;
4659
+ } else {
4660
+ rxr -> rx_cpr = & bp -> bnapi [i ]-> cp_ring ;
4657
4661
}
4658
4662
rxr -> bnapi = bp -> bnapi [i ];
4659
4663
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)
4682
4686
if (bp -> flags & BNXT_FLAG_CHIP_P5 )
4683
4687
txr -> tx_ring_struct .ring_mem .flags =
4684
4688
BNXT_RMEM_RING_PTE_FLAG ;
4689
+ else
4690
+ txr -> tx_cpr = & bp -> bnapi [i ]-> cp_ring ;
4685
4691
txr -> bnapi = bp -> bnapi [j ];
4686
4692
bp -> bnapi [j ]-> tx_ring = txr ;
4687
4693
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)
5242
5248
5243
5249
static u16 bnxt_cp_ring_for_rx (struct bnxt * bp , struct bnxt_rx_ring_info * rxr )
5244
5250
{
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
5252
5254
return bnxt_cp_ring_from_grp (bp , & rxr -> rx_ring_struct );
5253
- }
5254
5255
}
5255
5256
5256
5257
static u16 bnxt_cp_ring_for_tx (struct bnxt * bp , struct bnxt_tx_ring_info * txr )
5257
5258
{
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
5265
5262
return bnxt_cp_ring_from_grp (bp , & txr -> tx_ring_struct );
5266
- }
5267
5263
}
5268
5264
5269
5265
static int bnxt_alloc_rss_indir_tbl (struct bnxt * bp )
@@ -6022,12 +6018,10 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
6022
6018
u32 map_idx ;
6023
6019
6024
6020
if (bp -> flags & BNXT_FLAG_CHIP_P5 ) {
6021
+ struct bnxt_cp_ring_info * cpr2 = txr -> tx_cpr ;
6025
6022
struct bnxt_napi * bnapi = txr -> bnapi ;
6026
- struct bnxt_cp_ring_info * cpr , * cpr2 ;
6027
6023
u32 type2 = HWRM_RING_ALLOC_CMPL ;
6028
6024
6029
- cpr = & bnapi -> cp_ring ;
6030
- cpr2 = & cpr -> cp_ring_arr [BNXT_TX_HDL ];
6031
6025
ring = & cpr2 -> cp_ring_struct ;
6032
6026
ring -> handle = BNXT_TX_HDL ;
6033
6027
map_idx = bnapi -> index ;
@@ -6062,11 +6056,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
6062
6056
bnxt_db_write (bp , & rxr -> rx_db , rxr -> rx_prod );
6063
6057
bp -> grp_info [map_idx ].rx_fw_ring_id = ring -> fw_ring_id ;
6064
6058
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 ;
6066
6060
u32 type2 = HWRM_RING_ALLOC_CMPL ;
6067
- struct bnxt_cp_ring_info * cpr2 ;
6068
6061
6069
- cpr2 = & cpr -> cp_ring_arr [BNXT_RX_HDL ];
6070
6062
ring = & cpr2 -> cp_ring_struct ;
6071
6063
ring -> handle = BNXT_RX_HDL ;
6072
6064
rc = hwrm_ring_alloc_send_msg (bp , ring , type2 , map_idx );
0 commit comments