@@ -2897,6 +2897,13 @@ static int bnxt_hwrm_handler(struct bnxt *bp, struct tx_cmp *txcmp)
2897
2897
return 0 ;
2898
2898
}
2899
2899
2900
+ static bool bnxt_vnic_is_active (struct bnxt * bp )
2901
+ {
2902
+ struct bnxt_vnic_info * vnic = & bp -> vnic_info [0 ];
2903
+
2904
+ return vnic -> fw_vnic_id != INVALID_HW_RING_ID && vnic -> mru > 0 ;
2905
+ }
2906
+
2900
2907
static irqreturn_t bnxt_msix (int irq , void * dev_instance )
2901
2908
{
2902
2909
struct bnxt_napi * bnapi = dev_instance ;
@@ -3164,7 +3171,7 @@ static int bnxt_poll(struct napi_struct *napi, int budget)
3164
3171
break ;
3165
3172
}
3166
3173
}
3167
- if (bp -> flags & BNXT_FLAG_DIM ) {
3174
+ if (( bp -> flags & BNXT_FLAG_DIM ) && bnxt_vnic_is_active ( bp ) ) {
3168
3175
struct dim_sample dim_sample = {};
3169
3176
3170
3177
dim_update_sample (cpr -> event_ctr ,
@@ -3295,7 +3302,7 @@ static int bnxt_poll_p5(struct napi_struct *napi, int budget)
3295
3302
poll_done :
3296
3303
cpr_rx = & cpr -> cp_ring_arr [0 ];
3297
3304
if (cpr_rx -> cp_ring_type == BNXT_NQ_HDL_TYPE_RX &&
3298
- (bp -> flags & BNXT_FLAG_DIM )) {
3305
+ (bp -> flags & BNXT_FLAG_DIM ) && bnxt_vnic_is_active ( bp ) ) {
3299
3306
struct dim_sample dim_sample = {};
3300
3307
3301
3308
dim_update_sample (cpr -> event_ctr ,
@@ -7266,6 +7273,26 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
7266
7273
return rc ;
7267
7274
}
7268
7275
7276
+ static void bnxt_cancel_dim (struct bnxt * bp )
7277
+ {
7278
+ int i ;
7279
+
7280
+ /* DIM work is initialized in bnxt_enable_napi(). Proceed only
7281
+ * if NAPI is enabled.
7282
+ */
7283
+ if (!bp -> bnapi || test_bit (BNXT_STATE_NAPI_DISABLED , & bp -> state ))
7284
+ return ;
7285
+
7286
+ /* Make sure NAPI sees that the VNIC is disabled */
7287
+ synchronize_net ();
7288
+ for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
7289
+ struct bnxt_rx_ring_info * rxr = & bp -> rx_ring [i ];
7290
+ struct bnxt_napi * bnapi = rxr -> bnapi ;
7291
+
7292
+ cancel_work_sync (& bnapi -> cp_ring .dim .work );
7293
+ }
7294
+ }
7295
+
7269
7296
static int hwrm_ring_free_send_msg (struct bnxt * bp ,
7270
7297
struct bnxt_ring_struct * ring ,
7271
7298
u32 ring_type , int cmpl_ring_id )
@@ -7366,6 +7393,7 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path)
7366
7393
}
7367
7394
}
7368
7395
7396
+ bnxt_cancel_dim (bp );
7369
7397
for (i = 0 ; i < bp -> rx_nr_rings ; i ++ ) {
7370
7398
bnxt_hwrm_rx_ring_free (bp , & bp -> rx_ring [i ], close_path );
7371
7399
bnxt_hwrm_rx_agg_ring_free (bp , & bp -> rx_ring [i ], close_path );
@@ -11309,8 +11337,6 @@ static void bnxt_disable_napi(struct bnxt *bp)
11309
11337
if (bnapi -> in_reset )
11310
11338
cpr -> sw_stats -> rx .rx_resets ++ ;
11311
11339
napi_disable (& bnapi -> napi );
11312
- if (bnapi -> rx_ring )
11313
- cancel_work_sync (& cpr -> dim .work );
11314
11340
}
11315
11341
}
11316
11342
@@ -15572,8 +15598,10 @@ static int bnxt_queue_stop(struct net_device *dev, void *qmem, int idx)
15572
15598
bnxt_hwrm_vnic_update (bp , vnic ,
15573
15599
VNIC_UPDATE_REQ_ENABLES_MRU_VALID );
15574
15600
}
15575
-
15601
+ /* Make sure NAPI sees that the VNIC is disabled */
15602
+ synchronize_net ();
15576
15603
rxr = & bp -> rx_ring [idx ];
15604
+ cancel_work_sync (& rxr -> bnapi -> cp_ring .dim .work );
15577
15605
bnxt_hwrm_rx_ring_free (bp , rxr , false);
15578
15606
bnxt_hwrm_rx_agg_ring_free (bp , rxr , false);
15579
15607
rxr -> rx_next_cons = 0 ;
0 commit comments