From 6f014c0d0145a2d0bee57acd0f378591d28a7e4a Mon Sep 17 00:00:00 2001 From: Nicolas Escande Date: Mon, 13 Nov 2023 09:55:55 +0100 Subject: [PATCH] ACS: Add 320 MHz support for EHT Enable support for ACS in the IEEE 802.11be/320 MHz case. To do so we just: - add channel definitions for the 320 MHz blocks of the 6 GHz band - handle CONF_OPER_CHWIDTH_320MHZ in the different cases - restrict 320 MHz to ieee80211be=1 only Signed-off-by: Nicolas Escande --- src/ap/acs.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/ap/acs.c b/src/ap/acs.c index e3cfe1df8..0ac05b52a 100644 --- a/src/ap/acs.c +++ b/src/ap/acs.c @@ -245,6 +245,7 @@ enum bw_type { ACS_BW40, ACS_BW80, ACS_BW160, + ACS_BW320, }; struct bw_item { @@ -286,10 +287,16 @@ static const struct bw_item bw_160[] = { { 6435, 6575, 111 }, { 6595, 6735, 143 }, { 6755, 6895, 175 }, { 6915, 7055, 207 }, { -1, -1, -1 } }; +static const struct bw_item bw_320[] = { + { 5955, 6255, 31 }, { 6115, 6415, 63 }, { 6275, 6575, 95 }, + { 6435, 6735, 127 }, { 6595, 6895, 159}, { 6755, 7055, 191 }, + { -1, -1, -1 } +}; static const struct bw_item *bw_desc[] = { [ACS_BW40] = bw_40, [ACS_BW80] = bw_80, [ACS_BW160] = bw_160, + [ACS_BW320] = bw_320, }; @@ -859,6 +866,18 @@ 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_bw_chan(chan, ACS_BW320)) { + wpa_printf(MSG_DEBUG, + "ACS: Channel %d: not allowed as primary channel for 320 MHz bandwidth", + chan->chan); + continue; + } + } + factor = 0; if (acs_usable_chan(chan)) factor = chan->interference_factor; @@ -1034,7 +1053,8 @@ acs_find_ideal_chan(struct hostapd_iface *iface) iface->conf->secondary_channel) n_chans = 2; - if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax || + iface->conf->ieee80211be) { switch (hostapd_get_oper_chwidth(iface->conf)) { case CONF_OPER_CHWIDTH_80MHZ: n_chans = 4; @@ -1042,6 +1062,9 @@ acs_find_ideal_chan(struct hostapd_iface *iface) case CONF_OPER_CHWIDTH_160MHZ: n_chans = 8; break; + case CONF_OPER_CHWIDTH_320MHZ: + n_chans = 16; + break; default: break; } @@ -1125,11 +1148,14 @@ static void acs_adjust_center_freq(struct hostapd_iface *iface) case CONF_OPER_CHWIDTH_160MHZ: center = acs_get_bw_center_chan(iface->freq, ACS_BW160); break; + case CONF_OPER_CHWIDTH_320MHZ: + center = acs_get_bw_center_chan(iface->freq, ACS_BW320); + break; default: /* TODO: How can this be calculated? Adjust * acs_find_ideal_chan() */ wpa_printf(MSG_INFO, - "ACS: Only VHT20/40/80/160 is supported now"); + "ACS: Only VHT20/40/80/160/320 is supported now"); return; } @@ -1192,7 +1218,8 @@ static void acs_study(struct hostapd_iface *iface) iface->conf->punct_bitmap = ideal_chan->punct_bitmap; #endif /* CONFIG_IEEE80211BE */ - if (iface->conf->ieee80211ac || iface->conf->ieee80211ax) { + if (iface->conf->ieee80211ac || iface->conf->ieee80211ax || + iface->conf->ieee80211be) { acs_adjust_secondary(iface); acs_adjust_center_freq(iface); }