HE: Pass in HE information into hostapd_set_freq_params()

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin 2019-05-20 09:55:09 +02:00 committed by Jouni Malinen
parent ad9a1bfe78
commit 88005ee98d
8 changed files with 37 additions and 16 deletions

View file

@ -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 hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
int freq, int channel, int ht_enabled, int vht_enabled, int freq, int channel, int ht_enabled, int vht_enabled,
int he_enabled,
int sec_channel_offset, int oper_chwidth, int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1) int center_segment0, int center_segment1)
{ {
struct hostapd_freq_params data; struct hostapd_freq_params data;
if (hostapd_set_freq_params(&data, mode, freq, channel, ht_enabled, 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, oper_chwidth,
center_segment0, center_segment1, center_segment0, center_segment1,
hapd->iface->current_mode ? 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; return -1;
if (hapd->driver == NULL) 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, int hostapd_start_dfs_cac(struct hostapd_iface *iface,
enum hostapd_hw_mode mode, int freq, enum hostapd_hw_mode mode, int freq,
int channel, int ht_enabled, int vht_enabled, int channel, int ht_enabled, int vht_enabled,
int he_enabled,
int sec_channel_offset, int oper_chwidth, int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1) 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, 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, oper_chwidth, center_segment0,
center_segment1, 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"); wpa_printf(MSG_ERROR, "Can't set freq params");
return -1; return -1;
} }

View file

@ -63,7 +63,7 @@ int hostapd_get_seqnum(const char *ifname, struct hostapd_data *hapd,
int hostapd_flush(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 hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
int freq, int channel, int ht_enabled, int vht_enabled, 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 center_segment0, int center_segment1);
int hostapd_set_rts(struct hostapd_data *hapd, int rts); int hostapd_set_rts(struct hostapd_data *hapd, int rts);
int hostapd_set_frag(struct hostapd_data *hapd, int frag); 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, int hostapd_start_dfs_cac(struct hostapd_iface *iface,
enum hostapd_hw_mode mode, int freq, enum hostapd_hw_mode mode, int freq,
int channel, int ht_enabled, int vht_enabled, int channel, int ht_enabled, int vht_enabled,
int he_enabled,
int sec_channel_offset, int oper_chwidth, int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1); int center_segment0, int center_segment1);
int hostapd_drv_do_acs(struct hostapd_data *hapd); int hostapd_drv_do_acs(struct hostapd_data *hapd);

View file

@ -1424,12 +1424,13 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
if (iface->current_mode && if (iface->current_mode &&
hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq, hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq,
iconf->channel, iconf->ieee80211n, iconf->channel, iconf->ieee80211n,
iconf->ieee80211ac, iconf->ieee80211ac, iconf->ieee80211ax,
iconf->secondary_channel, iconf->secondary_channel,
hostapd_get_oper_chwidth(iconf), hostapd_get_oper_chwidth(iconf),
hostapd_get_oper_centr_freq_seg0_idx(iconf), hostapd_get_oper_centr_freq_seg0_idx(iconf),
hostapd_get_oper_centr_freq_seg1_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; params.freq = &freq;
res = hostapd_drv_set_ap(hapd, &params); res = hostapd_drv_set_ap(hapd, &params);

View file

@ -744,6 +744,7 @@ int hostapd_handle_dfs(struct hostapd_iface *iface)
res = hostapd_start_dfs_cac( res = hostapd_start_dfs_cac(
iface, iface->conf->hw_mode, iface->freq, iface->conf->channel, iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
iface->conf->ieee80211n, iface->conf->ieee80211ac, iface->conf->ieee80211n, iface->conf->ieee80211ac,
iface->conf->ieee80211ax,
iface->conf->secondary_channel, iface->conf->secondary_channel,
hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_chwidth(iface->conf),
hostapd_get_oper_centr_freq_seg0_idx(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, channel->chan,
iface->conf->ieee80211n, iface->conf->ieee80211n,
iface->conf->ieee80211ac, iface->conf->ieee80211ac,
iface->conf->ieee80211ax,
secondary_channel, secondary_channel,
hostapd_get_oper_chwidth(iface->conf), hostapd_get_oper_chwidth(iface->conf),
oper_centr_freq_seg0_idx, oper_centr_freq_seg0_idx,
oper_centr_freq_seg1_idx, oper_centr_freq_seg1_idx,
iface->current_mode->vht_capab); iface->current_mode->vht_capab,
&iface->current_mode->he_capab);
if (err) { if (err) {
wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params"); wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");

View file

@ -1868,6 +1868,7 @@ static int hostapd_setup_interface_complete_sync(struct hostapd_iface *iface,
hapd->iconf->channel, hapd->iconf->channel,
hapd->iconf->ieee80211n, hapd->iconf->ieee80211n,
hapd->iconf->ieee80211ac, hapd->iconf->ieee80211ac,
hapd->iconf->ieee80211ax,
hapd->iconf->secondary_channel, hapd->iconf->secondary_channel,
hostapd_get_oper_chwidth(hapd->iconf), hostapd_get_oper_chwidth(hapd->iconf),
hostapd_get_oper_centr_freq_seg0_idx( hostapd_get_oper_centr_freq_seg0_idx(
@ -3206,6 +3207,7 @@ static int hostapd_change_config_freq(struct hostapd_data *hapd,
{ {
int channel; int channel;
u8 seg0, seg1; u8 seg0, seg1;
struct hostapd_hw_modes *mode;
if (!params->channel) { if (!params->channel) {
/* check if the new channel is supported by hw */ /* 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) if (!channel)
return -1; return -1;
mode = hapd->iface->current_mode;
/* if a pointer to old_params is provided we save previous state */ /* if a pointer to old_params is provided we save previous state */
if (old_params && if (old_params &&
hostapd_set_freq_params(old_params, conf->hw_mode, hostapd_set_freq_params(old_params, conf->hw_mode,
hostapd_hw_get_freq(hapd, conf->channel), hostapd_hw_get_freq(hapd, conf->channel),
conf->channel, conf->ieee80211n, conf->channel, conf->ieee80211n,
conf->ieee80211ac, conf->ieee80211ac, conf->ieee80211ax,
conf->secondary_channel, conf->secondary_channel,
hostapd_get_oper_chwidth(conf), hostapd_get_oper_chwidth(conf),
hostapd_get_oper_centr_freq_seg0_idx(conf), hostapd_get_oper_centr_freq_seg0_idx(conf),
hostapd_get_oper_centr_freq_seg1_idx(conf), hostapd_get_oper_centr_freq_seg1_idx(conf),
conf->vht_capab)) conf->vht_capab,
mode ? &mode->he_capab : NULL))
return -1; return -1;
switch (params->bandwidth) { switch (params->bandwidth) {

View file

@ -361,16 +361,21 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode,
int hostapd_set_freq_params(struct hostapd_freq_params *data, int hostapd_set_freq_params(struct hostapd_freq_params *data,
enum hostapd_hw_mode mode, enum hostapd_hw_mode mode,
int freq, int channel, int ht_enabled, 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 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)); os_memset(data, 0, sizeof(*data));
data->mode = mode; data->mode = mode;
data->freq = freq; data->freq = freq;
data->channel = channel; data->channel = channel;
data->ht_enabled = ht_enabled; data->ht_enabled = ht_enabled;
data->vht_enabled = vht_enabled; data->vht_enabled = vht_enabled;
data->he_enabled = he_enabled;
data->sec_channel_offset = sec_channel_offset; data->sec_channel_offset = sec_channel_offset;
data->center_freq1 = freq + sec_channel_offset * 10; data->center_freq1 = freq + sec_channel_offset * 10;
data->center_freq2 = 0; data->center_freq2 = 0;

View file

@ -32,9 +32,11 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode,
int hostapd_set_freq_params(struct hostapd_freq_params *data, int hostapd_set_freq_params(struct hostapd_freq_params *data,
enum hostapd_hw_mode mode, enum hostapd_hw_mode mode,
int freq, int channel, int ht_enabled, 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 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, void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps,
int disabled); int disabled);
int ieee80211ac_cap_check(u32 hw, u32 conf); int ieee80211ac_cap_check(u32 hw, u32 conf);

View file

@ -2408,9 +2408,9 @@ skip_ht40:
if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq, if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,
freq->channel, freq->ht_enabled, freq->channel, freq->ht_enabled,
vht_freq.vht_enabled, vht_freq.vht_enabled, 0,
freq->sec_channel_offset, freq->sec_channel_offset,
chwidth, seg0, seg1, vht_caps) != 0) chwidth, seg0, seg1, vht_caps, NULL) != 0)
return; return;
*freq = vht_freq; *freq = vht_freq;