summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhmed Zaki <anzaki@gmail.com>2019-10-31 15:12:43 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 00:34:01 +0300
commitb6caf8942e17543a6155ac35cdd86389568613f4 (patch)
treed5cd2c5514dd6d4a7bc587a15453cf76f036e85c
parent3b8fcaa9c17ef4b35631154b74d9ba81eb262557 (diff)
downloadlinux-b6caf8942e17543a6155ac35cdd86389568613f4.tar.xz
mac80211: fix station inactive_time shortly after boot
[ Upstream commit 285531f9e6774e3be71da6673d475ff1a088d675 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/mac80211/sta_info.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 5fb368cc2633..0030b13c2f50 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -2455,7 +2455,8 @@ unsigned long ieee80211_sta_last_active(struct sta_info *sta)
{
struct ieee80211_sta_rx_stats *stats = sta_get_last_rx_stats(sta);
- if (time_after(stats->last_rx, sta->status_stats.last_ack))
+ if (!sta->status_stats.last_ack ||
+ time_after(stats->last_rx, sta->status_stats.last_ack))
return stats->last_rx;
return sta->status_stats.last_ack;
}