xref: /freebsd/sys/contrib/dev/athk/ath10k/debug.h (revision da8fa4e37a0c048a67d7baa3b5a9bed637d02564)
1*da8fa4e3SBjoern A. Zeeb /* SPDX-License-Identifier: ISC */
2*da8fa4e3SBjoern A. Zeeb /*
3*da8fa4e3SBjoern A. Zeeb  * Copyright (c) 2005-2011 Atheros Communications Inc.
4*da8fa4e3SBjoern A. Zeeb  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5*da8fa4e3SBjoern A. Zeeb  * Copyright (c) 2018, The Linux Foundation. All rights reserved.
6*da8fa4e3SBjoern A. Zeeb  */
7*da8fa4e3SBjoern A. Zeeb 
8*da8fa4e3SBjoern A. Zeeb #ifndef _DEBUG_H_
9*da8fa4e3SBjoern A. Zeeb #define _DEBUG_H_
10*da8fa4e3SBjoern A. Zeeb 
11*da8fa4e3SBjoern A. Zeeb #include <linux/types.h>
12*da8fa4e3SBjoern A. Zeeb #include "trace.h"
13*da8fa4e3SBjoern A. Zeeb 
14*da8fa4e3SBjoern A. Zeeb enum ath10k_debug_mask {
15*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_PCI		= 0x00000001,
16*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_WMI		= 0x00000002,
17*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_HTC		= 0x00000004,
18*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_HTT		= 0x00000008,
19*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_MAC		= 0x00000010,
20*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_BOOT		= 0x00000020,
21*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_PCI_DUMP	= 0x00000040,
22*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_HTT_DUMP	= 0x00000080,
23*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_MGMT		= 0x00000100,
24*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_DATA		= 0x00000200,
25*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_BMI		= 0x00000400,
26*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_REGULATORY	= 0x00000800,
27*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_TESTMODE	= 0x00001000,
28*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_WMI_PRINT	= 0x00002000,
29*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_PCI_PS	= 0x00004000,
30*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_AHB		= 0x00008000,
31*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_SDIO		= 0x00010000,
32*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_SDIO_DUMP	= 0x00020000,
33*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_USB		= 0x00040000,
34*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_USB_BULK	= 0x00080000,
35*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_SNOC		= 0x00100000,
36*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_QMI		= 0x00200000,
37*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_STA		= 0x00400000,
38*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_ANY		= 0xffffffff,
39*da8fa4e3SBjoern A. Zeeb };
40*da8fa4e3SBjoern A. Zeeb 
41*da8fa4e3SBjoern A. Zeeb enum ath10k_pktlog_filter {
42*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_RX         = 0x000000001,
43*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_TX         = 0x000000002,
44*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_RCFIND     = 0x000000004,
45*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_RCUPDATE   = 0x000000008,
46*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_DBG_PRINT  = 0x000000010,
47*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_PEER_STATS = 0x000000040,
48*da8fa4e3SBjoern A. Zeeb 	ATH10K_PKTLOG_ANY        = 0x00000005f,
49*da8fa4e3SBjoern A. Zeeb };
50*da8fa4e3SBjoern A. Zeeb 
51*da8fa4e3SBjoern A. Zeeb enum ath10k_dbg_aggr_mode {
52*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_AGGR_MODE_AUTO,
53*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_AGGR_MODE_MANUAL,
54*da8fa4e3SBjoern A. Zeeb 	ATH10K_DBG_AGGR_MODE_MAX,
55*da8fa4e3SBjoern A. Zeeb };
56*da8fa4e3SBjoern A. Zeeb 
57*da8fa4e3SBjoern A. Zeeb /* Types of packet log events */
58*da8fa4e3SBjoern A. Zeeb enum ath_pktlog_type {
59*da8fa4e3SBjoern A. Zeeb 	ATH_PKTLOG_TYPE_TX_CTRL = 1,
60*da8fa4e3SBjoern A. Zeeb 	ATH_PKTLOG_TYPE_TX_STAT,
61*da8fa4e3SBjoern A. Zeeb };
62*da8fa4e3SBjoern A. Zeeb 
63*da8fa4e3SBjoern A. Zeeb struct ath10k_pktlog_hdr {
64*da8fa4e3SBjoern A. Zeeb 	__le16 flags;
65*da8fa4e3SBjoern A. Zeeb 	__le16 missed_cnt;
66*da8fa4e3SBjoern A. Zeeb 	__le16 log_type; /* Type of log information foll this header */
67*da8fa4e3SBjoern A. Zeeb 	__le16 size; /* Size of variable length log information in bytes */
68*da8fa4e3SBjoern A. Zeeb 	__le32 timestamp;
69*da8fa4e3SBjoern A. Zeeb 	u8 payload[];
70*da8fa4e3SBjoern A. Zeeb } __packed;
71*da8fa4e3SBjoern A. Zeeb 
72*da8fa4e3SBjoern A. Zeeb /* FIXME: How to calculate the buffer size sanely? */
73*da8fa4e3SBjoern A. Zeeb #define ATH10K_FW_STATS_BUF_SIZE (1024 * 1024)
74*da8fa4e3SBjoern A. Zeeb 
75*da8fa4e3SBjoern A. Zeeb #define ATH10K_TX_POWER_MAX_VAL 70
76*da8fa4e3SBjoern A. Zeeb #define ATH10K_TX_POWER_MIN_VAL 0
77*da8fa4e3SBjoern A. Zeeb 
78*da8fa4e3SBjoern A. Zeeb extern unsigned int ath10k_debug_mask;
79*da8fa4e3SBjoern A. Zeeb 
80*da8fa4e3SBjoern A. Zeeb __printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...);
81*da8fa4e3SBjoern A. Zeeb __printf(2, 3) void ath10k_err(struct ath10k *ar, const char *fmt, ...);
82*da8fa4e3SBjoern A. Zeeb __printf(2, 3) void ath10k_warn(struct ath10k *ar, const char *fmt, ...);
83*da8fa4e3SBjoern A. Zeeb 
84*da8fa4e3SBjoern A. Zeeb void ath10k_debug_print_hwfw_info(struct ath10k *ar);
85*da8fa4e3SBjoern A. Zeeb void ath10k_debug_print_board_info(struct ath10k *ar);
86*da8fa4e3SBjoern A. Zeeb void ath10k_debug_print_boot_info(struct ath10k *ar);
87*da8fa4e3SBjoern A. Zeeb void ath10k_print_driver_info(struct ath10k *ar);
88*da8fa4e3SBjoern A. Zeeb 
89*da8fa4e3SBjoern A. Zeeb #ifdef CONFIG_ATH10K_DEBUGFS
90*da8fa4e3SBjoern A. Zeeb int ath10k_debug_start(struct ath10k *ar);
91*da8fa4e3SBjoern A. Zeeb void ath10k_debug_stop(struct ath10k *ar);
92*da8fa4e3SBjoern A. Zeeb int ath10k_debug_create(struct ath10k *ar);
93*da8fa4e3SBjoern A. Zeeb void ath10k_debug_destroy(struct ath10k *ar);
94*da8fa4e3SBjoern A. Zeeb int ath10k_debug_register(struct ath10k *ar);
95*da8fa4e3SBjoern A. Zeeb void ath10k_debug_unregister(struct ath10k *ar);
96*da8fa4e3SBjoern A. Zeeb void ath10k_debug_fw_stats_process(struct ath10k *ar, struct sk_buff *skb);
97*da8fa4e3SBjoern A. Zeeb void ath10k_debug_tpc_stats_process(struct ath10k *ar,
98*da8fa4e3SBjoern A. Zeeb 				    struct ath10k_tpc_stats *tpc_stats);
99*da8fa4e3SBjoern A. Zeeb void
100*da8fa4e3SBjoern A. Zeeb ath10k_debug_tpc_stats_final_process(struct ath10k *ar,
101*da8fa4e3SBjoern A. Zeeb 				     struct ath10k_tpc_stats_final *tpc_stats);
102*da8fa4e3SBjoern A. Zeeb void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer, int len);
103*da8fa4e3SBjoern A. Zeeb 
104*da8fa4e3SBjoern A. Zeeb #define ATH10K_DFS_STAT_INC(ar, c) (ar->debug.dfs_stats.c++)
105*da8fa4e3SBjoern A. Zeeb 
106*da8fa4e3SBjoern A. Zeeb void ath10k_debug_get_et_strings(struct ieee80211_hw *hw,
107*da8fa4e3SBjoern A. Zeeb 				 struct ieee80211_vif *vif,
108*da8fa4e3SBjoern A. Zeeb 				 u32 sset, u8 *data);
109*da8fa4e3SBjoern A. Zeeb int ath10k_debug_get_et_sset_count(struct ieee80211_hw *hw,
110*da8fa4e3SBjoern A. Zeeb 				   struct ieee80211_vif *vif, int sset);
111*da8fa4e3SBjoern A. Zeeb void ath10k_debug_get_et_stats(struct ieee80211_hw *hw,
112*da8fa4e3SBjoern A. Zeeb 			       struct ieee80211_vif *vif,
113*da8fa4e3SBjoern A. Zeeb 			       struct ethtool_stats *stats, u64 *data);
114*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_get_fw_dbglog_mask(struct ath10k * ar)115*da8fa4e3SBjoern A. Zeeb static inline u64 ath10k_debug_get_fw_dbglog_mask(struct ath10k *ar)
116*da8fa4e3SBjoern A. Zeeb {
117*da8fa4e3SBjoern A. Zeeb 	return ar->debug.fw_dbglog_mask;
118*da8fa4e3SBjoern A. Zeeb }
119*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_get_fw_dbglog_level(struct ath10k * ar)120*da8fa4e3SBjoern A. Zeeb static inline u32 ath10k_debug_get_fw_dbglog_level(struct ath10k *ar)
121*da8fa4e3SBjoern A. Zeeb {
122*da8fa4e3SBjoern A. Zeeb 	return ar->debug.fw_dbglog_level;
123*da8fa4e3SBjoern A. Zeeb }
124*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_is_extd_tx_stats_enabled(struct ath10k * ar)125*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_is_extd_tx_stats_enabled(struct ath10k *ar)
126*da8fa4e3SBjoern A. Zeeb {
127*da8fa4e3SBjoern A. Zeeb 	return ar->debug.enable_extd_tx_stats;
128*da8fa4e3SBjoern A. Zeeb }
129*da8fa4e3SBjoern A. Zeeb 
130*da8fa4e3SBjoern A. Zeeb int ath10k_debug_fw_stats_request(struct ath10k *ar);
131*da8fa4e3SBjoern A. Zeeb 
132*da8fa4e3SBjoern A. Zeeb #else
133*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_start(struct ath10k * ar)134*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_start(struct ath10k *ar)
135*da8fa4e3SBjoern A. Zeeb {
136*da8fa4e3SBjoern A. Zeeb 	return 0;
137*da8fa4e3SBjoern A. Zeeb }
138*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_stop(struct ath10k * ar)139*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_stop(struct ath10k *ar)
140*da8fa4e3SBjoern A. Zeeb {
141*da8fa4e3SBjoern A. Zeeb }
142*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_create(struct ath10k * ar)143*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_create(struct ath10k *ar)
144*da8fa4e3SBjoern A. Zeeb {
145*da8fa4e3SBjoern A. Zeeb 	return 0;
146*da8fa4e3SBjoern A. Zeeb }
147*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_destroy(struct ath10k * ar)148*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_destroy(struct ath10k *ar)
149*da8fa4e3SBjoern A. Zeeb {
150*da8fa4e3SBjoern A. Zeeb }
151*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_register(struct ath10k * ar)152*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_register(struct ath10k *ar)
153*da8fa4e3SBjoern A. Zeeb {
154*da8fa4e3SBjoern A. Zeeb 	return 0;
155*da8fa4e3SBjoern A. Zeeb }
156*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_unregister(struct ath10k * ar)157*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_unregister(struct ath10k *ar)
158*da8fa4e3SBjoern A. Zeeb {
159*da8fa4e3SBjoern A. Zeeb }
160*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_fw_stats_process(struct ath10k * ar,struct sk_buff * skb)161*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_fw_stats_process(struct ath10k *ar,
162*da8fa4e3SBjoern A. Zeeb 						 struct sk_buff *skb)
163*da8fa4e3SBjoern A. Zeeb {
164*da8fa4e3SBjoern A. Zeeb }
165*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_tpc_stats_process(struct ath10k * ar,struct ath10k_tpc_stats * tpc_stats)166*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_tpc_stats_process(struct ath10k *ar,
167*da8fa4e3SBjoern A. Zeeb 						  struct ath10k_tpc_stats *tpc_stats)
168*da8fa4e3SBjoern A. Zeeb {
169*da8fa4e3SBjoern A. Zeeb 	kfree(tpc_stats);
170*da8fa4e3SBjoern A. Zeeb }
171*da8fa4e3SBjoern A. Zeeb 
172*da8fa4e3SBjoern A. Zeeb static inline void
ath10k_debug_tpc_stats_final_process(struct ath10k * ar,struct ath10k_tpc_stats_final * tpc_stats)173*da8fa4e3SBjoern A. Zeeb ath10k_debug_tpc_stats_final_process(struct ath10k *ar,
174*da8fa4e3SBjoern A. Zeeb 				     struct ath10k_tpc_stats_final *tpc_stats)
175*da8fa4e3SBjoern A. Zeeb {
176*da8fa4e3SBjoern A. Zeeb 	kfree(tpc_stats);
177*da8fa4e3SBjoern A. Zeeb }
178*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_dbglog_add(struct ath10k * ar,u8 * buffer,int len)179*da8fa4e3SBjoern A. Zeeb static inline void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer,
180*da8fa4e3SBjoern A. Zeeb 					   int len)
181*da8fa4e3SBjoern A. Zeeb {
182*da8fa4e3SBjoern A. Zeeb }
183*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_get_fw_dbglog_mask(struct ath10k * ar)184*da8fa4e3SBjoern A. Zeeb static inline u64 ath10k_debug_get_fw_dbglog_mask(struct ath10k *ar)
185*da8fa4e3SBjoern A. Zeeb {
186*da8fa4e3SBjoern A. Zeeb 	return 0;
187*da8fa4e3SBjoern A. Zeeb }
188*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_get_fw_dbglog_level(struct ath10k * ar)189*da8fa4e3SBjoern A. Zeeb static inline u32 ath10k_debug_get_fw_dbglog_level(struct ath10k *ar)
190*da8fa4e3SBjoern A. Zeeb {
191*da8fa4e3SBjoern A. Zeeb 	return 0;
192*da8fa4e3SBjoern A. Zeeb }
193*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_is_extd_tx_stats_enabled(struct ath10k * ar)194*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_is_extd_tx_stats_enabled(struct ath10k *ar)
195*da8fa4e3SBjoern A. Zeeb {
196*da8fa4e3SBjoern A. Zeeb 	return 0;
197*da8fa4e3SBjoern A. Zeeb }
198*da8fa4e3SBjoern A. Zeeb 
ath10k_debug_fw_stats_request(struct ath10k * ar)199*da8fa4e3SBjoern A. Zeeb static inline int ath10k_debug_fw_stats_request(struct ath10k *ar)
200*da8fa4e3SBjoern A. Zeeb {
201*da8fa4e3SBjoern A. Zeeb 	return 0;
202*da8fa4e3SBjoern A. Zeeb }
203*da8fa4e3SBjoern A. Zeeb 
204*da8fa4e3SBjoern A. Zeeb #define ATH10K_DFS_STAT_INC(ar, c) do { } while (0)
205*da8fa4e3SBjoern A. Zeeb 
206*da8fa4e3SBjoern A. Zeeb #define ath10k_debug_get_et_strings NULL
207*da8fa4e3SBjoern A. Zeeb #define ath10k_debug_get_et_sset_count NULL
208*da8fa4e3SBjoern A. Zeeb #define ath10k_debug_get_et_stats NULL
209*da8fa4e3SBjoern A. Zeeb 
210*da8fa4e3SBjoern A. Zeeb #endif /* CONFIG_ATH10K_DEBUGFS */
211*da8fa4e3SBjoern A. Zeeb #ifdef CONFIG_MAC80211_DEBUGFS
212*da8fa4e3SBjoern A. Zeeb void ath10k_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
213*da8fa4e3SBjoern A. Zeeb 			    struct ieee80211_sta *sta, struct dentry *dir);
214*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_duration(struct ath10k *ar,
215*da8fa4e3SBjoern A. Zeeb 				   struct ath10k_fw_stats *stats);
216*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr,
217*da8fa4e3SBjoern A. Zeeb 				    unsigned long num_msdus,
218*da8fa4e3SBjoern A. Zeeb 				    enum ath10k_pkt_rx_err err,
219*da8fa4e3SBjoern A. Zeeb 				    unsigned long unchain_cnt,
220*da8fa4e3SBjoern A. Zeeb 				    unsigned long drop_cnt,
221*da8fa4e3SBjoern A. Zeeb 				    unsigned long drop_cnt_filter,
222*da8fa4e3SBjoern A. Zeeb 				    unsigned long queued_msdus);
223*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,
224*da8fa4e3SBjoern A. Zeeb 					  u16 peer_id, u8 tid,
225*da8fa4e3SBjoern A. Zeeb 					  struct htt_rx_indication_mpdu_range *ranges,
226*da8fa4e3SBjoern A. Zeeb 					  int num_ranges);
227*da8fa4e3SBjoern A. Zeeb #else
228*da8fa4e3SBjoern A. Zeeb static inline
ath10k_sta_update_rx_duration(struct ath10k * ar,struct ath10k_fw_stats * stats)229*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_duration(struct ath10k *ar,
230*da8fa4e3SBjoern A. Zeeb 				   struct ath10k_fw_stats *stats)
231*da8fa4e3SBjoern A. Zeeb {
232*da8fa4e3SBjoern A. Zeeb }
233*da8fa4e3SBjoern A. Zeeb 
234*da8fa4e3SBjoern A. Zeeb static inline
ath10k_sta_update_rx_tid_stats(struct ath10k * ar,u8 * first_hdr,unsigned long num_msdus,enum ath10k_pkt_rx_err err,unsigned long unchain_cnt,unsigned long drop_cnt,unsigned long drop_cnt_filter,unsigned long queued_msdus)235*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_tid_stats(struct ath10k *ar, u8 *first_hdr,
236*da8fa4e3SBjoern A. Zeeb 				    unsigned long num_msdus,
237*da8fa4e3SBjoern A. Zeeb 				    enum ath10k_pkt_rx_err err,
238*da8fa4e3SBjoern A. Zeeb 				    unsigned long unchain_cnt,
239*da8fa4e3SBjoern A. Zeeb 				    unsigned long drop_cnt,
240*da8fa4e3SBjoern A. Zeeb 				    unsigned long drop_cnt_filter,
241*da8fa4e3SBjoern A. Zeeb 				    unsigned long queued_msdus)
242*da8fa4e3SBjoern A. Zeeb {
243*da8fa4e3SBjoern A. Zeeb }
244*da8fa4e3SBjoern A. Zeeb 
245*da8fa4e3SBjoern A. Zeeb static inline
ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k * ar,u16 peer_id,u8 tid,struct htt_rx_indication_mpdu_range * ranges,int num_ranges)246*da8fa4e3SBjoern A. Zeeb void ath10k_sta_update_rx_tid_stats_ampdu(struct ath10k *ar,
247*da8fa4e3SBjoern A. Zeeb 					  u16 peer_id, u8 tid,
248*da8fa4e3SBjoern A. Zeeb 					  struct htt_rx_indication_mpdu_range *ranges,
249*da8fa4e3SBjoern A. Zeeb 					  int num_ranges)
250*da8fa4e3SBjoern A. Zeeb {
251*da8fa4e3SBjoern A. Zeeb }
252*da8fa4e3SBjoern A. Zeeb #endif /* CONFIG_MAC80211_DEBUGFS */
253*da8fa4e3SBjoern A. Zeeb 
254*da8fa4e3SBjoern A. Zeeb #ifdef CONFIG_ATH10K_DEBUG
255*da8fa4e3SBjoern A. Zeeb __printf(3, 4) void __ath10k_dbg(struct ath10k *ar,
256*da8fa4e3SBjoern A. Zeeb 				 enum ath10k_debug_mask mask,
257*da8fa4e3SBjoern A. Zeeb 				 const char *fmt, ...);
258*da8fa4e3SBjoern A. Zeeb void ath10k_dbg_dump(struct ath10k *ar,
259*da8fa4e3SBjoern A. Zeeb 		     enum ath10k_debug_mask mask,
260*da8fa4e3SBjoern A. Zeeb 		     const char *msg, const char *prefix,
261*da8fa4e3SBjoern A. Zeeb 		     const void *buf, size_t len);
262*da8fa4e3SBjoern A. Zeeb #else /* CONFIG_ATH10K_DEBUG */
263*da8fa4e3SBjoern A. Zeeb 
__ath10k_dbg(struct ath10k * ar,enum ath10k_debug_mask dbg_mask,const char * fmt,...)264*da8fa4e3SBjoern A. Zeeb static inline int __ath10k_dbg(struct ath10k *ar,
265*da8fa4e3SBjoern A. Zeeb 			       enum ath10k_debug_mask dbg_mask,
266*da8fa4e3SBjoern A. Zeeb 			       const char *fmt, ...)
267*da8fa4e3SBjoern A. Zeeb {
268*da8fa4e3SBjoern A. Zeeb 	return 0;
269*da8fa4e3SBjoern A. Zeeb }
270*da8fa4e3SBjoern A. Zeeb 
ath10k_dbg_dump(struct ath10k * ar,enum ath10k_debug_mask mask,const char * msg,const char * prefix,const void * buf,size_t len)271*da8fa4e3SBjoern A. Zeeb static inline void ath10k_dbg_dump(struct ath10k *ar,
272*da8fa4e3SBjoern A. Zeeb 				   enum ath10k_debug_mask mask,
273*da8fa4e3SBjoern A. Zeeb 				   const char *msg, const char *prefix,
274*da8fa4e3SBjoern A. Zeeb 				   const void *buf, size_t len)
275*da8fa4e3SBjoern A. Zeeb {
276*da8fa4e3SBjoern A. Zeeb }
277*da8fa4e3SBjoern A. Zeeb #endif /* CONFIG_ATH10K_DEBUG */
278*da8fa4e3SBjoern A. Zeeb 
279*da8fa4e3SBjoern A. Zeeb #if !defined(CONFIG_ATH10K_TRACING)
280*da8fa4e3SBjoern A. Zeeb #define	trace_ath10k_log_dbg_enabled()	(0)
281*da8fa4e3SBjoern A. Zeeb #endif
282*da8fa4e3SBjoern A. Zeeb 
283*da8fa4e3SBjoern A. Zeeb /* Avoid calling __ath10k_dbg() if debug_mask is not set and tracing
284*da8fa4e3SBjoern A. Zeeb  * disabled.
285*da8fa4e3SBjoern A. Zeeb  */
286*da8fa4e3SBjoern A. Zeeb #define ath10k_dbg(ar, dbg_mask, fmt, ...)			\
287*da8fa4e3SBjoern A. Zeeb do {								\
288*da8fa4e3SBjoern A. Zeeb 	if ((ath10k_debug_mask & dbg_mask) ||			\
289*da8fa4e3SBjoern A. Zeeb 	    trace_ath10k_log_dbg_enabled())			\
290*da8fa4e3SBjoern A. Zeeb 		__ath10k_dbg(ar, dbg_mask, fmt, ##__VA_ARGS__); \
291*da8fa4e3SBjoern A. Zeeb } while (0)
292*da8fa4e3SBjoern A. Zeeb #endif /* _DEBUG_H_ */
293