From: Aditya Kumar Singh Date: Tue, 27 Aug 2024 05:27:48 +0000 (+0530) Subject: wpa_supplicant: 320 MHz bandwidth support for mesh X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5b4c8bdd2ffebb2d4d75ccf8e48c31cd3b334b84;p=thirdparty%2Fhostap.git wpa_supplicant: 320 MHz bandwidth support for mesh Mesh supported a maximum operational channel width of up to 160 or 80+80 MHz. Extend this to support a maximum operational channel width of up to 320 MHz. Signed-off-by: Aditya Kumar Singh --- diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 126447442..13043afe9 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2544,7 +2544,7 @@ static const struct parse_data ssid_fields[] = { { INT_RANGE(he, 0, 1) }, { INT_RANGE(ht40, -1, 1) }, { INT_RANGE(max_oper_chwidth, CONF_OPER_CHWIDTH_USE_HT, - CONF_OPER_CHWIDTH_80P80MHZ) }, + CONF_OPER_CHWIDTH_320MHZ) }, { INT(vht_center_freq1) }, { INT(vht_center_freq2) }, #ifdef IEEE8021X_EAPOL diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index bca231139..514a56140 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3087,6 +3087,27 @@ static void ibss_mesh_select_40mhz(struct wpa_supplicant *wpa_s, } +static int ibss_get_center_320mhz(int channel) +{ + int seg0; + + if (channel >= 1 && channel <= 45) + seg0 = 31; + else if (channel >= 49 && channel <= 77) + seg0 = 63; + else if (channel >= 81 && channel <= 109) + seg0 = 95; + else if (channel >= 113 && channel <= 141) + seg0 = 127; + else if (channel >= 145 && channel <= 173) + seg0 = 159; + else + seg0 = 191; + + return seg0; +} + + static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, const struct wpa_ssid *ssid, struct hostapd_hw_modes *mode, @@ -3100,6 +3121,11 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, static const int bw160[] = { 5955, 6115, 6275, 6435, 6595, 6755, 6915 }; + static const int bw320[]= { + 5955, 6255, 6115, 6415, 6275, 6575, 6435, + 6735, 6595, 6895, 6755, 7055 + }; + struct hostapd_freq_params vht_freq; int i; unsigned int j, k; @@ -3160,6 +3186,26 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, } } + /* In 320 MHz, the initial four 20 MHz channels were validated + * above. If 320 MHz is supported, check the remaining 12 20 MHz + * channels for the total of 320 MHz bandwidth for 6 GHz. + */ + if ((mode->eht_capab[ieee80211_mode].phy_cap[ + EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] & + EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK) && is_6ghz && + ibss_mesh_is_80mhz_avail(channel + 16, mode) && + ibss_mesh_is_80mhz_avail(channel + 32, mode) && + ibss_mesh_is_80mhz_avail(channel + 48, mode)) { + for (j = 0; j < ARRAY_SIZE(bw320); j += 2) { + if (freq->freq >= bw320[j] && + freq->freq <= bw320[j + 1]) { + chwidth = CONF_OPER_CHWIDTH_320MHZ; + seg0 = ibss_get_center_320mhz(freq->channel); + break; + } + } + } + if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_80P80MHZ) { /* setup center_freq2, bandwidth */ for (k = 0; k < ARRAY_SIZE(bw80); k++) {