wlan-ap-Telecominfraproject/feeds/ipq95xx/mac80211/patches/qca/665-ath12k-Update-wbm_tx_stats-upon-tx-completion.patch
John Crispin b9b03a6e38 ipq95xx: add Qualcomm wifi-7 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00

124 lines
4.3 KiB
Diff

From 94fc0558028af74929df225287077c85eee8b6f0 Mon Sep 17 00:00:00 2001
From: Dinesh Karthikeyan <quic_dinek@quicinc.com>
Date: Thu, 8 Sep 2022 12:05:33 +0530
Subject: [PATCH] ath12k: Update wbm_tx_stats upon tx completion
Account the wbm_tx_stats for wbm_tx_comp_stats which is displayed in
the per peer Tx stats.
Signed-off-by: Dinesh Karthikeyan <quic_dinek@quicinc.com>
---
drivers/net/wireless/ath/ath12k/debugfs_sta.c | 17 ++++++++++++++++-
drivers/net/wireless/ath/ath12k/dp_tx.c | 10 ++++++++++
drivers/net/wireless/ath/ath12k/mac.c | 9 +++++++++
3 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath12k/debugfs_sta.c b/drivers/net/wireless/ath/ath12k/debugfs_sta.c
index 826d6e1..4da9f97 100644
--- a/drivers/net/wireless/ath/ath12k/debugfs_sta.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs_sta.c
@@ -210,8 +210,15 @@ static ssize_t ath12k_dbg_sta_dump_tx_stats(struct file *file,
const int size = 2 * 4096;
char *buf, mu_group_id[MAX_MU_GROUP_LENGTH] = {0};
u32 index;
+ char *fields[] = {[HAL_WBM_REL_HTT_TX_COMP_STATUS_OK] = "Acked pkt count",
+ [HAL_WBM_REL_HTT_TX_COMP_STATUS_TTL] = "Status ttl pkt count",
+ [HAL_WBM_REL_HTT_TX_COMP_STATUS_DROP] = "Dropped pkt count",
+ [HAL_WBM_REL_HTT_TX_COMP_STATUS_REINJ] = "Reinj pkt count",
+ [HAL_WBM_REL_HTT_TX_COMP_STATUS_INSPECT] = "Inspect pkt count",
+ [HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY] = "MEC notify pkt count"};
+ int idx;
- if (!arsta->tx_stats)
+ if (!arsta->tx_stats || !arsta->wbm_tx_stats)
return -ENOENT;
buf = kzalloc(size, GFP_KERNEL);
@@ -353,6 +360,14 @@ static ssize_t ath12k_dbg_sta_dump_tx_stats(struct file *file,
len += scnprintf(buf + len, size - len,
"ack fails\n %llu\n\n", arsta->tx_stats->ack_fails);
+ len += scnprintf(buf + len, size - len, "WBM tx completion stats of data pkts :\n");
+ for (idx = 0; idx <= HAL_WBM_REL_HTT_TX_COMP_STATUS_MEC_NOTIFY; idx++) {
+ len += scnprintf(buf + len, size - len,
+ "%-23s : %llu\n",
+ fields[idx],
+ arsta->wbm_tx_stats->wbm_tx_comp_stats[idx]);
+ }
+
spin_unlock_bh(&ar->data_lock);
if (len > size)
diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c
index bdaafd7..082caba 100644
--- a/drivers/net/wireless/ath/ath12k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
@@ -634,6 +634,7 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar,
struct rate_info rate;
struct hal_tx_status ts = { 0 };
enum hal_wbm_tqm_rel_reason rel_status;
+ enum hal_wbm_htt_tx_comp_status wbm_status;
struct ieee80211_vif *vif;
u8 flags = 0;
@@ -684,6 +685,9 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar,
return;
}
+ wbm_status = FIELD_GET(HTT_TX_WBM_COMP_INFO0_STATUS,
+ tx_status->info0);
+
vif = skb_cb->vif;
info = IEEE80211_SKB_CB(msdu);
@@ -745,6 +749,12 @@ static void ath12k_dp_tx_complete_msdu(struct ath12k *ar,
status.info = info;
rate = arsta->last_txrate;
status.rate = &rate;
+
+ if (unlikely(ath12k_debugfs_is_extd_tx_stats_enabled(ar))) {
+ if(arsta->wbm_tx_stats && wbm_status < HAL_WBM_REL_HTT_TX_COMP_STATUS_MAX)
+ arsta->wbm_tx_stats->wbm_tx_comp_stats[wbm_status]++;
+ }
+
spin_unlock_bh(&ab->base_lock);
if (flags & ATH12K_SKB_HW_80211_ENCAP)
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index f16a1d6..f3c1c1d 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5212,6 +5212,11 @@ static int ath12k_mac_station_add(struct ath12k *ar,
ret = -ENOMEM;
goto free_peer;
}
+ arsta->wbm_tx_stats = kzalloc(sizeof(*arsta->wbm_tx_stats), GFP_KERNEL);
+ if(!arsta->wbm_tx_stats) {
+ ret = -ENOMEM;
+ goto free_peer;
+ }
}
if (ieee80211_vif_is_mesh(vif)) {
@@ -5247,6 +5252,8 @@ static int ath12k_mac_station_add(struct ath12k *ar,
free_tx_stats:
kfree(arsta->tx_stats);
arsta->tx_stats = NULL;
+ kfree(arsta->wbm_tx_stats);
+ arsta->wbm_tx_stats = NULL;
free_peer:
ath12k_peer_delete(ar, arvif->vdev_id, sta->addr);
free_rx_stats:
@@ -5327,6 +5334,8 @@ static int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
kfree(arsta->tx_stats);
arsta->tx_stats = NULL;
+ kfree(arsta->wbm_tx_stats);
+ arsta->wbm_tx_stats = NULL;
kfree(arsta->rx_stats);
arsta->rx_stats = NULL;
--
2.17.1