diff options
author | Ahmed Zaki <anzaki@gmail.com> | 2019-10-31 08:12:43 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2019-11-08 03:17:28 -0500 |
commit | 285531f9e6774e3be71da6673d475ff1a088d675 (patch) | |
tree | cb3c05420787cef15b264b35b6b8ea6936f181e3 | |
parent | 71e67c3bd127cfe7863f54e4b087eba1cc8f9a7a (diff) |
mac80211: fix station inactive_time shortly after boot
In the first 5 minutes after boot (time of INITIAL_JIFFIES),
ieee80211_sta_last_active() returns zero if last_ack is zero. This
leads to "inactive time" showing jiffies_to_msecs(jiffies).
# iw wlan0 station get fc:ec:da:64:a6:dd
Station fc:ec:da:64:a6:dd (on wlan0)
inactive time: 4294894049 ms
.
.
connected time: 70 seconds
Fix by returning last_rx if last_ack == 0.
Signed-off-by: Ahmed Zaki <anzaki@gmail.com>
Link: https://lore.kernel.org/r/20191031121243.27694-1-anzaki@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/mac80211/sta_info.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index bd11fef2139f..8d3a2389b055 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -2457,7 +2457,8 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta) | |||
2457 | { | 2457 | { |
2458 | struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta); | 2458 | struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta); |
2459 | 2459 | ||
2460 | if (time_after(stats->last_rx, sta->status_stats.last_ack)) | 2460 | if (!sta->status_stats.last_ack || |
2461 | time_after(stats->last_rx, sta->status_stats.last_ack)) | ||
2461 | return stats->last_rx; | 2462 | return stats->last_rx; |
2462 | return sta->status_stats.last_ack; | 2463 | return sta->status_stats.last_ack; |
2463 | } | 2464 | } |