@@ -422,7 +422,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
422
422
static void bnxt_tx_int (struct bnxt * bp , struct bnxt_napi * bnapi , int nr_pkts )
423
423
{
424
424
struct bnxt_tx_ring_info * txr = bnapi -> tx_ring ;
425
- int index = bnapi -> index ;
425
+ int index = txr - & bp -> tx_ring [ 0 ] ;
426
426
struct netdev_queue * txq = netdev_get_tx_queue (bp -> dev , index );
427
427
u16 cons = txr -> tx_cons ;
428
428
struct pci_dev * pdev = bp -> pdev ;
@@ -3082,7 +3082,7 @@ static int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, u16 vnic_id)
3082
3082
3083
3083
static int bnxt_hwrm_vnic_cfg (struct bnxt * bp , u16 vnic_id )
3084
3084
{
3085
- int grp_idx = 0 ;
3085
+ unsigned int ring = 0 , grp_idx ;
3086
3086
struct bnxt_vnic_info * vnic = & bp -> vnic_info [vnic_id ];
3087
3087
struct hwrm_vnic_cfg_input req = {0 };
3088
3088
@@ -3093,10 +3093,11 @@ static int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id)
3093
3093
req .rss_rule = cpu_to_le16 (vnic -> fw_rss_cos_lb_ctx );
3094
3094
req .cos_rule = cpu_to_le16 (0xffff );
3095
3095
if (vnic -> flags & BNXT_VNIC_RSS_FLAG )
3096
- grp_idx = 0 ;
3096
+ ring = 0 ;
3097
3097
else if (vnic -> flags & BNXT_VNIC_RFS_FLAG )
3098
- grp_idx = vnic_id - 1 ;
3098
+ ring = vnic_id - 1 ;
3099
3099
3100
+ grp_idx = bp -> rx_ring [ring ].bnapi -> index ;
3100
3101
req .vnic_id = cpu_to_le16 (vnic -> fw_vnic_id );
3101
3102
req .dflt_ring_grp = cpu_to_le16 (bp -> grp_info [grp_idx ].fw_grp_id );
3102
3103
@@ -3137,22 +3138,25 @@ static void bnxt_hwrm_vnic_free(struct bnxt *bp)
3137
3138
bnxt_hwrm_vnic_free_one (bp , i );
3138
3139
}
3139
3140
3140
- static int bnxt_hwrm_vnic_alloc (struct bnxt * bp , u16 vnic_id , u16 start_grp_id ,
3141
- u16 end_grp_id )
3141
+ static int bnxt_hwrm_vnic_alloc (struct bnxt * bp , u16 vnic_id ,
3142
+ unsigned int start_rx_ring_idx ,
3143
+ unsigned int nr_rings )
3142
3144
{
3143
- u32 rc = 0 , i , j ;
3145
+ int rc = 0 ;
3146
+ unsigned int i , j , grp_idx , end_idx = start_rx_ring_idx + nr_rings ;
3144
3147
struct hwrm_vnic_alloc_input req = {0 };
3145
3148
struct hwrm_vnic_alloc_output * resp = bp -> hwrm_cmd_resp_addr ;
3146
3149
3147
3150
/* map ring groups to this vnic */
3148
- for (i = start_grp_id , j = 0 ; i < end_grp_id ; i ++ , j ++ ) {
3149
- if (bp -> grp_info [i ].fw_grp_id == INVALID_HW_RING_ID ) {
3151
+ for (i = start_rx_ring_idx , j = 0 ; i < end_idx ; i ++ , j ++ ) {
3152
+ grp_idx = bp -> rx_ring [i ].bnapi -> index ;
3153
+ if (bp -> grp_info [grp_idx ].fw_grp_id == INVALID_HW_RING_ID ) {
3150
3154
netdev_err (bp -> dev , "Not enough ring groups avail:%x req:%x\n" ,
3151
- j , ( end_grp_id - start_grp_id ) );
3155
+ j , nr_rings );
3152
3156
break ;
3153
3157
}
3154
3158
bp -> vnic_info [vnic_id ].fw_grp_ids [j ] =
3155
- bp -> grp_info [i ].fw_grp_id ;
3159
+ bp -> grp_info [grp_idx ].fw_grp_id ;
3156
3160
}
3157
3161
3158
3162
bp -> vnic_info [vnic_id ].fw_rss_cos_lb_ctx = INVALID_HW_RING_ID ;
@@ -3179,20 +3183,22 @@ static int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp)
3179
3183
struct hwrm_ring_grp_alloc_input req = {0 };
3180
3184
struct hwrm_ring_grp_alloc_output * resp =
3181
3185
bp -> hwrm_cmd_resp_addr ;
3186
+ unsigned int grp_idx = bp -> rx_ring [i ].bnapi -> index ;
3182
3187
3183
3188
bnxt_hwrm_cmd_hdr_init (bp , & req , HWRM_RING_GRP_ALLOC , -1 , -1 );
3184
3189
3185
- req .cr = cpu_to_le16 (bp -> grp_info [i ].cp_fw_ring_id );
3186
- req .rr = cpu_to_le16 (bp -> grp_info [i ].rx_fw_ring_id );
3187
- req .ar = cpu_to_le16 (bp -> grp_info [i ].agg_fw_ring_id );
3188
- req .sc = cpu_to_le16 (bp -> grp_info [i ].fw_stats_ctx );
3190
+ req .cr = cpu_to_le16 (bp -> grp_info [grp_idx ].cp_fw_ring_id );
3191
+ req .rr = cpu_to_le16 (bp -> grp_info [grp_idx ].rx_fw_ring_id );
3192
+ req .ar = cpu_to_le16 (bp -> grp_info [grp_idx ].agg_fw_ring_id );
3193
+ req .sc = cpu_to_le16 (bp -> grp_info [grp_idx ].fw_stats_ctx );
3189
3194
3190
3195
rc = _hwrm_send_message (bp , & req , sizeof (req ),
3191
3196
HWRM_CMD_TIMEOUT );
3192
3197
if (rc )
3193
3198
break ;
3194
3199
3195
- bp -> grp_info [i ].fw_grp_id = le32_to_cpu (resp -> ring_group_id );
3200
+ bp -> grp_info [grp_idx ].fw_grp_id =
3201
+ le32_to_cpu (resp -> ring_group_id );
3196
3202
}
3197
3203
mutex_unlock (& bp -> hwrm_cmd_lock );
3198
3204
return rc ;
@@ -3334,46 +3340,49 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
3334
3340
for (i = 0 ; i < bp -> tx_nr_rings ; i ++ ) {
3335
3341
struct bnxt_tx_ring_info * txr = & bp -> tx_ring [i ];
3336
3342
struct bnxt_ring_struct * ring = & txr -> tx_ring_struct ;
3337
- u16 fw_stats_ctx = bp -> grp_info [i ].fw_stats_ctx ;
3343
+ u32 map_idx = txr -> bnapi -> index ;
3344
+ u16 fw_stats_ctx = bp -> grp_info [map_idx ].fw_stats_ctx ;
3338
3345
3339
- rc = hwrm_ring_alloc_send_msg (bp , ring , HWRM_RING_ALLOC_TX , i ,
3340
- fw_stats_ctx );
3346
+ rc = hwrm_ring_alloc_send_msg (bp , ring , HWRM_RING_ALLOC_TX ,
3347
+ map_idx , fw_stats_ctx );
3341
3348
if (rc )
3342
3349
goto err_out ;
3343
- txr -> tx_doorbell = bp -> bar1 + i * 0x80 ;
3350
+ txr -> tx_doorbell = bp -> bar1 + map_idx * 0x80 ;
3344
3351
}
3345
3352
3346
3353
for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
3347
3354
struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
3348
3355
struct bnxt_ring_struct * ring = & rxr -> rx_ring_struct ;
3356
+ u32 map_idx = rxr -> bnapi -> index ;
3349
3357
3350
- rc = hwrm_ring_alloc_send_msg (bp , ring , HWRM_RING_ALLOC_RX , i ,
3351
- INVALID_STATS_CTX_ID );
3358
+ rc = hwrm_ring_alloc_send_msg (bp , ring , HWRM_RING_ALLOC_RX ,
3359
+ map_idx , INVALID_STATS_CTX_ID );
3352
3360
if (rc )
3353
3361
goto err_out ;
3354
- rxr -> rx_doorbell = bp -> bar1 + i * 0x80 ;
3362
+ rxr -> rx_doorbell = bp -> bar1 + map_idx * 0x80 ;
3355
3363
writel (DB_KEY_RX | rxr -> rx_prod , rxr -> rx_doorbell );
3356
- bp -> grp_info [i ].rx_fw_ring_id = ring -> fw_ring_id ;
3364
+ bp -> grp_info [map_idx ].rx_fw_ring_id = ring -> fw_ring_id ;
3357
3365
}
3358
3366
3359
3367
if (bp -> flags & BNXT_FLAG_AGG_RINGS ) {
3360
3368
for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
3361
3369
struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
3362
3370
struct bnxt_ring_struct * ring =
3363
3371
& rxr -> rx_agg_ring_struct ;
3372
+ u32 grp_idx = rxr -> bnapi -> index ;
3373
+ u32 map_idx = grp_idx + bp -> rx_nr_rings ;
3364
3374
3365
3375
rc = hwrm_ring_alloc_send_msg (bp , ring ,
3366
3376
HWRM_RING_ALLOC_AGG ,
3367
- bp -> rx_nr_rings + i ,
3377
+ map_idx ,
3368
3378
INVALID_STATS_CTX_ID );
3369
3379
if (rc )
3370
3380
goto err_out ;
3371
3381
3372
- rxr -> rx_agg_doorbell =
3373
- bp -> bar1 + (bp -> rx_nr_rings + i ) * 0x80 ;
3382
+ rxr -> rx_agg_doorbell = bp -> bar1 + map_idx * 0x80 ;
3374
3383
writel (DB_KEY_RX | rxr -> rx_agg_prod ,
3375
3384
rxr -> rx_agg_doorbell );
3376
- bp -> grp_info [i ].agg_fw_ring_id = ring -> fw_ring_id ;
3385
+ bp -> grp_info [grp_idx ].agg_fw_ring_id = ring -> fw_ring_id ;
3377
3386
}
3378
3387
}
3379
3388
err_out :
@@ -3430,7 +3439,8 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
3430
3439
for (i = 0 ; i < bp -> tx_nr_rings ; i ++ ) {
3431
3440
struct bnxt_tx_ring_info * txr = & bp -> tx_ring [i ];
3432
3441
struct bnxt_ring_struct * ring = & txr -> tx_ring_struct ;
3433
- u32 cmpl_ring_id = bp -> grp_info [i ].cp_fw_ring_id ;
3442
+ u32 grp_idx = txr -> bnapi -> index ;
3443
+ u32 cmpl_ring_id = bp -> grp_info [grp_idx ].cp_fw_ring_id ;
3434
3444
3435
3445
if (ring -> fw_ring_id != INVALID_HW_RING_ID ) {
3436
3446
hwrm_ring_free_send_msg (bp , ring ,
@@ -3444,30 +3454,34 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
3444
3454
for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
3445
3455
struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
3446
3456
struct bnxt_ring_struct * ring = & rxr -> rx_ring_struct ;
3447
- u32 cmpl_ring_id = bp -> grp_info [i ].cp_fw_ring_id ;
3457
+ u32 grp_idx = rxr -> bnapi -> index ;
3458
+ u32 cmpl_ring_id = bp -> grp_info [grp_idx ].cp_fw_ring_id ;
3448
3459
3449
3460
if (ring -> fw_ring_id != INVALID_HW_RING_ID ) {
3450
3461
hwrm_ring_free_send_msg (bp , ring ,
3451
3462
RING_FREE_REQ_RING_TYPE_RX ,
3452
3463
close_path ? cmpl_ring_id :
3453
3464
INVALID_HW_RING_ID );
3454
3465
ring -> fw_ring_id = INVALID_HW_RING_ID ;
3455
- bp -> grp_info [i ].rx_fw_ring_id = INVALID_HW_RING_ID ;
3466
+ bp -> grp_info [grp_idx ].rx_fw_ring_id =
3467
+ INVALID_HW_RING_ID ;
3456
3468
}
3457
3469
}
3458
3470
3459
3471
for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
3460
3472
struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
3461
3473
struct bnxt_ring_struct * ring = & rxr -> rx_agg_ring_struct ;
3462
- u32 cmpl_ring_id = bp -> grp_info [i ].cp_fw_ring_id ;
3474
+ u32 grp_idx = rxr -> bnapi -> index ;
3475
+ u32 cmpl_ring_id = bp -> grp_info [grp_idx ].cp_fw_ring_id ;
3463
3476
3464
3477
if (ring -> fw_ring_id != INVALID_HW_RING_ID ) {
3465
3478
hwrm_ring_free_send_msg (bp , ring ,
3466
3479
RING_FREE_REQ_RING_TYPE_RX ,
3467
3480
close_path ? cmpl_ring_id :
3468
3481
INVALID_HW_RING_ID );
3469
3482
ring -> fw_ring_id = INVALID_HW_RING_ID ;
3470
- bp -> grp_info [i ].agg_fw_ring_id = INVALID_HW_RING_ID ;
3483
+ bp -> grp_info [grp_idx ].agg_fw_ring_id =
3484
+ INVALID_HW_RING_ID ;
3471
3485
}
3472
3486
}
3473
3487
@@ -3859,7 +3873,7 @@ static int bnxt_alloc_rfs_vnics(struct bnxt *bp)
3859
3873
break ;
3860
3874
3861
3875
bp -> vnic_info [vnic_id ].flags |= BNXT_VNIC_RFS_FLAG ;
3862
- rc = bnxt_hwrm_vnic_alloc (bp , vnic_id , ring_id , ring_id + 1 );
3876
+ rc = bnxt_hwrm_vnic_alloc (bp , vnic_id , ring_id , 1 );
3863
3877
if (rc ) {
3864
3878
netdev_err (bp -> dev , "hwrm vnic %d alloc failure rc: %x\n" ,
3865
3879
vnic_id , rc );
@@ -4165,7 +4179,7 @@ static void bnxt_free_irq(struct bnxt *bp)
4165
4179
4166
4180
static int bnxt_request_irq (struct bnxt * bp )
4167
4181
{
4168
- int i , rc = 0 ;
4182
+ int i , j , rc = 0 ;
4169
4183
unsigned long flags = 0 ;
4170
4184
#ifdef CONFIG_RFS_ACCEL
4171
4185
struct cpu_rmap * rmap = bp -> dev -> rx_cpu_rmap ;
@@ -4174,14 +4188,15 @@ static int bnxt_request_irq(struct bnxt *bp)
4174
4188
if (!(bp -> flags & BNXT_FLAG_USING_MSIX ))
4175
4189
flags = IRQF_SHARED ;
4176
4190
4177
- for (i = 0 ; i < bp -> cp_nr_rings ; i ++ ) {
4191
+ for (i = 0 , j = 0 ; i < bp -> cp_nr_rings ; i ++ ) {
4178
4192
struct bnxt_irq * irq = & bp -> irq_tbl [i ];
4179
4193
#ifdef CONFIG_RFS_ACCEL
4180
- if (rmap && ( i < bp -> rx_nr_rings ) ) {
4194
+ if (rmap && bp -> bnapi [ i ] -> rx_ring ) {
4181
4195
rc = irq_cpu_rmap_add (rmap , irq -> vector );
4182
4196
if (rc )
4183
4197
netdev_warn (bp -> dev , "failed adding irq rmap for ring %d\n" ,
4184
- i );
4198
+ j );
4199
+ j ++ ;
4185
4200
}
4186
4201
#endif
4187
4202
rc = request_irq (irq -> vector , irq -> handler , flags , irq -> name ,
0 commit comments