5cb7801b294e386217d7d2dfb59066c2118a7e62
[librecmc/librecmc.git] /
1 From ebf82988f844dd98e6b007cffcc5e95986056995 Mon Sep 17 00:00:00 2001
2 From: Muna Sinada <quic_msinada@quicinc.com>
3 Date: Fri, 24 Feb 2023 12:28:04 +0200
4 Subject: [PATCH] wifi: ath11k: generate rx and tx mcs maps for supported HE
5  mcs
6
7 Generate rx and tx mcs maps in ath11k_mac_set_hemcsmap() and set them
8 in supported mcs/nss for HE capabilities.
9
10 Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-00356-QCAHKSWPL_SILICONZ-1
11
12 Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
13 Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
14 Link: https://lore.kernel.org/r/1666128501-12364-5-git-send-email-quic_msinada@quicinc.com
15 ---
16  drivers/net/wireless/ath/ath11k/mac.c | 30 ++++++++++++++++++++-------
17  1 file changed, 23 insertions(+), 7 deletions(-)
18
19 --- a/drivers/net/wireless/ath/ath11k/mac.c
20 +++ b/drivers/net/wireless/ath/ath11k/mac.c
21 @@ -5488,20 +5488,36 @@ static void ath11k_mac_set_hemcsmap(stru
22                                     struct ieee80211_sta_he_cap *he_cap,
23                                     int band)
24  {
25 -       struct ath11k_band_cap *band_cap = &cap->band[band];
26 +       u16 txmcs_map, rxmcs_map;
27 +       u32 i;
28  
29 +       rxmcs_map = 0;
30 +       txmcs_map = 0;
31 +       for (i = 0; i < 8; i++) {
32 +               if (i < ar->num_tx_chains &&
33 +                   (ar->cfg_tx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
34 +                       txmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
35 +               else
36 +                       txmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
37 +
38 +               if (i < ar->num_rx_chains &&
39 +                   (ar->cfg_rx_chainmask >> cap->tx_chain_mask_shift) & BIT(i))
40 +                       rxmcs_map |= IEEE80211_HE_MCS_SUPPORT_0_11 << (i * 2);
41 +               else
42 +                       rxmcs_map |= IEEE80211_HE_MCS_NOT_SUPPORTED << (i * 2);
43 +       }
44         he_cap->he_mcs_nss_supp.rx_mcs_80 =
45 -               cpu_to_le16(band_cap->he_mcs & 0xffff);
46 +               cpu_to_le16(rxmcs_map & 0xffff);
47         he_cap->he_mcs_nss_supp.tx_mcs_80 =
48 -               cpu_to_le16(band_cap->he_mcs & 0xffff);
49 +               cpu_to_le16(txmcs_map & 0xffff);
50         he_cap->he_mcs_nss_supp.rx_mcs_160 =
51 -               cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
52 +               cpu_to_le16(rxmcs_map & 0xffff);
53         he_cap->he_mcs_nss_supp.tx_mcs_160 =
54 -               cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
55 +               cpu_to_le16(txmcs_map & 0xffff);
56         he_cap->he_mcs_nss_supp.rx_mcs_80p80 =
57 -               cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
58 +               cpu_to_le16(rxmcs_map & 0xffff);
59         he_cap->he_mcs_nss_supp.tx_mcs_80p80 =
60 -               cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
61 +               cpu_to_le16(txmcs_map & 0xffff);
62  }
63  
64  static int ath11k_mac_copy_he_cap(struct ath11k *ar,