Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139802
b: refs/heads/master
c: 3fe7c4c
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki authored and David S. Miller committed Apr 2, 2009
1 parent b1504d7 commit 82ada60
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cdfa9f6444ced9425e8e4fe4c2975a620e664b77
refs/heads/master: 3fe7c4c9dca4fbbff92eb61a660690dad7029ec3
44 changes: 31 additions & 13 deletions trunk/drivers/net/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ static inline int igb_set_vf_rlpml(struct igb_adapter *, int, int);
static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *);
static void igb_restore_vf_multicasts(struct igb_adapter *adapter);

static int igb_suspend(struct pci_dev *, pm_message_t);
#ifdef CONFIG_PM
static int igb_suspend(struct pci_dev *, pm_message_t);
static int igb_resume(struct pci_dev *);
#endif
static void igb_shutdown(struct pci_dev *);
Expand Down Expand Up @@ -5060,7 +5060,7 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
return 0;
}

static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
static int __igb_shutdown(struct pci_dev *pdev, bool *enable_wake)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct igb_adapter *adapter = netdev_priv(netdev);
Expand Down Expand Up @@ -5119,28 +5119,39 @@ static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
wr32(E1000_WUFC, 0);
}

/* make sure adapter isn't asleep if manageability/wol is enabled */
if (wufc || adapter->en_mng_pt) {
pci_enable_wake(pdev, PCI_D3hot, 1);
pci_enable_wake(pdev, PCI_D3cold, 1);
} else {
*enable_wake = wufc || adapter->en_mng_pt;
if (!*enable_wake)
igb_shutdown_fiber_serdes_link_82575(hw);
pci_enable_wake(pdev, PCI_D3hot, 0);
pci_enable_wake(pdev, PCI_D3cold, 0);
}

/* Release control of h/w to f/w. If f/w is AMT enabled, this
* would have already happened in close and is redundant. */
igb_release_hw_control(adapter);

pci_disable_device(pdev);

pci_set_power_state(pdev, pci_choose_state(pdev, state));

return 0;
}

#ifdef CONFIG_PM
static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
{
int retval;
bool wake;

retval = __igb_shutdown(pdev, &wake);
if (retval)
return retval;

if (wake) {
pci_prepare_to_sleep(pdev);
} else {
pci_wake_from_d3(pdev, false);
pci_set_power_state(pdev, PCI_D3hot);
}

return 0;
}

static int igb_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
Expand Down Expand Up @@ -5193,7 +5204,14 @@ static int igb_resume(struct pci_dev *pdev)

static void igb_shutdown(struct pci_dev *pdev)
{
igb_suspend(pdev, PMSG_SUSPEND);
bool wake;

__igb_shutdown(pdev, &wake);

if (system_state == SYSTEM_POWER_OFF) {
pci_wake_from_d3(pdev, wake);
pci_set_power_state(pdev, PCI_D3hot);
}
}

#ifdef CONFIG_NET_POLL_CONTROLLER
Expand Down

0 comments on commit 82ada60

Please sign in to comment.