linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Get ethtool-stats frequency more often.
@ 2016-05-09 23:12 greearb
  2016-05-12  8:23 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: greearb @ 2016-05-09 23:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Some NICs (ath9k_htc) don't use chanctx_conf, it
seems, so look at local->hw.conf.channel->center_freq
in that case.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/mac80211/ethtool.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c
index 9cc986d..4e937c1 100644
--- a/net/mac80211/ethtool.c
+++ b/net/mac80211/ethtool.c
@@ -165,10 +165,14 @@ do_survey:
 		} while (channel != survey.channel);
 	}
 
-	if (survey.filled)
-		data[i++] = survey.channel->center_freq;
-	else
-		data[i++] = 0;
+	if (channel) {
+		data[i++] = channel->center_freq;
+	} else {
+		if (local->_oper_chandef.chan)
+			data[i++] = local->_oper_chandef.chan->center_freq;
+		else
+			data[i++] = 0;
+	}
 	if (survey.filled & SURVEY_INFO_NOISE_DBM)
 		data[i++] = (u8)survey.noise;
 	else
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: Get ethtool-stats frequency more often.
  2016-05-09 23:12 [PATCH] mac80211: Get ethtool-stats frequency more often greearb
@ 2016-05-12  8:23 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2016-05-12  8:23 UTC (permalink / raw)
  To: greearb, linux-wireless

Hi Ben,

I'm confused about the subject - "more often"?

> Some NICs (ath9k_htc) don't use chanctx_conf, it
> seems, so look at local->hw.conf.channel->center_freq
> in that case.

It shouldn't matter whether or not the *driver* (not NIC anyway) uses
that structure - mac80211 uses it throughout internally. As such, this
doesn't really make sense.

I also think that your patch is wrong because it causes a driver that
doesn't report information for the current channel to still have a non-
zero frequency, so userspace won't be able to tell if there's any data
or not.

johannes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-12  8:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-09 23:12 [PATCH] mac80211: Get ethtool-stats frequency more often greearb
2016-05-12  8:23 ` Johannes Berg

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).