From 927dbfb453ed712e4eea05eba44ea67b8a734fda Mon Sep 17 00:00:00 2001 From: Hari Chandrakanthan Date: Wed, 19 Apr 2023 17:35:11 +0530 Subject: [PATCH] Fix 40 MHz channel bringup with ACS on the 6 GHz band When AP is brought up in HE40/EHT40 with ACS, the AP comes up with 20 MHz bandwidth. It is expected to come up with 40 MHz bandwidth. conf->secondary_channel does not hold the correct value and it leads to choosing 20 MHz in hostapd_set_freq_params(). conf->secondary_channel is filled using the hostapd config he_oper_centr_freq_seg0_idx. When AP is configured to use ACS, the hostapd config he_oper_centr_freq_seg0_idx is not valid as the channel is not known during bring up. So using the config he_oper_centr_freq_seg0_idx to fill the conf->secondary_channel does not work with ACS. Use op_class to determine the bandwidth and based on the bandwidth fill the conf->secondary_channel to address this ACS case. Signed-off-by: Hari Chandrakanthan --- src/ap/hostapd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/ap/hostapd.c diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c old mode 100644 new mode 100755 index a20882794..aaf8d5e3c --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1756,16 +1756,15 @@ static int configured_fixed_chan_to_freq(struct hostapd_iface *iface) static void hostapd_set_6ghz_sec_chan(struct hostapd_iface *iface) { - int bw, seg0; + int bw; if (!is_6ghz_op_class(iface->conf->op_class)) return; - seg0 = hostapd_get_oper_centr_freq_seg0_idx(iface->conf); - bw = center_idx_to_bw_6ghz(seg0); + bw = op_class_to_bandwidth(iface->conf->op_class); /* Assign the secondary channel if absent in config for * bandwidths > 20 MHz */ - if (bw > 0 && !iface->conf->secondary_channel) { + if (bw >= 40 && !iface->conf->secondary_channel) { if (((iface->conf->channel - 1) / 4) % 2) iface->conf->secondary_channel = -1; else -- 2.47.2