From patchwork Thu Dec 28 14:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Otcheretianski, Andrei" X-Patchwork-Id: 1880858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org 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=snL22rJ4; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=K9Q+q2++; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=d+hcUXMk; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4T19GD4ml7z23dZ for ; Fri, 29 Dec 2023 01:03:31 +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:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=oGEfBMMWHU8Lcu81Hbu6uPjbusYercJdVvWYjoa7hVo=; b=snL22rJ4lkWc/n +FLvsnvZp5OllGeaWDgAt1LdLCQHgIJT+ScFdUafBi/3/WhZDeNNQn7Ujozygt9gJVpRFRDHyHWXk xjnktRzMKxVkjBBlf5I0QVc7kYfBS0e4COWMDrbBgrgk9eaN7RHnJasig3xetcRHPWf6fd8xtxbeZ tlHwABgOkSOyIWgQW7Kq9pDPAcyfX5HCl28SZycYIL+nPOVICUWvM7vw3ZEhi0YE4bw1nVaAWugpj jWRVTDv3kdCKVBPxs0C0/kLKAOXpcnCpK1L8i8HDQ06Z8+j1qbARFEKaNShUTefsgLUxTrQOoBo7m CJbBXJAnvVE8qCkeiunA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rIqy8-00GyNc-3A; Thu, 28 Dec 2023 14:02:40 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rIqy7-00GyNV-2g for hostap@bombadil.infradead.org; Thu, 28 Dec 2023 14:02:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=gHxSFPvYO9/NEVWE/GJh1Bvfjtj3Bm1o545iXsJrSj8=; b=K9Q+q2++EwDafx8hYH+iKP8HN5 02E3iw27vir1yagbwuJLif7evFP+fCAJSCPOCmudosIEqi51OZk+v036I4QSofhRx1TqoTLOjk0ur dLbQBIFRr1dlFAzE93WYoABOCfkbPz7RksJ49cDEYKvL5/W6uTf6y5aWHRZ9c7+ox+8aJyvpnhmV7 C+7S5AZYWG7Ah/lbUSwnTiCgGLDS2BcIsInPEtEA4537zTkbhIgpbsmI0IK8YVCK2rzRzpGHHaggB Ki/V3cSz9Uq89RdBL0R0q9zX7uLpIb+Bdl6kvIDXH2vdFbbGnE+XugWs/Pol03QIel62la2CyHx8E /6kY0cAQ==; Received: from mgamail.intel.com ([198.175.65.9]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rIqy2-001DLY-2o for hostap@lists.infradead.org; Thu, 28 Dec 2023 14:02:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703772155; x=1735308155; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Tlxy0R66NhzPbWAFZh3eqSXbQ8M1ITixUA7nY4LBd9Q=; b=d+hcUXMkeNmqSoznAOaOzJbUTYVYIp9DYCyY6EdICMEsNRxC+GoWhnKd ZP1oTgnyXigaeFo2jVUzk0bA+kF2j1dNXy0V2wxDaQVgXEXuLcRmLOXPL /45IS+bklxNG+HSEwDz6daza2uQKBsT51BfYdQ9wikM3QXal0a1LkjPQ5 UF0Uw2+PvuEhbRDQcd/bvuecSVLhSyM5In4Jltre2enHTy8Xz8+mryGHm GDJsFZAfgPk2bRniGce1DQ9F1H3RQq8N7VEzQ5BSXzoAwKjAQBind4qpA V5lrRhnHZHY4QfJFl7cr/HD5ASzg8gutjw2xUcg2e0tebeIs2GK6QppgF g==; X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="15204832" X-IronPort-AV: E=Sophos;i="6.04,312,1695711600"; d="scan'208";a="15204832" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 06:01:38 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10936"; a="922104435" X-IronPort-AV: E=Sophos;i="6.04,312,1695711600"; d="scan'208";a="922104435" Received: from unknown (HELO WEIS0042.iil.intel.com) ([10.12.217.211]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Dec 2023 06:01:36 -0800 From: Andrei Otcheretianski To: hostap@lists.infradead.org Cc: Ilan Peer Subject: [PATCH] AP: Avoid disabling HT/VHT/HE/EHT during CSA Date: Thu, 28 Dec 2023 16:01:04 +0200 Message-ID: <20231228140104.2505681-1-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231228_140235_445967_B138A8D4 X-CRM114-Status: GOOD ( 20.84 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.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: From: Ilan Peer During CSA an AP should not disable its HT/VHT/HE/EHT capabilities as it is not allowed by the IEEE80211 specification. - Modify the CSA flow to preserve the current HT/VHT/HE/EHT capabilities allowing only to add additional ones. - Update the DFS CSA flow to also preserve the HT/VHT/HE/EHT capabilities. Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender 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 From: Ilan Peer During CSA an AP should not disable its HT/VHT/HE/EHT capabilities as it is not allowed by the IEEE80211 specification. - Modify the CSA flow to preserve the current HT/VHT/HE/EHT capabilities allowing only to add additional ones. - Update the DFS CSA flow to also preserve the HT/VHT/HE/EHT capabilities. Modify one of the hwsim tests that verified that VHT capabilities are disabled during CSA, to verify that they are kept. Signed-off-by: Ilan Peer --- hostapd/ctrl_iface.c | 34 +++++++++++++++++++++-- src/ap/ap_config.h | 23 ++++++---------- src/ap/dfs.c | 9 ++++++ src/ap/drv_callbacks.c | 56 +++++++++----------------------------- src/ap/hostapd.c | 25 ++++++----------- tests/hwsim/test_ap_vht.py | 8 +++--- 6 files changed, 74 insertions(+), 81 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index f9a78651ca..e654d932c7 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2603,6 +2603,26 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, break; } + if (!settings.freq_params.ht_enabled && iface->conf->ieee80211n) { + wpa_printf(MSG_WARNING, "CSA: Cannot disable HT. Ignore"); + settings.freq_params.ht_enabled = iface->conf->ieee80211n; + } + + if (!settings.freq_params.vht_enabled && iface->conf->ieee80211ac) { + wpa_printf(MSG_WARNING, "CSA: Cannot disable VHT. Ignore"); + settings.freq_params.vht_enabled = iface->conf->ieee80211ac; + } + + if (!settings.freq_params.he_enabled && iface->conf->ieee80211ax) { + wpa_printf(MSG_WARNING, "CSA: Cannot disable HE. Ignore"); + settings.freq_params.he_enabled = iface->conf->ieee80211ax; + } + + if (!settings.freq_params.eht_enabled && iface->conf->ieee80211be) { + wpa_printf(MSG_WARNING, "CSA: Cannot disable EHT. Ignore"); + settings.freq_params.eht_enabled = iface->conf->ieee80211be; + } + if (settings.freq_params.center_freq1) dfs_range += hostapd_is_dfs_overlap( iface, bandwidth, settings.freq_params.center_freq1); @@ -2614,6 +2634,18 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, dfs_range += hostapd_is_dfs_overlap( iface, bandwidth, settings.freq_params.center_freq2); + /* If VHT/HE/EHT was enabled, we must also set the bandwidth and center + * frequency + */ + if ((settings.freq_params.vht_enabled || + settings.freq_params.he_enabled || + settings.freq_params.eht_enabled) && + (!settings.freq_params.bandwidth || + !settings.freq_params.center_freq1)) { + settings.freq_params.bandwidth = 20; + settings.freq_params.center_freq1 = settings.freq_params.freq; + } + if (dfs_range) { ret = ieee80211_freq_to_chan(settings.freq_params.freq, &chan); if (ret == NUM_HOSTAPD_MODES) { @@ -2641,8 +2673,6 @@ static int hostapd_ctrl_iface_chan_switch(struct hostapd_iface *iface, } for (i = 0; i < iface->num_bss; i++) { - - /* Save CHAN_SWITCH VHT, HE, and EHT config */ hostapd_chan_switch_config(iface->bss[i], &settings.freq_params); diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h index 1d39495595..baf2ebb8bf 100644 --- a/src/ap/ap_config.h +++ b/src/ap/ap_config.h @@ -1164,16 +1164,14 @@ struct hostapd_config { bool require_he; #endif /* CONFIG_IEEE80211AX */ - - /* VHT enable/disable config from CHAN_SWITCH */ -#define CH_SWITCH_VHT_ENABLED BIT(0) -#define CH_SWITCH_VHT_DISABLED BIT(1) - unsigned int ch_switch_vht_config; - - /* HE enable/disable config from CHAN_SWITCH */ -#define CH_SWITCH_HE_ENABLED BIT(0) -#define CH_SWITCH_HE_DISABLED BIT(1) - unsigned int ch_switch_he_config; + /* + * Save the expected HT/VHT/HE/EHT configuration so it could be used + * once CSA is done + */ + unsigned int ch_switch_ht_config:1; + unsigned int ch_switch_vht_config:1; + unsigned int ch_switch_he_config:1; + unsigned int ch_switch_eht_config:1; int rssi_reject_assoc_rssi; int rssi_reject_assoc_timeout; @@ -1202,11 +1200,6 @@ struct hostapd_config { u8 eht_bw320_offset; #endif /* CONFIG_IEEE80211BE */ - /* EHT enable/disable config from CHAN_SWITCH */ -#define CH_SWITCH_EHT_ENABLED BIT(0) -#define CH_SWITCH_EHT_DISABLED BIT(1) - unsigned int ch_switch_eht_config; - enum mbssid { MBSSID_DISABLED = 0, MBSSID_ENABLED = 1, diff --git a/src/ap/dfs.c b/src/ap/dfs.c index 18cb355a75..a91eb22475 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1016,7 +1016,16 @@ static int hostapd_dfs_request_channel_switch(struct hostapd_iface *iface, return err; } + /* preserve the HT/VHT/HE/EHT configuration */ + csa_settings.freq_params.ht_enabled = iface->conf->ieee80211n; + csa_settings.freq_params.vht_enabled = iface->conf->ieee80211ac; + csa_settings.freq_params.he_enabled = iface->conf->ieee80211ax; + csa_settings.freq_params.eht_enabled = iface->conf->ieee80211be; + for (i = 0; i < iface->num_bss; i++) { + hostapd_chan_switch_config(iface->bss[i], + &csa_settings.freq_params); + err = hostapd_switch_channel(iface->bss[i], &csa_settings); if (err) break; diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 210068a94d..f30fa364da 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1036,7 +1036,9 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, "driver %s channel switch: iface->freq=%d, freq=%d, ht=%d, vht_ch=0x%x, he_ch=0x%x, eht_ch=0x%x, offset=%d, width=%d (%s), cf1=%d, cf2=%d, puncturing_bitmap=0x%x", finished ? "had" : "starting", hapd->iface->freq, - freq, ht, hapd->iconf->ch_switch_vht_config, + freq, + hapd->iconf->ch_switch_ht_config, + hapd->iconf->ch_switch_vht_config, hapd->iconf->ch_switch_he_config, hapd->iconf->ch_switch_eht_config, offset, width, channel_width_to_string(width), cf1, cf2, @@ -1111,49 +1113,17 @@ void hostapd_event_ch_switch(struct hostapd_data *hapd, int freq, int ht, } hapd->iconf->channel = channel; - hapd->iconf->ieee80211n = ht; - if (!ht) - hapd->iconf->ieee80211ac = 0; - if (hapd->iconf->ch_switch_vht_config) { - /* CHAN_SWITCH VHT config */ - if (hapd->iconf->ch_switch_vht_config & - CH_SWITCH_VHT_ENABLED) - hapd->iconf->ieee80211ac = 1; - else if (hapd->iconf->ch_switch_vht_config & - CH_SWITCH_VHT_DISABLED) - hapd->iconf->ieee80211ac = 0; - } - if (hapd->iconf->ch_switch_he_config) { - /* CHAN_SWITCH HE config */ - if (hapd->iconf->ch_switch_he_config & - CH_SWITCH_HE_ENABLED) { - hapd->iconf->ieee80211ax = 1; - if (hapd->iface->freq > 4000 && - hapd->iface->freq < 5895) - hapd->iconf->ieee80211ac = 1; - } - else if (hapd->iconf->ch_switch_he_config & - CH_SWITCH_HE_DISABLED) - hapd->iconf->ieee80211ax = 0; - } -#ifdef CONFIG_IEEE80211BE - if (hapd->iconf->ch_switch_eht_config) { - /* CHAN_SWITCH EHT config */ - if (hapd->iconf->ch_switch_eht_config & - CH_SWITCH_EHT_ENABLED) { - hapd->iconf->ieee80211be = 1; - hapd->iconf->ieee80211ax = 1; - if (!is_6ghz_freq(hapd->iface->freq) && - hapd->iface->freq > 4000) - hapd->iconf->ieee80211ac = 1; - } else if (hapd->iconf->ch_switch_eht_config & - CH_SWITCH_EHT_DISABLED) - hapd->iconf->ieee80211be = 0; + hapd->iconf->ieee80211n = hapd->iconf->ch_switch_ht_config; + hapd->iconf->ieee80211ac = hapd->iconf->ch_switch_vht_config; + hapd->iconf->ieee80211ax = hapd->iconf->ch_switch_he_config; + hapd->iconf->ieee80211be = hapd->iconf->ch_switch_eht_config; + + if (finished) { + hapd->iconf->ch_switch_ht_config = 0; + hapd->iconf->ch_switch_vht_config = 0; + hapd->iconf->ch_switch_he_config = 0; + hapd->iconf->ch_switch_eht_config = 0; } -#endif /* CONFIG_IEEE80211BE */ - hapd->iconf->ch_switch_vht_config = 0; - hapd->iconf->ch_switch_he_config = 0; - hapd->iconf->ch_switch_eht_config = 0; if (width == CHAN_WIDTH_40 || width == CHAN_WIDTH_80 || width == CHAN_WIDTH_80P80 || width == CHAN_WIDTH_160 || diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 6a9b07e864..83ec043ba1 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -4034,27 +4034,18 @@ void hostapd_cleanup_cs_params(struct hostapd_data *hapd) void hostapd_chan_switch_config(struct hostapd_data *hapd, struct hostapd_freq_params *freq_params) { - if (freq_params->eht_enabled) - hapd->iconf->ch_switch_eht_config |= CH_SWITCH_EHT_ENABLED; - else - hapd->iconf->ch_switch_eht_config |= CH_SWITCH_EHT_DISABLED; - - if (freq_params->he_enabled) - hapd->iconf->ch_switch_he_config |= CH_SWITCH_HE_ENABLED; - else - hapd->iconf->ch_switch_he_config |= CH_SWITCH_HE_DISABLED; - - if (freq_params->vht_enabled) - hapd->iconf->ch_switch_vht_config |= CH_SWITCH_VHT_ENABLED; - else - hapd->iconf->ch_switch_vht_config |= CH_SWITCH_VHT_DISABLED; + hapd->iconf->ch_switch_ht_config = freq_params->ht_enabled; + hapd->iconf->ch_switch_vht_config = freq_params->vht_enabled; + hapd->iconf->ch_switch_he_config = freq_params->he_enabled; + hapd->iconf->ch_switch_eht_config = freq_params->eht_enabled; hostapd_logger(hapd, NULL, HOSTAPD_MODULE_IEEE80211, HOSTAPD_LEVEL_INFO, - "CHAN_SWITCH EHT config 0x%x HE config 0x%x VHT config 0x%x", - hapd->iconf->ch_switch_eht_config, + "CHAN_SWITCH: config: ht=%u, vht=%u, he=%u, eht=%u", + hapd->iconf->ch_switch_ht_config, + hapd->iconf->ch_switch_vht_config, hapd->iconf->ch_switch_he_config, - hapd->iconf->ch_switch_vht_config); + hapd->iconf->ch_switch_eht_config); } diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index 2a7da8f68c..a6ef121229 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -969,8 +969,8 @@ def test_ap_vht_csa_vht20(dev, apdev): dev[0].flush_scan_cache() dev[1].flush_scan_cache() -def test_ap_vht_csa_vht40_disable(dev, apdev): - """VHT CSA with VHT40 getting disabled""" +def test_ap_vht_csa_vht40_unchanged(dev, apdev): + """VHT CSA with VHT not specified. Verify the VHT was not disabled""" csa_supported(dev[0]) try: hapd = None @@ -1014,8 +1014,8 @@ def test_ap_vht_csa_vht40_disable(dev, apdev): dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200") hwsim_utils.test_connectivity(dev[1], hapd) - if dev[1].get_status_field("ieee80211ac") == '1': - raise Exception("VHT not disabled as part of channel switch") + if dev[1].get_status_field("ieee80211ac") != '1': + raise Exception("VHT unexpectedly disabled as part of channel switch") finally: dev[0].request("DISCONNECT") dev[1].request("DISCONNECT")