wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/q02-046-wpa_supplicant-add-RU-puncturing-support.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

268 lines
9.2 KiB
Diff

From 340c9ab10eabb7a962f16cbb0a3abd492942ef57 Mon Sep 17 00:00:00 2001
From: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Date: Wed, 25 May 2022 11:32:01 +0530
Subject: [PATCH] wpa_supplicant: add RU puncturing support
Retrieve the driver support for RU puncturing which is advertised
using the attribute NL80211_ATTR_RU_PUNCT_SUPP_BW.
Value indicates the bandwidths in which puncturing is supported -
80 MHz, 160 MHz or 320 MHz.
Absence of the attribute or the value 0 means the driver does not
support this feature.
Add New option 'ru_punct_bitmap' to configure RU puncturing bitmap
and pass the configured bitmap to kernel via frequency params
during join mesh if driver supports puncturing pattern for configured
Bandwidth.
Kernel will validate the pattern against spec allowed patterns
(IEEE P802.11be/D1.5, Table 36-30)
Parse EHT Operational IE of received mesh beacons and validate &
and send Peer mesh node's RU puncturing pattern as part of station
add command (NL80211_CMD_NEW_STATION).
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
---
src/ap/hw_features.c | 9 +++++++++
src/drivers/driver.h | 7 +++++++
src/drivers/driver_nl80211.c | 6 ++++++
wpa_supplicant/ap.c | 5 +++--
wpa_supplicant/config.c | 2 ++
wpa_supplicant/config_file.c | 1 +
wpa_supplicant/config_ssid.h | 6 ++++++
wpa_supplicant/mesh.c | 4 ++++
wpa_supplicant/mesh_mpm.c | 41 ++++++++++++++++++++++++++++++++++++++
wpa_supplicant/wpa_supplicant.c | 26 ++++++++++++++++++++++--
wpa_supplicant/wpa_supplicant.conf | 7 +++++++
wpa_supplicant/wpa_supplicant_i.h | 2 ++
12 files changed, 112 insertions(+), 4 deletions(-)
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -960,6 +960,15 @@ static int hostapd_is_usable_ru_punct_bi
return 0;
}
+#ifdef CONFIG_MESH
+ if (iface->mconf != NULL) {
+ wpa_printf(MSG_DEBUG,
+ "%s: Mesh RU bitmap will be validated in kernel while joining the mesh network",
+ iface->bss[0]->conf->iface);
+ return 1;
+ }
+#endif
+
switch (conf->eht_oper_chwidth) {
case 0:
wpa_printf(MSG_ERROR,
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1371,6 +1371,13 @@ struct wpa_driver_associate_params {
int enable_160mhz_bw;
/**
+ * RU puncturing bitmap - Each bit corresponds to a 20 MHz subchannel,
+ * lowest bit for the channel with the lowest frequency.
+ * Bit set to 1 indicates that the subchannel is punctured, otherwise active.
+ */
+ u16 ru_punct_bitmap;
+
+ /**
* disable_eht - Disable EHT for this connection
*/
int disable_eht;
@@ -2548,6 +2555,7 @@ struct hostapd_sta_add_params {
const u8 *supp_oper_classes;
size_t supp_oper_classes_len;
int support_p2p_ps;
+ u16 ru_punct_bitmap;
bool mld_link_sta;
s8 mld_link_id;
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -5808,6 +5808,12 @@ static int wpa_driver_nl80211_sta_add(vo
nla_nest_end(msg, wme);
}
+ if (params->ru_punct_bitmap) {
+ wpa_printf(MSG_DEBUG, " * eht ru puncturing bitmap=0x%x", params->ru_punct_bitmap);
+ if (nla_put_u16(msg, NL80211_ATTR_RU_PUNCT_BITMAP, params->ru_punct_bitmap))
+ goto fail;
+ }
+
/* In case we are an AP MLD need to always specify the link ID */
if (params->mld_link_id >= 0) {
wpa_printf(MSG_DEBUG, " * mld_link_id=%d",
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -427,8 +427,10 @@ int wpa_supplicant_conf_ap_ht(struct wpa
if (mode->eht_capab[wpas_mode_to_ieee80211_mode(
ssid->mode)].eht_supported &&
- ssid->eht)
+ ssid->eht) {
conf->ieee80211be = 1;
+ conf->ru_punct_bitmap = ssid->ru_punct_bitmap;
+ }
if (mode->vht_capab && ssid->vht) {
conf->ieee80211ac = 1;
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2885,6 +2885,7 @@ static const struct parse_data ssid_fiel
{ INT_RANGE(beacon_tx_mode, 1, 2)},
{ INT_RANGE(enable_160mhz_bw, 0, 1)},
{ INT_RANGE(enable_320mhz_bw, 0, 1)},
+ { INT(ru_punct_bitmap) },
{ INT_RANGE(disable_eht, 0, 1)},
{ INT_RANGE(enable_4addr_mode, 0, 1)},
};
@@ -3409,6 +3410,7 @@ void wpa_config_set_network_defaults(str
ssid->mac_addr = WPAS_MAC_ADDR_STYLE_NOT_SET;
ssid->max_oper_chwidth = DEFAULT_MAX_OPER_CHWIDTH;
ssid->beacon_tx_mode = DEFAULT_BEACON_TX_MODE;
+ ssid->ru_punct_bitmap = 0;
}
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -903,6 +903,7 @@ static void wpa_config_write_network(FIL
INT(disable_40mhz_scan);
INT(beacon_tx_mode);
INT(enable_160mhz_bw);
+ INT(ru_punct_bitmap);
INT(enable_4addr_mode);
#undef STR
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -1294,6 +1294,12 @@ struct wpa_ssid {
int enable_320mhz_bw;
/**
+ * RU puncturing bitmap - Each bit corresponds to a 20 MHz subchannel,
+ * lowest bit for the channel with the lowest frequency.
+ * Bit set to 1 indicates that the subchannel is punctured, otherwise active.*/
+ u16 ru_punct_bitmap;
+
+ /**
* disable_eht - Disable EHT (IEEE 802.11be) for this network
*
* By default, use it if it is available, but this can be configured
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -411,6 +411,7 @@ static int wpa_supplicant_mesh_init(stru
ifmsh->num_bss = 1;
ifmsh->enable_iface_cb = wpa_supplicant_mesh_enable_iface_cb;
ifmsh->disable_iface_cb = wpa_supplicant_mesh_disable_iface_cb;
+ ifmsh->ru_punct_supp_bw = wpa_s->ru_punct_supp_bw;
ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
sizeof(struct hostapd_data *));
if (!ifmsh->bss)
@@ -493,6 +494,9 @@ static int wpa_supplicant_mesh_init(stru
wpa_s->mesh_params->handle_dfs = true;
}
+ if (ssid->eht)
+ conf->ru_punct_bitmap = freq->ru_punct_bitmap;
+
bss->iconf = conf;
ifmsh->conf = conf;
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -749,6 +749,7 @@ static struct sta_info * mesh_mpm_add_pe
struct hostapd_data *data = wpa_s->ifmsh->bss[0];
struct sta_info *sta;
struct ieee80211_ht_operation *oper;
+ struct ieee80211_eht_operation *eht_oper_ie;
int ret;
if (elems->mesh_config_len >= 7 &&
@@ -839,6 +840,46 @@ static struct sta_info * mesh_mpm_add_pe
params.he_6ghz_capab = sta->he_6ghz_capab;
params.eht_capab = sta->eht_capab;
params.eht_capab_len = sta->eht_capab_len;
+#ifdef CONFIG_IEEE80211BE
+ if (elems->eht_operation && elems->eht_operation_len >= sizeof(*eht_oper_ie)) {
+ u16 bw = 0;
+ u16 start_chan = 0;
+ u16 pri_chan = wpa_s->ifmsh->conf->channel;
+
+ eht_oper_ie = (struct ieee80211_eht_operation *)elems->eht_operation;
+ if (eht_oper_ie->oper_info.control >= EHT_OPER_CHANNEL_WIDTH_80MHZ &&
+ (eht_oper_ie->oper_params & EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT) &&
+ eht_oper_ie->oper_info.disabled_chan_bitmap) {
+ params.ru_punct_bitmap = eht_oper_ie->oper_info.disabled_chan_bitmap;
+ /* Validate Peer's puncture bitmap and reset if invalid */
+ switch (eht_oper_ie->oper_info.control) {
+ case EHT_OPER_CHANNEL_WIDTH_80MHZ:
+ bw = 80;
+ start_chan = eht_oper_ie->oper_info.ccfs0 - 6;
+ if (!is_ru_punct_bitmap_valid(bw, (pri_chan - start_chan) / 4,
+ params.ru_punct_bitmap, 0))
+ params.ru_punct_bitmap = 0;
+ break;
+ case EHT_OPER_CHANNEL_WIDTH_160MHZ:
+ bw = 160;
+ start_chan = eht_oper_ie->oper_info.ccfs0 - 14;
+ if (!is_ru_punct_bitmap_valid(bw, (pri_chan - start_chan) / 4,
+ params.ru_punct_bitmap, 0))
+ params.ru_punct_bitmap = 0;
+ break;
+ case EHT_OPER_CHANNEL_WIDTH_320MHZ:
+ bw = 320;
+ start_chan = eht_oper_ie->oper_info.ccfs0 - 30;
+ if (!is_ru_punct_bitmap_valid(bw, (pri_chan - start_chan) / 4,
+ params.ru_punct_bitmap, 0))
+ params.ru_punct_bitmap = 0;
+ break;
+ default:
+ params.ru_punct_bitmap = 0;
+ }
+ }
+ }
+#endif /* CONFIG_IEEE80211BE */
params.flags |= WPA_STA_WMM;
params.flags_mask |= WPA_STA_AUTHENTICATED;
if (conf->security == MESH_CONF_SEC_NONE) {
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -7272,6 +7272,7 @@ static int wpa_supplicant_init_iface(str
capa.num_multichan_concurrent;
wpa_s->wmm_ac_supported = capa.wmm_ac_supported;
wpa_s->max_num_akms = capa.max_num_akms;
+ wpa_s->ru_punct_supp_bw = capa.ru_punct_supp_bw;
if (capa.mac_addr_rand_scan_supported)
wpa_s->mac_addr_rand_supported |= MAC_ADDR_RAND_SCAN;
--- a/wpa_supplicant/wpa_supplicant.conf
+++ b/wpa_supplicant/wpa_supplicant.conf
@@ -1765,6 +1765,13 @@ fast_reauth=1
# during radar detection
#disable_csa_dfs=1
+# RU puncturing bitmap (16 bits) where each bit corresponds to
+# a 20 MHz channel in the given bandwidth, bit 0 corresponding to the channel
+# with lowest frequency.
+# Bit set to 1 indicates that the channel is punctured, otherwise active.
+# Default value is 0 indicating that no channel is punctured.
+#ru_punct_bitmap=4
+
# This value is used to configure the channel bonding feature.
# Default value is 0.
# Relevant only if enable_edmg is true
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1540,6 +1540,8 @@ struct wpa_supplicant {
unsigned int wait_for_dscp_req:1;
struct wpa_signal_info last_signal_info;
+ /* Minimum bandwidth the driver supports RU puncturing */
+ u8 ru_punct_supp_bw;
};