linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ahmed Zaki <anzaki@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: anzaki@gmail.com
Subject: [PATCH 1/1] sta_info: fix insane values in iw sta dump "inactive time"
Date: Wed, 30 Oct 2019 15:31:53 -0600	[thread overview]
Message-ID: <20191030213153.3196-2-anzaki@gmail.com> (raw)
In-Reply-To: <20191030213153.3196-1-anzaki@gmail.com>

In the first 5 mins after boot (initial jiffies),
ieee80211_sta_last_active() returns zero in case last_ack is zero. This
leads to insane values appearing in "inactive time".

Fix by returning last_rx if last_ack == 0.
---
 net/mac80211/sta_info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index bd11fef2139f..428866ff7c0a 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)
 {
 	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;
 }
-- 
2.17.1


  reply	other threads:[~2019-10-30 21:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 21:31 [PATCH 0/1] sta_info: fix insane values in iw sta dump "inactive time" Ahmed Zaki
2019-10-30 21:31 ` Ahmed Zaki [this message]
2019-10-31  8:11   ` [PATCH 1/1] " Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191030213153.3196-2-anzaki@gmail.com \
    --to=anzaki@gmail.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).