* [PATCH v2] brcmfmac: support CQM RSSI notification with older firmware
@ 2023-01-24 10:42 John Keeping
2023-02-13 15:03 ` Kalle Valo
2023-02-27 10:42 ` [v2] wifi: " Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: John Keeping @ 2023-01-24 10:42 UTC (permalink / raw)
To: netdev
Cc: John Keeping, Arend van Spriel, Franky Lin, Hante Meuleman,
Kalle Valo, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alvin Šipraga, linux-wireless,
brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, linux-kernel
Using the BCM4339 firmware from linux-firmware (version "BCM4339/2 wl0:
Sep 5 2019 11:05:52 version 6.37.39.113 (r722271 CY)" from
cypress/cyfmac4339-sdio.bin) the RSSI respose is only 4 bytes, which
results in an error being logged.
It seems that older devices send only the RSSI field and neither SNR nor
noise is included. Handle this by accepting a 4 byte message and
reading only the RSSI from it.
Fixes: 7dd56ea45a66 ("brcmfmac: add support for CQM RSSI notifications")
Signed-off-by: John Keeping <john@metanate.com>
---
v2:
- Cast to __be32* to fix a Sparse warning (kernel test robot)
.../broadcom/brcm80211/brcmfmac/cfg80211.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index b115902eb475..43dc0faee92d 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -6489,18 +6489,20 @@ static s32 brcmf_notify_rssi(struct brcmf_if *ifp,
{
struct brcmf_cfg80211_vif *vif = ifp->vif;
struct brcmf_rssi_be *info = data;
- s32 rssi, snr, noise;
+ s32 rssi, snr = 0, noise = 0;
s32 low, high, last;
- if (e->datalen < sizeof(*info)) {
+ if (e->datalen >= sizeof(*info)) {
+ rssi = be32_to_cpu(info->rssi);
+ snr = be32_to_cpu(info->snr);
+ noise = be32_to_cpu(info->noise);
+ } else if (e->datalen >= sizeof(rssi)) {
+ rssi = be32_to_cpu(*(__be32 *)data);
+ } else {
brcmf_err("insufficient RSSI event data\n");
return 0;
}
- rssi = be32_to_cpu(info->rssi);
- snr = be32_to_cpu(info->snr);
- noise = be32_to_cpu(info->noise);
-
low = vif->cqm_rssi_low;
high = vif->cqm_rssi_high;
last = vif->cqm_rssi_last;
--
2.39.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] brcmfmac: support CQM RSSI notification with older firmware
2023-01-24 10:42 [PATCH v2] brcmfmac: support CQM RSSI notification with older firmware John Keeping
@ 2023-02-13 15:03 ` Kalle Valo
2023-02-27 10:42 ` [v2] wifi: " Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-02-13 15:03 UTC (permalink / raw)
To: John Keeping
Cc: netdev, John Keeping, Arend van Spriel, Franky Lin,
Hante Meuleman, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alvin Šipraga, linux-wireless,
brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, linux-kernel
John Keeping <john@metanate.com> wrote:
> Using the BCM4339 firmware from linux-firmware (version "BCM4339/2 wl0:
> Sep 5 2019 11:05:52 version 6.37.39.113 (r722271 CY)" from
> cypress/cyfmac4339-sdio.bin) the RSSI respose is only 4 bytes, which
> results in an error being logged.
>
> It seems that older devices send only the RSSI field and neither SNR nor
> noise is included. Handle this by accepting a 4 byte message and
> reading only the RSSI from it.
>
> Fixes: 7dd56ea45a66 ("brcmfmac: add support for CQM RSSI notifications")
> Signed-off-by: John Keeping <john@metanate.com>
Arend, could you take a look?
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230124104248.2917465-1-john@metanate.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [v2] wifi: brcmfmac: support CQM RSSI notification with older firmware
2023-01-24 10:42 [PATCH v2] brcmfmac: support CQM RSSI notification with older firmware John Keeping
2023-02-13 15:03 ` Kalle Valo
@ 2023-02-27 10:42 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2023-02-27 10:42 UTC (permalink / raw)
To: John Keeping
Cc: netdev, John Keeping, Arend van Spriel, Franky Lin,
Hante Meuleman, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alvin Šipraga, linux-wireless,
brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, linux-kernel
John Keeping <john@metanate.com> wrote:
> Using the BCM4339 firmware from linux-firmware (version "BCM4339/2 wl0:
> Sep 5 2019 11:05:52 version 6.37.39.113 (r722271 CY)" from
> cypress/cyfmac4339-sdio.bin) the RSSI respose is only 4 bytes, which
> results in an error being logged.
>
> It seems that older devices send only the RSSI field and neither SNR nor
> noise is included. Handle this by accepting a 4 byte message and
> reading only the RSSI from it.
>
> Fixes: 7dd56ea45a66 ("brcmfmac: add support for CQM RSSI notifications")
> Signed-off-by: John Keeping <john@metanate.com>
Patch applied to wireless-next.git, thanks.
ec52d77d0775 wifi: brcmfmac: support CQM RSSI notification with older firmware
--
https://patchwork.kernel.org/project/linux-wireless/patch/20230124104248.2917465-1-john@metanate.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-02-27 10:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 10:42 [PATCH v2] brcmfmac: support CQM RSSI notification with older firmware John Keeping
2023-02-13 15:03 ` Kalle Valo
2023-02-27 10:42 ` [v2] wifi: " Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).