Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1fd5e589d8c7d3cd42ddd39358338766cfcedec8
Commit:     1fd5e589d8c7d3cd42ddd39358338766cfcedec8
Parent:     4480f15ca62a595248d6d8e2b3e75052113cde59
Author:     Larry Finger <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 10 19:32:10 2007 +0200
Committer:  John W. Linville <[EMAIL PROTECTED]>
CommitDate: Thu Jul 12 16:07:26 2007 -0400

    [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 <[EMAIL PROTECTED]>.
    
    Signed-off-by: Larry Finger <[EMAIL PROTECTED]>
    Signed-off-by: Jiri Benc <[EMAIL PROTECTED]>
    Signed-off-by: John W. Linville <[EMAIL PROTECTED]>
---
 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 9c1d076..9bc209b 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,
 }
 
 
+static int ieee80211_ioctl_siwrate(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_param *rate, char *extra)
+{
+       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_hw_mode *mode;
+       int i;
+       u32 target_rate = rate->value / 100000;
+       struct ieee80211_sub_if_data *sdata;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       if (!sdata->bss)
+               return -ENODEV;
+       mode = local->oper_hw_mode;
+       /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
+        * target_rate = X, rate->fixed = 1 means only rate X
+        * target_rate = X, rate->fixed = 0 means all rates <= X */
+       sdata->bss->max_ratectrl_rateidx = -1;
+       sdata->bss->force_unicast_rateidx = -1;
+       if (rate->value < 0)
+               return 0;
+       for (i=0; i< mode->num_rates; i++) {
+               struct ieee80211_rate *rates = &mode->rates[i];
+               int this_rate = rates->rate;
+
+               if (mode->mode == MODE_ATHEROS_TURBO ||
+                   mode->mode == MODE_ATHEROS_TURBOG)
+                       this_rate *= 2;
+               if (target_rate == this_rate) {
+                       sdata->bss->max_ratectrl_rateidx = i;
+                       if (rate->fixed)
+                               sdata->bss->force_unicast_rateidx = i;
+                       break;
+               }
+       }
+       return 0;
+}
+
 static int ieee80211_ioctl_giwrate(struct net_device *dev,
                                  struct iw_request_info *info,
                                  struct iw_param *rate, char *extra)
@@ -1658,7 +1696,7 @@ static const iw_handler ieee80211_handler[] =
        (iw_handler) NULL,                              /* SIOCGIWNICKN */
        (iw_handler) NULL,                              /* -- hole -- */
        (iw_handler) NULL,                              /* -- hole -- */
-       (iw_handler) NULL,                              /* SIOCSIWRATE */
+       (iw_handler) ieee80211_ioctl_siwrate,           /* SIOCSIWRATE */
        (iw_handler) ieee80211_ioctl_giwrate,           /* SIOCGIWRATE */
        (iw_handler) ieee80211_ioctl_siwrts,            /* SIOCSIWRTS */
        (iw_handler) ieee80211_ioctl_giwrts,            /* SIOCGIWRTS */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to