diff options
author | Samuel Ortiz <samuel@sortiz.org> | 2008-07-04 10:49:31 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-14 14:30:06 -0400 |
commit | 49292d56352a6ab90d04c3448dd8b6106dfef2d6 (patch) | |
tree | d207a45ec1333831a82f2c9b2655b2a081ae889e /net/mac80211 | |
parent | 79d16385c7f287a33ea771c4dbe60ae43f791b49 (diff) | |
download | linux-3.10-49292d56352a6ab90d04c3448dd8b6106dfef2d6.tar.gz linux-3.10-49292d56352a6ab90d04c3448dd8b6106dfef2d6.tar.bz2 linux-3.10-49292d56352a6ab90d04c3448dd8b6106dfef2d6.zip |
mac80211: power management wext hooks
This patch implements the power management routines wireless extensions
for mac80211.
For now we only support switching PS mode between on and off.
Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/wext.c | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 736c32e340f..207971e9ad7 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c @@ -1009,6 +1009,45 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev, return 0; } +static int ieee80211_ioctl_siwpower(struct net_device *dev, + struct iw_request_info *info, + struct iw_param *wrq, + char *extra) +{ + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); + struct ieee80211_conf *conf = &local->hw.conf; + + if (wrq->disabled) { + conf->flags &= ~IEEE80211_CONF_PS; + return ieee80211_hw_config(local); + } + + switch (wrq->flags & IW_POWER_MODE) { + case IW_POWER_ON: /* If not specified */ + case IW_POWER_MODE: /* If set all mask */ + case IW_POWER_ALL_R: /* If explicitely state all */ + conf->flags |= IEEE80211_CONF_PS; + break; + default: /* Otherwise we don't support it */ + return -EINVAL; + } + + return ieee80211_hw_config(local); +} + +static int ieee80211_ioctl_giwpower(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, + char *extra) +{ + struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); + struct ieee80211_conf *conf = &local->hw.conf; + + wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS); + + return 0; +} + static int ieee80211_ioctl_siwauth(struct net_device *dev, struct iw_request_info *info, struct iw_param *data, char *extra) @@ -1211,8 +1250,8 @@ static const iw_handler ieee80211_handler[] = (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ - (iw_handler) NULL, /* SIOCSIWPOWER */ - (iw_handler) NULL, /* SIOCGIWPOWER */ + (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ + (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) NULL, /* -- hole -- */ (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ |