Merge tag 'mac80211-next-for-davem-2015-03-30' of git://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / net / mac80211 / cfg.c
index 74f509c..265e427 100644 (file)
@@ -24,6 +24,7 @@
 
 static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
                                                const char *name,
+                                               unsigned char name_assign_type,
                                                enum nl80211_iftype type,
                                                u32 *flags,
                                                struct vif_params *params)
@@ -33,7 +34,7 @@ static struct wireless_dev *ieee80211_add_iface(struct wiphy *wiphy,
        struct ieee80211_sub_if_data *sdata;
        int err;
 
-       err = ieee80211_if_add(local, name, &wdev, type, params);
+       err = ieee80211_if_add(local, name, name_assign_type, &wdev, type, params);
        if (err)
                return ERR_PTR(err);
 
@@ -977,6 +978,14 @@ static int sta_apply_auth_flags(struct ieee80211_local *local,
        if (mask & BIT(NL80211_STA_FLAG_ASSOCIATED) &&
            set & BIT(NL80211_STA_FLAG_ASSOCIATED) &&
            !test_sta_flag(sta, WLAN_STA_ASSOC)) {
+               /*
+                * When peer becomes associated, init rate control as
+                * well. Some drivers require rate control initialized
+                * before drv_sta_state() is called.
+                */
+               if (test_sta_flag(sta, WLAN_STA_TDLS_PEER))
+                       rate_control_rate_init(sta);
+
                ret = sta_info_move_state(sta, IEEE80211_STA_ASSOC);
                if (ret)
                        return ret;
@@ -1050,6 +1059,10 @@ static int sta_apply_parameters(struct ieee80211_local *local,
                }
        }
 
+       if (mask & BIT(NL80211_STA_FLAG_WME) &&
+           local->hw.queues >= IEEE80211_NUM_ACS)
+               sta->sta.wme = set & BIT(NL80211_STA_FLAG_WME);
+
        /* auth flags will be set later for TDLS stations */
        if (!test_sta_flag(sta, WLAN_STA_TDLS_PEER)) {
                ret = sta_apply_auth_flags(local, sta, mask, set);
@@ -1064,10 +1077,8 @@ static int sta_apply_parameters(struct ieee80211_local *local,
                        clear_sta_flag(sta, WLAN_STA_SHORT_PREAMBLE);
        }
 
-       if (mask & BIT(NL80211_STA_FLAG_WME))
-               sta->sta.wme = set & BIT(NL80211_STA_FLAG_WME);
-
        if (mask & BIT(NL80211_STA_FLAG_MFP)) {
+               sta->sta.mfp = !!(set & BIT(NL80211_STA_FLAG_MFP));
                if (set & BIT(NL80211_STA_FLAG_MFP))
                        set_sta_flag(sta, WLAN_STA_MFP);
                else
@@ -1377,11 +1388,6 @@ static int ieee80211_change_station(struct wiphy *wiphy,
        if (err)
                goto out_err;
 
-       /* When peer becomes authorized, init rate control as well */
-       if (test_sta_flag(sta, WLAN_STA_TDLS_PEER) &&
-           test_sta_flag(sta, WLAN_STA_AUTHORIZED))
-               rate_control_rate_init(sta);
-
        mutex_unlock(&local->sta_mtx);
 
        if ((sdata->vif.type == NL80211_IFTYPE_AP ||
@@ -2273,7 +2279,6 @@ int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
 {
        struct sta_info *sta;
        enum ieee80211_smps_mode old_req;
-       int i;
 
        if (WARN_ON_ONCE(sdata->vif.type != NL80211_IFTYPE_AP))
                return -EINVAL;
@@ -2297,52 +2302,44 @@ int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
        }
 
        ht_dbg(sdata,
-              "SMSP %d requested in AP mode, sending Action frame to %d stations\n",
+              "SMPS %d requested in AP mode, sending Action frame to %d stations\n",
               smps_mode, atomic_read(&sdata->u.ap.num_mcast_sta));
 
        mutex_lock(&sdata->local->sta_mtx);
-       for (i = 0; i < STA_HASH_SIZE; i++) {
-               for (sta = rcu_dereference_protected(sdata->local->sta_hash[i],
-                               lockdep_is_held(&sdata->local->sta_mtx));
-                    sta;
-                    sta = rcu_dereference_protected(sta->hnext,
-                               lockdep_is_held(&sdata->local->sta_mtx))) {
-                       /*
-                        * Only stations associated to our AP and
-                        * associated VLANs
-                        */
-                       if (sta->sdata->bss != &sdata->u.ap)
-                               continue;
+       list_for_each_entry(sta, &sdata->local->sta_list, list) {
+               /*
+                * Only stations associated to our AP and
+                * associated VLANs
+                */
+               if (sta->sdata->bss != &sdata->u.ap)
+                       continue;
 
-                       /* This station doesn't support MIMO - skip it */
-                       if (sta_info_tx_streams(sta) == 1)
-                               continue;
+               /* This station doesn't support MIMO - skip it */
+               if (sta_info_tx_streams(sta) == 1)
+                       continue;
 
-                       /*
-                        * Don't wake up a STA just to send the action frame
-                        * unless we are getting more restrictive.
-                        */
-                       if (test_sta_flag(sta, WLAN_STA_PS_STA) &&
-                           !ieee80211_smps_is_restrictive(sta->known_smps_mode,
-                                                          smps_mode)) {
-                               ht_dbg(sdata,
-                                      "Won't send SMPS to sleeping STA %pM\n",
-                                      sta->sta.addr);
-                               continue;
-                       }
+               /*
+                * Don't wake up a STA just to send the action frame
+                * unless we are getting more restrictive.
+                */
+               if (test_sta_flag(sta, WLAN_STA_PS_STA) &&
+                   !ieee80211_smps_is_restrictive(sta->known_smps_mode,
+                                                  smps_mode)) {
+                       ht_dbg(sdata, "Won't send SMPS to sleeping STA %pM\n",
+                              sta->sta.addr);
+                       continue;
+               }
 
-                       /*
-                        * If the STA is not authorized, wait until it gets
-                        * authorized and the action frame will be sent then.
-                        */
-                       if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
-                               continue;
+               /*
+                * If the STA is not authorized, wait until it gets
+                * authorized and the action frame will be sent then.
+                */
+               if (!test_sta_flag(sta, WLAN_STA_AUTHORIZED))
+                       continue;
 
-                       ht_dbg(sdata, "Sending SMPS to %pM\n", sta->sta.addr);
-                       ieee80211_send_smps_action(sdata, smps_mode,
-                                                  sta->sta.addr,
-                                                  sdata->vif.bss_conf.bssid);
-               }
+               ht_dbg(sdata, "Sending SMPS to %pM\n", sta->sta.addr);
+               ieee80211_send_smps_action(sdata, smps_mode, sta->sta.addr,
+                                          sdata->vif.bss_conf.bssid);
        }
        mutex_unlock(&sdata->local->sta_mtx);
 
@@ -3581,7 +3578,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
                nullfunc->qos_ctrl = cpu_to_le16(7);
 
        local_bh_disable();
-       ieee80211_xmit(sdata, skb);
+       ieee80211_xmit(sdata, sta, skb);
        local_bh_enable();
        rcu_read_unlock();