From ada9083ac4a13e87e0cb3847158f0c9c0a66d0e5 Mon Sep 17 00:00:00 2001 From: Ilan Peer Date: Fri, 22 Dec 2023 11:04:17 +0200 Subject: [PATCH] AP: Update the HE regulatory information AP types for the 6 GHz band Update the HE regulatory information AP types based on IEEE P802.11-REVme/D4.0. Set the default AP type to VLP. Check for valid values when setting 'he_6ghz_reg_pwr_type' in the interface configuration. Signed-off-by: Ilan Peer --- hostapd/config_file.c | 6 ++++++ hostapd/hostapd.conf | 9 +++++++-- src/ap/ap_config.c | 1 + src/ap/beacon.c | 7 ++++--- src/ap/ieee802_11.c | 3 ++- src/ap/ieee802_11_he.c | 10 ++++------ src/common/ieee802_11_defs.h | 15 +++++++++------ 7 files changed, 33 insertions(+), 18 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index b1b7350df..18aab8e50 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3675,6 +3675,12 @@ static int hostapd_config_fill(struct hostapd_config *conf, } } else if (os_strcmp(buf, "he_6ghz_reg_pwr_type") == 0) { conf->he_6ghz_reg_pwr_type = atoi(pos); + if (conf->he_6ghz_reg_pwr_type > HE_REG_INFO_6GHZ_AP_TYPE_MAX) { + wpa_printf(MSG_ERROR, + "Line %d: invalid he_6ghz_reg_pwr_type value", + line); + return 1; + } } 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 8f6165a0b..542489a39 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -980,9 +980,14 @@ wmm_ac_vo_acm=0 # 6 GHz Access Point type # This config is to set the 6 GHz Access Point type. Possible options are: -# 0 = Indoor AP (default) -# 1 = Standard Power AP +# 0 = Indoor AP +# 1 = Standard power AP +# 2 = Very low power AP (default) +# 3 = Indoor enabled AP +# 4 = Indoor standard power AP # This has no impact for operation on other bands. +# See IEEE P802.11-REVme/D4.0, Table E-12 (Regulatory Info subfield encoding) +# for more details. #he_6ghz_reg_pwr_type=0 # Unsolicited broadcast Probe Response transmission settings diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c index 2c66217e8..cc1f37694 100644 --- a/src/ap/ap_config.c +++ b/src/ap/ap_config.c @@ -281,6 +281,7 @@ struct hostapd_config * hostapd_config_defaults(void) conf->he_6ghz_max_ampdu_len_exp = 7; 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; #endif /* CONFIG_IEEE80211AX */ /* The third octet of the country string uses an ASCII space character diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 3588030fb..3c0353901 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -620,7 +620,7 @@ static size_t hostapd_probe_resp_elems_len(struct hostapd_data *hapd, /* An additional Transmit Power Envelope element for * subordinate client */ if (hapd->iconf->he_6ghz_reg_pwr_type == - HE_6GHZ_INDOOR_AP) + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR) buflen += 4; } } @@ -1930,7 +1930,8 @@ static u8 * hostapd_gen_fils_discovery(struct hostapd_data *hapd, size_t *len) /* Transmit Power Envelope element(s) */ if (is_6ghz_op_class(hapd->iconf->op_class)) { total_len += 4; - if (hapd->iconf->he_6ghz_reg_pwr_type == HE_6GHZ_INDOOR_AP) + if (hapd->iconf->he_6ghz_reg_pwr_type == + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR) total_len += 4; } #endif /* CONFIG_IEEE80211AX */ @@ -2095,7 +2096,7 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd, /* An additional Transmit Power Envelope element for * subordinate client */ if (hapd->iconf->he_6ghz_reg_pwr_type == - HE_6GHZ_INDOOR_AP) + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR) tail_len += 4; } } diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index c905c0fcd..1703d8317 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -7073,7 +7073,8 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid) /* Indoor Access Point must include an additional TPE for * subordinate devices */ - if (iconf->he_6ghz_reg_pwr_type == HE_6GHZ_INDOOR_AP) { + 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; eid = hostapd_add_tpe_info(eid, tx_pwr_count, diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c index f308a6daf..4b693a7c5 100644 --- a/src/ap/ieee802_11_he.c +++ b/src/ap/ieee802_11_he.c @@ -254,12 +254,10 @@ u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid) control = 3; else control = center_idx_to_bw_6ghz(seg0); - if (hapd->iconf->he_6ghz_reg_pwr_type == 1) - control |= HE_6GHZ_STANDARD_POWER_AP << - HE_6GHZ_OPER_INFO_CTRL_REG_INFO_SHIFT; - else - control |= HE_6GHZ_INDOOR_AP << - HE_6GHZ_OPER_INFO_CTRL_REG_INFO_SHIFT; + + control |= hapd->iconf->he_6ghz_reg_pwr_type << + HE_6GHZ_OPER_INFO_CTRL_REG_INFO_SHIFT; + *pos++ = control; /* Channel Center Freq Seg0/Seg1 */ diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 349aceb3c..09f7d0054 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2448,14 +2448,17 @@ struct ieee80211_spatial_reuse { #define HE_OPERATION_BSS_COLOR_MAX 64 /** - * enum he_6ghz_ap_type - Allowed Access Point types for 6 GHz Band + * enum he_reg_info_6ghz_ap_type - Allowed Access Point types for 6 GHz Band * - * IEEE Std 802.11ax-2021, Table E-12 (Regulatory Info subfield encoding in the - * United States) + * IEEE P802.11-REVme/D4.0, Table E-12 (Regulatory Info subfield encoding) */ -enum he_6ghz_ap_type { - HE_6GHZ_INDOOR_AP = 0, - HE_6GHZ_STANDARD_POWER_AP = 1, +enum he_reg_info_6ghz_ap_type { + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR = 0, + HE_REG_INFO_6GHZ_AP_TYPE_SP = 1, + HE_REG_INFO_6GHZ_AP_TYPE_VLP = 2, + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_ENABLED = 3, + HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP = 4, + HE_REG_INFO_6GHZ_AP_TYPE_MAX = HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP, }; /* Spatial Reuse defines */