From patchwork Sun Mar 6 19:34:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "lorenzo@kernel.org" X-Patchwork-Id: 1603290 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.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=Uecdi57T; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=klZD0Lkq; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KD5mw4G64z9sFv for ; Wed, 9 Mar 2022 20:02:24 +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:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=1z81zl7oLP71zu5QUDDU7wyX3ZM1BpnfoMsKttDnz7o=; b=Uecdi57T0l5UU6 jpD1ni1/EFoHkC8ebDNuFIybsyi0fluGmlj3MrSVkwVPOJj4tIRg3iz8cdu/5B80+ateaK1CLWDeV ACEqYIehav8CXczUJV8ChEVwCluYMsXt9lBzhi17ksjA6IhnKuW01h4JG4pueSMUh6KIj+sdH0/uo UTHfYw553f9wl0iB9RyJOfoYEK30g/0oEzTwM//h+Lh96Mu0pm0PkYAwGRHgTm1PFZUdBNOUxIJce 1Pe2qzwwFOC8hg4w+aR5YPFJ9LFAsvx3vo7W9gCsHuXJnfN7/y9EKR3w4j1xEAJKU81dDNm5Yv+oW Ukq2V1Hq7PSnUQ/bDXsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRsC2-007olt-AU; Wed, 09 Mar 2022 09:01:14 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQweT-00FFGq-VK for hostap@lists.infradead.org; Sun, 06 Mar 2022 19:34:47 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 579C5B80E69; Sun, 6 Mar 2022 19:34:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6944FC340EC; Sun, 6 Mar 2022 19:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646595280; bh=wXZdtYUXvO1fpehSDuuVnnrpANQgtmEixbb7r+LxYe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=klZD0LkqrgI83yF3R1++2UzvymePf4BTCNLmKgMufYPPIj3CAaJTHnEVT4UR1V0hM PBfcX4FFWIVtfIznYHIILN+Ec11DfngIn406dr9hZZABKAPa8E9FgNvGf76eq24Jow XD758IA8KI7dqCZRmzC/pmZpP7CfnPZWai1FU+4MChn1g34CVN9XYlimsoRdHTImK0 U/fVl6fHSfUyZGlSbqYxWrJuGcUdU4Q92gbtvYvHuGyo7fvcVT5pE4M89VdsTWM9rj hTWkKHN7UMfp3gUTRmIwWrNNU8YPyuR/JNHaBGseWPLWdfeUP5RleijO9zmUdqg9Qh PGTvWavH2tjmw== From: Lorenzo Bianconi To: j@w1.fi Cc: hostap@lists.infradead.org, nbd@nbd.name, lorenzo.bianconi@redhat.com, ryder.lee@mediatek.com, evelyn.tsai@mediatek.com, owen.peng@mediatek.com Subject: [PATCH v2 1/5] DFS: rely on channel_type in dfs_downgrade_bandwidth signature Date: Sun, 6 Mar 2022 20:34:10 +0100 Message-Id: <27a9fe59674c5349c295eee9ad914153a684ab24.1646594636.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220306_113446_329594_772FD070 X-CRM114-Status: GOOD ( 14.41 ) X-Spam-Score: -5.4 (-----) 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: Add the capability to specify all 3 channel type possibilities in dfs_downgrade_bandwidth routine. This is a preliminary change to introduce radar/CAC background detection support. Signed-off-by: Lorenzo Bianconi --- src/ap/dfs.c | 31 ++++++++++++++ 1 file changed, 14 insertions(+), 17 deletions(-) Content analysis details: (-5.4 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at https://www.dnswl.org/, high trust [145.40.68.75 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.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_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.2 DKIMWL_WL_HIGH DKIMwl.org - High trust sender X-Mailman-Approved-At: Wed, 09 Mar 2022 01:01:04 -0800 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 Add the capability to specify all 3 channel type possibilities in dfs_downgrade_bandwidth routine. This is a preliminary change to introduce radar/CAC background detection support. Signed-off-by: Lorenzo Bianconi --- src/ap/dfs.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index f2bc7eeb2..2d0e72bd6 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -969,7 +969,7 @@ int hostapd_dfs_pre_cac_expired(struct hostapd_iface *iface, int freq, static struct hostapd_channel_data * dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, u8 *oper_centr_freq_seg0_idx, - u8 *oper_centr_freq_seg1_idx, int *skip_radar) + u8 *oper_centr_freq_seg1_idx, int *channel_type) { struct hostapd_channel_data *channel; @@ -977,23 +977,22 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel, channel = dfs_get_valid_channel(iface, secondary_channel, oper_centr_freq_seg0_idx, oper_centr_freq_seg1_idx, - *skip_radar ? DFS_AVAILABLE : - DFS_ANY_CHANNEL); + *channel_type); if (channel) { wpa_printf(MSG_DEBUG, "DFS: Selected channel: %d", channel->chan); return channel; } - if (*skip_radar) { - *skip_radar = 0; + if (*channel_type) { + *channel_type = DFS_ANY_CHANNEL; } else { int oper_chwidth; oper_chwidth = hostapd_get_oper_chwidth(iface->conf); if (oper_chwidth == CHANWIDTH_USE_HT) break; - *skip_radar = 1; + *channel_type = DFS_AVAILABLE; hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1); } } @@ -1011,7 +1010,7 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) int secondary_channel; u8 oper_centr_freq_seg0_idx = 0; u8 oper_centr_freq_seg1_idx = 0; - int skip_radar = 0; + int channel_type = DFS_ANY_CHANNEL; int err = 1; /* Radar detected during active CAC */ @@ -1019,14 +1018,13 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) channel = dfs_get_valid_channel(iface, &secondary_channel, &oper_centr_freq_seg0_idx, &oper_centr_freq_seg1_idx, - skip_radar ? DFS_AVAILABLE : - DFS_ANY_CHANNEL); + channel_type); if (!channel) { channel = dfs_downgrade_bandwidth(iface, &secondary_channel, &oper_centr_freq_seg0_idx, &oper_centr_freq_seg1_idx, - &skip_radar); + &channel_type); if (!channel) { wpa_printf(MSG_ERROR, "No valid channel available"); return err; @@ -1060,7 +1058,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) u8 oper_centr_freq_seg0_idx; u8 oper_centr_freq_seg1_idx; u8 new_vht_oper_chwidth; - int skip_radar = 1; + int channel_type = DFS_AVAILABLE; struct csa_settings csa_settings; unsigned int i; int err = 1; @@ -1085,14 +1083,13 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) * uniform spreading. */ if (iface->dfs_domain == HOSTAPD_DFS_REGION_ETSI) - skip_radar = 0; + channel_type = DFS_ANY_CHANNEL; /* Perform channel switch/CSA */ channel = dfs_get_valid_channel(iface, &secondary_channel, &oper_centr_freq_seg0_idx, &oper_centr_freq_seg1_idx, - skip_radar ? DFS_AVAILABLE : - DFS_ANY_CHANNEL); + channel_type); if (!channel) { /* @@ -1100,11 +1097,11 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) * there is another channel where we can switch even if it * requires to perform a CAC first. */ - skip_radar = 0; + channel_type = DFS_ANY_CHANNEL; channel = dfs_downgrade_bandwidth(iface, &secondary_channel, &oper_centr_freq_seg0_idx, &oper_centr_freq_seg1_idx, - &skip_radar); + &channel_type); if (!channel) { /* * Toggle interface state to enter DFS state @@ -1115,7 +1112,7 @@ static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) return 0; } - if (!skip_radar) { + if (channel_type == DFS_ANY_CHANNEL) { iface->freq = channel->freq; iface->conf->channel = channel->chan; iface->conf->secondary_channel = secondary_channel;