Skip to content

Commit d1cb4ea

Browse files
committed
wifi: ath12k: Support pdev CCA Stats
JIRA: https://issues.redhat.com/browse/RHEL-79791 commit 3f5ecfc Author: Dinesh Karthikeyan <[email protected]> Date: Sat Oct 5 15:48:16 2024 +0530 wifi: ath12k: Support pdev CCA Stats Add support to request CCA stats for physical devices from firmware through HTT stats type 19. These stats give information about channel number, number of records, counters' bitmap, collection interval and different CCA counters. Sample output: ------------- echo 19 > /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_PDEV_CCA_STATS_HIST_TLV (1s): chan_num = 5955 num_records = 10 valid_cca_counters_bitmap = 0xff collection_interval = 1000 HTT_PDEV_STATS_CCA_COUNTERS_TLV:(in usec) tx_frame_usec = 0 rx_frame_usec = 0 rx_clear_usec = 999955 my_rx_frame_usec = 0 usec_cnt = 999955 med_rx_idle_usec = 0 med_tx_idle_global_usec = 0 cca_obss_usec = 999955 ..... Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-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 <[email protected]> Signed-off-by: Roopni Devanathan <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]> Signed-off-by: Jose Ignacio Tornos Martinez <[email protected]>
1 parent 0a34997 commit d1cb4ea

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

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

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,6 +2378,65 @@ ath12k_htt_print_tx_pdev_mu_mimo_mpdu_stats_tlv(const void *tag_buf, u16 tag_len
23782378
stats_req->buf_len = len;
23792379
}
23802380

2381+
static void
2382+
ath12k_htt_print_pdev_cca_stats_hist_tlv(const void *tag_buf, u16 tag_len,
2383+
struct debug_htt_stats_req *stats_req)
2384+
{
2385+
const struct ath12k_htt_pdev_cca_stats_hist_v1_tlv *htt_stats_buf = tag_buf;
2386+
u8 *buf = stats_req->buf;
2387+
u32 len = stats_req->buf_len;
2388+
u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
2389+
2390+
if (tag_len < sizeof(*htt_stats_buf))
2391+
return;
2392+
2393+
len += scnprintf(buf + len, buf_len - len, "HTT_PDEV_CCA_STATS_HIST_TLV :\n");
2394+
len += scnprintf(buf + len, buf_len - len, "chan_num = %u\n",
2395+
le32_to_cpu(htt_stats_buf->chan_num));
2396+
len += scnprintf(buf + len, buf_len - len, "num_records = %u\n",
2397+
le32_to_cpu(htt_stats_buf->num_records));
2398+
len += scnprintf(buf + len, buf_len - len, "valid_cca_counters_bitmap = 0x%x\n",
2399+
le32_to_cpu(htt_stats_buf->valid_cca_counters_bitmap));
2400+
len += scnprintf(buf + len, buf_len - len, "collection_interval = %u\n\n",
2401+
le32_to_cpu(htt_stats_buf->collection_interval));
2402+
2403+
stats_req->buf_len = len;
2404+
}
2405+
2406+
static void
2407+
ath12k_htt_print_pdev_stats_cca_counters_tlv(const void *tag_buf, u16 tag_len,
2408+
struct debug_htt_stats_req *stats_req)
2409+
{
2410+
const struct ath12k_htt_pdev_stats_cca_counters_tlv *htt_stats_buf = tag_buf;
2411+
u8 *buf = stats_req->buf;
2412+
u32 len = stats_req->buf_len;
2413+
u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
2414+
2415+
if (tag_len < sizeof(*htt_stats_buf))
2416+
return;
2417+
2418+
len += scnprintf(buf + len, buf_len - len,
2419+
"HTT_PDEV_STATS_CCA_COUNTERS_TLV:(in usec)\n");
2420+
len += scnprintf(buf + len, buf_len - len, "tx_frame_usec = %u\n",
2421+
le32_to_cpu(htt_stats_buf->tx_frame_usec));
2422+
len += scnprintf(buf + len, buf_len - len, "rx_frame_usec = %u\n",
2423+
le32_to_cpu(htt_stats_buf->rx_frame_usec));
2424+
len += scnprintf(buf + len, buf_len - len, "rx_clear_usec = %u\n",
2425+
le32_to_cpu(htt_stats_buf->rx_clear_usec));
2426+
len += scnprintf(buf + len, buf_len - len, "my_rx_frame_usec = %u\n",
2427+
le32_to_cpu(htt_stats_buf->my_rx_frame_usec));
2428+
len += scnprintf(buf + len, buf_len - len, "usec_cnt = %u\n",
2429+
le32_to_cpu(htt_stats_buf->usec_cnt));
2430+
len += scnprintf(buf + len, buf_len - len, "med_rx_idle_usec = %u\n",
2431+
le32_to_cpu(htt_stats_buf->med_rx_idle_usec));
2432+
len += scnprintf(buf + len, buf_len - len, "med_tx_idle_global_usec = %u\n",
2433+
le32_to_cpu(htt_stats_buf->med_tx_idle_global_usec));
2434+
len += scnprintf(buf + len, buf_len - len, "cca_obss_usec = %u\n\n",
2435+
le32_to_cpu(htt_stats_buf->cca_obss_usec));
2436+
2437+
stats_req->buf_len = len;
2438+
}
2439+
23812440
static int ath12k_dbg_htt_ext_stats_parse(struct ath12k_base *ab,
23822441
u16 tag, u16 len, const void *tag_buf,
23832442
void *user_data)
@@ -2540,6 +2599,14 @@ static int ath12k_dbg_htt_ext_stats_parse(struct ath12k_base *ab,
25402599
case HTT_STATS_TX_PDEV_MPDU_STATS_TAG:
25412600
ath12k_htt_print_tx_pdev_mu_mimo_mpdu_stats_tlv(tag_buf, len, stats_req);
25422601
break;
2602+
case HTT_STATS_PDEV_CCA_1SEC_HIST_TAG:
2603+
case HTT_STATS_PDEV_CCA_100MSEC_HIST_TAG:
2604+
case HTT_STATS_PDEV_CCA_STAT_CUMULATIVE_TAG:
2605+
ath12k_htt_print_pdev_cca_stats_hist_tlv(tag_buf, len, stats_req);
2606+
break;
2607+
case HTT_STATS_PDEV_CCA_COUNTERS_TAG:
2608+
ath12k_htt_print_pdev_stats_cca_counters_tlv(tag_buf, len, stats_req);
2609+
break;
25432610
default:
25442611
break;
25452612
}

drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ enum ath12k_dbg_htt_ext_stats_type {
133133
ATH12K_DBG_HTT_EXT_STATS_SRNG_INFO = 15,
134134
ATH12K_DBG_HTT_EXT_STATS_SFM_INFO = 16,
135135
ATH12K_DBG_HTT_EXT_STATS_PDEV_TX_MU = 17,
136+
ATH12K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS = 19,
136137

137138
/* keep this last */
138139
ATH12K_DBG_HTT_NUM_EXT_STATS,
@@ -176,6 +177,10 @@ enum ath12k_dbg_htt_tlv_tag {
176177
HTT_STATS_TX_DE_COMPL_STATS_TAG = 65,
177178
HTT_STATS_WHAL_TX_TAG = 66,
178179
HTT_STATS_TX_PDEV_SIFS_HIST_TAG = 67,
180+
HTT_STATS_PDEV_CCA_1SEC_HIST_TAG = 70,
181+
HTT_STATS_PDEV_CCA_100MSEC_HIST_TAG = 71,
182+
HTT_STATS_PDEV_CCA_STAT_CUMULATIVE_TAG = 72,
183+
HTT_STATS_PDEV_CCA_COUNTERS_TAG = 73,
179184
HTT_STATS_TX_PDEV_MPDU_STATS_TAG = 74,
180185
HTT_STATS_SCHED_TXQ_SCHED_ORDER_SU_TAG = 86,
181186
HTT_STATS_SCHED_TXQ_SCHED_INELIGIBILITY_TAG = 87,
@@ -1001,4 +1006,22 @@ struct ath12k_htt_tx_pdev_mpdu_stats_tlv {
10011006
__le32 tx_sched_mode;
10021007
} __packed;
10031008

1009+
struct ath12k_htt_pdev_stats_cca_counters_tlv {
1010+
__le32 tx_frame_usec;
1011+
__le32 rx_frame_usec;
1012+
__le32 rx_clear_usec;
1013+
__le32 my_rx_frame_usec;
1014+
__le32 usec_cnt;
1015+
__le32 med_rx_idle_usec;
1016+
__le32 med_tx_idle_global_usec;
1017+
__le32 cca_obss_usec;
1018+
} __packed;
1019+
1020+
struct ath12k_htt_pdev_cca_stats_hist_v1_tlv {
1021+
__le32 chan_num;
1022+
__le32 num_records;
1023+
__le32 valid_cca_counters_bitmap;
1024+
__le32 collection_interval;
1025+
} __packed;
1026+
10041027
#endif

0 commit comments

Comments
 (0)