Commit feb45643 authored by Alvin Šipraga's avatar Alvin Šipraga Committed by Kalle Valo

brcmfmac: fix setting of station info chains bitmask

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

Fixes: cae355dc ("brcmfmac: Add RSSI information to get_station.")
Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20210506132010.3964484-1-alsi@bang-olufsen.dk
parent b0b524f0
...@@ -2838,6 +2838,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2838,6 +2838,7 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
count_rssi = 0; count_rssi = 0;
for (i = 0; i < BRCMF_ANT_MAX; i++) { for (i = 0; i < BRCMF_ANT_MAX; i++) {
if (sta_info_le.rssi[i]) { if (sta_info_le.rssi[i]) {
sinfo->chains |= BIT(count_rssi);
sinfo->chain_signal_avg[count_rssi] = sinfo->chain_signal_avg[count_rssi] =
sta_info_le.rssi[i]; sta_info_le.rssi[i];
sinfo->chain_signal[count_rssi] = sinfo->chain_signal[count_rssi] =
...@@ -2848,8 +2849,6 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev, ...@@ -2848,8 +2849,6 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
} }
if (count_rssi) { if (count_rssi) {
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_CHAIN_SIGNAL);
sinfo->chains = count_rssi;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL); sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
total_rssi /= count_rssi; total_rssi /= count_rssi;
sinfo->signal = total_rssi; sinfo->signal = total_rssi;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment