diff options
-rw-r--r-- | net/mac80211/ieee80211_ioctl.c | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c index 9c1d076b1944..9bc209b72d41 100644 --- a/net/mac80211/ieee80211_ioctl.c +++ b/net/mac80211/ieee80211_ioctl.c | |||
@@ -863,6 +863,44 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev, | |||
863 | } | 863 | } |
864 | 864 | ||
865 | 865 | ||
866 | static int ieee80211_ioctl_siwrate(struct net_device *dev, | ||
867 | struct iw_request_info *info, | ||
868 | struct iw_param *rate, char *extra) | ||
869 | { | ||
870 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
871 | struct ieee80211_hw_mode *mode; | ||
872 | int i; | ||
873 | u32 target_rate = rate->value / 100000; | ||
874 | struct ieee80211_sub_if_data *sdata; | ||
875 | |||
876 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
877 | if (!sdata->bss) | ||
878 | return -ENODEV; | ||
879 | mode = local->oper_hw_mode; | ||
880 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates | ||
881 | * target_rate = X, rate->fixed = 1 means only rate X | ||
882 | * target_rate = X, rate->fixed = 0 means all rates <= X */ | ||
883 | sdata->bss->max_ratectrl_rateidx = -1; | ||
884 | sdata->bss->force_unicast_rateidx = -1; | ||
885 | if (rate->value < 0) | ||
886 | return 0; | ||
887 | for (i=0; i< mode->num_rates; i++) { | ||
888 | struct ieee80211_rate *rates = &mode->rates[i]; | ||
889 | int this_rate = rates->rate; | ||
890 | |||
891 | if (mode->mode == MODE_ATHEROS_TURBO || | ||
892 | mode->mode == MODE_ATHEROS_TURBOG) | ||
893 | this_rate *= 2; | ||
894 | if (target_rate == this_rate) { | ||
895 | sdata->bss->max_ratectrl_rateidx = i; | ||
896 | if (rate->fixed) | ||
897 | sdata->bss->force_unicast_rateidx = i; | ||
898 | break; | ||
899 | } | ||
900 | } | ||
901 | return 0; | ||
902 | } | ||
903 | |||
866 | static int ieee80211_ioctl_giwrate(struct net_device *dev, | 904 | static int ieee80211_ioctl_giwrate(struct net_device *dev, |
867 | struct iw_request_info *info, | 905 | struct iw_request_info *info, |
868 | struct iw_param *rate, char *extra) | 906 | struct iw_param *rate, char *extra) |
@@ -1658,7 +1696,7 @@ static const iw_handler ieee80211_handler[] = | |||
1658 | (iw_handler) NULL, /* SIOCGIWNICKN */ | 1696 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
1659 | (iw_handler) NULL, /* -- hole -- */ | 1697 | (iw_handler) NULL, /* -- hole -- */ |
1660 | (iw_handler) NULL, /* -- hole -- */ | 1698 | (iw_handler) NULL, /* -- hole -- */ |
1661 | (iw_handler) NULL, /* SIOCSIWRATE */ | 1699 | (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */ |
1662 | (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ | 1700 | (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ |
1663 | (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */ | 1701 | (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */ |
1664 | (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */ | 1702 | (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */ |