]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: fetch tx_retry and tx_failed from htt_ppdu_stats_user_cmpltn_common_tlv
authorSarika Sharma <quic_sarishar@quicinc.com>
Tue, 1 Jul 2025 10:59:27 +0000 (16:29 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Mon, 7 Jul 2025 22:34:49 +0000 (15:34 -0700)
Currently, tx_retries and tx_failed are updated only in mac80211 during
tx_completion path for sta->deflink. This works fine for non-ML
station but for multi-link (ML) station, these values should be updated
for sta->link[link_id] as per tx link_id. However, in tx_completion path
there is no way to determine the link_id for which packet is retried or
failed.

Therefore, update the tx_retries and tx_failed in arsta structure from
htt_ppdu_stats_user_cmpltn_common_tlv during
ath12k_update_per_peer_tx_stats() call to utilize the values from arsta.
Also, during 'iw dev xxxx station dump' populate the tx_retries and
tx_failed in station_info structure to ensure values are correctly
reflected.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20250701105927.803342-6-quic_sarishar@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.h
drivers/net/wireless/ath/ath12k/dp_rx.c
drivers/net/wireless/ath/ath12k/mac.c

index 96ff9b08a8482062ddce03f918b8e4bdb8801bd8..295609d849b81d5a8c058be6278777821e4b3d08 100644 (file)
@@ -563,6 +563,8 @@ struct ath12k_link_sta {
 
         /* for firmware use only */
        u8 link_idx;
+       u32 tx_retry_failed;
+       u32 tx_retry_count;
 };
 
 struct ath12k_reoq_buf {
index 7be9f8c02c67f8137977ae4a4d32a68a3ccf956b..ed325aa6322d53636714de574d3c786687b9e6f8 100644 (file)
@@ -1428,14 +1428,22 @@ ath12k_update_per_peer_tx_stats(struct ath12k *ar,
        u16 tones, rate = 0, succ_pkts = 0;
        u32 tx_duration = 0;
        u8 tid = HTT_PPDU_STATS_NON_QOS_TID;
+       u16 tx_retry_failed = 0, tx_retry_count = 0;
        bool is_ampdu = false, is_ofdma;
 
        if (!(usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_RATE)))
                return;
 
-       if (usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON))
+       if (usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON)) {
                is_ampdu =
                        HTT_USR_CMPLTN_IS_AMPDU(usr_stats->cmpltn_cmn.flags);
+               tx_retry_failed =
+                       __le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_tried) -
+                       __le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_success);
+               tx_retry_count =
+                       HTT_USR_CMPLTN_LONG_RETRY(usr_stats->cmpltn_cmn.flags) +
+                       HTT_USR_CMPLTN_SHORT_RETRY(usr_stats->cmpltn_cmn.flags);
+       }
 
        if (usr_stats->tlv_flags &
            BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_ACK_BA_STATUS)) {
@@ -1557,6 +1565,8 @@ ath12k_update_per_peer_tx_stats(struct ath12k *ar,
                break;
        }
 
+       arsta->tx_retry_failed += tx_retry_failed;
+       arsta->tx_retry_count += tx_retry_count;
        arsta->txrate.nss = nss;
        arsta->tx_duration += tx_duration;
        memcpy(&arsta->last_txrate, &arsta->txrate, sizeof(struct rate_info));
index 8fcfb374fc868ba57bb494c371e6bfc4418b0ca4..a4d7daee94ec8b598d79f74a33b65f55d70e7345 100644 (file)
@@ -12442,6 +12442,11 @@ static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw,
                sinfo->signal_avg += noise_floor;
 
        sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
+
+       sinfo->tx_retries = arsta->tx_retry_count;
+       sinfo->tx_failed = arsta->tx_retry_failed;
+       sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
+       sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
 }
 
 static void ath12k_mac_op_link_sta_statistics(struct ieee80211_hw *hw,
@@ -12519,6 +12524,11 @@ static void ath12k_mac_op_link_sta_statistics(struct ieee80211_hw *hw,
                link_sinfo->signal_avg += ATH12K_DEFAULT_NOISE_FLOOR;
 
        link_sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
+
+       link_sinfo->tx_retries = arsta->tx_retry_count;
+       link_sinfo->tx_failed = arsta->tx_retry_failed;
+       link_sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
+       link_sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_FAILED);
 }
 
 static int ath12k_mac_op_cancel_remain_on_channel(struct ieee80211_hw *hw,