From 833cdbe97dd4a7c6c225a5fc0ac2eceb0799c9d8 Mon Sep 17 00:00:00 2001 From: Sreeramya Soratkal Date: Mon, 23 Nov 2020 13:30:02 +0530 Subject: [PATCH] Add support for new 5 GHz channels 173 and 177 Add support for new channels 173 and 177 in the operating classes 125 to 130 as defined in draft IEEE P802.11ax/D8.0. Signed-off-by: Sreeramya Soratkal --- src/ap/dfs.c | 10 ++--- src/common/hw_features_common.c | 2 + src/common/ieee802_11_common.c | 64 +++++++++++++++--------------- src/drivers/driver_nl80211_event.c | 2 +- wpa_supplicant/op_classes.c | 21 ++++++++-- wpa_supplicant/p2p_supplicant.c | 6 +-- wpa_supplicant/rrm.c | 4 +- wpa_supplicant/wnm_sta.c | 2 +- 8 files changed, 63 insertions(+), 48 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 84db7f28d..be7726cbe 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -81,17 +81,17 @@ static int dfs_is_chan_allowed(struct hostapd_channel_data *chan, int n_chans) * We will also choose this first channel as the control one. */ int allowed_40[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, - 184, 192 }; + 165, 173, 184, 192 }; /* * VHT80, valid channels based on center frequency: - * 42, 58, 106, 122, 138, 155 + * 42, 58, 106, 122, 138, 155, 171 */ - int allowed_80[] = { 36, 52, 100, 116, 132, 149 }; + int allowed_80[] = { 36, 52, 100, 116, 132, 149, 165 }; /* * VHT160 valid channels based on center frequency: - * 50, 114 + * 50, 114, 163 */ - int allowed_160[] = { 36, 100 }; + int allowed_160[] = { 36, 100, 149 }; int *allowed = allowed_40; unsigned int i, allowed_no = 0; diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index 511e68f9e..b62c37aea 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -580,6 +580,8 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, center_segment0 = 138; else if (channel <= 161) center_segment0 = 155; + else if (channel <= 177) + center_segment0 = 171; data->center_freq1 = 5000 + center_segment0 * 5; } else { /* diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index 764ece92a..886b8d0a6 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -986,8 +986,8 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq, return HOSTAPD_MODE_IEEE80211A; } - /* 5 GHz, channels 149..169 */ - if (freq >= 5745 && freq <= 5845) { + /* 5 GHz, channels 149..177 */ + if (freq >= 5745 && freq <= 5885) { if ((freq - 5000) % 5) return NUM_HOSTAPD_MODES; @@ -1417,22 +1417,22 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan) return -1; return 5000 + 5 * chan; case 124: /* channels 149,153,157,161 */ - case 126: /* channels 149,157; 40 MHz */ - case 127: /* channels 153,161; 40 MHz */ if (chan < 149 || chan > 161) return -1; return 5000 + 5 * chan; - case 125: /* channels 149,153,157,161,165,169 */ - if (chan < 149 || chan > 169) + case 125: /* channels 149,153,157,161,165,169,173,177 */ + case 126: /* channels 149,157,165,173; 40 MHz */ + case 127: /* channels 153,161,169,177; 40 MHz */ + if (chan < 149 || chan > 177) return -1; return 5000 + 5 * chan; - case 128: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */ - case 130: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */ - if (chan < 36 || chan > 161) + case 128: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80 MHz */ + case 130: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80 MHz */ + if (chan < 36 || chan > 177) return -1; return 5000 + 5 * chan; - case 129: /* center freqs 50, 114; 160 MHz */ - if (chan < 36 || chan > 128) + case 129: /* center freqs 50, 114, 163; 160 MHz */ + if (chan < 36 || chan > 177) return -1; return 5000 + 5 * chan; case 131: /* UHB channels, 20 MHz: 1, 5, 9.. */ @@ -1876,20 +1876,20 @@ const struct oper_class_map global_op_class[] = { { HOSTAPD_MODE_IEEE80211A, 122, 100, 132, 8, BW40PLUS, NO_P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 123, 104, 136, 8, BW40MINUS, NO_P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 124, 149, 161, 4, BW20, P2P_SUPP }, - { HOSTAPD_MODE_IEEE80211A, 125, 149, 169, 4, BW20, P2P_SUPP }, - { HOSTAPD_MODE_IEEE80211A, 126, 149, 157, 8, BW40PLUS, P2P_SUPP }, - { HOSTAPD_MODE_IEEE80211A, 127, 153, 161, 8, BW40MINUS, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 125, 149, 177, 4, BW20, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 126, 149, 173, 8, BW40PLUS, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 127, 153, 177, 8, BW40MINUS, P2P_SUPP }, /* - * IEEE P802.11ac/D7.0 Table E-4 actually talks about channel center - * frequency index 42, 58, 106, 122, 138, 155 with channel spacing of - * 80 MHz, but currently use the following definition for simplicity + * IEEE P802.11ax/D8.0 Table E-4 actually talks about channel center + * frequency index 42, 58, 106, 122, 138, 155, 171 with channel spacing + * of 80 MHz, but currently use the following definition for simplicity * (these center frequencies are not actual channels, which makes * wpas_p2p_verify_channel() fail). wpas_p2p_verify_80mhz() should take * care of removing invalid channels. */ - { HOSTAPD_MODE_IEEE80211A, 128, 36, 161, 4, BW80, P2P_SUPP }, - { HOSTAPD_MODE_IEEE80211A, 129, 36, 128, 4, BW160, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 128, 36, 177, 4, BW80, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 129, 36, 177, 4, BW160, P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 131, 1, 233, 4, BW20, NO_P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 132, 1, 233, 8, BW40, NO_P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 133, 1, 233, 16, BW80, NO_P2P_SUPP }, @@ -1911,7 +1911,7 @@ const struct oper_class_map global_op_class[] = { * the OneHundredAndThirty Delimiter value used in the Supported * Operating Classes element to indicate the end of the Operating * Classes field. */ - { HOSTAPD_MODE_IEEE80211A, 130, 36, 161, 4, BW80P80, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211A, 130, 36, 177, 4, BW80P80, P2P_SUPP }, { -1, 0, 0, 0, 0, BW20, NO_P2P_SUPP } }; @@ -2493,16 +2493,16 @@ int op_class_to_bandwidth(u8 op_class) case 123: /* channels 104-136; 40 MHz */ return 40; case 124: /* channels 149,153,157,161 */ - case 125: /* channels 149,153,157,161,165,169 */ + case 125: /* channels 149,153,157,161,165,169,173,177 */ return 20; - case 126: /* channels 149,157; 40 MHz */ - case 127: /* channels 153,161; 40 MHz */ + case 126: /* channels 149,157,161,165,169,173; 40 MHz */ + case 127: /* channels 153..177; 40 MHz */ return 40; - case 128: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */ + case 128: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80 MHz */ return 80; - case 129: /* center freqs 50, 114; 160 MHz */ + case 129: /* center freqs 50, 114, 163; 160 MHz */ return 160; - case 130: /* center freqs 42, 58, 106, 122, 138, 155; 80+80 MHz */ + case 130: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80+80 MHz */ return 80; case 131: /* UHB channels, 20 MHz: 1, 5, 9.. */ return 20; @@ -2554,16 +2554,16 @@ int op_class_to_ch_width(u8 op_class) case 123: /* channels 104-136; 40 MHz */ return CHANWIDTH_USE_HT; case 124: /* channels 149,153,157,161 */ - case 125: /* channels 149,153,157,161,165,169 */ + case 125: /* channels 149,153,157,161,165,169,171 */ return CHANWIDTH_USE_HT; - case 126: /* channels 149,157; 40 MHz */ - case 127: /* channels 153,161; 40 MHz */ + case 126: /* channels 149,157,165, 173; 40 MHz */ + case 127: /* channels 153,161,169,177; 40 MHz */ return CHANWIDTH_USE_HT; - case 128: /* center freqs 42, 58, 106, 122, 138, 155; 80 MHz */ + case 128: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80 MHz */ return CHANWIDTH_80MHZ; - case 129: /* center freqs 50, 114; 160 MHz */ + case 129: /* center freqs 50, 114, 163; 160 MHz */ return CHANWIDTH_160MHZ; - case 130: /* center freqs 42, 58, 106, 122, 138, 155; 80+80 MHz */ + case 130: /* center freqs 42, 58, 106, 122, 138, 155, 171; 80+80 MHz */ return CHANWIDTH_80P80MHZ; case 131: /* UHB channels, 20 MHz: 1, 5, 9.. */ return CHANWIDTH_USE_HT; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index a63059bda..c971001ae 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -1944,7 +1944,7 @@ try_2_4_or_5: return 2407 + 5 * chan; if (chan == 14) return 2484; - if (chan >= 36 && chan <= 169) + if (chan >= 36 && chan <= 177) return 5000 + 5 * chan; return 0; diff --git a/wpa_supplicant/op_classes.c b/wpa_supplicant/op_classes.c index 41b47cc62..a0ad0c2ff 100644 --- a/wpa_supplicant/op_classes.c +++ b/wpa_supplicant/op_classes.c @@ -77,7 +77,7 @@ static enum chan_allowed verify_80mhz(struct hostapd_hw_modes *mode, unsigned int no_ir = 0; const u8 *center_channels; size_t num_chan; - const u8 center_channels_5ghz[] = { 42, 58, 106, 122, 138, 155 }; + const u8 center_channels_5ghz[] = { 42, 58, 106, 122, 138, 155, 171 }; const u8 center_channels_6ghz[] = { 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215 }; @@ -150,7 +150,7 @@ static enum chan_allowed verify_160mhz(struct hostapd_hw_modes *mode, unsigned int no_ir = 0; const u8 *center_channels; size_t num_chan; - const u8 center_channels_5ghz[] = { 50, 114 }; + const u8 center_channels_5ghz[] = { 50, 114, 163 }; const u8 center_channels_6ghz[] = { 15, 47, 79, 111, 143, 175, 207 }; if (is_6ghz_op_class(op_class)) { @@ -320,7 +320,7 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, #endif /* CONFIG_VHT_OVERRIDES */ if (op_class->op_class == 128) { - u8 channels[] = { 42, 58, 106, 122, 138, 155 }; + u8 channels[] = { 42, 58, 106, 122, 138, 155, 171 }; for (i = 0; i < ARRAY_SIZE(channels); i++) { if (verify_channel(mode, op_class->op_class, @@ -337,6 +337,8 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, return verify_channel(mode, op_class->op_class, 50, op_class->bw) != NOT_ALLOWED || verify_channel(mode, op_class->op_class, 114, + op_class->bw) != NOT_ALLOWED || + verify_channel(mode, op_class->op_class, 163, op_class->bw) != NOT_ALLOWED; } @@ -354,6 +356,10 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, verify_channel(mode, op_class->op_class, 122, op_class->bw) != NOT_ALLOWED || verify_channel(mode, op_class->op_class, 138, + op_class->bw) != NOT_ALLOWED || + verify_channel(mode, op_class->op_class, 155, + op_class->bw) != NOT_ALLOWED || + verify_channel(mode, op_class->op_class, 171, op_class->bw) != NOT_ALLOWED) found++; if (verify_channel(mode, op_class->op_class, 106, @@ -361,7 +367,14 @@ static int wpas_op_class_supported(struct wpa_supplicant *wpa_s, verify_channel(mode, op_class->op_class, 138, op_class->bw) != NOT_ALLOWED) found++; - if (verify_channel(mode, op_class->op_class, 155, + if (verify_channel(mode, op_class->op_class, 122, + op_class->bw) != NOT_ALLOWED && + verify_channel(mode, op_class->op_class, 155, + op_class->bw) != NOT_ALLOWED) + found++; + if (verify_channel(mode, op_class->op_class, 138, + op_class->bw) != NOT_ALLOWED && + verify_channel(mode, op_class->op_class, 171, op_class->bw) != NOT_ALLOWED) found++; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 7d6e2dac8..a1eaaf128 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3578,7 +3578,7 @@ static int wpas_p2p_get_center_80mhz(struct wpa_supplicant *wpa_s, struct hostapd_hw_modes *mode, u8 channel) { - u8 center_channels[] = { 42, 58, 106, 122, 138, 155 }; + u8 center_channels[] = { 42, 58, 106, 122, 138, 155, 171 }; size_t i; if (mode->mode != HOSTAPD_MODE_IEEE80211A) @@ -3639,7 +3639,7 @@ static int wpas_p2p_get_center_160mhz(struct wpa_supplicant *wpa_s, struct hostapd_hw_modes *mode, u8 channel) { - u8 center_channels[] = { 50, 114 }; + u8 center_channels[] = { 50, 114, 163 }; unsigned int i; if (mode->mode != HOSTAPD_MODE_IEEE80211A) @@ -3787,7 +3787,7 @@ static int wpas_p2p_setup_channels(struct wpa_supplicant *wpa_s, /* Check for non-continuous jump in channel index * incrementation */ - if ((o->op_class == 128 || o->op_class == 130) && + if ((o->op_class >= 128 && o->op_class <= 130) && ch < 149 && ch + o->inc > 149) ch = 149; diff --git a/wpa_supplicant/rrm.c b/wpa_supplicant/rrm.c index 242496d0a..cf107ebaf 100644 --- a/wpa_supplicant/rrm.c +++ b/wpa_supplicant/rrm.c @@ -556,8 +556,8 @@ static int * wpas_add_channels(const struct oper_class_map *op, static int * wpas_op_class_freqs(const struct oper_class_map *op, struct hostapd_hw_modes *mode, int active) { - u8 channels_80mhz_5ghz[] = { 42, 58, 106, 122, 138, 155 }; - u8 channels_160mhz_5ghz[] = { 50, 114 }; + u8 channels_80mhz_5ghz[] = { 42, 58, 106, 122, 138, 155, 171 }; + u8 channels_160mhz_5ghz[] = { 50, 114, 163 }; u8 channels_80mhz_6ghz[] = { 7, 23, 39, 55, 71, 87, 103, 119, 135, 151, 167, 183, 199, 215 }; u8 channels_160mhz_6ghz[] = { 15, 47, 79, 111, 143, 175, 207 }; diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c index 19f1eca8a..c4c6651d4 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -552,7 +552,7 @@ static int wnm_nei_get_chan(struct wpa_supplicant *wpa_s, u8 op_class, u8 chan) freq = 2407 + chan * 5; else if (chan == 14) freq = 2484; - else if (chan >= 36 && chan <= 169) + else if (chan >= 36 && chan <= 177) freq = 5000 + chan * 5; } return freq;