@@ -7199,6 +7199,25 @@ static int bnxt_hwrm_rx_agg_ring_alloc(struct bnxt *bp,
7199
7199
return 0 ;
7200
7200
}
7201
7201
7202
+ static int bnxt_hwrm_cp_ring_alloc_p5 (struct bnxt * bp ,
7203
+ struct bnxt_cp_ring_info * cpr )
7204
+ {
7205
+ const u32 type = HWRM_RING_ALLOC_CMPL ;
7206
+ struct bnxt_napi * bnapi = cpr -> bnapi ;
7207
+ struct bnxt_ring_struct * ring ;
7208
+ u32 map_idx = bnapi -> index ;
7209
+ int rc ;
7210
+
7211
+ ring = & cpr -> cp_ring_struct ;
7212
+ ring -> handle = BNXT_SET_NQ_HDL (cpr );
7213
+ rc = hwrm_ring_alloc_send_msg (bp , ring , type , map_idx );
7214
+ if (rc )
7215
+ return rc ;
7216
+ bnxt_set_db (bp , & cpr -> cp_db , type , map_idx , ring -> fw_ring_id );
7217
+ bnxt_db_cq (bp , & cpr -> cp_db , cpr -> cp_raw_cons );
7218
+ return 0 ;
7219
+ }
7220
+
7202
7221
static int bnxt_hwrm_ring_alloc (struct bnxt * bp )
7203
7222
{
7204
7223
bool agg_rings = !!(bp -> flags & BNXT_FLAG_AGG_RINGS );
@@ -7242,19 +7261,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
7242
7261
u32 map_idx ;
7243
7262
7244
7263
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7245
- struct bnxt_cp_ring_info * cpr2 = txr -> tx_cpr ;
7246
- struct bnxt_napi * bnapi = txr -> bnapi ;
7247
- u32 type2 = HWRM_RING_ALLOC_CMPL ;
7248
-
7249
- ring = & cpr2 -> cp_ring_struct ;
7250
- ring -> handle = BNXT_SET_NQ_HDL (cpr2 );
7251
- map_idx = bnapi -> index ;
7252
- rc = hwrm_ring_alloc_send_msg (bp , ring , type2 , map_idx );
7264
+ rc = bnxt_hwrm_cp_ring_alloc_p5 (bp , txr -> tx_cpr );
7253
7265
if (rc )
7254
7266
goto err_out ;
7255
- bnxt_set_db (bp , & cpr2 -> cp_db , type2 , map_idx ,
7256
- ring -> fw_ring_id );
7257
- bnxt_db_cq (bp , & cpr2 -> cp_db , cpr2 -> cp_raw_cons );
7258
7267
}
7259
7268
ring = & txr -> tx_ring_struct ;
7260
7269
map_idx = i ;
@@ -7274,20 +7283,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
7274
7283
if (!agg_rings )
7275
7284
bnxt_db_write (bp , & rxr -> rx_db , rxr -> rx_prod );
7276
7285
if (bp -> flags & BNXT_FLAG_CHIP_P5_PLUS ) {
7277
- struct bnxt_cp_ring_info * cpr2 = rxr -> rx_cpr ;
7278
- struct bnxt_napi * bnapi = rxr -> bnapi ;
7279
- u32 type2 = HWRM_RING_ALLOC_CMPL ;
7280
- struct bnxt_ring_struct * ring ;
7281
- u32 map_idx = bnapi -> index ;
7282
-
7283
- ring = & cpr2 -> cp_ring_struct ;
7284
- ring -> handle = BNXT_SET_NQ_HDL (cpr2 );
7285
- rc = hwrm_ring_alloc_send_msg (bp , ring , type2 , map_idx );
7286
+ rc = bnxt_hwrm_cp_ring_alloc_p5 (bp , rxr -> rx_cpr );
7286
7287
if (rc )
7287
7288
goto err_out ;
7288
- bnxt_set_db (bp , & cpr2 -> cp_db , type2 , map_idx ,
7289
- ring -> fw_ring_id );
7290
- bnxt_db_cq (bp , & cpr2 -> cp_db , cpr2 -> cp_raw_cons );
7291
7289
}
7292
7290
}
7293
7291
0 commit comments