On Mon, Oct 26, 2020 at 12:31:59PM +0000, Марков Михаил Александрович wrote: > Make ACS algorithm select the best channel within a bandwidth as primary > channel instead of just picking the first one. > > The reason i had to add acs_adjust_sec_chan is because even if i use VHT80 > ieee80211n_allowed_ht40_channel_pair -> allowed_ht40_channel_pair > check fails and i get fallback to 20 MHz. Can you please share hostapd debug logs for a case with and without this patch highlighting why this is needed? > diff --git a/src/ap/acs.c b/src/ap/acs.c > +static void acs_adjust_sec_chan(struct hostapd_config *conf) > +{ > + const int ht40_plus_channels[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 140, > + 149, 157, 165, 184, 192 }; > + int i, sec_chan = -1; > + > + for (i = 0; i < ARRAY_SIZE(ht40_plus_channels); i++) { > + if (conf->channel == ht40_plus_channels[i]) { > + sec_chan = 1; > + break; > + } > + } > + > + conf->secondary_channel = sec_chan; > } So this function would force conf->secondary_channel to be != 0. > @@ -961,8 +985,10 @@ static void acs_study(struct hostapd_iface *iface) > - if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) > + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { > acs_adjust_center_freq(iface); > + acs_adjust_sec_chan(iface->conf); > + } And it would be called unconditionally for VHT and HE.. Is that really correct? What if the configuration is requesting 20 MHz channel bandwidth to be used? -- Jouni Malinen PGP id EFC895FA _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap