Message ID | 20220324141920.317515-5-nico.escande@gmail.com |
---|---|
State | RFC |
Headers | show |
Series | ACS: better channel selection for 40/80/160 MHz | expand |
On Thu, Mar 24, 2022 at 03:19:20PM +0100, Nicolas Escande wrote: > When considering a channel for a bandwidth of 40/80/160MHZ on 5/6GHz, > allow selecting one of the other channels in the segment instead of the > first one. This is done only if it's interference_factor is lower than > the first one. Is this the correct thing to do on the 6 GHz band for all cases? In particular, is it really correct to pick something else than a preferred scanning channel unless the AP is capable of advertising the presence of that non-PSC 6 GHz channel on the 2.4/5 GHz bands?
On Sun Apr 24, 2022 at 3:37 PM CEST, Jouni Malinen wrote: > Is this the correct thing to do on the 6 GHz band for all cases? In > particular, is it really correct to pick something else than a preferred > scanning channel unless the AP is capable of advertising the presence of > that non-PSC 6 GHz channel on the 2.4/5 GHz bands? Yes I am not too familiar with the 6GHz requirements but it seems that if the AP is not co-located with a 2.4/5G AP we should only use a PSC as primary. I'll try to add that feature.
On Tue Apr 26, 2022 at 10:32 AM CEST, Nicolas Escande wrote: > On Sun Apr 24, 2022 at 3:37 PM CEST, Jouni Malinen wrote: > > Is this the correct thing to do on the 6 GHz band for all cases? In > > particular, is it really correct to pick something else than a preferred > > scanning channel unless the AP is capable of advertising the presence of > > that non-PSC 6 GHz channel on the 2.4/5 GHz bands? > > Yes I am not too familiar with the 6GHz requirements but it seems that > if the AP is not co-located with a 2.4/5G AP we should only use a PSC as > primary. I'll try to add that feature. Looking at the existing code, we do not take PSC channels into consideration right now, so at least it doesn't break something working. I'll tackle this later on as it will require more changes to the code (we need to know during ACS if we have a colocated 2.4/5G) if that's allright with you guys.
diff --git a/src/ap/acs.c b/src/ap/acs.c index 9e1810901..feb29ae4a 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -747,7 +747,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, struct hostapd_channel_data **ideal_chan, long double *ideal_factor) { - struct hostapd_channel_data *chan, *adj_chan = NULL; + struct hostapd_channel_data *chan, *adj_chan = NULL, *best; long double factor; int i, j; unsigned int k; @@ -756,7 +756,7 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, double total_weight; struct acs_bias *bias, tmp_bias; - chan = &mode->channels[i]; + best = chan = &mode->channels[i]; /* Since in the current ACS implementation the first channel is * always a primary channel, skip channels not available as @@ -836,10 +836,16 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, break; } - if (acs_usable_chan(adj_chan)) { - factor += adj_chan->interference_factor; - total_weight += 1; - } + if (!acs_usable_chan(adj_chan)) + break; + + factor += adj_chan->interference_factor; + total_weight += 1; + + /* find the best channel in this segment */ + if (adj_chan->interference_factor < + best->interference_factor) + best = adj_chan; } if (j != n_chans) { @@ -848,6 +854,19 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface, continue; } + /* If the AP is in the 5/6 GHz, lets prefer a less crowded + * primary channel if one was found in the segment */ + if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211A && + chan != best) { + wpa_printf(MSG_DEBUG, + "ACS: promoting channel %d over %d" + " (less interference %Lg/%Lg)", + best->chan, chan->chan, + chan->interference_factor, + best->interference_factor); + chan = best; + } + /* 2.4 GHz has overlapping 20 MHz channels. Include adjacent * channel interference factor. */ if (is_24ghz_mode(mode->mode)) {
When considering a channel for a bandwidth of 40/80/160MHZ on 5/6GHz, allow selecting one of the other channels in the segment instead of the first one. This is done only if it's interference_factor is lower than the first one. Signed-off-by: Nicolas Escande <nico.escande@gmail.com> --- src/ap/acs.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)