mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 19:03:39 +00:00
264 lines
9.2 KiB
Diff
264 lines
9.2 KiB
Diff
From d6e52c4ef2bb8e915cae088564c412583f1794c9 Mon Sep 17 00:00:00 2001
|
|
From: P Praneesh <quic_ppranees@quicinc.com>
|
|
Date: Fri, 21 Jan 2022 09:44:15 +0530
|
|
Subject: [PATCH] mesh: enable more 160MHz channels in 6GHz
|
|
|
|
Current 160MHz implementation supports mesh bringup in limited channels.
|
|
Allow all the 6GHz 80MHz channels to support 160MHz if the secondary 80MHz
|
|
is available.
|
|
|
|
Ex: User can bringup 160MHz in 49th channel (primary 80MHz) based on 33rd
|
|
channel(secondary 80MHz) availablity.
|
|
|
|
Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
|
|
---
|
|
wpa_supplicant/wpa_supplicant.c | 21 ++++++++++++++++++---
|
|
1 file changed, 18 insertions(+), 3 deletions(-)
|
|
|
|
Index: hostapd-2021-12-13-b26f5c0f/hostapd/config_file.c
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/hostapd/config_file.c
|
|
+++ hostapd-2021-12-13-b26f5c0f/hostapd/config_file.c
|
|
@@ -4280,6 +4280,8 @@ static int hostapd_config_fill(struct ho
|
|
} else if (os_strcmp(buf, "wowlan_triggers") == 0) {
|
|
os_free(bss->wowlan_triggers);
|
|
bss->wowlan_triggers = os_strdup(pos);
|
|
+ } else if (os_strcmp(buf, "enable_160mhz_bw") == 0) {
|
|
+ conf->enable_160mhz_bw = atoi(pos);
|
|
} else if (os_strcmp(buf, "disable_40mhz_scan") == 0) {
|
|
conf->disable_40mhz_scan = atoi(pos);
|
|
#ifdef CONFIG_FST
|
|
Index: hostapd-2021-12-13-b26f5c0f/src/ap/ap_config.h
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/src/ap/ap_config.h
|
|
+++ hostapd-2021-12-13-b26f5c0f/src/ap/ap_config.h
|
|
@@ -1083,6 +1083,7 @@ struct hostapd_config {
|
|
} *acs_chan_bias;
|
|
unsigned int num_acs_chan_bias;
|
|
#endif /* CONFIG_ACS */
|
|
+ int enable_160mhz_bw;
|
|
int disable_40mhz_scan;
|
|
|
|
struct wpabuf *lci;
|
|
Index: hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/src/drivers/driver.h
|
|
+++ hostapd-2021-12-13-b26f5c0f/src/drivers/driver.h
|
|
@@ -1236,6 +1236,10 @@ struct wpa_driver_associate_params {
|
|
* 2 = BURST beacon tx mode
|
|
*/
|
|
int beacon_tx_mode;
|
|
+ /**
|
|
+ * Enable 160MHz BW - set it 1 to enable mesh 160MHz 6G
|
|
+ */
|
|
+ int enable_160mhz_bw;
|
|
};
|
|
|
|
enum hide_ssid {
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config.c
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config.c
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config.c
|
|
@@ -2742,6 +2742,7 @@ static const struct parse_data ssid_fiel
|
|
{ INT_RANGE(sae_pk, 0, 2) },
|
|
{ INT_RANGE(disable_40mhz_scan, 0, 1)},
|
|
{ INT_RANGE(beacon_tx_mode, 1, 2)},
|
|
+ { INT_RANGE(enable_160mhz_bw, 0, 1)},
|
|
};
|
|
|
|
#undef OFFSET
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_file.c
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config_file.c
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_file.c
|
|
@@ -890,6 +890,7 @@ static void wpa_config_write_network(FIL
|
|
#endif /* CONFIG_HE_OVERRIDES */
|
|
INT(disable_40mhz_scan);
|
|
INT(beacon_tx_mode);
|
|
+ INT(enable_160mhz_bw);
|
|
#undef STR
|
|
#undef INT
|
|
#undef INT_DEF
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/config_ssid.h
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/config_ssid.h
|
|
@@ -1208,6 +1208,11 @@ struct wpa_ssid {
|
|
* 2 = BURST MODE
|
|
*/
|
|
int beacon_tx_mode;
|
|
+
|
|
+ /**
|
|
+ * Enable 160MHz BW - set it 1 to enable mesh 160MHz 6G
|
|
+ */
|
|
+ int enable_160mhz_bw;
|
|
};
|
|
|
|
#endif /* CONFIG_SSID_H */
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_cli.c
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_cli.c
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_cli.c
|
|
@@ -1491,6 +1491,7 @@ static const char *network_fields[] = {
|
|
"mac_addr", "pbss", "wps_disabled",
|
|
"disable_40mhz_scan",
|
|
"beacon_tx_mode",
|
|
+ "enable_160mhz_bw",
|
|
};
|
|
|
|
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.conf
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant.conf
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.conf
|
|
@@ -1699,6 +1699,11 @@ fast_reauth=1
|
|
# In STA mode it defines the EDMG channel for connection (if supported by AP).
|
|
#edmg_channel=9
|
|
|
|
+#To configure 80MHz and 160MHz in Mesh mode.
|
|
+#Set 0 to enable 80MHz in Mesh mode
|
|
+#Set 1 to enable 160MHz in Mesh mode
|
|
+#enable_160mhz_bw=1
|
|
+
|
|
# Example blocks:
|
|
|
|
# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
|
|
Index: hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
|
|
===================================================================
|
|
--- hostapd-2021-12-13-b26f5c0f.orig/wpa_supplicant/wpa_supplicant.c
|
|
+++ hostapd-2021-12-13-b26f5c0f/wpa_supplicant/wpa_supplicant.c
|
|
@@ -2541,12 +2541,20 @@ void ibss_mesh_setup_freq(struct wpa_sup
|
|
struct hostapd_hw_modes *mode = NULL;
|
|
int ht40plus[] = { 1, 2, 3, 4, 5, 6, 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157,
|
|
165, 173, 184, 192 };
|
|
- int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5825, 5955,
|
|
- 6035, 6115, 6195, 6275, 6355, 6435, 6515,
|
|
- 6595, 6675, 6755, 6835, 6915, 6995 };
|
|
- int bw160[] = { 5745, 5955, 6115, 6275, 6435, 6595, 6755, 6915 };
|
|
+ /* bw_80_160 array members are 80MHz start freq, 80MHz end freq and so on
|
|
+ */
|
|
+ unsigned int bw_80_160[] = { 5180, 5240, 5260, 5320,
|
|
+ 5500, 5560, 5580, 5660,
|
|
+ 5745, 5805, 5825, 5885,
|
|
+ 5955, 6015, 6035, 6095,
|
|
+ 6115, 6175, 6195, 6255,
|
|
+ 6275, 6335, 6355, 6415,
|
|
+ 6435, 6495, 6515, 6575,
|
|
+ 6595, 6655, 6675, 6735,
|
|
+ 6755, 6815, 6835, 6895,
|
|
+ 6915, 6975, 6995, 7055 };
|
|
struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL;
|
|
- u8 channel;
|
|
+ u8 channel, chan_80mhz;
|
|
int i, chan_idx, ht40 = -1, res, obss_scan = !(ssid->noscan);
|
|
unsigned int j, k;
|
|
struct hostapd_freq_params vht_freq;
|
|
@@ -2769,60 +2777,79 @@ skip_to_6ghz:
|
|
return;
|
|
|
|
/* Enable HE with VHT for 5 GHz */
|
|
- freq->he_enabled = mode->he_capab[ieee80211_mode].he_supported;
|
|
+ vht_freq.he_enabled = mode->he_capab[ieee80211_mode].he_supported;
|
|
|
|
#ifdef CONFIG_HE_OVERRIDES
|
|
if (is_24ghz)
|
|
goto skip_vht80;
|
|
#endif /* CONFIG_HE_OVERRIDES */
|
|
|
|
- /* setup center_freq1, bandwidth */
|
|
- for (j = 0; j < ARRAY_SIZE(bw80); j++) {
|
|
- if (freq->freq >= bw80[j] &&
|
|
- freq->freq < bw80[j] + 80)
|
|
+ for (j = 0; j < ARRAY_SIZE(bw_80_160); j+=2) {
|
|
+ /* If the config provided freq available between any of two indices
|
|
+ * get the starting range of the channel to check chan availability
|
|
+ */
|
|
+ if (freq->freq >= bw_80_160[j] && freq->freq <= bw_80_160[j+1]) {
|
|
+ ieee80211_freq_to_chan(bw_80_160[j], &chan_80mhz);
|
|
+ seg0 = chan_80mhz + 6;
|
|
break;
|
|
+ }
|
|
}
|
|
|
|
- if (j == ARRAY_SIZE(bw80) ||
|
|
- ieee80211_freq_to_chan(bw80[j], &channel) == NUM_HOSTAPD_MODES)
|
|
+ if (j == ARRAY_SIZE(bw_80_160))
|
|
return;
|
|
|
|
/* Back to HT configuration if channel not usable */
|
|
- if (!ibss_mesh_is_80mhz_avail(channel, mode))
|
|
+ if (!ibss_mesh_is_80mhz_avail(chan_80mhz, mode))
|
|
return;
|
|
|
|
chwidth = CHANWIDTH_80MHZ;
|
|
- seg0 = channel + 6;
|
|
seg1 = 0;
|
|
|
|
if ((mode->he_capab[ieee80211_mode].phy_cap[
|
|
HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] &
|
|
- HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G)) {
|
|
- /* In 160 MHz, the initial four 20 MHz channels were validated
|
|
- * above; check the remaining four 20 MHz channels for the total
|
|
- * of 160 MHz bandwidth.
|
|
- */
|
|
- if (!ibss_mesh_is_80mhz_avail(channel + 16, mode))
|
|
- break;
|
|
-
|
|
- for (j = 0; j < ARRAY_SIZE(bw160); j++) {
|
|
- if (freq->freq == bw160[j]) {
|
|
- chwidth = CHANWIDTH_160MHZ;
|
|
- seg0 = channel + 14;
|
|
+ HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && (ssid->enable_160mhz_bw)) {
|
|
+ chan_80mhz = freq->channel + 16;
|
|
+ for (j = 0; j < ARRAY_SIZE(bw_80_160); j+=2) {
|
|
+ if (freq->freq >= bw_80_160[j] && freq->freq <= bw_80_160[j+1]) {
|
|
+ if (j % 4 == 0) {
|
|
+ ieee80211_freq_to_chan(bw_80_160[j],
|
|
+ &chan_80mhz);
|
|
+ seg0 = chan_80mhz + 14;
|
|
+
|
|
+ /* Get secondary 80MHz channel using freq by
|
|
+ * adding 16*5 ie., 80MHz.
|
|
+ */
|
|
+ ieee80211_freq_to_chan((bw_80_160[j] + 16*5),
|
|
+ &chan_80mhz);
|
|
+ } else {
|
|
+ ieee80211_freq_to_chan(bw_80_160[j],
|
|
+ &chan_80mhz);
|
|
+ seg0 = chan_80mhz - 2;
|
|
+ /* Get secondary 80MHz channel using freq by
|
|
+ * subtracting 16*5 ie., 80MHz.
|
|
+ */
|
|
+ ieee80211_freq_to_chan((bw_80_160[j] - 16*5),
|
|
+ &chan_80mhz);
|
|
+ }
|
|
+
|
|
+ if (!ibss_mesh_is_80mhz_avail(chan_80mhz, mode))
|
|
+ seg0 = freq->channel + 6;
|
|
+ else
|
|
+ chwidth = CHANWIDTH_160MHZ;
|
|
break;
|
|
- }
|
|
- }
|
|
- }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
|
|
if (ssid->max_oper_chwidth == CHANWIDTH_80P80MHZ) {
|
|
/* setup center_freq2, bandwidth */
|
|
- for (k = 0; k < ARRAY_SIZE(bw80); k++) {
|
|
+ for (k = 0; k < ARRAY_SIZE(bw_80_160); k++) {
|
|
/* Only accept 80 MHz segments separated by a gap */
|
|
- if (j == k || abs(bw80[j] - bw80[k]) == 80)
|
|
+ if (j == k || abs(bw_80_160[j] - bw_80_160[k]) == 80)
|
|
continue;
|
|
|
|
- if (ieee80211_freq_to_chan(bw80[k], &channel) ==
|
|
- NUM_HOSTAPD_MODES)
|
|
+ if (ieee80211_freq_to_chan(bw_80_160[k],
|
|
+ &channel) == NUM_HOSTAPD_MODES)
|
|
return;
|
|
|
|
for (i = channel; i < channel + 16; i += 4) {
|