ath11k: fix incorrect peer stats counters update
authorVenkateswara Naralasetty <vnaralas@codeaurora.org>
Wed, 5 Feb 2020 08:35:30 +0000 (14:05 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 11 Feb 2020 18:35:51 +0000 (20:35 +0200)
Convert mac80211 bw to ath11k bw before updating peer stats
bw counters, which fixes incorrect peer stats counters update.

Signed-off-by: Venkateswara Naralasetty <vnaralas@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath11k/debugfs_sta.c
drivers/net/wireless/ath/ath11k/mac.c
drivers/net/wireless/ath/ath11k/mac.h

index 00f327e9bc25462201fa4abac5685bc021ec442a..872f3ef4d2a80c2c6be29fa48bfc56328109dd13 100644 (file)
@@ -24,7 +24,7 @@ ath11k_accumulate_per_peer_tx_stats(struct ath11k_sta *arsta,
        tx_stats = arsta->tx_stats;
        gi = FIELD_GET(RATE_INFO_FLAGS_SHORT_GI, arsta->txrate.flags);
        mcs = txrate->mcs;
-       bw = txrate->bw;
+       bw = ath11k_mac_mac80211_bw_to_ath11k_bw(txrate->bw);
        nss = txrate->nss - 1;
 
 #define STATS_OP_FMT(name) tx_stats->stats[ATH11K_STATS_TYPE_##name]
index e89790a01c48b79857b434c98284b69010dc3d9d..f5e171c26bd53fa6e65ca1aabfd69c452f5955b7 100644 (file)
@@ -178,6 +178,22 @@ u8 ath11k_mac_bw_to_mac80211_bw(u8 bw)
        return ret;
 }
 
+enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw)
+{
+       switch (bw) {
+       case RATE_INFO_BW_20:
+               return ATH11K_BW_20;
+       case RATE_INFO_BW_40:
+               return ATH11K_BW_40;
+       case RATE_INFO_BW_80:
+               return ATH11K_BW_80;
+       case RATE_INFO_BW_160:
+               return ATH11K_BW_160;
+       default:
+               return ATH11K_BW_20;
+       }
+}
+
 int ath11k_mac_hw_ratecode_to_legacy_rate(u8 hw_rc, u8 preamble, u8 *rateidx,
                                          u16 *rate)
 {
index f286531cdd78aff6cb73aaee27427a6524155400..f4937a03e92b516fe2695105e39830acfe3ca776 100644 (file)
@@ -144,4 +144,5 @@ void ath11k_mac_drain_tx(struct ath11k *ar);
 void ath11k_mac_peer_cleanup_all(struct ath11k *ar);
 int ath11k_mac_tx_mgmt_pending_free(int buf_id, void *skb, void *ctx);
 u8 ath11k_mac_bw_to_mac80211_bw(u8 bw);
+enum ath11k_supported_bw ath11k_mac_mac80211_bw_to_ath11k_bw(enum rate_info_bw bw);
 #endif