netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net (tg3): Fix failure to enable WoL by default when possible
@ 2008-12-07 23:46 Rafael J. Wysocki
  2008-12-08 11:50 ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2008-12-07 23:46 UTC (permalink / raw)
  To: Michael Chan; +Cc: netdev, Jeff Garzik, LKML

From: Rafael J. Wysocki <rjw@sisk.pl>
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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/net/tg3.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6/drivers/net/tg3.c
===================================================================
--- linux-2.6.orig/drivers/net/tg3.c
+++ 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;
 	}
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: net (tg3): Fix failure to enable WoL by default when possible
  2008-12-07 23:46 net (tg3): Fix failure to enable WoL by default when possible Rafael J. Wysocki
@ 2008-12-08 11:50 ` Rafael J. Wysocki
  2008-12-08 11:52   ` [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2) Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2008-12-08 11:50 UTC (permalink / raw)
  To: Michael Chan; +Cc: netdev, Jeff Garzik, LKML

On Monday, 8 of December 2008, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 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


> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  drivers/net/tg3.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/drivers/net/tg3.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/tg3.c
> +++ 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;
>  	}
>  
> --

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)
  2008-12-08 11:50 ` Rafael J. Wysocki
@ 2008-12-08 11:52   ` Rafael J. Wysocki
  2008-12-08 19:04     ` Matt Carlson
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2008-12-08 11:52 UTC (permalink / raw)
  To: Michael Chan; +Cc: netdev, Jeff Garzik, LKML, Andrew Morton

From: Rafael J. Wysocki <rjw@sisk.pl>
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.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/net/tg3.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6/drivers/net/tg3.c
===================================================================
--- linux-2.6.orig/drivers/net/tg3.c
+++ 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;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)
  2008-12-08 11:52   ` [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2) Rafael J. Wysocki
@ 2008-12-08 19:04     ` Matt Carlson
  2008-12-09  8:20       ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Matt Carlson @ 2008-12-08 19:04 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Michael Chan, netdev@vger.kernel.org, Jeff Garzik, LKML,
	Andrew Morton

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.

On Mon, Dec 08, 2008 at 03:52:55AM -0800, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 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.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> ---
>  drivers/net/tg3.c |   10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6/drivers/net/tg3.c
> ===================================================================
> --- linux-2.6.orig/drivers/net/tg3.c
> +++ 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;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)
  2008-12-08 19:04     ` Matt Carlson
@ 2008-12-09  8:20       ` David Miller
  2008-12-09 20:26         ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: David Miller @ 2008-12-09  8:20 UTC (permalink / raw)
  To: mcarlson; +Cc: rjw, mchan, netdev, jeff, linux-kernel, akpm

From: "Matt Carlson" <mcarlson@broadcom.com>
Date: Mon, 8 Dec 2008 11:04:03 -0800

> 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!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)
  2008-12-09  8:20       ` David Miller
@ 2008-12-09 20:26         ` Rafael J. Wysocki
  2008-12-09 20:39           ` Matt Carlson
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2008-12-09 20:26 UTC (permalink / raw)
  To: mcarlson; +Cc: David Miller, mchan, netdev, jeff, linux-kernel, akpm

On Tuesday, 9 of December 2008, David Miller wrote:
> From: "Matt Carlson" <mcarlson@broadcom.com>
> Date: Mon, 8 Dec 2008 11:04:03 -0800
> 
> > 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?

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

Rafael

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2)
  2008-12-09 20:26         ` Rafael J. Wysocki
@ 2008-12-09 20:39           ` Matt Carlson
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Carlson @ 2008-12-09 20:39 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Matthew Carlson, David Miller, Michael Chan,
	netdev@vger.kernel.org, jeff@garzik.org,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org

Sure.  I'll do it.  Standby.

On Tue, Dec 09, 2008 at 12:26:35PM -0800, Rafael J. Wysocki wrote:
> On Tuesday, 9 of December 2008, David Miller wrote:
> > From: "Matt Carlson" <mcarlson@broadcom.com>
> > Date: Mon, 8 Dec 2008 11:04:03 -0800
> > 
> > > 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?
> 
> Matt, are you going to take care of this or do you want me to do that?
> 
> Rafael
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-12-09 20:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-07 23:46 net (tg3): Fix failure to enable WoL by default when possible Rafael J. Wysocki
2008-12-08 11:50 ` Rafael J. Wysocki
2008-12-08 11:52   ` [PATCH] net (tg3): Fix failure to enable WoL by default when possible (rev. 2) Rafael J. Wysocki
2008-12-08 19:04     ` Matt Carlson
2008-12-09  8:20       ` David Miller
2008-12-09 20:26         ` Rafael J. Wysocki
2008-12-09 20:39           ` Matt Carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).