summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAndrew O. Shadoura <andrew@beldisplaytech.com>2010-07-24 18:24:17 +0200
committerDavid S. Miller <davem@davemloft.net>2010-07-26 01:48:44 +0200
commit690a1f2002a3091bd18a501f46c9530f10481463 (patch)
tree93eab8dc8cf08b72cfbe226fdcea9d85ab8b7667 /drivers/net
parentqlcnic: fix diag resource allocation (diff)
downloadlinux-690a1f2002a3091bd18a501f46c9530f10481463.tar.xz
linux-690a1f2002a3091bd18a501f46c9530f10481463.zip
3c59x: Add ethtool WOL support
This patch adds wrappers for ethtool to get or set wake-on-LAN setting without re-inserting the kernel module. Signed-off-by: Andrew O. Shadoura <andrew@beldisplaytech.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c59x.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index c44d599cc5ef..c754d88e5ec9 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -2918,6 +2918,36 @@ static void vortex_get_drvinfo(struct net_device *dev,
}
}
+static void vortex_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+ struct vortex_private *vp = netdev_priv(dev);
+
+ spin_lock_irq(&vp->lock);
+ wol->supported = WAKE_MAGIC;
+
+ wol->wolopts = 0;
+ if (vp->enable_wol)
+ wol->wolopts |= WAKE_MAGIC;
+ spin_unlock_irq(&vp->lock);
+}
+
+static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
+{
+ struct vortex_private *vp = netdev_priv(dev);
+ if (wol->wolopts & ~WAKE_MAGIC)
+ return -EINVAL;
+
+ spin_lock_irq(&vp->lock);
+ if (wol->wolopts & WAKE_MAGIC)
+ vp->enable_wol = 1;
+ else
+ vp->enable_wol = 0;
+ acpi_set_WOL(dev);
+ spin_unlock_irq(&vp->lock);
+
+ return 0;
+}
+
static const struct ethtool_ops vortex_ethtool_ops = {
.get_drvinfo = vortex_get_drvinfo,
.get_strings = vortex_get_strings,
@@ -2929,6 +2959,8 @@ static const struct ethtool_ops vortex_ethtool_ops = {
.set_settings = vortex_set_settings,
.get_link = ethtool_op_get_link,
.nway_reset = vortex_nway_reset,
+ .get_wol = vortex_get_wol,
+ .set_wol = vortex_set_wol,
};
#ifdef CONFIG_PCI