diff options
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 80 |
1 files changed, 2 insertions, 78 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index a01154e127f0..d2d81b103341 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -306,82 +306,6 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
306 | return 0; | 306 | return 0; |
307 | } | 307 | } |
308 | 308 | ||
309 | static int ieee80211_ioctl_siwtxpower(struct net_device *dev, | ||
310 | struct iw_request_info *info, | ||
311 | union iwreq_data *data, char *extra) | ||
312 | { | ||
313 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
314 | struct ieee80211_channel* chan = local->hw.conf.channel; | ||
315 | bool reconf = false; | ||
316 | u32 reconf_flags = 0; | ||
317 | int new_power_level; | ||
318 | |||
319 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) | ||
320 | return -EINVAL; | ||
321 | if (data->txpower.flags & IW_TXPOW_RANGE) | ||
322 | return -EINVAL; | ||
323 | if (!chan) | ||
324 | return -EINVAL; | ||
325 | |||
326 | /* only change when not disabling */ | ||
327 | if (!data->txpower.disabled) { | ||
328 | if (data->txpower.fixed) { | ||
329 | if (data->txpower.value < 0) | ||
330 | return -EINVAL; | ||
331 | new_power_level = data->txpower.value; | ||
332 | /* | ||
333 | * Debatable, but we cannot do a fixed power | ||
334 | * level above the regulatory constraint. | ||
335 | * Use "iwconfig wlan0 txpower 15dBm" instead. | ||
336 | */ | ||
337 | if (new_power_level > chan->max_power) | ||
338 | return -EINVAL; | ||
339 | } else { | ||
340 | /* | ||
341 | * Automatic power level setting, max being the value | ||
342 | * passed in from userland. | ||
343 | */ | ||
344 | if (data->txpower.value < 0) | ||
345 | new_power_level = -1; | ||
346 | else | ||
347 | new_power_level = data->txpower.value; | ||
348 | } | ||
349 | |||
350 | reconf = true; | ||
351 | |||
352 | /* | ||
353 | * ieee80211_hw_config() will limit to the channel's | ||
354 | * max power and possibly power constraint from AP. | ||
355 | */ | ||
356 | local->user_power_level = new_power_level; | ||
357 | } | ||
358 | |||
359 | if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { | ||
360 | local->hw.conf.radio_enabled = !(data->txpower.disabled); | ||
361 | reconf_flags |= IEEE80211_CONF_CHANGE_RADIO_ENABLED; | ||
362 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); | ||
363 | } | ||
364 | |||
365 | if (reconf || reconf_flags) | ||
366 | ieee80211_hw_config(local, reconf_flags); | ||
367 | |||
368 | return 0; | ||
369 | } | ||
370 | |||
371 | static int ieee80211_ioctl_giwtxpower(struct net_device *dev, | ||
372 | struct iw_request_info *info, | ||
373 | union iwreq_data *data, char *extra) | ||
374 | { | ||
375 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
376 | |||
377 | data->txpower.fixed = 1; | ||
378 | data->txpower.disabled = !(local->hw.conf.radio_enabled); | ||
379 | data->txpower.value = local->hw.conf.power_level; | ||
380 | data->txpower.flags = IW_TXPOW_DBM; | ||
381 | |||
382 | return 0; | ||
383 | } | ||
384 | |||
385 | static int ieee80211_ioctl_siwpower(struct net_device *dev, | 309 | static int ieee80211_ioctl_siwpower(struct net_device *dev, |
386 | struct iw_request_info *info, | 310 | struct iw_request_info *info, |
387 | struct iw_param *wrq, | 311 | struct iw_param *wrq, |
@@ -658,8 +582,8 @@ static const iw_handler ieee80211_handler[] = | |||
658 | (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */ | 582 | (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */ |
659 | (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */ | 583 | (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */ |
660 | (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */ | 584 | (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */ |
661 | (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */ | 585 | (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */ |
662 | (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ | 586 | (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */ |
663 | (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */ | 587 | (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */ |
664 | (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */ | 588 | (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */ |
665 | (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ | 589 | (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ |