wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/q02-048-hostapd-Update-11be-EHT-elements-to-Draft-2.0-versio.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

255 lines
9.4 KiB
Diff

From 7377742385c93887bc125cecc21204387112517d Mon Sep 17 00:00:00 2001
From: Balamurugan Mahalingam <quic_bmahalin@quicinc.com>
Date: Tue, 16 Aug 2022 17:53:38 -0700
Subject: [PATCH] hostapd: Update 11be EHT elements to Draft 2.0 version
Update the EHT operations elements to Draft 2.0 and fix interop
issues with stations
Signed-off-by: Balamurugan Mahalingam <quic_bmahalin@quicinc.com>
---
hostapd/config_file.c | 2 ++
src/ap/ap_config.h | 9 +++++++++
src/ap/beacon.c | 5 +++++
src/ap/ctrl_iface_ap.c | 6 ++++--
src/ap/ieee802_11.c | 2 ++
src/ap/ieee802_11_eht.c | 25 +++++++++++++++++++++++++
src/common/ieee802_11_defs.h | 33 ++++++++++++++++++++++-----------
wpa_supplicant/mesh_mpm.c | 10 +++++-----
8 files changed, 74 insertions(+), 18 deletions(-)
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4762,6 +4762,8 @@ static int hostapd_config_fill(struct ho
conf->eht_oper_chwidth = atoi(pos);
} else if (os_strcmp(buf, "eht_oper_centr_freq_seg0_idx") == 0) {
conf->eht_oper_centr_freq_seg0_idx = atoi(pos);
+ } else if (os_strcmp(buf, "eht_oper_centr_freq_seg1_idx") == 0) {
+ conf->eht_oper_centr_freq_seg1_idx = atoi(pos);
} else if (os_strcmp(buf, "eht_su_beamformer") == 0) {
conf->eht_phy_capab.su_beamformer = atoi(pos);
} else if (os_strcmp(buf, "eht_su_beamformee") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1191,6 +1191,7 @@ struct hostapd_config {
#ifdef CONFIG_IEEE80211BE
enum oper_chan_width eht_oper_chwidth;
u8 eht_oper_centr_freq_seg0_idx;
+ u8 eht_oper_centr_freq_seg1_idx;
struct eht_phy_capabilities_info eht_phy_capab;
u16 punct_bitmap; /* a bitmap of disabled 20 MHz channels */
u8 punct_acs_threshold;
@@ -1282,6 +1283,10 @@ hostapd_set_oper_centr_freq_seg0_idx(str
static inline u8
hostapd_get_oper_centr_freq_seg1_idx(struct hostapd_config *conf)
{
+#ifdef CONFIG_IEEE80211BE
+ if (conf->ieee80211be)
+ return conf->eht_oper_centr_freq_seg1_idx;
+#endif /* CONFIG_IEEE80211BE */
#ifdef CONFIG_IEEE80211AX
if (conf->ieee80211ax)
return conf->he_oper_centr_freq_seg1_idx;
@@ -1293,6 +1298,10 @@ static inline void
hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
u8 oper_centr_freq_seg1_idx)
{
+#ifdef CONFIG_IEEE80211BE
+ if (conf->ieee80211be)
+ conf->eht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
+#endif /* CONFIG_IEEE80211BE */
#ifdef CONFIG_IEEE80211AX
if (conf->ieee80211ax)
conf->he_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -610,6 +610,8 @@ static u8 * hostapd_gen_probe_resp(struc
if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) {
buflen += hostapd_eid_eht_capab_len(hapd, IEEE80211_MODE_AP);
buflen += 3 + sizeof(struct ieee80211_eht_operation);
+ if (hapd->iconf->ru_punct_bitmap)
+ buflen += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
if (hapd->iconf->punct_bitmap)
buflen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE;
@@ -787,7 +789,7 @@ static u8 * hostapd_gen_probe_resp(struc
if (hapd->conf->mld_ap)
pos = hostapd_eid_eht_basic_ml(hapd, pos, NULL, true);
pos = hostapd_eid_eht_capab(hapd, pos, IEEE80211_MODE_AP);
- pos = hostapd_eid_eht_operation(hapd, pos);
+ pos = hostapd_eid_eht_operation(hapd, pos, IEEE80211_MODE_AP);
}
#endif /* CONFIG_IEEE80211BE */
@@ -1768,6 +1770,9 @@ int ieee802_11_build_ap_params(struct ho
*/
if (hapd->conf->mld_ap)
tail_len += 256;
+
+ if (hapd->iconf->ru_punct_bitmap)
+ tail_len += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
}
#endif /* CONFIG_IEEE80211BE */
@@ -1946,7 +1951,7 @@ int ieee802_11_build_ap_params(struct ho
true);
tailpos = hostapd_eid_eht_capab(hapd, tailpos,
IEEE80211_MODE_AP);
- tailpos = hostapd_eid_eht_operation(hapd, tailpos);
+ tailpos = hostapd_eid_eht_operation(hapd, tailpos, IEEE80211_MODE_AP);
}
#endif /* CONFIG_IEEE80211BE */
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -955,9 +955,11 @@ int hostapd_ctrl_iface_status(struct hos
if (iface->conf->ieee80211be && !hapd->conf->disable_11be) {
ret = os_snprintf(buf + len, buflen - len,
"eht_oper_chwidth=%d\n"
- "eht_oper_centr_freq_seg0_idx=%d\n",
+ "eht_oper_centr_freq_seg0_idx=%d\n"
+ "eht_oper_centr_freq_seg1_idx=%d\n",
iface->conf->eht_oper_chwidth,
- iface->conf->eht_oper_centr_freq_seg0_idx);
+ iface->conf->eht_oper_centr_freq_seg0_idx,
+ iface->conf->eht_oper_centr_freq_seg1_idx);
if (os_snprintf_error(buflen - len, ret))
return len;
len += ret;
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4341,7 +4341,7 @@ static size_t ieee80211_ml_build_assoc_r
p = hostapd_eid_he_6ghz_band_cap(hapd, p);
if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) {
p = hostapd_eid_eht_capab(hapd, p, IEEE80211_MODE_AP);
- p = hostapd_eid_eht_operation(hapd, p);
+ p = hostapd_eid_eht_operation(hapd, p, IEEE80211_MODE_AP);
}
}
@@ -4731,6 +4731,8 @@ static u16 send_assoc_resp(struct hostap
if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) {
buflen += hostapd_eid_eht_capab_len(hapd, IEEE80211_MODE_AP);
buflen += 3 + sizeof(struct ieee80211_eht_operation);
+ if (hapd->iconf->ru_punct_bitmap)
+ buflen += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
if (hapd->iconf->punct_bitmap)
buflen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE;
}
@@ -4897,7 +4899,7 @@ rsnxe_done:
if (hapd->conf->mld_ap)
p = hostapd_eid_eht_basic_ml(hapd, p, sta, false);
p = hostapd_eid_eht_capab(hapd, p, IEEE80211_MODE_AP);
- p = hostapd_eid_eht_operation(hapd, p);
+ p = hostapd_eid_eht_operation(hapd, p, IEEE80211_MODE_AP);
}
#endif /* CONFIG_IEEE80211BE */
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -228,7 +228,8 @@ size_t hostapd_eid_eht_capab_len(struct
enum ieee80211_op_mode opmode);
u8 * hostapd_eid_eht_capab(struct hostapd_data *hapd, u8 *eid,
enum ieee80211_op_mode opmode);
-u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid);
+u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid,
+ enum ieee80211_op_mode opmode);
u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta,
enum ieee80211_op_mode opmode,
const u8 *he_capab, size_t he_capab_len,
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -208,13 +208,13 @@ u8 * hostapd_eid_eht_capab(struct hostap
}
-u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
+u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid,
+ enum ieee80211_op_mode opmode)
{
struct hostapd_config *conf = hapd->iconf;
struct ieee80211_eht_operation *oper;
- u8 *pos = eid, seg0 = 0, seg1 = 0;
+ u8 *pos = eid, seg0 = 0, seg1 = 0, *length_pos;
enum oper_chan_width chwidth;
- size_t elen = 1 + 4 + 3;
if (!hapd->iface->current_mode)
return eid;
@@ -223,7 +223,7 @@ u8 * hostapd_eid_eht_operation(struct ho
elen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE;
*pos++ = WLAN_EID_EXTENSION;
- *pos++ = 1 + elen;
+ length_pos = pos++;
*pos++ = WLAN_EID_EXT_EHT_OPERATION;
oper = (struct ieee80211_eht_operation *) pos;
@@ -261,6 +261,15 @@ u8 * hostapd_eid_eht_operation(struct ho
break;
case CONF_OPER_CHWIDTH_160MHZ:
oper->oper_info.control |= EHT_OPER_CHANNEL_WIDTH_160MHZ;
+ if (!oper->oper_info.ccfs1) {
+ /* CCFS0 points to center channel frequency in config */
+ oper->oper_info.ccfs1 = oper->oper_info.ccfs0;
+ if (hapd->iconf->channel < oper->oper_info.ccfs0)
+ oper->oper_info.ccfs0 = oper->oper_info.ccfs1 - 8;
+ else
+ oper->oper_info.ccfs0 = oper->oper_info.ccfs1 + 8;
+ }
+
if (hapd->iconf->ru_punct_bitmap &&
hapd->iface->ru_punct_supp_bw == CONF_OPER_CHWIDTH_320MHZ) {
hapd->iconf->ru_punct_bitmap = 0;
@@ -298,6 +307,7 @@ u8 * hostapd_eid_eht_operation(struct ho
if (hapd->iconf->ru_punct_bitmap) {
oper->oper_params |= EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT;
oper->oper_info.disabled_chan_bitmap = host_to_le16(hapd->iconf->ru_punct_bitmap);
+ pos += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
}
if (hapd->iconf->punct_bitmap) {
@@ -306,7 +316,10 @@ u8 * hostapd_eid_eht_operation(struct ho
host_to_le16(hapd->iconf->punct_bitmap);
}
- return pos + elen;
+ pos += 8;
+ *length_pos = pos - (eid + 2);
+
+ return pos;
}
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2502,6 +2502,8 @@ struct ieee80211_he_mu_edca_parameter_se
#define EHT_OPER_CHANNEL_WIDTH_160MHZ 3
#define EHT_OPER_CHANNEL_WIDTH_320MHZ 4
+#define DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE 2
+
/* Figure 9-1002c: EHT Operation Information field format */
struct ieee80211_eht_oper_info {
u8 control; /* B0..B2: Channel Width */
--- a/wpa_supplicant/mesh_mpm.c
+++ b/wpa_supplicant/mesh_mpm.c
@@ -279,6 +279,8 @@ static void mesh_mpm_send_plink_action(s
buf_len += 3 + 2 + EHT_PHY_CAPAB_LEN + EHT_MCS_NSS_CAPAB_LEN +
EHT_PPE_THRESH_CAPAB_LEN;
buf_len += 3 + sizeof(struct ieee80211_eht_operation);
+ if (bss->iconf->ru_punct_bitmap)
+ buf_len += DISABLED_SUBCHANNEL_BITMAP_BYTES_SIZE;
}
#endif /* CONFIG_IEEE80211BE */
@@ -448,7 +450,7 @@ static void mesh_mpm_send_plink_action(s
3 + sizeof(struct ieee80211_eht_operation)];
pos = hostapd_eid_eht_capab(bss, eht_capa_oper,
IEEE80211_MODE_MESH);
- pos = hostapd_eid_eht_operation(bss, pos);
+ pos = hostapd_eid_eht_operation(bss, pos, IEEE80211_MODE_MESH);
wpabuf_put_data(buf, eht_capa_oper, pos - eht_capa_oper);
}
#endif /* CONFIG_IEEE80211BE */