|
@@ -12059,7 +12059,10 @@ static int i40e_suspend(struct device *dev)
|
|
struct i40e_pf *pf = pci_get_drvdata(pdev);
|
|
struct i40e_pf *pf = pci_get_drvdata(pdev);
|
|
struct i40e_hw *hw = &pf->hw;
|
|
struct i40e_hw *hw = &pf->hw;
|
|
|
|
|
|
- set_bit(__I40E_SUSPENDED, pf->state);
|
|
|
|
|
|
+ /* If we're already suspended, then there is nothing to do */
|
|
|
|
+ if (test_and_set_bit(__I40E_SUSPENDED, pf->state))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
set_bit(__I40E_DOWN, pf->state);
|
|
set_bit(__I40E_DOWN, pf->state);
|
|
|
|
|
|
if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE))
|
|
if (pf->wol_en && (pf->hw_features & I40E_HW_WOL_MC_MAGIC_PKT_WAKE))
|
|
@@ -12084,11 +12087,15 @@ static int i40e_resume(struct device *dev)
|
|
struct pci_dev *pdev = to_pci_dev(dev);
|
|
struct pci_dev *pdev = to_pci_dev(dev);
|
|
struct i40e_pf *pf = pci_get_drvdata(pdev);
|
|
struct i40e_pf *pf = pci_get_drvdata(pdev);
|
|
|
|
|
|
- /* handling the reset will rebuild the device state */
|
|
|
|
- if (test_and_clear_bit(__I40E_SUSPENDED, pf->state)) {
|
|
|
|
- clear_bit(__I40E_DOWN, pf->state);
|
|
|
|
- i40e_reset_and_rebuild(pf, false, false);
|
|
|
|
- }
|
|
|
|
|
|
+ /* If we're not suspended, then there is nothing to do */
|
|
|
|
+ if (!test_bit(__I40E_SUSPENDED, pf->state))
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ clear_bit(__I40E_DOWN, pf->state);
|
|
|
|
+ i40e_reset_and_rebuild(pf, false, false);
|
|
|
|
+
|
|
|
|
+ /* Clear suspended state last after everything is recovered */
|
|
|
|
+ clear_bit(__I40E_SUSPENDED, pf->state);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|