netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sky2: Enable/disable WOL per hardware device
@ 2010-01-19 14:11 Mike McCormack
  2010-01-22  6:50 ` David Miller
  2010-01-23 10:09 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Mike McCormack @ 2010-01-19 14:11 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Y2_HW_WOL_ON/Y2_HW_WOL_OFF should be set and cleared per chip,
not per port.  On dual port cards, Y2_HW_WOL_ON should be
enabled if either sky2 port has WOL enabled.

Found while reviewing code for a WOL regression, though this is
probably not the cause of the regression.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
---
 drivers/net/sky2.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 4c06020..d86b7e8 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3238,6 +3238,27 @@ static inline u8 sky2_wol_supported(const struct sky2_hw *hw)
 	return sky2_is_copper(hw) ? (WAKE_PHY | WAKE_MAGIC) : 0;
 }
 
+static void sky2_hw_set_wol(struct sky2_hw *hw)
+{
+	int wol = 0;
+	int i;
+
+	for (i = 0; i < hw->ports; i++) {
+		struct net_device *dev = hw->dev[i];
+		struct sky2_port *sky2 = netdev_priv(dev);
+
+		if (sky2->wol)
+			wol = 1;
+	}
+
+	if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
+	    hw->chip_id == CHIP_ID_YUKON_EX ||
+	    hw->chip_id == CHIP_ID_YUKON_FE_P)
+		sky2_write32(hw, B0_CTST, wol ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
+
+	device_set_wakeup_enable(&hw->pdev->dev, wol);
+}
+
 static void sky2_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
 	const struct sky2_port *sky2 = netdev_priv(dev);
@@ -3257,13 +3278,7 @@ static int sky2_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 
 	sky2->wol = wol->wolopts;
 
-	if (hw->chip_id == CHIP_ID_YUKON_EC_U ||
-	    hw->chip_id == CHIP_ID_YUKON_EX ||
-	    hw->chip_id == CHIP_ID_YUKON_FE_P)
-		sky2_write32(hw, B0_CTST, sky2->wol
-			     ? Y2_HW_WOL_ON : Y2_HW_WOL_OFF);
-
-	device_set_wakeup_enable(&hw->pdev->dev, sky2->wol);
+	sky2_hw_set_wol(hw);
 
 	if (!netif_running(dev))
 		sky2_wol_init(sky2);
-- 
1.5.6.5


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

* Re: [PATCH] sky2: Enable/disable WOL per hardware device
  2010-01-19 14:11 [PATCH] sky2: Enable/disable WOL per hardware device Mike McCormack
@ 2010-01-22  6:50 ` David Miller
  2010-01-23 10:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-01-22  6:50 UTC (permalink / raw)
  To: mikem; +Cc: shemminger, netdev

From: Mike McCormack <mikem@ring3k.org>
Date: Tue, 19 Jan 2010 23:11:26 +0900

> Y2_HW_WOL_ON/Y2_HW_WOL_OFF should be set and cleared per chip,
> not per port.  On dual port cards, Y2_HW_WOL_ON should be
> enabled if either sky2 port has WOL enabled.
> 
> Found while reviewing code for a WOL regression, though this is
> probably not the cause of the regression.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>

Stephen?  ACK?

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

* Re: [PATCH] sky2: Enable/disable WOL per hardware device
  2010-01-19 14:11 [PATCH] sky2: Enable/disable WOL per hardware device Mike McCormack
  2010-01-22  6:50 ` David Miller
@ 2010-01-23 10:09 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-01-23 10:09 UTC (permalink / raw)
  To: mikem; +Cc: shemminger, netdev

From: Mike McCormack <mikem@ring3k.org>
Date: Tue, 19 Jan 2010 23:11:26 +0900

> Y2_HW_WOL_ON/Y2_HW_WOL_OFF should be set and cleared per chip,
> not per port.  On dual port cards, Y2_HW_WOL_ON should be
> enabled if either sky2 port has WOL enabled.
> 
> Found while reviewing code for a WOL regression, though this is
> probably not the cause of the regression.
> 
> Signed-off-by: Mike McCormack <mikem@ring3k.org>

Applied, thanks Mike.

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

end of thread, other threads:[~2010-01-23 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-19 14:11 [PATCH] sky2: Enable/disable WOL per hardware device Mike McCormack
2010-01-22  6:50 ` David Miller
2010-01-23 10:09 ` David Miller

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).