Skip to content

Commit 94abd77

Browse files
meijjaaKalle Valo
authored andcommitted
brcmfmac: add fallback for devices that do not report per-chain values
If brcmf_cfg80211_get_station fails to determine the RSSI from the per-chain values get the value individually as a fallback. Fixes: 1f0dc59 ("brcmfmac: rework .get_station() callback") Signed-off-by: Jaap Jan Meijer <[email protected]> Acked-by: Arend van Spriel <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
1 parent b7e7ad6 commit 94abd77

File tree

1 file changed

+16
-0
lines changed
  • drivers/net/wireless/broadcom/brcm80211/brcmfmac

1 file changed

+16
-0
lines changed

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2540,12 +2540,14 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
25402540
const u8 *mac, struct station_info *sinfo)
25412541
{
25422542
struct brcmf_if *ifp = netdev_priv(ndev);
2543+
struct brcmf_scb_val_le scb_val;
25432544
s32 err = 0;
25442545
struct brcmf_sta_info_le sta_info_le;
25452546
u32 sta_flags;
25462547
u32 is_tdls_peer;
25472548
s32 total_rssi;
25482549
s32 count_rssi;
2550+
int rssi;
25492551
u32 i;
25502552

25512553
brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
@@ -2629,6 +2631,20 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
26292631
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
26302632
total_rssi /= count_rssi;
26312633
sinfo->signal = total_rssi;
2634+
} else if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
2635+
&ifp->vif->sme_state)) {
2636+
memset(&scb_val, 0, sizeof(scb_val));
2637+
err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
2638+
&scb_val, sizeof(scb_val));
2639+
if (err) {
2640+
brcmf_err("Could not get rssi (%d)\n", err);
2641+
goto done;
2642+
} else {
2643+
rssi = le32_to_cpu(scb_val.val);
2644+
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
2645+
sinfo->signal = rssi;
2646+
brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
2647+
}
26322648
}
26332649
}
26342650
done:

0 commit comments

Comments
 (0)