]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/mac80211/mlme.c
Merge tag 'iommu-updates-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux.git] / net / mac80211 / mlme.c
index bcf5ffc1567a4ff1c6054f7aecc0aa28dfd2c3fa..687821567287104451d429d84db8192a7a8e1b24 100644 (file)
@@ -916,6 +916,15 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
                ieee80211_add_vht_ie(sdata, skb, sband,
                                     &assoc_data->ap_vht_cap);
 
+       /*
+        * If AP doesn't support HT, mark HE as disabled.
+        * If on the 5GHz band, make sure it supports VHT.
+        */
+       if (ifmgd->flags & IEEE80211_STA_DISABLE_HT ||
+           (sband->band == NL80211_BAND_5GHZ &&
+            ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
+               ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
+
        if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
                ieee80211_add_he_ie(sdata, skb, sband);
 
@@ -1869,7 +1878,7 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local,
        struct ieee80211_tx_queue_params params[IEEE80211_NUM_ACS];
        struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
        size_t left;
-       int count, ac;
+       int count, mu_edca_count, ac;
        const u8 *pos;
        u8 uapsd_queues = 0;
 
@@ -1889,9 +1898,16 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local,
                uapsd_queues = ifmgd->uapsd_queues;
 
        count = wmm_param[6] & 0x0f;
-       if (count == ifmgd->wmm_last_param_set)
+       /* -1 is the initial value of ifmgd->mu_edca_last_param_set.
+        * if mu_edca was preset before and now it disappeared tell
+        * the driver about it.
+        */
+       mu_edca_count = mu_edca ? mu_edca->mu_qos_info & 0x0f : -1;
+       if (count == ifmgd->wmm_last_param_set &&
+           mu_edca_count == ifmgd->mu_edca_last_param_set)
                return false;
        ifmgd->wmm_last_param_set = count;
+       ifmgd->mu_edca_last_param_set = mu_edca_count;
 
        pos = wmm_param + 8;
        left = wmm_param_len - 8;
@@ -3062,6 +3078,19 @@ static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
        }
 }
 
+static bool ieee80211_twt_req_supported(const struct sta_info *sta,
+                                       const struct ieee802_11_elems *elems)
+{
+       if (elems->ext_capab_len < 10)
+               return false;
+
+       if (!(elems->ext_capab[9] & WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT))
+               return false;
+
+       return sta->sta.he_cap.he_cap_elem.mac_cap_info[0] &
+               IEEE80211_HE_MAC_CAP0_TWT_RES;
+}
+
 static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
                                    struct cfg80211_bss *cbss,
                                    struct ieee80211_mgmt *mgmt, size_t len)
@@ -3215,16 +3244,6 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
                goto out;
        }
 
-       /*
-        * If AP doesn't support HT, or it doesn't have HE mandatory IEs, mark
-        * HE as disabled. If on the 5GHz band, make sure it supports VHT.
-        */
-       if (ifmgd->flags & IEEE80211_STA_DISABLE_HT ||
-           (sband->band == NL80211_BAND_5GHZ &&
-            ifmgd->flags & IEEE80211_STA_DISABLE_VHT) ||
-           (!elems.he_cap && !elems.he_operation))
-               ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
-
        if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) &&
            (!elems.he_cap || !elems.he_operation)) {
                mutex_unlock(&sdata->local->sta_mtx);
@@ -3251,8 +3270,11 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
                                                  sta);
 
                bss_conf->he_support = sta->sta.he_cap.has_he;
+               bss_conf->twt_requester =
+                       ieee80211_twt_req_supported(sta, &elems);
        } else {
                bss_conf->he_support = false;
+               bss_conf->twt_requester = false;
        }
 
        if (bss_conf->he_support) {
@@ -3337,6 +3359,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
         * 4-bit value.
         */
        ifmgd->wmm_last_param_set = -1;
+       ifmgd->mu_edca_last_param_set = -1;
 
        if (ifmgd->flags & IEEE80211_STA_DISABLE_WMM) {
                ieee80211_set_wmm_default(sdata, false, false);
@@ -4660,8 +4683,10 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                }
        }
 
-       if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE) &&
-           ieee80211_get_he_sta_cap(sband)) {
+       if (!ieee80211_get_he_sta_cap(sband))
+               ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
+
+       if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE)) {
                const struct cfg80211_bss_ies *ies;
                const u8 *he_oper_ie;