]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: Support Latency Stats
authorDinesh Karthikeyan <quic_dinek@quicinc.com>
Tue, 4 Feb 2025 06:44:14 +0000 (12:14 +0530)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Tue, 11 Feb 2025 15:27:11 +0000 (07:27 -0800)
Add support to request latency stats from firmware through HTT stats
type 25. These stats give information about count of transmitted and
received MAC Protocol Data Units(PDU) and Service Data Units(SDU)
and other latency stats.

Sample output:
-------------
echo 25 > /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/htt_stats_type
cat /sys/kernel/debug/ath12k/pci-0000\:06\:00.0/mac0/htt_stats
HTT_STATS_LATENCY_CTX_TLV:
duration = 0
tx_msdu_cnt = 0
tx_mpdu_cnt = 0
rx_msdu_cnt = 0
rx_mpdu_cnt = 0

HTT_STATS_LATENCY_PROF_TLV:
Latency name = PROF_SCH_ENQ_TQM_CMDS
count = 0
minimum = 4294967295
maximum = 0
.....

HTT_STATS_LATENCY_CNT_TLV:
prof_enable_cnt = 39

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Dinesh Karthikeyan <quic_dinek@quicinc.com>
Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
Link: https://patch.msgid.link/20250204064417.3671928-3-quic_rdevanat@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h

index 9998c5cf7ab0e5ff6e07d77d106f452d32343f22..0abca93e08020f676b2cbb5cc83638da07cc1993 100644 (file)
@@ -2838,6 +2838,91 @@ ath12k_htt_print_pdev_obss_pd_stats_tlv(const void *tag_buf, u16 tag_len,
        stats_req->buf_len = len;
 }
 
+static void
+ath12k_htt_print_latency_prof_ctx_tlv(const void *tag_buf, u16 tag_len,
+                                     struct debug_htt_stats_req *stats_req)
+{
+       const struct ath12k_htt_latency_prof_ctx_tlv *htt_stats_buf = tag_buf;
+       u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
+       u32 len = stats_req->buf_len;
+       u8 *buf = stats_req->buf;
+
+       if (tag_len < sizeof(*htt_stats_buf))
+               return;
+
+       len += scnprintf(buf + len, buf_len - len, "HTT_STATS_LATENCY_CTX_TLV:\n");
+       len += scnprintf(buf + len, buf_len - len, "duration = %u\n",
+                        le32_to_cpu(htt_stats_buf->duration));
+       len += scnprintf(buf + len, buf_len - len, "tx_msdu_cnt = %u\n",
+                        le32_to_cpu(htt_stats_buf->tx_msdu_cnt));
+       len += scnprintf(buf + len, buf_len - len, "tx_mpdu_cnt = %u\n",
+                        le32_to_cpu(htt_stats_buf->tx_mpdu_cnt));
+       len += scnprintf(buf + len, buf_len - len, "rx_msdu_cnt = %u\n",
+                        le32_to_cpu(htt_stats_buf->rx_msdu_cnt));
+       len += scnprintf(buf + len, buf_len - len, "rx_mpdu_cnt = %u\n\n",
+                        le32_to_cpu(htt_stats_buf->rx_mpdu_cnt));
+
+       stats_req->buf_len = len;
+}
+
+static void
+ath12k_htt_print_latency_prof_cnt(const void *tag_buf, u16 tag_len,
+                                 struct debug_htt_stats_req *stats_req)
+{
+       const struct ath12k_htt_latency_prof_cnt_tlv *htt_stats_buf = tag_buf;
+       u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
+       u32 len = stats_req->buf_len;
+       u8 *buf = stats_req->buf;
+
+       if (tag_len < sizeof(*htt_stats_buf))
+               return;
+
+       len += scnprintf(buf + len, buf_len - len, "HTT_STATS_LATENCY_CNT_TLV:\n");
+       len += scnprintf(buf + len, buf_len - len, "prof_enable_cnt = %u\n\n",
+                        le32_to_cpu(htt_stats_buf->prof_enable_cnt));
+
+       stats_req->buf_len = len;
+}
+
+static void
+ath12k_htt_print_latency_prof_stats_tlv(const void *tag_buf, u16 tag_len,
+                                       struct debug_htt_stats_req *stats_req)
+{
+       const struct ath12k_htt_latency_prof_stats_tlv *htt_stats_buf = tag_buf;
+       u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
+       u32 len = stats_req->buf_len;
+       u8 *buf = stats_req->buf;
+
+       if (tag_len < sizeof(*htt_stats_buf))
+               return;
+
+       if (le32_to_cpu(htt_stats_buf->print_header) == 1) {
+               len += scnprintf(buf + len, buf_len - len,
+                                "HTT_STATS_LATENCY_PROF_TLV:\n");
+       }
+
+       len += scnprintf(buf + len, buf_len - len, "Latency name = %s\n",
+                        htt_stats_buf->latency_prof_name);
+       len += scnprintf(buf + len, buf_len - len, "count = %u\n",
+                        le32_to_cpu(htt_stats_buf->cnt));
+       len += scnprintf(buf + len, buf_len - len, "minimum = %u\n",
+                        le32_to_cpu(htt_stats_buf->min));
+       len += scnprintf(buf + len, buf_len - len, "maximum = %u\n",
+                        le32_to_cpu(htt_stats_buf->max));
+       len += scnprintf(buf + len, buf_len - len, "last = %u\n",
+                        le32_to_cpu(htt_stats_buf->last));
+       len += scnprintf(buf + len, buf_len - len, "total = %u\n",
+                        le32_to_cpu(htt_stats_buf->tot));
+       len += scnprintf(buf + len, buf_len - len, "average = %u\n",
+                        le32_to_cpu(htt_stats_buf->avg));
+       len += scnprintf(buf + len, buf_len - len, "histogram interval = %u\n",
+                        le32_to_cpu(htt_stats_buf->hist_intvl));
+       len += print_array_to_buf(buf, len, "histogram", htt_stats_buf->hist,
+                                 ATH12K_HTT_LATENCY_PROFILE_NUM_MAX_HIST, "\n\n");
+
+       stats_req->buf_len = len;
+}
+
 static void
 ath12k_htt_print_pdev_tx_rate_txbf_stats_tlv(const void *tag_buf, u16 tag_len,
                                             struct debug_htt_stats_req *stats_req)
@@ -4741,6 +4826,15 @@ static int ath12k_dbg_htt_ext_stats_parse(struct ath12k_base *ab,
        case HTT_STATS_PDEV_OBSS_PD_TAG:
                ath12k_htt_print_pdev_obss_pd_stats_tlv(tag_buf, len, stats_req);
                break;
+       case HTT_STATS_LATENCY_CTX_TAG:
+               ath12k_htt_print_latency_prof_ctx_tlv(tag_buf, len, stats_req);
+               break;
+       case HTT_STATS_LATENCY_CNT_TAG:
+               ath12k_htt_print_latency_prof_cnt(tag_buf, len, stats_req);
+               break;
+       case HTT_STATS_LATENCY_PROF_STATS_TAG:
+               ath12k_htt_print_latency_prof_stats_tlv(tag_buf, len, stats_req);
+               break;
        case HTT_STATS_PDEV_TX_RATE_TXBF_STATS_TAG:
                ath12k_htt_print_pdev_tx_rate_txbf_stats_tlv(tag_buf, len, stats_req);
                break;
index a4dd894df077039c4481ab1739abbad50445c64b..1b835473f419c3168bf20a71f1428cf5aeb9a5f7 100644 (file)
@@ -138,6 +138,7 @@ enum ath12k_dbg_htt_ext_stats_type {
        ATH12K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS         = 19,
        ATH12K_DBG_HTT_EXT_STATS_TX_SOUNDING_INFO       = 22,
        ATH12K_DBG_HTT_EXT_STATS_PDEV_OBSS_PD_STATS     = 23,
+       ATH12K_DBG_HTT_EXT_STATS_LATENCY_PROF_STATS     = 25,
        ATH12K_DBG_HTT_EXT_STATS_PDEV_RX_RATE_EXT       = 30,
        ATH12K_DBG_HTT_EXT_STATS_PDEV_TX_RATE_TXBF      = 31,
        ATH12K_DBG_HTT_EXT_STATS_TXBF_OFDMA             = 32,
@@ -206,6 +207,9 @@ enum ath12k_dbg_htt_tlv_tag {
        HTT_STATS_SCHED_TXQ_SCHED_INELIGIBILITY_TAG     = 87,
        HTT_STATS_PDEV_OBSS_PD_TAG                      = 88,
        HTT_STATS_HW_WAR_TAG                            = 89,
+       HTT_STATS_LATENCY_PROF_STATS_TAG                = 91,
+       HTT_STATS_LATENCY_CTX_TAG                       = 92,
+       HTT_STATS_LATENCY_CNT_TAG                       = 93,
        HTT_STATS_SCHED_TXQ_SUPERCYCLE_TRIGGER_TAG      = 100,
        HTT_STATS_PDEV_CTRL_PATH_TX_STATS_TAG           = 102,
        HTT_STATS_RX_PDEV_RATE_EXT_STATS_TAG            = 103,
@@ -1340,6 +1344,36 @@ struct ath12k_htt_pdev_obss_pd_stats_tlv {
        __le32 num_sr_ppdu_abort_flush_cnt;
 } __packed;
 
+#define ATH12K_HTT_STATS_MAX_PROF_STATS_NAME_LEN       32
+#define ATH12K_HTT_LATENCY_PROFILE_NUM_MAX_HIST                3
+#define ATH12K_HTT_INTERRUPTS_LATENCY_PROFILE_MAX_HIST 3
+
+struct ath12k_htt_latency_prof_stats_tlv {
+       __le32 print_header;
+       s8 latency_prof_name[ATH12K_HTT_STATS_MAX_PROF_STATS_NAME_LEN];
+       __le32 cnt;
+       __le32 min;
+       __le32 max;
+       __le32 last;
+       __le32 tot;
+       __le32 avg;
+       __le32 hist_intvl;
+       __le32 hist[ATH12K_HTT_LATENCY_PROFILE_NUM_MAX_HIST];
+}  __packed;
+
+struct ath12k_htt_latency_prof_ctx_tlv {
+       __le32 duration;
+       __le32 tx_msdu_cnt;
+       __le32 tx_mpdu_cnt;
+       __le32 tx_ppdu_cnt;
+       __le32 rx_msdu_cnt;
+       __le32 rx_mpdu_cnt;
+} __packed;
+
+struct ath12k_htt_latency_prof_cnt_tlv {
+       __le32 prof_enable_cnt;
+} __packed;
+
 #define ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS           14
 #define ATH12K_HTT_TX_PDEV_STATS_NUM_LEGACY_OFDM_STATS         8
 #define ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS           8