AP: A helper function for determining whether the AP is an SP AP

Get rid of unnecessary code duplication.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2023-12-22 20:57:53 +02:00
parent 24baffc8b6
commit 121ccadeb4
3 changed files with 10 additions and 16 deletions

View file

@ -580,20 +580,14 @@ static size_t he_elem_len(struct hostapd_data *hapd)
3 + sizeof(struct ieee80211_he_6ghz_band_cap); 3 + sizeof(struct ieee80211_he_6ghz_band_cap);
/* An additional Transmit Power Envelope element for /* An additional Transmit Power Envelope element for
* subordinate client */ * subordinate client */
if (hapd->iconf->he_6ghz_reg_pwr_type == if (he_reg_is_sp(hapd->iconf->he_6ghz_reg_pwr_type))
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR ||
hapd->iconf->he_6ghz_reg_pwr_type ==
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP)
len += 4; len += 4;
/* An additional Transmit Power Envelope element for /* An additional Transmit Power Envelope element for
* default client with unit interpretation of regulatory * default client with unit interpretation of regulatory
* client EIRP */ * client EIRP */
if (hapd->iconf->reg_def_cli_eirp != -1 && if (hapd->iconf->reg_def_cli_eirp != -1 &&
(hapd->iconf->he_6ghz_reg_pwr_type == he_reg_is_sp(hapd->iconf->he_6ghz_reg_pwr_type))
HE_REG_INFO_6GHZ_AP_TYPE_SP ||
hapd->iconf->he_6ghz_reg_pwr_type ==
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP))
len += 4; len += 4;
} }
#endif /* CONFIG_IEEE80211AX */ #endif /* CONFIG_IEEE80211AX */

View file

@ -7077,10 +7077,7 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
/* Indoor Access Point must include an additional TPE for /* Indoor Access Point must include an additional TPE for
* subordinate devices */ * subordinate devices */
if (iconf->he_6ghz_reg_pwr_type == if (he_reg_is_sp(iconf->he_6ghz_reg_pwr_type)) {
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR ||
iconf->he_6ghz_reg_pwr_type ==
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP) {
/* TODO: Extract PSD limits from channel data */ /* TODO: Extract PSD limits from channel data */
if (hapd->iconf->reg_sub_cli_eirp_psd != -1) if (hapd->iconf->reg_sub_cli_eirp_psd != -1)
tx_pwr = hapd->iconf->reg_sub_cli_eirp_psd; tx_pwr = hapd->iconf->reg_sub_cli_eirp_psd;
@ -7093,10 +7090,7 @@ u8 * hostapd_eid_txpower_envelope(struct hostapd_data *hapd, u8 *eid)
} }
if (iconf->reg_def_cli_eirp != -1 && if (iconf->reg_def_cli_eirp != -1 &&
(iconf->he_6ghz_reg_pwr_type == he_reg_is_sp(iconf->he_6ghz_reg_pwr_type))
HE_REG_INFO_6GHZ_AP_TYPE_SP ||
iconf->he_6ghz_reg_pwr_type ==
HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP))
eid = hostapd_add_tpe_info( eid = hostapd_add_tpe_info(
eid, tx_pwr_count, REGULATORY_CLIENT_EIRP, eid, tx_pwr_count, REGULATORY_CLIENT_EIRP,
REG_DEFAULT_CLIENT, REG_DEFAULT_CLIENT,

View file

@ -2461,6 +2461,12 @@ enum he_reg_info_6ghz_ap_type {
HE_REG_INFO_6GHZ_AP_TYPE_MAX = HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP, HE_REG_INFO_6GHZ_AP_TYPE_MAX = HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP,
}; };
static inline bool he_reg_is_sp(enum he_reg_info_6ghz_ap_type type)
{
return type == HE_REG_INFO_6GHZ_AP_TYPE_SP ||
type == HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP;
}
/* Spatial Reuse defines */ /* Spatial Reuse defines */
#define SPATIAL_REUSE_SRP_DISALLOWED BIT(0) #define SPATIAL_REUSE_SRP_DISALLOWED BIT(0)
#define SPATIAL_REUSE_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1) #define SPATIAL_REUSE_NON_SRG_OBSS_PD_SR_DISALLOWED BIT(1)