igb/e1000e/e1000/e100: make wol usable
Subsystems (2)
PATCH 1/1 igb/e1000e/e1000/e100: make wol usable
It seems that the patches that intended to use the new calls to check status and capabilities for WOL and fix it up:
commit bc79fc8409b3dccbde072e8113cc1fb3fd876fc5
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Oct 29 14:22:18 2008 -0700
e100: adapt to the reworked PCI PM
commit e1b86d8479f90aadee57a3d07d8e61c815c202d9
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:37 2008 +0000
igb: Use device_set_wakeup_enable
commit de1264896c8012a261c1cba17e6a61199c276ad3
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:19 2008 +0000
e1000: Use device_set_wakeup_enable
commit 6ff68026f4757d68461b7fbeca5c944e1f5f8b44
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Nov 12 09:52:32 2008 +0000
e1000e: Use device_set_wakeup_enable
Unfortunately they left out some important bits. This should make sure the e100, igb, e1000e, and e1000-based devices can actually enable WOL rather than their current state which is reported as not supported.
This looks like it has been broken since 2.6.28.
---
e100.c | 1 + e1000/e1000_main.c | 1 + e1000e/netdev.c | 1 + igb/igb_main.c | 1 + 4 files changed, 4 insertions(+)
drivers/net/e100.c +1 -0
@@ -2816,6 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,if ((nic->mac >= mac_82558_D101_A4) && (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; +device_init_wakeup (&pdev->dev, true);device_set_wakeup_enable (&pdev->dev, true); }
drivers/net/e1000/e1000_main.c +1 -0
@@ -1208,6 +1208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* print bus type/speed/width info */
drivers/net/e1000e/netdev.c +1 -0
@@ -5196,6 +5196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* save off EEPROM version number */
drivers/net/igb/igb_main.c +1 -0
@@ -1475,6 +1475,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* reset the hardware with the new settings */
Quoted 103 lines
-----Original Message-----
From: Andy Gospodarek [mailto:[email protected]]
Sent: Tuesday, July 21, 2009 2:01 PM
To: [email protected]
Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Waskiewicz Jr, Peter P; Ronciak, John; [email protected]
Subject: [PATCH] igb/e1000e/e1000/e100: make wol usableIt seems that the patches that intended to use the new calls to check status and capabilities for WOL and fix it up:
commit
bc79fc8409b3dccbde072e8113cc1fb3fd876fc5
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Oct 29 14:22:18 2008 -0700e100: adapt to the reworked PCI PM
commit
e1b86d8479f90aadee57a3d07d8e61c815c202d9
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:37 2008 +0000igb: Use
device_set_wakeup_enablecommit
de1264896c8012a261c1cba17e6a61199c276ad3
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:19 2008 +0000e1000: Use
device_set_wakeup_enablecommit
6ff68026f4757d68461b7fbeca5c944e1f5f8b44
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Nov 12 09:52:32 2008 +0000e1000e: Use
device_set_wakeup_enableUnfortunately they left out some important bits. This should make sure the e100, igb, e1000e, and e1000-based devices can actually enable WOL rather than their current state which is reported as not supported.
This looks like it has been broken since 2.6.28.
Signed-off-by Andy Gospodarek <[email protected]>---
e100.c | 1 + e1000/e1000_main.c | 1 + e1000e/netdev.c | 1 + igb/igb_main.c | 1 + 4 files changed, 4 insertions(+)drivers/net/e100.c +1
-0@@ -2816,6 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, if ((nic->mac >= mac_82558_D101_A4) && (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; +device_init_wakeup (&pdev->dev, true);device_set_wakeup_enable (&pdev->dev, true); }drivers/net/e1000/e1000_main.c +1
-0@@ -1208,6 +1208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* print bus type/speed/width info */drivers/net/e1000e/netdev.c +1
-0@@ -5196,6 +5196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* save off EEPROM version number */drivers/net/igb/igb_main.c +1
-0@@ -1475,6 +1475,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);
Quoted 1 line
/* reset the hardware with the new settings */
Andy,
WoL not supported is reported back when WoL is disabled in the EEPROM. So if this is happening to you, that system (or at least that interface) has WoL disabled. How are you testing this?
Cheers,
John
-----------------------------------------------------------
"...that your people will judge you on what you can build, not what you destroy.", B. Obama, 2009
Quoted 103 lines · John
Quoted 103 lines
-----Original Message-----
From: Andy Gospodarek [mailto:[email protected]]
Sent: Tuesday, July 21, 2009 2:01 PM
To: [email protected]
Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Waskiewicz Jr, Peter P; Ronciak, John; [email protected]
Subject: [PATCH] igb/e1000e/e1000/e100: make wol usableIt seems that the patches that intended to use the new calls to check status and capabilities for WOL and fix it up:
commit
bc79fc8409b3dccbde072e8113cc1fb3fd876fc5
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Oct 29 14:22:18 2008 -0700e100: adapt to the reworked PCI PM
commit
e1b86d8479f90aadee57a3d07d8e61c815c202d9
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:37 2008 +0000igb: Use
device_set_wakeup_enablecommit
de1264896c8012a261c1cba17e6a61199c276ad3
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:19 2008 +0000e1000: Use
device_set_wakeup_enablecommit
6ff68026f4757d68461b7fbeca5c944e1f5f8b44
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Nov 12 09:52:32 2008 +0000e1000e: Use
device_set_wakeup_enableUnfortunately they left out some important bits. This should make sure the e100, igb, e1000e, and e1000-based devices can actually enable WOL rather than their current state which is reported as not supported.
This looks like it has been broken since 2.6.28.
Signed-off-by Andy Gospodarek <[email protected]>---
e100.c | 1 + e1000/e1000_main.c | 1 + e1000e/netdev.c | 1 + igb/igb_main.c | 1 + 4 files changed, 4 insertions(+)drivers/net/e100.c +1
-0@@ -2816,6 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev, if ((nic->mac >= mac_82558_D101_A4) && (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; +device_init_wakeup (&pdev->dev, true);device_set_wakeup_enable (&pdev->dev, true); }drivers/net/e1000/e1000_main.c +1
-0@@ -1208,6 +1208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* print bus type/speed/width info */drivers/net/e1000e/netdev.c +1
-0@@ -5196,6 +5196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* save off EEPROM version number */drivers/net/igb/igb_main.c +1
-0@@ -1475,6 +1475,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; +device_init_wakeup (&adapter->pdev->dev, adapter->wol);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);
Quoted 7 lines
Quoted 1 line
/* reset the hardware with the new settings */Andy,
WoL not supported is reported back when WoL is disabled in the EEPROM. So if this is happening to you, that system (or at least that interface) has WoL disabled. How are you testing this?
Cheers,
John
John,
I'm not doing anything differently than what the eeprom is reporting as support with these patches. In every one of the drivers above, the enabling of ethtool first calls device_can_wakeup. That inline function is pretty simple and all it does is return the value of dev->power.can_wakeup. If never set, dev->power.can_wakeup is false and wol status can never be set.
The proper way to set it would be to call dev_init_wakeup first (or simply call it). Take a look at the code and you will see what I'm talking about.
Now that I'm looking at it again, this patch would probably be better anyway:
Replace device_set_wakeup_enable calls with device_init_wakeup, so that calls to device_can_wakeup in each drivers' code will not fail each time. The intent of the calls to device_can_wakeup were added to ensure the device was enabled for WOL, but without the proper call to device_init_wakeup, any call to device_can_wakeup will always return false.
---
e100.c | 2 +- e1000/e1000_main.c | 2 +- e1000e/netdev.c | 2 +- igb/igb_main.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/e100.c +1 -1
@@ -2816,7 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,if ((nic->mac >= mac_82558_D101_A4) && (nic->eeprom[eeprom_id] & eeprom_id_wol)) { nic->flags |= wol_magic; -device_set_wakeup_enable (&pdev->dev, true); +device_init_wakeup (&pdev->dev, true); }/* ack any pending wake events, disable PME */
drivers/net/e1000/e1000_main.c +1 -1
@@ -1208,7 +1208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; -device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol); +device_init_wakeup (&adapter->pdev->dev, adapter->wol);/* print bus type/speed/width info */ DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ",
drivers/net/e1000e/netdev.c +1 -1
@@ -5196,7 +5196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; -device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol); +device_init_wakeup (&adapter->pdev->dev, adapter->wol);/* save off EEPROM version number */ e1000_read_nvm (&adapter->hw,5 ,1 , &adapter->eeprom_vers);
drivers/net/igb/igb_main.c +1 -1
@@ -1475,7 +1475,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,/* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; -device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol); +device_init_wakeup (&adapter->pdev->dev, adapter->wol);/* reset the hardware with the new settings */ igb_reset (adapter);
My understanding was that the can_wakeup was supposed to be initialized by pci_pm_init or platform_pci_wakeup_init based on the pci-e capabilities. Is this not the case? It seems like this is where you should be looking to determine why the the can_wakeup isn't being initialized correctly.
The patch below won't solve the problem either. The problem is that the can_wakeup value is being disabled when the EEPROM doesn't support WOL.
If you have to do this in the drivers, then my suggestion is to take a look at how ixgbe is doing it. You essentially need to initialize can_wakeup to true, and then set the should_wakeup attribute based on the EEPROM setting or via ethtool. This way you can still toggle the should_wakeup option without being blocked by the EEPROM disabling it.
Thanks,
Alex
Quoted 207 lines · Andy Gospodarek
Quoted 103 lines · John
Quoted 103 lines
-----Original Message-----
From: Andy Gospodarek [mailto:[email protected]]
Sent: Tuesday, July 21, 2009 2:01 PM
To: [email protected]
Cc: Kirsher, Jeffrey T; Brandeburg, Jesse; Allan, Bruce W; Waskiewicz Jr, Peter P; Ronciak, John; [email protected]
Subject: [PATCH] igb/e1000e/e1000/e100: make wol usableIt seems that the patches that intended to use the new calls to check status and capabilities for WOL and fix it up:
commit
bc79fc8409b3dccbde072e8113cc1fb3fd876fc5
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Oct 29 14:22:18 2008 -0700e100: adapt to the reworked PCI PM
commit
e1b86d8479f90aadee57a3d07d8e61c815c202d9
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:37 2008 +0000igb: Use
device_set_wakeup_enablecommit
de1264896c8012a261c1cba17e6a61199c276ad3
Author: Rafael J. Wysocki <[email protected]>
Date: Fri Nov 7 20:30:19 2008 +0000e1000: Use
device_set_wakeup_enablecommit
6ff68026f4757d68461b7fbeca5c944e1f5f8b44
Author: Rafael J. Wysocki <[email protected]>
Date: Wed Nov 12 09:52:32 2008 +0000e1000e: Use
device_set_wakeup_enableUnfortunately they left out some important bits. This should make sure the e100, igb, e1000e, and e1000-based devices can actually enable WOL rather than their current state which is reported as not supported.
This looks like it has been broken since 2.6.28.
Signed-off-by Andy Gospodarek <[email protected]>---
e100.c| 1 +e1000/e1000_main.c| 1 +e1000e/netdev.c| 1 +igb/igb_main.c| 1 +4 files changed, 4 insertions(+)drivers/net/e100.c +0
-0@@ -2816,6 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,if ((
nic->mac>=mac_82558_D101_A4) && (nic->eeprom[eeprom_id] &eeprom_id_wol)) {nic->flags|=wol_magic;
+ device_init_wakeup(&pdev->dev, true);device_set_wakeup_enable(&pdev->dev, true); }drivers/net/e1000/e1000_main.c +1
-0@@ -1208,6 +1208,7 @@ static int __devinit e1000_probe(structpci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; + device_init_wakeup(&adapter->pdev->dev, adapter->wol); device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);/* print bus type/speed/width info */
drivers/net/e1000e/netdev.c +1
-0@@ -5196,6 +5196,7 @@ static int __devinit e1000_probe(structpci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; + device_init_wakeup(&adapter->pdev->dev, adapter->wol); device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);/* save off EEPROM version number */
drivers/net/igb/igb_main.c +1
-0@@ -1475,6 +1475,7 @@ static int __devinit igb_probe(structpci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; + device_init_wakeup(&adapter->pdev->dev, adapter->wol); device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);Quoted 7 lines
Quoted 1 line
/* reset the hardware with the new settings */
Andy,
WoL not supported is reported back when WoL is disabled in the EEPROM. So if this is happening to you, that system (or at least that interface) has WoL disabled. How are you testing this?
Cheers,
JohnJohn,
I'm not doing anything differently than what the eeprom is reporting as support with these patches. In every one of the drivers above, the enabling of ethtool first calls
device_can_wakeup. That inline function is pretty simple and all it does is return the value ofdev->power.can_wakeup. If never set,dev->power.can_wakeupis false and wol status can never be set.The proper way to set it would be to call
dev_init_wakeupfirst (or simply call it). Take a look at the code and you will see what I'm talking about.Now that I'm looking at it again, this patch would probably be better anyway:
Replace
device_set_wakeup_enablecalls withdevice_init_wakeup, so that calls todevice_can_wakeupin each drivers' code will not fail each time. The intent of the calls todevice_can_wakeupwere added to ensure the device was enabled for WOL, but without the proper call todevice_init_wakeup, any call todevice_can_wakeupwill always return false.Signed-off-by Andy Gospodarek <[email protected]>---
e100.c | 2 +-
e1000/e1000_main.c | 2 +-
e1000e/netdev.c | 2 +-
igb/igb_main.c | 2 +-4 files changed, 4 insertions(+), 4 deletions(-)drivers/net/e100.c +0
-0@@ -2816,7 +2816,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,if ((
nic->mac>=mac_82558_D101_A4) && (nic->eeprom[eeprom_id] &eeprom_id_wol)) {nic->flags|=wol_magic;
-device_set_wakeup_enable(&pdev->dev, true);
+device_init_wakeup(&pdev->dev, true); }/* ack any pending wake events, disable PME */
drivers/net/e1000/e1000_main.c +1
-1@@ -1208,7 +1208,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; - device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); + device_init_wakeup(&adapter->pdev->dev, adapter->wol); /* print bus type/speed/width info */ DPRINTK(PROBE, INFO, "(PCI%s:%s:%s) ",drivers/net/e1000e/netdev.c +1
-1@@ -5196,7 +5196,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; - device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); + device_init_wakeup(&adapter->pdev->dev, adapter->wol); /* save off EEPROM version number */ e1000_read_nvm(&adapter->hw, 5, 1, &adapter->eeprom_vers);drivers/net/igb/igb_main.c +1
-2@@ -1475,7 +1475,7 @@ static int __devinit igb_probe(struct pci_dev *pdev, /* initialize the wol settings based on the eeprom settings */ adapter->wol = adapter->eeprom_wol; - device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); + device_init_wakeup(&adapter->pdev->dev, adapter->wol); /* reset the hardware with the new settings */ igb_reset(adapter); --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
David Miller
maintainerFrom: Alexander Duyck <[email protected]>
Date: Tue, 21 Jul 2009 20:25:31 -0700
Quoted 10 lines
My understanding was that the
can_wakeupwas supposed to be initialized bypci_pm_initorplatform_pci_wakeup_initbased on the pci-e capabilities. Is this not the case? It seems like this is where you should be looking to determine why the thecan_wakeupisn't being initialized correctly.The patch below won't solve the problem either. The problem is that the
can_wakeupvalue is being disabled when the EEPROM doesn't support WOL.
Quoted 5 lines
If you have to do this in the drivers, then my suggestion is to take a look at how ixgbe is doing it. You essentially need to initialize
can_wakeupto true, and then set theshould_wakeupattribute based on the EEPROM setting or via ethtool. This way you can still toggle theshould_wakeupoption without being blocked by the EEPROM disabling it.
It looks like the approach needs to be worked out still, so I'm tossing these patches from patchwork.
Let me know when a more final fix is ready.
Thanks.
Quoted 9 lines · Alexander Duyck
My understanding was that the
can_wakeupwas supposed to be initialized bypci_pm_initorplatform_pci_wakeup_initbased on the pci-e capabilities. Is this not the case? It seems like this is where you should be looking to determine why the thecan_wakeupisn't being initialized correctly.The patch below won't solve the problem either. The problem is that the
can_wakeupvalue is being disabled when the EEPROM doesn't support WOL.
The lack of EEPROM support for this was not the problem at all. Ultimately it turns out that can_wakeup is set in pci_pm_init, so calls to device_init_wakeup and device_set_wakeup_capable should not be needed in any driver.
Quoted 5 lines
If you have to do this in the drivers, then my suggestion is to take a look at how ixgbe is doing it. You essentially need to initialize
can_wakeupto true, and then set theshould_wakeupattribute based on the EEPROM setting or via ethtool. This way you can still toggle theshould_wakeupoption without being blocked by the EEPROM disabling it.
The first patch does exactly that (and ixgbe was part of my inspiration for it). Since can_wakeup and should_wakeup are both set in device_init_wakeup it's a suitable alternative in driver probe functions, but probably not ideal when drivers check for device_can_wakeup in their ethtool set_wol functions.
Anyway, I knew I would find a bug or unnecessary code between e1000e and friends or ixgbe, so it looks like ixgbe has an unnecessary call to device_init_wakeup. Feel free to consider this patch as an alternative.
[PATCH] ixgbe: remove unnecessary call to device_init_wakeup
Calls to device_init_wakeup should not be necessary in drivers that use device_set_wakeup_enable since pci_pm_init will set the can_wakeup flag for the device when initialized.
I can't test this since I don't have any of the 82599 KX4 interfaces (the only ones capable of WOL), but I did instrument ixgbe_probe and know that can_wakeup=1 when device_init_wakeup is removed.
---
ixgbe_main.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ixgbe/ixgbe_main.c +0 -1
@@ -5640,7 +5640,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, adapter->wol =0 ;break ; } -device_init_wakeup (&adapter->pdev->dev, true);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* pick up the PCI bus settings for reporting later */
Quoted 22 lines
[PATCH] ixgbe: remove unnecessary call to
device_init_wakeupCalls to
device_init_wakeupshould not be necessary in drivers that usedevice_set_wakeup_enablesincepci_pm_initwill set thecan_wakeupflag for the device when initialized.I can't test this since I don't have any of the 82599 KX4 interfaces (the only ones capable of WOL), but I did instrument
ixgbe_probeand know that can_wakeup=1 whendevice_init_wakeupis removed.Signed-off-by Andy Gospodarek <[email protected]>---
ixgbe_main.c | 1 - 1 file changed, 1 deletion(-)drivers/net/ixgbe/ixgbe_main.c +0
-0
drivers/net/ixgbe/ixgbe_main.c static int __devinit ixgbe_probe(struct pci_dev *pdev, · line 5645
Quoted 7 lines
drivers/net/ixgbe/ixgbe_main.c +0
-1@@ -5640,7 +5640,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, adapter->wol =0 ;break ; } -device_init_wakeup (&adapter->pdev->dev, true);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* pick up the PCI bus settings for reporting later */
I need to rebuild one of my boxes in the lab that I do WoL testing on for ixgbe devices. That shouldn't take me long, and I'll test this. If it works as expected, I'll send my ack.
Cheers,
-PJ Waskiewicz
Waskiewicz Jr, Peter P
Acked-byQuoted 56 lines · Andy Gospodarek
Quoted 9 lines · Alexander Duyck
My understanding was that the
can_wakeupwas supposed to be initialized bypci_pm_initorplatform_pci_wakeup_initbased on the pci-e capabilities. Is this not the case? It seems like this is where you should be looking to determine why the thecan_wakeupisn't being initialized correctly.The patch below won't solve the problem either. The problem is that the
can_wakeupvalue is being disabled when the EEPROM doesn't support WOL.The lack of EEPROM support for this was not the problem at all. Ultimately it turns out that
can_wakeupis set inpci_pm_init, so calls todevice_init_wakeupanddevice_set_wakeup_capableshould not be needed in any driver.Quoted 5 lines
If you have to do this in the drivers, then my suggestion is to take a look at how ixgbe is doing it. You essentially need to initialize
can_wakeupto true, and then set theshould_wakeupattribute based on the EEPROM setting or via ethtool. This way you can still toggle theshould_wakeupoption without being blocked by the EEPROM disabling it.The first patch does exactly that (and ixgbe was part of my inspiration for it). Since
can_wakeupandshould_wakeupare both set indevice_init_wakeupit's a suitable alternative in driver probe functions, but probably not ideal when drivers check fordevice_can_wakeupin their ethtoolset_wolfunctions.Anyway, I knew I would find a bug or unnecessary code between e1000e and friends or ixgbe, so it looks like ixgbe has an unnecessary call to
device_init_wakeup. Feel free to consider this patch as an alternative.[PATCH] ixgbe: remove unnecessary call to
device_init_wakeupCalls to
device_init_wakeupshould not be necessary in drivers that usedevice_set_wakeup_enablesincepci_pm_initwill set thecan_wakeupflag for the device when initialized.I can't test this since I don't have any of the 82599 KX4 interfaces (the only ones capable of WOL), but I did instrument
ixgbe_probeand know that can_wakeup=1 whendevice_init_wakeupis removed.Signed-off-by Andy Gospodarek <[email protected]>---
ixgbe_main.c | 1 - 1 file changed, 1 deletion(-)drivers/net/ixgbe/ixgbe_main.c +0
-0
drivers/net/ixgbe/ixgbe_main.c static int __devinit ixgbe_probe(struct pci_dev *pdev, · line 5645
Quoted 7 lines
drivers/net/ixgbe/ixgbe_main.c +0
-1@@ -5640,7 +5640,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, adapter->wol =0 ;break ; } -device_init_wakeup (&adapter->pdev->dev, true);device_set_wakeup_enable (&adapter->pdev->dev, adapter->wol);/* pick up the PCI bus settings for reporting later */
Works just fine on two different 82599 mezz cards that support WoL. Thanks Andy for finding and fixing.
From: "Waskiewicz Jr, Peter P" <[email protected]>
Date: Wed, 22 Jul 2009 16:43:03 -0700 (Pacific Daylight Time)
Quoted 13 lines · Andy Gospodarek
Quoted 12 lines
[PATCH] ixgbe: remove unnecessary call to
device_init_wakeupCalls to
device_init_wakeupshould not be necessary in drivers that usedevice_set_wakeup_enablesincepci_pm_initwill set thecan_wakeupflag for the device when initialized.I can't test this since I don't have any of the 82599 KX4 interfaces (the only ones capable of WOL), but I did instrument
ixgbe_probeand know that can_wakeup=1 whendevice_init_wakeupis removed.Signed-off-by Andy Gospodarek <[email protected]>
...
Quoted 4 lines
Works just fine on two different 82599 mezz cards that support WoL. Thanks Andy for finding and fixing.
Applied, thanks.