From 88005ee98dd7f3ec0ab58a05b480d45bd133da2b Mon Sep 17 00:00:00 2001 From: John Crispin Date: Mon, 20 May 2019 09:55:09 +0200 Subject: [PATCH] HE: Pass in HE information into hostapd_set_freq_params() Signed-off-by: Shashidhar Lakkavalli Signed-off-by: John Crispin --- src/ap/ap_drv_ops.c | 12 ++++++++---- src/ap/ap_drv_ops.h | 3 ++- src/ap/beacon.c | 5 +++-- src/ap/dfs.c | 5 ++++- src/ap/hostapd.c | 9 +++++++-- src/common/hw_features_common.c | 9 +++++++-- src/common/hw_features_common.h | 6 ++++-- wpa_supplicant/wpa_supplicant.c | 4 ++-- 8 files changed, 37 insertions(+), 16 deletions(-) diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c index 8bdacf6ff..9249762ca 100644 --- a/src/ap/ap_drv_ops.c +++ b/src/ap/ap_drv_ops.c @@ -541,17 +541,19 @@ 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 ht_enabled, int vht_enabled, + int he_enabled, int sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1) { struct hostapd_freq_params data; if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled, - vht_enabled, sec_channel_offset, + vht_enabled, he_enabled, sec_channel_offset, oper_chwidth, center_segment0, center_segment1, hapd->iface->current_mode ? - hapd->iface->current_mode->vht_capab : 0)) + hapd->iface->current_mode->vht_capab : 0, + &hapd->iface->current_mode->he_capab)) return -1; if (hapd->driver == NULL) @@ -789,6 +791,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 sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1) { @@ -806,10 +809,11 @@ int hostapd_start_dfs_cac(struct hostapd_iface *iface, } if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled, - vht_enabled, sec_channel_offset, + vht_enabled, he_enabled, sec_channel_offset, oper_chwidth, center_segment0, center_segment1, - iface->current_mode->vht_capab)) { + iface->current_mode->vht_capab, + &iface->current_mode->he_capab)) { 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 4357ceed3..2a914dc65 100644 --- a/src/ap/ap_drv_ops.h +++ b/src/ap/ap_drv_ops.h @@ -63,7 +63,7 @@ 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 ht_enabled, int vht_enabled, - int sec_channel_offset, int oper_chwidth, + int he_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); @@ -126,6 +126,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 sec_channel_offset, int oper_chwidth, int center_segment0, int center_segment1); int hostapd_drv_do_acs(struct hostapd_data *hapd); diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 5cc304450..1838c1c84 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1424,12 +1424,13 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) if (iface->current_mode && hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq, iconf->channel, iconf->ieee80211n, - iconf->ieee80211ac, + iconf->ieee80211ac, iconf->ieee80211ax, iconf->secondary_channel, hostapd_get_oper_chwidth(iconf), hostapd_get_oper_centr_freq_seg0_idx(iconf), hostapd_get_oper_centr_freq_seg1_idx(iconf), - iface->current_mode->vht_capab) == 0) + iface->current_mode->vht_capab, + &iface->current_mode->he_capab) == 0) params.freq = &freq; res = hostapd_drv_set_ap(hapd, ¶ms); diff --git a/src/ap/dfs.c b/src/ap/dfs.c index e4dc0dd3d..417235b02 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -744,6 +744,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->secondary_channel, hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_centr_freq_seg0_idx(iface->conf), @@ -960,11 +961,13 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) channel->chan, iface->conf->ieee80211n, iface->conf->ieee80211ac, + iface->conf->ieee80211ax, secondary_channel, hostapd_get_oper_chwidth(iface->conf), oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx, - iface->current_mode->vht_capab); + iface->current_mode->vht_capab, + &iface->current_mode->he_capab); if (err) { wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 29860a96b..a333ba137 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1868,6 +1868,7 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface, hapd->iconf->channel, hapd->iconf->ieee80211n, hapd->iconf->ieee80211ac, + hapd->iconf->ieee80211ax, hapd->iconf->secondary_channel, hostapd_get_oper_chwidth(hapd->iconf), hostapd_get_oper_centr_freq_seg0_idx( @@ -3206,6 +3207,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, { int channel; u8 seg0, seg1; + struct hostapd_hw_modes *mode; if (!params->channel) { /* check if the new channel is supported by hw */ @@ -3216,17 +3218,20 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd, if (!channel) return -1; + mode = hapd->iface->current_mode; + /* if a pointer to old_params is provided we save previous state */ if (old_params && hostapd_set_freq_params(old_params, conf->hw_mode, hostapd_hw_get_freq(hapd, conf->channel), conf->channel, conf->ieee80211n, - conf->ieee80211ac, + conf->ieee80211ac, conf->ieee80211ax, 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)) + conf->vht_capab, + mode ? &mode->he_capab : NULL)) return -1; switch (params->bandwidth) { diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index aa430f2e2..3fdbf893d 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -361,16 +361,21 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode, int hostapd_set_freq_params(struct hostapd_freq_params *data, enum hostapd_hw_mode mode, int freq, int channel, int ht_enabled, - int vht_enabled, int sec_channel_offset, + int vht_enabled, int he_enabled, + int sec_channel_offset, int oper_chwidth, int center_segment0, - int center_segment1, u32 vht_caps) + int center_segment1, u32 vht_caps, + struct he_capabilities *he_cap) { + if (!he_cap) + he_enabled = 0; os_memset(data, 0, sizeof(*data)); data->mode = mode; data->freq = freq; data->channel = channel; data->ht_enabled = ht_enabled; data->vht_enabled = vht_enabled; + data->he_enabled = he_enabled; data->sec_channel_offset = sec_channel_offset; data->center_freq1 = freq + sec_channel_offset * 10; data->center_freq2 = 0; diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index d3efe77f2..2d2a53994 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -32,9 +32,11 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode, int hostapd_set_freq_params(struct hostapd_freq_params *data, enum hostapd_hw_mode mode, int freq, int channel, int ht_enabled, - int vht_enabled, int sec_channel_offset, + int vht_enabled, int he_enabled, + int sec_channel_offset, int oper_chwidth, int center_segment0, - int center_segment1, u32 vht_caps); + int center_segment1, u32 vht_caps, + struct he_capabilities *he_caps); void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps, int disabled); int ieee80211ac_cap_check(u32 hw, u32 conf); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2b92fcb92..f82d18fe2 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2408,9 +2408,9 @@ skip_ht40: if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq, freq->channel, freq->ht_enabled, - vht_freq.vht_enabled, + vht_freq.vht_enabled, 0, freq->sec_channel_offset, - chwidth, seg0, seg1, vht_caps) != 0) + chwidth, seg0, seg1, vht_caps, NULL) != 0) return; *freq = vht_freq; -- 2.39.2