2
0

330-v4.18-0002-brcmfmac-reports-boottime_ns-while-informing-bss.patch 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. From 7742fce4c007141617dab9bcb90034b3c0fe2347 Mon Sep 17 00:00:00 2001
  2. From: Franky Lin <[email protected]>
  3. Date: Thu, 26 Apr 2018 12:18:35 +0200
  4. Subject: [PATCH] brcmfmac: reports boottime_ns while informing bss
  5. Provides a timestamp in bss information so user space can see when the
  6. bss info was updated. Since tsf is not available from the dongle events
  7. boottime is reported instead.
  8. Reported-by: Dmitry Shmidt <[email protected]>
  9. Reviewed-by: Arend van Spriel <[email protected]>
  10. Signed-off-by: Franky Lin <[email protected]>
  11. Signed-off-by: Arend van Spriel <[email protected]>
  12. Signed-off-by: Kalle Valo <[email protected]>
  13. ---
  14. .../broadcom/brcm80211/brcmfmac/cfg80211.c | 26 +++++++++++-----------
  15. 1 file changed, 13 insertions(+), 13 deletions(-)
  16. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  17. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
  18. @@ -2728,7 +2728,6 @@ static s32 brcmf_inform_single_bss(struc
  19. struct brcmf_bss_info_le *bi)
  20. {
  21. struct wiphy *wiphy = cfg_to_wiphy(cfg);
  22. - struct ieee80211_channel *notify_channel;
  23. struct cfg80211_bss *bss;
  24. struct ieee80211_supported_band *band;
  25. struct brcmu_chan ch;
  26. @@ -2738,7 +2737,7 @@ static s32 brcmf_inform_single_bss(struc
  27. u16 notify_interval;
  28. u8 *notify_ie;
  29. size_t notify_ielen;
  30. - s32 notify_signal;
  31. + struct cfg80211_inform_bss bss_data = { 0 };
  32. if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) {
  33. brcmf_err("Bss info is larger than buffer. Discarding\n");
  34. @@ -2758,27 +2757,28 @@ static s32 brcmf_inform_single_bss(struc
  35. band = wiphy->bands[NL80211_BAND_5GHZ];
  36. freq = ieee80211_channel_to_frequency(channel, band->band);
  37. - notify_channel = ieee80211_get_channel(wiphy, freq);
  38. + bss_data.chan = ieee80211_get_channel(wiphy, freq);
  39. + bss_data.scan_width = NL80211_BSS_CHAN_WIDTH_20;
  40. + bss_data.boottime_ns = ktime_to_ns(ktime_get_boottime());
  41. notify_capability = le16_to_cpu(bi->capability);
  42. notify_interval = le16_to_cpu(bi->beacon_period);
  43. notify_ie = (u8 *)bi + le16_to_cpu(bi->ie_offset);
  44. notify_ielen = le32_to_cpu(bi->ie_length);
  45. - notify_signal = (s16)le16_to_cpu(bi->RSSI) * 100;
  46. + bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100;
  47. brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID);
  48. brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq);
  49. brcmf_dbg(CONN, "Capability: %X\n", notify_capability);
  50. brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
  51. - brcmf_dbg(CONN, "Signal: %d\n", notify_signal);
  52. + brcmf_dbg(CONN, "Signal: %d\n", bss_data.signal);
  53. - bss = cfg80211_inform_bss(wiphy, notify_channel,
  54. - CFG80211_BSS_FTYPE_UNKNOWN,
  55. - (const u8 *)bi->BSSID,
  56. - 0, notify_capability,
  57. - notify_interval, notify_ie,
  58. - notify_ielen, notify_signal,
  59. - GFP_KERNEL);
  60. + bss = cfg80211_inform_bss_data(wiphy, &bss_data,
  61. + CFG80211_BSS_FTYPE_UNKNOWN,
  62. + (const u8 *)bi->BSSID,
  63. + 0, notify_capability,
  64. + notify_interval, notify_ie,
  65. + notify_ielen, GFP_KERNEL);
  66. if (!bss)
  67. return -ENOMEM;