summary refs log tree commit diff
path: root/drivers
diff options
context:
space:
mode:
authorneil.shi <neil.shi@quectel.com>2023-06-01 13:25:04 +0800
committerPierre-Loup A. Griffais <pgriffais@valvesoftware.com>2023-11-02 16:05:18 -0700
commit8b764dcf8c2da5a45b34466dccd2f91c2ae821c2 (patch)
treec552da9861de11e036c4a23df52f66e4c716938d /drivers
parent87bd596e69dfe58945ed0d7776dad46399feb2d0 (diff)
downloadlinux-8b764dcf8c2da5a45b34466dccd2f91c2ae821c2.tar.gz
Subject: [PATCH 28/42] wifi: ath11k: generate rx and tx mcs maps for supported HE mcs
Generate rx and tx mcs maps in ath11k_mac_set_hemcsmap() and set them
in supported mcs/nss for HE capabilities.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1

Signed-off-by: neil.shi <neil.shi@quectel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ath/ath11k/mac.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 7fced3af187b..5bc06894412c 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5441,20 +5441,36 @@ static void ath11k_mac_set_hemcsmap(struct ath11k *ar,
 				    struct ieee80211_sta_he_cap *he_cap,
 				    int band)
 {
-	struct ath11k_band_cap *band_cap = &cap->band[band];
+	u16 txmcs_map, rxmcs_map;
+	u32 i;
 
+	rxmcs_map = 0;
+	txmcs_map = 0;
+	for (i = 0; i < 8; i++) {
+		if (i < ar->num_tx_chains &&
+		    (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
+			txmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
+		else
+			txmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
+
+		if (i < ar->num_rx_chains &&
+		    (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
+			rxmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
+		else
+			rxmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
+	}
 	he_cap->he_mcs_nss_supp.rx_mcs_80 =
-		cpu_to_le16(band_cap->he_mcs & 0xffff);
+		cpu_to_le16(rxmcs_map & 0xffff);
 	he_cap->he_mcs_nss_supp.tx_mcs_80 =
-		cpu_to_le16(band_cap->he_mcs & 0xffff);
+		cpu_to_le16(txmcs_map & 0xffff);
 	he_cap->he_mcs_nss_supp.rx_mcs_160 =
-		cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		cpu_to_le16(rxmcs_map & 0xffff);
 	he_cap->he_mcs_nss_supp.tx_mcs_160 =
-		cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		cpu_to_le16(txmcs_map & 0xffff);
 	he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
-		cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		cpu_to_le16(rxmcs_map & 0xffff);
 	he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
-		cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+		cpu_to_le16(txmcs_map & 0xffff);
 }
 
 static int ath11k_mac_copy_he_cap(struct ath11k *ar,