On 7/24/2024 10:42 PM, Ramya Gnanasekar wrote: > From: Dinesh Karthikeyan <quic_dinek@xxxxxxxxxxx> > > Add support to parse and dump the Rx PDEV related stats such as > SOC stats, PHY error, MPDU error through htt stats type 2. > > Sample output: > ------------- > echo 2 > /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_RX_PDEV_FW_STATS_TLV: > mac_id = 0 > ppdu_recvd = 215 > mpdu_cnt_fcs_ok = 215 > mpdu_cnt_fcs_err = 0 > tcp_msdu_cnt = 0 > tcp_ack_msdu_cnt = 0 > udp_msdu_cnt = 0 > other_msdu_cnt = 215 > fw_ring_mpdu_ind = 215 > fw_ring_mgmt_subtype = 0:0, 1:0, 2:0, 3:0, 4:21, 5:1, 6:0, 7:0, 8:193, 9:0, 10:0, 11:0, 12:0, 13:0, 14:0, 15:0 > fw_ring_ctrl_subtype = 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, 14:0, 15:0 > fw_ring_mcast_data_msdu = 0 > fw_ring_bcast_data_msdu = 0 > fw_ring_ucast_data_msdu = 0 > fw_ring_null_data_msdu = 0 > fw_ring_mpdu_drop = 0 > ofld_local_data_ind_cnt = 0 > ofld_local_data_buf_recycle_cnt = 0 > drx_local_data_ind_cnt = 0 > drx_local_data_buf_recycle_cnt = 0 > local_nondata_ind_cnt = 215 > local_nondata_buf_recycle_cnt = 215 > fw_status_buf_ring_refill_cnt = 215 > fw_status_buf_ring_empty_cnt = 0 > fw_pkt_buf_ring_refill_cnt = 215 > fw_pkt_buf_ring_empty_cnt = 0 > fw_link_buf_ring_refill_cnt = 215 > fw_link_buf_ring_empty_cnt = 0 > host_pkt_buf_ring_refill_cnt = 0 > host_pkt_buf_ring_empty_cnt = 0 > mon_pkt_buf_ring_refill_cnt = 0 > mon_pkt_buf_ring_empty_cnt = 0 > mon_status_buf_ring_refill_cnt = 0 > mon_status_buf_ring_empty_cnt = 0 > mon_desc_buf_ring_refill_cnt = 0 > mon_desc_buf_ring_empty_cnt = 0 > mon_dest_ring_update_cnt = 0 > mon_dest_ring_full_cnt = 0 > rx_suspend_cnt = 0 > rx_resume_fail_cnt = 0 > rx_ring_switch_cnt = 0 > rx_ring_restore_cnt = 0 > rx_flush_cnt = 0 > rx_recovery_reset_cnt = 0 > > HTT_RX_PDEV_FW_RING_MPDU_ERR_TLV: > fw_ring_mpdu_err = 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, 14:0, 15:0 > > HTT_RX_PDEV_FW_MPDU_DROP_TLV: > fw_mpdu_drop = 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, 14:0, 15:0 > > HTT_RX_SOC_FW_STATS_TLV: > fw_reo_ring_data_msdu = 0 > fw_to_host_data_msdu_bcmc = 0 > fw_to_host_data_msdu_uc = 0 > ofld_remote_data_buf_recycle_cnt = 0 > ofld_remote_free_buf_indication_cnt = 0 > ofld_buf_to_host_data_msdu_uc = 0 > reo_fw_ring_to_host_data_msdu_uc = 0 > wbm_sw_ring_reap = 0 > wbm_forward_to_host_cnt = 0 > wbm_target_recycle_cnt = 0 > target_refill_ring_recycle_cnt = 0 > > HTT_RX_SOC_FW_REFILL_RING_EMPTY_TLV: > refill_ring_empty_cnt = 0:0, 1:0, 2:0, 3:0 > > HTT_RX_SOC_FW_REFILL_RING_NUM_REFILL_TLV: > refill_ring_num_refill = 0:0, 1:0, 2:0, 3:0 > > HTT_RX_SOC_FW_REFILL_RING_NUM_RXDMA_ERR_TLV: > rxdma_err = 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, 14:0, 15:0 > > HTT_RX_SOC_FW_REFILL_RING_NUM_REO_ERR_TLV: > reo_err = 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, 14:0, 15:0 > > HTT_RX_PDEV_FW_STATS_PHY_ERR_TLV: > mac_id_word = 0 > total_phy_err_nct = 0 > phy_errs = 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, 14:0, 15:0, 16:0, 17:0, 18:0, 19:0, 20:0, 21:0, 22:0, 23:0, 24:0, 25:0, 26:0, 27:0, 28:0, 29:0, 30:0, 31:0, 32:0, 33:0, 34:0, 35:0, 36:0, 37:0, 38:0, 39:0, 40:0, 41:0, 42:0 > > 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.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 > > Signed-off-by: Dinesh Karthikeyan <quic_dinek@xxxxxxxxxxx> > Signed-off-by: Ramya Gnanasekar <quic_rgnanase@xxxxxxxxxxx> > --- > drivers/net/wireless/ath/ath12k/debugfs.h | 2 + > .../wireless/ath/ath12k/debugfs_htt_stats.c | 342 ++++++++++++++++++ > .../wireless/ath/ath12k/debugfs_htt_stats.h | 138 +++++++ > 3 files changed, 482 insertions(+) > > diff --git a/drivers/net/wireless/ath/ath12k/debugfs.h b/drivers/net/wireless/ath/ath12k/debugfs.h > index 8d64ba03aa9a..00b34e00cdf2 100644 > --- a/drivers/net/wireless/ath/ath12k/debugfs.h > +++ b/drivers/net/wireless/ath/ath12k/debugfs.h > @@ -7,6 +7,8 @@ > #ifndef _ATH12K_DEBUGFS_H_ > #define _ATH12K_DEBUGFS_H_ > > +#define IEEE80211_MGMT_FRAME_SUBTYPE_MAX 16 why define this here given that this header file doesn't need it? seems this should be defined in debugfs_htt_stats.h since that actually uses it also seems we should drop "MGMT_" since this is applicable to all frame types, not just management frames > + > #ifdef CONFIG_ATH12K_DEBUGFS > void ath12k_debugfs_soc_create(struct ath12k_base *ab); > void ath12k_debugfs_soc_destroy(struct ath12k_base *ab); > diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > index f1b7e74aefe4..c2b0bb134c11 100644 > --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c > @@ -1447,6 +1447,320 @@ ath12k_htt_print_tx_de_compl_stats_tlv(const void *tag_buf, u16 tag_len, > stats_req->buf_len = len; > } > ... > +static void > +htt_print_rx_soc_fw_refill_ring_num_refill_tlv(const void *tag_buf, > + u16 tag_len, > + struct debug_htt_stats_req *stats_req) > +{ > + const struct ath12k_htt_rx_soc_fw_refill_ring_num_refill_tlv *htt_stats_buf = > + tag_buf; > + u8 *buf = stats_req->buf; > + u32 len = stats_req->buf_len; > + u32 buf_len = ATH12K_HTT_STATS_BUF_SIZE; > + u16 num_elems = min_t(u16, (tag_len >> 2), > + ATH12K_HTT_RX_STATS_REFILL_MAX_RING); bad alignment? align on min_t( > + > + len += scnprintf(buf + len, buf_len - len, > + "HTT_RX_SOC_FW_REFILL_RING_NUM_REFILL_TLV:\n"); > + > + len += print_array_to_buf(buf, len, "refill_ring_num_refill", > + htt_stats_buf->refill_ring_num_refill, > + num_elems, "\n\n"); > + > + stats_req->buf_len = len; > +} ... > diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h > index d52b26b23e65..c411e7da4e09 100644 > --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h > +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h > @@ -7,6 +7,8 @@ > #ifndef DEBUG_HTT_STATS_H > #define DEBUG_HTT_STATS_H > > +#include "debugfs.h" is this needed if you move IEEE80211_[MGMT_]FRAME_SUBTYPE_MAX to this file? just those nit comments from me /jeff