From 44b32a7526263d32e511f9fed95ca08ceb90e52e Mon Sep 17 00:00:00 2001 From: Sathishkumar Muruganandam Date: Fri, 3 Mar 2023 11:17:57 +0530 Subject: [PATCH] mesh: Add EHT support Add mesh_eht_enabled and eht ssid configuration parameters to include EHT Capability and EHT Operation elements in mesh PLINK Action frames. Update mesh_eht_enabled from EHT capability advertised for mesh mode. Signed-off-by: Sathishkumar Muruganandam Signed-off-by: Ramya Gnanasekar --- wpa_supplicant/ap.c | 15 +++++++++++++++ wpa_supplicant/config_ssid.h | 2 ++ wpa_supplicant/mesh.c | 5 ++++- wpa_supplicant/mesh_mpm.c | 32 ++++++++++++++++++++++++++++++- wpa_supplicant/wpa_supplicant.c | 28 +++++++++++++++++++++++++-- wpa_supplicant/wpa_supplicant_i.h | 1 + 6 files changed, 79 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 653f15f54..30b1f7417 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -326,6 +326,16 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, if (mode && is_6ghz_freq(ssid->frequency) && conf->hw_mode == HOSTAPD_MODE_IEEE80211A) { + if (mode->eht_capab[wpas_mode_to_ieee80211_mode( + ssid->mode)].eht_supported && + ssid->eht) + conf->ieee80211be = 1; + + if (mode->he_capab[wpas_mode_to_ieee80211_mode( + ssid->mode)].he_supported && + ssid->he) + conf->ieee80211ax = 1; + #ifdef CONFIG_P2P wpas_conf_ap_he_6ghz(wpa_s, mode, ssid, conf); #endif /* CONFIG_P2P */ @@ -400,6 +410,11 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s, /* check this before VHT, because setting oper chan * width and friends is the same call for HE and VHT * and checks if conf->ieee8021ax == 1 */ + if (mode->eht_capab[wpas_mode_to_ieee80211_mode( + ssid->mode)].eht_supported && + ssid->eht) + conf->ieee80211be = 1; + if (mode->he_capab[wpas_mode_to_ieee80211_mode( ssid->mode)].he_supported && ssid->he) diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 18b92b40d..ff045380e 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -584,6 +584,8 @@ struct wpa_ssid { int he; + int eht; + enum oper_chan_width max_oper_chwidth; unsigned int vht_center_freq1; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index 16530fb74..486fc6a09 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -225,7 +225,7 @@ static int wpas_mesh_update_freq_params(struct wpa_supplicant *wpa_s) ifmsh->conf->ieee80211n, ifmsh->conf->ieee80211ac, ifmsh->conf->ieee80211ax, - false, + ifmsh->conf->ieee80211be, ifmsh->conf->secondary_channel, hostapd_get_oper_chwidth(ifmsh->conf), hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf), @@ -634,6 +634,7 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, wpa_s->mesh_ht_enabled = !!params->freq.ht_enabled; wpa_s->mesh_vht_enabled = !!params->freq.vht_enabled; wpa_s->mesh_he_enabled = !!params->freq.he_enabled; + wpa_s->mesh_eht_enabled = !!params->freq.eht_enabled; if (params->freq.ht_enabled && params->freq.sec_channel_offset) ssid->ht40 = params->freq.sec_channel_offset; @@ -662,6 +663,8 @@ int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s, } if (wpa_s->mesh_he_enabled) ssid->he = 1; + if (wpa_s->mesh_eht_enabled) + ssid->eht = 1; if (ssid->beacon_int > 0) params->beacon_int = ssid->beacon_int; else if (wpa_s->conf->beacon_int > 0) diff --git a/wpa_supplicant/mesh_mpm.c b/wpa_supplicant/mesh_mpm.c index c1ed8c4b5..da6d9db05 100644 --- a/wpa_supplicant/mesh_mpm.c +++ b/wpa_supplicant/mesh_mpm.c @@ -263,6 +263,13 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, if (type != PLINK_CLOSE && conf->ocv) buf_len += OCV_OCI_EXTENDED_LEN; #endif /* CONFIG_OCV */ +#ifdef CONFIG_IEEE80211BE + if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) { + buf_len += 3 + 2 + EHT_PHY_CAPAB_LEN + EHT_MCS_NSS_CAPAB_LEN + + EHT_PPE_THRESH_CAPAB_LEN; + buf_len += 3 + sizeof(struct ieee80211_eht_operation); +} +#endif /* CONFIG_IEEE80211BE */ buf = wpabuf_alloc(buf_len); if (!buf) @@ -390,7 +397,6 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, wpabuf_put_data(buf, he_capa_oper, pos - he_capa_oper); } #endif /* CONFIG_IEEE80211AX */ - #ifdef CONFIG_OCV if (type != PLINK_CLOSE && conf->ocv) { struct wpa_channel_info ci; @@ -407,6 +413,21 @@ static void mesh_mpm_send_plink_action(struct wpa_supplicant *wpa_s, } #endif /* CONFIG_OCV */ +#ifdef CONFIG_IEEE80211BE + if (type != PLINK_CLOSE && wpa_s->mesh_eht_enabled) { + u8 eht_capa_oper[3 + + 2 + + EHT_PHY_CAPAB_LEN + + EHT_MCS_NSS_CAPAB_LEN + + EHT_PPE_THRESH_CAPAB_LEN + + 3 + sizeof(struct ieee80211_eht_operation)]; + pos = hostapd_eid_eht_capab(bss, eht_capa_oper, + IEEE80211_MODE_MESH); + pos = hostapd_eid_eht_operation(bss, pos); + wpabuf_put_data(buf, eht_capa_oper, pos - eht_capa_oper); + } +#endif /* CONFIG_IEEE80211BE */ + if (ampe && mesh_rsn_protect_frame(wpa_s->mesh_rsn, sta, cat, buf)) { wpa_msg(wpa_s, MSG_INFO, "Mesh MPM: failed to add AMPE and MIC IE"); @@ -758,6 +779,13 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, elems->he_capabilities, elems->he_capabilities_len); copy_sta_he_6ghz_capab(data, sta, elems->he_6ghz_band_cap); #endif /* CONFIG_IEEE80211AX */ +#ifdef CONFIG_IEEE80211BE + copy_sta_eht_capab(data, sta, IEEE80211_MODE_MESH, + elems->he_capabilities, + elems->he_capabilities_len, + elems->eht_capabilities, + elems->eht_capabilities_len); +#endif /*CONFIG_IEEE80211BE */ if (hostapd_get_aid(data, sta) < 0) { wpa_msg(wpa_s, MSG_ERROR, "No AIDs available"); @@ -779,6 +807,8 @@ static struct sta_info * mesh_mpm_add_peer(struct wpa_supplicant *wpa_s, params.he_capab = sta->he_capab; params.he_capab_len = sta->he_capab_len; params.he_6ghz_capab = sta->he_6ghz_capab; + params.eht_capab = sta->eht_capab; + params.eht_capab_len = sta->eht_capab_len; 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 d624f16b8..1de6fa036 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2733,6 +2733,25 @@ static bool ibss_mesh_can_use_he(struct wpa_supplicant *wpa_s, } +static bool ibss_mesh_can_use_eht(struct wpa_supplicant *wpa_s, + const struct wpa_ssid *ssid, + const struct hostapd_hw_modes *mode, + int ieee80211_mode) +{ + if (ssid->disable_eht) + return false; + + switch(mode->mode) { + case HOSTAPD_MODE_IEEE80211G: + case HOSTAPD_MODE_IEEE80211B: + case HOSTAPD_MODE_IEEE80211A: + return mode->eht_capab[ieee80211_mode].eht_supported; + default: + return false; + } +} + + static void ibss_mesh_select_40mhz(struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, @@ -2962,11 +2981,11 @@ skip_80mhz: freq->channel, ssid->enable_edmg, ssid->edmg_channel, freq->ht_enabled, freq->vht_enabled, freq->he_enabled, - false, + freq->eht_enabled, freq->sec_channel_offset, chwidth, seg0, seg1, vht_caps, &mode->he_capab[ieee80211_mode], - NULL) != 0) + &mode->eht_capab[ieee80211_mode]) != 0) return false; *freq = vht_freq; @@ -3020,6 +3039,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, freq->ht_enabled = 0; freq->vht_enabled = 0; freq->he_enabled = 0; + freq->eht_enabled = 0; if (!is_6ghz) freq->ht_enabled = ibss_mesh_can_use_ht(wpa_s, ssid, mode); @@ -3036,6 +3056,10 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, ieee80211_mode, is_6ghz)) freq->he_enabled = freq->vht_enabled = false; } + + if (freq->he_enabled) + freq->eht_enabled = ibss_mesh_can_use_eht(wpa_s, ssid, mode, + ieee80211_mode); } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 61d274a05..d5b3dab67 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1003,6 +1003,7 @@ struct wpa_supplicant { unsigned int mesh_ht_enabled:1; unsigned int mesh_vht_enabled:1; unsigned int mesh_he_enabled:1; + unsigned int mesh_eht_enabled:1; struct wpa_driver_mesh_join_params *mesh_params; #ifdef CONFIG_PMKSA_CACHE_EXTERNAL /* struct external_pmksa_cache::list */