mbox series

[v3,0/4] wifi: ath12k: Support Pager, Counter, SoC, Transmit Rate Stats

Message ID 20241105045406.2098436-1-quic_rdevanat@quicinc.com
Headers show
Series wifi: ath12k: Support Pager, Counter, SoC, Transmit Rate Stats | expand

Message

Roopni Devanathan Nov. 5, 2024, 4:54 a.m. UTC
Add support to request HTT stats type 36, 37, 38 and 40 from firmware.
These stat types give downlink pager stats, counter and TPC stats, SoC
common stats and Transmit PER rate stats, respectively.

v3:
 - Added macros to fix compilation issues.
v2:
 - Removed dependencies. No change in code.

Dinesh Karthikeyan (4):
  wifi: ath12k: Support Downlink Pager Stats
  wifi: ath12k: Support phy counter and TPC stats
  wifi: ath12k: Support SoC Common Stats
  wifi: ath12k: Support Transmit PER Rate Stats

 .../wireless/ath/ath12k/debugfs_htt_stats.c   | 627 +++++++++++++++++-
 .../wireless/ath/ath12k/debugfs_htt_stats.h   | 204 +++++-
 2 files changed, 828 insertions(+), 3 deletions(-)


base-commit: d63fbff74ab1af1573c1dca20cfe1e876f8ffa62

Comments

Jeff Johnson Nov. 5, 2024, 10:49 p.m. UTC | #1
On 11/4/2024 8:54 PM, Roopni Devanathan wrote:
> From: Dinesh Karthikeyan <quic_dinek@quicinc.com>
> 
> Add support to request downlink pager stats from firmware through HTT
> stats type 36. These stats give paging information like number of pages,
> their timestamp, number of locked and free pages, synchronous and
> asynchronous locked pages.

...

> +static void ath12k_htt_print_dlpager_entry(const struct ath12k_htt_pgs_info *pg_info,
> +					   int idx, char *str_buf)
> +{
> +	u32 ts_lo;
> +	u32 ts_hi;
> +	unsigned long long page_timestamp;
> +	u16 index = 0;
> +
> +	ts_lo = le32_to_cpu(pg_info->ts_lsb);
> +	ts_hi = le32_to_cpu(pg_info->ts_msb);
> +	page_timestamp = ((unsigned long long)ts_hi) << 32 | ts_lo;

use u64 and ath12k_le32hilo_to_u64(pg_info->ts_msb, pg_info->ts_lsb)?

> +
> +	index += snprintf(&str_buf[index], ATH12K_HTT_MAX_STRING_LEN - index,
> +			  "Index - %u ; Page Number - %u ; ",
> +			  idx, le32_to_cpu(pg_info->page_num));
> +	index += snprintf(&str_buf[index], ATH12K_HTT_MAX_STRING_LEN - index,
> +			  "Num of pages - %u ; Timestamp - %lluus\n",
> +			  le32_to_cpu(pg_info->num_pgs), page_timestamp);
> +}
Jeff Johnson Nov. 5, 2024, 10:53 p.m. UTC | #2
On 11/4/2024 8:54 PM, Roopni Devanathan wrote:
> From: Dinesh Karthikeyan <quic_dinek@quicinc.com>
> 
> Add support to request SoC stat from firmware through HTT stat
> type 38. This stat gives drop count of SoC.
> 
> Note: MCC firmware version -
> WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4 does not
> support tag HTT_STATS_SOC_TXRX_STATS_COMMON_TAG(125).
> 
> Sample output:
> -------------
> echo 38 > /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_SOC_COMMON_STATS_TLV:
> soc_drop_count = 0x0000000000000000
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Dinesh Karthikeyan <quic_dinek@quicinc.com>
> Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
> ---
>  .../wireless/ath/ath12k/debugfs_htt_stats.c   | 23 +++++++++++++++++++
>  .../wireless/ath/ath12k/debugfs_htt_stats.h   |  7 ++++++
>  2 files changed, 30 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
> index 732e600d33fa..8f89ba2db8c7 100644
> --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
> +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.c
> @@ -2859,6 +2859,26 @@ ath12k_htt_print_phy_tpc_stats_tlv(const void *tag_buf, u16 tag_len,
>  	stats_req->buf_len = len;
>  }
>  
> +static void
> +ath12k_htt_print_soc_txrx_stats_common_tlv(const void *tag_buf, u16 tag_len,
> +					   struct debug_htt_stats_req *stats_req)
> +{
> +	const struct ath12k_htt_t2h_soc_txrx_stats_common_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;
> +
> +	if (tag_len < sizeof(*htt_stats_buf))
> +		return;
> +
> +	len += scnprintf(buf + len, buf_len - len, "HTT_SOC_COMMON_STATS_TLV:\n");
> +	len += scnprintf(buf + len, buf_len - len, "soc_drop_count = 0x%08x%08x\n\n",
> +			 le32_to_cpu(htt_stats_buf->inv_peers_msdu_drop_count_hi),
> +			 le32_to_cpu(htt_stats_buf->inv_peers_msdu_drop_count_lo));

perhaps use ath12k_le32hilo_to_u64() to convert to u64 and then print in
decimal instead of hex? just a suggestion, no need to respin if you disagree

> +
> +	stats_req->buf_len = len;
> +}
> +
>  static void
>  ath12k_htt_print_dmac_reset_stats_tlv(const void *tag_buf, u16 tag_len,
>  				      struct debug_htt_stats_req *stats_req)
> @@ -3204,6 +3224,9 @@ static int ath12k_dbg_htt_ext_stats_parse(struct ath12k_base *ab,
>  	case HTT_STATS_PHY_TPC_STATS_TAG:
>  		ath12k_htt_print_phy_tpc_stats_tlv(tag_buf, len, stats_req);
>  		break;
> +	case HTT_STATS_SOC_TXRX_STATS_COMMON_TAG:
> +		ath12k_htt_print_soc_txrx_stats_common_tlv(tag_buf, len, stats_req);
> +		break;
>  	case HTT_STATS_DMAC_RESET_STATS_TAG:
>  		ath12k_htt_print_dmac_reset_stats_tlv(tag_buf, len, stats_req);
>  		break;
> diff --git a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h
> index 10d7ca9c02f4..c07b60636c22 100644
> --- a/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h
> +++ b/drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h
> @@ -137,6 +137,7 @@ enum ath12k_dbg_htt_ext_stats_type {
>  	ATH12K_DBG_HTT_EXT_STATS_PDEV_OBSS_PD_STATS	= 23,
>  	ATH12K_DBG_HTT_EXT_STATS_DLPAGER_STATS		= 36,
>  	ATH12K_DBG_HTT_EXT_PHY_COUNTERS_AND_PHY_STATS	= 37,
> +	ATH12K_DBG_HTT_EXT_VDEVS_TXRX_STATS		= 38,
>  	ATH12K_DBG_HTT_EXT_STATS_SOC_ERROR		= 45,
>  	ATH12K_DBG_HTT_EXT_STATS_PDEV_SCHED_ALGO	= 49,
>  	ATH12K_DBG_HTT_EXT_STATS_MANDATORY_MUOFDMA	= 51,
> @@ -201,6 +202,7 @@ enum ath12k_dbg_htt_tlv_tag {
>  	HTT_STATS_PHY_STATS_TAG				= 122,
>  	HTT_STATS_PHY_RESET_COUNTERS_TAG		= 123,
>  	HTT_STATS_PHY_RESET_STATS_TAG			= 124,
> +	HTT_STATS_SOC_TXRX_STATS_COMMON_TAG		= 125,
>  	HTT_STATS_MU_PPDU_DIST_TAG			= 129,
>  	HTT_STATS_TX_PDEV_MUMIMO_GRP_STATS_TAG		= 130,
>  	HTT_STATS_TX_PDEV_RATE_STATS_BE_OFDMA_TAG	= 135,
> @@ -1183,6 +1185,11 @@ struct ath12k_htt_phy_tpc_stats_tlv {
>  	__le32 sub_band_txpower[ATH12K_HTT_MAX_CH_PWR_INFO_SIZE];
>  } __packed;
>  
> +struct ath12k_htt_t2h_soc_txrx_stats_common_tlv {
> +	__le32 inv_peers_msdu_drop_count_hi;
> +	__le32 inv_peers_msdu_drop_count_lo;
> +} __packed;
> +
>  struct ath12k_htt_dmac_reset_stats_tlv {
>  	__le32 reset_count;
>  	__le32 reset_time_lo_ms;