ath10k: add statistics of tx retries and tx failed when tx complete disable
authorWen Gong <wgong@codeaurora.org>
Thu, 23 Apr 2020 02:41:34 +0000 (10:41 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 27 Apr 2020 05:02:03 +0000 (08:02 +0300)
When tx complete is disabled, all tx status will be set with status
HTT_TX_COMPL_STATE_ACK and indicate to mac80211 by ieee80211_tx_status,
then it does not have the statistics for retries and failed packets.
count of tx retries and tx failed of command "iw wlan0 station dump"
are both 0. If tx complete is not disabled, then firmware report the
tx status and ath10k indicate the status to mac80211, then mac80211
save the statistics and command "iw wlan0 station dump" show them.

for example:
localhost ~ # iw dev wlan0 station dump
Station 3c:28:6d:96:fd:69 (on wlan0)
inactive time: 5 ms
rx bytes: 1325012
rx packets: 6477
tx bytes: 85264
tx packets: 518
tx retries: 0
tx failed: 0

This patch only effect chips with tx complete disabled, e.g. SDIO.

with this patch, output of command "iw dev wlan0 station dump":
Station c4:04:15:5d:97:22 (on wlan0)
        inactive time:  608 ms
        rx bytes:       180366
        rx packets:     991
        tx bytes:       98765577
        tx packets:     64624
        tx retries:     14682
        tx failed:      47086

Tested with QCA6174 SDIO with firmware WLAN.RMH.4.4.1-00042.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200423024134.10601-1-wgong@codeaurora.org
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/htt_rx.c
drivers/net/wireless/ath/ath10k/mac.c

index d6adcba..07935d3 100644 (file)
@@ -500,6 +500,8 @@ struct ath10k_sta {
        u16 peer_id;
        struct rate_info txrate;
        struct ieee80211_tx_info tx_info;
+       u32 tx_retries;
+       u32 tx_failed;
        u32 last_tx_bitrate;
 
        struct work_struct update_wk;
index 816af1a..d787cbe 100644 (file)
@@ -3574,6 +3574,13 @@ ath10k_update_per_peer_tx_stats(struct ath10k *ar,
                ieee80211_tx_rate_update(ar->hw, sta, &arsta->tx_info);
        }
 
+       if (ar->htt.disable_tx_comp) {
+               arsta->tx_retries += peer_stats->retry_pkts;
+               arsta->tx_failed += peer_stats->failed_pkts;
+               ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx retries %d tx failed %d\n",
+                          arsta->tx_retries, arsta->tx_failed);
+       }
+
        if (ath10k_debug_is_extd_tx_stats_enabled(ar))
                ath10k_accumulate_per_peer_tx_stats(ar, arsta, peer_stats,
                                                    rate_idx);
index 98065b9..a1147cc 100644 (file)
@@ -8328,6 +8328,13 @@ static void ath10k_sta_statistics(struct ieee80211_hw *hw,
        }
        sinfo->txrate.flags = arsta->txrate.flags;
        sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
+
+       if (ar->htt.disable_tx_comp) {
+               sinfo->tx_retries = arsta->tx_retries;
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
+               sinfo->tx_failed = arsta->tx_failed;
+               sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
+       }
 }
 
 static const struct ieee80211_ops ath10k_ops = {