aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-07-10 13:32:10 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-07-12 16:07:26 -0400
commit1fd5e589d8c7d3cd42ddd39358338766cfcedec8 (patch)
tree10158cea9fdca493c16f2f4790b6488091254731 /net
parent4480f15ca62a595248d6d8e2b3e75052113cde59 (diff)
[PATCH] mac80211: Implementation of SIOCSIWRATE
The WEXT ioctl SIOCSIWRATE is not implemented in mac80211. This patch adds the missing routine. It supports the 'auto' keyword, fixed rates, and the combination of 'auto' and a fixed rate to select an upper bound. Based on the patch from Mohamed Abbas <mabbas@linux.intel.com>. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Jiri Benc <jbenc@suse.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/ieee80211_ioctl.c40
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
866static 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
866static int ieee80211_ioctl_giwrate(struct net_device *dev, 904static 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 */