From: Alex Shumsky <alexthreed@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: "Alex Shumsky" <alexthreed@gmail.com>,
"Alexey Berezhok" <a@bayrepo.ru>,
"Alvin Šipraga" <ALSI@bang-olufsen.dk>,
"Arend van Spriel" <arend.vanspriel@broadcom.com>,
"Hector Martin" <marcan@marcan.st>, "Janne Grunau" <j@jannau.net>,
"Kalle Valo" <kvalo@kernel.org>, "Kees Cook" <kees@kernel.org>,
"Neal Gompa" <neal@gompa.dev>,
"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
brcm80211-dev-list.pdl@broadcom.com, brcm80211@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: [PATCH] brcmfmac: fix RSSI report in AP mode
Date: Sat, 23 Nov 2024 00:03:46 +0300 [thread overview]
Message-ID: <20241122210346.2848578-1-alexthreed@gmail.com> (raw)
After commit 9a1590934d9a ("brcmfmac: correctly report average RSSI in
station info") it is required from firmware to provide rx_lastpkt_rssi.
If this field is not provided brcmfmac doesn't report any RSSI at all.
Unfortunately some firmwares doesn't provide it. One example is firmware
for BCM43455 found in Raspbberry Pi.
See https://github.com/raspberrypi/linux/issues/4574
Fix it by falling back to rssi field if rx_lastpkt_rssi is not provided
(like it was before 9a1590934d9a).
Fixes: 9a1590934d9a ("brcmfmac: correctly report average RSSI in station info")
Signed-off-by: Alex Shumsky <alexthreed@gmail.com>
---
.../wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 349aa3439502..8fc10858e936 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -3125,6 +3125,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
s32 total_rssi = 0;
s32 count_rssi = 0;
int rssi;
+ int rx_lastpkt_rssi;
u32 i;
brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
@@ -3190,15 +3191,16 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
}
for (i = 0; i < BRCMF_ANT_MAX; i++) {
- if (sta_info_le.rssi[i] == 0 ||
- sta_info_le.rx_lastpkt_rssi[i] == 0)
+ if (sta_info_le.rssi[i] == 0)
continue;
+ rx_lastpkt_rssi = sta_info_le.rx_lastpkt_rssi[i] != 0 ?
+ sta_info_le.rx_lastpkt_rssi[i] :
+ sta_info_le.rssi[i];
sinfo->chains |= BIT(count_rssi);
- sinfo->chain_signal[count_rssi] =
- sta_info_le.rx_lastpkt_rssi[i];
+ sinfo->chain_signal[count_rssi] = rx_lastpkt_rssi;
sinfo->chain_signal_avg[count_rssi] =
sta_info_le.rssi[i];
- total_rssi += sta_info_le.rx_lastpkt_rssi[i];
+ total_rssi += rx_lastpkt_rssi;
total_rssi_avg += sta_info_le.rssi[i];
count_rssi++;
}
--
2.34.1
next reply other threads:[~2024-11-22 21:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 21:03 Alex Shumsky [this message]
2024-11-25 11:58 ` Kalle Valo
2024-11-26 11:13 ` Arend van Spriel
2024-12-09 21:08 ` Alex Shumsky
2024-12-09 21:43 ` KeithG
2024-12-17 18:54 ` Alex Shumsky
2024-12-17 19:45 ` Arend van Spriel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241122210346.2848578-1-alexthreed@gmail.com \
--to=alexthreed@gmail.com \
--cc=ALSI@bang-olufsen.dk \
--cc=a@bayrepo.ru \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211@lists.linux.dev \
--cc=j@jannau.net \
--cc=kees@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=neal@gompa.dev \
--cc=wsa+renesas@sang-engineering.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®