diff mbox series

[01/11] iwlwifi: mvm: rs-fw: handle VHT extended NSS capability

Message ID iwlwifi.20200911204056.523f5eca82ce.Ic0cd9cc86a91b1f23a5a54921736332be9abac29@changeid (mailing list archive)
State Accepted
Commit 3d70247d34fc4c9df6c5fb324e29f06f8e6b8e2a
Delegated to: Luca Coelho
Headers show
Series iwlwifi: updates intended for v5.10 2020-09-11 | expand

Commit Message

Luca Coelho Sept. 11, 2020, 5:44 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

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>
---
 .../net/wireless/intel/iwlwifi/mvm/rs-fw.c    | 24 +++++++++++++++----
 1 file changed, 19 insertions(+), 5 deletions(-)

Comments

Luca Coelho Oct. 1, 2020, 6:53 p.m. UTC | #1
Luca Coelho <luca@coelho.fi> wrote:

> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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>

11 patches applied to iwlwifi-next.git, thanks.

3d70247d34fc iwlwifi: mvm: rs-fw: handle VHT extended NSS capability
bbb95d37b74f iwlwifi: mvm: add PROTECTED_TWT firmware API
659ac93d7ced iwlwifi: mvm: set PROTECTED_TWT in MAC data policy
9c11d8a9d41c iwlwifi: mvm: set PROTECTED_TWT feature if supported by firmware
7e0ca7230b98 iwlwifi: sta: defer ADDBA transmit in case reclaimed SN != next SN
0cd38f4d0529 iwlwifi: msix: limit max RX queues for 9000 family
02d31e9b626a iwlwifi: acpi: evaluate dsm to disable 5.8GHz channels
d14f499dd2ed iwlwifi: wowlan: adapt to wowlan status API version 10
79946ee77428 iwlwifi: fw: move assert descriptor parser to common code
64564669e1a5 iwlwifi: add new cards for AX201 family
be82ecd3a5c8 iwlwifi: mvm: add an option to add PASN station
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
index 6f4d241d47e9..012123268ba9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs-fw.c
@@ -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];
 	}