Skip to contentSkip to conversation

ax200: Fix avg-power report.

PATCH New [email protected] 1 participant 1 message Nov 26, 2019 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ax200: Fix avg-power report.

From: Ben Greear <[email protected]>

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.

---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +9 -1
index 1bff94c3dd72..2876db1b1d17 100644
@@ -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);
 	}
 
Signature · 1 line
2.20.1