brcmfmac: Add RSSI information to get_station.
authorHante Meuleman <meuleman@broadcom.com>
Thu, 8 Oct 2015 18:33:17 +0000 (20:33 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 21 Oct 2015 07:56:48 +0000 (10:56 +0300)
Reviewed-by: Arend Van Spriel <arend@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: Hante Meuleman <meuleman@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c

index 73eddaddc6602e2c2d9cf11608683b862e469e93..ca9d2398d026836c3f21ee814800cc2c57974ebe 100644 (file)
@@ -2432,6 +2432,9 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
        struct brcmf_sta_info_le sta_info_le;
        u32 sta_flags;
        u32 is_tdls_peer;
+       s32 total_rssi;
+       s32 count_rssi;
+       u32 i;
 
        brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
        if (!check_vif_up(ifp->vif))
@@ -2492,6 +2495,26 @@ brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *ndev,
                        sinfo->filled |= BIT(NL80211_STA_INFO_RX_BYTES);
                        sinfo->rx_bytes = le64_to_cpu(sta_info_le.rx_tot_bytes);
                }
+               total_rssi = 0;
+               count_rssi = 0;
+               for (i = 0; i < BRCMF_ANT_MAX; i++) {
+                       if (sta_info_le.rssi[i]) {
+                               sinfo->chain_signal_avg[count_rssi] =
+                                       sta_info_le.rssi[i];
+                               sinfo->chain_signal[count_rssi] =
+                                       sta_info_le.rssi[i];
+                               total_rssi += sta_info_le.rssi[i];
+                               count_rssi++;
+                       }
+               }
+               if (count_rssi) {
+                       sinfo->filled |= BIT(NL80211_STA_INFO_CHAIN_SIGNAL);
+                       sinfo->chains = count_rssi;
+
+                       sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+                       total_rssi /= count_rssi;
+                       sinfo->signal = total_rssi;
+               }
        }
 done:
        brcmf_dbg(TRACE, "Exit\n");