From patchwork Tue Nov 22 11:05:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zefir Kurtisi X-Patchwork-Id: 9440817 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 09A3460237 for ; Tue, 22 Nov 2016 11:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE41E284E0 for ; Tue, 22 Nov 2016 11:05:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3330284E7; Tue, 22 Nov 2016 11:05:19 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEB92284E0 for ; Tue, 22 Nov 2016 11:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932714AbcKVLFR (ORCPT ); Tue, 22 Nov 2016 06:05:17 -0500 Received: from mail.neratec.com ([46.140.151.2]:14361 "EHLO mail.neratec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932263AbcKVLFQ (ORCPT ); Tue, 22 Nov 2016 06:05:16 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 221C88A01E9; Tue, 22 Nov 2016 12:05:14 +0100 (CET) Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bk7uokxIx0tT; Tue, 22 Nov 2016 12:05:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 03C538A03B5; Tue, 22 Nov 2016 12:05:14 +0100 (CET) X-Virus-Scanned: amavisd-new at neratec.com Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id doG8kVdy2m3J; Tue, 22 Nov 2016 12:05:13 +0100 (CET) Received: from zefir.neratec.local (unknown [192.168.11.169]) by mail.neratec.com (Postfix) with ESMTPSA id D82638A01E9; Tue, 22 Nov 2016 12:05:13 +0100 (CET) From: Zefir Kurtisi To: linux-wireless@vger.kernel.org Cc: kvalo@qca.qualcomm.com, michal.kazior@tieto.com, benjamin@sipsolutions.net Subject: [PATCH] ath9k: feed only active spectral / dfs-detector Date: Tue, 22 Nov 2016 12:05:09 +0100 Message-Id: <1479812709-18875-1-git-send-email-zefir.kurtisi@neratec.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Radar pulse and spectral scan reports are provided by the HW with the ATH9K_RXERR_PHY flag set. Those are forwarded to the dfs-detector and spectral module for further processing. For some older chips, the pre-conditions checked in those modules are ambiguous, since ATH9K_PHYERR_RADAR is used to tag both types. As a result, spectral frames are fed into the dfs-detector and vice versa. This could lead to a false radar detection on a non-DFS channel (which is uncritical), but more relevant it causes useless CPU load for processing invalid frames. This commit ensures that the dfs-detector and spectral collector are only fed when they are active. Signed-off-by: Zefir Kurtisi --- drivers/net/wireless/ath/ath9k/recv.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 6697342..48f8af1 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -867,10 +867,21 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc, * can be dropped. */ if (rx_stats->rs_status & ATH9K_RXERR_PHY) { - ath9k_dfs_process_phyerr(sc, hdr, rx_stats, rx_status->mactime); - if (ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats, rx_status->mactime)) + /* + * DFS and spectral are mutually exclusive + * + * Since some chips use PHYERR_RADAR as indication for both, we + * need to double check which feature is enabled to prevent + * feeding spectral or dfs-detector with wrong frames. + */ + if (hw->conf.radar_enabled) { + ath9k_dfs_process_phyerr(sc, hdr, rx_stats, + rx_status->mactime); + } else if (sc->spec_priv.spectral_mode != SPECTRAL_DISABLED && + ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats, + rx_status->mactime)) { RX_STAT_INC(rx_spectral); - + } return -EINVAL; }