diff mbox series

[2/7] AP: Add configuration options for 6GHz TPE Tx power

Message ID 20231222090423.111386-2-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series [1/7] AP: Update the HE regulatory information AP types | expand

Commit Message

Andrei Otcheretianski Dec. 22, 2023, 9:04 a.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Add configuration options for setting the Tx Power value
in the Transmit Power Envelope for 6GHz:

- The Tx power value for default client where the transmit
  power interpretation is "Regulatory Client EIRP PSD"
- The Tx power value for subordinate client where the transmit
  power interpretation is "Regulatory Client EIRP PSD"

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 hostapd/config_file.c |  4 ++++
 hostapd/hostapd.conf  |  7 +++++++
 src/ap/ap_config.c    |  2 ++
 src/ap/ap_config.h    |  6 +++++-
 src/ap/ieee802_11.c   | 14 +++++++++++---
 5 files changed, 29 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 09c31b4eaf..9469d1a4a3 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3630,6 +3630,10 @@  static int hostapd_config_fill(struct hostapd_config *conf,
 				   line);
 			return 1;
 		}
+	} else if (os_strcmp(buf, "reg_def_cli_eirp_psd") == 0) {
+		conf->reg_def_cli_eirp_psd = atoi(pos);
+	} else if (os_strcmp(buf, "reg_sub_cli_eirp_psd") == 0) {
+		conf->reg_sub_cli_eirp_psd = 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 cf18b2b7e7..8c8545e232 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -987,6 +987,13 @@  wmm_ac_vo_acm=0
 # 4 = Indoor Standard Power AP
 # This has no impact for operation on other bands.
 #he_6ghz_reg_pwr_type=0
+#
+# 6GHz Maximum Tx Power used in Tx Power Envelope Elements, where the
+# "Transmit Power Interpretation" is set to "Regulatory client EIRP PSD".
+# For Maximum Transmit Power Category subfield encoding set to default (0):
+#reg_def_cli_eirp_psd=-1
+# For Maximum Transmit Power Category subfield encoding set to subordinate (1):
+#reg_sub_cli_eirp_psd=-1
 
 # Unsolicited broadcast Probe Response transmission settings
 # This is for the 6 GHz band only. If the interval is set to a non-zero value,
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index cc1f37694e..a86887930f 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -282,6 +282,8 @@  struct hostapd_config * hostapd_config_defaults(void)
 	conf->he_6ghz_rx_ant_pat = 1;
 	conf->he_6ghz_tx_ant_pat = 1;
 	conf->he_6ghz_reg_pwr_type = HE_REG_INFO_6GHZ_AP_TYPE_VLP;
+	conf->reg_def_cli_eirp_psd = -1;
+	conf->reg_sub_cli_eirp_psd = -1;
 #endif /* CONFIG_IEEE80211AX */
 
 	/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 0bc799d3e7..a0290931b3 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1137,7 +1137,11 @@  struct hostapd_config {
 	u8 he_6ghz_rx_ant_pat;
 	u8 he_6ghz_tx_ant_pat;
 	u8 he_6ghz_reg_pwr_type;
-	bool require_he;
+
+	int reg_def_cli_eirp_psd;
+	int reg_sub_cli_eirp_psd;
+
+	int require_he;
 #endif /* CONFIG_IEEE80211AX */
 
 	/* VHT enable/disable config from CHAN_SWITCH */
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 3964efa43e..12725011bd 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7060,16 +7060,24 @@  u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
 		tx_pwr_intrpn = REGULATORY_CLIENT_EIRP_PSD;
 
 		/* Default Transmit Power Envelope for Global Operating Class */
-		tx_pwr = REG_PSD_MAX_TXPOWER_FOR_DEFAULT_CLIENT * 2;
+		if (hapd->iconf->reg_def_cli_eirp_psd != -1)
+			tx_pwr = hapd->iconf->reg_def_cli_eirp_psd;
+		else
+			tx_pwr = REG_PSD_MAX_TXPOWER_FOR_DEFAULT_CLIENT * 2;
+
 		eid = hostapd_add_tpe_info(eid, tx_pwr_count, tx_pwr_intrpn,
 					   REG_DEFAULT_CLIENT, tx_pwr);
 
 		/* Indoor Access Point must include an additional TPE for
-		 * subordinate devices */
+		 * subordinate devices
+		 */
 		if (iconf->he_6ghz_reg_pwr_type ==
 		    HE_REG_INFO_6GHZ_AP_TYPE_INDOOR) {
 			/* TODO: Extract PSD limits from channel data */
-			tx_pwr = REG_PSD_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT * 2;
+			if (hapd->iconf->reg_sub_cli_eirp_psd != -1)
+				tx_pwr = hapd->iconf->reg_sub_cli_eirp_psd;
+			else
+				tx_pwr = REG_PSD_MAX_TXPOWER_FOR_SUBORDINATE_CLIENT * 2;
 			eid = hostapd_add_tpe_info(eid, tx_pwr_count,
 						   tx_pwr_intrpn,
 						   REG_SUBORDINATE_CLIENT,