From patchwork Wed Feb 14 16:26:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre TOSONI X-Patchwork-Id: 10219407 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 BF41A601C2 for ; Wed, 14 Feb 2018 16:26:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF71828A9D for ; Wed, 14 Feb 2018 16:26:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3F3E28AAB; Wed, 14 Feb 2018 16:26:48 +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,DKIM_SIGNED, DKIM_VALID,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 C214E28A9D for ; Wed, 14 Feb 2018 16:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032509AbeBNQ0p (ORCPT ); Wed, 14 Feb 2018 11:26:45 -0500 Received: from mail-db5eur01on0118.outbound.protection.outlook.com ([104.47.2.118]:51456 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1032204AbeBNQ0o (ORCPT ); Wed, 14 Feb 2018 11:26:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ACKSYS.onmicrosoft.com; s=selector1-acksys-fr; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=0L8TFvAgQ82kzpFRDjamcLe6uqxNtx+kuv0LgFb7lN0=; b=CoRjuADilMm6qk+SAXz0IopXqGmHtcioslmdPnL75IwSaL/PAPRUPk36mDuUQdvx+zj9D1o5uGeufMxCxcY2/1SRjI8sVo5KM/rEJ0/fxWFrwxrUHdCxDh3nzaLbXtLPLwDeWexUVWt+CMbHj2XpZDywCxElGLA9S3qwLpByzv4= Received: from AM4PR0101MB2305.eurprd01.prod.exchangelabs.com (10.165.38.134) by AM4PR0101MB1988.eurprd01.prod.exchangelabs.com (10.168.0.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.485.10; Wed, 14 Feb 2018 16:26:42 +0000 Received: from AM4PR0101MB2305.eurprd01.prod.exchangelabs.com ([fe80::d8a:c9fa:642:767c]) by AM4PR0101MB2305.eurprd01.prod.exchangelabs.com ([fe80::d8a:c9fa:642:767c%14]) with mapi id 15.20.0485.017; Wed, 14 Feb 2018 16:26:42 +0000 From: Jean Pierre TOSONI To: Kalle Valo CC: "linux-wireless@vger.kernel.org" , "ath9k-devel@qca.qualcomm.com" Subject: [PATCH v2] ath9k: mark RSSI as invalid if frame received during channel setup Thread-Topic: [PATCH v2] ath9k: mark RSSI as invalid if frame received during channel setup Thread-Index: AdOlryVpbGJlJnB1Sj+E1UrdO6l79w== Date: Wed, 14 Feb 2018 16:26:42 +0000 Message-ID: Accept-Language: fr-FR, en-US Content-Language: fr-FR X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jp.tosoni@acksys.fr; x-originating-ip: [62.193.53.221] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM4PR0101MB1988; 7:IRgxjItPBdV+5bu7AyiOW+8l8ioZwaUQl51h43WkRlWWsVicMJAb2J/CmG789zn/MXW0THUxOlkFzBrfYRppHID0KWo0wz/Gq44jsxG9B2Y/zEaBx2J7DAqnOBRDeDkq8u8q2j12riCJLqjmZxqzMKic1ZnYy9LF55aDZzfYQzDUU2SIVrQV1wcGq/119iyhPEJFcy9CMjcDE+U3UmdH2ou3THIuTrL0IWUoWMV56IJGlLvWYh/DW4m2i2KvC/VT x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 30645abb-a7da-4a0f-28fa-08d573c7bb65 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(5600026)(4604075)(3008032)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(2017052603307)(7153060)(7193020); SRVR:AM4PR0101MB1988; x-ms-traffictypediagnostic: AM4PR0101MB1988: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231101)(944501161)(10201501046)(3002001)(6041288)(2016111802025)(20161123562045)(20161123564045)(20161123558120)(20161123560045)(6072148)(6043046)(201708071742011); SRVR:AM4PR0101MB1988; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0101MB1988; x-forefront-prvs: 0583A86C08 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(346002)(39830400003)(39380400002)(396003)(366004)(199004)(189003)(478600001)(81156014)(74482002)(186003)(102836004)(2900100001)(81166006)(3280700002)(105586002)(316002)(66066001)(97736004)(6506007)(26005)(68736007)(3660700001)(14454004)(8676002)(8936002)(6916009)(54906003)(74316002)(53936002)(4326008)(9686003)(25786009)(305945005)(106356001)(55016002)(7736002)(7696005)(2906002)(3846002)(6116002)(33656002)(86362001)(99286004)(6436002)(5660300001)(5250100002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM4PR0101MB1988; H:AM4PR0101MB2305.eurprd01.prod.exchangelabs.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: acksys.fr does not designate permitted sender hosts) x-microsoft-antispam-message-info: kTFeYwMNoesE8o6L0RxBvwhMq8CZGRQOUj4au1gzfYK/Edf32RzoB5lr4XJzNQQW2Avn/pVR+vN+cynCeY6IIg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: acksys.fr X-MS-Exchange-CrossTenant-Network-Message-Id: 30645abb-a7da-4a0f-28fa-08d573c7bb65 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2018 16:26:42.1354 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f18a6414-d5f3-4b5c-9345-f30c01d87e32 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0101MB1988 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 ath9k returns a wrong RSSI value for frames received in a 30ms time window after a channel change. The correct value is typically 10dB below the returned value. This was found with a Atheros AR9300 Rev:3 chip (WLE350NX / JWX6083 cards), during offchannel scans. Mark the signal value as invalid in this case. Signed-off-by: Jean Pierre TOSONI --- V2: replace LEDE patch with due kernel patch (with excuses to Kalle Valo) drivers/net/wireless/ath/ath9k/ani.c | 1 + drivers/net/wireless/ath/ath9k/common.c | 10 ++++++++++ drivers/net/wireless/ath/ath9k/hw.h | 1 + 3 files changed, 12 insertions(+), 0 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index 5214dd7..a7e07ed 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c @@ -317,6 +317,7 @@ void ath9k_ani_reset(struct ath_hw *ah, bool is_scanning) return; BUG_ON(aniState == NULL); + ah->chan_stable_time = jiffies + (30*HZ)/1000; /* 30ms */ ah->stats.ast_ani_reset++; ofdm_nil = max_t(int, ATH9K_ANI_OFDM_DEF_LEVEL, diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c index 099f3d4..7e5f7a3 100644 --- a/drivers/net/wireless/ath/ath9k/common.c +++ b/drivers/net/wireless/ath/ath9k/common.c @@ -221,6 +221,16 @@ void ath9k_cmn_process_rssi(struct ath_common *common, int i, j; /* + * RSSI is not available before 30ms after reset on ath9k. + */ + if (time_before(jiffies, ah->chan_stable_time)) { + ath_dbg(common, ANY, "early frame rssi=%d\n",rx_stats->rs_rssi); + rxs->flag |= RX_FLAG_NO_SIGNAL_VAL; + return; + } + ah->chan_stable_time = jiffies; /* advance stable time to cop with jiffies wraparound */ + + /* * RSSI is not available for subframes in an A-MPDU. */ if (rx_stats->rs_moreaggr) { diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h index 9804a24..ec07da9 100644 --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h @@ -809,6 +809,7 @@ struct ath_hw { bool reset_power_on; bool htc_reset_init; + unsigned long chan_stable_time; enum nl80211_iftype opmode; enum ath9k_power_mode power_mode;