[PATCH v12 1/4] hostapd: Support 80/160/320 MHz widths in hostapd_is_usable_chans
Jouni Malinen
j at w1.fi
Tue May 19 09:06:48 PDT 2026
On Wed, Apr 08, 2026 at 01:56:37PM +0800, Allen Ye wrote:
> Update hostapd_is_usable_chans utility routine logic to take into
> account 80MHz, 160MHz and 320MHz channel widths.
> This is a preliminary patch to introduce AFC support.
> diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
> @@ -1105,11 +1106,6 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
> - err = hostapd_is_usable_chan(iface, pri_chan->freq, 1);
> - if (err <= 0) {
> - wpa_printf(MSG_ERROR, "Primary frequency not allowed");
> - return err;
> - }
Why does this remove this call to hostapd_is_usable_chan() with
primary=1 completely? That feels wrong and at minimum, needs to be
clearly justified in the commit message. All the new checks use
primary=0 in the calls so it looks like this patch would completely
eliminate the check with chan_pri_allowed().
> @@ -1117,38 +1113,111 @@ static int hostapd_is_usable_chans(struct hostapd_iface *iface)
> - err = hostapd_is_usable_chan(iface, iface->freq +
> - iface->conf->secondary_channel * 20, 0);
> - if (err > 0) {
> if (iface->conf->secondary_channel == 1 &&
> - (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P))
> + (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M)) {
> + iface->conf->secondary_channel = -1;
> return 1;
> + }
> +
> if (iface->conf->secondary_channel == -1 &&
> - (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40M))
> + (pri_chan->allowed_bw & HOSTAPD_CHAN_WIDTH_40P)) {
> + iface->conf->secondary_channel = 1;
> return 1;
> - }
Why do these swap the HOSTAPD_CHAN_WIDTH_40P and HOSTAPD_CHAN_WIDTH_40M
checks?
It is unfortunately difficult to follow the changes proposed into this
function and this feels far from being obviously correct. Would it be
possible to split this into smaller changes and describe the needed
change in each individual commit message in a manner that would make it
much easier to understand what is being changed here and why?
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list