From patchwork Wed Feb 15 17:02:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Cavallari X-Patchwork-Id: 1742976 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=VLmQOv7h; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PH4LK3Crmz23r4 for ; Thu, 16 Feb 2023 04:09:13 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ypQtAMDQdIhtd62woGtdCWrbG++DgdtXR80HqcCeKuo=; b=VLmQOv7hdG19i9 Zh7knb+WbH8xZNXlU71Kfbgv8JWZ+nJ5kfy70XolTkP32ucyEabHEtdncWVaGiHMcb/JjaW0HN/uK VWfAOiiBryISHhIdzvLRaybDqTN85qJ475dWjBd24hs+yPTWTInOKUPD8cntDHc4y5LntI22oYFaT ZJY7QyL1ix4WC9ZobvfiyQ0ht4+K9iYSizteRw6yOVhY06OyPrmlL16V2TGwZZ8Em3OmEmksUmWjj IKjkZPHRyZKV8E0nwZODmtDsXOfK5mqW0ukKA+bNQtlNMxiUC0iT1d6U2WMwOKM/HArD4xSjzD3bE 5oksyY/XBVyO9LnKT7lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSLGQ-006caL-R0; Wed, 15 Feb 2023 17:08:14 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pSLGM-006cYr-9v for hostap@lists.infradead.org; Wed, 15 Feb 2023 17:08:12 +0000 Received: from evilbit.green-communications.fr ([92.154.77.116]) by mrelayeu.kundenserver.de (mreue009 [213.165.67.103]) with ESMTPSA (Nemesis) id 1Mi2BV-1oxO9h1Xnt-00e7a0; Wed, 15 Feb 2023 18:08:00 +0100 From: Nicolas Cavallari To: hostap@lists.infradead.org Subject: [PATCH 4/4] wpa_supplicant: Rework ibss/mesh 80 MHz channel selection. Date: Wed, 15 Feb 2023 18:02:53 +0100 Message-Id: <20230215170253.13949-4-nicolas.cavallari@green-communications.fr> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230215170253.13949-1-nicolas.cavallari@green-communications.fr> References: <20230215170253.13949-1-nicolas.cavallari@green-communications.fr> MIME-Version: 1.0 X-Provags-ID: V03:K1:3d50ypbxDUubq8ahNEaKoX3h8Dum3RqcBr66I5bCT7lyAuhepkR ZArP7PpAfqpqF8dHEoFKkD4ygrxivEcf3T0cHnuFlbNqm2NmO+GwH7ptYnsKoXmq1sGM7yq 6xTzfA80iG4RsHnzUtjZBVU6P2LAZqxp088NvSdueIyiGbUf6HRDKQQccPZw1mCV2rYTIbh Bzwka+XD+Ru3rbUnozUHg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:0Wtu2S2gRkU=;HTtU+lKNI9lAAX47D8C7FK8G+qx JcTs9HOzbtF2Hkc8dpoUhA9bDW8Mn6JTTgCRmCnUGQ35REpVsUvNdC5+2/FcrlS6k6IPn52Nb x50r74cMn9CQDKcfcPx9BzX1SyYQyNSnAOfRdTSdt4c9h+RksDG4HK6x7d0mHPNZaGEyvHsCs FWSCVUBXEjA91721alScQCya+NjMqefAeb5sSoHdSnPNbJrkGo63YNC70rJbDoZ6dYoKpDS9C tupOcN4GNIj95V1EDaL87jcBi7fTsSmFxfFS1gH5NyK3zC3G0nWjNDYnmi9toBv2ctnSy/vb8 shNXEx/8G+h5f17BpLKko7WThXLsY9efiaD6dgWQB81xaaeZm0EpsAHOqu6jAw+v9Gq/UpAKf 06J3OKQPm7aTxbYxJmtp6Hg0ZQVm1XM9poRiu4TcqF1OhLKqRvqRiIMOcoVQAB15qL0vx9fXf d1Mp8QeGRscxO3ZRxvMWFMWL18MWHwF759jjcR4ZlNnadeNaXpvoMhSthPBm/uJ8ny+PdUFG2 P5gbSIEt3OhWsCPGLagMK0jhqA0oiI6A+XQx1VwX+wRoEbgxjC+4xbGYJISctk9KpsGgYSaTb 4XIh0EUHC9oNHkp4QE/4whbzjXrRV5833fM4mQSuoJXxq2HNRLI62KEfRlzWBM7RRom5fQuHc eoXfY4TA6/C/Nx6HIyD0DkP2DdBuO4Q0d/pXDM1/mg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230215_090810_671367_D44E1419 X-CRM114-Status: GOOD ( 17.70 ) X-Spam-Score: -0.0 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: - Do not try to enable 80 MHz if 40 MHz is disabled or not selected (due to e.g. obss_scan). - If it is not possible to use 80 HMz or even 40 MHz, then still attempt to configure HE40/VHT40/HE20/VHT20 [...] Content analysis details: (-0.0 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.126.133 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [212.227.126.133 listed in wl.mailspike.net] X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org - Do not try to enable 80 MHz if 40 MHz is disabled or not selected (due to e.g. obss_scan). - If it is not possible to use 80 HMz or even 40 MHz, then still attempt to configure HE40/VHT40/HE20/VHT20 instead of bailing out. - When bailing out, also disable HE. Signed-off-by: Nicolas Cavallari --- wpa_supplicant/wpa_supplicant.c | 53 +++++++++++++++++---------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 9ed79abab..66a27468f 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2852,13 +2852,22 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, u32 vht_caps = 0; u8 channel = freq->channel; + if (!freq->vht_enabled && !freq->he_enabled) + return true; + vht_freq = *freq; - /* 6 GHz does not have VHT enabled, so allow that exception here. */ - if (!freq->he_enabled && is_6ghz) - return false; - if (!vht_freq.vht_enabled && !is_6ghz) - return false; + chwidth = CONF_OPER_CHWIDTH_USE_HT; + seg0 = freq->channel + 2 * freq->sec_channel_offset; + seg1 = 0; + if (freq->sec_channel_offset == 0) { + seg0 = 0; + /* Don't try 80 MHz if 40 MHz failed, except in 6 GHz */ + if (freq->ht_enabled && !is_6ghz) + goto skip_80mhz; + } + if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_USE_HT) + goto skip_80mhz; /* setup center_freq1, bandwidth */ for (j = 0; j < ARRAY_SIZE(bw80); j++) { @@ -2869,26 +2878,24 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, if (j == ARRAY_SIZE(bw80) || ieee80211_freq_to_chan(bw80[j], &channel) == NUM_HOSTAPD_MODES) - return false; + goto skip_80mhz; - /* Back to HT configuration if channel not usable */ + /* Use 40 MHz if channel not usable */ if (!ibss_mesh_is_80mhz_avail(channel, mode)) - return false; + goto skip_80mhz; chwidth = CONF_OPER_CHWIDTH_80MHZ; seg0 = channel + 6; seg1 = 0; + /* In 160 MHz, the initial four 20 MHz channels were validated + * above. If 160 MHz is supported, check the remaining four 20 MHz + * channels for the total of 160 MHz bandwidth for 6 GHz. + */ if ((mode->he_capab[ieee80211_mode].phy_cap[ HE_PHYCAP_CHANNEL_WIDTH_SET_IDX] & - HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz) { - /* 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)) - return false; - + HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G) && is_6ghz && + ibss_mesh_is_80mhz_avail(channel + 16, mode)) { for (j = 0; j < ARRAY_SIZE(bw160); j++) { if (freq->freq == bw160[j]) { chwidth = CONF_OPER_CHWIDTH_160MHZ; @@ -2907,7 +2914,7 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, if (ieee80211_freq_to_chan(bw80[k], &channel) == NUM_HOSTAPD_MODES) - return false; + break; for (i = channel; i < channel + 16; i += 4) { struct hostapd_channel_data *chan; @@ -2942,19 +2949,13 @@ static bool ibss_mesh_select_80_160mhz(struct wpa_supplicant *wpa_s, vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; seg0 = 114; } - } else if (ssid->max_oper_chwidth == CONF_OPER_CHWIDTH_USE_HT) { - chwidth = CONF_OPER_CHWIDTH_USE_HT; - seg0 = channel + 2; -#ifdef CONFIG_HT_OVERRIDES - if (ssid->disable_ht40) - seg0 = 0; -#endif /* CONFIG_HT_OVERRIDES */ } +skip_80mhz: if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq, freq->channel, ssid->enable_edmg, ssid->edmg_channel, freq->ht_enabled, - vht_freq.vht_enabled, freq->he_enabled, + freq->vht_enabled, freq->he_enabled, false, freq->sec_channel_offset, chwidth, seg0, seg1, vht_caps, @@ -3026,7 +3027,7 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, ibss_mesh_select_40mhz(wpa_s, ssid, mode, freq, obss_scan); if (!ibss_mesh_select_80_160mhz(wpa_s, ssid, mode, freq, ieee80211_mode, is_6ghz)) - freq->vht_enabled = false; + freq->he_enabled = freq->vht_enabled = false; } }