]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
hostapd: ucode: fix CSA bandwidth for 320 MHz and 80+80 channels
authorFelix Fietkau <nbd@nbd.name>
Fri, 10 Jul 2026 10:23:19 +0000 (12:23 +0200)
committerFelix Fietkau <nbd@nbd.name>
Thu, 16 Jul 2026 09:50:21 +0000 (11:50 +0200)
switch_channel computed the CSA bandwidth as 40 << oper_chwidth, which
mismaps oper_chwidth 3 (80+80, must be 80 MHz plus center_freq2) to 320
and 9 (320 MHz) to 20480. Map the operating channel width to the actual
MHz bandwidth explicitly.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/network/services/hostapd/src/src/ap/ucode.c

index e1a365b7a62bd5baeb5bb9454c1858247f9484e7..4db5eddf7c5212b7e663cc6bb707a67fefa153b3 100644 (file)
@@ -739,10 +739,22 @@ uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
        intval = ucv_int64_get(ucv_object_get(info, "oper_chwidth", NULL));
        if (errno)
                intval = hostapd_get_oper_chwidth(conf);
-       if (intval)
-               csa.freq_params.bandwidth = 40 << intval;
-       else
+       switch (intval) {
+       case CONF_OPER_CHWIDTH_80MHZ:
+       case CONF_OPER_CHWIDTH_80P80MHZ:
+               /* 80+80 uses an 80 MHz primary segment plus center_freq2 */
+               csa.freq_params.bandwidth = 80;
+               break;
+       case CONF_OPER_CHWIDTH_160MHZ:
+               csa.freq_params.bandwidth = 160;
+               break;
+       case CONF_OPER_CHWIDTH_320MHZ:
+               csa.freq_params.bandwidth = 320;
+               break;
+       default:
                csa.freq_params.bandwidth = csa.freq_params.sec_channel_offset ? 40 : 20;
+               break;
+       }
 
        if ((intval = ucv_int64_get(ucv_object_get(info, "frequency", NULL))) && !errno)
                csa.freq_params.freq = intval;