aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/ethtool.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-12 20:06:06 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:05 -0500
commit506e9025e030c441679fb1ae77fb0d6266c34443 (patch)
tree9869587068fae691b9bdee93c6b9df85ef786023 /drivers/net/wireless/libertas/ethtool.c
parentd1f7a5b8cfefdb443a05a9e3d636fe7fef57459a (diff)
libertas: add ethtool support for wake-on-lan configuration
Also, check that suspend is refused if HOST_SLEEP_CFG hasn't been done. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/ethtool.c')
-rw-r--r--drivers/net/wireless/libertas/ethtool.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index a54b4f406af2..21e6f988ea81 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -8,6 +8,8 @@
8#include "dev.h" 8#include "dev.h"
9#include "join.h" 9#include "join.h"
10#include "wext.h" 10#include "wext.h"
11#include "cmd.h"
12
11static const char * mesh_stat_strings[]= { 13static const char * mesh_stat_strings[]= {
12 "drop_duplicate_bcast", 14 "drop_duplicate_bcast",
13 "drop_ttl_zero", 15 "drop_ttl_zero",
@@ -172,6 +174,49 @@ static void lbs_ethtool_get_strings(struct net_device *dev,
172 lbs_deb_enter(LBS_DEB_ETHTOOL); 174 lbs_deb_enter(LBS_DEB_ETHTOOL);
173} 175}
174 176
177static void lbs_ethtool_get_wol(struct net_device *dev,
178 struct ethtool_wolinfo *wol)
179{
180 struct lbs_private *priv = dev->priv;
181
182 if (priv->wol_criteria == 0xffffffff) {
183 /* Interface driver didn't configure wake */
184 wol->supported = wol->wolopts = 0;
185 return;
186 }
187
188 wol->supported = WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY;
189
190 if (priv->wol_criteria & EHS_WAKE_ON_UNICAST_DATA)
191 wol->wolopts |= WAKE_UCAST;
192 if (priv->wol_criteria & EHS_WAKE_ON_MULTICAST_DATA)
193 wol->wolopts |= WAKE_MCAST;
194 if (priv->wol_criteria & EHS_WAKE_ON_BROADCAST_DATA)
195 wol->wolopts |= WAKE_BCAST;
196 if (priv->wol_criteria & EHS_WAKE_ON_MAC_EVENT)
197 wol->wolopts |= WAKE_PHY;
198}
199
200static int lbs_ethtool_set_wol(struct net_device *dev,
201 struct ethtool_wolinfo *wol)
202{
203 struct lbs_private *priv = dev->priv;
204 uint32_t criteria = 0;
205
206 if (priv->wol_criteria == 0xffffffff && wol->wolopts)
207 return -EOPNOTSUPP;
208
209 if (wol->wolopts & ~(WAKE_UCAST|WAKE_MCAST|WAKE_BCAST|WAKE_PHY))
210 return -EOPNOTSUPP;
211
212 if (wol->wolopts & WAKE_UCAST) criteria |= EHS_WAKE_ON_UNICAST_DATA;
213 if (wol->wolopts & WAKE_MCAST) criteria |= EHS_WAKE_ON_MULTICAST_DATA;
214 if (wol->wolopts & WAKE_BCAST) criteria |= EHS_WAKE_ON_BROADCAST_DATA;
215 if (wol->wolopts & WAKE_PHY) criteria |= EHS_WAKE_ON_MAC_EVENT;
216
217 return lbs_host_sleep_cfg(priv, criteria);
218}
219
175struct ethtool_ops lbs_ethtool_ops = { 220struct ethtool_ops lbs_ethtool_ops = {
176 .get_drvinfo = lbs_ethtool_get_drvinfo, 221 .get_drvinfo = lbs_ethtool_get_drvinfo,
177 .get_eeprom = lbs_ethtool_get_eeprom, 222 .get_eeprom = lbs_ethtool_get_eeprom,
@@ -179,5 +224,7 @@ struct ethtool_ops lbs_ethtool_ops = {
179 .get_sset_count = lbs_ethtool_get_sset_count, 224 .get_sset_count = lbs_ethtool_get_sset_count,
180 .get_ethtool_stats = lbs_ethtool_get_stats, 225 .get_ethtool_stats = lbs_ethtool_get_stats,
181 .get_strings = lbs_ethtool_get_strings, 226 .get_strings = lbs_ethtool_get_strings,
227 .get_wol = lbs_ethtool_get_wol,
228 .set_wol = lbs_ethtool_set_wol,
182}; 229};
183 230