Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 94abd778 authored by Jaap Jan Meijer's avatar Jaap Jan Meijer Committed by Kalle Valo
Browse files

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: 1f0dc59a ("brcmfmac: rework .get_station() callback")
Signed-off-by: default avatarJaap Jan Meijer <jjmeijer88@gmail.com>
Acked-by: default avatarArend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent b7e7ad61
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line Diff line number Diff line
@@ -2540,12 +2540,14 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
			   const u8 *mac, struct station_info *sinfo)
			   const u8 *mac, struct station_info *sinfo)
{
{
	struct brcmf_if *ifp = netdev_priv(ndev);
	struct brcmf_if *ifp = netdev_priv(ndev);
	struct brcmf_scb_val_le scb_val;
	s32 err = 0;
	s32 err = 0;
	struct brcmf_sta_info_le sta_info_le;
	struct brcmf_sta_info_le sta_info_le;
	u32 sta_flags;
	u32 sta_flags;
	u32 is_tdls_peer;
	u32 is_tdls_peer;
	s32 total_rssi;
	s32 total_rssi;
	s32 count_rssi;
	s32 count_rssi;
	int rssi;
	u32 i;
	u32 i;


	brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
	brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
@@ -2629,6 +2631,20 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
			sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
			sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
			total_rssi /= count_rssi;
			total_rssi /= count_rssi;
			sinfo->signal = total_rssi;
			sinfo->signal = total_rssi;
		} else if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
			&ifp->vif->sme_state)) {
			memset(&scb_val, 0, sizeof(scb_val));
			err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
						     &scb_val, sizeof(scb_val));
			if (err) {
				brcmf_err("Could not get rssi (%d)\n", err);
				goto done;
			} else {
				rssi = le32_to_cpu(scb_val.val);
				sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
				sinfo->signal = rssi;
				brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
			}
		}
		}
	}
	}
done:
done: