hostapd: Add eht_bw320_offset configuration option

Introduce a new configuration option, "eht_bw320_offset", which enables
devices to specify a preferred channelization for 320 MHz BSSs when
using automatic channel selection (ACS). This option is applicable only
when the channel is not already decided and the bandwidth is set to 320
MHz.

The value and meaning of the option:
0: auto-detected by ACS
1: 320 MHz-1
2: 320 MHz-2

Co-developed-by: Money Wang <money.wang@mediatek.com>
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
This commit is contained in:
Michael-CY Lee 2023-12-22 12:59:10 +08:00 committed by Jouni Malinen
parent 733de85680
commit e6f2494c3a
6 changed files with 68 additions and 0 deletions

View file

@ -1199,6 +1199,7 @@ struct hostapd_config {
u16 punct_bitmap; /* a bitmap of disabled 20 MHz channels */
u8 punct_acs_threshold;
u8 eht_default_pe_duration;
u8 eht_bw320_offset;
#endif /* CONFIG_IEEE80211BE */
/* EHT enable/disable config from CHAN_SWITCH */
@ -1299,6 +1300,43 @@ hostapd_set_oper_centr_freq_seg1_idx(struct hostapd_config *conf,
conf->vht_oper_centr_freq_seg1_idx = oper_centr_freq_seg1_idx;
}
static inline u8
hostapd_get_bw320_offset(struct hostapd_config *conf)
{
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) &&
hostapd_get_oper_chwidth(conf) == CONF_OPER_CHWIDTH_320MHZ)
return conf->eht_bw320_offset;
#endif /* CONFIG_IEEE80211BE */
return 0;
}
static inline void
hostapd_set_and_check_bw320_offset(struct hostapd_config *conf,
u8 bw320_offset)
{
#ifdef CONFIG_IEEE80211BE
if (conf->ieee80211be && is_6ghz_op_class(conf->op_class) &&
op_class_to_ch_width(conf->op_class) == CONF_OPER_CHWIDTH_320MHZ) {
if (conf->channel) {
/* If the channel is set, then calculate bw320_offset
* by center frequency segment 0.
*/
u8 seg0 = hostapd_get_oper_centr_freq_seg0_idx(conf);
conf->eht_bw320_offset = (seg0 - 31) % 64 ? 2 : 1;
} else {
/* If the channel is not set, bw320_offset indicates
* preferred offset of 320 MHz.
*/
conf->eht_bw320_offset = bw320_offset;
}
} else {
conf->eht_bw320_offset = 0;
}
#endif /* CONFIG_IEEE80211BE */
}
int hostapd_mac_comp(const void *a, const void *b);
struct hostapd_config * hostapd_config_defaults(void);