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

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

#ifndef DEBUG_HTT_STATS_H
#define DEBUG_HTT_STATS_H

#define ATH12K_HTT_STATS_BUF_SIZE
#define ATH12K_HTT_STATS_COOKIE_LSB
#define ATH12K_HTT_STATS_COOKIE_MSB
#define ATH12K_HTT_STATS_MAGIC_VALUE
#define ATH12K_HTT_STATS_SUBTYPE_MAX
#define ATH12K_HTT_MAX_STRING_LEN

#define ATH12K_HTT_STATS_RESET_BITMAP32_OFFSET(_idx)
#define ATH12K_HTT_STATS_RESET_BITMAP64_OFFSET(_idx)
#define ATH12K_HTT_STATS_RESET_BITMAP32_BIT(_idx)
#define ATH12K_HTT_STATS_RESET_BITMAP64_BIT(_idx)

void ath12k_debugfs_htt_stats_register(struct ath12k *ar);

#ifdef CONFIG_ATH12K_DEBUGFS
void ath12k_debugfs_htt_ext_stats_handler(struct ath12k_base *ab,
					  struct sk_buff *skb);
#else /* CONFIG_ATH12K_DEBUGFS */
static inline void ath12k_debugfs_htt_ext_stats_handler(struct ath12k_base *ab,
							struct sk_buff *skb)
{
}
#endif

/**
 * DOC: target -> host extended statistics upload
 *
 * The following field definitions describe the format of the HTT
 * target to host stats upload confirmation message.
 * The message contains a cookie echoed from the HTT host->target stats
 * upload request, which identifies which request the confirmation is
 * for, and a single stats can span over multiple HTT stats indication
 * due to the HTT message size limitation so every HTT ext stats
 * indication will have tag-length-value stats information elements.
 * The tag-length header for each HTT stats IND message also includes a
 * status field, to indicate whether the request for the stat type in
 * question was fully met, partially met, unable to be met, or invalid
 * (if the stat type in question is disabled in the target).
 * A Done bit 1's indicate the end of the of stats info elements.
 *
 *
 * |31                         16|15    12|11|10 8|7   5|4       0|
 * |--------------------------------------------------------------|
 * |                   reserved                   |    msg type   |
 * |--------------------------------------------------------------|
 * |                         cookie LSBs                          |
 * |--------------------------------------------------------------|
 * |                         cookie MSBs                          |
 * |--------------------------------------------------------------|
 * |      stats entry length     | rsvd   | D|  S |   stat type   |
 * |--------------------------------------------------------------|
 * |                   type-specific stats info                   |
 * |                      (see debugfs_htt_stats.h)               |
 * |--------------------------------------------------------------|
 * Header fields:
 *  - MSG_TYPE
 *    Bits 7:0
 *    Purpose: Identifies this is a extended statistics upload confirmation
 *             message.
 *    Value: 0x1c
 *  - COOKIE_LSBS
 *    Bits 31:0
 *    Purpose: Provide a mechanism to match a target->host stats confirmation
 *        message with its preceding host->target stats request message.
 *    Value: MSBs of the opaque cookie specified by the host-side requestor
 *  - COOKIE_MSBS
 *    Bits 31:0
 *    Purpose: Provide a mechanism to match a target->host stats confirmation
 *        message with its preceding host->target stats request message.
 *    Value: MSBs of the opaque cookie specified by the host-side requestor
 *
 * Stats Information Element tag-length header fields:
 *  - STAT_TYPE
 *    Bits 7:0
 *    Purpose: identifies the type of statistics info held in the
 *        following information element
 *    Value: ath12k_dbg_htt_ext_stats_type
 *  - STATUS
 *    Bits 10:8
 *    Purpose: indicate whether the requested stats are present
 *    Value:
 *       0 -> The requested stats have been delivered in full
 *       1 -> The requested stats have been delivered in part
 *       2 -> The requested stats could not be delivered (error case)
 *       3 -> The requested stat type is either not recognized (invalid)
 *  - DONE
 *    Bits 11
 *    Purpose:
 *        Indicates the completion of the stats entry, this will be the last
 *        stats conf HTT segment for the requested stats type.
 *    Value:
 *        0 -> the stats retrieval is ongoing
 *        1 -> the stats retrieval is complete
 *  - LENGTH
 *    Bits 31:16
 *    Purpose: indicate the stats information size
 *    Value: This field specifies the number of bytes of stats information
 *       that follows the element tag-length header.
 *       It is expected but not required that this length is a multiple of
 *       4 bytes.
 */

#define ATH12K_HTT_T2H_EXT_STATS_INFO1_DONE
#define ATH12K_HTT_T2H_EXT_STATS_INFO1_LENGTH

struct ath12k_htt_extd_stats_msg {} __packed;

/* htt_dbg_ext_stats_type */
enum ath12k_dbg_htt_ext_stats_type {};

enum ath12k_dbg_htt_tlv_tag {};

#define ATH12K_HTT_STATS_MAC_ID

#define ATH12K_HTT_TX_PDEV_MAX_SIFS_BURST_STATS
#define ATH12K_HTT_TX_PDEV_MAX_FLUSH_REASON_STATS

/* MU MIMO distribution stats is a 2-dimensional array
 * with dimension one denoting stats for nr4[0] or nr8[1]
 */
#define ATH12K_HTT_STATS_NUM_NR_BINS
#define ATH12K_HTT_STATS_MAX_NUM_MU_PPDU_PER_BURST
#define ATH12K_HTT_TX_PDEV_MAX_SIFS_BURST_HIST_STATS
#define ATH12K_HTT_STATS_MAX_NUM_SCHED_STATUS
#define ATH12K_HTT_STATS_NUM_SCHED_STATUS_WORDS
#define ATH12K_HTT_STATS_MU_PPDU_PER_BURST_WORDS

enum ath12k_htt_tx_pdev_underrun_enum {};

enum ath12k_htt_stats_reset_cfg_param_alloc_pos {};

struct debug_htt_stats_req {};

struct ath12k_htt_tx_pdev_stats_cmn_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_urrn_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_flush_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_phy_err_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_sifs_tlv {} __packed;

struct ath12k_htt_pdev_ctrl_path_tx_stats_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_sifs_hist_tlv {} __packed;

enum ath12k_htt_stats_hw_mode {};

struct ath12k_htt_tx_pdev_mu_ppdu_dist_stats_tlv {} __packed;

#define ATH12K_HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID
#define ATH12K_HTT_TX_PDEV_STATS_SCHED_PER_TXQ_ID

#define ATH12K_HTT_TX_PDEV_NUM_SCHED_ORDER_LOG

struct ath12k_htt_stats_tx_sched_cmn_tlv {} __packed;

struct ath12k_htt_tx_pdev_stats_sched_per_txq_tlv {} __packed;

struct ath12k_htt_sched_txq_cmd_posted_tlv {} __packed;

struct ath12k_htt_sched_txq_cmd_reaped_tlv {} __packed;

struct ath12k_htt_sched_txq_sched_order_su_tlv {} __packed;

struct ath12k_htt_sched_txq_sched_ineligibility_tlv {} __packed;

enum ath12k_htt_sched_txq_supercycle_triggers_tlv_enum {};

struct ath12k_htt_sched_txq_supercycle_triggers_tlv {} __packed;

struct ath12k_htt_hw_stats_pdev_errs_tlv {} __packed;

#define ATH12K_HTT_STATS_MAX_HW_INTR_NAME_LEN
struct ath12k_htt_hw_stats_intr_misc_tlv {} __packed;

struct ath12k_htt_hw_stats_whal_tx_tlv {} __packed;

struct ath12k_htt_hw_war_stats_tlv {} __packed;

struct ath12k_htt_tx_tqm_cmn_stats_tlv {} __packed;

struct ath12k_htt_tx_tqm_error_stats_tlv {} __packed;

struct ath12k_htt_tx_tqm_gen_mpdu_stats_tlv {} __packed;

#define ATH12K_HTT_TX_TQM_MAX_LIST_MPDU_END_REASON
#define ATH12K_HTT_TX_TQM_MAX_LIST_MPDU_CNT_HISTOGRAM_BINS

struct ath12k_htt_tx_tqm_list_mpdu_stats_tlv {} __packed;

struct ath12k_htt_tx_tqm_list_mpdu_cnt_tlv {} __packed;

struct ath12k_htt_tx_tqm_pdev_stats_tlv {} __packed;

#endif