Skip to contentSkip to conversation

net (tg3): Fix failure to enable WoL by default when possible

PATCH In review Rafael J. Wysocki 3 participants 7 messages Dec 7, 2008 – Dec 9, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

From: Rafael J. Wysocki <[email protected]>
Subject: net (tg3): Fix failure to enable WoL by default when possible

tg3 is supposed to enable WoL by default on adapters which support that, but it fails to do so unless the adapter's /sys/devices/.../power/wakeup file contains 'enabled' during the initialization of the adapter. Fix that by making tg3 update the device's 'should_wakeup' bit automatically whenever WoL should be enabled by default.

---
 drivers/net/tg3.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/tg3.c +3 -2
Index: linux-2.6/drivers/net/tg3.c
===================================================================
@@ -11296,9 +11296,10 @@ static void __devinit tg3_get_eeprom_hw_
 		if (val & VCPU_CFGSHDW_ASPM_DBNC)
 			tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
 		if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
-		    (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+			device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 		return;
 	}
 
#1 lore raw
Quoted 9 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>
Subject: net (tg3): Fix failure to enable WoL by default when possible

tg3 is supposed to enable WoL by default on adapters which support that, but it fails to do so unless the adapter's /sys/devices/.../power/wakeup file contains 'enabled' during the initialization of the adapter. Fix that by making tg3 update the device's 'should_wakeup' bit automatically whenever WoL should be enabled by default.

This version of the patch is incomplete, because there's one more place where an analogous change has to be made.

I'll send the updated patch in a reply to this message.

Thanks,
Rafael

Quoted 23 lines
---
 drivers/net/tg3.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/net/tg3.c
===================================================================

drivers/net/tg3.c +3 -3
@@ -11296,9 +11296,10 @@ static void __devinit tg3_get_eeprom_hw_
 		if (val & VCPU_CFGSHDW_ASPM_DBNC)
 			tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
 		if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
-		    (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+			device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 		return;
 	}
 
--
#2 lore raw

PATCH 1/1 net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

From: Rafael J. Wysocki <[email protected]>
Subject: net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

tg3 is supposed to enable WoL by default on adapters which support that, but it fails to do so unless the adapter's /sys/devices/.../power/wakeup file contains 'enabled' during the initialization of the adapter. Fix that by making tg3 update the device's 'should_wakeup' bit automatically whenever WoL should be enabled by default.

---
 drivers/net/tg3.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/net/tg3.c +6 -4
Index: linux-2.6/drivers/net/tg3.c
===================================================================
@@ -11296,9 +11296,10 @@ static void __devinit tg3_get_eeprom_hw_
 		if (val & VCPU_CFGSHDW_ASPM_DBNC)
 			tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
 		if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
-		    (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+			device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 		return;
 	}
 
@@ -11428,9 +11429,10 @@ static void __devinit tg3_get_eeprom_hw_
 			tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
 
 		if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
-		    (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+		    	device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 
 		if (cfg2 & (1 << 17))
 			tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING;
#3 lore raw

Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

This has mostly been fixed up already in Dave Miller's tree. In that tree, the WOL capability advertisements happens at the end of the tg3_get_eeprom_hw_cfg() function.

Your patch did uncover a bug though. The removal of device_may_wakeup() in the first hunk of your patch still needs to be done.

Quoted 50 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>
Subject: net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

tg3 is supposed to enable WoL by default on adapters which support that, but it fails to do so unless the adapter's /sys/devices/.../power/wakeup file contains 'enabled' during the initialization of the adapter. Fix that by making tg3 update the device's 'should_wakeup' bit automatically whenever WoL should be enabled by default.

---
 drivers/net/tg3.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/net/tg3.c
===================================================================

drivers/net/tg3.c +6 -5
@@ -11296,9 +11296,10 @@ static void __devinit tg3_get_eeprom_hw_
 		if (val & VCPU_CFGSHDW_ASPM_DBNC)
 			tp->tg3_flags |= TG3_FLAG_ASPM_WORKAROUND;
 		if ((val & VCPU_CFGSHDW_WOL_ENABLE) &&
-		    (val & VCPU_CFGSHDW_WOL_MAGPKT) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (val & VCPU_CFGSHDW_WOL_MAGPKT)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+			device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 		return;
 	}
 
@@ -11428,9 +11429,10 @@ static void __devinit tg3_get_eeprom_hw_
 			tp->tg3_flags &= ~TG3_FLAG_WOL_CAP;
 
 		if ((tp->tg3_flags & TG3_FLAG_WOL_CAP) &&
-		    (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE) &&
-		    device_may_wakeup(&tp->pdev->dev))
+		    (nic_cfg & NIC_SRAM_DATA_CFG_WOL_ENABLE)) {
 			tp->tg3_flags |= TG3_FLAG_WOL_ENABLE;
+		    	device_set_wakeup_enable(&tp->pdev->dev, true);
+		}
 
 		if (cfg2 & (1 << 17))
 			tp->tg3_flags2 |= TG3_FLG2_CAPACITIVE_COUPLING;
--

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

maintainer
#4 lore raw

Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

From: "Matt Carlson" <[email protected]>
Date: Mon, 8 Dec 2008 11:04:03 -0800

Quoted 6 lines

This has mostly been fixed up already in Dave Miller's tree. In that tree, the WOL capability advertisements happens at the end of the tg3_get_eeprom_hw_cfg() function.

Your patch did uncover a bug though. The removal of device_may_wakeup() in the first hunk of your patch still needs to be done.

Ok, can someone post a patch that takes care of that against net-next-2.6?

Thanks in advance!

#5 lore raw

Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

Quoted 7 lines · David Miller

From: "Matt Carlson" <[email protected]>
Date: Mon, 8 Dec 2008 11:04:03 -0800

Quoted 4 lines

This has mostly been fixed up already in Dave Miller's tree. In that tree, the WOL capability advertisements happens at the end of the tg3_get_eeprom_hw_cfg() function.

Quoted 5 lines
Quoted 2 lines

Your patch did uncover a bug though. The removal of device_may_wakeup() in the first hunk of your patch still needs to be done.

Ok, can someone post a patch that takes care of that against net-next-2.6?

Matt, are you going to take care of this or do you want me to do that?

Rafael

#6 lore raw

Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)

Sure. I'll do it. Standby.

Quoted 18 lines · Rafael J. Wysocki
Quoted 7 lines · David Miller

From: "Matt Carlson" <[email protected]>
Date: Mon, 8 Dec 2008 11:04:03 -0800

Quoted 4 lines

This has mostly been fixed up already in Dave Miller's tree. In that tree, the WOL capability advertisements happens at the end of the tg3_get_eeprom_hw_cfg() function.

Quoted 5 lines
Quoted 2 lines

Your patch did uncover a bug though. The removal of device_may_wakeup() in the first hunk of your patch still needs to be done.

Ok, can someone post a patch that takes care of that against net-next-2.6?

Matt, are you going to take care of this or do you want me to do that?

Rafael