]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/mac80211/wext.c
Merge branch 'drm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[linux-2.6-omap-h63xx.git] / net / mac80211 / wext.c
index beae664ab4801eff2204b75cb404367f414a33d4..742f811ca416e5b16701ce2ae49f582ed32317a6 100644 (file)
@@ -122,8 +122,8 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
        if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
                return -EOPNOTSUPP;
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length);
                if (ret)
                        return ret;
@@ -273,21 +273,21 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev,
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        int type;
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN)
+       if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
                return -EOPNOTSUPP;
 
        switch (*mode) {
        case IW_MODE_INFRA:
-               type = IEEE80211_IF_TYPE_STA;
+               type = NL80211_IFTYPE_STATION;
                break;
        case IW_MODE_ADHOC:
-               type = IEEE80211_IF_TYPE_IBSS;
+               type = NL80211_IFTYPE_ADHOC;
                break;
        case IW_MODE_REPEAT:
-               type = IEEE80211_IF_TYPE_WDS;
+               type = NL80211_IFTYPE_WDS;
                break;
        case IW_MODE_MONITOR:
-               type = IEEE80211_IF_TYPE_MNTR;
+               type = NL80211_IFTYPE_MONITOR;
                break;
        default:
                return -EINVAL;
@@ -305,22 +305,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
        switch (sdata->vif.type) {
-       case IEEE80211_IF_TYPE_AP:
+       case NL80211_IFTYPE_AP:
                *mode = IW_MODE_MASTER;
                break;
-       case IEEE80211_IF_TYPE_STA:
+       case NL80211_IFTYPE_STATION:
                *mode = IW_MODE_INFRA;
                break;
-       case IEEE80211_IF_TYPE_IBSS:
+       case NL80211_IFTYPE_ADHOC:
                *mode = IW_MODE_ADHOC;
                break;
-       case IEEE80211_IF_TYPE_MNTR:
+       case NL80211_IFTYPE_MONITOR:
                *mode = IW_MODE_MONITOR;
                break;
-       case IEEE80211_IF_TYPE_WDS:
+       case NL80211_IFTYPE_WDS:
                *mode = IW_MODE_REPEAT;
                break;
-       case IEEE80211_IF_TYPE_VLAN:
+       case NL80211_IFTYPE_AP_VLAN:
                *mode = IW_MODE_SECOND;         /* FIXME */
                break;
        default:
@@ -330,47 +330,19 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev,
        return 0;
 }
 
-int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
-{
-       int ret = -EINVAL;
-       struct ieee80211_channel *chan;
-       struct ieee80211_local *local = sdata->local;
-
-       chan = ieee80211_get_channel(local->hw.wiphy, freqMHz);
-
-       if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
-               if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS &&
-                   chan->flags & IEEE80211_CHAN_NO_IBSS) {
-                       printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
-                               "%d MHz\n", sdata->dev->name, chan->center_freq);
-                       return ret;
-               }
-               local->oper_channel = chan;
-
-               if (local->sta_sw_scanning || local->sta_hw_scanning)
-                       ret = 0;
-               else
-                       ret = ieee80211_hw_config(local);
-
-               rate_control_clear(local);
-       }
-
-       return ret;
-}
-
 static int ieee80211_ioctl_siwfreq(struct net_device *dev,
                                   struct iw_request_info *info,
                                   struct iw_freq *freq, char *extra)
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
+       if (sdata->vif.type == NL80211_IFTYPE_STATION)
                sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
 
        /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
        if (freq->e == 0) {
                if (freq->m < 0) {
-                       if (sdata->vif.type == IEEE80211_IF_TYPE_STA)
+                       if (sdata->vif.type == NL80211_IFTYPE_STATION)
                                sdata->u.sta.flags |=
                                        IEEE80211_STA_AUTO_CHANNEL_SEL;
                        return 0;
@@ -414,8 +386,8 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
                len--;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                int ret;
                if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
                        if (len > IEEE80211_MAX_SSID_LEN)
@@ -435,7 +407,7 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev,
                return 0;
        }
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
+       if (sdata->vif.type == NL80211_IFTYPE_AP) {
                memcpy(sdata->u.ap.ssid, ssid, len);
                memset(sdata->u.ap.ssid + len, 0,
                       IEEE80211_MAX_SSID_LEN - len);
@@ -454,8 +426,8 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
 
        struct ieee80211_sub_if_data *sdata;
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                int res = ieee80211_sta_get_ssid(sdata, ssid, &len);
                if (res == 0) {
                        data->length = len;
@@ -465,7 +437,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
                return res;
        }
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
+       if (sdata->vif.type == NL80211_IFTYPE_AP) {
                len = sdata->u.ap.ssid_len;
                if (len > IW_ESSID_MAX_SIZE)
                        len = IW_ESSID_MAX_SIZE;
@@ -485,8 +457,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
        struct ieee80211_sub_if_data *sdata;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                int ret;
                if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
                        memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
@@ -505,7 +477,7 @@ static int ieee80211_ioctl_siwap(struct net_device *dev,
                        return ret;
                ieee80211_sta_req_auth(sdata, &sdata->u.sta);
                return 0;
-       } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
+       } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
                /*
                 * If it is necessary to update the WDS peer address
                 * while the interface is running, then we need to do
@@ -533,8 +505,8 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
        struct ieee80211_sub_if_data *sdata;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED ||
                    sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) {
                        ap_addr->sa_family = ARPHRD_ETHER;
@@ -544,7 +516,7 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
                        memset(&ap_addr->sa_data, 0, ETH_ALEN);
                        return 0;
                }
-       } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) {
+       } else if (sdata->vif.type == NL80211_IFTYPE_WDS) {
                ap_addr->sa_family = ARPHRD_ETHER;
                memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
                return 0;
@@ -566,10 +538,10 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
        if (!netif_running(dev))
                return -ENETDOWN;
 
-       if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
-           sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
-           sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT &&
-           sdata->vif.type != IEEE80211_IF_TYPE_AP)
+       if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+           sdata->vif.type != NL80211_IFTYPE_ADHOC &&
+           sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+           sdata->vif.type != NL80211_IFTYPE_AP)
                return -EOPNOTSUPP;
 
        /* if SSID was specified explicitly then use that */
@@ -580,7 +552,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
                ssid_len = req->essid_len;
        }
 
-       return ieee80211_sta_req_scan(sdata, ssid, ssid_len);
+       return ieee80211_request_scan(sdata, ssid, ssid_len);
 }
 
 
@@ -594,10 +566,10 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev,
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       if (local->sta_sw_scanning || local->sta_hw_scanning)
+       if (local->sw_scanning || local->hw_scanning)
                return -EAGAIN;
 
-       res = ieee80211_sta_scan_results(local, info, extra, data->length);
+       res = ieee80211_scan_results(local, info, extra, data->length);
        if (res >= 0) {
                data->length = res;
                return 0;
@@ -655,7 +627,7 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
+       if (sdata->vif.type != NL80211_IFTYPE_STATION)
                return -EOPNOTSUPP;
 
        sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
@@ -664,8 +636,8 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev,
 
        sta = sta_info_get(local, sdata->u.sta.bssid);
 
-       if (sta && sta->txrate_idx < sband->n_bitrates)
-               rate->value = sband->bitrates[sta->txrate_idx].bitrate;
+       if (sta && sta->last_txrate_idx < sband->n_bitrates)
+               rate->value = sband->bitrates[sta->last_txrate_idx].bitrate;
        else
                rate->value = 0;
 
@@ -803,7 +775,7 @@ static int ieee80211_ioctl_siwfrag(struct net_device *dev,
         * configure it here */
 
        if (local->ops->set_frag_threshold)
-               local->ops->set_frag_threshold(
+               return local->ops->set_frag_threshold(
                        local_to_hw(local),
                        local->fragmentation_threshold);
 
@@ -886,8 +858,8 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev,
        struct iw_mlme *mlme = (struct iw_mlme *) extra;
 
        sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       if (sdata->vif.type != IEEE80211_IF_TYPE_STA &&
-           sdata->vif.type != IEEE80211_IF_TYPE_IBSS)
+       if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+           sdata->vif.type != NL80211_IFTYPE_ADHOC)
                return -EINVAL;
 
        switch (mlme->cmd) {
@@ -982,7 +954,7 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev,
        erq->length = sdata->keys[idx]->conf.keylen;
        erq->flags |= IW_ENCODE_ENABLED;
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA) {
+       if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                struct ieee80211_if_sta *ifsta = &sdata->u.sta;
                switch (ifsta->auth_alg) {
                case WLAN_AUTH_OPEN:
@@ -1056,7 +1028,7 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
                sdata->drop_unencrypted = !!data->value;
                break;
        case IW_AUTH_PRIVACY_INVOKED:
-               if (sdata->vif.type != IEEE80211_IF_TYPE_STA)
+               if (sdata->vif.type != NL80211_IFTYPE_STATION)
                        ret = -EINVAL;
                else {
                        sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
@@ -1071,8 +1043,8 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
                }
                break;
        case IW_AUTH_80211_AUTH_ALG:
-               if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-                   sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
+               if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC)
                        sdata->u.sta.auth_algs = data->value;
                else
                        ret = -EOPNOTSUPP;
@@ -1094,8 +1066,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
 
        rcu_read_lock();
 
-       if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-           sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
+       if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+           sdata->vif.type == NL80211_IFTYPE_ADHOC)
                sta = sta_info_get(local, sdata->u.sta.bssid);
        if (!sta) {
                wstats->discard.fragment = 0;
@@ -1125,8 +1097,8 @@ static int ieee80211_ioctl_giwauth(struct net_device *dev,
 
        switch (data->flags & IW_AUTH_INDEX) {
        case IW_AUTH_80211_AUTH_ALG:
-               if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
-                   sdata->vif.type == IEEE80211_IF_TYPE_IBSS)
+               if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC)
                        data->value = sdata->u.sta.auth_algs;
                else
                        ret = -EOPNOTSUPP;