diff options
author | Andrew O. Shadoura <andrew@beldisplaytech.com> | 2010-07-24 12:24:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-25 19:48:44 -0400 |
commit | 690a1f2002a3091bd18a501f46c9530f10481463 (patch) | |
tree | 93eab8dc8cf08b72cfbe226fdcea9d85ab8b7667 /drivers/net/3c59x.c | |
parent | 57e46248a71bfcafb3937a7a5ed8ad324c9fc4f0 (diff) |
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/3c59x.c')
-rw-r--r-- | drivers/net/3c59x.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index c44d599cc5e..c754d88e5ec 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -2918,6 +2918,36 @@ static void vortex_get_drvinfo(struct net_device *dev, | |||
2918 | } | 2918 | } |
2919 | } | 2919 | } |
2920 | 2920 | ||
2921 | static void vortex_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
2922 | { | ||
2923 | struct vortex_private *vp = netdev_priv(dev); | ||
2924 | |||
2925 | spin_lock_irq(&vp->lock); | ||
2926 | wol->supported = WAKE_MAGIC; | ||
2927 | |||
2928 | wol->wolopts = 0; | ||
2929 | if (vp->enable_wol) | ||
2930 | wol->wolopts |= WAKE_MAGIC; | ||
2931 | spin_unlock_irq(&vp->lock); | ||
2932 | } | ||
2933 | |||
2934 | static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | ||
2935 | { | ||
2936 | struct vortex_private *vp = netdev_priv(dev); | ||
2937 | if (wol->wolopts & ~WAKE_MAGIC) | ||
2938 | return -EINVAL; | ||
2939 | |||
2940 | spin_lock_irq(&vp->lock); | ||
2941 | if (wol->wolopts & WAKE_MAGIC) | ||
2942 | vp->enable_wol = 1; | ||
2943 | else | ||
2944 | vp->enable_wol = 0; | ||
2945 | acpi_set_WOL(dev); | ||
2946 | spin_unlock_irq(&vp->lock); | ||
2947 | |||
2948 | return 0; | ||
2949 | } | ||
2950 | |||
2921 | static const struct ethtool_ops vortex_ethtool_ops = { | 2951 | static const struct ethtool_ops vortex_ethtool_ops = { |
2922 | .get_drvinfo = vortex_get_drvinfo, | 2952 | .get_drvinfo = vortex_get_drvinfo, |
2923 | .get_strings = vortex_get_strings, | 2953 | .get_strings = vortex_get_strings, |
@@ -2929,6 +2959,8 @@ static const struct ethtool_ops vortex_ethtool_ops = { | |||
2929 | .set_settings = vortex_set_settings, | 2959 | .set_settings = vortex_set_settings, |
2930 | .get_link = ethtool_op_get_link, | 2960 | .get_link = ethtool_op_get_link, |
2931 | .nway_reset = vortex_nway_reset, | 2961 | .nway_reset = vortex_nway_reset, |
2962 | .get_wol = vortex_get_wol, | ||
2963 | .set_wol = vortex_set_wol, | ||
2932 | }; | 2964 | }; |
2933 | 2965 | ||
2934 | #ifdef CONFIG_PCI | 2966 | #ifdef CONFIG_PCI |