2024-04-24 20:42:41

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v3 00/10] wifi: ath12k: add MU-MIMO and 160 MHz bandwidth support

Add support for
1. enabling MU-MIMO in HE and EHT modes from hardware
2. setting fixed HE rate/GI/LTF
3. 160 MHz bandwidth in HE mode
4. extended NSS bandwidth support

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

changes in v3:
- address review comments for fixing ath12k-check issues.

changes in v2:
- Amend mac80211 patch description as the patch is not specific
to AP mode.
- Amend EHT MU-MIMO patch description to specify future support
for STA mode.

Pradeep Kumar Chitrapu (10):
wifi: mac80211: Add EHT UL MU-MIMO flag in ieee80211_bss_conf
wifi: ath12k: push HE MU-MIMO params from hostapd to hardware
wifi: ath12k: push EHT MU-MIMO params from hostapd to hardware
wifi: ath12k: move HE MCS mapper to a separate function
wifi: ath12k: generate rx and tx mcs maps for supported HE mcs
wifi: ath12k: fix TX and RX MCS rate configurations in HE mode
wifi: ath12k: add support for setting fixed HE rate/GI/LTF
wifi: ath12k: clean up 80P80 support
wifi: ath12k: add support for 160 MHz bandwidth
wifi: ath12k: add extended NSS bandwidth support for 160 MHz

drivers/net/wireless/ath/ath12k/core.h | 2 +
drivers/net/wireless/ath/ath12k/mac.c | 1043 ++++++++++++++++++++----
drivers/net/wireless/ath/ath12k/mac.h | 17 +
drivers/net/wireless/ath/ath12k/wmi.c | 24 +-
drivers/net/wireless/ath/ath12k/wmi.h | 98 ++-
include/net/mac80211.h | 4 +
net/mac80211/cfg.c | 5 +
7 files changed, 986 insertions(+), 207 deletions(-)


base-commit: 1a17b8f9196db4d5b9f81f69cac885ba8c832da7
prerequisite-patch-id: 6cb82354d93f2d3d0e61dca59b7939e1bae2f263
prerequisite-patch-id: b93a6cfb7a9caa843eb4a1df2d400b56b548188f
prerequisite-patch-id: bbf8aa44334b11e860f4b68c22607110e81498a1
prerequisite-patch-id: 70140f291ade3c2db0a0f36fe1c7c7d93eedfdeb
prerequisite-patch-id: c52742e59bc5db2742ab66ec16175e983b88fb72
prerequisite-patch-id: 8f9c43d387ec6bcf807f53dc17dcaaaa21c8a03f
prerequisite-patch-id: a36bcb4e892019e5dcc39854088371e1c20e4ebf
prerequisite-patch-id: 42864cd08f6d37e14f1794d29e13f8a094e489cc
prerequisite-patch-id: 67eb3991126edab717635666297a6a910adbb8c1
prerequisite-patch-id: be513e07c8fbbc556d3b61f2356d0a4391901ba5
prerequisite-patch-id: 6dd663b6660f5f8d49fbd3e49023d0fd851100dc
prerequisite-patch-id: 77ba10656791f90eeeb88ef749829b1474de4280
prerequisite-patch-id: ec4c06aca44fecabfbdbf305581c60587cf23e63
prerequisite-patch-id: f24c686941a9136ff7d800a726fad8c5d5d3b1b1
prerequisite-patch-id: 14c827bfdc875273056194059bcd0cb042db123a
prerequisite-patch-id: c1adce3c611529902e3a19a74f775cfffbba69b3
prerequisite-patch-id: a4ff79eb14ba0e59508ce72e0d0eca56da2b6060
prerequisite-patch-id: 66d93f366737e1a4b1e3c0a10747994b39bdd49a
prerequisite-patch-id: 4890b86b151fad62b5a37688d813696f507cd9b1
prerequisite-patch-id: 58918f67d676fafe5c527c83d1401da8cd30cb41
prerequisite-patch-id: d6acc523424cd3049f471191406d456625a903ee
prerequisite-patch-id: ce6f394abfaa9dbf2e818379850b911ea380e8ff
prerequisite-patch-id: 92fc0dabdc596b6d1f4940a8be86f9558dabede9
prerequisite-patch-id: 34f4bf81393b8f035604eca6fb13a964dc933fb0
prerequisite-patch-id: d14a14bb3e1b22afdce181eab811e4151b837b7e
prerequisite-patch-id: 275f221e85124f4cccac788a2d109dd71bb611f8
prerequisite-patch-id: a68de371d003e45f93defbadaa164ce016f62b43
prerequisite-patch-id: d156ad9d641c02cb2b00bb2a9bb3952f1ee1eda5
prerequisite-patch-id: 022d675781d55b377befb1bfa73cdd13eb544919
prerequisite-patch-id: cd0f4fc60b3e60fd5daed4c4aef5ff836a1d6afe
prerequisite-patch-id: 2d8e31915fb462a006aa36a878afc722dae702f1
prerequisite-patch-id: 6db9ebc02e7aff5b0dd6a791bcb56b174b8f5075
prerequisite-patch-id: 8ab4b749c404278c6f3284e7626f7fc34f4c168c
prerequisite-patch-id: 3132da2b7c8c7c62e27c995c81a2805898bbecf5
prerequisite-patch-id: 47954405bc0dd7a3b89981a1f62b2942c6690321
prerequisite-patch-id: 9394e4f195275a48ccc6feb79a69391bd5a081ac
prerequisite-patch-id: 73a8dedb5b3270e36d08453ecde5a1eda1d488df
prerequisite-patch-id: 0b51e47032752aff3d731c060f9ec63de49d6efa
prerequisite-patch-id: de40f7811a733a0e14e2bb9e263e632a488c350a
prerequisite-patch-id: 018f54a2e185dac93eb3ff126a3dcfe830797da7
prerequisite-patch-id: 65c73a3902c82ed46fd45ba3e02477746b80f43f
prerequisite-patch-id: 0a3e374a2927cc6b36aa886562ea74197f3e31e1
prerequisite-patch-id: 197d9f2f52a4f397bcadfb097f66026aec7d8531
prerequisite-patch-id: 0d2aedbe585ef88c171a8e6e07c88cdbc4269194
prerequisite-patch-id: 445f5b16f72a183fcf92eadbd1329902267ecfc5
prerequisite-patch-id: c753615aebcfe5d7419d00f11ef94c41618032d1
prerequisite-patch-id: b15f736df11c88fb96a180e0d928a6e1cd0c0f34
prerequisite-patch-id: 6eb961cc481ac73a4e17b2338814fb2f86b02b2a
prerequisite-patch-id: fdddada4c012b7d7cc79d1e17caccac67ee63bef
prerequisite-patch-id: ffd8fb7974d49d06574ab4b97b0ca74a3b2e5e21
prerequisite-patch-id: d56eb0552657a692d6db25fb1badba1f06769c07
prerequisite-patch-id: 468fad8de3fef4b8c470408fb1db12edd4a195c0
prerequisite-patch-id: 9f816eb8e25fa683f06c2f5e5317ac7a51d57ab9
prerequisite-patch-id: 734bba56b6da8d0ba773c335e1da4926fe8b8035
prerequisite-patch-id: 8db71e2c9424eb2d1296c73100d34c8f9bcdde0b
prerequisite-patch-id: bdadfa11d95682aeb60202635ce434c98e451c20
prerequisite-patch-id: 3af02179828c0bb21ab1d4bd9ff61231ef091162
prerequisite-patch-id: 861aa5786a781f71cf5adfabc531ca6b61ef1c72
prerequisite-patch-id: b3df68b21838ded80f002482f69d7a458776cf99
prerequisite-patch-id: 11d0c8923fe6f22cebf2afcd57e3bf7c8f36b4f9
prerequisite-patch-id: 599e5c0a6a6c9e9a12ee422f4af9340c0b465f67
prerequisite-patch-id: 13952e429c380cd716c6f449df3dcedaae109479
prerequisite-patch-id: 07c9ff6fcaf4ba464be993caa19eb49113eedbdf
--
2.17.1



2024-04-24 20:42:49

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v3 04/10] wifi: ath12k: move HE MCS mapper to a separate function

Refactor the HE MCS mapper functionality in
ath12k_mac_copy_he_cap() into a new function.

This helps improve readability, extensibility and will be used
when adding support for 160 MHz bandwidth in subsequent patches.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Co-developed-by: Muna Sinada <[email protected]>
Signed-off-by: Muna Sinada <[email protected]>
Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index d7844709fbf8..523255743b9c 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5161,12 +5161,24 @@ static __le16 ath12k_mac_setup_he_6ghz_cap(struct ath12k_pdev_cap *pcap,
return cpu_to_le16(bcap->he_6ghz_capa);
}

+static void ath12k_mac_set_hemcsmap(struct ath12k_band_cap *band_cap,
+ struct ieee80211_sta_he_cap *he_cap)
+{
+ struct ieee80211_he_mcs_nss_supp *mcs_nss = &he_cap->he_mcs_nss_supp;
+
+ mcs_nss->rx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
+ mcs_nss->tx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
+ mcs_nss->rx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+ mcs_nss->tx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+ mcs_nss->rx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+ mcs_nss->tx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+}
+
static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
int iftype, u8 num_tx_chains,
struct ieee80211_sta_he_cap *he_cap)
{
struct ieee80211_he_cap_elem *he_cap_elem = &he_cap->he_cap_elem;
- struct ieee80211_he_mcs_nss_supp *mcs_nss = &he_cap->he_mcs_nss_supp;

he_cap->has_he = true;
memcpy(he_cap_elem->mac_cap_info, band_cap->he_cap_info,
@@ -5204,13 +5216,7 @@ static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
break;
}

- mcs_nss->rx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
- mcs_nss->tx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
- mcs_nss->rx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->tx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->rx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->tx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
-
+ ath12k_mac_set_hemcsmap(band_cap, he_cap);
memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
if (he_cap_elem->phy_cap_info[6] &
IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT)
--
2.17.1


2024-04-24 20:43:25

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v3 05/10] wifi: ath12k: generate rx and tx mcs maps for supported HE mcs

Generate rx and tx mcs maps in ath12k_mac_set_hemcsmap() based
on number of supported tx/rx chains and set them in supported
mcs/nss for HE capabilities.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Co-developed-by: Muna Sinada <[email protected]>
Signed-off-by: Muna Sinada <[email protected]>
Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 40 ++++++++++++++++++++-------
1 file changed, 30 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 523255743b9c..2e477b4bd6c6 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5161,20 +5161,40 @@ static __le16 ath12k_mac_setup_he_6ghz_cap(struct ath12k_pdev_cap *pcap,
return cpu_to_le16(bcap->he_6ghz_capa);
}

-static void ath12k_mac_set_hemcsmap(struct ath12k_band_cap *band_cap,
+static void ath12k_mac_set_hemcsmap(struct ath12k *ar,
+ struct ath12k_pdev_cap *cap,
struct ieee80211_sta_he_cap *he_cap)
{
struct ieee80211_he_mcs_nss_supp *mcs_nss = &he_cap->he_mcs_nss_supp;
+ 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);
+ }

- mcs_nss->rx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
- mcs_nss->tx_mcs_80 = cpu_to_le16(band_cap->he_mcs & 0xffff);
- mcs_nss->rx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->tx_mcs_160 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->rx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
- mcs_nss->tx_mcs_80p80 = cpu_to_le16((band_cap->he_mcs >> 16) & 0xffff);
+ mcs_nss->rx_mcs_80 = cpu_to_le16(rxmcs_map & 0xffff);
+ mcs_nss->tx_mcs_80 = cpu_to_le16(txmcs_map & 0xffff);
+ mcs_nss->rx_mcs_160 = cpu_to_le16(rxmcs_map & 0xffff);
+ mcs_nss->tx_mcs_160 = cpu_to_le16(txmcs_map & 0xffff);
+ mcs_nss->rx_mcs_80p80 = cpu_to_le16(rxmcs_map & 0xffff);
+ mcs_nss->tx_mcs_80p80 = cpu_to_le16(txmcs_map & 0xffff);
}

-static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
+static void ath12k_mac_copy_he_cap(struct ath12k *ar,
+ struct ath12k_band_cap *band_cap,
int iftype, u8 num_tx_chains,
struct ieee80211_sta_he_cap *he_cap)
{
@@ -5216,7 +5236,7 @@ static void ath12k_mac_copy_he_cap(struct ath12k_band_cap *band_cap,
break;
}

- ath12k_mac_set_hemcsmap(band_cap, he_cap);
+ ath12k_mac_set_hemcsmap(ar, &ar->pdev->cap, he_cap);
memset(he_cap->ppe_thres, 0, sizeof(he_cap->ppe_thres));
if (he_cap_elem->phy_cap_info[6] &
IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT)
@@ -5405,7 +5425,7 @@ static int ath12k_mac_copy_sband_iftype_data(struct ath12k *ar,

data[idx].types_mask = BIT(i);

- ath12k_mac_copy_he_cap(band_cap, i, ar->num_tx_chains, he_cap);
+ ath12k_mac_copy_he_cap(ar, band_cap, i, ar->num_tx_chains, he_cap);
if (band == NL80211_BAND_6GHZ) {
data[idx].he_6ghz_capa.capa =
ath12k_mac_setup_he_6ghz_cap(cap, band_cap);
--
2.17.1


2024-04-24 20:44:31

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

Add support to set fixed HE rate/GI/LTF values using nl80211.
Reuse parts of the existing code path already used for HT/VHT
to implement the new helpers symmetrically, similar to how
HT/VHT is handled.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Co-developed-by: Muna Sinada <[email protected]>
Signed-off-by: Muna Sinada <[email protected]>
Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 596 ++++++++++++++++++++++++--
drivers/net/wireless/ath/ath12k/wmi.h | 18 +
2 files changed, 567 insertions(+), 47 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 2e477b4bd6c6..e9febe74bfe1 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -434,6 +434,18 @@ ath12k_mac_max_vht_nss(const u16 *vht_mcs_mask)
return 1;
}

+static u32
+ath12k_mac_max_he_nss(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
+{
+ int nss;
+
+ for (nss = NL80211_HE_NSS_MAX - 1; nss >= 0; nss--)
+ if (he_mcs_mask[nss])
+ return nss + 1;
+
+ return 1;
+}
+
static u8 ath12k_parse_mpdudensity(u8 mpdudensity)
{
/* From IEEE Std 802.11-2020 defined values for "Minimum MPDU Start Spacing":
@@ -1665,6 +1677,14 @@ static void ath12k_peer_assoc_h_ht(struct ath12k *ar,
arg->peer_rate_caps |= WMI_HOST_RC_CW40_FLAG;
}

+ /* As firmware handles these two flags (IEEE80211_HT_CAP_SGI_20
+ * and IEEE80211_HT_CAP_SGI_40) for enabling SGI, reset both
+ * flags if guard interval is Default GI
+ */
+ if (arvif->bitrate_mask.control[band].gi == NL80211_TXRATE_DEFAULT_GI)
+ arg->peer_ht_caps &= ~(IEEE80211_HT_CAP_SGI_20 |
+ IEEE80211_HT_CAP_SGI_40);
+
if (arvif->bitrate_mask.control[band].gi != NL80211_TXRATE_FORCE_LGI) {
if (ht_cap->cap & (IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_SGI_40))
@@ -1788,11 +1808,12 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
struct cfg80211_chan_def def;
enum nl80211_band band;
- const u16 *vht_mcs_mask;
+ u16 *vht_mcs_mask;
u16 tx_mcs_map;
u8 ampdu_factor;
u8 max_nss, vht_mcs;
- int i;
+ int i, vht_nss, nss_idx;
+ bool user_rate_valid = true;

if (WARN_ON(ath12k_mac_vif_chan(vif, &def)))
return;
@@ -1835,6 +1856,25 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_160)
arg->bw_160 = true;

+ vht_nss = ath12k_mac_max_vht_nss(vht_mcs_mask);
+
+ if (vht_nss > sta->deflink.rx_nss) {
+ user_rate_valid = false;
+ for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) {
+ if (vht_mcs_mask[nss_idx]) {
+ user_rate_valid = true;
+ break;
+ }
+ }
+ }
+
+ if (!user_rate_valid) {
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "Setting vht range MCS value to peer supported nss:%d for peer %pM\n",
+ sta->deflink.rx_nss, sta->deflink.addr);
+ vht_mcs_mask[sta->deflink.rx_nss - 1] = vht_mcs_mask[vht_nss - 1];
+ }
+
/* Calculate peer NSS capability from VHT capabilities if STA
* supports VHT.
*/
@@ -1874,21 +1914,103 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
/* TODO: rxnss_override */
}

+static int ath12k_mac_get_max_he_mcs_map(u16 mcs_map, int nss)
+{
+ switch ((mcs_map >> (2 * nss)) & 0x3) {
+ case IEEE80211_HE_MCS_SUPPORT_0_7: return BIT(8) - 1;
+ case IEEE80211_HE_MCS_SUPPORT_0_9: return BIT(10) - 1;
+ case IEEE80211_HE_MCS_SUPPORT_0_11: return BIT(12) - 1;
+ }
+ return 0;
+}
+
+static u16 ath12k_peer_assoc_h_he_limit(u16 tx_mcs_set,
+ const u16 he_mcs_limit[NL80211_HE_NSS_MAX])
+{
+ int idx_limit;
+ int nss;
+ u16 mcs_map;
+ u16 mcs;
+
+ for (nss = 0; nss < NL80211_HE_NSS_MAX; nss++) {
+ mcs_map = ath12k_mac_get_max_he_mcs_map(tx_mcs_set, nss) &
+ he_mcs_limit[nss];
+
+ if (mcs_map)
+ idx_limit = fls(mcs_map) - 1;
+ else
+ idx_limit = -1;
+
+ switch (idx_limit) {
+ case 0 ... 7:
+ mcs = IEEE80211_HE_MCS_SUPPORT_0_7;
+ break;
+ case 8:
+ case 9:
+ mcs = IEEE80211_HE_MCS_SUPPORT_0_9;
+ break;
+ case 10:
+ case 11:
+ mcs = IEEE80211_HE_MCS_SUPPORT_0_11;
+ break;
+ default:
+ WARN_ON(1);
+ fallthrough;
+ case -1:
+ mcs = IEEE80211_HE_MCS_NOT_SUPPORTED;
+ break;
+ }
+
+ tx_mcs_set &= ~(0x3 << (nss * 2));
+ tx_mcs_set |= mcs << (nss * 2);
+ }
+
+ return tx_mcs_set;
+}
+
+static bool
+ath12k_peer_assoc_h_he_masked(const u16 he_mcs_mask[NL80211_HE_NSS_MAX])
+{
+ int nss;
+
+ for (nss = 0; nss < NL80211_HE_NSS_MAX; nss++)
+ if (he_mcs_mask[nss])
+ return false;
+
+ return true;
+}
+
static void ath12k_peer_assoc_h_he(struct ath12k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ath12k_wmi_peer_assoc_arg *arg)
{
const struct ieee80211_sta_he_cap *he_cap = &sta->deflink.he_cap;
+ struct ath12k_vif *arvif = ath12k_vif_to_arvif(vif);
+ struct cfg80211_chan_def def;
int i;
u8 ampdu_factor, rx_mcs_80, rx_mcs_160, max_nss;
u16 mcs_160_map, mcs_80_map;
bool support_160;
- u16 v;
+ enum nl80211_band band;
+ u16 *he_mcs_mask;
+ u8 he_mcs;
+ u16 he_tx_mcs = 0, v = 0;
+ int he_nss, nss_idx;
+ bool user_rate_valid = true;
+
+ if (WARN_ON(ath12k_mac_vif_chan(vif, &def)))
+ return;

if (!he_cap->has_he)
return;

+ band = def.chan->band;
+ he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;
+
+ if (ath12k_peer_assoc_h_he_masked(he_mcs_mask))
+ return;
+
arg->he_flag = true;

support_160 = !!(he_cap->he_cap_elem.phy_cap_info[0] &
@@ -1995,25 +2117,47 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
if (he_cap->he_cap_elem.mac_cap_info[0] & IEEE80211_HE_MAC_CAP0_TWT_REQ)
arg->twt_requester = true;

+ he_nss = ath12k_mac_max_he_nss(he_mcs_mask);
+
+ if (he_nss > sta->deflink.rx_nss) {
+ user_rate_valid = false;
+ for (nss_idx = sta->deflink.rx_nss - 1; nss_idx >= 0; nss_idx--) {
+ if (he_mcs_mask[nss_idx]) {
+ user_rate_valid = true;
+ break;
+ }
+ }
+ }
+
+ if (!user_rate_valid) {
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "Setting he range MCS value to peer supported nss:%d for peer %pM\n",
+ sta->deflink.rx_nss, sta->deflink.addr);
+ he_mcs_mask[sta->deflink.rx_nss - 1] = he_mcs_mask[he_nss - 1];
+ }
+
switch (sta->deflink.bandwidth) {
case IEEE80211_STA_RX_BW_160:
if (he_cap->he_cap_elem.phy_cap_info[0] &
IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G) {
- v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_80p80);
+ v = ath12k_peer_assoc_h_he_limit(v, he_mcs_mask);
arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v;

v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80p80);
arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80_80] = v;

arg->peer_he_mcs_count++;
+ he_tx_mcs = v;
}
v = le16_to_cpu(he_cap->he_mcs_nss_supp.rx_mcs_160);
arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v;

- v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_160);
+ v = ath12k_peer_assoc_h_he_limit(v, he_mcs_mask);
arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_160] = v;

arg->peer_he_mcs_count++;
+ if (!he_tx_mcs)
+ he_tx_mcs = v;
fallthrough;

default:
@@ -2021,11 +2165,34 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
arg->peer_he_rx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v;

v = le16_to_cpu(he_cap->he_mcs_nss_supp.tx_mcs_80);
+ v = ath12k_peer_assoc_h_he_limit(v, he_mcs_mask);
arg->peer_he_tx_mcs_set[WMI_HECAP_TXRX_MCS_NSS_IDX_80] = v;

arg->peer_he_mcs_count++;
+ if (!he_tx_mcs)
+ he_tx_mcs = v;
break;
}
+
+ /* Calculate peer NSS capability from HE capabilities if STA
+ * supports HE.
+ */
+ for (i = 0, max_nss = 0, he_mcs = 0; i < NL80211_HE_NSS_MAX; i++) {
+ he_mcs = he_tx_mcs >> (2 * i) & 3;
+
+ /* In case of fixed rates, MCS Range in he_tx_mcs might have
+ * unsupported range, with he_mcs_mask set, so check either of them
+ * to find nss.
+ */
+ if (he_mcs != IEEE80211_HE_MCS_NOT_SUPPORTED ||
+ he_mcs_mask[i])
+ max_nss = i + 1;
+ }
+ arg->peer_nss = min(sta->deflink.rx_nss, max_nss);
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac he peer %pM nss %d mcs cnt %d\n",
+ sta->deflink.addr, arg->peer_nss, arg->peer_he_mcs_count);
}

static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
@@ -2263,6 +2430,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
+ const u16 *he_mcs_mask;
enum wmi_phy_mode phymode = MODE_UNKNOWN;

if (WARN_ON(ath12k_mac_vif_chan(vif, &def)))
@@ -2271,6 +2439,7 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
band = def.chan->band;
ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
+ he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;

switch (band) {
case NL80211_BAND_2GHZ:
@@ -2279,7 +2448,8 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
phymode = MODE_11BE_EHT40_2G;
else
phymode = MODE_11BE_EHT20_2G;
- } else if (sta->deflink.he_cap.has_he) {
+ } else if (sta->deflink.he_cap.has_he &&
+ !ath12k_peer_assoc_h_he_masked(he_mcs_mask)) {
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_80)
phymode = MODE_11AX_HE80_2G;
else if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40)
@@ -2309,7 +2479,8 @@ static void ath12k_peer_assoc_h_phymode(struct ath12k *ar,
/* Check EHT first */
if (sta->deflink.eht_cap.has_eht) {
phymode = ath12k_mac_get_phymode_eht(ar, sta);
- } else if (sta->deflink.he_cap.has_he) {
+ } else if (sta->deflink.he_cap.has_he &&
+ !ath12k_peer_assoc_h_he_masked(he_mcs_mask)) {
phymode = ath12k_mac_get_phymode_he(ar, sta);
} else if (sta->deflink.vht_cap.vht_supported &&
!ath12k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
@@ -3957,6 +4128,20 @@ ath12k_mac_bitrate_mask_num_vht_rates(struct ath12k *ar,
return num_rates;
}

+static int
+ath12k_mac_bitrate_mask_num_he_rates(struct ath12k *ar,
+ enum nl80211_band band,
+ const struct cfg80211_bitrate_mask *mask)
+{
+ int num_rates = 0;
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++)
+ num_rates += hweight16(mask->control[band].he_mcs[i]);
+
+ return num_rates;
+}
+
static int
ath12k_mac_set_peer_vht_fixed_rate(struct ath12k_vif *arvif,
struct ieee80211_sta *sta,
@@ -4003,6 +4188,57 @@ ath12k_mac_set_peer_vht_fixed_rate(struct ath12k_vif *arvif,
return ret;
}

+static int
+ath12k_mac_set_peer_he_fixed_rate(struct ath12k_vif *arvif,
+ struct ieee80211_sta *sta,
+ const struct cfg80211_bitrate_mask *mask,
+ enum nl80211_band band)
+{
+ struct ath12k *ar = arvif->ar;
+ u8 he_rate, nss;
+ u32 rate_code;
+ int ret, i;
+
+ lockdep_assert_held(&ar->conf_mutex);
+
+ nss = 0;
+
+ for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) {
+ if (hweight16(mask->control[band].he_mcs[i]) == 1) {
+ nss = i + 1;
+ he_rate = ffs(mask->control[band].he_mcs[i]) - 1;
+ }
+ }
+
+ if (!nss) {
+ ath12k_warn(ar->ab, "No single HE Fixed rate found to set for %pM",
+ sta->deflink.addr);
+ return -EINVAL;
+ }
+
+ /* Avoid updating invalid nss as fixed rate*/
+ if (nss > sta->deflink.rx_nss)
+ return -EINVAL;
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "Setting Fixed HE Rate for peer %pM. Device will not switch to any other selected rates",
+ sta->deflink.addr);
+
+ rate_code = ATH12K_HW_RATE_CODE(he_rate, nss - 1,
+ WMI_RATE_PREAMBLE_HE);
+
+ ret = ath12k_wmi_set_peer_param(ar, sta->deflink.addr,
+ arvif->vdev_id,
+ WMI_PEER_PARAM_FIXED_RATE,
+ rate_code);
+ if (ret)
+ ath12k_warn(ar->ab,
+ "failed to update STA %pM Fixed Rate %d: %d\n",
+ sta->deflink.addr, rate_code, ret);
+
+ return ret;
+}
+
static int ath12k_station_assoc(struct ath12k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -4014,7 +4250,7 @@ static int ath12k_station_assoc(struct ath12k *ar,
struct cfg80211_chan_def def;
enum nl80211_band band;
struct cfg80211_bitrate_mask *mask;
- u8 num_vht_rates;
+ u8 num_vht_rates, num_he_rates;

lockdep_assert_held(&ar->conf_mutex);

@@ -4040,15 +4276,19 @@ static int ath12k_station_assoc(struct ath12k *ar,
}

num_vht_rates = ath12k_mac_bitrate_mask_num_vht_rates(ar, band, mask);
+ num_he_rates = ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask);

- /* If single VHT rate is configured (by set_bitrate_mask()),
- * peer_assoc will disable VHT. This is now enabled by a peer specific
+ /* If single VHT/HE rate is configured (by set_bitrate_mask()),
+ * peer_assoc will disable VHT/HE. This is now enabled by a peer specific
* fixed param.
* Note that all other rates and NSS will be disabled for this peer.
*/
if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) {
- ret = ath12k_mac_set_peer_vht_fixed_rate(arvif, sta, mask,
- band);
+ ret = ath12k_mac_set_peer_vht_fixed_rate(arvif, sta, mask, band);
+ if (ret)
+ return ret;
+ } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) {
+ ret = ath12k_mac_set_peer_he_fixed_rate(arvif, sta, mask, band);
if (ret)
return ret;
}
@@ -4121,8 +4361,9 @@ static void ath12k_sta_rc_update_wk(struct work_struct *wk)
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
- u32 changed, bw, nss, smps, bw_prev;
- int err, num_vht_rates;
+ const u16 *he_mcs_mask;
+ u32 changed, bw, nss, mac_nss, smps, bw_prev;
+ int err, num_vht_rates, num_he_rates;
const struct cfg80211_bitrate_mask *mask;
struct ath12k_wmi_peer_assoc_arg peer_arg;
enum wmi_phy_mode peer_phymode;
@@ -4138,6 +4379,7 @@ static void ath12k_sta_rc_update_wk(struct work_struct *wk)
band = def.chan->band;
ht_mcs_mask = arvif->bitrate_mask.control[band].ht_mcs;
vht_mcs_mask = arvif->bitrate_mask.control[band].vht_mcs;
+ he_mcs_mask = arvif->bitrate_mask.control[band].he_mcs;

spin_lock_bh(&ar->data_lock);

@@ -4154,8 +4396,10 @@ static void ath12k_sta_rc_update_wk(struct work_struct *wk)
mutex_lock(&ar->conf_mutex);

nss = max_t(u32, 1, nss);
- nss = min(nss, max(ath12k_mac_max_ht_nss(ht_mcs_mask),
- ath12k_mac_max_vht_nss(vht_mcs_mask)));
+ mac_nss = max3(ath12k_mac_max_ht_nss(ht_mcs_mask),
+ ath12k_mac_max_vht_nss(vht_mcs_mask),
+ ath12k_mac_max_he_nss(he_mcs_mask));
+ nss = min(nss, mac_nss);

if (changed & IEEE80211_RC_BW_CHANGED) {
ath12k_peer_assoc_h_phymode(ar, arvif->vif, sta, &peer_arg);
@@ -4233,6 +4477,8 @@ static void ath12k_sta_rc_update_wk(struct work_struct *wk)
mask = &arvif->bitrate_mask;
num_vht_rates = ath12k_mac_bitrate_mask_num_vht_rates(ar, band,
mask);
+ num_he_rates = ath12k_mac_bitrate_mask_num_he_rates(ar, band,
+ mask);

/* Peer_assoc_prepare will reject vht rates in
* bitrate_mask if its not available in range format and
@@ -4248,11 +4494,24 @@ static void ath12k_sta_rc_update_wk(struct work_struct *wk)
if (sta->deflink.vht_cap.vht_supported && num_vht_rates == 1) {
ath12k_mac_set_peer_vht_fixed_rate(arvif, sta, mask,
band);
+ } else if (sta->deflink.he_cap.has_he && num_he_rates == 1) {
+ ath12k_mac_set_peer_he_fixed_rate(arvif, sta, mask, band);
} else {
- /* If the peer is non-VHT or no fixed VHT rate
+ /* If the peer is non-VHT/HE or no fixed VHT/HE rate
* is provided in the new bitrate mask we set the
- * other rates using peer_assoc command.
+ * other rates using peer_assoc command. Also clear
+ * the peer fixed rate settings as it has higher proprity
+ * than peer assoc
*/
+
+ err = ath12k_wmi_set_peer_param(ar, sta->deflink.addr,
+ arvif->vdev_id,
+ WMI_PEER_PARAM_FIXED_RATE,
+ WMI_FIXED_RATE_NONE);
+ if (err)
+ ath12k_warn(ar->ab,
+ "failed to disable peer fixed rate for STA %pM ret %d\n",
+ sta->deflink.addr, err);
ath12k_peer_assoc_prepare(ar, arvif->vif, sta,
&peer_arg, true);

@@ -6536,10 +6795,13 @@ static int ath12k_mac_op_add_interface(struct ieee80211_hw *hw,

for (i = 0; i < ARRAY_SIZE(arvif->bitrate_mask.control); i++) {
arvif->bitrate_mask.control[i].legacy = 0xffffffff;
+ arvif->bitrate_mask.control[i].gi = NL80211_TXRATE_FORCE_SGI;
memset(arvif->bitrate_mask.control[i].ht_mcs, 0xff,
sizeof(arvif->bitrate_mask.control[i].ht_mcs));
memset(arvif->bitrate_mask.control[i].vht_mcs, 0xff,
sizeof(arvif->bitrate_mask.control[i].vht_mcs));
+ memset(arvif->bitrate_mask.control[i].he_mcs, 0xff,
+ sizeof(arvif->bitrate_mask.control[i].he_mcs));
}

/* Allocate Default Queue now and reassign during actual vdev create */
@@ -7714,9 +7976,26 @@ ath12k_mac_has_single_legacy_rate(struct ath12k *ar,
if (ath12k_mac_bitrate_mask_num_vht_rates(ar, band, mask))
return false;

+ if (ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask))
+ return false;
+
return num_rates == 1;
}

+static __le16
+ath12k_mac_get_tx_mcs_map(const struct ieee80211_sta_he_cap *he_cap)
+{
+ if (he_cap->he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G)
+ return he_cap->he_mcs_nss_supp.tx_mcs_80p80;
+
+ if (he_cap->he_cap_elem.phy_cap_info[0] &
+ IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G)
+ return he_cap->he_mcs_nss_supp.tx_mcs_160;
+
+ return he_cap->he_mcs_nss_supp.tx_mcs_80;
+}
+
static bool
ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
enum nl80211_band band,
@@ -7725,8 +8004,10 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
{
struct ieee80211_supported_band *sband = &ar->mac.sbands[band];
u16 vht_mcs_map = le16_to_cpu(sband->vht_cap.vht_mcs.tx_mcs_map);
+ u16 he_mcs_map = 0;
u8 ht_nss_mask = 0;
u8 vht_nss_mask = 0;
+ u8 he_nss_mask = 0;
int i;

/* No need to consider legacy here. Basic rates are always present
@@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
return false;
}

- if (ht_nss_mask != vht_nss_mask)
+ he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
+
+ for (i = 0; i < ARRAY_SIZE(mask->control[band].he_mcs); i++) {
+ if (mask->control[band].he_mcs[i] == 0)
+ continue;
+
+ if (mask->control[band].he_mcs[i] ==
+ ath12k_mac_get_max_he_mcs_map(he_mcs_map, i))
+ he_nss_mask |= BIT(i);
+ else
+ return false;
+ }
+
+ if (ht_nss_mask != vht_nss_mask || ht_nss_mask != he_nss_mask)
return false;

if (ht_nss_mask == 0)
@@ -7800,54 +8094,158 @@ ath12k_mac_get_single_legacy_rate(struct ath12k *ar,
return 0;
}

-static int ath12k_mac_set_fixed_rate_params(struct ath12k_vif *arvif,
- u32 rate, u8 nss, u8 sgi, u8 ldpc)
+static int
+ath12k_mac_set_fixed_rate_gi_ltf(struct ath12k_vif *arvif, u8 he_gi, u8 he_ltf)
{
struct ath12k *ar = arvif->ar;
- u32 vdev_param;
int ret;

- lockdep_assert_held(&ar->conf_mutex);
+ /* 0.8 = 0, 1.6 = 2 and 3.2 = 3. */
+ if (he_gi && he_gi != 0xFF)
+ he_gi += 1;

- ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac set fixed rate params vdev %i rate 0x%02x nss %u sgi %u\n",
- arvif->vdev_id, rate, nss, sgi);
+ ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+ WMI_VDEV_PARAM_SGI, he_gi);
+ if (ret) {
+ ath12k_warn(ar->ab, "failed to set HE GI:%d, error:%d\n",
+ he_gi, ret);
+ return ret;
+ }
+ /* start from 1 */
+ if (he_ltf != 0xFF)
+ he_ltf += 1;

- vdev_param = WMI_VDEV_PARAM_FIXED_RATE;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- vdev_param, rate);
+ WMI_VDEV_PARAM_HE_LTF, he_ltf);
if (ret) {
- ath12k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n",
- rate, ret);
+ ath12k_warn(ar->ab, "failed to set HE LTF:%d, error:%d\n",
+ he_ltf, ret);
return ret;
}
+ return 0;
+}
+
+static int
+ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_vif *arvif, u16 he_gi, u8 he_ltf)
+{
+ struct ath12k *ar = arvif->ar;
+ int ret;
+ u32 he_ar_gi_ltf;
+
+ if (he_gi != 0xFF) {
+ switch (he_gi) {
+ case NL80211_RATE_INFO_HE_GI_0_8:
+ he_gi = WMI_AUTORATE_800NS_GI;
+ break;
+ case NL80211_RATE_INFO_HE_GI_1_6:
+ he_gi = WMI_AUTORATE_1600NS_GI;
+ break;
+ case NL80211_RATE_INFO_HE_GI_3_2:
+ he_gi = WMI_AUTORATE_3200NS_GI;
+ break;
+ default:
+ ath12k_warn(ar->ab, "Invalid GI\n");
+ return -EINVAL;
+ }
+ }
+
+ if (he_ltf != 0xFF) {
+ switch (he_ltf) {
+ case NL80211_RATE_INFO_HE_1XLTF:
+ he_ltf = WMI_HE_AUTORATE_LTF_1X;
+ break;
+ case NL80211_RATE_INFO_HE_2XLTF:
+ he_ltf = WMI_HE_AUTORATE_LTF_2X;
+ break;
+ case NL80211_RATE_INFO_HE_4XLTF:
+ he_ltf = WMI_HE_AUTORATE_LTF_4X;
+ break;
+ default:
+ ath12k_warn(ar->ab, "Invalid LTF\n");
+ return -EINVAL;
+ }
+ }
+
+ he_ar_gi_ltf = he_gi | he_ltf;

- vdev_param = WMI_VDEV_PARAM_NSS;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- vdev_param, nss);
+ WMI_VDEV_PARAM_AUTORATE_MISC_CFG,
+ he_ar_gi_ltf);
if (ret) {
- ath12k_warn(ar->ab, "failed to set nss param %d: %d\n",
- nss, ret);
+ ath12k_warn(ar->ab,
+ "failed to set HE autorate GI:%u, LTF:%u params, error:%d\n",
+ he_gi, he_ltf, ret);
return ret;
}

- vdev_param = WMI_VDEV_PARAM_SGI;
+ return 0;
+}
+
+static int ath12k_mac_set_rate_params(struct ath12k_vif *arvif,
+ u32 rate, u8 nss, u8 sgi, u8 ldpc,
+ u8 he_gi, u8 he_ltf, bool he_fixed_rate)
+{
+ struct ath12k *ar = arvif->ar;
+ u32 vdev_param;
+ int ret;
+
+ lockdep_assert_held(&ar->conf_mutex);
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac set rate params vdev %i rate 0x%02x nss 0x%02x sgi 0x%02x ldpc 0x%02x\n",
+ arvif->vdev_id, rate, nss, sgi, ldpc);
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "he_gi 0x%02x he_ltf 0x%02x he_fixed_rate %d\n", he_gi,
+ he_ltf, he_fixed_rate);
+
+ if (!arvif->vif->bss_conf.he_support) {
+ vdev_param = WMI_VDEV_PARAM_FIXED_RATE;
+ ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+ vdev_param, rate);
+ if (ret) {
+ ath12k_warn(ar->ab, "failed to set fixed rate param 0x%02x: %d\n",
+ rate, ret);
+ return ret;
+ }
+ }
+
+ vdev_param = WMI_VDEV_PARAM_NSS;
+
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- vdev_param, sgi);
+ vdev_param, nss);
if (ret) {
- ath12k_warn(ar->ab, "failed to set sgi param %d: %d\n",
- sgi, ret);
+ ath12k_warn(ar->ab, "failed to set nss param %d: %d\n",
+ nss, ret);
return ret;
}

- vdev_param = WMI_VDEV_PARAM_LDPC;
ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
- vdev_param, ldpc);
+ WMI_VDEV_PARAM_LDPC, ldpc);
if (ret) {
ath12k_warn(ar->ab, "failed to set ldpc param %d: %d\n",
ldpc, ret);
return ret;
}

+ if (arvif->vif->bss_conf.he_support) {
+ if (he_fixed_rate)
+ ret = ath12k_mac_set_fixed_rate_gi_ltf(arvif, he_gi, he_ltf);
+ else
+ ret = ath12k_mac_set_auto_rate_gi_ltf(arvif, he_gi, he_ltf);
+ if (ret)
+ return ret;
+ } else {
+ vdev_param = WMI_VDEV_PARAM_SGI;
+ ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
+ vdev_param, sgi);
+ if (ret) {
+ ath12k_warn(ar->ab, "failed to set sgi param %d: %d\n",
+ sgi, ret);
+ return ret;
+ }
+ }
+
return 0;
}

@@ -7876,6 +8274,31 @@ ath12k_mac_vht_mcs_range_present(struct ath12k *ar,
return true;
}

+static bool
+ath12k_mac_he_mcs_range_present(struct ath12k *ar,
+ enum nl80211_band band,
+ const struct cfg80211_bitrate_mask *mask)
+{
+ int i;
+ u16 he_mcs;
+
+ for (i = 0; i < NL80211_HE_NSS_MAX; i++) {
+ he_mcs = mask->control[band].he_mcs[i];
+
+ switch (he_mcs) {
+ case 0:
+ case BIT(8) - 1:
+ case BIT(10) - 1:
+ case BIT(12) - 1:
+ break;
+ default:
+ return false;
+ }
+ }
+
+ return true;
+}
+
static void ath12k_mac_set_bitrate_mask_iter(void *data,
struct ieee80211_sta *sta)
{
@@ -7914,6 +8337,54 @@ static void ath12k_mac_disable_peer_fixed_rate(void *data,
sta->addr, ret);
}

+static int
+ath12k_mac_validate_vht_he_fixed_rate_settings(struct ath12k *ar, enum nl80211_band band,
+ const struct cfg80211_bitrate_mask *mask)
+{
+ bool he_fixed_rate = false, vht_fixed_rate = false;
+ struct ath12k_peer *peer;
+ const u16 *vht_mcs_mask, *he_mcs_mask;
+ u8 vht_nss, he_nss;
+ int ret = 0;
+
+ vht_mcs_mask = mask->control[band].vht_mcs;
+ he_mcs_mask = mask->control[band].he_mcs;
+
+ if (ath12k_mac_bitrate_mask_num_vht_rates(ar, band, mask) == 1)
+ vht_fixed_rate = true;
+
+ if (ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask) == 1)
+ he_fixed_rate = true;
+
+ if (!vht_fixed_rate && !he_fixed_rate)
+ return 0;
+
+ vht_nss = ath12k_mac_max_vht_nss(vht_mcs_mask);
+ he_nss = ath12k_mac_max_he_nss(he_mcs_mask);
+
+ rcu_read_lock();
+ spin_lock_bh(&ar->ab->base_lock);
+ list_for_each_entry(peer, &ar->ab->peers, list) {
+ if (peer->sta) {
+ if (vht_fixed_rate &&
+ (!peer->sta->deflink.vht_cap.vht_supported ||
+ peer->sta->deflink.rx_nss < vht_nss)) {
+ ret = -EINVAL;
+ goto exit;
+ }
+ if (he_fixed_rate && (!peer->sta->deflink.he_cap.has_he ||
+ peer->sta->deflink.rx_nss < he_nss)) {
+ ret = -EINVAL;
+ goto exit;
+ }
+ }
+ }
+exit:
+ spin_unlock_bh(&ar->ab->base_lock);
+ rcu_read_unlock();
+ return ret;
+}
+
static int
ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
@@ -7925,13 +8396,17 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
enum nl80211_band band;
const u8 *ht_mcs_mask;
const u16 *vht_mcs_mask;
+ const u16 *he_mcs_mask;
+ u8 he_ltf = 0;
+ u8 he_gi = 0;
u32 rate;
- u8 nss;
+ u8 nss, mac_nss;
u8 sgi;
u8 ldpc;
int single_nss;
int ret;
int num_rates;
+ bool he_fixed_rate = false;

if (ath12k_mac_vif_chan(vif, &def))
return -EPERM;
@@ -7939,6 +8414,7 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
band = def.chan->band;
ht_mcs_mask = mask->control[band].ht_mcs;
vht_mcs_mask = mask->control[band].vht_mcs;
+ he_mcs_mask = mask->control[band].he_mcs;
ldpc = !!(ar->ht_cap_info & WMI_HT_CAP_LDPC);

sgi = mask->control[band].gi;
@@ -7947,6 +8423,9 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
goto out;
}

+ he_gi = mask->control[band].he_gi;
+ he_ltf = mask->control[band].he_ltf;
+
/* mac80211 doesn't support sending a fixed HT/VHT MCS alone, rather it
* requires passing at least one of used basic rates along with them.
* Fixed rate setting across different preambles(legacy, HT, VHT) is
@@ -7970,11 +8449,23 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
&single_nss)) {
rate = WMI_FIXED_RATE_NONE;
nss = single_nss;
+ mutex_lock(&ar->conf_mutex);
+ arvif->bitrate_mask = *mask;
+ ieee80211_iterate_stations_atomic(hw,
+ ath12k_mac_set_bitrate_mask_iter,
+ arvif);
+ mutex_unlock(&ar->conf_mutex);
} else {
rate = WMI_FIXED_RATE_NONE;
- nss = min_t(u32, ar->num_tx_chains,
- max(ath12k_mac_max_ht_nss(ht_mcs_mask),
- ath12k_mac_max_vht_nss(vht_mcs_mask)));
+
+ if (!ath12k_mac_validate_vht_he_fixed_rate_settings(ar, band, mask))
+ ath12k_warn(ar->ab,
+ "could not update fixed rate settings to all peers due to mcs/nss incompatiblity\n");
+
+ mac_nss = max3(ath12k_mac_max_ht_nss(ht_mcs_mask),
+ ath12k_mac_max_vht_nss(vht_mcs_mask),
+ ath12k_mac_max_he_nss(he_mcs_mask));
+ nss = min_t(u32, ar->num_tx_chains, mac_nss);

/* If multiple rates across different preambles are given
* we can reconfigure this info with all peers using PEER_ASSOC
@@ -8010,12 +8501,22 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,
goto out;
}

+ num_rates = ath12k_mac_bitrate_mask_num_he_rates(ar, band, mask);
+ if (num_rates == 1)
+ he_fixed_rate = true;
+
+ if (!ath12k_mac_he_mcs_range_present(ar, band, mask) &&
+ num_rates > 1) {
+ ath12k_warn(ar->ab,
+ "Setting more than one HE MCS Value in bitrate mask not supported\n");
+ return -EINVAL;
+ }
+
+ mutex_lock(&ar->conf_mutex);
ieee80211_iterate_stations_atomic(hw,
ath12k_mac_disable_peer_fixed_rate,
arvif);

- mutex_lock(&ar->conf_mutex);
-
arvif->bitrate_mask = *mask;
ieee80211_iterate_stations_atomic(hw,
ath12k_mac_set_bitrate_mask_iter,
@@ -8026,9 +8527,10 @@ ath12k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw,

mutex_lock(&ar->conf_mutex);

- ret = ath12k_mac_set_fixed_rate_params(arvif, rate, nss, sgi, ldpc);
+ ret = ath12k_mac_set_rate_params(arvif, rate, nss, sgi, ldpc, he_gi,
+ he_ltf, he_fixed_rate);
if (ret) {
- ath12k_warn(ar->ab, "failed to set fixed rate params on vdev %i: %d\n",
+ ath12k_warn(ar->ab, "failed to set rate params on vdev %i: %d\n",
arvif->vdev_id, ret);
}

diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 97500195ca85..6627e2ceb6a9 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -219,6 +219,22 @@ enum WMI_HOST_WLAN_BAND {
WMI_HOST_WLAN_2G_5G_CAP = 3,
};

+/* Parameters used for WMI_VDEV_PARAM_AUTORATE_MISC_CFG command.
+ * Used only for HE auto rate mode.
+ */
+enum {
+ /* HE LTF related configuration */
+ WMI_HE_AUTORATE_LTF_1X = BIT(0),
+ WMI_HE_AUTORATE_LTF_2X = BIT(1),
+ WMI_HE_AUTORATE_LTF_4X = BIT(2),
+
+ /* HE GI related configuration */
+ WMI_AUTORATE_400NS_GI = BIT(8),
+ WMI_AUTORATE_800NS_GI = BIT(9),
+ WMI_AUTORATE_1600NS_GI = BIT(10),
+ WMI_AUTORATE_3200NS_GI = BIT(11),
+};
+
enum wmi_cmd_group {
/* 0 to 2 are reserved */
WMI_GRP_START = 0x3,
@@ -1131,7 +1147,9 @@ enum wmi_tlv_vdev_param {
WMI_VDEV_PARAM_HE_RANGE_EXT,
WMI_VDEV_PARAM_ENABLE_BCAST_PROBE_RESPONSE,
WMI_VDEV_PARAM_FILS_MAX_CHANNEL_GUARD_TIME,
+ WMI_VDEV_PARAM_HE_LTF = 0x74,
WMI_VDEV_PARAM_BA_MODE = 0x7e,
+ WMI_VDEV_PARAM_AUTORATE_MISC_CFG = 0x80,
WMI_VDEV_PARAM_SET_HE_SOUNDING_MODE = 0x87,
WMI_VDEV_PARAM_6GHZ_PARAMS = 0x99,
WMI_VDEV_PARAM_PROTOTYPE = 0x8000,
--
2.17.1


2024-04-24 20:44:34

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: [PATCH v3 09/10] wifi: ath12k: add support for 160 MHz bandwidth

Add support to configure maximum NSS in 160 MHz bandwidth.
Firmware advertizes support for handling NSS ratio information
as a part of service ready ext event using nss_ratio_enabled
flag. Save this information in ath12k_pdev_cap to calculate
NSS ratio.

Additionally, reorder the code by moving
ath12k_peer_assoc_h_phymode() before ath12k_peer_assoc_h_vht()
to ensure that arg->peer_phymode correctly reflects the bandwidth
in the max NSS calculation.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Co-developed-by: P Praneesh <[email protected]>
Signed-off-by: P Praneesh <[email protected]>
Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
---
drivers/net/wireless/ath/ath12k/core.h | 2 +
drivers/net/wireless/ath/ath12k/mac.c | 85 ++++++++++++++++++++++----
drivers/net/wireless/ath/ath12k/mac.h | 2 +
drivers/net/wireless/ath/ath12k/wmi.c | 19 +++++-
drivers/net/wireless/ath/ath12k/wmi.h | 28 +++++++++
5 files changed, 124 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index 47dde4401210..a0375884ab95 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -673,6 +673,8 @@ struct ath12k_pdev_cap {
u32 tx_chain_mask_shift;
u32 rx_chain_mask_shift;
struct ath12k_band_cap band[NUM_NL80211_BANDS];
+ bool nss_ratio_enabled;
+ u8 nss_ratio_info;
};

struct mlo_timestamp {
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 3ec58b96760c..87830865bec2 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -1799,6 +1799,34 @@ ath12k_peer_assoc_h_vht_limit(u16 tx_mcs_set,
return tx_mcs_set;
}

+static u8 ath12k_get_nss_160mhz(struct ath12k *ar,
+ u8 max_nss)
+{
+ u8 nss_ratio_info = ar->pdev->cap.nss_ratio_info;
+ u8 max_sup_nss = 0;
+
+ switch (nss_ratio_info) {
+ case WMI_NSS_RATIO_1BY2_NSS:
+ max_sup_nss = max_nss >> 1;
+ break;
+ case WMI_NSS_RATIO_3BY4_NSS:
+ ath12k_warn(ar->ab, "WMI_NSS_RATIO_3BY4_NSS not supported\n");
+ break;
+ case WMI_NSS_RATIO_1_NSS:
+ max_sup_nss = max_nss;
+ break;
+ case WMI_NSS_RATIO_2_NSS:
+ ath12k_warn(ar->ab, "WMI_NSS_RATIO_2_NSS not supported\n");
+ break;
+ default:
+ ath12k_warn(ar->ab, "invalid nss ratio received from fw: %d\n",
+ nss_ratio_info);
+ break;
+ }
+
+ return max_sup_nss;
+}
+
static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
@@ -1814,6 +1842,7 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
u8 max_nss, vht_mcs;
int i, vht_nss, nss_idx;
bool user_rate_valid = true;
+ u32 rx_nss, tx_nss, nss_160;

if (WARN_ON(ath12k_mac_vif_chan(vif, &def)))
return;
@@ -1908,10 +1937,24 @@ static void ath12k_peer_assoc_h_vht(struct ath12k *ar,
/* TODO: Check */
arg->tx_max_mcs_nss = 0xFF;

- ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n",
- sta->addr, arg->peer_max_mpdu, arg->peer_flags);
+ if (arg->peer_phymode == MODE_11AC_VHT160) {
+ tx_nss = ath12k_get_nss_160mhz(ar, max_nss);
+ rx_nss = min(arg->peer_nss, tx_nss);
+ arg->peer_bw_rxnss_override = ATH12K_BW_NSS_MAP_ENABLE;

- /* TODO: rxnss_override */
+ if (!rx_nss) {
+ ath12k_warn(ar->ab, "invalid max_nss\n");
+ return;
+ }
+
+ nss_160 = u32_encode_bits(rx_nss - 1, ATH12K_PEER_RX_NSS_160MHZ);
+ arg->peer_bw_rxnss_override |= nss_160;
+ }
+
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
+ "mac vht peer %pM max_mpdu %d flags 0x%x nss_override 0x%x\n",
+ sta->addr, arg->peer_max_mpdu, arg->peer_flags,
+ arg->peer_bw_rxnss_override);
}

static int ath12k_mac_get_max_he_mcs_map(u16 mcs_map, int nss)
@@ -1998,6 +2041,7 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
u16 he_tx_mcs = 0, v = 0;
int he_nss, nss_idx;
bool user_rate_valid = true;
+ u32 rx_nss, tx_nss, nss_160;

if (WARN_ON(ath12k_mac_vif_chan(vif, &def)))
return;
@@ -2177,11 +2221,28 @@ static void ath12k_peer_assoc_h_he(struct ath12k *ar,
he_mcs_mask[i])
max_nss = i + 1;
}
+ max_nss = min(max_nss, ar->num_tx_chains);
arg->peer_nss = min(sta->deflink.rx_nss, max_nss);

+ if (arg->peer_phymode == MODE_11AX_HE160) {
+ tx_nss = ath12k_get_nss_160mhz(ar, max_nss);
+ rx_nss = min(arg->peer_nss, tx_nss);
+ arg->peer_bw_rxnss_override = ATH12K_BW_NSS_MAP_ENABLE;
+
+ if (!rx_nss) {
+ ath12k_warn(ar->ab, "invalid max_nss\n");
+ return;
+ }
+
+ nss_160 = u32_encode_bits(rx_nss - 1, ATH12K_PEER_RX_NSS_160MHZ);
+ arg->peer_bw_rxnss_override |= nss_160;
+ }
+
ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
- "mac he peer %pM nss %d mcs cnt %d\n",
- sta->deflink.addr, arg->peer_nss, arg->peer_he_mcs_count);
+ "mac he peer %pM nss %d mcs cnt %d nss_override 0x%x\n",
+ sta->deflink.addr, arg->peer_nss,
+ arg->peer_he_mcs_count,
+ arg->peer_bw_rxnss_override);
}

static void ath12k_peer_assoc_h_smps(struct ieee80211_sta *sta,
@@ -2642,12 +2703,12 @@ static void ath12k_peer_assoc_prepare(struct ath12k *ar,
ath12k_peer_assoc_h_basic(ar, vif, sta, arg);
ath12k_peer_assoc_h_crypto(ar, vif, sta, arg);
ath12k_peer_assoc_h_rates(ar, vif, sta, arg);
+ ath12k_peer_assoc_h_phymode(ar, vif, sta, arg);
ath12k_peer_assoc_h_ht(ar, vif, sta, arg);
ath12k_peer_assoc_h_vht(ar, vif, sta, arg);
ath12k_peer_assoc_h_he(ar, vif, sta, arg);
ath12k_peer_assoc_h_eht(ar, vif, sta, arg);
ath12k_peer_assoc_h_qos(ar, vif, sta, arg);
- ath12k_peer_assoc_h_phymode(ar, vif, sta, arg);
ath12k_peer_assoc_h_smps(sta, arg);

/* TODO: amsdu_disable req? */
@@ -5192,10 +5253,8 @@ ath12k_create_vht_cap(struct ath12k *ar, u32 rate_cap_tx_chainmask,

ath12k_set_vht_txbf_cap(ar, &vht_cap.cap);

- /* TODO: Enable back VHT160 mode once association issues are fixed */
- /* Disabling VHT160 and VHT80+80 modes */
- vht_cap.cap &= ~IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
- vht_cap.cap &= ~IEEE80211_VHT_CAP_SHORT_GI_160;
+ /* 80P80 is not supported */
+ vht_cap.cap &= ~IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ;

rxmcs_map = 0;
txmcs_map = 0;
@@ -9075,7 +9134,8 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah)
combinations[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
BIT(NL80211_CHAN_WIDTH_20) |
BIT(NL80211_CHAN_WIDTH_40) |
- BIT(NL80211_CHAN_WIDTH_80);
+ BIT(NL80211_CHAN_WIDTH_80) |
+ BIT(NL80211_CHAN_WIDTH_160);

wiphy->iface_combinations = combinations;
wiphy->n_iface_combinations = 1;
@@ -9282,6 +9342,9 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
ieee80211_hw_set(hw, SUPPORTS_TX_FRAG);
ieee80211_hw_set(hw, REPORTS_LOW_ACK);

+ if (cap->nss_ratio_enabled)
+ ieee80211_hw_set(hw, SUPPORTS_VHT_EXT_NSS_BW);
+
if (ht_cap & WMI_HT_CAP_ENABLED) {
ieee80211_hw_set(hw, AMPDU_AGGREGATION);
ieee80211_hw_set(hw, TX_AMPDU_SETUP_IN_HW);
diff --git a/drivers/net/wireless/ath/ath12k/mac.h b/drivers/net/wireless/ath/ath12k/mac.h
index e5193a44f344..ced73bb99169 100644
--- a/drivers/net/wireless/ath/ath12k/mac.h
+++ b/drivers/net/wireless/ath/ath12k/mac.h
@@ -36,6 +36,8 @@ struct ath12k_generic_iter {
#define IEEE80211_DISABLE_VHT_MCS_SUPPORT_0_11 BIT(24)

#define ATH12K_CHAN_WIDTH_NUM 14
+#define ATH12K_BW_NSS_MAP_ENABLE BIT(31)
+#define ATH12K_PEER_RX_NSS_160MHZ GENMASK(2, 0)

#define ATH12K_TX_POWER_MAX_VAL 70
#define ATH12K_TX_POWER_MIN_VAL 0
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index c64d1085dfe8..414c4f8829ec 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -519,6 +519,10 @@ ath12k_pull_mac_phy_cap_svc_ready_ext(struct ath12k_wmi_pdev *wmi_handle,
pdev_cap->he_mcs = le32_to_cpu(mac_caps->he_supp_mcs_5g);
pdev_cap->tx_chain_mask = le32_to_cpu(mac_caps->tx_chain_mask_5g);
pdev_cap->rx_chain_mask = le32_to_cpu(mac_caps->rx_chain_mask_5g);
+ pdev_cap->nss_ratio_enabled =
+ WMI_NSS_RATIO_EN_DIS_GET(mac_caps->nss_ratio);
+ pdev_cap->nss_ratio_info =
+ WMI_NSS_RATIO_INFO_GET(mac_caps->nss_ratio);
} else {
return -EINVAL;
}
@@ -974,11 +978,24 @@ int ath12k_wmi_vdev_down(struct ath12k *ar, u8 vdev_id)
static void ath12k_wmi_put_wmi_channel(struct ath12k_wmi_channel_params *chan,
struct wmi_vdev_start_req_arg *arg)
{
+ u32 center_freq1 = arg->band_center_freq1;
+
memset(chan, 0, sizeof(*chan));

chan->mhz = cpu_to_le32(arg->freq);
chan->band_center_freq1 = cpu_to_le32(arg->band_center_freq1);
- chan->band_center_freq2 = 0;
+ if (arg->mode == MODE_11AX_HE160) {
+ if (arg->freq > center_freq1)
+ chan->band_center_freq1 =
+ cpu_to_le32(center_freq1 + 40);
+ else
+ chan->band_center_freq1 =
+ cpu_to_le32(center_freq1 - 40);
+
+ chan->band_center_freq2 = cpu_to_le32(arg->band_center_freq1);
+ } else {
+ chan->band_center_freq2 = 0;
+ }

chan->info |= le32_encode_bits(arg->mode, WMI_CHAN_INFO_MODE);
if (arg->passive)
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 49f485477d41..d5eb5982af47 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -2262,6 +2262,21 @@ enum wmi_direct_buffer_module {
WMI_DIRECT_BUF_MAX
};

+/**
+ * enum wmi_nss_ratio - NSS ratio received from FW during service ready ext event
+ * @WMI_NSS_RATIO_1BY2_NSS: Max nss of 160MHz is equals to half of the max nss of 80MHz
+ * @WMI_NSS_RATIO_3BY4_NSS: Max nss of 160MHz is equals to 3/4 of the max nss of 80MHz
+ * @WMI_NSS_RATIO_1_NSS: Max nss of 160MHz is equals to the max nss of 80MHz
+ * @WMI_NSS_RATIO_2_NSS: Max nss of 160MHz is equals to two times the max nss of 80MHz
+ */
+
+enum wmi_nss_ratio {
+ WMI_NSS_RATIO_1BY2_NSS,
+ WMI_NSS_RATIO_3BY4_NSS,
+ WMI_NSS_RATIO_1_NSS,
+ WMI_NSS_RATIO_2_NSS
+};
+
struct ath12k_wmi_pdev_band_arg {
u32 pdev_id;
u32 start_freq;
@@ -2568,6 +2583,12 @@ struct ath12k_wmi_hw_mode_cap_params {
} __packed;

#define WMI_MAX_HECAP_PHY_SIZE (3)
+#define WMI_NSS_RATIO_EN_DIS_BITPOS BIT(0)
+#define WMI_NSS_RATIO_EN_DIS_GET(_val) \
+ le32_get_bits(_val, WMI_NSS_RATIO_EN_DIS_BITPOS)
+#define WMI_NSS_RATIO_INFO_BITPOS GENMASK(4, 1)
+#define WMI_NSS_RATIO_INFO_GET(_val) \
+ le32_get_bits(_val, WMI_NSS_RATIO_INFO_BITPOS)

/* pdev_id is present in lower 16 bits of pdev_and_hw_link_ids in
* ath12k_wmi_mac_phy_caps_params & ath12k_wmi_caps_ext_params.
@@ -2609,6 +2630,13 @@ struct ath12k_wmi_mac_phy_caps_params {
__le32 he_cap_info_2g_ext;
__le32 he_cap_info_5g_ext;
__le32 he_cap_info_internal;
+ __le32 wireless_modes;
+ __le32 low_2ghz_chan_freq;
+ __le32 high_2ghz_chan_freq;
+ __le32 low_5ghz_chan_freq;
+ __le32 high_5ghz_chan_freq;
+ __le32 nss_ratio;
+
} __packed;

struct ath12k_wmi_hal_reg_caps_ext_params {
--
2.17.1


2024-04-25 06:48:17

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3 00/10] wifi: ath12k: add MU-MIMO and 160 MHz bandwidth support

Pradeep Kumar Chitrapu <[email protected]> writes:

> Add support for
> 1. enabling MU-MIMO in HE and EHT modes from hardware
> 2. setting fixed HE rate/GI/LTF
> 3. 160 MHz bandwidth in HE mode
> 4. extended NSS bandwidth support
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>
> changes in v3:
> - address review comments for fixing ath12k-check issues.
>
> changes in v2:
> - Amend mac80211 patch description as the patch is not specific
> to AP mode.
> - Amend EHT MU-MIMO patch description to specify future support
> for STA mode.
>
> Pradeep Kumar Chitrapu (10):
> wifi: mac80211: Add EHT UL MU-MIMO flag in ieee80211_bss_conf
> wifi: ath12k: push HE MU-MIMO params from hostapd to hardware
> wifi: ath12k: push EHT MU-MIMO params from hostapd to hardware
> wifi: ath12k: move HE MCS mapper to a separate function
> wifi: ath12k: generate rx and tx mcs maps for supported HE mcs
> wifi: ath12k: fix TX and RX MCS rate configurations in HE mode
> wifi: ath12k: add support for setting fixed HE rate/GI/LTF
> wifi: ath12k: clean up 80P80 support
> wifi: ath12k: add support for 160 MHz bandwidth
> wifi: ath12k: add extended NSS bandwidth support for 160 MHz
>
> drivers/net/wireless/ath/ath12k/core.h | 2 +
> drivers/net/wireless/ath/ath12k/mac.c | 1043 ++++++++++++++++++++----
> drivers/net/wireless/ath/ath12k/mac.h | 17 +
> drivers/net/wireless/ath/ath12k/wmi.c | 24 +-
> drivers/net/wireless/ath/ath12k/wmi.h | 98 ++-
> include/net/mac80211.h | 4 +
> net/mac80211/cfg.c | 5 +
> 7 files changed, 986 insertions(+), 207 deletions(-)
>
>
> base-commit: 1a17b8f9196db4d5b9f81f69cac885ba8c832da7
> prerequisite-patch-id: 6cb82354d93f2d3d0e61dca59b7939e1bae2f263
> prerequisite-patch-id: b93a6cfb7a9caa843eb4a1df2d400b56b548188f
> prerequisite-patch-id: bbf8aa44334b11e860f4b68c22607110e81498a1
> prerequisite-patch-id: 70140f291ade3c2db0a0f36fe1c7c7d93eedfdeb
> prerequisite-patch-id: c52742e59bc5db2742ab66ec16175e983b88fb72
> prerequisite-patch-id: 8f9c43d387ec6bcf807f53dc17dcaaaa21c8a03f
> prerequisite-patch-id: a36bcb4e892019e5dcc39854088371e1c20e4ebf
> prerequisite-patch-id: 42864cd08f6d37e14f1794d29e13f8a094e489cc
> prerequisite-patch-id: 67eb3991126edab717635666297a6a910adbb8c1
> prerequisite-patch-id: be513e07c8fbbc556d3b61f2356d0a4391901ba5
> prerequisite-patch-id: 6dd663b6660f5f8d49fbd3e49023d0fd851100dc
> prerequisite-patch-id: 77ba10656791f90eeeb88ef749829b1474de4280
> prerequisite-patch-id: ec4c06aca44fecabfbdbf305581c60587cf23e63
> prerequisite-patch-id: f24c686941a9136ff7d800a726fad8c5d5d3b1b1
> prerequisite-patch-id: 14c827bfdc875273056194059bcd0cb042db123a
> prerequisite-patch-id: c1adce3c611529902e3a19a74f775cfffbba69b3
> prerequisite-patch-id: a4ff79eb14ba0e59508ce72e0d0eca56da2b6060
> prerequisite-patch-id: 66d93f366737e1a4b1e3c0a10747994b39bdd49a
> prerequisite-patch-id: 4890b86b151fad62b5a37688d813696f507cd9b1
> prerequisite-patch-id: 58918f67d676fafe5c527c83d1401da8cd30cb41
> prerequisite-patch-id: d6acc523424cd3049f471191406d456625a903ee
> prerequisite-patch-id: ce6f394abfaa9dbf2e818379850b911ea380e8ff
> prerequisite-patch-id: 92fc0dabdc596b6d1f4940a8be86f9558dabede9
> prerequisite-patch-id: 34f4bf81393b8f035604eca6fb13a964dc933fb0
> prerequisite-patch-id: d14a14bb3e1b22afdce181eab811e4151b837b7e
> prerequisite-patch-id: 275f221e85124f4cccac788a2d109dd71bb611f8
> prerequisite-patch-id: a68de371d003e45f93defbadaa164ce016f62b43
> prerequisite-patch-id: d156ad9d641c02cb2b00bb2a9bb3952f1ee1eda5
> prerequisite-patch-id: 022d675781d55b377befb1bfa73cdd13eb544919
> prerequisite-patch-id: cd0f4fc60b3e60fd5daed4c4aef5ff836a1d6afe
> prerequisite-patch-id: 2d8e31915fb462a006aa36a878afc722dae702f1
> prerequisite-patch-id: 6db9ebc02e7aff5b0dd6a791bcb56b174b8f5075
> prerequisite-patch-id: 8ab4b749c404278c6f3284e7626f7fc34f4c168c
> prerequisite-patch-id: 3132da2b7c8c7c62e27c995c81a2805898bbecf5
> prerequisite-patch-id: 47954405bc0dd7a3b89981a1f62b2942c6690321
> prerequisite-patch-id: 9394e4f195275a48ccc6feb79a69391bd5a081ac
> prerequisite-patch-id: 73a8dedb5b3270e36d08453ecde5a1eda1d488df
> prerequisite-patch-id: 0b51e47032752aff3d731c060f9ec63de49d6efa
> prerequisite-patch-id: de40f7811a733a0e14e2bb9e263e632a488c350a
> prerequisite-patch-id: 018f54a2e185dac93eb3ff126a3dcfe830797da7
> prerequisite-patch-id: 65c73a3902c82ed46fd45ba3e02477746b80f43f
> prerequisite-patch-id: 0a3e374a2927cc6b36aa886562ea74197f3e31e1
> prerequisite-patch-id: 197d9f2f52a4f397bcadfb097f66026aec7d8531
> prerequisite-patch-id: 0d2aedbe585ef88c171a8e6e07c88cdbc4269194
> prerequisite-patch-id: 445f5b16f72a183fcf92eadbd1329902267ecfc5
> prerequisite-patch-id: c753615aebcfe5d7419d00f11ef94c41618032d1
> prerequisite-patch-id: b15f736df11c88fb96a180e0d928a6e1cd0c0f34
> prerequisite-patch-id: 6eb961cc481ac73a4e17b2338814fb2f86b02b2a
> prerequisite-patch-id: fdddada4c012b7d7cc79d1e17caccac67ee63bef
> prerequisite-patch-id: ffd8fb7974d49d06574ab4b97b0ca74a3b2e5e21
> prerequisite-patch-id: d56eb0552657a692d6db25fb1badba1f06769c07
> prerequisite-patch-id: 468fad8de3fef4b8c470408fb1db12edd4a195c0
> prerequisite-patch-id: 9f816eb8e25fa683f06c2f5e5317ac7a51d57ab9
> prerequisite-patch-id: 734bba56b6da8d0ba773c335e1da4926fe8b8035
> prerequisite-patch-id: 8db71e2c9424eb2d1296c73100d34c8f9bcdde0b
> prerequisite-patch-id: bdadfa11d95682aeb60202635ce434c98e451c20
> prerequisite-patch-id: 3af02179828c0bb21ab1d4bd9ff61231ef091162
> prerequisite-patch-id: 861aa5786a781f71cf5adfabc531ca6b61ef1c72
> prerequisite-patch-id: b3df68b21838ded80f002482f69d7a458776cf99
> prerequisite-patch-id: 11d0c8923fe6f22cebf2afcd57e3bf7c8f36b4f9
> prerequisite-patch-id: 599e5c0a6a6c9e9a12ee422f4af9340c0b465f67
> prerequisite-patch-id: 13952e429c380cd716c6f449df3dcedaae109479
> prerequisite-patch-id: 07c9ff6fcaf4ba464be993caa19eb49113eedbdf

Whoa, what's this huge prerequisite-patch-id list? There's no mention of
dependencies in the cover letter.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2024-04-25 22:56:30

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
> Add support to set fixed HE rate/GI/LTF values using nl80211.
> Reuse parts of the existing code path already used for HT/VHT
> to implement the new helpers symmetrically, similar to how
> HT/VHT is handled.
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>
> Co-developed-by: Muna Sinada <[email protected]>
> Signed-off-by: Muna Sinada <[email protected]>
> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
> ---

[...]

> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
> return false;
> }
>
> - if (ht_nss_mask != vht_nss_mask)
> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));

drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *



2024-04-25 23:07:38

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v3 00/10] wifi: ath12k: add MU-MIMO and 160 MHz bandwidth support

On 4/24/2024 11:48 PM, Kalle Valo wrote:
> Pradeep Kumar Chitrapu <[email protected]> writes:
>
>> Add support for
>> 1. enabling MU-MIMO in HE and EHT modes from hardware
>> 2. setting fixed HE rate/GI/LTF
>> 3. 160 MHz bandwidth in HE mode
>> 4. extended NSS bandwidth support
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
>>
>> changes in v3:
>> - address review comments for fixing ath12k-check issues.
>>
>> changes in v2:
>> - Amend mac80211 patch description as the patch is not specific
>> to AP mode.
>> - Amend EHT MU-MIMO patch description to specify future support
>> for STA mode.
>>
>> Pradeep Kumar Chitrapu (10):
>> wifi: mac80211: Add EHT UL MU-MIMO flag in ieee80211_bss_conf
>> wifi: ath12k: push HE MU-MIMO params from hostapd to hardware
>> wifi: ath12k: push EHT MU-MIMO params from hostapd to hardware
>> wifi: ath12k: move HE MCS mapper to a separate function
>> wifi: ath12k: generate rx and tx mcs maps for supported HE mcs
>> wifi: ath12k: fix TX and RX MCS rate configurations in HE mode
>> wifi: ath12k: add support for setting fixed HE rate/GI/LTF
>> wifi: ath12k: clean up 80P80 support
>> wifi: ath12k: add support for 160 MHz bandwidth
>> wifi: ath12k: add extended NSS bandwidth support for 160 MHz
>>
>> drivers/net/wireless/ath/ath12k/core.h | 2 +
>> drivers/net/wireless/ath/ath12k/mac.c | 1043 ++++++++++++++++++++----
>> drivers/net/wireless/ath/ath12k/mac.h | 17 +
>> drivers/net/wireless/ath/ath12k/wmi.c | 24 +-
>> drivers/net/wireless/ath/ath12k/wmi.h | 98 ++-
>> include/net/mac80211.h | 4 +
>> net/mac80211/cfg.c | 5 +
>> 7 files changed, 986 insertions(+), 207 deletions(-)
>>
>>
>> base-commit: 1a17b8f9196db4d5b9f81f69cac885ba8c832da7
>> prerequisite-patch-id: 6cb82354d93f2d3d0e61dca59b7939e1bae2f263
>> prerequisite-patch-id: b93a6cfb7a9caa843eb4a1df2d400b56b548188f
>> prerequisite-patch-id: bbf8aa44334b11e860f4b68c22607110e81498a1
>> prerequisite-patch-id: 70140f291ade3c2db0a0f36fe1c7c7d93eedfdeb
>> prerequisite-patch-id: c52742e59bc5db2742ab66ec16175e983b88fb72
>> prerequisite-patch-id: 8f9c43d387ec6bcf807f53dc17dcaaaa21c8a03f
>> prerequisite-patch-id: a36bcb4e892019e5dcc39854088371e1c20e4ebf
>> prerequisite-patch-id: 42864cd08f6d37e14f1794d29e13f8a094e489cc
>> prerequisite-patch-id: 67eb3991126edab717635666297a6a910adbb8c1
>> prerequisite-patch-id: be513e07c8fbbc556d3b61f2356d0a4391901ba5
>> prerequisite-patch-id: 6dd663b6660f5f8d49fbd3e49023d0fd851100dc
>> prerequisite-patch-id: 77ba10656791f90eeeb88ef749829b1474de4280
>> prerequisite-patch-id: ec4c06aca44fecabfbdbf305581c60587cf23e63
>> prerequisite-patch-id: f24c686941a9136ff7d800a726fad8c5d5d3b1b1
>> prerequisite-patch-id: 14c827bfdc875273056194059bcd0cb042db123a
>> prerequisite-patch-id: c1adce3c611529902e3a19a74f775cfffbba69b3
>> prerequisite-patch-id: a4ff79eb14ba0e59508ce72e0d0eca56da2b6060
>> prerequisite-patch-id: 66d93f366737e1a4b1e3c0a10747994b39bdd49a
>> prerequisite-patch-id: 4890b86b151fad62b5a37688d813696f507cd9b1
>> prerequisite-patch-id: 58918f67d676fafe5c527c83d1401da8cd30cb41
>> prerequisite-patch-id: d6acc523424cd3049f471191406d456625a903ee
>> prerequisite-patch-id: ce6f394abfaa9dbf2e818379850b911ea380e8ff
>> prerequisite-patch-id: 92fc0dabdc596b6d1f4940a8be86f9558dabede9
>> prerequisite-patch-id: 34f4bf81393b8f035604eca6fb13a964dc933fb0
>> prerequisite-patch-id: d14a14bb3e1b22afdce181eab811e4151b837b7e
>> prerequisite-patch-id: 275f221e85124f4cccac788a2d109dd71bb611f8
>> prerequisite-patch-id: a68de371d003e45f93defbadaa164ce016f62b43
>> prerequisite-patch-id: d156ad9d641c02cb2b00bb2a9bb3952f1ee1eda5
>> prerequisite-patch-id: 022d675781d55b377befb1bfa73cdd13eb544919
>> prerequisite-patch-id: cd0f4fc60b3e60fd5daed4c4aef5ff836a1d6afe
>> prerequisite-patch-id: 2d8e31915fb462a006aa36a878afc722dae702f1
>> prerequisite-patch-id: 6db9ebc02e7aff5b0dd6a791bcb56b174b8f5075
>> prerequisite-patch-id: 8ab4b749c404278c6f3284e7626f7fc34f4c168c
>> prerequisite-patch-id: 3132da2b7c8c7c62e27c995c81a2805898bbecf5
>> prerequisite-patch-id: 47954405bc0dd7a3b89981a1f62b2942c6690321
>> prerequisite-patch-id: 9394e4f195275a48ccc6feb79a69391bd5a081ac
>> prerequisite-patch-id: 73a8dedb5b3270e36d08453ecde5a1eda1d488df
>> prerequisite-patch-id: 0b51e47032752aff3d731c060f9ec63de49d6efa
>> prerequisite-patch-id: de40f7811a733a0e14e2bb9e263e632a488c350a
>> prerequisite-patch-id: 018f54a2e185dac93eb3ff126a3dcfe830797da7
>> prerequisite-patch-id: 65c73a3902c82ed46fd45ba3e02477746b80f43f
>> prerequisite-patch-id: 0a3e374a2927cc6b36aa886562ea74197f3e31e1
>> prerequisite-patch-id: 197d9f2f52a4f397bcadfb097f66026aec7d8531
>> prerequisite-patch-id: 0d2aedbe585ef88c171a8e6e07c88cdbc4269194
>> prerequisite-patch-id: 445f5b16f72a183fcf92eadbd1329902267ecfc5
>> prerequisite-patch-id: c753615aebcfe5d7419d00f11ef94c41618032d1
>> prerequisite-patch-id: b15f736df11c88fb96a180e0d928a6e1cd0c0f34
>> prerequisite-patch-id: 6eb961cc481ac73a4e17b2338814fb2f86b02b2a
>> prerequisite-patch-id: fdddada4c012b7d7cc79d1e17caccac67ee63bef
>> prerequisite-patch-id: ffd8fb7974d49d06574ab4b97b0ca74a3b2e5e21
>> prerequisite-patch-id: d56eb0552657a692d6db25fb1badba1f06769c07
>> prerequisite-patch-id: 468fad8de3fef4b8c470408fb1db12edd4a195c0
>> prerequisite-patch-id: 9f816eb8e25fa683f06c2f5e5317ac7a51d57ab9
>> prerequisite-patch-id: 734bba56b6da8d0ba773c335e1da4926fe8b8035
>> prerequisite-patch-id: 8db71e2c9424eb2d1296c73100d34c8f9bcdde0b
>> prerequisite-patch-id: bdadfa11d95682aeb60202635ce434c98e451c20
>> prerequisite-patch-id: 3af02179828c0bb21ab1d4bd9ff61231ef091162
>> prerequisite-patch-id: 861aa5786a781f71cf5adfabc531ca6b61ef1c72
>> prerequisite-patch-id: b3df68b21838ded80f002482f69d7a458776cf99
>> prerequisite-patch-id: 11d0c8923fe6f22cebf2afcd57e3bf7c8f36b4f9
>> prerequisite-patch-id: 599e5c0a6a6c9e9a12ee422f4af9340c0b465f67
>> prerequisite-patch-id: 13952e429c380cd716c6f449df3dcedaae109479
>> prerequisite-patch-id: 07c9ff6fcaf4ba464be993caa19eb49113eedbdf
>
> Whoa, what's this huge prerequisite-patch-id list? There's no mention of
> dependencies in the cover letter.
>

FYI I was just able to pull this into a testing branch that already contains:
[PATCH v3 0/3] wifi: ath12k: Refactor the hardware recovery procedures
[PATCH v2 0/8] wifi: ath12k: Introduce device group abstraction
[PATCH] wifi: ath12k: fix the problem that down grade phy mode operation

There are a couple of smatch issues being flagged which I've responded to
individually.

/jeff

2024-04-25 23:37:35

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

On 4/25/2024 3:32 PM, Jeff Johnson wrote:
> On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
>> Add support to set fixed HE rate/GI/LTF values using nl80211.
>> Reuse parts of the existing code path already used for HT/VHT
>> to implement the new helpers symmetrically, similar to how
>> HT/VHT is handled.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>
>> Co-developed-by: Muna Sinada <[email protected]>
>> Signed-off-by: Muna Sinada <[email protected]>
>> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
>> ---
>
> [...]
>
>> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
>> return false;
>> }
>>
>> - if (ht_nss_mask != vht_nss_mask)
>> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
>
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *

for this issue you need to use ieee80211_get_he_iftype_cap() (may return NULL)


2024-04-26 07:31:42

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

Jeff Johnson <[email protected]> writes:

> On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
>> Add support to set fixed HE rate/GI/LTF values using nl80211.
>> Reuse parts of the existing code path already used for HT/VHT
>> to implement the new helpers symmetrically, similar to how
>> HT/VHT is handled.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>
>> Co-developed-by: Muna Sinada <[email protected]>
>> Signed-off-by: Muna Sinada <[email protected]>
>> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
>> ---
>
> [...]
>
>> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
>> return false;
>> }
>>
>> - if (ht_nss_mask != vht_nss_mask)
>> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
>
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
> drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *

ALWAYS run ath12k-check, we wrote the tool for a reason. Skipping these
tests is disrespect for maintainers' time and a great way to get your
patches to the bottom of the queue.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2024-04-26 23:42:37

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF



On 4/26/2024 12:31 AM, Kalle Valo wrote:
> Jeff Johnson <[email protected]> writes:
>
>> On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
>>> Add support to set fixed HE rate/GI/LTF values using nl80211.
>>> Reuse parts of the existing code path already used for HT/VHT
>>> to implement the new helpers symmetrically, similar to how
>>> HT/VHT is handled.
>>>
>>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>>
>>> Co-developed-by: Muna Sinada <[email protected]>
>>> Signed-off-by: Muna Sinada <[email protected]>
>>> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
>>> ---
>>
>> [...]
>>
>>> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
>>> return false;
>>> }
>>>
>>> - if (ht_nss_mask != vht_nss_mask)
>>> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
>>
>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *
>
> ALWAYS run ath12k-check, we wrote the tool for a reason. Skipping these
> tests is disrespect for maintainers' time and a great way to get your
> patches to the bottom of the queue.
>
Hi Kalle

I did run ath12k-check but I don't see these errors. Trying to see if
this is due to version differences. will update further once I have more
information on this.

This is version I ran:
qca-swiss-army-knife/tools/scripts/ath12k/ath12k-check --version
ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)

python: 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0]
host gcc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
config cc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
sparse: v0.6.4
checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
gtags: gtags (GNU GLOBAL) 6.6.2


I see some notes like below this in all files:
drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
include/linux/bitops.h, include/linux/kernel.h, include/net/mac80211.h):
drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
include/linux/bitops.h, include/linux/kernel.h, include/net/mac80211.h):

Thanks
Pradeep

2024-04-29 12:08:43

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

Pradeep Kumar Chitrapu <[email protected]> writes:

> On 4/26/2024 12:31 AM, Kalle Valo wrote:
>> Jeff Johnson <[email protected]> writes:
>>
>>> On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
>>>> Add support to set fixed HE rate/GI/LTF values using nl80211.
>>>> Reuse parts of the existing code path already used for HT/VHT
>>>> to implement the new helpers symmetrically, similar to how
>>>> HT/VHT is handled.
>>>>
>>>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>>>
>>>> Co-developed-by: Muna Sinada <[email protected]>
>>>> Signed-off-by: Muna Sinada <[email protected]>
>>>> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
>>>> ---
>>>
>>> [...]
>>>
>>>> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
>>>> return false;
>>>> }
>>>> - if (ht_nss_mask != vht_nss_mask)
>>>> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
>>>
>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *
>> ALWAYS run ath12k-check, we wrote the tool for a reason. Skipping
>> these
>> tests is disrespect for maintainers' time and a great way to get your
>> patches to the bottom of the queue.
>>
> Hi Kalle
>
> I did run ath12k-check but I don't see these errors. Trying to see if
> this is due to version differences. will update further once I have
> more information on this.
>
> This is version I ran:
> qca-swiss-army-knife/tools/scripts/ath12k/ath12k-check --version
> ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)
>
> python: 3.6.9 (default, Mar 10 2023, 16:46:00)
> [GCC 8.4.0]
> host gcc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> config cc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
> sparse: v0.6.4
> checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
> gtags: gtags (GNU GLOBAL) 6.6.2

Your sparse is too old, you need to get the latest from git:

https://docs.kernel.org/dev-tools/sparse.html#getting-sparse

Also your GCC is really old, I strongly recommend to use GCC 13.2. You
can get it here:

https://mirrors.edge.kernel.org/pub/tools/crosstool/

Why on earth are you using Ubuntu 18.04? It's end of life was a year
ago.

And please also update ath12k-check. This is what I have:

$ ath12k-check --version
ath12k-check (md5sum c5567fc8aaede613275e8cafea6ed7cd)

python: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
host gcc: gcc (Debian 12.2.0-14) 12.2.0
config cc: x86_64-linux-gcc (GCC) 13.2.0
sparse: v0.6.4-39-gce1a6720f69e
checkpatch.pl: Version: 0.32 (md5sum 77c655474ed7622c0077caf2f0d7c440)
gtags: gtags (Global) 6.6.9

> I see some notes like below this in all files:
> drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
> include/linux/bitops.h, include/linux/kernel.h,
> include/net/mac80211.h):
> drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
> include/linux/bitops.h, include/linux/kernel.h,
> include/net/mac80211.h):

Jeff and me are extra careful that there are no warnings in ath12k, in
fact in wireless-next the whole wireless subsystem has no sparse
warnings. So if you ever see warnings please report them to maintainers
ASAP.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2024-04-30 01:44:13

by Pradeep Kumar Chitrapu

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF



On 4/29/2024 5:08 AM, Kalle Valo wrote:
> Pradeep Kumar Chitrapu <[email protected]> writes:
>
>> On 4/26/2024 12:31 AM, Kalle Valo wrote:
>>> Jeff Johnson <[email protected]> writes:
>>>
>>>> On 4/24/2024 1:19 PM, Pradeep Kumar Chitrapu wrote:
>>>>> Add support to set fixed HE rate/GI/LTF values using nl80211.
>>>>> Reuse parts of the existing code path already used for HT/VHT
>>>>> to implement the new helpers symmetrically, similar to how
>>>>> HT/VHT is handled.
>>>>>
>>>>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
>>>>>
>>>>> Co-developed-by: Muna Sinada <[email protected]>
>>>>> Signed-off-by: Muna Sinada <[email protected]>
>>>>> Signed-off-by: Pradeep Kumar Chitrapu <[email protected]>
>>>>> ---
>>>>
>>>> [...]
>>>>
>>>>> @@ -7753,7 +8034,20 @@ ath12k_mac_bitrate_mask_get_single_nss(struct ath12k *ar,
>>>>> return false;
>>>>> }
>>>>> - if (ht_nss_mask != vht_nss_mask)
>>>>> + he_mcs_map = le16_to_cpu(ath12k_mac_get_tx_mcs_map(&sband->iftype_data->he_cap));
>>>>
>>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: warning: incorrect type in argument 1 (different address spaces)
>>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: expected struct ieee80211_sta_he_cap const *he_cap
>>>> drivers/net/wireless/ath/ath12k/mac.c:8041:22: got struct ieee80211_sta_he_cap const [noderef] __iftype_data *
>>> ALWAYS run ath12k-check, we wrote the tool for a reason. Skipping
>>> these
>>> tests is disrespect for maintainers' time and a great way to get your
>>> patches to the bottom of the queue.
>>>
>> Hi Kalle
>>
>> I did run ath12k-check but I don't see these errors. Trying to see if
>> this is due to version differences. will update further once I have
>> more information on this.
>>
>> This is version I ran:
>> qca-swiss-army-knife/tools/scripts/ath12k/ath12k-check --version
>> ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)
>>
>> python: 3.6.9 (default, Mar 10 2023, 16:46:00)
>> [GCC 8.4.0]
>> host gcc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>> config cc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>> sparse: v0.6.4
>> checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
>> gtags: gtags (GNU GLOBAL) 6.6.2
>
> Your sparse is too old, you need to get the latest from git:
>
> https://docs.kernel.org/dev-tools/sparse.html#getting-sparse

Thanks Kalle and Jeff for sharing the tool versions required..
I am able to see the errors reported now..
will fix and respin the series..

ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)

python: 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0]
host gcc: gcc (GCC) 13.2.0
config cc: gcc (GCC) 13.2.0
sparse: v0.6.4-66-g0196afe16a50
checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
gtags: gtags (GNU GLOBAL) 6.6.2


Thanks
Pradeep


>
> Also your GCC is really old, I strongly recommend to use GCC 13.2. You
> can get it here:
>
> https://mirrors.edge.kernel.org/pub/tools/crosstool/
>
> Why on earth are you using Ubuntu 18.04? It's end of life was a year
> ago.
Will get update ubuntu in few days.
>
> And please also update ath12k-check. This is what I have:
>
> $ ath12k-check --version
> ath12k-check (md5sum c5567fc8aaede613275e8cafea6ed7cd)
>
> python: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]
> host gcc: gcc (Debian 12.2.0-14) 12.2.0
> config cc: x86_64-linux-gcc (GCC) 13.2.0
> sparse: v0.6.4-39-gce1a6720f69e
> checkpatch.pl: Version: 0.32 (md5sum 77c655474ed7622c0077caf2f0d7c440)
> gtags: gtags (Global) 6.6.9
>
>> I see some notes like below this in all files:
>> drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
>> include/linux/bitops.h, include/linux/kernel.h,
>> include/net/mac80211.h):
>> drivers/net/wireless/ath/ath12k/mac.c: note: in included file (through
>> include/linux/bitops.h, include/linux/kernel.h,
>> include/net/mac80211.h):
>
> Jeff and me are extra careful that there are no warnings in ath12k, in
> fact in wireless-next the whole wireless subsystem has no sparse
> warnings. So if you ever see warnings please report them to maintainers
> ASAP.
>


2024-04-30 06:43:28

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH v3 07/10] wifi: ath12k: add support for setting fixed HE rate/GI/LTF

Pradeep Kumar Chitrapu <[email protected]> writes:

>>> I did run ath12k-check but I don't see these errors. Trying to see if
>>> this is due to version differences. will update further once I have
>>> more information on this.
>>>
>>> This is version I ran:
>>> qca-swiss-army-knife/tools/scripts/ath12k/ath12k-check --version
>>> ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)
>>>
>>> python: 3.6.9 (default, Mar 10 2023, 16:46:00)
>>> [GCC 8.4.0]
>>> host gcc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>>> config cc: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
>>> sparse: v0.6.4
>>> checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
>>> gtags: gtags (GNU GLOBAL) 6.6.2
>> Your sparse is too old, you need to get the latest from git:
>> https://docs.kernel.org/dev-tools/sparse.html#getting-sparse
>
> Thanks Kalle and Jeff for sharing the tool versions required..
> I am able to see the errors reported now..
> will fix and respin the series..
>
> ath12k-check (md5sum cb8a85242f2ec7343f6f94af9fa5ebb2)
>
> python: 3.6.9 (default, Mar 10 2023, 16:46:00)
> [GCC 8.4.0]
> host gcc: gcc (GCC) 13.2.0
> config cc: gcc (GCC) 13.2.0
> sparse: v0.6.4-66-g0196afe16a50
> checkpatch.pl: Version: 0.32 (md5sum 12ea394e9bf27280f30a684ff937cc57)
> gtags: gtags (GNU GLOBAL) 6.6.2

I added a section about tools to the wiki:

https://wireless.wiki.kernel.org/en/users/drivers/ath10k/codingstyle#tools

Feedback very welcome, it's important that our documentation is
understandable for new developers.

--
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches