i40e: don't handle VF reset on unload
authorMitch Williams <mitch.a.williams@intel.com>
Thu, 13 Feb 2014 11:48:48 +0000 (03:48 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Feb 2014 22:27:29 +0000 (17:27 -0500)
Set the DOWN flag before attempting to disable VFs when unloading the
driver. Also, don't attempt to reset the VFs when the driver is
unloading, because the switch configuration will fail. This fixes a
panic on unload when VFs are enabled.

Change-ID: I25a6567e89c9687145f510ff4f630932412c5c5d
Signed-off-by: Mitch Williams <mitch.a.williams@intel.com>
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

index 897452d72d71cb73c44ea0ebcd2f974ef63bc5ca..628e917f5338c88d6a12e89a50b482cfc5f61436 100644 (file)
@@ -8181,16 +8181,16 @@ static void i40e_remove(struct pci_dev *pdev)
 
        i40e_ptp_stop(pf);
 
-       if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
-               i40e_free_vfs(pf);
-               pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
-       }
-
        /* no more scheduling of any task */
        set_bit(__I40E_DOWN, &pf->state);
        del_timer_sync(&pf->service_timer);
        cancel_work_sync(&pf->service_task);
 
+       if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
+               i40e_free_vfs(pf);
+               pf->flags &= ~I40E_FLAG_SRIOV_ENABLED;
+       }
+
        i40e_fdir_teardown(pf);
 
        /* If there is a switch structure or any orphans, remove them.
index 9074f63a2447512db98858025ca93006849aaca1..7d133faad4cf8dbc04bb674eddf10c85fabb81f7 100644 (file)
@@ -1868,7 +1868,8 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
                        /* clear the bit in GLGEN_VFLRSTAT */
                        wr32(hw, I40E_GLGEN_VFLRSTAT(reg_idx), (1 << bit_idx));
 
-                       i40e_reset_vf(vf, true);
+                       if (!test_bit(__I40E_DOWN, &pf->state))
+                               i40e_reset_vf(vf, true);
                }
        }