1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#ifndef __iwl_debug_h__
30#define __iwl_debug_h__
31
32#include "iwl-modparams.h"
33
34
35static inline bool iwl_have_debug_level(u32 level)
36{
37#ifdef CONFIG_IWLWIFI_DEBUG
38 return iwlwifi_mod_params.debug_level & level;
39#else
40 return false;
41#endif
42}
43
44struct device;
45void __iwl_err(struct device *dev, bool rfkill_prefix, bool only_trace,
46 const char *fmt, ...) __printf(4, 5);
47void __iwl_warn(struct device *dev, const char *fmt, ...) __printf(2, 3);
48void __iwl_info(struct device *dev, const char *fmt, ...) __printf(2, 3);
49void __iwl_crit(struct device *dev, const char *fmt, ...) __printf(2, 3);
50
51
52#define CHECK_FOR_NEWLINE(f) BUILD_BUG_ON(f[sizeof(f) - 2] != '\n')
53
54
55#define IWL_ERR_DEV(d, f, a...) \
56 do { \
57 CHECK_FOR_NEWLINE(f); \
58 __iwl_err((d), false, false, f, ## a); \
59 } while (0)
60#define IWL_ERR(m, f, a...) \
61 IWL_ERR_DEV((m)->dev, f, ## a)
62#define IWL_WARN(m, f, a...) \
63 do { \
64 CHECK_FOR_NEWLINE(f); \
65 __iwl_warn((m)->dev, f, ## a); \
66 } while (0)
67#define IWL_INFO(m, f, a...) \
68 do { \
69 CHECK_FOR_NEWLINE(f); \
70 __iwl_info((m)->dev, f, ## a); \
71 } while (0)
72#define IWL_CRIT(m, f, a...) \
73 do { \
74 CHECK_FOR_NEWLINE(f); \
75 __iwl_crit((m)->dev, f, ## a); \
76 } while (0)
77
78#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)
79void __iwl_dbg(struct device *dev,
80 u32 level, bool limit, const char *function,
81 const char *fmt, ...) __printf(5, 6);
82#else
83__printf(5, 6) static inline void
84__iwl_dbg(struct device *dev,
85 u32 level, bool limit, const char *function,
86 const char *fmt, ...)
87{}
88#endif
89
90#define iwl_print_hex_error(m, p, len) \
91do { \
92 print_hex_dump(KERN_ERR, "iwl data: ", \
93 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
94} while (0)
95
96#define __IWL_DEBUG_DEV(dev, level, limit, fmt, args...) \
97 do { \
98 CHECK_FOR_NEWLINE(fmt); \
99 __iwl_dbg(dev, level, limit, __func__, fmt, ##args); \
100 } while (0)
101#define IWL_DEBUG(m, level, fmt, args...) \
102 __IWL_DEBUG_DEV((m)->dev, level, false, fmt, ##args)
103#define IWL_DEBUG_DEV(dev, level, fmt, args...) \
104 __IWL_DEBUG_DEV(dev, level, false, fmt, ##args)
105#define IWL_DEBUG_LIMIT(m, level, fmt, args...) \
106 __IWL_DEBUG_DEV((m)->dev, level, true, fmt, ##args)
107
108#ifdef CONFIG_IWLWIFI_DEBUG
109#define iwl_print_hex_dump(m, level, p, len) \
110do { \
111 if (iwl_have_debug_level(level)) \
112 print_hex_dump(KERN_DEBUG, "iwl data: ", \
113 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
114} while (0)
115#else
116#define iwl_print_hex_dump(m, level, p, len)
117#endif
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144#define IWL_DL_INFO 0x00000001
145#define IWL_DL_MAC80211 0x00000002
146#define IWL_DL_HCMD 0x00000004
147#define IWL_DL_TDLS 0x00000008
148
149#define IWL_DL_QUOTA 0x00000010
150#define IWL_DL_TE 0x00000020
151#define IWL_DL_EEPROM 0x00000040
152#define IWL_DL_RADIO 0x00000080
153
154#define IWL_DL_POWER 0x00000100
155#define IWL_DL_TEMP 0x00000200
156#define IWL_DL_RPM 0x00000400
157#define IWL_DL_SCAN 0x00000800
158
159#define IWL_DL_ASSOC 0x00001000
160#define IWL_DL_DROP 0x00002000
161#define IWL_DL_LAR 0x00004000
162#define IWL_DL_COEX 0x00008000
163
164#define IWL_DL_FW 0x00010000
165#define IWL_DL_RF_KILL 0x00020000
166#define IWL_DL_FW_ERRORS 0x00040000
167
168#define IWL_DL_RATE 0x00100000
169#define IWL_DL_CALIB 0x00200000
170#define IWL_DL_WEP 0x00400000
171#define IWL_DL_TX 0x00800000
172
173#define IWL_DL_RX 0x01000000
174#define IWL_DL_ISR 0x02000000
175#define IWL_DL_HT 0x04000000
176#define IWL_DL_EXTERNAL 0x08000000
177
178#define IWL_DL_11H 0x10000000
179#define IWL_DL_STATS 0x20000000
180#define IWL_DL_TX_REPLY 0x40000000
181#define IWL_DL_TX_QUEUES 0x80000000
182
183#define IWL_DEBUG_INFO(p, f, a...) IWL_DEBUG(p, IWL_DL_INFO, f, ## a)
184#define IWL_DEBUG_TDLS(p, f, a...) IWL_DEBUG(p, IWL_DL_TDLS, f, ## a)
185#define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a)
186#define IWL_DEBUG_EXTERNAL(p, f, a...) IWL_DEBUG(p, IWL_DL_EXTERNAL, f, ## a)
187#define IWL_DEBUG_TEMP(p, f, a...) IWL_DEBUG(p, IWL_DL_TEMP, f, ## a)
188#define IWL_DEBUG_SCAN(p, f, a...) IWL_DEBUG(p, IWL_DL_SCAN, f, ## a)
189#define IWL_DEBUG_RX(p, f, a...) IWL_DEBUG(p, IWL_DL_RX, f, ## a)
190#define IWL_DEBUG_TX(p, f, a...) IWL_DEBUG(p, IWL_DL_TX, f, ## a)
191#define IWL_DEBUG_ISR(p, f, a...) IWL_DEBUG(p, IWL_DL_ISR, f, ## a)
192#define IWL_DEBUG_WEP(p, f, a...) IWL_DEBUG(p, IWL_DL_WEP, f, ## a)
193#define IWL_DEBUG_HC(p, f, a...) IWL_DEBUG(p, IWL_DL_HCMD, f, ## a)
194#define IWL_DEBUG_QUOTA(p, f, a...) IWL_DEBUG(p, IWL_DL_QUOTA, f, ## a)
195#define IWL_DEBUG_TE(p, f, a...) IWL_DEBUG(p, IWL_DL_TE, f, ## a)
196#define IWL_DEBUG_EEPROM(d, f, a...) IWL_DEBUG_DEV(d, IWL_DL_EEPROM, f, ## a)
197#define IWL_DEBUG_CALIB(p, f, a...) IWL_DEBUG(p, IWL_DL_CALIB, f, ## a)
198#define IWL_DEBUG_FW(p, f, a...) IWL_DEBUG(p, IWL_DL_FW, f, ## a)
199#define IWL_DEBUG_RF_KILL(p, f, a...) IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a)
200#define IWL_DEBUG_FW_ERRORS(p, f, a...) IWL_DEBUG(p, IWL_DL_FW_ERRORS, f, ## a)
201#define IWL_DEBUG_DROP(p, f, a...) IWL_DEBUG(p, IWL_DL_DROP, f, ## a)
202#define IWL_DEBUG_DROP_LIMIT(p, f, a...) \
203 IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a)
204#define IWL_DEBUG_COEX(p, f, a...) IWL_DEBUG(p, IWL_DL_COEX, f, ## a)
205#define IWL_DEBUG_RATE(p, f, a...) IWL_DEBUG(p, IWL_DL_RATE, f, ## a)
206#define IWL_DEBUG_RATE_LIMIT(p, f, a...) \
207 IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a)
208#define IWL_DEBUG_ASSOC(p, f, a...) \
209 IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
210#define IWL_DEBUG_ASSOC_LIMIT(p, f, a...) \
211 IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
212#define IWL_DEBUG_HT(p, f, a...) IWL_DEBUG(p, IWL_DL_HT, f, ## a)
213#define IWL_DEBUG_STATS(p, f, a...) IWL_DEBUG(p, IWL_DL_STATS, f, ## a)
214#define IWL_DEBUG_STATS_LIMIT(p, f, a...) \
215 IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a)
216#define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a)
217#define IWL_DEBUG_TX_QUEUES(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_QUEUES, f, ## a)
218#define IWL_DEBUG_RADIO(p, f, a...) IWL_DEBUG(p, IWL_DL_RADIO, f, ## a)
219#define IWL_DEBUG_DEV_RADIO(p, f, a...) IWL_DEBUG_DEV(p, IWL_DL_RADIO, f, ## a)
220#define IWL_DEBUG_POWER(p, f, a...) IWL_DEBUG(p, IWL_DL_POWER, f, ## a)
221#define IWL_DEBUG_11H(p, f, a...) IWL_DEBUG(p, IWL_DL_11H, f, ## a)
222#define IWL_DEBUG_RPM(p, f, a...) IWL_DEBUG(p, IWL_DL_RPM, f, ## a)
223#define IWL_DEBUG_LAR(p, f, a...) IWL_DEBUG(p, IWL_DL_LAR, f, ## a)
224
225#endif
226