[PATCH v2] Fix ACS when using 20MHz channels in 6GHz

Nicolas Escande nico.escande at gmail.com
Tue Apr 1 13:18:13 PDT 2025


On Tue Apr 1, 2025 at 3:19 PM CEST, Matej Vrba wrote:
> When configured to use ACS with 20MHz channels, hostapd incorrectly rejects
> half of the available channels with an error messages "Channel XX: not
> allowed as primary channel for 40 MHz bandwidth." This includes all PSC
> channels.
>
> Signed-off-by: Matěj Vrba <matej.vrba at advantech.cz>
> ---
>  src/ap/acs.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/src/ap/acs.c b/src/ap/acs.c
> index 44d083684..7c6bdc003 100644
> --- a/src/ap/acs.c
> +++ b/src/ap/acs.c
> @@ -889,11 +889,10 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
>  
>         /* HT40 on 5 GHz has a limited set of primary channels as per
>          * 11n Annex J */
> -       if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
> -           ((iface->conf->ieee80211n &&
> -             iface->conf->secondary_channel) ||
> -            is_6ghz_freq(chan->freq)) &&
> -           !acs_usable_bw_chan(chan, ACS_BW40)) {
> +       if (bw == 40 &&
> +           mode->mode == HOSTAPD_MODE_IEEE80211A &&
> +           iface->conf->ieee80211n &&
> +           !acs_usable_bw_chan(chan, ACS_BW40)) {
>             wpa_printf(MSG_DEBUG,
>                    "ACS: Channel %d: not allowed as primary channel for 40 MHz bandwidth",
>                    chan->chan);
> @@ -903,18 +902,14 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
>         if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
>             (iface->conf->ieee80211ac || iface->conf->ieee80211ax ||
>              iface->conf->ieee80211be)) {
> -           if (hostapd_get_oper_chwidth(iface->conf) ==
> -               CONF_OPER_CHWIDTH_80MHZ &&
> -               !acs_usable_bw_chan(chan, ACS_BW80)) {
> +           if (bw == 80 && !acs_usable_bw_chan(chan, ACS_BW80)) {
>                 wpa_printf(MSG_DEBUG,
>                        "ACS: Channel %d: not allowed as primary channel for 80 MHz bandwidth",
>                        chan->chan);
>                 continue;
>             }
>  
> -           if (hostapd_get_oper_chwidth(iface->conf) ==
> -               CONF_OPER_CHWIDTH_160MHZ &&
> -               !acs_usable_bw_chan(chan, ACS_BW160)) {
> +           if (bw == 160 && !acs_usable_bw_chan(chan, ACS_BW160)) {
>                 wpa_printf(MSG_DEBUG,
>                        "ACS: Channel %d: not allowed as primary channel for 160 MHz bandwidth",
>                        chan->chan);
> @@ -924,10 +919,12 @@ acs_find_ideal_chan_mode(struct hostapd_iface *iface,
>  
>         if (mode->mode == HOSTAPD_MODE_IEEE80211A &&
>             iface->conf->ieee80211be) {
> -           if (hostapd_get_oper_chwidth(iface->conf) ==
> -               CONF_OPER_CHWIDTH_320MHZ &&
> -               !acs_usable_bw320_chan(iface, chan, &bw320_offset))
> +           if (bw == 320 && !acs_usable_bw320_chan(iface, chan, &bw320_offset)){
> +               wpa_printf(MSG_DEBUG,
> +                      "ACS: Channel %d: not allowed as primary channel for 320 MHz bandwidth",
> +                      chan->chan);
>                 continue;
> +           }
>         }
>  
>         factor = 0;

Hello,

I see you went with my second option, great !!!
That should be enough to solve you original problem.

I have internally a similar set of patches to enable selecting PSC only channels
on 6GHz with wider bandwidth. I'll try to upstream them at some point.

Reviewed-by: Nicolas Escande <nico.escande at gmail.com>



More information about the Hostap mailing list