On 6/19/2019 2:49 PM, Andrei Otcheretianski wrote:
Add support for new hardware mode for 6GHz band. 6GHz operation is
defined in "Draft IEEE P802.11ax/D4.1".
6GHz band adds 131-135 operating classes that define channels in
frequency range from 5940MHz to 7105MHz.
Hi Andrei,
A few remarks below.
Regards,
Arend
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
hostapd/config_file.c | 2 +
hostapd/hostapd.conf | 7 ++-
src/ap/hw_features.c | 3 ++
src/common/defs.h | 1 +
src/common/hw_features_common.c | 84 +++++++++++++++++++++++++++++++++
src/common/hw_features_common.h | 1 +
src/common/ieee802_11_common.c | 23 +++++++++
wlantest/Makefile | 1 +
8 files changed, 121 insertions(+), 1 deletion(-)
[snip]
diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c
index 3fdbf893d2..9996ef2bf7 100644
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -358,6 +358,25 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode,
}
+int center_idx_to_width_6ghz(u8 idx)
+{
+ /* channels: 1, 5, 9, 13... */
+ if ((idx & 0x3) == 0x1)
+ return 0; /* 20mhz */
+ /* channels 3, 11, 19... */
+ if ((idx & 0x7) == 0x3)
+ return 1; /* 40mhz */
+ /* channels 7, 23, 39.. */
+ if ((idx & 0xf) == 0x7)
+ return 2; /* 80mhz */
+ /* channels 15, 47, 79...*/
+ if ((idx & 0x1f) == 0xf)
+ return 3; /* 160mhz */
+
+ return -1;
+}
+
+
int hostapd_set_freq_params(struct hostapd_freq_params *data,
enum hostapd_hw_mode mode,
int freq, int channel, int ht_enabled,
@@ -381,6 +400,71 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data,
data->center_freq2 = 0;
data->bandwidth = sec_channel_offset ? 40 : 20;
+ if (mode == HOSTAPD_MODE_IEEE80211AX) {
+ if (!data->he_enabled) {
+ wpa_printf(MSG_ERROR,
+ "Can't set 6GHz mode - HE isn't enabled");
+ return -1;
+ }
+
+ if (center_idx_to_width_6ghz(channel) != 0) {
Should the condition be '< 0' instead here?
+ wpa_printf(MSG_ERROR,
+ "Invalid control channel for 6Ghz band");
+ return -1;
+ }
+
+ if (!center_segment0) {
+ if (center_segment1) {
+ wpa_printf(MSG_ERROR,
+ "Center0 freq isn't set");
+ return -1;
+ }
+
+ data->center_freq1 = data->freq;
+ data->bandwidth = 20;
+ } else {
+ int freq1, freq2 = 0;
+ int bw = center_idx_to_width_6ghz(center_segment0);
+
+ if (bw < 0 ) {
+ wpa_printf(MSG_ERROR,
+ "Invalid center channel idx for 6GHz");
+ return -1;
+ }
+
+ freq1 = ieee80211_chan_to_freq(NULL, 131,
+ center_segment0);
+ if (freq1 < 0) {
+ wpa_printf(MSG_ERROR,
+ "Invalid center0 freq. for 6GHz");
+ return -1;
+ }
+
+ if (center_segment1) {
+ if (center_idx_to_width_6ghz(center_segment1) != 2 ||
+ bw != 2) {
A nit really but you could check for 'bw != 2' first.
+ wpa_printf(MSG_ERROR,
+ "6GHz 80+80 configuration doesn't use valid 80MHz channels");
+ return -1;
+ }
[snip]
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index a081f87cc2..8096e17409 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
[snip]
@@ -1161,6 +1175,14 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
if (chan < 36 || chan > 128)
return -1;
return 5000 + 5 * chan;
+ case 131: /* UHB channels, 20 mhz: 1, 5, 9.. */
+ case 132: /* UHB channels, 40 mhz: 3, 11, 19.. */
+ case 133: /* UHB channels, 80 mhz: 7, 23, 39.. */
+ case 134: /* UHB channels, 160 mhz: 15, 47, 79.. */
+ case 135: /* UHB channels, 80+80 mhz: 7, 23, 39.. */
+ if (chan < 1 || chan > 233)
The spec mentions range 1..253. Where is 233 coming from?
+ return -1;
+ return 5940 + chan * 5;
case 180: /* 60 GHz band, channels 1..4 */
if (chan < 1 || chan > 4)
return -1;
_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap