From a7ea721889eb8919cd284ae36e6ff4db0310e8a1 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <quic_alokad@quicinc.com>
Date: Tue, 19 Apr 2022 11:04:05 -0700
Subject: [PATCH] EHT: Add configuration options for beamforming capabilities

Add configuration options to set EHT SU/MU beamforming capabilities.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
---
 hostapd/config_file.c |  6 ++++++
 hostapd/hostapd.conf  | 15 +++++++++++++++
 src/ap/ap_config.h    | 10 ++++++++++
 3 files changed, 31 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index b60517db2..97eea8eda 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4705,6 +4705,12 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		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_su_beamformer") == 0) {
+		conf->eht_phy_capab.su_beamformer = atoi(pos);
+	} else if (os_strcmp(buf, "eht_su_beamformee") == 0) {
+		conf->eht_phy_capab.su_beamformee = atoi(pos);
+	} else if (os_strcmp(buf, "eht_mu_beamformer") == 0) {
+		conf->eht_phy_capab.mu_beamformer = atoi(pos);
 #endif /* CONFIG_IEEE80211BE */
 	} else {
 		wpa_printf(MSG_ERROR,
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 64e8cb3e8..6ccb61115 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -1000,6 +1000,21 @@ wmm_ac_vo_acm=0
 #disable_11be: Boolean (0/1) to disable EHT for a specific BSS
 #disable_11be=0
 
+#eht_su_beamformer: EHT single user beamformer support
+# 0 = not supported (default)
+# 1 = supported
+#eht_su_beamformer=1
+
+#eht_su_beamformee: EHT single user beamformee support
+# 0 = not supported (default)
+# 1 = supported
+#eht_su_beamformee=1
+
+#eht_mu_beamformer: EHT multiple user beamformer support
+# 0 = not supported (default)
+# 1 = supported
+#eht_mu_beamformer=1
+
 # EHT operating channel information; see matching he_* parameters for details.
 # The field eht_oper_centr_freq_seg0_idx field is used to indicate center
 # frequency of 40, 80, and 160 MHz bandwidth operation.
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index b6f2ee701..0739bc61c 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -948,6 +948,15 @@ struct spatial_reuse {
 	u8 srg_partial_bssid_bitmap[8];
 };
 
+/**
+ * struct eht_phy_capabilities_info - EHT PHY capabilities
+ */
+struct eht_phy_capabilities_info {
+	bool su_beamformer;
+	bool su_beamformee;
+	bool mu_beamformer;
+};
+
 /**
  * struct hostapd_config - Per-radio interface configuration
  */
@@ -1120,6 +1129,7 @@ struct hostapd_config {
 #ifdef CONFIG_IEEE80211BE
 	u8 eht_oper_chwidth;
 	u8 eht_oper_centr_freq_seg0_idx;
+	struct eht_phy_capabilities_info eht_phy_capab;
 #endif /* CONFIG_IEEE80211BE */
 };