Skip to content

Commit d2602a0

Browse files
Sarika Sharmagregkh
authored andcommitted
wifi: ath12k: account TX stats only when ACK/BA status is present
[ Upstream commit 1635ecc ] The fields tx_retry_failed, tx_retry_count, and tx_duration are currently updated outside the HTT_PPDU_STATS_TAG_USR_COMPLTN_ACK_BA_STATUS flag check. In certain scenarios, firmware delivers multiple PPDU statistics for the same PPDU, first without BA/ACK information, and later with BA/ACK status once it becomes available. As the same PPDU is processed again, these counters are updated a second time, resulting in duplicate TX statistics. To address this, move the accounting of tx_retry_failed and tx_retry_count under the ACK/BA status flag check, and similarly gate tx_duration on the same path. This ensures that each PPDU contributes to these counters exactly once, avoids double counting, and provides consistent reporting in userspace tools such as station dump. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1 Fixes: a0b963e ("wifi: ath12k: fetch tx_retry and tx_failed from htt_ppdu_stats_user_cmpltn_common_tlv") Signed-off-by: Sarika Sharma <sarika.sharma@oss.qualcomm.com> Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com> Link: https://patch.msgid.link/20260226051947.1379716-1-sarika.sharma@oss.qualcomm.com Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 94f9532 commit d2602a0

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

drivers/net/wireless/ath/ath12k/dp_htt.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,9 @@ ath12k_update_per_peer_tx_stats(struct ath12k_pdev_dp *dp_pdev,
205205
if (!(usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_RATE)))
206206
return;
207207

208-
if (usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON)) {
208+
if (usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON))
209209
is_ampdu =
210210
HTT_USR_CMPLTN_IS_AMPDU(usr_stats->cmpltn_cmn.flags);
211-
tx_retry_failed =
212-
__le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_tried) -
213-
__le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_success);
214-
tx_retry_count =
215-
HTT_USR_CMPLTN_LONG_RETRY(usr_stats->cmpltn_cmn.flags) +
216-
HTT_USR_CMPLTN_SHORT_RETRY(usr_stats->cmpltn_cmn.flags);
217-
}
218211

219212
if (usr_stats->tlv_flags &
220213
BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_ACK_BA_STATUS)) {
@@ -223,10 +216,19 @@ ath12k_update_per_peer_tx_stats(struct ath12k_pdev_dp *dp_pdev,
223216
HTT_PPDU_STATS_ACK_BA_INFO_NUM_MSDU_M);
224217
tid = le32_get_bits(usr_stats->ack_ba.info,
225218
HTT_PPDU_STATS_ACK_BA_INFO_TID_NUM);
226-
}
227219

228-
if (common->fes_duration_us)
229-
tx_duration = le32_to_cpu(common->fes_duration_us);
220+
if (usr_stats->tlv_flags & BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON)) {
221+
tx_retry_failed =
222+
__le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_tried) -
223+
__le16_to_cpu(usr_stats->cmpltn_cmn.mpdu_success);
224+
tx_retry_count =
225+
HTT_USR_CMPLTN_LONG_RETRY(usr_stats->cmpltn_cmn.flags) +
226+
HTT_USR_CMPLTN_SHORT_RETRY(usr_stats->cmpltn_cmn.flags);
227+
}
228+
229+
if (common->fes_duration_us)
230+
tx_duration = le32_to_cpu(common->fes_duration_us);
231+
}
230232

231233
user_rate = &usr_stats->rate;
232234
flags = HTT_USR_RATE_PREAMBLE(user_rate->rate_flags);

0 commit comments

Comments
 (0)