From patchwork Sun Mar 6 19:34:14 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: 1603292 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=rNHQ9yrX; 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=DNZeFawM; 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 4KD5nC1dRCz9sFv for ; Wed, 9 Mar 2022 20:02:39 +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=gyElmVc/NZKRJwe8e1DagEssF6W7c+DVa6Pnm8b67OU=; b=rNHQ9yrXL2hWSe gk87k3hU/53K/1vdcaOkjzJEr+5DKK6xR6MpM+gBX2lQmEH0O2SXA3xlD+p9hFKI3PAfqj3tDteLi 3t7NDtbNtWLEH+zqOFnUoKSVE69ByEgSjOi821XZNeSeTbga3UbqbczUHZfRipcPgYpg7ZVotwNlR MeChomO6nyhjjdNLmGOayfcrGQ4ugUDbabelOmkQu7YY8F+11RxYhzJwZHhcAn6l6C6h+f9/vcoH/ 4nZBcALKaSXuBrhfKH91iVcrjxE2JnPedmP4Yq1MnHvxhGafB8mIIcEwUQjpRhLkzUUwKiUvWGb4D fu4IVlg3dc2GsUdjESMw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRsCe-007otl-8O; Wed, 09 Mar 2022 09:01:52 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nQweY-00FFIu-Sz for hostap@lists.infradead.org; Sun, 06 Mar 2022 19:34:52 +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 62465B80E69; Sun, 6 Mar 2022 19:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88806C340EC; Sun, 6 Mar 2022 19:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646595288; bh=0W8jXv/psdPxZ5+7KH7sl0w3fN1lk/UiX8QBzB9TyHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DNZeFawMw7lu43IWB3crAGNOZRFDlyNdy7b0rVnWJyND7Cs0Fo2HN6tQscFZrhgIB 1XlYbRRaq07EdkmakkU3YpTnRMQy+tUBvstkPiP0PmrX6ulTvWycv5p2W3ET7a8WUl wTlyhP2kogfRvq5uJmwq0i3vXW9tyNzKD15mSRyf1bQ16iQCcfEVLBOpDWabZKbcWK 6SyFORk2cIxJKX0A2wYTSXFuhXYAPzJtk99Bxrc5wk7iavGkGf3jNow7mcXvIYnmGk WosDBEU3T5aHN8UkcPHqmKdRfwU4Hznq4nP2h70g54ubN5DkUe3Ji96LN8ELFnu2N/ Nx4TMzN3I3tCg== 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 5/5] DFS: switch to background radar channel if available Date: Sun, 6 Mar 2022 20:34:14 +0100 Message-Id: <6f18afa3fb1326bab22d199dc4c5007d794f7034.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_113451_265251_8B43B61D X-CRM114-Status: GOOD ( 17.29 ) 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: On radar detection on the main chain switch to the channel monitored by the background chain if we have already performed the CAC there. If a radar pattern is reported on the background chain, just se [...] 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 [2604:1380:4601:e00:0:0:0:1 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 On radar detection on the main chain switch to the channel monitored by the background chain if we have already performed the CAC there. If a radar pattern is reported on the background chain, just select a new random channel according to the regulations for monitoring. Tested-by: Owen Peng Signed-off-by: Lorenzo Bianconi --- src/ap/dfs.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/src/ap/dfs.c b/src/ap/dfs.c index b152dc411..796fd348a 100644 --- a/src/ap/dfs.c +++ b/src/ap/dfs.c @@ -1263,6 +1263,51 @@ static int hostapd_dfs_start_channel_switch_cac(struct hostapd_iface *iface) return err; } +static int +hostapd_dfs_background_start_channel_switch(struct hostapd_iface *iface, + int freq) +{ + if (!(iface->drv_flags2 & WPA_DRIVER_RADAR_BACKGROUND)) + return -1; /* Background radar chain not supported. */ + + wpa_printf(MSG_DEBUG, + "%s called (background CAC active: %s, CSA active: %s)", + __func__, iface->radar_background.cac_started ? "yes" : "no", + hostapd_csa_in_progress(iface) ? "yes" : "no"); + + /* Check if CSA in progress */ + if (hostapd_csa_in_progress(iface)) + return 0; + + if (hostapd_dfs_is_background_event(iface, freq)) { + /* + * Radar pattern is reported on the background chain. + * Just select a new random channel according to the + * regulations for monitoring. + */ + hostpad_dfs_update_background_chain(iface); + return 0; + } + + /* + * If background radar detection is supported and radar channel + * monitored by background chain is available switch to it without + * waiting for the CAC. + */ + if (iface->radar_background.channel == -1) + return -1; /* Background radar chain not available. */ + + if (iface->radar_background.cac_started) { + /* Background channel not available yet. Perform CAC on the + * main chain. + */ + iface->radar_background.temp_ch = 1; + return -1; + } + + return hostapd_dfs_start_channel_switch_background(iface); +} + static int hostapd_dfs_start_channel_switch(struct hostapd_iface *iface) { u8 current_vht_oper_chwidth = hostapd_get_oper_chwidth(iface->conf); @@ -1365,15 +1410,19 @@ int hostapd_dfs_radar_detected(struct hostapd_iface *iface, int freq, if (!res) return 0; - /* Skip if reported radar event not overlapped our channels */ - res = dfs_are_channels_overlapped(iface, freq, chan_width, cf1, cf2); - if (!res) - return 0; + if (!hostapd_dfs_is_background_event(iface, freq)) { + /* Skip if reported radar event not overlapped our channels */ + res = dfs_are_channels_overlapped(iface, freq, chan_width, + cf1, cf2); + if (!res) + return 0; + } - /* radar detected while operating, switch the channel. */ - res = hostapd_dfs_start_channel_switch(iface); + if (hostapd_dfs_background_start_channel_switch(iface, freq)) + /* radar detected while operating, switch the channel. */ + return hostapd_dfs_start_channel_switch(iface); - return res; + return 0; }