From 6ab1c08908767246cf0550787adb75371ab00c96 Mon Sep 17 00:00:00 2001
From: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Date: Tue, 2 Mar 2021 23:03:03 -0800
Subject: [PATCH 3/4] hostapd: add config option to specify 6Ghz AP type

IEEE P802.11ax/D7.0 introduces Regulatory info subfield which
is interpreted to 6Ghz ap type.

When not specified, Indoor AP type is selected for 6GHz AP by
default.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
 hostapd/config_file.c |  2 ++
 hostapd/hostapd.conf  |  7 +++++++
 src/ap/ap_config.h    | 12 ++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index d9c21a5780ba..e3be84c2ac63 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3502,6 +3502,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 				   line, pos);
 			return 1;
 		}
+	} else if (os_strcmp(buf, "he_6ghz_reg_pwr_type") == 0) {
+		conf->he_6ghz_reg_pwr_type = atoi(pos);
 	} else if (os_strcmp(buf, "he_oper_chwidth") == 0) {
 		conf->he_oper_chwidth = atoi(pos);
 	} else if (os_strcmp(buf, "he_oper_centr_freq_seg0_idx") == 0) {
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index 976582312513..7b9f11a16f80 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -579,6 +579,13 @@ wmm_ac_vo_acm=0
 # Enable co-locate for a 6GHz radio
 #co_locate=0
 
+# 6GHz regulatory AP type
+# This config is to set 6GHz access point type. Possible options
+# are 0 = Indoor AP, 1 = Standard Power AP
+# If not specified Indoor AP is selected by default.
+# option is no operation for non 6GHz band.
+#he_6ghz_reg_pwr_type=0
+
 ##### IEEE 802.11n related configuration ######################################
 
 # ieee80211n: Whether IEEE 802.11n (HT) is enabled
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 70cee055bbe6..6e5406f59887 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1049,6 +1049,9 @@ struct hostapd_config {
 	u8 he_oper_centr_freq_seg0_idx;
 	u8 he_oper_centr_freq_seg1_idx;
 	bool he_co_locate;
+#define AP_TYPE_6GHZ_INDOOR_AP	0
+#define AP_TYPE_6GHZ_STANDARD_POWER_AP	1
+	u8 he_6ghz_reg_pwr_type;
 #endif /* CONFIG_IEEE80211AX */
 
 #ifdef CONFIG_IEEE80211AX
@@ -1079,6 +1082,15 @@ struct hostapd_config {
 #endif /* CONFIG_AIRTIME_POLICY */
 };
 
+static inline u8 hostapd_get_he_6ghz_reg_pwr_type(struct hostapd_config *conf)
+{
+#ifdef CONFIG_IEEE80211AX
+	if (conf->ieee80211ax)
+		return conf->he_6ghz_reg_pwr_type;
+#endif /* CONFIG_IEEE80211AX */
+	return 0;
+}
+
 
 static inline u8 hostapd_get_oper_chwidth(struct hostapd_config *conf)
 {
-- 
2.17.1

