From 1aef02a7dcf4206fd231097a4d0b7704b6c95111 Mon Sep 17 00:00:00 2001 From: Hari Chandrakanthan Date: Tue, 9 Aug 2022 00:17:18 +0530 Subject: [PATCH] hostapd : fix he40/eht40 bringup with acs 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 doesnot hold the correct value and it leads to choosing 20 Mhz in the api hostapd_set_freq_params. when the config acs is chosen, the hostapd config he_oper_centr_freq_seg0_idx is not filled with correct value 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 doesnot work with acs. So use op_class to determine the bandwidth and based on the bandwidth fill the conf->secondary_channel. Signed-off-by: Hari Chandrakanthan --- src/ap/hostapd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index d9c0f09..86e094a 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -1725,16 +1725,13 @@ 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; - 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); /* Assign the secondary channel if absent in config for * bandwidths > 20 MHz */ - if (bw > 20 && !iface->conf->secondary_channel) { + if (op_class_to_bandwidth(iface->conf->op_class) >= 40 && + !iface->conf->secondary_channel) { if (((iface->conf->channel - 1) / 4) % 2) iface->conf->secondary_channel = -1; else -- 2.7.4