mac80211: fix insane values that sometimes appear in inactive_time
PATCH v2 1/1 mac80211: fix insane values that sometimes appear in inactive_time
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 <[email protected]>
--- net/mac80211/sta_info.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/sta_info.c +2 -1
@@ -2457,7 +2457,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; }
Signature · 1 line
2.17.1
Johannes Berg
maintainerQuoted 11 lines · Ahmed Zaki
In the first 5 minutes after boot (time of
INITIAL_JIFFIES),ieee80211_sta_last_active()returns zero iflast_ackis zero. This leads to "inactive time" showingjiffies_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
Quoted 3 lines
Fix by returning
last_rxiflast_ack== 0.Signed-off-by Ahmed Zaki <[email protected]>
Thanks for the updates :)
net/mac80211/sta_info.c unsigned long ieee80211_sta_last_active(struct sta_info *sta) · line 2462
Quoted 4 lines
net/mac80211/sta_info.c +2
-1-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;
The indentation is still wrong :)
I guess I could fix that too.
johannes