]> err.no Git - linux-2.6/blobdiff - net/mac80211/ieee80211_ioctl.c
[PATCH] mac80211: kill rate control ioctls
[linux-2.6] / net / mac80211 / ieee80211_ioctl.c
index 352f03bd8a3adcd8104212e1bf731c8961a4af46..f404f1f4251d2233b7418475f9a8c296b380b4c2 100644 (file)
@@ -345,6 +345,8 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
        struct iw_range *range = (struct iw_range *) extra;
+       struct ieee80211_hw_mode *mode = NULL;
+       int c = 0;
 
        data->length = sizeof(struct iw_range);
        memset(range, 0, sizeof(struct iw_range));
@@ -378,6 +380,29 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
        range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
                          IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
 
+       list_for_each_entry(mode, &local->modes_list, list) {
+               int i = 0;
+
+               if (!(local->enabled_modes & (1 << mode->mode)) ||
+                   (local->hw_modes & local->enabled_modes &
+                    (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B))
+                       continue;
+
+               while (i < mode->num_channels && c < IW_MAX_FREQUENCIES) {
+                       struct ieee80211_channel *chan = &mode->channels[i];
+
+                       if (chan->flag & IEEE80211_CHAN_W_SCAN) {
+                               range->freq[c].i = chan->chan;
+                               range->freq[c].m = chan->freq * 100000;
+                               range->freq[c].e = 1;
+                               c++;
+                       }
+                       i++;
+               }
+       }
+       range->num_channels = c;
+       range->num_frequency = c;
+
        IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
        IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
        IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
@@ -838,6 +863,29 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev,
 }
 
 
+static int ieee80211_ioctl_giwrate(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 sta_info *sta;
+       struct ieee80211_sub_if_data *sdata;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       if (sdata->type == IEEE80211_IF_TYPE_STA)
+               sta = sta_info_get(local, sdata->u.sta.bssid);
+       else
+               return -EOPNOTSUPP;
+       if (!sta)
+               return -ENODEV;
+       if (sta->txrate < local->oper_hw_mode->num_rates)
+               rate->value = local->oper_hw_mode->rates[sta->txrate].rate * 100000;
+       else
+               rate->value = 0;
+       sta_info_put(sta);
+       return 0;
+}
+
 static int ieee80211_ioctl_siwrts(struct net_device *dev,
                                  struct iw_request_info *info,
                                  struct iw_param *rts, char *extra)
@@ -1026,62 +1074,6 @@ static int ieee80211_ioctl_clear_keys(struct net_device *dev)
 }
 
 
-static int
-ieee80211_ioctl_force_unicast_rate(struct net_device *dev,
-                                  struct ieee80211_sub_if_data *sdata,
-                                  int rate)
-{
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_hw_mode *mode;
-       int i;
-
-       if (sdata->type != IEEE80211_IF_TYPE_AP)
-               return -ENOENT;
-
-       if (rate == 0) {
-               sdata->u.ap.force_unicast_rateidx = -1;
-               return 0;
-       }
-
-       mode = local->oper_hw_mode;
-       for (i = 0; i < mode->num_rates; i++) {
-               if (mode->rates[i].rate == rate) {
-                       sdata->u.ap.force_unicast_rateidx = i;
-                       return 0;
-               }
-       }
-       return -EINVAL;
-}
-
-
-static int
-ieee80211_ioctl_max_ratectrl_rate(struct net_device *dev,
-                                 struct ieee80211_sub_if_data *sdata,
-                                 int rate)
-{
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_hw_mode *mode;
-       int i;
-
-       if (sdata->type != IEEE80211_IF_TYPE_AP)
-               return -ENOENT;
-
-       if (rate == 0) {
-               sdata->u.ap.max_ratectrl_rateidx = -1;
-               return 0;
-       }
-
-       mode = local->oper_hw_mode;
-       for (i = 0; i < mode->num_rates; i++) {
-               if (mode->rates[i].rate == rate) {
-                       sdata->u.ap.max_ratectrl_rateidx = i;
-                       return 0;
-               }
-       }
-       return -EINVAL;
-}
-
-
 static void ieee80211_key_enable_hwaccel(struct ieee80211_local *local,
                                         struct ieee80211_key *key)
 {
@@ -1269,22 +1261,6 @@ static int ieee80211_ioctl_prism2_param(struct net_device *dev,
                local->sta_antenna_sel = value;
                break;
 
-       case PRISM2_PARAM_FORCE_UNICAST_RATE:
-               ret = ieee80211_ioctl_force_unicast_rate(dev, sdata, value);
-               break;
-
-       case PRISM2_PARAM_MAX_RATECTRL_RATE:
-               ret = ieee80211_ioctl_max_ratectrl_rate(dev, sdata, value);
-               break;
-
-       case PRISM2_PARAM_RATE_CTRL_NUM_UP:
-               local->rate_ctrl_num_up = value;
-               break;
-
-       case PRISM2_PARAM_RATE_CTRL_NUM_DOWN:
-               local->rate_ctrl_num_down = value;
-               break;
-
        case PRISM2_PARAM_TX_POWER_REDUCTION:
                if (value < 0)
                        ret = -EINVAL;
@@ -1403,14 +1379,6 @@ static int ieee80211_ioctl_get_prism2_param(struct net_device *dev,
                *param = local->sta_antenna_sel;
                break;
 
-       case PRISM2_PARAM_RATE_CTRL_NUM_UP:
-               *param = local->rate_ctrl_num_up;
-               break;
-
-       case PRISM2_PARAM_RATE_CTRL_NUM_DOWN:
-               *param = local->rate_ctrl_num_down;
-               break;
-
        case PRISM2_PARAM_TX_POWER_REDUCTION:
                *param = local->hw.conf.tx_power_reduction;
                break;
@@ -1779,7 +1747,7 @@ static const iw_handler ieee80211_handler[] =
        (iw_handler) NULL,                              /* -- hole -- */
        (iw_handler) NULL,                              /* -- hole -- */
        (iw_handler) NULL,                              /* SIOCSIWRATE */
-       (iw_handler) NULL,                              /* SIOCGIWRATE */
+       (iw_handler) ieee80211_ioctl_giwrate,           /* SIOCGIWRATE */
        (iw_handler) ieee80211_ioctl_siwrts,            /* SIOCSIWRTS */
        (iw_handler) ieee80211_ioctl_giwrts,            /* SIOCGIWRTS */
        (iw_handler) ieee80211_ioctl_siwfrag,           /* SIOCSIWFRAG */