From patchwork Mon Oct 15 05:07:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamizh chelvam X-Patchwork-Id: 10641065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9472157A for ; Mon, 15 Oct 2018 05:08:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8D7C293A9 for ; Mon, 15 Oct 2018 05:08:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABE18293AF; Mon, 15 Oct 2018 05:08:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2739A293A9 for ; Mon, 15 Oct 2018 05:08:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject: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=Vt+iEKX9Ululk2P91qBy/OWvAXR1OYH3ReJnfkMTSvI=; b=CJn R0vfGZQ7d/m1us+vJAShl8rlg9QJnxUsbZm7utOstUt9Gp2e7PxZU9UeZdHb8yFR5FiNTfitzAPdh 2VAEK2Yd1EoYxmYnNftZa38MisxvfjlM8T22qLeKzB3m4dYkaG2o/7Y1DsXuiZaC9YU1RKmn9VmsZ xlq6IgDGjk8c1ICUtofAUd+tACwWiWb7SQfKLmDxz1I32G/1/B1XIDYW8JbU0suiVr8EyXXHfb32P qg1ViKT3+TDSZ9YXkPdKm1v8RCMK9gnAbz/jFdzLq/v0+7tNtwDzaeicQ6z/493mQ2C6oN0k/Aj1d Xfz+z3ag8gUzyYMaNUP7m12KAFOSIFQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBv7B-0003sq-RZ; Mon, 15 Oct 2018 05:08:25 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBv78-0003qS-BD for ath10k@lists.infradead.org; Mon, 15 Oct 2018 05:08:24 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id B8D7760C1C; Mon, 15 Oct 2018 05:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539580089; bh=gLyd0x5nf73ViO8DD6sdvJ86ZplfNLQTBJq1uM2s8u4=; h=From:To:Cc:Subject:Date:From; b=cbzFAhAnD8Oz7gh8/Yjah2JB22b9Nje5a5ZtCY5mEyNd8YY+UcZuMBWgQC5ecJm98 mRwNwazrGNlQW63Do7zfFaauq06sLtS52O1ujg6wHjCh0eBl8K1UQTmjGiNKNSuLMB UZTdQJ4+15tF4oOjT2u3hPdg+w49+hTohQVAOvZc= Received: from cheath10p342229-lin.qca.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: tamizhr@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 560436024C; Mon, 15 Oct 2018 05:08:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539580089; bh=gLyd0x5nf73ViO8DD6sdvJ86ZplfNLQTBJq1uM2s8u4=; h=From:To:Cc:Subject:Date:From; b=cbzFAhAnD8Oz7gh8/Yjah2JB22b9Nje5a5ZtCY5mEyNd8YY+UcZuMBWgQC5ecJm98 mRwNwazrGNlQW63Do7zfFaauq06sLtS52O1ujg6wHjCh0eBl8K1UQTmjGiNKNSuLMB UZTdQJ4+15tF4oOjT2u3hPdg+w49+hTohQVAOvZc= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 560436024C Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=tamizhr@codeaurora.org From: Tamizh chelvam To: ath10k@lists.infradead.org Subject: [PATCH] ath: fix frequent flase radar detection Date: Mon, 15 Oct 2018 10:37:27 +0530 Message-Id: <1539580047-22512-1-git-send-email-tamizhr@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181014_220822_472507_8FE851D6 X-CRM114-Status: GOOD ( 13.77 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Tamizh chelvam MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Many number of false radar detection occurred in a noisy environment in QCA4019, QCA9888 devices. By reducing PRI_TOLERANCE to 6 and flushing out pulse queue by dpd_reset if timestamp between current and previous pulse is lesser than 100ms helps to avoid/reduce this false radar detection in the noisy environment. Tested ath10k hw and fw: * QCA9888(10.4-3.5.1-00052) * QCA4019(10.4-3.2.1.1-00017) * QCA9984(10.4-3.6-00104) * QCA988X(10.2.4-1.0-00041) Tested ath9k hw: AR9300 Signed-off-by: Tamizh chelvam --- drivers/net/wireless/ath/ath.h | 2 ++ drivers/net/wireless/ath/ath10k/mac.c | 4 ++++ drivers/net/wireless/ath/ath9k/init.c | 1 + drivers/net/wireless/ath/dfs_pattern_detector.c | 4 +++- drivers/net/wireless/ath/dfs_pattern_detector.h | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h index 7a364ec..2bf2d0c 100644 --- a/drivers/net/wireless/ath/ath.h +++ b/drivers/net/wireless/ath/ath.h @@ -184,6 +184,8 @@ struct ath_common { int last_rssi; struct ieee80211_supported_band sbands[NUM_NL80211_BANDS]; + + int dfs_pulse_valid_diff_ts; }; static inline const struct ath_ps_ops *ath_ps_ops(struct ath_common *common) diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index a1c2801..c93b81c 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -8275,6 +8275,8 @@ struct ath10k_vif *ath10k_get_arvif(struct ath10k *ar, u32 vdev_id) #define WRD_METHOD "WRDD" #define WRDD_WIFI (0x07) +#define ATH10K_DFS_PULSE_VALID_DIFF_TS 100 + static u32 ath10k_mac_wrdd_get_mcc(struct ath10k *ar, union acpi_object *wrdd) { union acpi_object *mcc_pkg; @@ -8642,6 +8644,8 @@ int ath10k_mac_register(struct ath10k *ar) if (IS_ENABLED(CONFIG_ATH10K_DFS_CERTIFIED)) { /* Init ath dfs pattern detector */ ar->ath_common.debug_mask = ATH_DBG_DFS; + ar->ath_common.dfs_pulse_valid_diff_ts = + ATH10K_DFS_PULSE_VALID_DIFF_TS; ar->dfs_detector = dfs_pattern_detector_init(&ar->ath_common, NL80211_DFS_UNSET); diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index c070a9e..7ea4460 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -696,6 +696,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, common->debug_mask = ath9k_debug; common->btcoex_enabled = ath9k_btcoex_enable == 1; common->disable_ani = false; + common->dfs_pulse_valid_diff_ts = 0; /* * Platform quirks. diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c index d52b31b..3dbf0ab 100644 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c @@ -273,6 +273,7 @@ static void dpd_exit(struct dfs_pattern_detector *dpd) { u32 i; struct channel_detector *cd; + int diff_ts; /* * pulses received for a non-supported or un-initialized @@ -285,8 +286,9 @@ static void dpd_exit(struct dfs_pattern_detector *dpd) if (cd == NULL) return false; + diff_ts = event->ts - dpd->last_pulse_ts; /* reset detector on time stamp wraparound, caused by TSF reset */ - if (event->ts < dpd->last_pulse_ts) + if (diff_ts < dpd->common->dfs_pulse_valid_diff_ts) dpd_reset(dpd); dpd->last_pulse_ts = event->ts; diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.h b/drivers/net/wireless/ath/dfs_pattern_detector.h index 18db6f4..6f419d4 100644 --- a/drivers/net/wireless/ath/dfs_pattern_detector.h +++ b/drivers/net/wireless/ath/dfs_pattern_detector.h @@ -24,7 +24,7 @@ /* tolerated deviation of radar time stamp in usecs on both sides * TODO: this might need to be HW-dependent */ -#define PRI_TOLERANCE 16 +#define PRI_TOLERANCE 6 /** * struct ath_dfs_pool_stats - DFS Statistics for global pools