From 3951d8e0aa5100b8cc7c94f39a67d743f69f2a8b Mon Sep 17 00:00:00 2001 From: Rameshkumar Sundaram Date: Wed, 15 Jun 2022 08:29:43 +0530 Subject: [PATCH] wpa_supplicant: Add 5GHz 240MHz support for mesh 240MHz can be supported in 5 GHz for from channel #100 - 144 with right hand 80MHz punctured in 320MHz bandwidth. Add support to bring up mesh in 5 GHz 320MHz (240+80 Punctrued). When 320MHz is configured for channel 100-144, static puncturing pattern bits for higher 80MHz should be set (i.e. pattern & 0xF000) should result in 0xF000). EHT phy capability for advertising 320MHz support in 6GHz is reused for 5GHz as well if 320MHz is configured. Add the missing 80MHz channels to bw_80_160 array of ibss_mesh_setup_freq(). Signed-off-by: Rameshkumar Sundaram --- src/common/ieee802_11_common.c | 3 ++- wpa_supplicant/ap.c | 5 ++-- wpa_supplicant/wpa_supplicant.c | 51 ++++++++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 19 deletions(-) Index: b/src/common/ieee802_11_common.c =================================================================== --- a/src/common/ieee802_11_common.c 2022-07-14 14:31:03.057966186 +0530 +++ b/src/common/ieee802_11_common.c 2022-07-14 14:31:03.049966278 +0530 @@ -1028,7 +1028,8 @@ enum hostapd_hw_mode ieee80211_freq_to_c if ((freq - 5000) % 5) return NUM_HOSTAPD_MODES; - if (vht_opclass) + /* There is no op class defined for 5 GHz 320MHz, let it be unset */ + if (vht_opclass || chanwidth == CHANWIDTH_320MHZ) *op_class = vht_opclass; else if (sec_channel == 1) *op_class = 122; Index: b/wpa_supplicant/ap.c =================================================================== --- a/wpa_supplicant/ap.c 2022-07-14 14:31:03.057966186 +0530 +++ b/wpa_supplicant/ap.c 2022-07-14 14:31:03.049966278 +0530 @@ -105,9 +105,10 @@ static void wpas_conf_ap_vht(struct wpa_ hostapd_set_oper_centr_freq_seg0_idx(conf, freq_seg_idx); wpa_printf(MSG_DEBUG, - "VHT seg0 index %d and seg1 index %d for AP", + "VHT seg0 index %d and seg1 index %d BW %d for AP", hostapd_get_oper_centr_freq_seg0_idx(conf), - hostapd_get_oper_centr_freq_seg1_idx(conf)); + hostapd_get_oper_centr_freq_seg1_idx(conf), + hostapd_get_oper_chwidth(conf)); return; } Index: b/wpa_supplicant/wpa_supplicant.c =================================================================== --- a/wpa_supplicant/wpa_supplicant.c 2022-07-14 14:31:03.057966186 +0530 +++ b/wpa_supplicant/wpa_supplicant.c 2022-07-14 14:33:12.080479343 +0530 @@ -2509,7 +2509,9 @@ void ibss_mesh_setup_freq(struct wpa_sup /* 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, + 5500, 5560, 5580, 5640, + 5660, 5720, 0, 0, + /* Adding dummy sec80 after channel #144 to keep remining 160MHz array intact */ 5745, 5805, 5825, 5885, 5955, 6015, 6035, 6095, 6115, 6175, 6195, 6255, @@ -2824,16 +2826,33 @@ skip_to_6ghz: } if ((ssid->enable_320mhz_bw) && (mode->eht_capab[ieee80211_mode].phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] & - EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK) && is_6ghz) { - - for (i = 0; i < ARRAY_SIZE(bw_320); i+=2) { - if (freq->freq >= bw_320[i] && - freq->freq <= bw_320[i+1]) - break; + EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) { + if (is_6ghz) { + for (i = 0; i < ARRAY_SIZE(bw_320); i+=2) { + if (freq->freq >= bw_320[i] && + freq->freq <= bw_320[i+1]) + break; + } + + seg0 = ibss_get_center_320mhz(freq->channel); + chwidth = CHANWIDTH_320MHZ; + } else { + /* There is only one 320MHz(240+80 Punctured) in 5 GHz Band */ + u8 start_chan_idx = 100; + if (freq->channel >= 100 && freq->channel <= 144 && (ssid->ru_punct_bitmap & 0xF000) == 0xF000) { + for (i = start_chan_idx; i <= start_chan_idx + 44; i += 4) { + struct hostapd_channel_data *chan; + chan = hw_get_channel_chan(mode, i, NULL); + if (!chan) + return; + if (chan->flag & (HOSTAPD_CHAN_DISABLED| + HOSTAPD_CHAN_NO_IR)) + return; + } + seg0 = 130; + chwidth = CHANWIDTH_320MHZ; + } } - - seg0 = ibss_get_center_320mhz(freq->channel); - chwidth = CHANWIDTH_320MHZ; } if (ssid->max_oper_chwidth == CHANWIDTH_80P80MHZ) {