add support for QAM-256 in 2.4GHz

This commit is contained in:
Lucas Asvio
2024-06-02 12:27:44 +02:00
parent 3d31199b30
commit 7a31020772
7 changed files with 2755 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
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>
---
ath10k-6.2/mac.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ath10k-6.2/mac.c b/ath10k-6.2/mac.c
index 9c4bf2fdbc0f..8d362ba351e6 100644
--- a/ath10k-6.2/mac.c
+++ b/ath10k-6.2k/mac.c
@@ -2749,9 +2749,9 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
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)
@@ -4998,6 +4998,7 @@ static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
/* Enable the VHT support at 2.4 GHz */
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];
--
2.40.1

View File

@@ -0,0 +1,42 @@
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(-)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 9c4bf2fdbc0f..8d362ba351e6 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2749,9 +2749,9 @@ static void ath10k_peer_assoc_h_phymode(struct ath10k *ar,
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)
@@ -4998,6 +4998,8 @@ static void ath10k_mac_setup_ht_vht_cap(struct ath10k *ar)
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];
--
2.40.1

View File

@@ -0,0 +1,57 @@
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(-)
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index c947d1c8d8c1..1cadfdd50afc 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -2773,9 +2773,9 @@ static void ath11k_peer_assoc_h_phymode(struct ath11k *ar,
} 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)
@@ -5613,6 +5613,9 @@ static void ath11k_mac_setup_ht_vht_cap(struct ath11k *ar,
*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 &&
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 443199e85fa2..77054ed687d5 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -406,6 +406,8 @@ ath11k_pull_mac_phy_cap_svc_ready_ext(struct ath11k_pdev_wmi *wmi_handle,
* 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;
}
--
2.40.1

View File

@@ -0,0 +1,232 @@
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(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 1b8619685bf6..e9c9afae9a80 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -338,11 +338,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;
};
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 3827b5dcdb03..9c3b3de28dc8 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4720,7 +4720,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
const struct cfg80211_bss_ies *ies;
int ret;
u32 i;
- bool have_80mhz;
+ bool can_vht;
rcu_read_lock();
@@ -4867,18 +4867,22 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
}
/* 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) {
- sdata_info(sdata, "80 MHz not supported, disabling VHT\n");
+ /* 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) {
+ sdata_info(sdata, "80 MHz or QAM-256 not supported, disabling VHT\n");
*conn_flags |= IEEE80211_CONN_DISABLE_VHT;
}
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 083ad56d08d9..3fc1e84e4275 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1951,7 +1951,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,
int ext_rates_len;
int shift;
u32 rate_flags;
- bool have_80mhz = false;
+ bool can_vht = false;
*offset = 0;
@@ -2089,11 +2089,15 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,
IEEE80211_CHAN_NO_80MHZ))
continue;
- have_80mhz = true;
+ can_vht = true;
break;
}
- if (sband->vht_cap.vht_supported && 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 (sband->vht_cap.vht_supported && can_vht) {
if (end - pos < 2 + sizeof(struct ieee80211_vht_cap))
goto out_err;
pos = ieee80211_ie_build_vht_cap(pos, &sband->vht_cap,
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index c1250aa47808..37f4673d4194 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -121,7 +121,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
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;
memset(vht_cap, 0, sizeof(*vht_cap));
@@ -132,17 +132,21 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
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;
/*
@@ -346,16 +350,16 @@ ieee80211_sta_cap_rx_bw(struct link_sta_info *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;
+ struct ieee80211_bss_conf *link_conf;
+ enum ieee80211_sta_rx_bandwidth ret;
u32 cap_width;
+ rcu_read_lock();
+ link_conf = rcu_dereference(sdata->vif.link_conf[link_id]);
+
if (he_cap->has_he) {
- struct ieee80211_bss_conf *link_conf;
- enum ieee80211_sta_rx_bandwidth ret;
u8 info;
- rcu_read_lock();
- link_conf = rcu_dereference(sdata->vif.link_conf[link_id]);
-
if (eht_cap->has_eht &&
link_conf->chandef.chan->band == NL80211_BAND_6GHZ) {
info = eht_cap->eht_cap_elem.phy_cap_info[0];
@@ -383,32 +387,42 @@ ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta)
ret = IEEE80211_STA_RX_BW_80;
else
ret = IEEE80211_STA_RX_BW_20;
-out:
- rcu_read_unlock();
- return ret;
+ goto out;
}
- if (!vht_cap->vht_supported)
- return link_sta->pub->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
+ if (!vht_cap->vht_supported ||
+ (link_conf->chandef.chan->band == NL80211_BAND_2GHZ &&
+ vht_cap->vendor_qam256_supported)) {
+ ret = link_sta->pub->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 ?
IEEE80211_STA_RX_BW_40 :
IEEE80211_STA_RX_BW_20;
+ goto out;
+ }
cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ||
- cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ)
- return IEEE80211_STA_RX_BW_160;
+ cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ) {
+ ret = IEEE80211_STA_RX_BW_160;
+ goto out;
+ }
/*
* If this is non-zero, then it does support 160 MHz after all,
* in one form or the other. We don't distinguish here (or even
* above) between 160 and 80+80 yet.
*/
- if (vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK)
- return IEEE80211_STA_RX_BW_160;
+ if (vht_cap->cap & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK) {
+ ret = IEEE80211_STA_RX_BW_160;
+ goto out;
+ }
+
+ ret = IEEE80211_STA_RX_BW_80;
- return IEEE80211_STA_RX_BW_80;
+out:
+ rcu_read_unlock();
+ return ret;
}
enum nl80211_chan_width
--
2.40.1

View File

@@ -0,0 +1,37 @@
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(+)
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index 37f4673d4194..b57391a032c8 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -400,6 +400,12 @@ ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta)
goto out;
}
+ /* 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 IEEE80211_STA_RX_BW_20;
+
cap_width = vht_cap->cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
if (cap_width == IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ||
--
2.40.1

View File

@@ -0,0 +1,76 @@
From b4fe1f680ba28588c330bcd65156ef7f8423426c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Thu, 15 Jun 2023 19:44:53 +0200
Subject: [PATCH] nl80211: add support for QAM-256 in 2.4GHz 802.11n
Add support for QAM-256 in 2.4GHz 802.11n where VHT rates are set in
2.4GHz 802.11n mode.
To identify if we are using this non-standard mode, we refer to the
hostapd conf providing vht_capab config.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
iwinfo_nl80211.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/iwinfo_nl80211.c b/iwinfo_nl80211.c
index 50bb8f0..cb3100f 100644
--- a/iwinfo_nl80211.c
+++ b/iwinfo_nl80211.c
@@ -3179,6 +3179,14 @@ static void nl80211_eval_modelist(struct nl80211_modes *m)
{
m->hw |= IWINFO_80211_B;
m->hw |= IWINFO_80211_G;
+
+ if (m->nl_vht > 0)
+ {
+ m->ht |= IWINFO_HTMODE_VHT20;
+
+ if (m->nl_ht & (1 << 1))
+ m->ht |= IWINFO_HTMODE_VHT40;
+ }
}
if (m->bands & IWINFO_BAND_5)
@@ -3313,10 +3321,10 @@ static int nl80211_get_htmode_cb(struct nl_msg *msg, void *arg)
static int nl80211_get_htmode(const char *ifname, int *buf)
{
+ bool he = false, vendor_qam256 = false;
struct chan_info chn = { 0 };
char *res, b[2] = { 0 };
int err;
- bool he = false;
res = nl80211_phy2ifname(ifname);
*buf = 0;
@@ -3332,11 +3340,15 @@ static int nl80211_get_htmode(const char *ifname, int *buf)
else if (nl80211_wpactl_query(res ? res : ifname, "wifi_generation", b, sizeof(b)))
he = b[0] == '6';
+ if ((chn.width == NL80211_CHAN_WIDTH_20 || chn.width == NL80211_CHAN_WIDTH_40) &&
+ nl80211_hostapd_query(res ? res : ifname, "vht_capab", b, sizeof(b)))
+ vendor_qam256 = true;
+
switch (chn.width) {
case NL80211_CHAN_WIDTH_20:
if (he)
*buf = IWINFO_HTMODE_HE20;
- else if (chn.mode == -1)
+ else if (chn.mode == -1 || vendor_qam256)
*buf = IWINFO_HTMODE_VHT20;
else
*buf = IWINFO_HTMODE_HT20;
@@ -3344,7 +3356,7 @@ static int nl80211_get_htmode(const char *ifname, int *buf)
case NL80211_CHAN_WIDTH_40:
if (he)
*buf = IWINFO_HTMODE_HE40;
- else if (chn.mode == -1)
+ else if (chn.mode == -1 || vendor_qam256)
*buf = IWINFO_HTMODE_VHT40;
else
*buf = IWINFO_HTMODE_HT40;
--
2.40.1