hostapd: ucode: fix CSA bandwidth for 320 MHz and 80+80 channels

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>
This commit is contained in:
Felix Fietkau
2026-07-16 11:50:21 +02:00
parent 5625dadb4b
commit b92df1e8da
@@ -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;