mac80211: add support for QAM-256 in 2.4GHz 802.11n

Add support for QAM-256 in 2.4GHz 802.11n. This is non-standard and
comunicate vht capabilities in 2.4GHz 802.11n permittin, for supported
clients, to benefits for additional data rate.

Many driver supports this, for a start enable this for ath10k and
ath11k.
This commit is contained in:
Christian Marangi
2023-06-16 00:47:46 +02:00
committed by Lucas Asvio
parent 52b907129f
commit 94d9c06907
4 changed files with 268 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
From 7658e786e6de189f218ba7ed5d8db953cc6cf980 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 14 Jun 2023 09:14:56 +0200
Subject: [PATCH 3/4] wifi: ath10k: add support for QAM-256 in 2.4GHz 802.11n
Ath10k supports non-standard QAM-256 in 2.4GHz in 802.11n. Permit for
supported client to benefits from these extra bandwidth by enabling
support for it.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2744,9 +2744,9 @@ static void ath10k_peer_assoc_h_phymode(
if (sta->deflink.vht_cap.vht_supported &&
!ath10k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40)
- phymode = MODE_11AC_VHT40;
+ phymode = MODE_11AC_VHT40_2G;
else
- phymode = MODE_11AC_VHT20;
+ phymode = MODE_11AC_VHT20_2G;
} else if (sta->deflink.ht_cap.ht_supported &&
!ath10k_peer_assoc_h_ht_masked(ht_mcs_mask)) {
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40)
@@ -4996,6 +4996,8 @@ static void ath10k_mac_setup_ht_vht_cap(
if (ar->phy_capability & WHAL_WLAN_11G_CAPABILITY) {
band = &ar->mac.sbands[NL80211_BAND_2GHZ];
band->ht_cap = ht_cap;
+ band->vht_cap = vht_cap;
+ band->vht_cap.vendor_qam256_supported = true;
}
if (ar->phy_capability & WHAL_WLAN_11A_CAPABILITY) {
band = &ar->mac.sbands[NL80211_BAND_5GHZ];

View File

@@ -0,0 +1,50 @@
From 462b0e7ce7cadef5c14bb16134e43573b169c9b5 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 14 Jun 2023 09:44:29 +0200
Subject: [PATCH 4/4] wifi: ath11k: add support for QAM-256 in 2.4GHz 802.11n
Ath11k supports non-standard QAM-256 in 2.4GHz in 802.11n. Permit for
supported client to benefits from these extra bandwidth by enabling
support for it.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/wireless/ath/ath11k/mac.c | 7 +++++--
drivers/net/wireless/ath/ath11k/wmi.c | 2 ++
2 files changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2858,9 +2858,9 @@ static void ath11k_peer_assoc_h_phymode(
} else if (sta->deflink.vht_cap.vht_supported &&
!ath11k_peer_assoc_h_vht_masked(vht_mcs_mask)) {
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40)
- phymode = MODE_11AC_VHT40;
+ phymode = MODE_11AC_VHT40_2G;
else
- phymode = MODE_11AC_VHT20;
+ phymode = MODE_11AC_VHT20_2G;
} else if (sta->deflink.ht_cap.ht_supported &&
!ath11k_peer_assoc_h_ht_masked(ht_mcs_mask)) {
if (sta->deflink.bandwidth == IEEE80211_STA_RX_BW_40)
@@ -5490,6 +5490,9 @@ static void ath11k_mac_setup_ht_vht_cap(
*ht_cap_info = ht_cap;
band->ht_cap = ath11k_create_ht_cap(ar, ht_cap,
rate_cap_rx_chainmask);
+ band->vht_cap = ath11k_create_vht_cap(ar, rate_cap_tx_chainmask,
+ rate_cap_rx_chainmask);
+ band->vht_cap.vendor_qam256_supported = true;
}
if (cap->supported_bands & WMI_HOST_WLAN_5G_CAP &&
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -411,6 +411,8 @@ ath11k_pull_mac_phy_cap_svc_ready_ext(st
* handled.
*/
if (mac_phy_caps->supported_bands & WMI_HOST_WLAN_2G_CAP) {
+ pdev_cap->vht_cap = mac_phy_caps->vht_cap_info_2g;
+ pdev_cap->vht_mcs = mac_phy_caps->vht_supp_mcs_2g;
pdev_cap->tx_chain_mask = mac_phy_caps->tx_chain_mask_2g;
pdev_cap->rx_chain_mask = mac_phy_caps->rx_chain_mask_2g;
}

View File

@@ -0,0 +1,149 @@
From 35040d1f349f2346832ca1ebb408924dbefc1cfc Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 14 Jun 2023 07:15:48 +0200
Subject: [PATCH 1/4] mac80211: introduce support for vendor QAM-256 in 2.4GHz
802.11n
Some vendor supports non-standard QAM-256 in 2.4GHz 802.11n mode.
The implementation works by comunicating vht capabilities to the client
in 2.4GHz 802.11n, the supported client will take this info and
benefits from the additional rates of it.
Each driver needs to enable support for this by enabling the
vendor_qam256_supported in the 2G sband struct and add the required
capabilities for vht_cap.
This feature is supported by various vendor with all kind of marketing
name, but all of them have in common the use of vht capabilities in
2.4GHz 802.11n.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
include/net/cfg80211.h | 2 ++
net/mac80211/mlme.c | 14 ++++++++----
net/mac80211/util.c | 10 +++++---
net/mac80211/vht.c | 52 +++++++++++++++++++++++++++---------------
4 files changed, 51 insertions(+), 27 deletions(-)
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -357,11 +357,13 @@ struct ieee80211_sta_ht_cap {
* to describe 802.11ac VHT capabilities for an STA.
*
* @vht_supported: is VHT supported by the STA
+ * @qam256_supported: is QAM256 supported by the STA
* @cap: VHT capabilities map as described in 802.11ac spec
* @vht_mcs: Supported VHT MCS rates
*/
struct ieee80211_sta_vht_cap {
bool vht_supported;
+ bool vendor_qam256_supported;
u32 cap; /* use IEEE80211_VHT_CAP_ */
struct ieee80211_vht_mcs_info vht_mcs;
};
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -5270,6 +5270,8 @@ ieee80211_determine_our_sta_mode(struct
if (sband->band != NL80211_BAND_2GHZ) {
conn->mode = IEEE80211_CONN_MODE_VHT;
conn->bw_limit = IEEE80211_CONN_BW_LIMIT_160;
+ } else if (sband->vht_cap.vendor_qam256_supported) {
+ conn->mode = IEEE80211_CONN_MODE_VHT;
}
if (is_5ghz &&
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1318,7 +1318,9 @@ static int ieee80211_put_preq_ies_band(s
break;
}
- if (sband->vht_cap.vht_supported && have_80mhz) {
+ if (sband->vht_cap.vht_supported &&
+ (have_80mhz ||
+ sband->vht_cap.vendor_qam256_supported)) {
u8 *pos;
if (skb_tailroom(skb) < 2 + sizeof(struct ieee80211_vht_cap))
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -122,7 +122,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru
struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;
struct ieee80211_sta_vht_cap own_cap;
u32 cap_info, i;
- bool have_80mhz;
+ bool can_vht;
u32 mpdu_len;
memset(vht_cap, 0, sizeof(*vht_cap));
@@ -134,17 +134,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(stru
return;
/* Allow VHT if at least one channel on the sband supports 80 MHz */
- have_80mhz = false;
+ can_vht = false;
for (i = 0; i < sband->n_channels; i++) {
if (sband->channels[i].flags & (IEEE80211_CHAN_DISABLED |
IEEE80211_CHAN_NO_80MHZ))
continue;
- have_80mhz = true;
+ can_vht = true;
break;
}
- if (!have_80mhz)
+ /* Some Vendor supports non-standard QAM-256 on 2.4GHz 802.11n */
+ if (sband->vht_cap.vendor_qam256_supported)
+ can_vht = true;
+
+ if (!can_vht)
return;
/*
@@ -359,23 +363,23 @@ _ieee80211_sta_cap_rx_bw(struct link_sta
struct ieee80211_sta_vht_cap *vht_cap = &link_sta->pub->vht_cap;
struct ieee80211_sta_he_cap *he_cap = &link_sta->pub->he_cap;
struct ieee80211_sta_eht_cap *eht_cap = &link_sta->pub->eht_cap;
+ enum nl80211_band band;
u32 cap_width;
+ if (chandef) {
+ band = chandef->chan->band;
+ } else {
+ struct ieee80211_bss_conf *link_conf;
+
+ rcu_read_lock();
+ link_conf = rcu_dereference(sdata->vif.link_conf[link_id]);
+ band = link_conf->chanreq.oper.chan->band;
+ rcu_read_unlock();
+ }
+
if (he_cap->has_he) {
- enum nl80211_band band;
u8 info;
- if (chandef) {
- band = chandef->chan->band;
- } else {
- struct ieee80211_bss_conf *link_conf;
-
- rcu_read_lock();
- link_conf = rcu_dereference(sdata->vif.link_conf[link_id]);
- band = link_conf->chanreq.oper.chan->band;
- rcu_read_unlock();
- }
-
if (eht_cap->has_eht && band == NL80211_BAND_6GHZ) {
info = eht_cap->eht_cap_elem.phy_cap_info[0];
@@ -401,7 +405,8 @@ _ieee80211_sta_cap_rx_bw(struct link_sta
return IEEE80211_STA_RX_BW_20;
}
- if (!vht_cap->vht_supported)
+ if (!vht_cap->vht_supported || (band == NL80211_BAND_2GHZ &&
+ vht_cap->vendor_qam256_supported))
return link_sta->pub->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
IEEE80211_STA_RX_BW_40 :
IEEE80211_STA_RX_BW_20;

View File

@@ -0,0 +1,32 @@
From 793bfa410bd16c273beb390818ab44886c680a22 Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 14 Jun 2023 10:20:31 +0200
Subject: [PATCH 2/4] mac80211: add logic to skip useless VHT cap check in
ieee80211_sta_cap_rx_bw
Add logic to skip useless VHT cap check in ieee80211_sta_cap_rx_bw in
the case where HT doesn't indicate support for 40MHz.
If the STA doesn't indicate support for 40MHz then it doesn't make sense
to check additional support for 80MHz, 80+80MHz or 160MHz
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
net/mac80211/vht.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -442,6 +442,12 @@ ieee80211_sta_cap_chan_bw(struct link_st
NL80211_CHAN_WIDTH_40 : NL80211_CHAN_WIDTH_20;
}
+ /* Skip checking VHT cap and set to 20MHz if HT cap doesn't indicate
+ * support for 40MHz.
+ */
+ if (!(link_sta->pub->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40))
+ return NL80211_CHAN_WIDTH_20;
+
cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ)