diff mbox series

[4/5] AP: Support overriding EHT operation puncturing mask

Message ID 20231221064934.3887910-4-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series None | expand

Commit Message

Andrei Otcheretianski Dec. 21, 2023, 6:49 a.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Add support for overriding EHT operation element puncturing mask
for testing purposes.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 hostapd/config_file.c   |  3 +++
 src/ap/ap_config.h      |  4 ++++
 src/ap/ieee802_11_eht.c | 17 +++++++++++++----
 3 files changed, 20 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 3d356e617a..fddf61024e 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4802,6 +4802,9 @@  static int hostapd_config_fill(struct hostapd_config *conf,
 				   line);
 			return 1;
 		}
+#ifdef CONFIG_TESTING_OPTIONS
+	PARSE_FORCE_U16(bss, eht_oper_puncturing_override)
+#endif /* CONFIG_TESTING_OPTIONS */
 #endif /* CONFIG_IEEE80211BE */
 	} else {
 		wpa_printf(MSG_ERROR,
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 0bc799d3e7..5bf41b4389 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -704,6 +704,10 @@  struct hostapd_bss_config {
 	unsigned int oci_freq_override_ft_assoc;
 	unsigned int oci_freq_override_fils_assoc;
 	unsigned int oci_freq_override_wnm_sleep;
+
+#ifdef CONFIG_IEEE80211BE
+	u16 eht_oper_puncturing_override;
+#endif /* CONFIG_IEEE80211BE */
 #endif /* CONFIG_TESTING_OPTIONS */
 
 #define MESH_ENABLED BIT(0)
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index 2a1c811e54..ecf76cc77a 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -204,22 +204,31 @@  u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
 	enum oper_chan_width chwidth;
 	size_t elen = 1 + 4;
 	bool eht_oper_info_present;
+	u16 punct_bitmap =conf->punct_bitmap;
 
 	if (!hapd->iface->current_mode)
 		return eid;
 
+#ifdef CONFIG_TESTING_OPTIONS
+	if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override) {
+		wpa_printf(MSG_DEBUG, "EHT: puncturing mask override=0x%x",
+			   hapd->conf->eht_oper_puncturing_override);
+		punct_bitmap = hapd->conf->eht_oper_puncturing_override;
+	}
+#endif /* CONFIG_TESTING_OPTIONS */
+
 	if (is_6ghz_op_class(conf->op_class))
 		chwidth = op_class_to_ch_width(conf->op_class);
 	else
 		chwidth = conf->eht_oper_chwidth;
 
 	eht_oper_info_present = chwidth == CONF_OPER_CHWIDTH_320MHZ ||
-		hapd->iconf->punct_bitmap;
+				punct_bitmap;
 
 	if (eht_oper_info_present)
 		elen += 3;
 
-	if (hapd->iconf->punct_bitmap)
+	if (punct_bitmap)
 		elen += EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE;
 
 	*pos++ = WLAN_EID_EXTENSION;
@@ -275,10 +284,10 @@  u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
 	oper->oper_info.ccfs0 = seg0 ? seg0 : hapd->iconf->channel;
 	oper->oper_info.ccfs1 = seg1;
 
-	if (hapd->iconf->punct_bitmap) {
+	if (punct_bitmap) {
 		oper->oper_params |= EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT;
 		oper->oper_info.disabled_chan_bitmap =
-			host_to_le16(hapd->iconf->punct_bitmap);
+			host_to_le16(punct_bitmap);
 	}
 
 	return pos + elen;