@@ -7893,7 +7893,7 @@ static void bnxt_setup_msix(struct bnxt *bp)
7893
7893
int tcs , i ;
7894
7894
7895
7895
tcs = netdev_get_num_tc (dev );
7896
- if (tcs > 1 ) {
7896
+ if (tcs ) {
7897
7897
int i , off , count ;
7898
7898
7899
7899
for (i = 0 ; i < tcs ; i ++ ) {
@@ -9241,6 +9241,17 @@ void bnxt_half_close_nic(struct bnxt *bp)
9241
9241
bnxt_free_mem (bp , false);
9242
9242
}
9243
9243
9244
+ static void bnxt_reenable_sriov (struct bnxt * bp )
9245
+ {
9246
+ if (BNXT_PF (bp )) {
9247
+ struct bnxt_pf_info * pf = & bp -> pf ;
9248
+ int n = pf -> active_vfs ;
9249
+
9250
+ if (n )
9251
+ bnxt_cfg_hw_sriov (bp , & n , true);
9252
+ }
9253
+ }
9254
+
9244
9255
static int bnxt_open (struct net_device * dev )
9245
9256
{
9246
9257
struct bnxt * bp = netdev_priv (dev );
@@ -9259,15 +9270,10 @@ static int bnxt_open(struct net_device *dev)
9259
9270
bnxt_hwrm_if_change (bp , false);
9260
9271
} else {
9261
9272
if (test_and_clear_bit (BNXT_STATE_FW_RESET_DET , & bp -> state )) {
9262
- if (BNXT_PF (bp )) {
9263
- struct bnxt_pf_info * pf = & bp -> pf ;
9264
- int n = pf -> active_vfs ;
9265
-
9266
- if (n )
9267
- bnxt_cfg_hw_sriov (bp , & n , true);
9268
- }
9269
- if (!test_bit (BNXT_STATE_IN_FW_RESET , & bp -> state ))
9273
+ if (!test_bit (BNXT_STATE_IN_FW_RESET , & bp -> state )) {
9270
9274
bnxt_ulp_start (bp , 0 );
9275
+ bnxt_reenable_sriov (bp );
9276
+ }
9271
9277
}
9272
9278
bnxt_hwmon_open (bp );
9273
9279
}
@@ -9307,10 +9313,6 @@ static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init,
9307
9313
bnxt_debug_dev_exit (bp );
9308
9314
bnxt_disable_napi (bp );
9309
9315
del_timer_sync (& bp -> timer );
9310
- if (test_bit (BNXT_STATE_IN_FW_RESET , & bp -> state ) &&
9311
- pci_is_enabled (bp -> pdev ))
9312
- pci_disable_device (bp -> pdev );
9313
-
9314
9316
bnxt_free_skbs (bp );
9315
9317
9316
9318
/* Save ring stats before shutdown */
@@ -10096,9 +10098,16 @@ static void bnxt_reset(struct bnxt *bp, bool silent)
10096
10098
static void bnxt_fw_reset_close (struct bnxt * bp )
10097
10099
{
10098
10100
bnxt_ulp_stop (bp );
10101
+ /* When firmware is fatal state, disable PCI device to prevent
10102
+ * any potential bad DMAs before freeing kernel memory.
10103
+ */
10104
+ if (test_bit (BNXT_STATE_FW_FATAL_COND , & bp -> state ))
10105
+ pci_disable_device (bp -> pdev );
10099
10106
__bnxt_close_nic (bp , true, false);
10100
10107
bnxt_clear_int_mode (bp );
10101
10108
bnxt_hwrm_func_drv_unrgtr (bp );
10109
+ if (pci_is_enabled (bp -> pdev ))
10110
+ pci_disable_device (bp -> pdev );
10102
10111
bnxt_free_ctx_mem (bp );
10103
10112
kfree (bp -> ctx );
10104
10113
bp -> ctx = NULL ;
@@ -10831,6 +10840,8 @@ static void bnxt_fw_reset_task(struct work_struct *work)
10831
10840
smp_mb__before_atomic ();
10832
10841
clear_bit (BNXT_STATE_IN_FW_RESET , & bp -> state );
10833
10842
bnxt_ulp_start (bp , rc );
10843
+ if (!rc )
10844
+ bnxt_reenable_sriov (bp );
10834
10845
bnxt_dl_health_recovery_done (bp );
10835
10846
bnxt_dl_health_status_update (bp , true);
10836
10847
rtnl_unlock ();
0 commit comments