User-space needs to know real time from boot (including suspend) of bss entry for location and connectivity services. Change-Id: I7d5db4378d7941ccecf8ac675425024c2aafe62b Signed-off-by: Dmitry Shmidt <dimitrysh@xxxxxxxxxx> --- include/uapi/linux/nl80211.h | 2 ++ net/wireless/core.h | 1 + net/wireless/nl80211.c | 3 ++- net/wireless/scan.c | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index c0ab6b0..173b6a5 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -3364,6 +3364,7 @@ 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: age of this BSS entry in us from boot * @__NL80211_BSS_AFTER_LAST: internal * @NL80211_BSS_MAX: highest BSS attribute */ @@ -3383,6 +3384,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/net/wireless/core.h b/net/wireless/core.h index b9d5bc8..261e159 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h @@ -140,6 +140,7 @@ struct cfg80211_internal_bss { unsigned long ts; unsigned long refcount; atomic_t hold; + u64 tfb; /* must be last because of priv member */ struct cfg80211_bss pub; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index f05ba8b..a9ed2da 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -6602,7 +6602,8 @@ static int nl80211_send_bss(struct sk_buff *msg, struct netlink_callback *cb, nla_put_u32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq) || nla_put_u32(msg, NL80211_BSS_CHAN_WIDTH, res->scan_width) || nla_put_u32(msg, NL80211_BSS_SEEN_MS_AGO, - jiffies_to_msecs(jiffies - intbss->ts))) + jiffies_to_msecs(jiffies - intbss->ts)) || + nla_put_u64(msg, NL80211_BSS_LAST_SEEN_BOOTTIME, intbss->tfb)) goto nla_put_failure; switch (rdev->wiphy.signal_type) { diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 3a50aa2..275cc92 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -749,10 +749,12 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, bool signal_valid) { struct cfg80211_internal_bss *found = NULL; + struct timespec tfb; if (WARN_ON(!tmp->pub.channel)) return NULL; + get_monotonic_boottime(&tfb); tmp->ts = jiffies; spin_lock_bh(&rdev->bss_lock); @@ -895,6 +897,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev, found = new; } + found->tfb = (u64)(timespec_to_ns(&tfb) / 1000); rdev->bss_generation++; bss_ref_get(rdev, found); spin_unlock_bh(&rdev->bss_lock); -- 2.6.0.rc2.230.g3dd15c0
Attachment:
0001-nl80211-report-age-of-bss-entry-from-boot-in-microse.patch
Description: Binary data