linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: Add timestamp to scan results report
@ 2018-03-21 22:44 dimitrysh
  2018-03-22 10:44 ` Arend van Spriel
  0 siblings, 1 reply; 3+ messages in thread
From: dimitrysh @ 2018-03-21 22:44 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, franky.lin

 From 01da9ee11ce6e0973972b2ffd37eef660714f71a Mon Sep 17 00:00:00 2001
From: Dmitry Shmidt <dimitrysh@google.com>
Date: Wed, 21 Mar 2018 15:35:45 -0700
Subject: [PATCH] brcmfmac: Add timestamp to scan results report

Monotonic time from boot is good timestamp indicator
and it can be used by kernel and userspace.

Change-Id: I122374fa79c6dbd7967b2c30553cb04dee032ebc
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c  
b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index 4157c90ad973..76d6ed553b7c 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -2845,6 +2845,8 @@ static s32 brcmf_inform_single_bss(struct  
brcmf_cfg80211_info *cfg,
  	struct cfg80211_bss *bss;
  	struct ieee80211_supported_band *band;
  	struct brcmu_chan ch;
+	struct timespec ts;
+	u64 timestamp;
  	u16 channel;
  	u32 freq;
  	u16 notify_capability;
@@ -2885,10 +2887,12 @@ static s32 brcmf_inform_single_bss(struct  
brcmf_cfg80211_info *cfg,
  	brcmf_dbg(CONN, "Beacon interval: %d\n", notify_interval);
  	brcmf_dbg(CONN, "Signal: %d\n", notify_signal);

+	get_monotonic_boottime(&ts);
+	timestamp = (u64)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
  	bss = cfg80211_inform_bss(wiphy, notify_channel,
  				  CFG80211_BSS_FTYPE_UNKNOWN,
  				  (const u8 *)bi->BSSID,
-				  0, notify_capability,
+				  timestamp, notify_capability,
  				  notify_interval, notify_ie,
  				  notify_ielen, notify_signal,
  				  GFP_KERNEL);
-- 
2.17.0.rc0.231.g781580f067-goog

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] brcmfmac: Add timestamp to scan results report
  2018-03-21 22:44 [PATCH] brcmfmac: Add timestamp to scan results report dimitrysh
@ 2018-03-22 10:44 ` Arend van Spriel
  2018-03-22 11:48   ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Arend van Spriel @ 2018-03-22 10:44 UTC (permalink / raw)
  To: dimitrysh, linux-wireless; +Cc: johannes, franky.lin

On 3/21/2018 11:44 PM, dimitrysh@google.com wrote:
>  From 01da9ee11ce6e0973972b2ffd37eef660714f71a Mon Sep 17 00:00:00 2001
> From: Dmitry Shmidt <dimitrysh@google.com>
> Date: Wed, 21 Mar 2018 15:35:45 -0700
> Subject: [PATCH] brcmfmac: Add timestamp to scan results report
>
> Monotonic time from boot is good timestamp indicator
> and it can be used by kernel and userspace.

Thanks, Dmitry

I recall a similar attempt for another driver, but I think the timestamp 
should really be the TSF of the beacon/proberesp received. As you 
already Cc-ed Johannes explicitly maybe he can clarify what is needed 
here as I do not recall the details. ;-)

Regards,
Arend

> Change-Id: I122374fa79c6dbd7967b2c30553cb04dee032ebc
> Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] brcmfmac: Add timestamp to scan results report
  2018-03-22 10:44 ` Arend van Spriel
@ 2018-03-22 11:48   ` Johannes Berg
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2018-03-22 11:48 UTC (permalink / raw)
  To: Arend van Spriel, dimitrysh, linux-wireless; +Cc: franky.lin

On Thu, 2018-03-22 at 11:44 +0100, Arend van Spriel wrote:
> I recall a similar attempt for another driver, but I think the timestamp 
> should really be the TSF of the beacon/proberesp received. As you 
> already Cc-ed Johannes explicitly maybe he can clarify what is needed 
> here as I do not recall the details. ;-)

Yes, this should be "tsf", it's actually labelled explicitly as such. I
know Android used to get this wrong and *even test* it wrongly, but
that's no excuse.

However, should switch this to cfg80211_inform_bss_data() and use the
timestamp set up here to fill the cfg80211_inform_bss::boottime_ns
value. That's also sent to userspace in the proper way for this.

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-22 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-21 22:44 [PATCH] brcmfmac: Add timestamp to scan results report dimitrysh
2018-03-22 10:44 ` Arend van Spriel
2018-03-22 11:48   ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).