aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/wext-compat.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/wext-compat.c')
-rw-r--r--net/wireless/wext-compat.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 02f052fc1808..2e1ab78fb0d7 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -987,3 +987,63 @@ int cfg80211_wext_giwauth(struct net_device *dev,
987 return -EOPNOTSUPP; 987 return -EOPNOTSUPP;
988} 988}
989EXPORT_SYMBOL_GPL(cfg80211_wext_giwauth); 989EXPORT_SYMBOL_GPL(cfg80211_wext_giwauth);
990
991int cfg80211_wext_siwpower(struct net_device *dev,
992 struct iw_request_info *info,
993 struct iw_param *wrq, char *extra)
994{
995 struct wireless_dev *wdev = dev->ieee80211_ptr;
996 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
997 bool ps = wdev->wext.ps;
998 int timeout = wdev->wext.ps_timeout;
999 int err;
1000
1001 if (wdev->iftype != NL80211_IFTYPE_STATION)
1002 return -EINVAL;
1003
1004 if (!rdev->ops->set_power_mgmt)
1005 return -EOPNOTSUPP;
1006
1007 if (wrq->disabled) {
1008 ps = false;
1009 } else {
1010 switch (wrq->flags & IW_POWER_MODE) {
1011 case IW_POWER_ON: /* If not specified */
1012 case IW_POWER_MODE: /* If set all mask */
1013 case IW_POWER_ALL_R: /* If explicitely state all */
1014 ps = true;
1015 break;
1016 default: /* Otherwise we ignore */
1017 return -EINVAL;
1018 }
1019
1020 if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT))
1021 return -EINVAL;
1022
1023 if (wrq->flags & IW_POWER_TIMEOUT)
1024 timeout = wrq->value / 1000;
1025 }
1026
1027 err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, ps, timeout);
1028 if (err)
1029 return err;
1030
1031 wdev->wext.ps = ps;
1032 wdev->wext.ps_timeout = timeout;
1033
1034 return 0;
1035
1036}
1037EXPORT_SYMBOL_GPL(cfg80211_wext_siwpower);
1038
1039int cfg80211_wext_giwpower(struct net_device *dev,
1040 struct iw_request_info *info,
1041 struct iw_param *wrq, char *extra)
1042{
1043 struct wireless_dev *wdev = dev->ieee80211_ptr;
1044
1045 wrq->disabled = !wdev->wext.ps;
1046
1047 return 0;
1048}
1049EXPORT_SYMBOL_GPL(cfg80211_wext_giwpower);