Wake On lan and ATL1 nic
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 9 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: atl1c: Do not use legacy PCI power management
The atl1c driver uses the legacy PCI power management, so it has to do some PCI-specific things in its ->suspend() and ->resume() callbacks and they are not done correctly.
Convert atl1c to the new PCI power management framework and make it let the PCI subsystem handle all of the PCI-specific aspects of device handling during system power transitions.
--- drivers/net/atl1c/atl1c_main.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
drivers/net/atl1c/atl1c_main.c +15 -24
@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struc adapter->wol =0 ; +device_set_wakeup_enable (&pdev->dev, false); adapter->link_speed =SPEED_0 ; adapter->link_duplex =FULL_DUPLEX ; adapter->num_rx_queues =AT_DEF_RECEIVE_QUEUE ;
@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_devicereturn 0 ; } -static int atl1c_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1c_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev);struct atl1c_hw *hw = &adapter->hw;
@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_devu32 wol_ctrl_data =0 ;u16 mii_intr_status_data =0 ;u32 wufc = adapter->wol; -int retval =0 ;atl1c_disable_l0s_l1 (hw);if (netif_running (netdev)) {
@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_devatl1c_down (adapter); }netif_device_detach (netdev); - retval =pci_save_state (pdev); -if (retval) -return retval;if (wufc)if (atl1c_phy_power_saving (hw) !=0 )
@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_WOL_CTRL , wol_ctrl_data);AT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data); -/* pcie patch */ -device_set_wakeup_enable (&pdev->dev,1 ); -AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_DEFAULT |GPHY_CTRL_EXT_RESET ); -pci_prepare_to_sleep (pdev); }else {AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_POWER_SAVING ); master_ctrl_data |=MASTER_CTRL_CLK_SEL_DIS ;
@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data);AT_WRITE_REG (hw,REG_WOL_CTRL ,0 ); hw->phy_configured = false;/* re-init PHY when resume */ -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); } -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state)); -return 0 ; } -static int atl1c_resume (struct pci_dev *pdev) +static int atl1c_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev); -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 ); -AT_WRITE_REG (&adapter->hw,REG_WOL_CTRL ,0 );atl1c_reset_pcie (&adapter->hw,ATL1C_PCIE_L0S_L1_DISABLE |ATL1C_PCIE_PHY_RESET );
@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *static void atl1c_shutdown (struct pci_dev *pdev) { -atl1c_suspend (pdev,PMSG_SUSPEND ); +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1c_adapter *adapter =netdev_priv (netdev); + +atl1c_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }static const struct net_device_ops atl1c_netdev_ops = {
@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_e .resume = atl1c_io_resume, }; +static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); +static struct pci_driver atl1c_driver = { .name = atl1c_driver_name, .id_table = atl1c_pci_tbl, .probe = atl1c_probe, .remove =__devexit_p (atl1c_remove), -/* Power Managment Hooks */ - .suspend = atl1c_suspend, - .resume = atl1c_resume, .shutdown = atl1c_shutdown, - .err_handler = &atl1c_err_handler + .err_handler = &atl1c_err_handler, + .driver.pm = &atl1c_pm_ops, };/*
Quoted 9 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: atl1c: Do not use legacy PCI power management
The atl1c driver uses the legacy PCI power management, so it has to do some PCI-specific things in its ->suspend() and ->resume() callbacks and they are not done correctly.
Convert atl1c to the new PCI power management framework and make it let the PCI subsystem handle all of the PCI-specific aspects of device handling during system power transitions.
--- drivers/net/atl1c/atl1c_main.c | 39 +++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
drivers/net/atl1c/atl1c_main.c +15 -24
@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struc adapter->wol =0 ; +device_set_wakeup_enable (&pdev->dev, false); adapter->link_speed =SPEED_0 ; adapter->link_duplex =FULL_DUPLEX ; adapter->num_rx_queues =AT_DEF_RECEIVE_QUEUE ;
@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_devicereturn 0 ; } -static int atl1c_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1c_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev);struct atl1c_hw *hw = &adapter->hw;
@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_devu32 wol_ctrl_data =0 ;u16 mii_intr_status_data =0 ;u32 wufc = adapter->wol; -int retval =0 ;atl1c_disable_l0s_l1 (hw);if (netif_running (netdev)) {
@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_devatl1c_down (adapter); }netif_device_detach (netdev); - retval =pci_save_state (pdev); -if (retval) -return retval;if (wufc)if (atl1c_phy_power_saving (hw) !=0 )
@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_WOL_CTRL , wol_ctrl_data);AT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data); -/* pcie patch */ -device_set_wakeup_enable (&pdev->dev,1 ); -AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_DEFAULT |GPHY_CTRL_EXT_RESET ); -pci_prepare_to_sleep (pdev); }else {AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_POWER_SAVING ); master_ctrl_data |=MASTER_CTRL_CLK_SEL_DIS ;
@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data);AT_WRITE_REG (hw,REG_WOL_CTRL ,0 ); hw->phy_configured = false;/* re-init PHY when resume */ -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); } -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state)); -return 0 ; } -static int atl1c_resume (struct pci_dev *pdev) +static int atl1c_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev); -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 ); -AT_WRITE_REG (&adapter->hw,REG_WOL_CTRL ,0 );atl1c_reset_pcie (&adapter->hw,ATL1C_PCIE_L0S_L1_DISABLE |ATL1C_PCIE_PHY_RESET );
@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *static void atl1c_shutdown (struct pci_dev *pdev) { -atl1c_suspend (pdev,PMSG_SUSPEND ); +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1c_adapter *adapter =netdev_priv (netdev); + +atl1c_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }static const struct net_device_ops atl1c_netdev_ops = {
@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_e .resume = atl1c_io_resume, }; +static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); +static struct pci_driver atl1c_driver = { .name = atl1c_driver_name, .id_table = atl1c_pci_tbl, .probe = atl1c_probe, .remove =__devexit_p (atl1c_remove), -/* Power Managment Hooks */ - .suspend = atl1c_suspend, - .resume = atl1c_resume, .shutdown = atl1c_shutdown, - .err_handler = &atl1c_err_handler + .err_handler = &atl1c_err_handler, + .driver.pm = &atl1c_pm_ops, };/*
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Quoted 6 lines
Quoted 2 lines
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 138 lines
Thanks,
Rafael---
From: Rafael J. Wysocki <[email protected]>
Subject: atl1c: Do not use legacy PCI power managementThe atl1c driver uses the legacy PCI power management, so it has to do some PCI-specific things in its ->suspend() and ->resume() callbacks and they are not done correctly.
Convert atl1c to the new PCI power management framework and make it let the PCI subsystem handle all of the PCI-specific aspects of device handling during system power transitions.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/net/atl1c/atl1c_main.c | 39+++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
Index:
linux-2.6/drivers/net/atl1c/atl1c_main.c
===================================================================drivers/net/atl1c/atl1c_main.c +15
-24@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struc adapter->wol =0 ; +device_set_wakeup_enable (&pdev->dev, false); adapter->link_speed =SPEED_0 ; adapter->link_duplex =FULL_DUPLEX ; adapter->num_rx_queues =AT_DEF_RECEIVE_QUEUE ;@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_devicereturn 0 ; } -static int atl1c_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1c_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev);struct atl1c_hw *hw = &adapter->hw;@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_devu32 wol_ctrl_data =0 ;u16 mii_intr_status_data =0 ;u32 wufc = adapter->wol; -int retval =0 ;atl1c_disable_l0s_l1 (hw);if (netif_running (netdev)) {@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_devatl1c_down (adapter); }netif_device_detach (netdev); - retval =pci_save_state (pdev); -if (retval) -return retval;if (wufc)if (atl1c_phy_power_saving (hw) !=0 )@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_WOL_CTRL , wol_ctrl_data);AT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data); -/* pcie patch */ -device_set_wakeup_enable (&pdev->dev,1 ); -AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_DEFAULT |GPHY_CTRL_EXT_RESET ); -pci_prepare_to_sleep (pdev); }else {AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_POWER_SAVING ); master_ctrl_data |=MASTER_CTRL_CLK_SEL_DIS ;@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data);AT_WRITE_REG (hw,REG_WOL_CTRL ,0 ); hw->phy_configured = false;/* re-init PHY when resume */ -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); } -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state)); -return 0 ; } -static int atl1c_resume (struct pci_dev *pdev) +static int atl1c_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev); -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 ); -AT_WRITE_REG (&adapter->hw,REG_WOL_CTRL ,0 );atl1c_reset_pcie (&adapter->hw,ATL1C_PCIE_L0S_L1_DISABLE |ATL1C_PCIE_PHY_RESET );@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *static void atl1c_shutdown (struct pci_dev *pdev) { -atl1c_suspend (pdev,PMSG_SUSPEND ); +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1c_adapter *adapter =netdev_priv (netdev); + +atl1c_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }static const struct net_device_ops atl1c_netdev_ops = {@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_e .resume = atl1c_io_resume, }; +static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); +static struct pci_driver atl1c_driver = { .name = atl1c_driver_name, .id_table = atl1c_pci_tbl, .probe = atl1c_probe, .remove =__devexit_p (atl1c_remove), -/* Power Managment Hooks */ - .suspend = atl1c_suspend, - .resume = atl1c_resume, .shutdown = atl1c_shutdown, - .err_handler = &atl1c_err_handler + .err_handler = &atl1c_err_handler, + .driver.pm = &atl1c_pm_ops, };/*
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Quoted 6 lines
Quoted 2 lines
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 138 lines
Thanks,
Rafael---
From: Rafael J. Wysocki <[email protected]>
Subject: atl1c: Do not use legacy PCI power managementThe atl1c driver uses the legacy PCI power management, so it has to do some PCI-specific things in its ->suspend() and ->resume() callbacks and they are not done correctly.
Convert atl1c to the new PCI power management framework and make it let the PCI subsystem handle all of the PCI-specific aspects of device handling during system power transitions.
Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/net/atl1c/atl1c_main.c | 39+++++++++++++++------------------------ 1 file changed, 15 insertions(+), 24 deletions(-)
Index:
linux-2.6/drivers/net/atl1c/atl1c_main.c
===================================================================drivers/net/atl1c/atl1c_main.c +15
-24@@ -702,6 +702,7 @@ static int __devinit atl1c_sw_init(struc adapter->wol =0 ; +device_set_wakeup_enable (&pdev->dev, false); adapter->link_speed =SPEED_0 ; adapter->link_duplex =FULL_DUPLEX ; adapter->num_rx_queues =AT_DEF_RECEIVE_QUEUE ;@@ -2444,8 +2445,9 @@ static int atl1c_close(struct net_devicereturn 0 ; } -static int atl1c_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1c_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev);struct atl1c_hw *hw = &adapter->hw;@@ -2454,7 +2456,6 @@ static int atl1c_suspend(struct pci_devu32 wol_ctrl_data =0 ;u16 mii_intr_status_data =0 ;u32 wufc = adapter->wol; -int retval =0 ;atl1c_disable_l0s_l1 (hw);if (netif_running (netdev)) {@@ -2462,9 +2463,6 @@ static int atl1c_suspend(struct pci_devatl1c_down (adapter); }netif_device_detach (netdev); - retval =pci_save_state (pdev); -if (retval) -return retval;if (wufc)if (atl1c_phy_power_saving (hw) !=0 )@@ -2525,12 +2523,8 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_WOL_CTRL , wol_ctrl_data);AT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data); -/* pcie patch */ -device_set_wakeup_enable (&pdev->dev,1 ); -AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_DEFAULT |GPHY_CTRL_EXT_RESET ); -pci_prepare_to_sleep (pdev); }else {AT_WRITE_REG (hw,REG_GPHY_CTRL ,GPHY_CTRL_POWER_SAVING ); master_ctrl_data |=MASTER_CTRL_CLK_SEL_DIS ;@@ -2540,25 +2534,17 @@ static int atl1c_suspend(struct pci_devAT_WRITE_REG (hw,REG_MAC_CTRL , mac_ctrl_data);AT_WRITE_REG (hw,REG_WOL_CTRL ,0 ); hw->phy_configured = false;/* re-init PHY when resume */ -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); } -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state)); -return 0 ; } -static int atl1c_resume (struct pci_dev *pdev) +static int atl1c_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1c_adapter *adapter =netdev_priv (netdev); -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 ); -AT_WRITE_REG (&adapter->hw,REG_WOL_CTRL ,0 );atl1c_reset_pcie (&adapter->hw,ATL1C_PCIE_L0S_L1_DISABLE |ATL1C_PCIE_PHY_RESET );@@ -2582,7 +2568,12 @@ static int atl1c_resume(struct pci_dev *static void atl1c_shutdown (struct pci_dev *pdev) { -atl1c_suspend (pdev,PMSG_SUSPEND ); +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1c_adapter *adapter =netdev_priv (netdev); + +atl1c_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }static const struct net_device_ops atl1c_netdev_ops = {@@ -2886,16 +2877,16 @@ static struct pci_error_handlers atl1c_e .resume = atl1c_io_resume, }; +static SIMPLE_DEV_PM_OPS(atl1c_pm_ops, atl1c_suspend, atl1c_resume); +static struct pci_driver atl1c_driver = { .name = atl1c_driver_name, .id_table = atl1c_pci_tbl, .probe = atl1c_probe, .remove =__devexit_p (atl1c_remove), -/* Power Managment Hooks */ - .suspend = atl1c_suspend, - .resume = atl1c_resume, .shutdown = atl1c_shutdown, - .err_handler = &atl1c_err_handler + .err_handler = &atl1c_err_handler, + .driver.pm = &atl1c_pm_ops, };/*
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 12 lines · Thomas Fjellstrom
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
Rafael
--- drivers/net/atlx/atl1.c | 77 +++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 46 deletions(-)
drivers/net/atlx/atl1.c +31 -46
@@ -950,6 +950,7 @@ static int __devinit atl1_sw_init(struct hw->min_frame_size =ETH_ZLEN +ETH_FCS_LEN ; adapter->wol =0 ; +device_set_wakeup_enable (&adapter->pdev->dev, false); adapter->rx_buffer_len = (hw->max_frame_size +7 ) & ~7 ; adapter->ict =50000 ;/* 100ms */ adapter->link_speed =SPEED_0 ;/* hardware init */
@@ -2735,15 +2736,15 @@ static int atl1_close(struct net_device }#ifdef CONFIG_PM -static int atl1_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1_adapter *adapter =netdev_priv (netdev);struct atl1_hw *hw = &adapter->hw;u32 ctrl =0 ;u32 wufc = adapter->wol;u32 val; -int retval;u16 speed;u16 duplex;
@@ -2751,17 +2752,15 @@ static int atl1_suspend(struct pci_dev *if (netif_running (netdev))atl1_down (adapter); - retval =pci_save_state (pdev); -if (retval) -return retval; -atl1_read_phy_reg (hw,MII_BMSR , (u16 *) & ctrl);atl1_read_phy_reg (hw,MII_BMSR , (u16 *) & ctrl); val = ctrl &BMSR_LSTATUS ;if (val) wufc &= ~ATLX_WUFC_LNKC ; +if (!wufc) + goto disable_wol; -if (val && wufc) { +if (val) { val =atl1_get_speed_and_duplex (hw, &speed, &duplex);if (val) {if (netif_msg_ifdown (adapter))
@@ -2798,23 +2797,18 @@ static int atl1_suspend(struct pci_dev * ctrl |=PCIE_PHYMISC_FORCE_RCV_DET ;iowrite32 (ctrl, hw->hw_addr +REG_PCIE_PHYMISC );ioread32 (hw->hw_addr +REG_PCIE_PHYMISC ); - -pci_enable_wake (pdev,pci_choose_state (pdev, state),1 ); - goto exit; - } - -if (!val && wufc) { + }else { ctrl |= (WOL_LINK_CHG_EN |WOL_LINK_CHG_PME_EN );iowrite32 (ctrl, hw->hw_addr +REG_WOL_CTRL );ioread32 (hw->hw_addr +REG_WOL_CTRL );iowrite32 (0 , hw->hw_addr +REG_MAC_CTRL );ioread32 (hw->hw_addr +REG_MAC_CTRL ); hw->phy_configured = false; -pci_enable_wake (pdev,pci_choose_state (pdev, state),1 ); - goto exit; } -disable_wol: +return 0 ; + + disable_wol:iowrite32 (0 , hw->hw_addr +REG_WOL_CTRL );ioread32 (hw->hw_addr +REG_WOL_CTRL ); ctrl =ioread32 (hw->hw_addr +REG_PCIE_PHYMISC );
@@ -2822,37 +2816,17 @@ disable_wol:iowrite32 (ctrl, hw->hw_addr +REG_PCIE_PHYMISC );ioread32 (hw->hw_addr +REG_PCIE_PHYMISC ); hw->phy_configured = false; -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); -exit: -if (netif_running (netdev)) -pci_disable_msi (adapter->pdev); -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state));return 0 ; } -static int atl1_resume (struct pci_dev *pdev) +static int atl1_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1_adapter *adapter =netdev_priv (netdev); -u32 err; -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); - - err =pci_enable_device (pdev); -if (err) { -if (netif_msg_ifup (adapter)) -dev_printk (KERN_DEBUG , &pdev->dev, -"error enabling pci device\n" ); -return err; - } - -pci_set_master (pdev);iowrite32 (0 , adapter->hw.hw_addr +REG_WOL_CTRL ); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 );atl1_reset_hw (&adapter->hw);
@@ -2864,16 +2838,25 @@ static int atl1_resume(struct pci_dev *preturn 0 ; } + +static SIMPLE_DEV_PM_OPS(atl1_pm_ops, atl1_suspend, atl1_resume); +#define ATL1_PM_OPS (&atl1_pm_ops) +#else -#define atl1_suspend NULL -#define atl1_resume NULL + +static int atl1_suspend (struct device *dev) {return 0 ; } + +#define ATL1_PM_OPS NULL#endif static void atl1_shutdown (struct pci_dev *pdev) { -#ifdef CONFIG_PM -atl1_suspend (pdev,PMSG_SUSPEND ); -#endif +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1_adapter *adapter =netdev_priv (netdev); + +atl1_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -3117,9 +3100,8 @@ static struct pci_driver atl1_driver = { .id_table = atl1_pci_tbl, .probe = atl1_probe, .remove = __devexit_p(atl1_remove), - .suspend = atl1_suspend, - .resume = atl1_resume, - .shutdown = atl1_shutdown + .shutdown = atl1_shutdown, + .driver.pm = ATL1_PM_OPS, };/*
@@ -3409,6 +3391,9 @@ static int atl1_set_wol(struct net_devic adapter->wol =0 ;if (wol->wolopts &WAKE_MAGIC ) adapter->wol |=ATLX_WUFC_MAG ; + +device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol); +return 0 ; }
Quoted 12 lines · Thomas Fjellstrom
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
Rafael
--- drivers/net/atlx/atl1.c | 77 +++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 46 deletions(-)
drivers/net/atlx/atl1.c +31 -46
@@ -950,6 +950,7 @@ static int __devinit atl1_sw_init(struct hw->min_frame_size =ETH_ZLEN +ETH_FCS_LEN ; adapter->wol =0 ; +device_set_wakeup_enable (&adapter->pdev->dev, false); adapter->rx_buffer_len = (hw->max_frame_size +7 ) & ~7 ; adapter->ict =50000 ;/* 100ms */ adapter->link_speed =SPEED_0 ;/* hardware init */
@@ -2735,15 +2736,15 @@ static int atl1_close(struct net_device }#ifdef CONFIG_PM -static int atl1_suspend (struct pci_dev *pdev,pm_message_t state) +static int atl1_suspend (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1_adapter *adapter =netdev_priv (netdev);struct atl1_hw *hw = &adapter->hw;u32 ctrl =0 ;u32 wufc = adapter->wol;u32 val; -int retval;u16 speed;u16 duplex;
@@ -2751,17 +2752,15 @@ static int atl1_suspend(struct pci_dev *if (netif_running (netdev))atl1_down (adapter); - retval =pci_save_state (pdev); -if (retval) -return retval; -atl1_read_phy_reg (hw,MII_BMSR , (u16 *) & ctrl);atl1_read_phy_reg (hw,MII_BMSR , (u16 *) & ctrl); val = ctrl &BMSR_LSTATUS ;if (val) wufc &= ~ATLX_WUFC_LNKC ; +if (!wufc) + goto disable_wol; -if (val && wufc) { +if (val) { val =atl1_get_speed_and_duplex (hw, &speed, &duplex);if (val) {if (netif_msg_ifdown (adapter))
@@ -2798,23 +2797,18 @@ static int atl1_suspend(struct pci_dev * ctrl |=PCIE_PHYMISC_FORCE_RCV_DET ;iowrite32 (ctrl, hw->hw_addr +REG_PCIE_PHYMISC );ioread32 (hw->hw_addr +REG_PCIE_PHYMISC ); - -pci_enable_wake (pdev,pci_choose_state (pdev, state),1 ); - goto exit; - } - -if (!val && wufc) { + }else { ctrl |= (WOL_LINK_CHG_EN |WOL_LINK_CHG_PME_EN );iowrite32 (ctrl, hw->hw_addr +REG_WOL_CTRL );ioread32 (hw->hw_addr +REG_WOL_CTRL );iowrite32 (0 , hw->hw_addr +REG_MAC_CTRL );ioread32 (hw->hw_addr +REG_MAC_CTRL ); hw->phy_configured = false; -pci_enable_wake (pdev,pci_choose_state (pdev, state),1 ); - goto exit; } -disable_wol: +return 0 ; + + disable_wol:iowrite32 (0 , hw->hw_addr +REG_WOL_CTRL );ioread32 (hw->hw_addr +REG_WOL_CTRL ); ctrl =ioread32 (hw->hw_addr +REG_PCIE_PHYMISC );
@@ -2822,37 +2816,17 @@ disable_wol:iowrite32 (ctrl, hw->hw_addr +REG_PCIE_PHYMISC );ioread32 (hw->hw_addr +REG_PCIE_PHYMISC ); hw->phy_configured = false; -pci_enable_wake (pdev,pci_choose_state (pdev, state),0 ); -exit: -if (netif_running (netdev)) -pci_disable_msi (adapter->pdev); -pci_disable_device (pdev); -pci_set_power_state (pdev,pci_choose_state (pdev, state));return 0 ; } -static int atl1_resume (struct pci_dev *pdev) +static int atl1_resume (struct device *dev) { +struct pci_dev *pdev =to_pci_dev (dev);struct net_device *netdev =pci_get_drvdata (pdev);struct atl1_adapter *adapter =netdev_priv (netdev); -u32 err; -pci_set_power_state (pdev,PCI_D0 ); -pci_restore_state (pdev); - - err =pci_enable_device (pdev); -if (err) { -if (netif_msg_ifup (adapter)) -dev_printk (KERN_DEBUG , &pdev->dev, -"error enabling pci device\n" ); -return err; - } - -pci_set_master (pdev);iowrite32 (0 , adapter->hw.hw_addr +REG_WOL_CTRL ); -pci_enable_wake (pdev, PCI_D3hot,0 ); -pci_enable_wake (pdev, PCI_D3cold,0 );atl1_reset_hw (&adapter->hw);
@@ -2864,16 +2838,25 @@ static int atl1_resume(struct pci_dev *preturn 0 ; } + +static SIMPLE_DEV_PM_OPS(atl1_pm_ops, atl1_suspend, atl1_resume); +#define ATL1_PM_OPS (&atl1_pm_ops) +#else -#define atl1_suspend NULL -#define atl1_resume NULL + +static int atl1_suspend (struct device *dev) {return 0 ; } + +#define ATL1_PM_OPS NULL#endif static void atl1_shutdown (struct pci_dev *pdev) { -#ifdef CONFIG_PM -atl1_suspend (pdev,PMSG_SUSPEND ); -#endif +struct net_device *netdev =pci_get_drvdata (pdev); +struct atl1_adapter *adapter =netdev_priv (netdev); + +atl1_suspend (&pdev->dev); +pci_wake_from_d3 (pdev, adapter->wol); +pci_set_power_state (pdev, PCI_D3hot); }#ifdef CONFIG_NET_POLL_CONTROLLER
@@ -3117,9 +3100,8 @@ static struct pci_driver atl1_driver = { .id_table = atl1_pci_tbl, .probe = atl1_probe, .remove = __devexit_p(atl1_remove), - .suspend = atl1_suspend, - .resume = atl1_resume, - .shutdown = atl1_shutdown + .shutdown = atl1_shutdown, + .driver.pm = ATL1_PM_OPS, };/*
@@ -3409,6 +3391,9 @@ static int atl1_set_wol(struct net_devic adapter->wol =0 ;if (wol->wolopts &WAKE_MAGIC ) adapter->wol |=ATLX_WUFC_MAG ; + +device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol); +return 0 ; }
Quoted 23 lines · Rafael J. Wysocki
Quoted 13 lines · Thomas Fjellstrom
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 9 lines
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
Rafael
Hi, I just (finally) got around to testing this, and it all works now! thanks a lot. Though to be honest, it may not have had an impact. I noticed my BIOS settings for PCI device wakeup had been disabled (I could swear they were on, but after testing the patch, and wol STILL didn't work, I didn't have any other ideas...). And it seems WOL now works on both an unpatched 2.6.36.1+autogroup, and a patched 2.6.37.
I haven't done any significant testing of this patch, other than the machine boots, the network comes up, and WOL works.
If you have any things you want me to try, to make sure the patch is correct, let me know.
Thanks again for working on the patches.
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 23 lines · Rafael J. Wysocki
Quoted 13 lines · Thomas Fjellstrom
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 9 lines
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
Rafael
Hi, I just (finally) got around to testing this, and it all works now! thanks a lot. Though to be honest, it may not have had an impact. I noticed my BIOS settings for PCI device wakeup had been disabled (I could swear they were on, but after testing the patch, and wol STILL didn't work, I didn't have any other ideas...). And it seems WOL now works on both an unpatched 2.6.36.1+autogroup, and a patched 2.6.37.
I haven't done any significant testing of this patch, other than the machine boots, the network comes up, and WOL works.
If you have any things you want me to try, to make sure the patch is correct, let me know.
Thanks again for working on the patches.
Signature · 2 lines
Thomas Fjellstrom [email protected]
Quoted 41 lines · Thomas Fjellstrom
Quoted 23 lines · Rafael J. Wysocki
Quoted 13 lines · Thomas Fjellstrom
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 9 lines
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
RafaelHi, I just (finally) got around to testing this, and it all works now! thanks a lot. Though to be honest, it may not have had an impact. I noticed my BIOS settings for PCI device wakeup had been disabled (I could swear they were on, but after testing the patch, and wol STILL didn't work, I didn't have any other ideas...). And it seems WOL now works on both an unpatched 2.6.36.1+autogroup, and a patched 2.6.37.
Quoted 7 lines
I haven't done any significant testing of this patch, other than the machine boots, the network comes up, and WOL works.
If you have any things you want me to try, to make sure the patch is correct, let me know.
Thanks again for working on the patches.
No problem, thanks for the testing. I'm going to push the patch, because it's generally needed, so it's good to know it doesn't break things at least.
Rafael
Quoted 41 lines · Thomas Fjellstrom
Quoted 23 lines · Rafael J. Wysocki
Quoted 13 lines · Thomas Fjellstrom
Quoted 12 lines · Rafael J. Wysocki
Quoted 10 lines · Thomas Fjellstrom
I can't seem to get wol to work with my desktop, which has an integrated ATL1 GbE nic. I can't be absolutely sure if it ever worked, but I think it did at one point. I can use ethtool to look at the wol status, that it supports magic-packet wol, and I can enable it, which is done at boot using an init script. But No matter how many times I try to send a wol packet to that machine it never wakes up.
Looking around on the net seems to say it is supported, and should work, but I'm not having any luck. Anyone have any hints?
Quoted 8 lines
Quoted 3 lines
It works for me with 2.6.37-rc7 and the appended patch applied (at least the machine is woken up from suspend to RAM). Of course, the adapter needs to be configured for that with the help of ethtool.
Hi, thanks for making quick work of this. I have one slight problem, my nic seems to use the atl1 driver, and not atl1c. I've tried using atl1c and atl1e, both will load if I modprobe them, but neither actually bring up the device. Even tried blacklisting atl1 first.
Quoted 9 lines
I see.
Please try the patch below, then. It's analogous to the atl1c one, but it's untested (builds for me).
Thanks,
RafaelHi, I just (finally) got around to testing this, and it all works now! thanks a lot. Though to be honest, it may not have had an impact. I noticed my BIOS settings for PCI device wakeup had been disabled (I could swear they were on, but after testing the patch, and wol STILL didn't work, I didn't have any other ideas...). And it seems WOL now works on both an unpatched 2.6.36.1+autogroup, and a patched 2.6.37.
Quoted 7 lines
I haven't done any significant testing of this patch, other than the machine boots, the network comes up, and WOL works.
If you have any things you want me to try, to make sure the patch is correct, let me know.
Thanks again for working on the patches.
No problem, thanks for the testing. I'm going to push the patch, because it's generally needed, so it's good to know it doesn't break things at least.
Rafael