350-0001-brcmfmac-add-fallback-for-devices-that-do-not-report.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. From: Jaap Jan Meijer <jjmeijer88@gmail.com>
  2. Date: Thu, 12 May 2016 18:25:08 +0200
  3. Subject: [PATCH] brcmfmac: add fallback for devices that do not report
  4. per-chain values
  5. If brcmf_cfg80211_get_station fails to determine the RSSI from the
  6. per-chain values get the value individually as a fallback.
  7. Fixes: 1f0dc59a6de9 ("brcmfmac: rework .get_station() callback")
  8. Signed-off-by: Jaap Jan Meijer <jjmeijer88@gmail.com>
  9. Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
  10. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  11. ---
  12. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  13. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  14. @@ -2540,12 +2540,14 @@ brcmf_cfg80211_get_station(struct wiphy
  15. const u8 *mac, struct station_info *sinfo)
  16. {
  17. struct brcmf_if *ifp = netdev_priv(ndev);
  18. + struct brcmf_scb_val_le scb_val;
  19. s32 err = 0;
  20. struct brcmf_sta_info_le sta_info_le;
  21. u32 sta_flags;
  22. u32 is_tdls_peer;
  23. s32 total_rssi;
  24. s32 count_rssi;
  25. + int rssi;
  26. u32 i;
  27. brcmf_dbg(TRACE, "Enter, MAC %pM\n", mac);
  28. @@ -2629,6 +2631,20 @@ brcmf_cfg80211_get_station(struct wiphy
  29. sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  30. total_rssi /= count_rssi;
  31. sinfo->signal = total_rssi;
  32. + } else if (test_bit(BRCMF_VIF_STATUS_CONNECTED,
  33. + &ifp->vif->sme_state)) {
  34. + memset(&scb_val, 0, sizeof(scb_val));
  35. + err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_RSSI,
  36. + &scb_val, sizeof(scb_val));
  37. + if (err) {
  38. + brcmf_err("Could not get rssi (%d)\n", err);
  39. + goto done;
  40. + } else {
  41. + rssi = le32_to_cpu(scb_val.val);
  42. + sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
  43. + sinfo->signal = rssi;
  44. + brcmf_dbg(CONN, "RSSI %d dBm\n", rssi);
  45. + }
  46. }
  47. }
  48. done: