From patchwork Wed Feb 14 13:51:12 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: 10218947 X-Patchwork-Delegate: johannes@sipsolutions.net 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 6B042601D7 for ; Wed, 14 Feb 2018 13:51:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57AC928517 for ; Wed, 14 Feb 2018 13:51:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C2452896D; Wed, 14 Feb 2018 13:51:20 +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 374D82869D for ; Wed, 14 Feb 2018 13:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030328AbeBNNvQ (ORCPT ); Wed, 14 Feb 2018 08:51:16 -0500 Received: from mail-db5eur01on0114.outbound.protection.outlook.com ([104.47.2.114]:48920 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030221AbeBNNvP (ORCPT ); Wed, 14 Feb 2018 08:51:15 -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=phdKOlMhBThdN4CwIVF4mmUJvhpecO1hFrqqbiyhZ24=; b=BdIHn++fBaA/yLmnzhkYKT3wopdhxVnkXVTwLTN/KG67qPxfVxgRvTbDRT3dd/jFqRiDdo4vtCdzphyNbTL5rK8uBd5sYBx7gxoo3Gk+h0FK4Dvb8Y9jXrmGh0QsgAtp6gEwxs52aiAFUALJoR108inrP1IPhgSnNzMVvBTsGCk= Received: from AM4PR0101MB2305.eurprd01.prod.exchangelabs.com (10.165.38.134) by AM4PR0101MB1651.eurprd01.prod.exchangelabs.com (10.166.129.7) 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 13:51:12 +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 13:51:12 +0000 From: Jean Pierre TOSONI To: Johannes Berg , "linux-wireless@vger.kernel.org" Subject: [PATCH] mac80211: inform wireless layer when frame RSSI is invalid Thread-Topic: [PATCH] mac80211: inform wireless layer when frame RSSI is invalid Thread-Index: AdOlmaIXQj8Y8CV7TKWOOxOMkpv+og== Date: Wed, 14 Feb 2018 13:51:12 +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; AM4PR0101MB1651; 7:sWf3hhHJKODRysPkzSLY76oLn/to+mJFgamCjmeoG3/N/fWWeO0L0RRmKfHTAYvDH+BqenRF/JpVQxnYX3Mmcws8Dvq0EfEIysLVnjLuGNGxfbP1/4cFG5aBIY76ffBmgfEgD/R83737+/zCm0HAW5x1y5jN555rfsNCNe/cjqBcIJ8mg/Zb8GON1khar424Qfxbtgq5tSuDhZ9enbuw3L2RuZKcZET8W6BMR3we0gBbCGT9/ly3cBIJfEZvt3hT x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 223decba-7ab1-4d8c-1c31-08d573b2026b 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:AM4PR0101MB1651; x-ms-traffictypediagnostic: AM4PR0101MB1651: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231101)(944501161)(6041288)(20161123562045)(20161123564045)(2016111802025)(20161123558120)(20161123560045)(6043046)(6072148)(201708071742011); SRVR:AM4PR0101MB1651; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0101MB1651; x-forefront-prvs: 0583A86C08 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39380400002)(396003)(39830400003)(376002)(366004)(199004)(189003)(14454004)(55016002)(86362001)(81156014)(59450400001)(68736007)(6436002)(7696005)(74316002)(53936002)(7736002)(9686003)(81166006)(2906002)(6116002)(305945005)(2900100001)(99286004)(97736004)(26005)(74482002)(316002)(3846002)(5660300001)(102836004)(8676002)(66066001)(6506007)(33656002)(3660700001)(478600001)(25786009)(2501003)(106356001)(5250100002)(3280700002)(1857600001)(186003)(105586002)(8936002)(110136005); DIR:OUT; SFP:1102; SCL:1; SRVR:AM4PR0101MB1651; 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: /HEiucKmqpE3qvBgMN4DUqEs0+oWdEJjyTAOmnmehq5+1tnrgNEGgIWqipTF14vtVubEK/LOirhQjMxA2I410Q== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: acksys.fr X-MS-Exchange-CrossTenant-Network-Message-Id: 223decba-7ab1-4d8c-1c31-08d573b2026b X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Feb 2018 13:51:12.2865 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f18a6414-d5f3-4b5c-9345-f30c01d87e32 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0101MB1651 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 When the low-level driver returns an invalid RSSI indication, set the signal value to 0 as an indication to the upper layer. Also, skip average level computation if signal is invalid. Signed-off-by: Jean Pierre TOSONI --- WARNING: This patch applies to wireless-testing retrieved on Feb 14, 2018 but it was tested on a much older version (OpenWrt kernel 3.18 with compat-wireless-2015-07-21). net/mac80211/mlme.c | 3 +++ net/mac80211/rx.c | 6 ++++-- net/mac80211/scan.c | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) -- 1.7.2.5 diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 39b660b..99ff679 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -3368,6 +3368,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, bssid = ifmgd->associated->bssid; /* Track average RSSI from the Beacon frames of the current AP */ + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) + goto skip_signal_processing; if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; ewma_beacon_signal_init(&ifmgd->ave_beacon_signal); @@ -3454,6 +3456,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, sig, GFP_KERNEL); } } +skip_signal_processing: if (ifmgd->flags & IEEE80211_STA_CONNECTION_POLL) { mlme_dbg_ratelimited(sdata, diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index e755f93..8d63a1b 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2791,7 +2791,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, !(rx->flags & IEEE80211_RX_BEACON_REPORTED)) { int sig = 0; - if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM)) + if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) sig = status->signal; cfg80211_report_obss_beacon(rx->local->hw.wiphy, @@ -3132,7 +3133,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, * it transmitted were processed or returned. */ - if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM)) + if (ieee80211_hw_check(&rx->local->hw, SIGNAL_DBM) && + !(status->flag & RX_FLAG_NO_SIGNAL_VAL)) sig = status->signal; if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig, diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index ef2beca..a3b1bcc 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c @@ -73,7 +73,9 @@ struct ieee80211_bss * bool signal_valid; struct ieee80211_sub_if_data *scan_sdata; - if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) + if (rx_status->flag & RX_FLAG_NO_SIGNAL_VAL) + bss_meta.signal = 0; /* invalid signal indication */ + else if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) bss_meta.signal = rx_status->signal * 100; else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) bss_meta.signal = (rx_status->signal * 100) / local->hw.max_signal;