* [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results
@ 2017-07-11 0:47 Ningyuan Wang
2017-07-21 15:18 ` Kalle Valo
2017-07-26 0:01 ` [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf Ningyuan Wang
0 siblings, 2 replies; 5+ messages in thread
From: Ningyuan Wang @ 2017-07-11 0:47 UTC (permalink / raw)
To: johannes; +Cc: Ningyuan Wang, linux-wireless
This patch allows iw to print NL80211_BSS_LAST_SEEN_BOOTTIME
values on scan results.
Change-Id: I4e6a3d9999830a83766d59671b42e824421a3414
---
nl80211.h | 4 ++++
scan.c | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/nl80211.h b/nl80211.h
index 241220c..5ea103c 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -3360,6 +3360,9 @@ enum nl80211_bss_scan_width {
* (not present if no beacon frame has been received yet)
* @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
* @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
+ * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
+ * was last updated by a received frame. The value is expected to be
+ * accurate to about 10ms. (u64, nanoseconds)
* @__NL80211_BSS_AFTER_LAST: internal
* @NL80211_BSS_MAX: highest BSS attribute
*/
@@ -3379,6 +3382,7 @@ enum nl80211_bss {
NL80211_BSS_CHAN_WIDTH,
NL80211_BSS_BEACON_TSF,
NL80211_BSS_PRESP_DATA,
+ NL80211_BSS_LAST_SEEN_BOOTTIME,
/* keep last */
__NL80211_BSS_AFTER_LAST,
diff --git a/scan.c b/scan.c
index bf39f34..279df04 100644
--- a/scan.c
+++ b/scan.c
@@ -1853,6 +1853,7 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
char mac_addr[20], dev[20];
static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
[NL80211_BSS_TSF] = { .type = NLA_U64 },
+ [NL80211_BSS_LAST_SEEN_BOOTTIME] = { .type = NLA_U64 },
[NL80211_BSS_FREQUENCY] = { .type = NLA_U32 },
[NL80211_BSS_BSSID] = { },
[NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
@@ -1918,6 +1919,16 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
}
+ if (bss[NL80211_BSS_LAST_SEEN_BOOTTIME]) {
+ unsigned long long last_seen_since_boot;
+ last_seen_since_boot =
+ (unsigned long long)nla_get_u64(bss[NL80211_BSS_LAST_SEEN_BOOTTIME]);
+ printf("\tlast seen since boot time: %llu usec (%llud, %.2lld:%.2llu:%.2llu)\n",
+ last_seen_since_boot, last_seen_since_boot /1000/1000/1000/60/60/24,
+ (last_seen_since_boot /1000/1000/1000/60/60) % 24,
+ (last_seen_since_boot/1000/1000/1000/60) % 60,
+ (last_seen_since_boot/1000/1000/1000) % 60);
+ }
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq);
--
2.13.2.725.g09c95d1e9-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results
2017-07-11 0:47 [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results Ningyuan Wang
@ 2017-07-21 15:18 ` Kalle Valo
[not found] ` <CACS3zKWXPYK98kuBBXnwXa84H5DrB8Mv4UbF7NdM3DFJ9G3PdQ@mail.gmail.com>
2017-07-26 0:01 ` [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf Ningyuan Wang
1 sibling, 1 reply; 5+ messages in thread
From: Kalle Valo @ 2017-07-21 15:18 UTC (permalink / raw)
To: Ningyuan Wang; +Cc: johannes, linux-wireless
Ningyuan Wang <nywang@google.com> writes:
> This patch allows iw to print NL80211_BSS_LAST_SEEN_BOOTTIME
> values on scan results.
>
> Change-Id: I4e6a3d9999830a83766d59671b42e824421a3414
Signed-off-by missing and Change-Id should not be included.
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results
[not found] ` <CACS3zKWXPYK98kuBBXnwXa84H5DrB8Mv4UbF7NdM3DFJ9G3PdQ@mail.gmail.com>
@ 2017-07-21 16:57 ` Kalle Valo
0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2017-07-21 16:57 UTC (permalink / raw)
To: Ningyuan Wang; +Cc: Johannes Berg, linux-wireless
Ningyuan Wang <nywang@google.com> writes:
> Signed-off-by: Ningyuan Wang <nywang@google.com>
> ---
> nl80211.h | 4 ++++
> scan.c | 11 +++++++++++
> 2 files changed, 15 insertions(+)
>
> diff --git a/nl80211.h b/nl80211.h
> index 241220c..5ea103c 100644
> --- a/nl80211.h
> +++ b/nl80211.h
> @@ -3360,6 +3360,9 @@ enum nl80211_bss_scan_width {
> * (not present if no beacon frame has been received yet)
> * @NL80211_BSS_PRESP_DATA: the data in
> @NL80211_BSS_INFORMATION_ELEMENTS and
The patch looks to be corrupted, patchwork won't see it either:
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#format_issues
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf
2017-07-11 0:47 [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results Ningyuan Wang
2017-07-21 15:18 ` Kalle Valo
@ 2017-07-26 0:01 ` Ningyuan Wang
2017-09-06 10:36 ` Johannes Berg
1 sibling, 1 reply; 5+ messages in thread
From: Ningyuan Wang @ 2017-07-26 0:01 UTC (permalink / raw)
To: johannes; +Cc: Ningyuan Wang, linux-wireless
This patch allows iw to print NL80211_BSS_LAST_SEEN_BOOTTIME
values on scan results.
Signed-off-by: Ningyuan Wang <nywang@google.com>
---
nl80211.h | 4 ++++
scan.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/nl80211.h b/nl80211.h
index 241220c..5ea103c 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -3360,6 +3360,9 @@ enum nl80211_bss_scan_width {
* (not present if no beacon frame has been received yet)
* @NL80211_BSS_PRESP_DATA: the data in @NL80211_BSS_INFORMATION_ELEMENTS and
* @NL80211_BSS_TSF is known to be from a probe response (flag attribute)
+ * @NL80211_BSS_LAST_SEEN_BOOTTIME: CLOCK_BOOTTIME timestamp when this entry
+ * was last updated by a received frame. The value is expected to be
+ * accurate to about 10ms. (u64, nanoseconds)
* @__NL80211_BSS_AFTER_LAST: internal
* @NL80211_BSS_MAX: highest BSS attribute
*/
@@ -3379,6 +3382,7 @@ enum nl80211_bss {
NL80211_BSS_CHAN_WIDTH,
NL80211_BSS_BEACON_TSF,
NL80211_BSS_PRESP_DATA,
+ NL80211_BSS_LAST_SEEN_BOOTTIME,
/* keep last */
__NL80211_BSS_AFTER_LAST,
diff --git a/scan.c b/scan.c
index bf39f34..6646732 100644
--- a/scan.c
+++ b/scan.c
@@ -1853,6 +1853,8 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
char mac_addr[20], dev[20];
static struct nla_policy bss_policy[NL80211_BSS_MAX + 1] = {
[NL80211_BSS_TSF] = { .type = NLA_U64 },
+ [NL80211_BSS_BEACON_TSF] = { .type = NLA_U64 },
+ [NL80211_BSS_LAST_SEEN_BOOTTIME] = { .type = NLA_U64 },
[NL80211_BSS_FREQUENCY] = { .type = NLA_U32 },
[NL80211_BSS_BSSID] = { },
[NL80211_BSS_BEACON_INTERVAL] = { .type = NLA_U16 },
@@ -1918,6 +1920,23 @@ static int print_bss_handler(struct nl_msg *msg, void *arg)
tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
(tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
}
+ if (bss[NL80211_BSS_BEACON_TSF]) {
+ unsigned long long tsf;
+ tsf = (unsigned long long)nla_get_u64(bss[NL80211_BSS_BEACON_TSF]);
+ printf("\tBeacon TSF: %llu usec (%llud, %.2lld:%.2llu:%.2llu)\n",
+ tsf, tsf/1000/1000/60/60/24, (tsf/1000/1000/60/60) % 24,
+ (tsf/1000/1000/60) % 60, (tsf/1000/1000) % 60);
+ }
+ if (bss[NL80211_BSS_LAST_SEEN_BOOTTIME]) {
+ unsigned long long last_seen_since_boot;
+ last_seen_since_boot =
+ (unsigned long long)nla_get_u64(bss[NL80211_BSS_LAST_SEEN_BOOTTIME]);
+ printf("\tlast seen since boot time: %llu usec (%llud, %.2lld:%.2llu:%.2llu)\n",
+ last_seen_since_boot, last_seen_since_boot /1000/1000/1000/60/60/24,
+ (last_seen_since_boot /1000/1000/1000/60/60) % 24,
+ (last_seen_since_boot/1000/1000/1000/60) % 60,
+ (last_seen_since_boot/1000/1000/1000) % 60);
+ }
if (bss[NL80211_BSS_FREQUENCY]) {
int freq = nla_get_u32(bss[NL80211_BSS_FREQUENCY]);
printf("\tfreq: %d\n", freq);
--
2.14.0.rc0.400.g1c36432dff-goog
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf
2017-07-26 0:01 ` [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf Ningyuan Wang
@ 2017-09-06 10:36 ` Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2017-09-06 10:36 UTC (permalink / raw)
To: Ningyuan Wang; +Cc: linux-wireless
Hi,
> nl80211.h | 4 ++++
Please don't include nl80211.h changes, I'll update that as needed.
> + if (bss[NL80211_BSS_BEACON_TSF]) {
> + unsigned long long tsf;
> + tsf = (unsigned long
> long)nla_get_u64(bss[NL80211_BSS_BEACON_TSF]);
> + printf("\tBeacon TSF: %llu usec (%llud,
> %.2lld:%.2llu:%.2llu)\n",
> + tsf, tsf/1000/1000/60/60/24,
> (tsf/1000/1000/60/60) % 24,
> + (tsf/1000/1000/60) % 60, (tsf/1000/1000) %
> 60);
> + }
This seems fine, but we already print the BSS_TSF - is it really
needed? Anyway, I think it's OK, just not sure there's much point.
> + if (bss[NL80211_BSS_LAST_SEEN_BOOTTIME]) {
> + unsigned long long last_seen_since_boot;
> + last_seen_since_boot =
> + (unsigned long
> long)nla_get_u64(bss[NL80211_BSS_LAST_SEEN_BOOTTIME]);
> + printf("\tlast seen since boot time: %llu usec
> (%llud, %.2lld:%.2llu:%.2llu)\n",
> + last_seen_since_boot, last_seen_since_boot
> /1000/1000/1000/60/60/24,
> + (last_seen_since_boot /1000/1000/1000/60/60)
> % 24,
> + (last_seen_since_boot/1000/1000/1000/60) %
> 60,
> + (last_seen_since_boot/1000/1000/1000) % 60);
> + }
This is wrong - the value isn't "last seen since boot", it's "last seen
*at* boottime X" - but "boottime" maybe some kind of strange concept,
so I don't think printing this to a user makes a lot of sense at all?
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-06 10:36 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-11 0:47 [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME on scan results Ningyuan Wang
2017-07-21 15:18 ` Kalle Valo
[not found] ` <CACS3zKWXPYK98kuBBXnwXa84H5DrB8Mv4UbF7NdM3DFJ9G3PdQ@mail.gmail.com>
2017-07-21 16:57 ` Kalle Valo
2017-07-26 0:01 ` [PATCH] Print NL80211_BSS_LAST_SEEN_BOOTTIME and beacon tsf Ningyuan Wang
2017-09-06 10:36 ` 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).