From patchwork Thu May 6 13:20:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 432016 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37B26C433ED for ; Thu, 6 May 2021 13:20:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F382C61104 for ; Thu, 6 May 2021 13:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233407AbhEFNVR (ORCPT ); Thu, 6 May 2021 09:21:17 -0400 Received: from mail-eopbgr40096.outbound.protection.outlook.com ([40.107.4.96]:7687 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231993AbhEFNVQ (ORCPT ); Thu, 6 May 2021 09:21:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q74uDxiOlzeiS/lkoYTZRSMugpnIGEBBExcRXKbxy4L0JNa/8xBgXQ3fbsVGHiN3uRt+gnC9Ha6slIgVhbFWkrwkFO0q3nd/HQg3lA1mp6Ft108rxoHRgSyneyx3t+z9fFg7l0L7Rf56I229hW9ISIpMgyNfMe4nj0j3lCTpMvpt/TlDhzGZ4hz/la3XwihsMOf+4Fm2KfbTOCl2P6kLYJraEfqCQFnvyKLreiaUlksGQ9SyAJ8BigNod1gc7mqASQQFM85IR+d6yQPbOOqlXJzdt8xsni+1zeOSSKb4u9C38+m0D4zYHD07ln9+3FPGZNRHKFwT7LwgaCnp0JUSLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nWgZkNYYiTe4RQ5OhyzEZiTQFltOOT1xvekU68a5EGA=; b=ekdNP5FrCxZhaX785N9myAx8Max4GOrb2P/SttXYkvdGQ/B/9kJ7EZvqO4GMwiSYSsgouX90aLzSWLoVX6moOYv+r6OQFwHhvNMXouV0Phhyt8r5igSGZzC7S0CNcGy5FefF6rWxZ4AynVdll/VJP6QawXZCKsx9dhsbzYF5qA5RkdKNAu4Fim4OwdcA4OTFe7WVuACb+KprwME88KAOnxpjNfxfYg/QCefbOB2fTqslw1W8nAbpwCJ4fwaGtr+XdHdX8Wn9i/eV6x/KyjUQ+b8SjdHbdSJWtbxQ1Fac4cUuQlf9njC7tG1DIkB+8oxMQwBq7pDqy6duzt7N6uFjBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bang-olufsen.dk; dmarc=pass action=none header.from=bang-olufsen.dk; dkim=pass header.d=bang-olufsen.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bang-olufsen.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nWgZkNYYiTe4RQ5OhyzEZiTQFltOOT1xvekU68a5EGA=; b=sxEsrLxoJ91n3iTASy3QUBvCHOLP58aZ0ho7gEcXbFgFVElip62vENvKXmDoAKRYOWzByUOCAW0Am2hBkvrkMecxvk7iG5kNESATxQvpknuGohzQJqPb5gYdcJJHtui+h6eAK+LRl8e2L8j05C2Drx+QMkV40ELcwVPwpmh8k/o= Received: from VI1PR03MB3166.eurprd03.prod.outlook.com (2603:10a6:802:32::30) by VI1PR03MB5135.eurprd03.prod.outlook.com (2603:10a6:803:bc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Thu, 6 May 2021 13:20:12 +0000 Received: from VI1PR03MB3166.eurprd03.prod.outlook.com ([fe80::ddd3:cf29:124a:ef1e]) by VI1PR03MB3166.eurprd03.prod.outlook.com ([fe80::ddd3:cf29:124a:ef1e%4]) with mapi id 15.20.4087.044; Thu, 6 May 2021 13:20:12 +0000 From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-hsien Lin , Wright Feng , Chung-hsien Hsu , Kalle Valo CC: "linux-wireless@vger.kernel.org" , "brcm80211-dev-list.pdl@broadcom.com" , "SHA-cyfmac-dev-list@infineon.com" , =?utf-8?q?Alvin_=C5=A0ipraga?= Subject: [PATCH 1/2] brcmfmac: fix setting of station info chains bitmask Thread-Topic: [PATCH 1/2] brcmfmac: fix setting of station info chains bitmask Thread-Index: AQHXQnqLrkcIm6m/cUuFlqnvRe20bg== Date: Thu, 6 May 2021 13:20:12 +0000 Message-ID: <20210506132010.3964484-1-alsi@bang-olufsen.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.31.1 authentication-results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=bang-olufsen.dk; x-originating-ip: [193.89.194.27] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7f1a74b5-3901-4856-7585-08d91091ae28 x-ms-traffictypediagnostic: VI1PR03MB5135: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: uPNSm+SmH40wG3mh5rEhHS537oXfRF8M980K6CiiIpVugS0aYWmR4JWkVEraLEjkN0wl1C8L18BKHmZBrYdpoK1zyC2h8eLva6Rr2o0nGmpLcwi9IscizQTbbp4h7GGTswUpdD1drJYv+dJbTS02gqTRgQ9A7iZB1JoN9Wkiud7rFEMBegtj5ZbyKSMLtU5XnTkumCNJlxpJdRK378TOzYcc1itSIuw+UItqZhWXuLXoTgBkfQry1sGBky7UbPXLozxPGwI723VVpWuMCGFqVgeh3kPwWoKcOLZ830AivyIYSDGEayebczJBsk3Y0jyUl+C9UQcVEyCEL8eyeIP5YWPvLSO0awGmW3fv7YVmHt/cQ08KXPhxF9gDkaKi1rUuwYty7H/TunW1pIFoBXg+RjYQ6hybuptBdrJ+XmCHG1clONDafUWAoaUnwwEvwK24GVmXd2IDjsy4BhRtM4hEFLzP2rjLLaRwRY31rIksGCnl8Mhvf6Eynan/rTN34/g6jrzOhpYSBYxA1PK0ZJM93ODO4hvmuPDSWD7NHq1zXMEbbhilzkqeqmMIZXYs5SKPWVLOZnkajW8I5rDh//hSaLybxVh6b6I+DDqDs43yBjE= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB3166.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(366004)(136003)(376002)(346002)(396003)(110136005)(4326008)(107886003)(186003)(1076003)(66476007)(6506007)(85202003)(2906002)(478600001)(64756008)(54906003)(83380400001)(76116006)(316002)(66946007)(66556008)(66446008)(36756003)(6486002)(5660300002)(71200400001)(122000001)(2616005)(8936002)(86362001)(6512007)(8676002)(8976002)(85182001)(38100700002)(7416002)(91956017)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?utf-8?q?08DmT1vS3yoNAt/b5cvZxvB0RxL?= =?utf-8?q?xG6IpwdltQrYPlNLe/k2kZYsqEIrKhYF7hpWL4X74We1LsgnA2Zbyaah?= =?utf-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Jd6/K?= =?utf-8?q?GsVHaw9ceAX7YDk2vj3VtY7/sHn5a0DAFnsrXE4VeKaJmZT1Pzs1Lsl7?= =?utf-8?q?+PMScvLI9iRFfQlFVI3rddxiGhndJ+XTFmBU/FDVSCOGMHFW5zhRzw3f?= =?utf-8?q?/Yxl0ec9I48wcFiD2dyoasngDXx1A5UDmnN1CJ/Sglz9BCUoz1MEiod0?= =?utf-8?q?9hZ7zZfnBKeBBxraPG/1raVGvYXx3bHdmKIc9GBIWDtGbFNG9AI8O32b?= =?utf-8?q?9kzPDA6AHnG6aZbwVy70wf3sj0GxPgDb8B74jXrOE/hsaCS8z2AcJZoF?= =?utf-8?q?zH5fLlGtspLJT+DF3H7p36Xk+iefcMJ0DefOUQPr2tckOGUKZ1+inwIm?= =?utf-8?q?8Xstt+SlqZDqEtnOpuMfTYSV+hxTN?= Content-ID: <0C510F9715584341B640A205305C7BC2@eurprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: bang-olufsen.dk X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3166.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f1a74b5-3901-4856-7585-08d91091ae28 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2021 13:20:12.6246 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 210d08b8-83f7-470a-bc96-381193ca14a1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ELxSER4DAhk64H+OJlFwRhcNydhCIJKSUhobWKdmt2sMAPuWYCSkgHAucJqLS56BYof4GkLqMgAjQlHnol21/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB5135 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The sinfo->chains field is a bitmask for filled values in chain_signal and chain_signal_avg, not a count. Treat it as such so that the driver can properly report per-chain RSSI information. Before (MIMO mode): $ iw dev wlan0 station dump ... signal: -51 [-51] dBm After (MIMO mode): $ iw dev wlan0 station dump ... signal: -53 [-53, -54] dBm Signed-off-by: Alvin Šipraga Fixes: cae355dc90db ("brcmfmac: Add RSSI information to get_station.") --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.31.1 diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index f4405d7861b6..afa75cb83221 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2838,6 +2838,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, count_rssi = 0; for (i = 0; i < BRCMF_ANT_MAX; i++) { if (sta_info_le.rssi[i]) { + sinfo->chains |= BIT(count_rssi); sinfo->chain_signal_avg[count_rssi] = sta_info_le.rssi[i]; sinfo->chain_signal[count_rssi] = @@ -2848,8 +2849,6 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, } if (count_rssi) { sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); - sinfo->chains = count_rssi; - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); total_rssi /= count_rssi; sinfo->signal = total_rssi; From patchwork Thu May 6 13:20:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 432449 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22DFDC43461 for ; Thu, 6 May 2021 13:20:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DF41561157 for ; Thu, 6 May 2021 13:20:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233280AbhEFNVT (ORCPT ); Thu, 6 May 2021 09:21:19 -0400 Received: from mail-eopbgr40096.outbound.protection.outlook.com ([40.107.4.96]:7687 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233373AbhEFNVR (ORCPT ); Thu, 6 May 2021 09:21:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fVPzJMeLeLymkgik4F/vp1Ij1IWlNMUiP2jvS4q6g6A+qk68hhWuVlhFDecXyt5gaNaUwb6n4ACDZeX68eznk6D3m+G99OiI+J6yE73po3ZL1HAZQXqQU4wJLgnnSf6YbeYLmKeK1Tbloe5FcR9yJ+Hq35u9UrblUccScCue0qIngkkYy/lYyW1jA17VyB6LdnD71rQ1XIJMnOXW6FWk6Wntm3kbQUHbF9Sr1UUPQvxb14cLOe0EJvU042FffPObCl09g6p9Ko1jEmdqvHKqrKeKWSALbrryTP5wSmcFiFsjBF8T94kcHCnPf5niisVn3jMW1XLmyULoxk2m9r5TjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4lewEenWLO8Zmn2QapUJK4lFm1McL1vhuhuStddHt1w=; b=UhIlkGGQVaKn+vAIyqGhNZah1qoy2S67sRDxYYAEF1LSnaqseMvUdFbyHZQUe0nOSZ+aD4MJdhMcLfHMKg9AnZzOMqgT7L89o2hUczeyvpAfLcE9NeBOu2JmCUAw11arY/GiCto5DBjbTnUB9sqXp4SC2oqw8lWfn8/5Lk4FM4YTo2+JnSCz981wrxe8cD1LEx0j0PNcs0GogXviYLEidvE+4LBKMPuuLWHKGCk158N0fkJSzL36KpAe2iqvzTdoCsZvWYIQrO0g4v5h+ZeekRMxMwBGpjNyJW8LIyl6vIauO0L2uepjMCnNwYQAHqIUdFSYwXDHejILLEsJkWEDZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bang-olufsen.dk; dmarc=pass action=none header.from=bang-olufsen.dk; dkim=pass header.d=bang-olufsen.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bang-olufsen.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4lewEenWLO8Zmn2QapUJK4lFm1McL1vhuhuStddHt1w=; b=i/kQ6ZzOXWUsA96QfVJp1zHRcOvT4y7RMDnKX4ROyhLGDlxBNR1iSsfniDh1zTMLm6XX+Iv/MmLNL9EON5LR0Kh3ksO7X4HGfmF+OpHm9p1hZyUDZGmrPjSBD2elR7hKJ9zWkCvnNZyG2fJxJmy+lE6D0Nlry1BvnWup/K9Y8xk= Received: from VI1PR03MB3166.eurprd03.prod.outlook.com (2603:10a6:802:32::30) by VI1PR03MB5135.eurprd03.prod.outlook.com (2603:10a6:803:bc::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4108.25; Thu, 6 May 2021 13:20:15 +0000 Received: from VI1PR03MB3166.eurprd03.prod.outlook.com ([fe80::ddd3:cf29:124a:ef1e]) by VI1PR03MB3166.eurprd03.prod.outlook.com ([fe80::ddd3:cf29:124a:ef1e%4]) with mapi id 15.20.4087.044; Thu, 6 May 2021 13:20:15 +0000 From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Chi-hsien Lin , Wright Feng , Chung-hsien Hsu , Kalle Valo CC: "linux-wireless@vger.kernel.org" , "brcm80211-dev-list.pdl@broadcom.com" , "SHA-cyfmac-dev-list@infineon.com" , =?utf-8?q?Alvin_=C5=A0ipraga?= Subject: [PATCH 2/2] brcmfmac: correctly report average RSSI in station info Thread-Topic: [PATCH 2/2] brcmfmac: correctly report average RSSI in station info Thread-Index: AQHXQnqLOmBXf+QmGkezfIsJga6FZw== Date: Thu, 6 May 2021 13:20:12 +0000 Message-ID: <20210506132010.3964484-2-alsi@bang-olufsen.dk> References: <20210506132010.3964484-1-alsi@bang-olufsen.dk> In-Reply-To: <20210506132010.3964484-1-alsi@bang-olufsen.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.31.1 authentication-results: gmail.com; dkim=none (message not signed) header.d=none; gmail.com; dmarc=none action=none header.from=bang-olufsen.dk; x-originating-ip: [193.89.194.27] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: d193f3ee-3fe4-4f59-c717-08d91091b00e x-ms-traffictypediagnostic: VI1PR03MB5135: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: E/vEfCUUSsEmPS6tiY3sZeXueZlhRPHgzxv+ccrFYa7U2LBi0d9EXf6p2zxPBvPe8htbHXyzbtA3XbVmtcSf0kjamur0AVa+2V+l+WSG1gvEkBpPar68qCU6bzC09Sc3gTjRGhOX/0A1bSr1vXli1DBz9bGZ+8l9Wnu+71NLVlGzGv2cYAXitvxHCPvrOaZtRdt5MAcAlLba5WfDptBOS6Uk/VvM3VzPHGiEfqUfaKZuRFron6KNsNCCzdd4yoelf/5Tbl93pPKq1mBsfFtqBJuTQQPxTsUe3tVvofoomkh4y75lxbJmbC2cnxXBiiogEREnhLufDFYO2GCt5pgCNX+Z5iZRxJ6jQwvgb364Hs6vKPFsqRhfbdIIXTr2/VvT0fPhv++5vXXvvQNaNBAzvzbMcOgtwY3iuaukwt9BXRXKPxLP7KE1uMg+6jgJuOPm6rePCm1ZTCQbMl8lyDtC920ttLWeAcCIKa2Eex1/I5rELihVRYZ50E+oZBjuS2nS6yc2/jzNTQI/Afq4Tg7x0EFzpzFXffyQ/o6I68Ek9GVP68ajaa1sL1jNnYW60lvyMuaTfUYhzcqnHW8rNYlPNcI/8xeY8YxUo5JSEO7E60g= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR03MB3166.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(366004)(136003)(376002)(346002)(396003)(110136005)(4326008)(107886003)(186003)(1076003)(66476007)(6506007)(85202003)(2906002)(478600001)(64756008)(54906003)(83380400001)(76116006)(316002)(6666004)(66946007)(66556008)(66446008)(36756003)(6486002)(5660300002)(71200400001)(122000001)(2616005)(8936002)(86362001)(6512007)(8676002)(8976002)(85182001)(38100700002)(7416002)(91956017)(26005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?utf-8?q?xGXd9eH5wJfiior4xF90zl1bB9v?= =?utf-8?q?q0EFwkRbam7VlKLpivORX+Zog4n8jH5fDNPxwGS0bi06lQ3X1T1XrZDK?= =?utf-8?q?443zhA/Zj9d1qp/Qbar77hkPgVFDeItyemfhJ7JW3V8wEdIqjeWrgmBW?= =?utf-8?q?kXu1sSon1SqcHXtRZ7PH/TP3P4cN+qlLLDNrOEP4VrSNY1XboIW/MWO2?= =?utf-8?q?f9motj5ft+BU9jrObKsoWEevNQ+XYR1S1r/iW15HzzbYl+V1foY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+5w+iifIMJjDWENnlwMDJ78xI3H5?= =?utf-8?q?0psv3tJQdYFyKrfLZXKjwu0HqpuIQtB4v+V1JG5qhoRLn+u3+twW8nfq?= =?utf-8?q?NSQk7FMmFTJE4ZtIFZi7W5SY/rm4OWiY6lCQpbsW4GIDDuOn1QoQRR6D?= =?utf-8?q?WUYwF/zMN+b+caSY7ZruVyltqiXKH66IFbMB43L3MYOiK5huBhrQk9Gb?= =?utf-8?q?dK2d/Zke3a/vw5nk7zhNhqzSzy20B?= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: bang-olufsen.dk X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: VI1PR03MB3166.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d193f3ee-3fe4-4f59-c717-08d91091b00e X-MS-Exchange-CrossTenant-originalarrivaltime: 06 May 2021 13:20:13.0033 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 210d08b8-83f7-470a-bc96-381193ca14a1 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0kHpkuqDMnCnkJs4b/iJBuk8J2ObMNNUDzyGHGsUZkwrWdUhKf7hmVeO1TTBdr5kZcAD8vwUAPyg+/rCWuPKZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB5135 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The rx_lastpkt_rssi field provided by the firmware is suitable for NL80211_STA_INFO_{SIGNAL,CHAIN_SIGNAL}, while the rssi field is an average. Fix up the assignments and set the correct STA_INFO bits. This lets userspace know that the average RSSI is part of the station info. Signed-off-by: Alvin Šipraga Fixes: cae355dc90db ("brcmfmac: Add RSSI information to get_station.") --- .../broadcom/brcm80211/brcmfmac/cfg80211.c | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) -- 2.31.1 diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index afa75cb83221..d8822a01d277 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2767,8 +2767,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, struct brcmf_sta_info_le sta_info_le; u32 sta_flags; u32 is_tdls_peer; - s32 total_rssi; - s32 count_rssi; + s32 total_rssi_avg = 0; + s32 total_rssi = 0; + s32 count_rssi = 0; int rssi; u32 i; @@ -2834,24 +2835,27 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_BYTES); sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes); } - total_rssi = 0; - count_rssi = 0; for (i = 0; i < BRCMF_ANT_MAX; i++) { - if (sta_info_le.rssi[i]) { - sinfo->chains |= BIT(count_rssi); - sinfo->chain_signal_avg[count_rssi] = - sta_info_le.rssi[i]; - sinfo->chain_signal[count_rssi] = - sta_info_le.rssi[i]; - total_rssi += sta_info_le.rssi[i]; - count_rssi++; - } + if (sta_info_le.rssi[i] == 0 || + sta_info_le.rx_lastpkt_rssi[i] == 0) + continue; + sinfo->chains |= BIT(count_rssi); + sinfo->chain_signal[count_rssi] = + sta_info_le.rx_lastpkt_rssi[i]; + sinfo->chain_signal_avg[count_rssi] = + sta_info_le.rssi[i]; + total_rssi += sta_info_le.rx_lastpkt_rssi[i]; + total_rssi_avg += sta_info_le.rssi[i]; + count_rssi++; } if (count_rssi) { - sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); - total_rssi /= count_rssi; - sinfo->signal = total_rssi; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); + sinfo->filled |= + BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL_AVG); + sinfo->signal = total_rssi / count_rssi; + sinfo->signal_avg = total_rssi_avg / count_rssi; } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED, &ifp->vif->sme_state)) { memset(&scb_val, 0, sizeof(scb_val));