1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
7 #ifndef _ATH11K_DEBUGFS_H_
8 #define _ATH11K_DEBUGFS_H_
12 #define ATH11K_TX_POWER_MAX_VAL 70
13 #define ATH11K_TX_POWER_MIN_VAL 0
15 /* htt_dbg_ext_stats_type */
16 enum ath11k_dbg_htt_ext_stats_type
{
17 ATH11K_DBG_HTT_EXT_STATS_RESET
= 0,
18 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX
= 1,
19 ATH11K_DBG_HTT_EXT_STATS_PDEV_RX
= 2,
20 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_HWQ
= 3,
21 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_SCHED
= 4,
22 ATH11K_DBG_HTT_EXT_STATS_PDEV_ERROR
= 5,
23 ATH11K_DBG_HTT_EXT_STATS_PDEV_TQM
= 6,
24 ATH11K_DBG_HTT_EXT_STATS_TQM_CMDQ
= 7,
25 ATH11K_DBG_HTT_EXT_STATS_TX_DE_INFO
= 8,
26 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_RATE
= 9,
27 ATH11K_DBG_HTT_EXT_STATS_PDEV_RX_RATE
= 10,
28 ATH11K_DBG_HTT_EXT_STATS_PEER_INFO
= 11,
29 ATH11K_DBG_HTT_EXT_STATS_TX_SELFGEN_INFO
= 12,
30 ATH11K_DBG_HTT_EXT_STATS_TX_MU_HWQ
= 13,
31 ATH11K_DBG_HTT_EXT_STATS_RING_IF_INFO
= 14,
32 ATH11K_DBG_HTT_EXT_STATS_SRNG_INFO
= 15,
33 ATH11K_DBG_HTT_EXT_STATS_SFM_INFO
= 16,
34 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_MU
= 17,
35 ATH11K_DBG_HTT_EXT_STATS_ACTIVE_PEERS_LIST
= 18,
36 ATH11K_DBG_HTT_EXT_STATS_PDEV_CCA_STATS
= 19,
37 ATH11K_DBG_HTT_EXT_STATS_TWT_SESSIONS
= 20,
38 ATH11K_DBG_HTT_EXT_STATS_REO_RESOURCE_STATS
= 21,
39 ATH11K_DBG_HTT_EXT_STATS_TX_SOUNDING_INFO
= 22,
40 ATH11K_DBG_HTT_EXT_STATS_PDEV_OBSS_PD_STATS
= 23,
41 ATH11K_DBG_HTT_EXT_STATS_RING_BACKPRESSURE_STATS
= 24,
42 ATH11K_DBG_HTT_EXT_STATS_PEER_CTRL_PATH_TXRX_STATS
= 29,
43 ATH11K_DBG_HTT_EXT_STATS_PDEV_TX_RATE_TXBF_STATS
= 31,
44 ATH11K_DBG_HTT_EXT_STATS_TXBF_OFDMA
= 32,
45 ATH11K_DBG_HTT_EXT_PHY_COUNTERS_AND_PHY_STATS
= 37,
48 ATH11K_DBG_HTT_NUM_EXT_STATS
,
51 #define ATH11K_DEBUG_DBR_ENTRIES_MAX 512
53 enum ath11k_dbg_dbr_event
{
54 ATH11K_DBG_DBR_EVENT_INVALID
,
55 ATH11K_DBG_DBR_EVENT_RX
,
56 ATH11K_DBG_DBR_EVENT_REPLENISH
,
57 ATH11K_DBG_DBR_EVENT_MAX
,
60 struct ath11k_dbg_dbr_entry
{
64 enum ath11k_dbg_dbr_event event
;
67 struct ath11k_dbg_dbr_data
{
68 /* protects ath11k_db_ring_debug data */
70 struct ath11k_dbg_dbr_entry
*entries
;
72 u32 num_ring_debug_entries
;
75 struct ath11k_debug_dbr
{
76 struct ath11k_dbg_dbr_data dbr_dbg_data
;
77 struct dentry
*dbr_debugfs
;
78 bool dbr_debug_enabled
;
81 struct debug_htt_stats_req
{
85 u8 peer_addr
[ETH_ALEN
];
86 struct completion cmpln
;
91 struct ath_pktlog_hdr
{
97 u32 type_specific_data
;
101 #define ATH11K_HTT_PEER_STATS_RESET BIT(16)
103 #define ATH11K_HTT_STATS_BUF_SIZE (1024 * 512)
104 #define ATH11K_FW_STATS_BUF_SIZE (1024 * 1024)
106 enum ath11k_pktlog_filter
{
107 ATH11K_PKTLOG_RX
= 0x000000001,
108 ATH11K_PKTLOG_TX
= 0x000000002,
109 ATH11K_PKTLOG_RCFIND
= 0x000000004,
110 ATH11K_PKTLOG_RCUPDATE
= 0x000000008,
111 ATH11K_PKTLOG_EVENT_SMART_ANT
= 0x000000020,
112 ATH11K_PKTLOG_EVENT_SW
= 0x000000040,
113 ATH11K_PKTLOG_ANY
= 0x00000006f,
116 enum ath11k_pktlog_mode
{
117 ATH11K_PKTLOG_MODE_LITE
= 1,
118 ATH11K_PKTLOG_MODE_FULL
= 2,
121 enum ath11k_pktlog_enum
{
122 ATH11K_PKTLOG_TYPE_INVALID
= 0,
123 ATH11K_PKTLOG_TYPE_TX_CTRL
= 1,
124 ATH11K_PKTLOG_TYPE_TX_STAT
= 2,
125 ATH11K_PKTLOG_TYPE_TX_MSDU_ID
= 3,
126 ATH11K_PKTLOG_TYPE_RX_STAT
= 5,
127 ATH11K_PKTLOG_TYPE_RC_FIND
= 6,
128 ATH11K_PKTLOG_TYPE_RC_UPDATE
= 7,
129 ATH11K_PKTLOG_TYPE_TX_VIRT_ADDR
= 8,
130 ATH11K_PKTLOG_TYPE_RX_CBF
= 10,
131 ATH11K_PKTLOG_TYPE_RX_STATBUF
= 22,
132 ATH11K_PKTLOG_TYPE_PPDU_STATS
= 23,
133 ATH11K_PKTLOG_TYPE_LITE_RX
= 24,
136 enum ath11k_dbg_aggr_mode
{
137 ATH11K_DBG_AGGR_MODE_AUTO
,
138 ATH11K_DBG_AGGR_MODE_MANUAL
,
139 ATH11K_DBG_AGGR_MODE_MAX
,
142 enum fw_dbglog_wlan_module_id
{
143 WLAN_MODULE_ID_MIN
= 0,
144 WLAN_MODULE_INF
= WLAN_MODULE_ID_MIN
,
146 WLAN_MODULE_STA_PWRSAVE
,
150 WLAN_MODULE_RESMGR_CHAN_MANAGER
,
152 WLAN_MODULE_VDEV_MGR
,
154 WLAN_MODULE_RATECTRL
,
155 WLAN_MODULE_AP_PWRSAVE
,
156 WLAN_MODULE_BLOCKACK
,
157 WLAN_MODULE_MGMT_TXRX
,
158 WLAN_MODULE_DATA_TXRX
,
167 WLAN_MODULE_RESOURCE
,
169 WLAN_MODULE_CACHEMGR
,
176 WLAN_MODULE_WAL_VDEV
,
177 WLAN_MODULE_WAL_PDEV
,
179 WLAN_MODULE_STA_SMPS
,
185 WLAN_MODULE_BATCH_SCAN
,
186 WLAN_MODULE_THERMAL_MGR
,
187 WLAN_MODULE_PHYERR_DFS
,
191 WLAN_MODULE_IBSS_PWRSAVE
,
192 WLAN_MODULE_HIF_UART
,
195 WLAN_MODULE_UNIT_TEST
,
200 WLAN_MODULE_RSSI_MONITOR
,
204 WLAN_MODULE_SCAN_CH_PREDICT
,
206 WLAN_MODULE_CMC_QMIC
,
210 WLAN_MODULE_P2P_LISTEN_OFFLOAD
,
215 WLAN_MODULE_SCHED_ALGO
,
219 WLAN_MODULE_RU_ALLOCATOR
,
220 WLAN_MODULE_11K_OFFLOAD
,
223 WLAN_MODULE_UL_OFDMA
,
224 WLAN_MODULE_HPCS_PULSE
,
226 WLAN_MODULE_QUIET_IE
,
227 WLAN_MODULE_SHMEM_MGR
,
229 WLAN_MODULE_CODE_COVER
,
232 WLAN_MODULE_PEER_INIT
,
233 WLAN_MODULE_STA_MLO_PS
,
236 WLAN_MODULE_ID_INVALID
= WLAN_MODULE_ID_MAX
,
239 enum fw_dbglog_log_level
{
240 ATH11K_FW_DBGLOG_ML
= 0,
241 ATH11K_FW_DBGLOG_VERBOSE
= 0,
242 ATH11K_FW_DBGLOG_INFO
,
243 ATH11K_FW_DBGLOG_INFO_LVL_1
,
244 ATH11K_FW_DBGLOG_INFO_LVL_2
,
245 ATH11K_FW_DBGLOG_WARN
,
246 ATH11K_FW_DBGLOG_ERR
,
247 ATH11K_FW_DBGLOG_LVL_MAX
250 struct ath11k_fw_dbglog
{
251 enum wmi_debug_log_param param
;
254 /* log_level values are given in enum fw_dbglog_log_level */
256 /* module_id values are given in enum fw_dbglog_wlan_module_id */
259 /* value is either log_level&module_id/vdev_id/vdev_id_bitmap/log_level
266 #ifdef CONFIG_ATH11K_DEBUGFS
267 int ath11k_debugfs_soc_create(struct ath11k_base
*ab
);
268 void ath11k_debugfs_soc_destroy(struct ath11k_base
*ab
);
269 int ath11k_debugfs_pdev_create(struct ath11k_base
*ab
);
270 void ath11k_debugfs_pdev_destroy(struct ath11k_base
*ab
);
271 int ath11k_debugfs_register(struct ath11k
*ar
);
272 void ath11k_debugfs_unregister(struct ath11k
*ar
);
273 void ath11k_debugfs_fw_stats_process(struct ath11k
*ar
, struct ath11k_fw_stats
*stats
);
275 void ath11k_debugfs_fw_stats_init(struct ath11k
*ar
);
276 int ath11k_debugfs_get_fw_stats(struct ath11k
*ar
, u32 pdev_id
,
277 u32 vdev_id
, u32 stats_id
);
279 static inline bool ath11k_debugfs_is_pktlog_lite_mode_enabled(struct ath11k
*ar
)
281 return (ar
->debug
.pktlog_mode
== ATH11K_PKTLOG_MODE_LITE
);
284 static inline bool ath11k_debugfs_is_pktlog_rx_stats_enabled(struct ath11k
*ar
)
286 return (!ar
->debug
.pktlog_peer_valid
&& ar
->debug
.pktlog_mode
);
289 static inline bool ath11k_debugfs_is_pktlog_peer_valid(struct ath11k
*ar
, u8
*addr
)
291 return (ar
->debug
.pktlog_peer_valid
&& ar
->debug
.pktlog_mode
&&
292 ether_addr_equal(addr
, ar
->debug
.pktlog_peer_addr
));
295 static inline int ath11k_debugfs_is_extd_tx_stats_enabled(struct ath11k
*ar
)
297 return ar
->debug
.extd_tx_stats
;
300 static inline int ath11k_debugfs_is_extd_rx_stats_enabled(struct ath11k
*ar
)
302 return ar
->debug
.extd_rx_stats
;
305 static inline int ath11k_debugfs_rx_filter(struct ath11k
*ar
)
307 return ar
->debug
.rx_filter
;
310 void ath11k_debugfs_op_vif_add(struct ieee80211_hw
*hw
,
311 struct ieee80211_vif
*vif
);
312 void ath11k_debugfs_add_dbring_entry(struct ath11k
*ar
,
313 enum wmi_direct_buffer_module id
,
314 enum ath11k_dbg_dbr_event event
,
315 struct hal_srng
*srng
);
318 static inline int ath11k_debugfs_soc_create(struct ath11k_base
*ab
)
323 static inline void ath11k_debugfs_soc_destroy(struct ath11k_base
*ab
)
327 static inline int ath11k_debugfs_pdev_create(struct ath11k_base
*ab
)
332 static inline void ath11k_debugfs_pdev_destroy(struct ath11k_base
*ab
)
336 static inline int ath11k_debugfs_register(struct ath11k
*ar
)
341 static inline void ath11k_debugfs_unregister(struct ath11k
*ar
)
345 static inline void ath11k_debugfs_fw_stats_process(struct ath11k
*ar
,
346 struct ath11k_fw_stats
*stats
)
350 static inline void ath11k_debugfs_fw_stats_init(struct ath11k
*ar
)
354 static inline int ath11k_debugfs_is_extd_tx_stats_enabled(struct ath11k
*ar
)
359 static inline int ath11k_debugfs_is_extd_rx_stats_enabled(struct ath11k
*ar
)
364 static inline bool ath11k_debugfs_is_pktlog_lite_mode_enabled(struct ath11k
*ar
)
369 static inline bool ath11k_debugfs_is_pktlog_rx_stats_enabled(struct ath11k
*ar
)
374 static inline bool ath11k_debugfs_is_pktlog_peer_valid(struct ath11k
*ar
, u8
*addr
)
379 static inline int ath11k_debugfs_rx_filter(struct ath11k
*ar
)
384 static inline int ath11k_debugfs_get_fw_stats(struct ath11k
*ar
,
385 u32 pdev_id
, u32 vdev_id
, u32 stats_id
)
391 ath11k_debugfs_add_dbring_entry(struct ath11k
*ar
,
392 enum wmi_direct_buffer_module id
,
393 enum ath11k_dbg_dbr_event event
,
394 struct hal_srng
*srng
)
397 #endif /* CONFIG_ATH11K_DEBUGFS*/
399 #endif /* _ATH11K_DEBUGFS_H_ */