nl80211: report age of scan results
authorHolger Schurig <hs4233@mail.mn-solutions.de>
Thu, 24 Sep 2009 10:21:01 +0000 (12:21 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 7 Oct 2009 20:39:42 +0000 (16:39 -0400)
Linux keeps scan results up to 15 seconds. This can be a problem for fast
moving clients: they get back stale data. But if the kernel reports the age
of the BSS items, then user-space can simply weed out old entries by itself.

Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
include/linux/nl80211.h
net/wireless/nl80211.c

index a8d71ed43a0e80a8608dadebe343c61379cd88ef..50afca3dcff14e0128402297ebc5c2f92638a4f6 100644 (file)
@@ -1277,6 +1277,7 @@ enum nl80211_channel_type {
  * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
  *     in unspecified units, scaled to 0..100 (u8)
  * @NL80211_BSS_STATUS: status, if this BSS is "used"
  * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
  *     in unspecified units, scaled to 0..100 (u8)
  * @NL80211_BSS_STATUS: status, if this BSS is "used"
+ * @NL80211_BSS_SEEN_MS_AGO: age of this BSS entry in ms
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
  * @__NL80211_BSS_AFTER_LAST: internal
  * @NL80211_BSS_MAX: highest BSS attribute
  */
@@ -1291,6 +1292,7 @@ enum nl80211_bss {
        NL80211_BSS_SIGNAL_MBM,
        NL80211_BSS_SIGNAL_UNSPEC,
        NL80211_BSS_STATUS,
        NL80211_BSS_SIGNAL_MBM,
        NL80211_BSS_SIGNAL_UNSPEC,
        NL80211_BSS_STATUS,
+       NL80211_BSS_SEEN_MS_AGO,
 
        /* keep last */
        __NL80211_BSS_AFTER_LAST,
 
        /* keep last */
        __NL80211_BSS_AFTER_LAST,
index eddab097435cd9a0473b6f12f98575e45ef1e0f2..e0ecc9f153d406027ab0d731b7da1362d71c9966 100644 (file)
@@ -3105,6 +3105,8 @@ static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags,
                NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval);
        NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability);
        NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq);
                NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval);
        NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability);
        NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq);
+       NLA_PUT_U32(msg, NL80211_BSS_SEEN_MS_AGO,
+               jiffies_to_msecs(jiffies - intbss->ts));
 
        switch (rdev->wiphy.signal_type) {
        case CFG80211_SIGNAL_TYPE_MBM:
 
        switch (rdev->wiphy.signal_type) {
        case CFG80211_SIGNAL_TYPE_MBM: