diff mbox

mac80211: Get ethtool-stats frequency more often.

Message ID 1462835537-11268-1-git-send-email-greearb@candelatech.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Ben Greear May 9, 2016, 11:12 p.m. UTC
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(-)

Comments

Johannes Berg May 12, 2016, 8:23 a.m. UTC | #1
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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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