diff options
author | Samuel Ortiz <samuel@sortiz.org> | 2008-07-04 04:49:31 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-07-14 14:30:06 -0400 |
commit | 49292d56352a6ab90d04c3448dd8b6106dfef2d6 (patch) | |
tree | d207a45ec1333831a82f2c9b2655b2a081ae889e | |
parent | 79d16385c7f287a33ea771c4dbe60ae43f791b49 (diff) |
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>
-rw-r--r-- | include/net/mac80211.h | 2 | ||||
-rw-r--r-- | net/mac80211/wext.c | 43 |
2 files changed, 43 insertions, 2 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 656442c6b1c3..9672a04c4f7b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -407,11 +407,13 @@ struct ieee80211_rx_status { | |||
407 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time | 407 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time |
408 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 408 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) |
409 | * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported) | 409 | * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported) |
410 | * @IEEE80211_CONF_PS: Enable 802.11 power save mode | ||
410 | */ | 411 | */ |
411 | enum ieee80211_conf_flags { | 412 | enum ieee80211_conf_flags { |
412 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), | 413 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), |
413 | IEEE80211_CONF_RADIOTAP = (1<<1), | 414 | IEEE80211_CONF_RADIOTAP = (1<<1), |
414 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), | 415 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), |
416 | IEEE80211_CONF_PS = (1<<3), | ||
415 | }; | 417 | }; |
416 | 418 | ||
417 | /** | 419 | /** |
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 736c32e340f2..207971e9ad72 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -1009,6 +1009,45 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev, | |||
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | static int ieee80211_ioctl_siwpower(struct net_device *dev, | ||
1013 | struct iw_request_info *info, | ||
1014 | struct iw_param *wrq, | ||
1015 | char *extra) | ||
1016 | { | ||
1017 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1018 | struct ieee80211_conf *conf = &local->hw.conf; | ||
1019 | |||
1020 | if (wrq->disabled) { | ||
1021 | conf->flags &= ~IEEE80211_CONF_PS; | ||
1022 | return ieee80211_hw_config(local); | ||
1023 | } | ||
1024 | |||
1025 | switch (wrq->flags & IW_POWER_MODE) { | ||
1026 | case IW_POWER_ON: /* If not specified */ | ||
1027 | case IW_POWER_MODE: /* If set all mask */ | ||
1028 | case IW_POWER_ALL_R: /* If explicitely state all */ | ||
1029 | conf->flags |= IEEE80211_CONF_PS; | ||
1030 | break; | ||
1031 | default: /* Otherwise we don't support it */ | ||
1032 | return -EINVAL; | ||
1033 | } | ||
1034 | |||
1035 | return ieee80211_hw_config(local); | ||
1036 | } | ||
1037 | |||
1038 | static int ieee80211_ioctl_giwpower(struct net_device *dev, | ||
1039 | struct iw_request_info *info, | ||
1040 | union iwreq_data *wrqu, | ||
1041 | char *extra) | ||
1042 | { | ||
1043 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
1044 | struct ieee80211_conf *conf = &local->hw.conf; | ||
1045 | |||
1046 | wrqu->power.disabled = !(conf->flags & IEEE80211_CONF_PS); | ||
1047 | |||
1048 | return 0; | ||
1049 | } | ||
1050 | |||
1012 | static int ieee80211_ioctl_siwauth(struct net_device *dev, | 1051 | static int ieee80211_ioctl_siwauth(struct net_device *dev, |
1013 | struct iw_request_info *info, | 1052 | struct iw_request_info *info, |
1014 | struct iw_param *data, char *extra) | 1053 | struct iw_param *data, char *extra) |
@@ -1211,8 +1250,8 @@ static const iw_handler ieee80211_handler[] = | |||
1211 | (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ | 1250 | (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ |
1212 | (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ | 1251 | (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ |
1213 | (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ | 1252 | (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ |
1214 | (iw_handler) NULL, /* SIOCSIWPOWER */ | 1253 | (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ |
1215 | (iw_handler) NULL, /* SIOCGIWPOWER */ | 1254 | (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */ |
1216 | (iw_handler) NULL, /* -- hole -- */ | 1255 | (iw_handler) NULL, /* -- hole -- */ |
1217 | (iw_handler) NULL, /* -- hole -- */ | 1256 | (iw_handler) NULL, /* -- hole -- */ |
1218 | (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ | 1257 | (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ |