Skip to content

Commit c9f6ee2

Browse files
Pradeep Kumar Chitrapujeff-t-johnson
authored andcommitted
wifi: ath12k: Support Transmit Rate Buffer Stats
Add support to request transmit rate buffer stats from firmware through HTT stats type 31. These stats give information such as MCS, NSS and bandwidth of transmit and input buffer. Sample output: ------------- echo 31 > /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_PDEV_TX_RATE_TXBF_STATS: Legacy OFDM Rates: 6 Mbps: 0, 9 Mbps: 0, 12 Mbps: 0, 18 Mbps: 0 24 Mbps: 0, 36 Mbps: 0, 48 Mbps: 0, 54 Mbps: 0 tx_ol_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_ibf_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_txbf_mcs = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0, 8:0, 9:0, 10:0, 11:0, 12:0, 13:0 tx_ol_nss = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 tx_ibf_nss = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 tx_txbf_nss = 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 tx_ol_bw = 0:0, 1:0, 2:0, 3:0, 4:0 half_tx_ol_bw = 0:0, 1:0, 2:0, 3:0, 4:0 quarter_tx_ol_bw = 0:0, 1:0, 2:0, 3:0, 4:0 tx_ibf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 half_tx_ibf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 quarter_tx_ibf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 tx_txbf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 half_tx_txbf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 quarter_tx_txbf_bw = 0:0, 1:0, 2:0, 3:0, 4:0 HTT_STATS_PDEV_TXBF_FLAG_RETURN_STATS: TXBF_reason_code_stats: 0:0, 1:0, 2:0, 3:0, 4:0, 5:0, 6:0, 7:0 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: Pradeep Kumar Chitrapu <[email protected]> Signed-off-by: Roopni Devanathan <[email protected]> Acked-by: Kalle Valo <[email protected]> Acked-by: Jeff Johnson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent 3540bba commit c9f6ee2

File tree

2 files changed

+127
-0
lines changed

2 files changed

+127
-0
lines changed

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

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2576,6 +2576,98 @@ ath12k_htt_print_pdev_obss_pd_stats_tlv(const void *tag_buf, u16 tag_len,
25762576
stats_req->buf_len = len;
25772577
}
25782578

2579+
static void
2580+
ath12k_htt_print_pdev_tx_rate_txbf_stats_tlv(const void *tag_buf, u16 tag_len,
2581+
struct debug_htt_stats_req *stats_req)
2582+
{
2583+
const struct ath12k_htt_pdev_txrate_txbf_stats_tlv *htt_stats_buf = tag_buf;
2584+
u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE;
2585+
u32 len = stats_req->buf_len;
2586+
u8 *buf = stats_req->buf;
2587+
u8 i;
2588+
2589+
if (tag_len < sizeof(*htt_stats_buf))
2590+
return;
2591+
2592+
len += scnprintf(buf + len, buf_len - len,
2593+
"HTT_STATS_PDEV_TX_RATE_TXBF_STATS:\n");
2594+
len += scnprintf(buf + len, buf_len - len, "Legacy OFDM Rates: 6 Mbps: %u, ",
2595+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[0]));
2596+
len += scnprintf(buf + len, buf_len - len, "9 Mbps: %u, 12 Mbps: %u, ",
2597+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[1]),
2598+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[2]));
2599+
len += scnprintf(buf + len, buf_len - len, "18 Mbps: %u\n",
2600+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[3]));
2601+
len += scnprintf(buf + len, buf_len - len, "24 Mbps: %u, 36 Mbps: %u, ",
2602+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[4]),
2603+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[5]));
2604+
len += scnprintf(buf + len, buf_len - len, "48 Mbps: %u, 54 Mbps: %u\n",
2605+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[6]),
2606+
le32_to_cpu(htt_stats_buf->tx_legacy_ofdm_rate[7]));
2607+
2608+
len += print_array_to_buf(buf, len, "tx_ol_mcs", htt_stats_buf->tx_su_ol_mcs,
2609+
ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS, "\n");
2610+
len += print_array_to_buf(buf, len, "tx_ibf_mcs", htt_stats_buf->tx_su_ibf_mcs,
2611+
ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS, "\n");
2612+
len += print_array_to_buf(buf, len, "tx_txbf_mcs", htt_stats_buf->tx_su_txbf_mcs,
2613+
ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS, "\n");
2614+
len += print_array_to_buf_index(buf, len, "tx_ol_nss", 1,
2615+
htt_stats_buf->tx_su_ol_nss,
2616+
ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS,
2617+
"\n");
2618+
len += print_array_to_buf_index(buf, len, "tx_ibf_nss", 1,
2619+
htt_stats_buf->tx_su_ibf_nss,
2620+
ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS,
2621+
"\n");
2622+
len += print_array_to_buf_index(buf, len, "tx_txbf_nss", 1,
2623+
htt_stats_buf->tx_su_txbf_nss,
2624+
ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS,
2625+
"\n");
2626+
len += print_array_to_buf(buf, len, "tx_ol_bw", htt_stats_buf->tx_su_ol_bw,
2627+
ATH12K_HTT_TXBF_NUM_BW_CNTRS, "\n");
2628+
for (i = 0; i < ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES; i++)
2629+
len += print_array_to_buf(buf, len, i ? "quarter_tx_ol_bw" :
2630+
"half_tx_ol_bw",
2631+
htt_stats_buf->ol[i],
2632+
ATH12K_HTT_TXBF_NUM_BW_CNTRS,
2633+
"\n");
2634+
2635+
len += print_array_to_buf(buf, len, "tx_ibf_bw", htt_stats_buf->tx_su_ibf_bw,
2636+
ATH12K_HTT_TXBF_NUM_BW_CNTRS, "\n");
2637+
for (i = 0; i < ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES; i++)
2638+
len += print_array_to_buf(buf, len, i ? "quarter_tx_ibf_bw" :
2639+
"half_tx_ibf_bw",
2640+
htt_stats_buf->ibf[i],
2641+
ATH12K_HTT_TXBF_NUM_BW_CNTRS,
2642+
"\n");
2643+
2644+
len += print_array_to_buf(buf, len, "tx_txbf_bw", htt_stats_buf->tx_su_txbf_bw,
2645+
ATH12K_HTT_TXBF_NUM_BW_CNTRS, "\n");
2646+
for (i = 0; i < ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES; i++)
2647+
len += print_array_to_buf(buf, len, i ? "quarter_tx_txbf_bw" :
2648+
"half_tx_txbf_bw",
2649+
htt_stats_buf->txbf[i],
2650+
ATH12K_HTT_TXBF_NUM_BW_CNTRS,
2651+
"\n");
2652+
len += scnprintf(buf + len, buf_len - len, "\n");
2653+
2654+
len += scnprintf(buf + len, buf_len - len,
2655+
"HTT_STATS_PDEV_TXBF_FLAG_RETURN_STATS:\n");
2656+
len += scnprintf(buf + len, buf_len - len, "TXBF_reason_code_stats: 0:%u, 1:%u,",
2657+
le32_to_cpu(htt_stats_buf->txbf_flag_set_mu_mode),
2658+
le32_to_cpu(htt_stats_buf->txbf_flag_set_final_status));
2659+
len += scnprintf(buf + len, buf_len - len, " 2:%u, 3:%u, 4:%u, 5:%u, ",
2660+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_verified_txbf_mode),
2661+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_disable_p2p_access),
2662+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_max_nss_in_he160),
2663+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_disable_uldlofdma));
2664+
len += scnprintf(buf + len, buf_len - len, "6:%u, 7:%u\n\n",
2665+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_mcs_threshold_val),
2666+
le32_to_cpu(htt_stats_buf->txbf_flag_not_set_final_status));
2667+
2668+
stats_req->buf_len = len;
2669+
}
2670+
25792671
static void ath12k_htt_print_dlpager_entry(const struct ath12k_htt_pgs_info *pg_info,
25802672
int idx, char *str_buf)
25812673
{
@@ -3508,6 +3600,9 @@ static int ath12k_dbg_htt_ext_stats_parse(struct ath12k_base *ab,
35083600
case HTT_STATS_PDEV_OBSS_PD_TAG:
35093601
ath12k_htt_print_pdev_obss_pd_stats_tlv(tag_buf, len, stats_req);
35103602
break;
3603+
case HTT_STATS_PDEV_TX_RATE_TXBF_STATS_TAG:
3604+
ath12k_htt_print_pdev_tx_rate_txbf_stats_tlv(tag_buf, len, stats_req);
3605+
break;
35113606
case HTT_STATS_DLPAGER_STATS_TAG:
35123607
ath12k_htt_print_dlpager_stats_tlv(tag_buf, len, stats_req);
35133608
break;

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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ enum ath12k_dbg_htt_ext_stats_type {
135135
ATH12K_DBG_HTT_EXT_STATS_PDEV_TX_MU = 17,
136136
ATH12K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS = 19,
137137
ATH12K_DBG_HTT_EXT_STATS_PDEV_OBSS_PD_STATS = 23,
138+
ATH12K_DBG_HTT_EXT_STATS_PDEV_TX_RATE_TXBF = 31,
138139
ATH12K_DBG_HTT_EXT_STATS_DLPAGER_STATS = 36,
139140
ATH12K_DBG_HTT_EXT_PHY_COUNTERS_AND_PHY_STATS = 37,
140141
ATH12K_DBG_HTT_EXT_VDEVS_TXRX_STATS = 38,
@@ -197,6 +198,7 @@ enum ath12k_dbg_htt_tlv_tag {
197198
HTT_STATS_HW_WAR_TAG = 89,
198199
HTT_STATS_SCHED_TXQ_SUPERCYCLE_TRIGGER_TAG = 100,
199200
HTT_STATS_PDEV_CTRL_PATH_TX_STATS_TAG = 102,
201+
HTT_STATS_PDEV_TX_RATE_TXBF_STATS_TAG = 108,
200202
HTT_STATS_TX_SELFGEN_AC_SCHED_STATUS_STATS_TAG = 111,
201203
HTT_STATS_TX_SELFGEN_AX_SCHED_STATUS_STATS_TAG = 112,
202204
HTT_STATS_DLPAGER_STATS_TAG = 120,
@@ -1068,6 +1070,36 @@ struct ath12k_htt_pdev_obss_pd_stats_tlv {
10681070
__le32 num_sr_ppdu_abort_flush_cnt;
10691071
} __packed;
10701072

1073+
#define ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS 14
1074+
#define ATH12K_HTT_TX_PDEV_STATS_NUM_LEGACY_OFDM_STATS 8
1075+
#define ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS 8
1076+
#define ATH12K_HTT_TXBF_NUM_BW_CNTRS 5
1077+
#define ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES 2
1078+
1079+
struct ath12k_htt_pdev_txrate_txbf_stats_tlv {
1080+
__le32 tx_su_txbf_mcs[ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS];
1081+
__le32 tx_su_ibf_mcs[ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS];
1082+
__le32 tx_su_ol_mcs[ATH12K_HTT_TX_BF_RATE_STATS_NUM_MCS_COUNTERS];
1083+
__le32 tx_su_txbf_nss[ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS];
1084+
__le32 tx_su_ibf_nss[ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS];
1085+
__le32 tx_su_ol_nss[ATH12K_HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS];
1086+
__le32 tx_su_txbf_bw[ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1087+
__le32 tx_su_ibf_bw[ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1088+
__le32 tx_su_ol_bw[ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1089+
__le32 tx_legacy_ofdm_rate[ATH12K_HTT_TX_PDEV_STATS_NUM_LEGACY_OFDM_STATS];
1090+
__le32 txbf[ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES][ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1091+
__le32 ibf[ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES][ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1092+
__le32 ol[ATH12K_HTT_TXBF_NUM_REDUCED_CHAN_TYPES][ATH12K_HTT_TXBF_NUM_BW_CNTRS];
1093+
__le32 txbf_flag_set_mu_mode;
1094+
__le32 txbf_flag_set_final_status;
1095+
__le32 txbf_flag_not_set_verified_txbf_mode;
1096+
__le32 txbf_flag_not_set_disable_p2p_access;
1097+
__le32 txbf_flag_not_set_max_nss_in_he160;
1098+
__le32 txbf_flag_not_set_disable_uldlofdma;
1099+
__le32 txbf_flag_not_set_mcs_threshold_val;
1100+
__le32 txbf_flag_not_set_final_status;
1101+
} __packed;
1102+
10711103
enum ath12k_htt_stats_page_lock_state {
10721104
ATH12K_HTT_STATS_PAGE_LOCKED = 0,
10731105
ATH12K_HTT_STATS_PAGE_UNLOCKED = 1,

0 commit comments

Comments
 (0)