From d10a01e221d80592e7eaea5699f9a9a51473d19a Mon Sep 17 00:00:00 2001 From: Pradeep Kumar Chitrapu Date: Thu, 9 Sep 2021 10:46:14 -0700 Subject: [PATCH] mesh: Enable 80 MHz support for 11s mesh in 6 GHz Add support for 80 MHz bandwidth operation in 6 GHz 11s mesh. example: network={ ssid="6GHz-mesh-node" key_mgmt=SAE mode=5 frequency=6195 psk="1234567890" } Signed-off-by: Pradeep Kumar Chitrapu --- wpa_supplicant/mesh.c | 24 ++++++++++++++++++++++++ wpa_supplicant/mesh_mpm.c | 10 +++++++++- wpa_supplicant/wpa_supplicant.c | 26 +++++++++++++++++++------- 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 901b49b4d..4e9d89061 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -437,6 +437,30 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, if (!conf) goto out_free; + if (is_6ghz_freq(freq->freq)) { + /* Set mandatory op_class parameter for setting up BSS */ + switch (freq->bandwidth) { + case 20: + if (freq->freq == 5935) + conf->op_class = 136; + else + conf->op_class = 131; + break; + case 40: + conf->op_class = 132; + break; + case 80: + conf->op_class = 133; + break; + case 160: + conf->op_class = 134; + break; + default: + conf->op_class = 131; + break; + } + } + bss->conf = *conf->bss; bss->conf->start_disabled = 1; bss->conf->mesh = MESH_ENABLED; diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index b6a5e8857..38f0d641a 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -251,6 +251,9 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, HE_MAX_MCS_CAPAB_SIZE + HE_MAX_PPET_CAPAB_SIZE; buf_len += 3 + sizeof(struct ieee80211_he_operation); + if (is_6ghz_op_class(bss->iconf->op_class)) + buf_len += sizeof(struct ieee80211_he_6ghz_oper_info) + + 3 + sizeof(struct ieee80211_he_6ghz_band_cap); } #endif /* CONFIG_IEEE80211AX */ if (type != PLINK_CLOSE) @@ -375,11 +378,14 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, HE_MAX_PHY_CAPAB_SIZE + HE_MAX_MCS_CAPAB_SIZE + HE_MAX_PPET_CAPAB_SIZE + - 3 + sizeof(struct ieee80211_he_operation)]; + 3 + sizeof(struct ieee80211_he_operation) + + sizeof(struct ieee80211_he_6ghz_oper_info) + + 3 + sizeof(struct ieee80211_he_6ghz_band_cap)]; pos = hostapd_eid_he_capab(bss, he_capa_oper, IEEE80211_MODE_MESH); pos = hostapd_eid_he_operation(bss, pos); + pos = hostapd_eid_he_6ghz_band_cap(bss, pos); wpabuf_put_data(buf, he_capa_oper, pos - he_capa_oper); } #endif /* CONFIG_IEEE80211AX */ @@ -749,6 +755,7 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, #ifdef CONFIG_IEEE80211AX copy_sta_he_capab(data, sta, IEEE80211_MODE_MESH, elems->he_capabilities, elems->he_capabilities_len); + copy_sta_he_6ghz_capab(data, sta, elems->he_6ghz_band_cap); #endif /* CONFIG_IEEE80211AX */ if (hostapd_get_aid(data, sta) < 0) { @@ -770,6 +777,7 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, params.vht_capabilities = sta->vht_capabilities; params.he_capab = sta->he_capab; params.he_capab_len = sta->he_capab_len; + params.he_6ghz_capab = sta->he_6ghz_capab; params.flags |= WPA_STA_WMM; params.flags_mask |= WPA_STA_AUTHENTICATED; if (conf->security == MESH_CONF_SEC_NONE) { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 2acbfc6a7..f21270d9e 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2418,7 +2418,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, struct hostapd_hw_modes *mode = NULL; int ht40plus[] = { 36, 44, 52, 60, 100, 108, 116, 124, 132, 149, 157, 184, 192 }; - int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745 }; + int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745, 5955, + 6035, 6115, 6195, 6275, 6355, 6435, 6515, + 6595, 6675, 6755, 6835, 6915, 6995 }; struct hostapd_channel_data *pri_chan = NULL, *sec_chan = NULL; u8 channel; int i, chan_idx, ht40 = -1, res, obss_scan = 1; @@ -2426,7 +2428,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, struct hostapd_freq_params vht_freq; int chwidth, seg0, seg1; u32 vht_caps = 0; - int is_24ghz; + bool is_24ghz, is_6ghz; freq->freq = ssid->frequency; @@ -2483,6 +2485,13 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, is_24ghz = hw_mode == HOSTAPD_MODE_IEEE80211G || hw_mode == HOSTAPD_MODE_IEEE80211B; + /* HT/VHT and corresponding overrides are not applicable to 6 GHz. + * However, HE is mandatory for 6 GHz. + */ + is_6ghz = is_6ghz_freq(freq->freq); + if (is_6ghz) + goto skip_to_6ghz; + #ifdef CONFIG_HT_OVERRIDES if (ssid->disable_ht) { freq->ht_enabled = 0; @@ -2610,8 +2619,6 @@ skip_ht40: !(wpa_s->drv_flags & WPA_DRIVER_FLAGS_VHT_IBSS)) return; - vht_freq = *freq; - #ifdef CONFIG_VHT_OVERRIDES if (ssid->disable_vht) { freq->vht_enabled = 0; @@ -2619,8 +2626,12 @@ skip_ht40: } #endif /* CONFIG_VHT_OVERRIDES */ +skip_to_6ghz: + vht_freq = *freq; + + /* 6 GHz does not have VHT enabled, so allow that exception here. */ vht_freq.vht_enabled = vht_supported(mode); - if (!vht_freq.vht_enabled) + if (!vht_freq.vht_enabled && !is_6ghz) return; /* Enable HE with VHT for 5 GHz */ @@ -2678,8 +2689,9 @@ skip_ht40: /* Found a suitable second segment for 80+80 */ chwidth = CHANWIDTH_80P80MHZ; - vht_caps |= - VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; + if (!is_6ghz) + vht_caps |= + VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ; seg1 = channel + 6; } -- 2.47.2