diff mbox series

ACS: Add 320MHz support for 80211be

Message ID 20231109150408.3644508-1-nico.escande@gmail.com
State Changes Requested
Headers show
Series ACS: Add 320MHz support for 80211be | expand

Commit Message

Nicolas Escande Nov. 9, 2023, 3:04 p.m. UTC
This enables support for ACS in the 80211be/320MHZ. To do so we just:
  - add channel definitions for the 3 320MHZ blocks of the 6GHz band
  - handle CONF_OPER_CHWIDTH_320MHZ in the different cases
  - restrict 320MHZ to 80211be only

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
---
 src/ap/acs.c | 32 +++++++++++++++++++++++++++++---
 1 file changed, 29 insertions(+), 3 deletions(-)

Comments

Jouni Malinen Nov. 11, 2023, 8:55 p.m. UTC | #1
On Thu, Nov 09, 2023 at 04:04:08PM +0100, Nicolas Escande wrote:
> This enables support for ACS in the 80211be/320MHZ. To do so we just:
>   - add channel definitions for the 3 320MHZ blocks of the 6GHz band
>   - handle CONF_OPER_CHWIDTH_320MHZ in the different cases
>   - restrict 320MHZ to 80211be only

> diff --git a/src/ap/acs.c b/src/ap/acs.c
> +static const struct bw_item bw_320[] = {
> +	{ 6115, 6415, 63 }, { 6435, 6735, 127 }, { 66755, 7055, 191 },
> +	{ -1, -1, -1 }

That 66755 should have been 6755..

Is there some specific reason for including only the channel center
frequency index values 63, 127, and 191 here? IEEE P802.11be/D4.0
defines the operating class 137 with the following set of possible
channel center frequency index values: 31, 63, 95, 127, 159, 191.
Nicolas Escande Nov. 13, 2023, 8:43 a.m. UTC | #2
On Sat Nov 11, 2023 at 9:55 PM CET, Jouni Malinen wrote:
> On Thu, Nov 09, 2023 at 04:04:08PM +0100, Nicolas Escande wrote:
> > This enables support for ACS in the 80211be/320MHZ. To do so we just:
> >   - add channel definitions for the 3 320MHZ blocks of the 6GHz band
> >   - handle CONF_OPER_CHWIDTH_320MHZ in the different cases
> >   - restrict 320MHZ to 80211be only
>
> > diff --git a/src/ap/acs.c b/src/ap/acs.c
> > +static const struct bw_item bw_320[] = {
> > +	{ 6115, 6415, 63 }, { 6435, 6735, 127 }, { 66755, 7055, 191 },
> > +	{ -1, -1, -1 }
>
> That 66755 should have been 6755..

Indeed I'll fix it in v2

>
> Is there some specific reason for including only the channel center
> frequency index values 63, 127, and 191 here? IEEE P802.11be/D4.0
> defines the operating class 137 with the following set of possible
> channel center frequency index values: 31, 63, 95, 127, 159, 191.

Nope I missed it completely, I'll fix it in v2.

Thanks for the review.
diff mbox series

Patch

diff --git a/src/ap/acs.c b/src/ap/acs.c
index fdc9c0d35..770a571a6 100644
--- a/src/ap/acs.c
+++ b/src/ap/acs.c
@@ -246,6 +246,7 @@  enum bw_type {
 	ACS_BW40,
 	ACS_BW80,
 	ACS_BW160,
+	ACS_BW320,
 };
 
 struct bw_item {
@@ -287,10 +288,15 @@  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[] = {
+	{ 6115, 6415, 63 }, { 6435, 6735, 127 }, { 66755, 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,
 };
 
 
@@ -860,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;
@@ -1035,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;
@@ -1043,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;
 		}
@@ -1126,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;
 	}
 
@@ -1193,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);
 	}