linux/drivers/net/wireless/ath/ath11k/debugfs_htt_stats.h

/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#ifndef DEBUG_HTT_STATS_H
#define DEBUG_HTT_STATS_H

#define HTT_STATS_COOKIE_LSB
#define HTT_STATS_COOKIE_MSB
#define HTT_STATS_MAGIC_VALUE

enum htt_tlv_tag_t {};

#define HTT_STATS_MAX_STRING_SZ32
#define HTT_STATS_MACID_INVALID
#define HTT_TX_HWQ_MAX_DIFS_LATENCY_BINS
#define HTT_TX_HWQ_MAX_CMD_RESULT_STATS
#define HTT_TX_HWQ_MAX_CMD_STALL_STATS
#define HTT_TX_HWQ_MAX_FES_RESULT_STATS

enum htt_tx_pdev_underrun_enum {};

#define HTT_TX_PDEV_MAX_FLUSH_REASON_STATS
#define HTT_TX_PDEV_MAX_SIFS_BURST_STATS
#define HTT_TX_PDEV_MAX_SIFS_BURST_HIST_STATS
#define HTT_TX_PDEV_MAX_PHY_ERR_STATS
#define HTT_TX_PDEV_SCHED_TX_MODE_MAX
#define HTT_TX_PDEV_NUM_SCHED_ORDER_LOG

#define HTT_RX_STATS_REFILL_MAX_RING
#define HTT_RX_STATS_RXDMA_MAX_ERR
#define HTT_RX_STATS_FW_DROP_REASON_MAX

/* Bytes stored in little endian order */
/* Length should be multiple of DWORD */
struct htt_stats_string_tlv {} __packed;

#define HTT_STATS_MAC_ID

/* == TX PDEV STATS == */
struct htt_tx_pdev_stats_cmn_tlv {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_pdev_stats_urrn_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_pdev_stats_flush_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_pdev_stats_sifs_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_pdev_stats_phy_err_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_pdev_stats_sifs_hist_tlv_v {};

struct htt_tx_pdev_stats_tx_ppdu_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size .
 *
 *  Tried_mpdu_cnt_hist is the histogram of MPDUs tries per HWQ.
 *  The tries here is the count of the  MPDUS within a PPDU that the
 *  HW had attempted to transmit on  air, for the HWSCH Schedule
 *  command submitted by FW.It is not the retry attempts.
 *  The histogram bins are  0-29, 30-59, 60-89 and so on. The are
 *   10 bins in this histogram. They are defined in FW using the
 *  following macros
 *  #define WAL_MAX_TRIED_MPDU_CNT_HISTOGRAM 9
 *  #define WAL_TRIED_MPDU_CNT_HISTOGRAM_INTERVAL 30
 */
struct htt_tx_pdev_stats_tried_mpdu_cnt_hist_tlv_v {};

/* == SOC ERROR STATS == */

/* =============== PDEV ERROR STATS ============== */
#define HTT_STATS_MAX_HW_INTR_NAME_LEN
struct htt_hw_stats_intr_misc_tlv {};

#define HTT_STATS_MAX_HW_MODULE_NAME_LEN
struct htt_hw_stats_wd_timeout_tlv {};

struct htt_hw_stats_pdev_errs_tlv {};

struct htt_hw_stats_whal_tx_tlv {};

/* ============ PEER STATS ============ */
#define HTT_MSDU_FLOW_STATS_TX_FLOW_NO
#define HTT_MSDU_FLOW_STATS_TID_NUM
#define HTT_MSDU_FLOW_STATS_DROP_RULE

struct htt_msdu_flow_stats_tlv {};

#define MAX_HTT_TID_NAME

#define HTT_TX_TID_STATS_SW_PEER_ID
#define HTT_TX_TID_STATS_TID_NUM
#define HTT_TX_TID_STATS_NUM_SCHED_PENDING
#define HTT_TX_TID_STATS_NUM_PPDU_IN_HWQ

/* Tidq stats */
struct htt_tx_tid_stats_tlv {};

#define HTT_TX_TID_STATS_V1_SW_PEER_ID
#define HTT_TX_TID_STATS_V1_TID_NUM
#define HTT_TX_TID_STATS_V1_NUM_SCHED_PENDING
#define HTT_TX_TID_STATS_V1_NUM_PPDU_IN_HWQ

/* Tidq stats */
struct htt_tx_tid_stats_v1_tlv {};

#define HTT_RX_TID_STATS_SW_PEER_ID
#define HTT_RX_TID_STATS_TID_NUM

struct htt_rx_tid_stats_tlv {};

#define HTT_MAX_COUNTER_NAME
struct htt_counter_tlv {};

struct htt_peer_stats_cmn_tlv {};

#define HTT_PEER_DETAILS_VDEV_ID
#define HTT_PEER_DETAILS_PDEV_ID
#define HTT_PEER_DETAILS_AST_IDX

struct htt_peer_details_tlv {};

enum htt_stats_param_type {};

#define HTT_TX_PEER_STATS_NUM_MCS_COUNTERS
#define HTT_TX_PEER_STATS_NUM_GI_COUNTERS
#define HTT_TX_PEER_STATS_NUM_DCM_COUNTERS
#define HTT_TX_PEER_STATS_NUM_BW_COUNTERS
#define HTT_TX_PEER_STATS_NUM_SPATIAL_STREAMS
#define HTT_TX_PEER_STATS_NUM_PREAMBLE_TYPES

struct htt_tx_peer_rate_stats_tlv {};

#define HTT_RX_PEER_STATS_NUM_MCS_COUNTERS
#define HTT_RX_PEER_STATS_NUM_GI_COUNTERS
#define HTT_RX_PEER_STATS_NUM_DCM_COUNTERS
#define HTT_RX_PEER_STATS_NUM_BW_COUNTERS
#define HTT_RX_PEER_STATS_NUM_SPATIAL_STREAMS
#define HTT_RX_PEER_STATS_NUM_PREAMBLE_TYPES

struct htt_rx_peer_rate_stats_tlv {};

enum htt_peer_stats_req_mode {};

enum htt_peer_stats_tlv_enum {};

/* =========== MUMIMO HWQ stats =========== */
/* MU MIMO stats per hwQ */
struct htt_tx_hwq_mu_mimo_sch_stats_tlv {};

struct htt_tx_hwq_mu_mimo_mpdu_stats_tlv {};

#define HTT_TX_HWQ_STATS_MAC_ID
#define HTT_TX_HWQ_STATS_HWQ_ID

struct htt_tx_hwq_mu_mimo_cmn_stats_tlv {};

/* == TX HWQ STATS == */
struct htt_tx_hwq_stats_cmn_tlv {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_hwq_difs_latency_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_hwq_cmd_result_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_hwq_cmd_stall_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_hwq_fes_result_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size
 *
 *  The hwq_tried_mpdu_cnt_hist is a  histogram of MPDUs tries per HWQ.
 *  The tries here is the count of the  MPDUS within a PPDU that the HW
 *  had attempted to transmit on  air, for the HWSCH Schedule command
 *  submitted by FW in this HWQ .It is not the retry attempts. The
 *  histogram bins are  0-29, 30-59, 60-89 and so on. The are 10 bins
 *  in this histogram.
 *  they are defined in FW using the following macros
 *  #define WAL_MAX_TRIED_MPDU_CNT_HISTOGRAM 9
 *  #define WAL_TRIED_MPDU_CNT_HISTOGRAM_INTERVAL 30
 */
struct htt_tx_hwq_tried_mpdu_cnt_hist_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size
 *
 * The txop_used_cnt_hist is the histogram of txop per burst. After
 * completing the burst, we identify the txop used in the burst and
 * incr the corresponding bin.
 * Each bin represents 1ms & we have 10 bins in this histogram.
 * they are defined in FW using the following macros
 * #define WAL_MAX_TXOP_USED_CNT_HISTOGRAM 10
 * #define WAL_TXOP_USED_HISTOGRAM_INTERVAL 1000 ( 1 ms )
 */
struct htt_tx_hwq_txop_used_cnt_hist_tlv_v {};

/* == TX SELFGEN STATS == */
struct htt_tx_selfgen_cmn_stats_tlv {};

struct htt_tx_selfgen_ac_stats_tlv {};

struct htt_tx_selfgen_ax_stats_tlv {};

struct htt_tx_selfgen_ac_err_stats_tlv {};

struct htt_tx_selfgen_ax_err_stats_tlv {};

/* == TX MU STATS == */
#define HTT_TX_PDEV_STATS_NUM_AC_MUMIMO_USER_STATS
#define HTT_TX_PDEV_STATS_NUM_AX_MUMIMO_USER_STATS
#define HTT_TX_PDEV_STATS_NUM_OFDMA_USER_STATS
#define HTT_TX_PDEV_STATS_NUM_UL_MUMIMO_USER_STATS

struct htt_tx_pdev_mu_mimo_sch_stats_tlv {};

struct htt_tx_pdev_mu_mimo_mpdu_stats_tlv {};

#define HTT_STATS_TX_SCHED_MODE_MU_MIMO_AC
#define HTT_STATS_TX_SCHED_MODE_MU_MIMO_AX
#define HTT_STATS_TX_SCHED_MODE_MU_OFDMA_AX

struct htt_tx_pdev_mpdu_stats_tlv {};

/* == TX SCHED STATS == */
/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_sched_txq_cmd_posted_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_sched_txq_cmd_reaped_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_sched_txq_sched_order_su_tlv_v {};

enum htt_sched_txq_sched_ineligibility_tlv_enum {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_sched_txq_sched_ineligibility_tlv_v {};

#define HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID
#define HTT_TX_PDEV_STATS_SCHED_PER_TXQ_ID

struct htt_tx_pdev_stats_sched_per_txq_tlv {};

struct htt_stats_tx_sched_cmn_tlv {};

/* == TQM STATS == */
#define HTT_TX_TQM_MAX_GEN_MPDU_END_REASON
#define HTT_TX_TQM_MAX_LIST_MPDU_END_REASON
#define HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_tqm_gen_mpdu_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_tqm_list_mpdu_stats_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_tx_tqm_list_mpdu_cnt_tlv_v {};

struct htt_tx_tqm_pdev_stats_tlv_v {};

struct htt_tx_tqm_cmn_stats_tlv {};

struct htt_tx_tqm_error_stats_tlv {};

/* == TQM CMDQ stats == */
#define HTT_TX_TQM_CMDQ_STATUS_MAC_ID
#define HTT_TX_TQM_CMDQ_STATUS_CMDQ_ID

struct htt_tx_tqm_cmdq_status_tlv {};

/* == TX-DE STATS == */
/* Structures for tx de stats */
struct htt_tx_de_eapol_packets_stats_tlv {};

struct htt_tx_de_classify_failed_stats_tlv {};

struct htt_tx_de_classify_stats_tlv {};

struct htt_tx_de_classify_status_stats_tlv {};

struct htt_tx_de_enqueue_packets_stats_tlv {};

struct htt_tx_de_enqueue_discard_stats_tlv {};

struct htt_tx_de_compl_stats_tlv {};

/*
 *  The htt_tx_de_fw2wbm_ring_full_hist_tlv is a histogram of time we waited
 *  for the fw2wbm ring buffer.  we are requesting a buffer in FW2WBM release
 *  ring,which may fail, due to non availability of buffer. Hence we sleep for
 *  200us & again request for it. This is a histogram of time we wait, with
 *  bin of 200ms & there are 10 bin (2 seconds max)
 *  They are defined by the following macros in FW
 *  #define ENTRIES_PER_BIN_COUNT 1000  // per bin 1000 * 200us = 200ms
 *  #define RING_FULL_BIN_ENTRIES (WAL_TX_DE_FW2WBM_ALLOC_TIMEOUT_COUNT /
 *                               ENTRIES_PER_BIN_COUNT)
 */
struct htt_tx_de_fw2wbm_ring_full_hist_tlv {};

struct htt_tx_de_cmn_stats_tlv {};

/* == RING-IF STATS == */
#define HTT_STATS_LOW_WM_BINS
#define HTT_STATS_HIGH_WM_BINS

#define HTT_RING_IF_STATS_NUM_ELEMS
#define HTT_RING_IF_STATS_PREFETCH_TAIL_INDEX
#define HTT_RING_IF_STATS_HEAD_IDX
#define HTT_RING_IF_STATS_TAIL_IDX
#define HTT_RING_IF_STATS_SHADOW_HEAD_IDX
#define HTT_RING_IF_STATS_SHADOW_TAIL_IDX
#define HTT_RING_IF_STATS_LWM_THRESH
#define HTT_RING_IF_STATS_HWM_THRESH

struct htt_ring_if_stats_tlv {};

struct htt_ring_if_cmn_tlv {};

/* == SFM STATS == */
/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_sfm_client_user_tlv_v {};

struct htt_sfm_client_tlv {};

struct htt_sfm_cmn_tlv {};

/* == SRNG STATS == */
#define HTT_SRING_STATS_MAC_ID
#define HTT_SRING_STATS_RING_ID
#define HTT_SRING_STATS_ARENA
#define HTT_SRING_STATS_EP
#define HTT_SRING_STATS_NUM_AVAIL_WORDS
#define HTT_SRING_STATS_NUM_VALID_WORDS
#define HTT_SRING_STATS_HEAD_PTR
#define HTT_SRING_STATS_TAIL_PTR
#define HTT_SRING_STATS_CONSUMER_EMPTY
#define HTT_SRING_STATS_PRODUCER_FULL
#define HTT_SRING_STATS_PREFETCH_COUNT
#define HTT_SRING_STATS_INTERNAL_TAIL_PTR

struct htt_sring_stats_tlv {};

struct htt_sring_cmn_tlv {};

/* == PDEV TX RATE CTRL STATS == */
#define HTT_TX_PDEV_STATS_NUM_MCS_COUNTERS
#define HTT_TX_PDEV_STATS_NUM_GI_COUNTERS
#define HTT_TX_PDEV_STATS_NUM_DCM_COUNTERS
#define HTT_TX_PDEV_STATS_NUM_BW_COUNTERS
#define HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS
#define HTT_TX_PDEV_STATS_NUM_PREAMBLE_TYPES
#define HTT_TX_PDEV_STATS_NUM_LEGACY_CCK_STATS
#define HTT_TX_PDEV_STATS_NUM_LEGACY_OFDM_STATS
#define HTT_TX_PDEV_STATS_NUM_LTF

#define HTT_TX_NUM_OF_SOUNDING_STATS_WORDS

struct htt_tx_pdev_rate_stats_tlv {};

/* == PDEV RX RATE CTRL STATS == */
#define HTT_RX_PDEV_STATS_NUM_LEGACY_CCK_STATS
#define HTT_RX_PDEV_STATS_NUM_LEGACY_OFDM_STATS
#define HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS
#define HTT_RX_PDEV_STATS_NUM_GI_COUNTERS
#define HTT_RX_PDEV_STATS_NUM_DCM_COUNTERS
#define HTT_RX_PDEV_STATS_NUM_BW_COUNTERS
#define HTT_RX_PDEV_STATS_NUM_SPATIAL_STREAMS
#define HTT_RX_PDEV_STATS_NUM_PREAMBLE_TYPES
#define HTT_RX_PDEV_MAX_OFDMA_NUM_USER
#define HTT_RX_PDEV_STATS_RXEVM_MAX_PILOTS_PER_NSS
#define HTT_RX_PDEV_STATS_NUM_RU_SIZE_COUNTERS
#define HTT_RX_PDEV_MAX_ULMUMIMO_NUM_USER

struct htt_rx_pdev_rate_stats_tlv {};

/* == RX PDEV/SOC STATS == */
struct htt_rx_soc_fw_stats_tlv {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_soc_fw_refill_ring_empty_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_soc_fw_refill_ring_num_refill_tlv_v {};

/* RXDMA error code from WBM released packets */
enum htt_rx_rxdma_error_code_enum {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_soc_fw_refill_ring_num_rxdma_err_tlv_v {};

/* REO error code from WBM released packets */
enum htt_rx_reo_error_code_enum {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_soc_fw_refill_ring_num_reo_err_tlv_v {};

/* == RX PDEV STATS == */
#define HTT_STATS_SUBTYPE_MAX

struct htt_rx_pdev_fw_stats_tlv {};

#define HTT_STATS_PHY_ERR_MAX

struct htt_rx_pdev_fw_stats_phy_err_tlv {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_pdev_fw_ring_mpdu_err_tlv_v {};

/* NOTE: Variable length TLV, use length spec to infer array size */
struct htt_rx_pdev_fw_mpdu_drop_tlv_v {};

#define HTT_PDEV_CCA_STATS_TX_FRAME_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_RX_FRAME_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_RX_CLEAR_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_MY_RX_FRAME_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_USEC_CNT_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_MED_RX_IDLE_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_MED_TX_IDLE_GLOBAL_INFO_PRESENT
#define HTT_PDEV_CCA_STATS_CCA_OBBS_USEC_INFO_PRESENT

struct htt_pdev_stats_cca_counters_tlv {};

struct htt_pdev_cca_stats_hist_v1_tlv {};

struct htt_pdev_stats_twt_session_tlv {};

struct htt_pdev_stats_twt_sessions_tlv {};

enum htt_rx_reo_resource_sample_id_enum {};

struct htt_rx_reo_resource_stats_tlv_v {};

/* == TX SOUNDING STATS == */

enum htt_txbf_sound_steer_modes {};

enum htt_stats_sounding_tx_mode {};

struct htt_tx_sounding_stats_tlv {};

struct htt_pdev_obss_pd_stats_tlv {};

struct htt_ring_backpressure_stats_tlv {};

#define HTT_TX_TXBF_RATE_STATS_NUM_MCS_COUNTERS
#define HTT_TX_TXBF_RATE_STATS_NUM_BW_COUNTERS
#define HTT_TX_PDEV_STATS_NUM_SPATIAL_STREAMS

struct htt_pdev_txrate_txbf_stats_tlv {};

struct htt_txbf_ofdma_ndpa_stats_tlv {};

struct htt_txbf_ofdma_ndp_stats_tlv {};

struct htt_txbf_ofdma_brp_stats_tlv {};

struct htt_txbf_ofdma_steer_stats_tlv {};

#define HTT_MAX_RX_PKT_CNT
#define HTT_MAX_RX_PKT_CRC_PASS_CNT
#define HTT_MAX_PER_BLK_ERR_CNT
#define HTT_MAX_RX_OTA_ERR_CNT
#define HTT_STATS_MAX_CHAINS
#define ATH11K_STATS_MGMT_FRM_TYPE_MAX

struct htt_phy_counters_tlv {};

struct htt_phy_stats_tlv {};

struct htt_phy_reset_counters_tlv {};

struct htt_phy_reset_stats_tlv {};

struct htt_peer_ctrl_path_txrx_stats_tlv {};

#ifdef CONFIG_ATH11K_DEBUGFS

void ath11k_debugfs_htt_stats_init(struct ath11k *ar);
void ath11k_debugfs_htt_ext_stats_handler(struct ath11k_base *ab,
					  struct sk_buff *skb);
int ath11k_debugfs_htt_stats_req(struct ath11k *ar);

#else /* CONFIG_ATH11K_DEBUGFS */

static inline void ath11k_debugfs_htt_stats_init(struct ath11k *ar)
{
}

static inline void ath11k_debugfs_htt_ext_stats_handler(struct ath11k_base *ab,
							struct sk_buff *skb)
{
}

static inline int ath11k_debugfs_htt_stats_req(struct ath11k *ar)
{
	return 0;
}

#endif /* CONFIG_ATH11K_DEBUGFS */

#endif