From dae7940a487fb68ea4af391df770d50793422a82 Mon Sep 17 00:00:00 2001 From: Muna Sinada Date: Tue, 19 Apr 2022 11:04:16 -0700 Subject: [PATCH] EHT: Additions to hostapd_set_freq_params() Modify hostapd_set_freq_params() to include EHT parameters and update the calling functions to match. Signed-off-by: Muna Sinada Signed-off-by: Aloka Dixit Signed-off-by: Pradeep Kumar Chitrapu --- src/ap/ap_drv_ops.c | 19 ++++++++++++------- src/ap/ap_drv_ops.h | 6 +++--- src/ap/beacon.c | 4 +++- src/ap/dfs.c | 7 +++++-- src/ap/hostapd.c | 5 ++++- src/common/hw_features_common.c | 28 ++++++++++++++++++++++------ src/common/hw_features_common.h | 5 +++-- src/drivers/driver.h | 5 +++++ wpa_supplicant/mesh.c | 3 ++- wpa_supplicant/wpa_supplicant.c | 4 +++- 10 files changed, 62 insertions(+), 24 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 027b459a0..817fbe603 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -551,7 +551,7 @@ int hostapd_flush(struct hostapd_data *hapd) int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int freq, int channel, int edmg, u8 edmg_channel, int ht_enabled, int vht_enabled, - int he_enabled, + int he_enabled, bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1) { @@ -560,12 +560,15 @@ int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, if (hostapd_set_freq_params(&data, mode, freq, channel, edmg, edmg_channel, ht_enabled, - vht_enabled, he_enabled, sec_channel_offset, - oper_chwidth, + vht_enabled, he_enabled, eht_enabled, + sec_channel_offset, oper_chwidth, center_segment0, center_segment1, cmode ? cmode->vht_capab : 0, cmode ? - &cmode->he_capab[IEEE80211_MODE_AP] : NULL)) + &cmode->he_capab[IEEE80211_MODE_AP] : NULL, + cmode ? + &cmode->eht_capab[IEEE80211_MODE_AP] : + NULL)) return -1; if (hapd->driver == NULL) @@ -814,7 +817,7 @@ int hostapd_drv_send_action_addr3_ap(struct hostapd_data *hapd, int hostapd_start_dfs_cac(struct hostapd_iface *iface, enum hostapd_hw_mode mode, int freq, int channel, int ht_enabled, int vht_enabled, - int he_enabled, + int he_enabled, bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, bool radar_background) @@ -835,11 +838,13 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, if (hostapd_set_freq_params(&data, mode, freq, channel, 0, 0, ht_enabled, - vht_enabled, he_enabled, sec_channel_offset, + vht_enabled, he_enabled, eht_enabled, + sec_channel_offset, oper_chwidth, center_segment0, center_segment1, cmode->vht_capab, - &cmode->he_capab[IEEE80211_MODE_AP])) { + &cmode->he_capab[IEEE80211_MODE_AP], + &cmode->eht_capab[IEEE80211_MODE_AP])) { wpa_printf(MSG_ERROR, "Can't set freq params"); return -1; } diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h index e5669a0c9..b4fb766ee 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -66,8 +66,8 @@ int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd, int hostapd_flush(struct hostapd_data *hapd); int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode, int freq, int channel, int edmg, u8 edmg_channel, - int ht_enabled, int vht_enabled, - int he_enabled, int sec_channel_offset, int oper_chwidth, + int ht_enabled, int vht_enabled, int he_enabled, + bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1); int hostapd_set_rts(struct hostapd_data *hapd, int rts); int hostapd_set_frag(struct hostapd_data *hapd, int frag); @@ -130,7 +130,7 @@ int hostapd_add_tspec(struct hostapd_data *hapd, const u8 *addr, int hostapd_start_dfs_cac(struct hostapd_iface *iface, enum hostapd_hw_mode mode, int freq, int channel, int ht_enabled, int vht_enabled, - int he_enabled, + int he_enabled, bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, bool radar_background); diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 7212f501f..eaa403326 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1950,12 +1950,14 @@ static int __ieee802_11_set_beacon(struct hostapd_data *hapd) iconf->channel, iconf->enable_edmg, iconf->edmg_channel, iconf->ieee80211n, iconf->ieee80211ac, iconf->ieee80211ax, + iconf->ieee80211be, iconf->secondary_channel, hostapd_get_oper_chwidth(iconf), hostapd_get_oper_centr_freq_seg0_idx(iconf), hostapd_get_oper_centr_freq_seg1_idx(iconf), cmode->vht_capab, - &cmode->he_capab[IEEE80211_MODE_AP]) == 0) + &cmode->he_capab[IEEE80211_MODE_AP], + &cmode->eht_capab[IEEE80211_MODE_AP]) == 0) params.freq = &freq; res = hostapd_drv_set_ap(hapd, ¶ms); diff --git a/src/ap/dfs.c b/src/ap/dfs.c index ed9978b6e..e46dd7ede 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -888,7 +888,7 @@ int hostapd_handle_dfs(struct hostapd_iface *iface) res = hostapd_start_dfs_cac( iface, iface->conf->hw_mode, iface->freq, iface->conf->channel, iface->conf->ieee80211n, iface->conf->ieee80211ac, - iface->conf->ieee80211ax, + iface->conf->ieee80211ax, iface->conf->ieee80211be, iface->conf->secondary_channel, hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_centr_freq_seg0_idx(iface->conf), @@ -981,12 +981,14 @@ static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface, iface->conf->ieee80211n, iface->conf->ieee80211ac, iface->conf->ieee80211ax, + iface->conf->ieee80211be, secondary_channel, new_vht_oper_chwidth, oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx, cmode->vht_capab, - &cmode->he_capab[ieee80211_mode]); + &cmode->he_capab[ieee80211_mode], + &cmode->eht_capab[ieee80211_mode]); if (err) { wpa_printf(MSG_ERROR, @@ -1059,6 +1061,7 @@ static void hostpad_dfs_update_background_chain(struct hostapd_iface *iface) iface->conf->ieee80211n, iface->conf->ieee80211ac, iface->conf->ieee80211ax, + iface->conf->ieee80211be, sec, hostapd_get_oper_chwidth(iface->conf), oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx, true)) { diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 32d222561..6b46e798e 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2076,6 +2076,7 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface, hapd->iconf->ieee80211n, hapd->iconf->ieee80211ac, hapd->iconf->ieee80211ax, + hapd->iconf->ieee80211be, hapd->iconf->secondary_channel, hostapd_get_oper_chwidth(hapd->iconf), hostapd_get_oper_centr_freq_seg0_idx( @@ -3461,12 +3462,14 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, conf->channel, conf->enable_edmg, conf->edmg_channel, conf->ieee80211n, conf->ieee80211ac, conf->ieee80211ax, - conf->secondary_channel, + conf->ieee80211be, conf->secondary_channel, hostapd_get_oper_chwidth(conf), hostapd_get_oper_centr_freq_seg0_idx(conf), hostapd_get_oper_centr_freq_seg1_idx(conf), conf->vht_capab, mode ? &mode->he_capab[IEEE80211_MODE_AP] : + NULL, + mode ? &mode->eht_capab[IEEE80211_MODE_AP] : NULL)) return -1; diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index f168d4e92..732124f4d 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -383,10 +383,11 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, int freq, int channel, int enable_edmg, u8 edmg_channel, int ht_enabled, int vht_enabled, int he_enabled, - int sec_channel_offset, + bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, u32 vht_caps, - struct he_capabilities *he_cap) + struct he_capabilities *he_cap, + struct eht_capabilities *eht_cap) { if (!he_cap || !he_cap->he_supported) he_enabled = 0; @@ -397,6 +398,7 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, data->ht_enabled = ht_enabled; data->vht_enabled = vht_enabled; data->he_enabled = he_enabled; + data->eht_enabled = eht_enabled; data->sec_channel_offset = sec_channel_offset; data->center_freq1 = freq + sec_channel_offset * 10; data->center_freq2 = 0; @@ -415,9 +417,9 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, &data->edmg); if (is_6ghz_freq(freq)) { - if (!data->he_enabled) { + if (!data->he_enabled && !data->eht_enabled) { wpa_printf(MSG_ERROR, - "Can't set 6 GHz mode - HE isn't enabled"); + "Can't set 6 GHz mode - HE or EHT aren't enabled"); return -1; } @@ -480,7 +482,20 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, return 0; } - if (data->he_enabled) switch (oper_chwidth) { +#if 0 /* FIX: Figure out how to handle CHANWIDTH_320MHZ */ + if (data->eht_enabled) switch (oper_chwidth) { + case CHANWIDTH_320MHZ: + if (!(eht_cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] & + EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) { + wpa_printf(MSG_ERROR, + "320 MHz channel width is not supported in 5 or 6 GHz"); + return -1; + } + break; + } +#endif + + if (data->he_enabled || data->eht_enabled) switch (oper_chwidth) { case CHANWIDTH_USE_HT: if (sec_channel_offset == 0) break; @@ -543,7 +558,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, break; } - if (data->he_enabled || data->vht_enabled) switch (oper_chwidth) { + if (data->eht_enabled || data->he_enabled || + data->vht_enabled) switch (oper_chwidth) { case CHANWIDTH_USE_HT: if (center_segment1 || (center_segment0 != 0 && diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index 0e92aa0f2..d87a2caff 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -40,10 +40,11 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, int freq, int channel, int edmg, u8 edmg_channel, int ht_enabled, int vht_enabled, int he_enabled, - int sec_channel_offset, + bool eht_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1, u32 vht_caps, - struct he_capabilities *he_caps); + struct he_capabilities *he_caps, + struct eht_capabilities *eht_cap); void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps, int disabled); int ieee80211ac_cap_check(u32 hw, u32 conf); diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d8220e956..7e83f0246 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -803,6 +803,11 @@ struct hostapd_freq_params { * radar_background - Whether radar/CAC background is requested */ bool radar_background; + + /** + * eht_enabled - Whether EHT is enabled + */ + bool eht_enabled; }; /** diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index d6b8a1ad9..b67396d5a 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -225,12 +225,13 @@ static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) ifmsh->conf->ieee80211n, ifmsh->conf->ieee80211ac, ifmsh->conf->ieee80211ax, + false, ifmsh->conf->secondary_channel, hostapd_get_oper_chwidth(ifmsh->conf), hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf), ifmsh->conf->vht_capab, - he_capab)) { + he_capab, NULL)) { wpa_printf(MSG_ERROR, "Error updating mesh frequency params"); wpa_supplicant_mesh_deinit(wpa_s, true); return -1; diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 64cad0af2..4237174ab 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2759,9 +2759,11 @@ skip_to_6ghz: freq->channel, ssid->enable_edmg, ssid->edmg_channel, freq->ht_enabled, vht_freq.vht_enabled, freq->he_enabled, + false, freq->sec_channel_offset, chwidth, seg0, seg1, vht_caps, - &mode->he_capab[ieee80211_mode]) != 0) + &mode->he_capab[ieee80211_mode], + NULL) != 0) return; *freq = vht_freq; -- 2.47.2