From 15f8ed3e8f3226654aecf17800854486ab1356bf Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Wed, 21 Jul 2021 10:12:52 -0700 Subject: [PATCH 18/23] eht: support for channel switch command Add option to hostapd client command to allow switch in EHT mode. Signed-off-by: Muna Sinada Signed-off-by: Aloka Dixit --- hostapd/ctrl_iface.c | 2 +- hostapd/hostapd_cli.c | 2 +- src/ap/ap_config.h | 5 +++++ src/ap/ctrl_iface_ap.c | 1 + src/ap/hostapd.c | 14 +++++++++++--- 5 files changed, 19 insertions(+), 5 deletions(-) --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2771,7 +2771,7 @@ static int hostapd_ctrl_iface_chan_switc for (i = 0; i < iface->num_bss; i++) { - /* Save CHAN_SWITCH VHT and HE config */ + /* Save CHAN_SWITCH VHT, HE and EHT config */ hostapd_chan_switch_config(iface->bss[i], &settings.freq_params); --- a/hostapd/hostapd_cli.c +++ b/hostapd/hostapd_cli.c @@ -1188,7 +1188,7 @@ static int hostapd_cli_cmd_chan_switch(s "arguments (count and freq)\n" "usage: [sec_channel_offset=] " "[center_freq1=] [center_freq2=] [bandwidth=] " - "[blocktx] [ht|vht]\n"); + "[blocktx] [ht|vht|he|eht]\n"); return -1; } --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1127,6 +1127,11 @@ struct hostapd_config { u8 eht_oper_centr_freq_seg0_idx; struct eht_phy_capabilities_info eht_phy_capab; #endif /* CONFIG_IEEE80211BE */ + + /* EHT enable/disable config from CHAN_SWITCH */ +#define CH_SWITCH_EHT_ENABLED BIT(0) +#define CH_SWITCH_EHT_DISABLED BIT(1) + unsigned int ch_switch_eht_config; }; static inline u8 hostapd_get_he_6ghz_reg_pwr_type(struct hostapd_config *conf) --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -1258,6 +1258,7 @@ int hostapd_parse_csa_settings(const cha settings->freq_params.ht_enabled = !!os_strstr(pos, " ht"); settings->freq_params.vht_enabled = !!os_strstr(pos, " vht"); settings->freq_params.he_enabled = !!os_strstr(pos, " he"); + settings->freq_params.eht_enabled = !!os_strstr(pos, " eht"); settings->block_tx = !!os_strstr(pos, " blocktx"); #undef SET_CSA_SETTING --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -3581,11 +3581,12 @@ static int hostapd_fill_csa_settings(str &hapd->iface->cs_oper_class, &chan) == NUM_HOSTAPD_MODES) { wpa_printf(MSG_DEBUG, - "invalid frequency for channel switch (freq=%d, sec_channel_offset=%d, vht_enabled=%d, he_enabled=%d)", + "invalid frequency for channel switch (freq=%d, sec_channel_offset=%d, vht_enabled=%d, he_enabled=%d, eht_enabled=%d)", settings->freq_params.freq, settings->freq_params.sec_channel_offset, settings->freq_params.vht_enabled, - settings->freq_params.he_enabled); + settings->freq_params.he_enabled, + settings->freq_params.eht_enabled); return -1; } @@ -3646,6 +3647,11 @@ void hostapd_cleanup_cs_params(struct ho void hostapd_chan_switch_config(struct hostapd_data *hapd, struct hostapd_freq_params *freq_params) { + if (freq_params->eht_enabled) + hapd->iconf->ch_switch_eht_config |= CH_SWITCH_EHT_ENABLED; + else + hapd->iconf->ch_switch_eht_config |= CH_SWITCH_EHT_DISABLED; + if (freq_params->he_enabled) hapd->iconf->ch_switch_he_config |= CH_SWITCH_HE_ENABLED; else @@ -3658,7 +3664,8 @@ void hostapd_chan_switch_config(struct h hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO, - "CHAN_SWITCH HE config 0x%x VHT config 0x%x", + "CHAN_SWITCH EHT config 0x%x HE config 0x%x VHT config 0x%x", + hapd->iconf->ch_switch_eht_config, hapd->iconf->ch_switch_he_config, hapd->iconf->ch_switch_vht_config); } @@ -3733,6 +3740,7 @@ hostapd_switch_channel_fallback(struct h iface->conf->ieee80211n = freq_params->ht_enabled; iface->conf->ieee80211ac = freq_params->vht_enabled; iface->conf->ieee80211ax = freq_params->he_enabled; + iface->conf->ieee80211be = freq_params->eht_enabled; hostapd_set_oper_centr_freq_seg0_idx(iface->conf, seg0_idx); hostapd_set_oper_centr_freq_seg1_idx(iface->conf, seg1_idx); hostapd_set_oper_chwidth(iface->conf, bw);