wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r02-007-hostapd-add-Max-Channel-Switch-Time-IE-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

148 lines
4.7 KiB
Diff

From 7edc79611ea6c4b5fd512662317ffd73b318e00a Mon Sep 17 00:00:00 2001
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
Date: Sat, 14 Oct 2023 11:28:01 +0530
Subject: [PATCH] hostapd: add Max Channel Switch Time IE support
The Max Channel Switch Time (MCST) element indicates the time delta
between the time the last beacon is transmitted by the AP in the
current channel and the expected time of the first beacon transmitted
by the AP in the new channel.
IEEE Std 802.11be-Draft2.2-2022, Section 35.3.11 (Multi-link procedures
for channel switching, extended channel switching, and channel quieting)
indicates that if an AP affiliated with an AP MLD is switching channel,
MCST IE shall be included in every beacon and probe response frames it
transmits.
Add support to include MCST IE in beacon and probe response during channel
switch announcement for an AP affiliated to an AP MLD.
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
---
src/ap/beacon.c | 45 ++++++++++++++++++++++++++++++++++--
src/common/defs.h | 5 ++++
src/common/ieee802_11_defs.h | 1 +
src/fst/fst_session.c | 5 ----
4 files changed, 49 insertions(+), 7 deletions(-)
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -438,6 +438,35 @@ static u8 * hostapd_eid_ecsa(struct host
return eid;
}
+static u8 *hostapd_eid_mcst(struct hostapd_data *hapd, u8 *eid)
+{
+#ifdef CONFIG_IEEE80211BE
+ /* switch time is basically time between CSA count 1 and CSA count 0
+ * (1 beacon interval) + time for interface restart + time to send beacon
+ * in the new channel (1 beacon interval)
+ *
+ * TODO: Use dynamic interface restart time
+ */
+ u32 switch_time_ms = host_to_le16(hapd->iconf->beacon_int) + 1000 +
+ host_to_le16(hapd->iconf->beacon_int);
+ u32 switch_time = US_TO_TU(switch_time_ms * 1000);
+
+ /* add MCST IE only if its part of a MLD */
+ if (!hapd->conf->mld_ap)
+ return eid;
+
+ if (!hapd->cs_freq_params.channel)
+ return eid;
+
+ *eid++ = WLAN_EID_EXTENSION;
+ *eid++ = 4;
+ *eid++ = WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME;
+ os_memcpy(eid, &switch_time, 3);
+ eid += 3;
+#endif /* CONFIG_IEEE80211BE */
+
+ return eid;
+}
static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid)
{
@@ -629,8 +658,11 @@ static u8 * hostapd_gen_probe_resp(struc
* long based on the common info and number of per
* station profiles. For now use 256.
*/
- if (hapd->conf->mld_ap)
+ if (hapd->conf->mld_ap) {
buflen += 256;
+ /* inclusion on MCST IE is mandatory */
+ buflen += 6;
+ }
/* QCN Vendor IE for 240MHz */
if (is_5ghz_freq(hapd->iface->freq))
buflen += (6 + 2 + 4 +
@@ -731,6 +763,9 @@ static u8 * hostapd_gen_probe_resp(struc
hapd->cs_c_off_ecsa_proberesp = csa_pos - (u8 *) resp - 1;
pos = csa_pos;
+ /* MCST IE */
+ pos = hostapd_eid_mcst(hapd, pos);
+
pos = hostapd_eid_supported_op_classes(hapd, pos);
pos = hostapd_eid_ht_capabilities(hapd, pos);
pos = hostapd_eid_ht_operation(hapd, pos);
@@ -1823,8 +1858,11 @@ int ieee802_11_build_ap_params(struct ho
* long based on the common info and number of per
* station profiles. For now use 256.
*/
- if (hapd->conf->mld_ap)
+ if (hapd->conf->mld_ap) {
tail_len += 256;
+ /* inclusion on MCST IE is mandatory */
+ tail_len += 6;
+ }
if (hapd->iconf->ru_punct_bitmap)
tail_len += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
@@ -1920,6 +1958,9 @@ int ieee802_11_build_ap_params(struct ho
hapd->cs_c_off_ecsa_beacon = csa_pos - tail - 1;
tailpos = csa_pos;
+ /* MCST IE */
+ tailpos = hostapd_eid_mcst(hapd, tailpos);
+
tailpos = hostapd_eid_supported_op_classes(hapd, tailpos);
tailpos = hostapd_eid_ht_capabilities(hapd, tailpos);
tailpos = hostapd_eid_ht_operation(hapd, tailpos);
--- a/src/common/defs.h
+++ b/src/common/defs.h
@@ -530,4 +530,9 @@ enum sae_pwe {
SAE_PWE_NOT_SET = 4,
};
+#define US_80211_TU 1024
+
+#define US_TO_TU(m) ((m) / US_80211_TU)
+#define TU_TO_US(m) ((m) * US_80211_TU)
+
#endif /* DEFS_H */
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -483,6 +483,7 @@
#define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
#define WLAN_EID_EXT_SPATIAL_REUSE 39
#define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42
+#define WLAN_EID_EXT_MAX_CHANNEL_SWITCH_TIME 52
#define WLAN_EID_EXT_OCV_OCI 54
#define WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION 55
#define WLAN_EID_EXT_NON_INHERITANCE 56
--- a/src/fst/fst_session.c
+++ b/src/fst/fst_session.c
@@ -18,11 +18,6 @@
#include "fst/fst_ctrl_defs.h"
#endif /* CONFIG_FST_TEST */
-#define US_80211_TU 1024
-
-#define US_TO_TU(m) ((m) * / US_80211_TU)
-#define TU_TO_US(m) ((m) * US_80211_TU)
-
#define FST_LLT_SWITCH_IMMEDIATELY 0
#define fst_printf_session(s, level, format, ...) \