ipw2x00: age scan results on resume
Scanned BSS entries are timestamped with jiffies, which doesn't increment across suspend and hibernate. On resume, every BSS in the scan list looks like it was scanned within the last 10 seconds, irregardless of how long the machine was actually asleep. Age scan results on resume with the time spent during sleep so userspace has a clue how old they really are. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
bc8263f1d8
commit
c3d72b9681
@@ -43,6 +43,16 @@ static const char *ieee80211_modes[] = {
|
||||
"?", "a", "b", "ab", "g", "ag", "bg", "abg"
|
||||
};
|
||||
|
||||
static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
|
||||
{
|
||||
unsigned long end = jiffies;
|
||||
|
||||
if (end >= start)
|
||||
return jiffies_to_msecs(end - start);
|
||||
|
||||
return jiffies_to_msecs(end + (MAX_JIFFY_OFFSET - start) + 1);
|
||||
}
|
||||
|
||||
#define MAX_CUSTOM_LEN 64
|
||||
static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
|
||||
char *start, char *stop,
|
||||
@@ -216,8 +226,8 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
|
||||
iwe.cmd = IWEVCUSTOM;
|
||||
p = custom;
|
||||
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom),
|
||||
" Last beacon: %dms ago",
|
||||
jiffies_to_msecs(jiffies - network->last_scanned));
|
||||
" Last beacon: %ums ago",
|
||||
elapsed_jiffies_msecs(network->last_scanned));
|
||||
iwe.u.data.length = p - custom;
|
||||
if (iwe.u.data.length)
|
||||
start = iwe_stream_add_point(info, start, stop, &iwe, custom);
|
||||
@@ -277,15 +287,15 @@ int ieee80211_wx_get_scan(struct ieee80211_device *ieee,
|
||||
time_after(network->last_scanned + ieee->scan_age, jiffies))
|
||||
ev = ieee80211_translate_scan(ieee, ev, stop, network,
|
||||
info);
|
||||
else
|
||||
else {
|
||||
IEEE80211_DEBUG_SCAN("Not showing network '%s ("
|
||||
"%pM)' due to age (%dms).\n",
|
||||
"%pM)' due to age (%ums).\n",
|
||||
print_ssid(ssid, network->ssid,
|
||||
network->ssid_len),
|
||||
network->bssid,
|
||||
jiffies_to_msecs(jiffies -
|
||||
network->
|
||||
last_scanned));
|
||||
elapsed_jiffies_msecs(
|
||||
network->last_scanned));
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&ieee->lock, flags);
|
||||
|
Reference in New Issue
Block a user