From d293ae8bf203e42cf2fb29ed68664ad7a0465ab4 Mon Sep 17 00:00:00 2001 From: Lavanya Suresh Date: Thu, 11 Mar 2021 14:50:13 +0530 Subject: [PATCH] ath11k: Add htt stats for phy reset case New htt stats are added in htt stats type 37, to provide phy reset stats and counters. Usage: echo 37 > /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats_type cat /sys/kernel/debug/ieee80211/phyx/ath11k/htt_stats Signed-off-by: Lavanya Suresh --- drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c | 116 +++++++++++++++++++++- drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h | 99 ++++++++++++++++++ 2 files changed, 214 insertions(+), 1 deletion(-) --- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c +++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.c @@ -4507,9 +4507,13 @@ static inline void htt_print_phy_stats_t len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PHY_STATS_TLV:\n"); for (i = 0; i < HTT_STATS_MAX_CHAINS; i++) - len += HTT_DBG_OUT(buf + len, buf_len - len, "nf_chain[%d] = %d\n", + len += HTT_DBG_OUT(buf + len, buf_len - len, "bdf_nf_chain[%d] = %d\n", i, htt_stats_buf->nf_chain[i]); + for (i = 0; i < HTT_STATS_MAX_CHAINS; i++) + len += HTT_DBG_OUT(buf + len, buf_len - len, "runtime_nf_chain[%d] = %d\n", + i, htt_stats_buf->runtime_nf_chain[i]); + len += HTT_DBG_OUT(buf + len, buf_len - len, "false_radar_cnt = %u\n", htt_stats_buf->false_radar_cnt); len += HTT_DBG_OUT(buf + len, buf_len - len, "radar_cs_cnt = %u\n", @@ -4527,6 +4531,110 @@ static inline void htt_print_phy_stats_t stats_req->buf_len = len; } +static inline void htt_print_phy_reset_counters_tlv(const void *tag_buf, + struct debug_htt_stats_req *stats_req) +{ + const struct htt_phy_reset_counters_tlv *htt_stats_buf = tag_buf; + u8 *buf = stats_req->buf; + u32 len = stats_req->buf_len; + u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; + + len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PHY_RESET_COUNTERS_TLV:\n"); + + len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_id = %u\n", + htt_stats_buf->pdev_id); + len += HTT_DBG_OUT(buf + len, buf_len - len, "cf_active_low_fail_cnt = %u\n", + htt_stats_buf->cf_active_low_fail_cnt); + len += HTT_DBG_OUT(buf + len, buf_len - len, "cf_active_low_pass_cnt = %u\n", + htt_stats_buf->cf_active_low_pass_cnt); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_off_through_vreg_cnt = %u\n", + htt_stats_buf->phy_off_through_vreg_cnt); + len += HTT_DBG_OUT(buf + len, buf_len - len, "force_calibration_cnt = %u\n", + htt_stats_buf->force_calibration_cnt); + len += HTT_DBG_OUT(buf + len, buf_len - len, "rf_mode_switch_phy_off_cnt = %u\n", + htt_stats_buf->rf_mode_switch_phy_off_cnt); + + if (len >= buf_len) + buf[buf_len - 1] = 0; + else + buf[len] = 0; + + stats_req->buf_len = len; +} + +static inline void htt_print_phy_reset_stats_tlv(const void *tag_buf, + struct debug_htt_stats_req *stats_req) +{ + const struct htt_phy_reset_stats_tlv *htt_stats_buf = tag_buf; + u8 *buf = stats_req->buf; + u32 len = stats_req->buf_len; + u32 buf_len = ATH11K_HTT_STATS_BUF_SIZE; + + len += HTT_DBG_OUT(buf + len, buf_len - len, "HTT_PHY_RESET_STATS_TLV:\n"); + + len += HTT_DBG_OUT(buf + len, buf_len - len, "pdev_id = %u\n", + htt_stats_buf->pdev_id); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_mhz = %u\n", + htt_stats_buf->chan_mhz); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_band_center_freq1 = %u\n", + htt_stats_buf->chan_band_center_freq1); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_band_center_freq2 = %u\n", + htt_stats_buf->chan_band_center_freq2); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_phy_mode = %u\n", + htt_stats_buf->chan_phy_mode); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_flags = 0x%0x\n", + htt_stats_buf->chan_flags); + len += HTT_DBG_OUT(buf + len, buf_len - len, "chan_num = %u\n", + htt_stats_buf->chan_num); + len += HTT_DBG_OUT(buf + len, buf_len - len, "reset_cause = 0x%0x\n", + htt_stats_buf->reset_cause); + len += HTT_DBG_OUT(buf + len, buf_len - len, "prev_reset_cause = 0x%0x\n", + htt_stats_buf->prev_reset_cause); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_warm_reset_src = 0x%0x\n", + htt_stats_buf->phy_warm_reset_src); + len += HTT_DBG_OUT(buf + len, buf_len - len, "rx_gain_tbl_mode = %d\n", + htt_stats_buf->rx_gain_tbl_mode); + len += HTT_DBG_OUT(buf + len, buf_len - len, "xbar_val = 0x%0x\n", + htt_stats_buf->xbar_val); + len += HTT_DBG_OUT(buf + len, buf_len - len, "force_calibration = %u\n", + htt_stats_buf->force_calibration); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phyrf_mode = %u\n", + htt_stats_buf->phyrf_mode); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_homechan = %u\n", + htt_stats_buf->phy_homechan); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_tx_ch_mask = 0x%0x\n", + htt_stats_buf->phy_tx_ch_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_rx_ch_mask = 0x%0x\n", + htt_stats_buf->phy_rx_ch_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phybb_ini_mask = 0x%0x\n", + htt_stats_buf->phybb_ini_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phyrf_ini_mask = 0x%0x\n", + htt_stats_buf->phyrf_ini_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_dfs_en_mask = 0x%0x\n", + htt_stats_buf->phy_dfs_en_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_sscan_en_mask = 0x%0x\n", + htt_stats_buf->phy_sscan_en_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_synth_sel_mask = 0x%0x\n", + htt_stats_buf->phy_synth_sel_mask); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_adfs_freq = %u\n", + htt_stats_buf->phy_adfs_freq); + len += HTT_DBG_OUT(buf + len, buf_len - len, "cck_fir_settings = 0x%0x\n", + htt_stats_buf->cck_fir_settings); + len += HTT_DBG_OUT(buf + len, buf_len - len, "phy_dyn_pri_chan = %u\n", + htt_stats_buf->phy_dyn_pri_chan); + len += HTT_DBG_OUT(buf + len, buf_len - len, "cca_thresh = 0x%0x\n", + htt_stats_buf->cca_thresh); + len += HTT_DBG_OUT(buf + len, buf_len - len, "dyn_cca_status = %u\n", + htt_stats_buf->dyn_cca_status); + + if (len >= buf_len) + buf[buf_len - 1] = 0; + else + buf[len] = 0; + + stats_req->buf_len = len; +} + static inline void htt_print_peer_ctrl_path_txrx_stats_tlv(const void *tag_buf, struct debug_htt_stats_req *stats_req) { @@ -4970,6 +5078,12 @@ static int ath11k_dbg_htt_ext_stats_pars case HTT_STATS_PHY_STATS_TAG: htt_print_phy_stats_tlv(tag_buf, stats_req); break; + case HTT_STATS_PHY_RESET_COUNTERS_TAG: + htt_print_phy_reset_counters_tlv(tag_buf, stats_req); + break; + case HTT_STATS_PHY_RESET_STATS_TAG: + htt_print_phy_reset_stats_tlv(tag_buf, stats_req); + break; case HTT_STATS_PEER_CTRL_PATH_TXRX_STATS_TAG: htt_print_peer_ctrl_path_txrx_stats_tlv(tag_buf, stats_req); break; --- a/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h +++ b/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h @@ -122,6 +122,8 @@ enum htt_tlv_tag_t { HTT_STATS_TXBF_OFDMA_STEER_STATS_TAG = 116, HTT_STATS_PHY_COUNTERS_TAG = 121, HTT_STATS_PHY_STATS_TAG = 122, + HTT_STATS_PHY_RESET_COUNTERS_TAG = 123, + HTT_STATS_PHY_RESET_STATS_TAG = 124, HTT_STATS_MAX_TAG, }; @@ -1982,12 +1984,52 @@ struct htt_phy_counters_tlv { struct htt_phy_stats_tlv { int nf_chain[HTT_STATS_MAX_CHAINS]; + int runtime_nf_chain[HTT_STATS_MAX_CHAINS]; u32 false_radar_cnt; u32 radar_cs_cnt; int ani_level; u32 fw_run_time; }; +struct htt_phy_reset_counters_tlv { + u32 pdev_id; + u32 cf_active_low_fail_cnt; + u32 cf_active_low_pass_cnt; + u32 phy_off_through_vreg_cnt; + u32 force_calibration_cnt; + u32 rf_mode_switch_phy_off_cnt; +}; + +struct htt_phy_reset_stats_tlv { + u32 pdev_id; + u32 chan_mhz; + u32 chan_band_center_freq1; + u32 chan_band_center_freq2; + u32 chan_phy_mode; + u32 chan_flags; + u32 chan_num; + u32 reset_cause; + u32 prev_reset_cause; + u32 phy_warm_reset_src; + u32 rx_gain_tbl_mode; + u32 xbar_val; + u32 force_calibration; + u32 phyrf_mode; + u32 phy_homechan; + u32 phy_tx_ch_mask; + u32 phy_rx_ch_mask; + u32 phybb_ini_mask; + u32 phyrf_ini_mask; + u32 phy_dfs_en_mask; + u32 phy_sscan_en_mask; + u32 phy_synth_sel_mask; + u32 phy_adfs_freq; + u32 cck_fir_settings; + u32 phy_dyn_pri_chan; + u32 cca_thresh; + u32 dyn_cca_status; +}; + struct htt_peer_ctrl_path_txrx_stats_tlv { u8 peer_mac_addr[6]; u8 rsvd[2];