Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH ath-next] wifi: ath11k: report TX retries in station statistics
@ 2026-10-18 17:18 Julius Bairaktaris
  2026-10-19  7:16 ` Nicolas Escande
  0 siblings, 1 reply; 3+ messages in thread
From: Julius Bairaktaris @ 2026-10-18 17:18 UTC (permalink / raw)
  To: jjohnson
  Cc: linux-wireless, ath11k, linux-kernel, baochen.qiang,
	rameshkumar.sundaram, john, kvalo

ath11k does not fill NL80211_STA_INFO_TX_RETRIES, and mac80211's TX
status accounting leaves it at zero because the driver reports no
per-rate try counts. The HTT PPDU statistics carry the MPDUs tried and
acknowledged per user. Report the unacknowledged MPDUs per station as TX
retries and leave TX failures to mac80211. Over 6 runs of 30 s the
station's TX retries track the firmware's pdev mpdu_requeued counter to
within 57 MPDUs.

Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
---
 drivers/net/wireless/ath/ath11k/core.h  | 1 +
 drivers/net/wireless/ath/ath11k/dp_rx.c | 5 +++++
 drivers/net/wireless/ath/ath11k/mac.c   | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index a0d725923e..f7ba888b61 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -556,6 +556,7 @@ struct ath11k_sta {
 	struct rate_info last_txrate;
 	u64 rx_duration;
 	u64 tx_duration;
+	u32 tx_retries;
 	u8 rssi_comb;
 	struct ewma_avg_rssi avg_rssi;
 	s8 rssi_beacon;
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 6d95f7b343..726a9fc807 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1454,6 +1454,11 @@ ath11k_update_per_peer_tx_stats(struct ath11k *ar,
 	sta = peer->sta;
 	arsta = ath11k_sta_to_arsta(sta);
 
+	if (usr_stats->cmpltn_cmn.mpdu_tried >
+	    usr_stats->cmpltn_cmn.mpdu_success)
+		arsta->tx_retries += usr_stats->cmpltn_cmn.mpdu_tried -
+				     usr_stats->cmpltn_cmn.mpdu_success;
+
 	memset(&arsta->txrate, 0, sizeof(arsta->txrate));
 
 	switch (flags) {
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 1a237adaa3..066a503d76 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9435,6 +9435,9 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw,
 	sinfo->tx_duration = arsta->tx_duration;
 	sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_DURATION);
 
+	sinfo->tx_retries = arsta->tx_retries;
+	sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_RETRIES);
+
 	if (arsta->txrate.legacy || arsta->txrate.nss) {
 		if (arsta->txrate.legacy) {
 			sinfo->txrate.legacy = arsta->txrate.legacy;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH ath-next] wifi: ath11k: report TX retries in station statistics
  2026-10-18 17:18 [PATCH ath-next] wifi: ath11k: report TX retries in station statistics Julius Bairaktaris
@ 2026-10-19  7:16 ` Nicolas Escande
  2026-10-19  7:41   ` Julius Bairaktaris
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Escande @ 2026-10-19  7:16 UTC (permalink / raw)
  To: Julius Bairaktaris, jjohnson; +Cc: linux-wireless, ath11k

On Sun Oct 18, 2026 at 7:18 PM CEST, Julius Bairaktaris wrote:
> ath11k does not fill NL80211_STA_INFO_TX_RETRIES, and mac80211's TX
> status accounting leaves it at zero because the driver reports no
> per-rate try counts. The HTT PPDU statistics carry the MPDUs tried and
> acknowledged per user. Report the unacknowledged MPDUs per station as TX
> retries and leave TX failures to mac80211. Over 6 runs of 30 s the
> station's TX retries track the firmware's pdev mpdu_requeued counter to
> within 57 MPDUs.
>
> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
>
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
> ---
>  drivers/net/wireless/ath/ath11k/core.h  | 1 +
>  drivers/net/wireless/ath/ath11k/dp_rx.c | 5 +++++
>  drivers/net/wireless/ath/ath11k/mac.c   | 3 +++
>  3 files changed, 9 insertions(+)
There seems to be a way to retrieve this info directly per tx completion: 

https://git.codelinaro.org/clo/qsdk/oss/system/feeds/wlan-open/-/raw/win.wlan_host_opensource.4.0.r39/patches/ath11k/0149-ath11k-fix-tx-bitrate-retry-signal-in-station-dump.patch
and the try_cnt comes from
https://git.codelinaro.org/clo/qsdk/oss/system/feeds/wlan-open/-/raw/win.wlan_host_opensource.4.0.r39/patches/ath11k/0117-001-ath11k-optimize-tx-completions.patch

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH ath-next] wifi: ath11k: report TX retries in station statistics
  2026-10-19  7:16 ` Nicolas Escande
@ 2026-10-19  7:41   ` Julius Bairaktaris
  0 siblings, 0 replies; 3+ messages in thread
From: Julius Bairaktaris @ 2026-10-19  7:41 UTC (permalink / raw)
  To: Nicolas Escande; +Cc: jjohnson, linux-wireless, ath11k

Hi Nicolas,

> There seems to be a way to retrieve this info directly per tx completion:

I checked the links and the way I see it the WBM transmit count is per
MSDU, so A-MSDUs inflate it.
The PPDU stats count MPDUs, as nl80211 expects so i will not switch.

Thanks for looking into this!

Julius

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-19  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 17:18 [PATCH ath-next] wifi: ath11k: report TX retries in station statistics Julius Bairaktaris
2026-10-19  7:16 ` Nicolas Escande
2026-10-19  7:41   ` Julius Bairaktaris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox