diff options
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 11fd153da85f..febde45cf9fa 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -3612,9 +3612,9 @@ static int ixgbe_resume(struct pci_dev *pdev) | |||
3612 | 3612 | ||
3613 | return 0; | 3613 | return 0; |
3614 | } | 3614 | } |
3615 | |||
3616 | #endif /* CONFIG_PM */ | 3615 | #endif /* CONFIG_PM */ |
3617 | static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | 3616 | |
3617 | static int __ixgbe_shutdown(struct pci_dev *pdev, bool *enable_wake) | ||
3618 | { | 3618 | { |
3619 | struct net_device *netdev = pci_get_drvdata(pdev); | 3619 | struct net_device *netdev = pci_get_drvdata(pdev); |
3620 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | 3620 | struct ixgbe_adapter *adapter = netdev_priv(netdev); |
@@ -3673,18 +3673,46 @@ static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | |||
3673 | pci_enable_wake(pdev, PCI_D3cold, 0); | 3673 | pci_enable_wake(pdev, PCI_D3cold, 0); |
3674 | } | 3674 | } |
3675 | 3675 | ||
3676 | *enable_wake = !!wufc; | ||
3677 | |||
3676 | ixgbe_release_hw_control(adapter); | 3678 | ixgbe_release_hw_control(adapter); |
3677 | 3679 | ||
3678 | pci_disable_device(pdev); | 3680 | pci_disable_device(pdev); |
3679 | 3681 | ||
3680 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | 3682 | return 0; |
3683 | } | ||
3684 | |||
3685 | #ifdef CONFIG_PM | ||
3686 | static int ixgbe_suspend(struct pci_dev *pdev, pm_message_t state) | ||
3687 | { | ||
3688 | int retval; | ||
3689 | bool wake; | ||
3690 | |||
3691 | retval = __ixgbe_shutdown(pdev, &wake); | ||
3692 | if (retval) | ||
3693 | return retval; | ||
3694 | |||
3695 | if (wake) { | ||
3696 | pci_prepare_to_sleep(pdev); | ||
3697 | } else { | ||
3698 | pci_wake_from_d3(pdev, false); | ||
3699 | pci_set_power_state(pdev, PCI_D3hot); | ||
3700 | } | ||
3681 | 3701 | ||
3682 | return 0; | 3702 | return 0; |
3683 | } | 3703 | } |
3704 | #endif /* CONFIG_PM */ | ||
3684 | 3705 | ||
3685 | static void ixgbe_shutdown(struct pci_dev *pdev) | 3706 | static void ixgbe_shutdown(struct pci_dev *pdev) |
3686 | { | 3707 | { |
3687 | ixgbe_suspend(pdev, PMSG_SUSPEND); | 3708 | bool wake; |
3709 | |||
3710 | __ixgbe_shutdown(pdev, &wake); | ||
3711 | |||
3712 | if (system_state == SYSTEM_POWER_OFF) { | ||
3713 | pci_wake_from_d3(pdev, wake); | ||
3714 | pci_set_power_state(pdev, PCI_D3hot); | ||
3715 | } | ||
3688 | } | 3716 | } |
3689 | 3717 | ||
3690 | /** | 3718 | /** |