[PATCH v12 1/4] hostapd: Support 80/160/320 MHz widths in hostapd_is_usable_chans
Allen Ye (葉芷勳)
Allen.Ye at mediatek.com
Tue Aug 4 01:22:57 PDT 2026
On Tue, 2026-05-19 at 19:06 +0300, Jouni Malinen wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> 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().
>
>
Hi Jouni,
Thank you for pointing this out. We will restore the primary=1 check
and have fixed this in the v13 patch series.
> > @@ -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?
This swap was intended to the incorrect secondary_channel handling.
However, as you mentioned, this made the logic hard to follow.
To address this, we have reworked this logic in the v13 series and
split this change into a separate, standalone patch to make it much
clearer and easier to review.
Thanks,
Allen
>
> --
> Jouni Malinen PGP id
> EFC895FA
More information about the Hostap
mailing list