aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_ioctl.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2007-09-20 16:06:39 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:23 -0400
commit61609bc0e4d3bc677ecdccf216a0a77563f52457 (patch)
tree218ad785638f05c357571b400e0cb3fc21787ece /net/mac80211/ieee80211_ioctl.c
parent501d857ec93e797d4872d6b9b265b7472b455ddf (diff)
[MAC80211]: Add support for setting TX power and radio status
This adds support for disabling the radio and setting the TXpower through wext. This also fixes the prism TXpower ioctl (It always overwrote the TXpower value in ieee80211_hw_config()) Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/ieee80211_ioctl.c')
-rw-r--r--net/mac80211/ieee80211_ioctl.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 6ccdde82bded..b4cce441d7e6 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -666,6 +666,38 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
666 return 0; 666 return 0;
667} 667}
668 668
669static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
670 struct iw_request_info *info,
671 union iwreq_data *data, char *extra)
672{
673 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
674 bool need_reconfig = 0;
675
676 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
677 return -EINVAL;
678 if (data->txpower.flags & IW_TXPOW_RANGE)
679 return -EINVAL;
680 if (!data->txpower.fixed)
681 return -EINVAL;
682
683 if (local->hw.conf.power_level != data->txpower.value) {
684 local->hw.conf.power_level = data->txpower.value;
685 need_reconfig = 1;
686 }
687 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
688 local->hw.conf.radio_enabled = !(data->txpower.disabled);
689 need_reconfig = 1;
690 }
691 if (need_reconfig) {
692 ieee80211_hw_config(local);
693 /* The return value of hw_config is not of big interest here,
694 * as it doesn't say that it failed because of _this_ config
695 * change or something else. Ignore it. */
696 }
697
698 return 0;
699}
700
669static int ieee80211_ioctl_giwtxpower(struct net_device *dev, 701static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
670 struct iw_request_info *info, 702 struct iw_request_info *info,
671 union iwreq_data *data, char *extra) 703 union iwreq_data *data, char *extra)
@@ -1339,7 +1371,7 @@ static const iw_handler ieee80211_handler[] =
1339 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */ 1371 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
1340 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */ 1372 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
1341 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */ 1373 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
1342 (iw_handler) NULL, /* SIOCSIWTXPOW */ 1374 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
1343 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ 1375 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
1344 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */ 1376 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
1345 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ 1377 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */