From: greearb@candelatech.com
To: linux-wireless@vger.kernel.org
Cc: Ben Greear <greearb@candelatech.com>
Subject: [PATCH] ax200: Fix avg-power report.
Date: Tue, 26 Nov 2019 13:47:44 -0800 [thread overview]
Message-ID: <20191126214744.1283-1-greearb@candelatech.com> (raw)
From: Ben Greear <greearb@candelatech.com>
On AX200, the average power was showing possitive instead of negative, but
otherwise matched the expected RSSI. I think that we just need to flip
the value to negative before giving to mac80211.
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 1bff94c3dd72..2876db1b1d17 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4948,7 +4948,15 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
if (mvmsta->avg_energy) {
- sinfo->signal_avg = mvmsta->avg_energy;
+ /* signal_avg is s8, mvsta->avg_energy is u8. At least on AX200,
+ * avg_energy is RSSI but missing the minus sign.
+ */
+ if (mvmsta->avg_energy & 0x80) {
+ sinfo->signal_avg = mvmsta->avg_energy;
+ }
+ else {
+ sinfo->signal_avg = -((s8)(mvmsta->avg_energy));
+ }
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
}
--
2.20.1
reply other threads:[~2019-11-26 21:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20191126214744.1283-1-greearb@candelatech.com \
--to=greearb@candelatech.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).