]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iwlwifi: mvm: rs-fw: handle VHT extended NSS capability
authorJohannes Berg <johannes.berg@intel.com>
Fri, 11 Sep 2020 17:44:29 +0000 (20:44 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 1 Oct 2020 18:52:51 +0000 (21:52 +0300)
If extended NSS capability is used, the NSS for 160 may be
lower than for 80.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200911204056.523f5eca82ce.Ic0cd9cc86a91b1f23a5a54921736332be9abac29@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c

index 6f4d241d47e9f9b45d3d93035f5655d7ba9e924a..012123268ba99d06a4c43be07905f55eb03dd8a1 100644 (file)
@@ -195,14 +195,20 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
 {
        u16 supp;
        int i, highest_mcs;
-       u8 nss = sta->rx_nss;
+       u8 max_nss = sta->rx_nss;
+       struct ieee80211_vht_cap ieee_vht_cap = {
+               .vht_cap_info = cpu_to_le32(vht_cap->cap),
+               .supp_mcs = vht_cap->vht_mcs,
+       };
 
        /* the station support only a single receive chain */
        if (sta->smps_mode == IEEE80211_SMPS_STATIC)
-               nss = 1;
+               max_nss = 1;
 
-       for (i = 0; i < nss && i < IWL_TLC_NSS_MAX; i++) {
-               highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, i + 1);
+       for (i = 0; i < max_nss && i < IWL_TLC_NSS_MAX; i++) {
+               int nss = i + 1;
+
+               highest_mcs = rs_fw_vht_highest_rx_mcs_index(vht_cap, nss);
                if (!highest_mcs)
                        continue;
 
@@ -211,7 +217,15 @@ rs_fw_vht_set_enabled_rates(const struct ieee80211_sta *sta,
                        supp &= ~BIT(IWL_TLC_MNG_HT_RATE_MCS9);
 
                cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160] = cpu_to_le16(supp);
-               if (sta->bandwidth == IEEE80211_STA_RX_BW_160)
+               /*
+                * Check if VHT extended NSS indicates that the bandwidth/NSS
+                * configuration is supported - only for MCS 0 since we already
+                * decoded the MCS bits anyway ourselves.
+                */
+               if (sta->bandwidth == IEEE80211_STA_RX_BW_160 &&
+                   ieee80211_get_vht_max_nss(&ieee_vht_cap,
+                                             IEEE80211_VHT_CHANWIDTH_160MHZ,
+                                             0, true, nss) >= nss)
                        cmd->ht_rates[i][IWL_TLC_HT_BW_160] =
                                cmd->ht_rates[i][IWL_TLC_HT_BW_NONE_160];
        }