EHT: Move puncturing bitmap determination into a helper function

Avoid duplicated implementation for this by using a shared helper
function.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2024-03-08 10:00:35 +02:00 committed by Jouni Malinen
parent eecaceed8f
commit 47dad1ed16
4 changed files with 20 additions and 14 deletions

View file

@ -4425,3 +4425,19 @@ struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
return NULL;
}
#endif /* CONFIG_IEEE80211BE */
u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd)
{
u16 punct_bitmap = 0;
#ifdef CONFIG_IEEE80211BE
punct_bitmap = hapd->iconf->punct_bitmap;
#ifdef CONFIG_TESTING_OPTIONS
if (!punct_bitmap)
punct_bitmap = hapd->conf->eht_oper_puncturing_override;
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_IEEE80211BE */
return punct_bitmap;
}

View file

@ -801,4 +801,6 @@ int hostapd_link_remove(struct hostapd_data *hapd, u32 count);
if (false)
#endif /* CONFIG_IEEE80211BE */
u16 hostapd_get_punct_bitmap(struct hostapd_data *hapd);
#endif /* HOSTAPD_H */

View file

@ -206,19 +206,11 @@ u8 * hostapd_eid_eht_operation(struct hostapd_data *hapd, u8 *eid)
enum oper_chan_width chwidth;
size_t elen = 1 + 4;
bool eht_oper_info_present;
u16 punct_bitmap = conf->punct_bitmap;
u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
if (!hapd->iface->current_mode)
return eid;
#ifdef CONFIG_TESTING_OPTIONS
if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override) {
wpa_printf(MSG_DEBUG, "EHT: Puncturing mask override=0x%x",
hapd->conf->eht_oper_puncturing_override);
punct_bitmap = hapd->conf->eht_oper_puncturing_override;
}
#endif /* CONFIG_TESTING_OPTIONS */
if (is_6ghz_op_class(conf->op_class))
chwidth = op_class_to_ch_width(conf->op_class);
else

View file

@ -80,7 +80,7 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
u8 seg0 = hapd->iconf->vht_oper_centr_freq_seg0_idx;
u8 seg1 = hapd->iconf->vht_oper_centr_freq_seg1_idx;
#ifdef CONFIG_IEEE80211BE
u16 punct_bitmap = hapd->iconf->punct_bitmap;
u16 punct_bitmap = hostapd_get_punct_bitmap(hapd);
#endif /* CONFIG_IEEE80211BE */
if (is_6ghz_op_class(hapd->iconf->op_class))
@ -93,10 +93,6 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
os_memset(oper, 0, sizeof(*oper));
#ifdef CONFIG_IEEE80211BE
#ifdef CONFIG_TESTING_OPTIONS
if (!punct_bitmap && hapd->conf->eht_oper_puncturing_override)
punct_bitmap = hapd->conf->eht_oper_puncturing_override;
#endif /* CONFIG_TESTING_OPTIONS */
if (punct_bitmap) {
punct_update_legacy_bw(punct_bitmap,
hapd->iconf->channel,