aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/mac80211/ieee80211.c7
-rw-r--r--net/mac80211/ieee80211_ioctl.c34
2 files changed, 39 insertions, 2 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 4229d150e783..23853331e8db 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -704,7 +704,12 @@ int ieee80211_hw_config(struct ieee80211_local *local)
704 704
705 local->hw.conf.channel = chan->chan; 705 local->hw.conf.channel = chan->chan;
706 local->hw.conf.channel_val = chan->val; 706 local->hw.conf.channel_val = chan->val;
707 local->hw.conf.power_level = chan->power_level; 707 if (!local->hw.conf.power_level) {
708 local->hw.conf.power_level = chan->power_level;
709 } else {
710 local->hw.conf.power_level = min(chan->power_level,
711 local->hw.conf.power_level);
712 }
708 local->hw.conf.freq = chan->freq; 713 local->hw.conf.freq = chan->freq;
709 local->hw.conf.phymode = mode->mode; 714 local->hw.conf.phymode = mode->mode;
710 local->hw.conf.antenna_max = chan->antenna_max; 715 local->hw.conf.antenna_max = chan->antenna_max;
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 */