diff mbox series

[3/3] 6G: update missing channel 2 for 6GHZ

Message ID 20200622064014.25012-3-pradeepc@codeaurora.org
State Superseded
Headers show
Series [1/3] 6G: Fix enabling 40/80MHz bandwidth support in 6GHZ | expand

Commit Message

Pradeep Kumar Chitrapu June 22, 2020, 6:40 a.m. UTC
This adds 6GHz channel 2 with center frequency 5935MHz which
is the new addition in latest specification IEEE P802.11ax/D6.1.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
---
 src/common/ieee802_11_common.c | 18 +++++++++++++++---
 wpa_supplicant/op_classes.c    |  7 ++++---
 2 files changed, 19 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index 32d429fbc9fe..625b581172e8 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -1029,6 +1029,11 @@  enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq,
 		return HOSTAPD_MODE_IEEE80211A;
 	}
 
+	if (freq == 5935) {
+		*op_class = 136;
+		return HOSTAPD_MODE_IEEE80211A;
+	}
+
 	if (freq > 5950 && freq <= 7115) {
 		int bw;
 		u8 idx = (freq - 5950) / 5;
@@ -1419,6 +1424,10 @@  static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
 		if (chan < 1 || chan > 233)
 			return -1;
 		return 5950 + chan * 5;
+	case 136: /* UHB channel, 20MHz: 2 */
+		if (chan != 2)
+			return -1;
+		return 5935;
 	case 180: /* 60 GHz band, channels 1..8 */
 		if (chan < 1 || chan > 8)
 			return -1;
@@ -2190,7 +2199,7 @@  int oper_class_bw_to_int(const struct oper_class_map *map)
 int center_idx_to_bw_6ghz(u8 idx)
 {
 	/* channels: 1, 5, 9, 13... */
-	if ((idx & 0x3) == 0x1)
+	if ((idx & 0x3) == 0x1 || idx == 2)
 		return 0; /* 20 MHz */
 	/* channels 3, 11, 19... */
 	if ((idx & 0x7) == 0x3)
@@ -2208,6 +2217,9 @@  int center_idx_to_bw_6ghz(u8 idx)
 
 int is_6ghz_freq(int freq)
 {
+	if (freq == 5935)
+		return 1;
+
 	if (freq < 5950 || freq > 7115)
 		return 0;
 
@@ -2220,7 +2232,7 @@  int is_6ghz_freq(int freq)
 
 int is_6ghz_op_class(u8 op_class)
 {
-	return op_class >= 131 && op_class <= 135;
+	return op_class >= 131 && op_class <= 136;
 }
 
 
@@ -2228,7 +2240,7 @@  int is_6ghz_psc_frequency(int freq)
 {
 	int i;
 
-	if (!is_6ghz_freq(freq))
+	if (!is_6ghz_freq(freq) || freq == 5935)
 		return 0;
 	if ((((freq - 5950) / 5) & 0x3) != 0x1)
 		return 0;
diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c
index ec0b5a989c8a..b46844f82025 100644
--- a/wpa_supplicant/op_classes.c
+++ b/wpa_supplicant/op_classes.c
@@ -22,13 +22,14 @@  static enum chan_allowed allow_channel(struct hostapd_hw_modes *mode,
 				       unsigned int *flags)
 {
 	int i;
-	int is_6ghz = op_class >= 131 && op_class <= 135;
+	int is_6ghz = op_class >= 131 && op_class <= 136;
 
 	for (i = 0; i < mode->num_channels; i++) {
 		int chan_is_6ghz;
 
-		chan_is_6ghz = mode->channels[i].freq > 5950 &&
-			mode->channels[i].freq <= 7115;
+		chan_is_6ghz = mode->channels[i].freq == 5935 ||
+			(mode->channels[i].freq > 5950 &&
+			 mode->channels[i].freq <= 7115);
 		if (is_6ghz == chan_is_6ghz && mode->channels[i].chan == chan)
 			break;
 	}