From 2908dc91c1253ba67927294719b1bfc2141913f1 Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Thu, 11 Jun 2020 04:18:42 -0700 Subject: [PATCH] hostapd: Enable HE for channel switch commmand Add HE as an accepted option ("he") in the CHAN_SWITCH command similarly to the way VHT is addressed. Signed-off-by: Muna Sinada --- src/ap/ap_config.h | 5 +++++ src/ap/ctrl_iface_ap.c | 1 + src/ap/drv_callbacks.c | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index e69132584..fb153c40b 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1049,6 +1049,11 @@ struct hostapd_config { #define CH_SWITCH_VHT_DISABLED BIT(1) unsigned int ch_switch_vht_config; + /* HE enable/disable config from CHAN_SWITCH */ +#define CH_SWITCH_HE_ENABLED BIT(0) +#define CH_SWITCH_HE_DISABLED BIT(1) + unsigned int ch_switch_he_config; + int rssi_reject_assoc_rssi; int rssi_reject_assoc_timeout; int rssi_ignore_probe_request; diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index b3d6d62e4..28e40ba9c 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -909,6 +909,7 @@ int hostapd_parse_csa_settings(const char *pos, SET_CSA_SETTING(sec_channel_offset); 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->block_tx = !!os_strstr(pos, " blocktx"); #undef SET_CSA_SETTING diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 9af5445e2..53082f53c 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -870,9 +870,10 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO, - "driver %s channel switch: freq=%d, ht=%d, vht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d", + "driver %s channel switch: freq=%d, ht=%d, vht_ch=0x%x, he_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d", finished ? "had" : "starting", - freq, ht, hapd->iconf->ch_switch_vht_config, offset, + freq, ht, hapd->iconf->ch_switch_vht_config, + hapd->iconf->ch_switch_he_config, offset, width, channel_width_to_string(width), cf1, cf2); if (!hapd->iface->current_mode) { @@ -944,8 +945,17 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, else if (hapd->iconf->ch_switch_vht_config & CH_SWITCH_VHT_DISABLED) hapd->iconf->ieee80211ac = 0; + } else if (hapd->iconf->ch_switch_he_config) { + /* CHAN_SWITCH HE config */ + if (hapd->iconf->ch_switch_he_config & + CH_SWITCH_HE_ENABLED) + hapd->iconf->ieee80211ax = 1; + else if (hapd->iconf->ch_switch_he_config & + CH_SWITCH_HE_DISABLED) + hapd->iconf->ieee80211ax = 0; } hapd->iconf->ch_switch_vht_config = 0; + hapd->iconf->ch_switch_he_config = 0; hapd->iconf->secondary_channel = offset; hostapd_set_oper_chwidth(hapd->iconf, chwidth);