xref: /openbmc/linux/net/mac80211/debug.h (revision c1d45424)
1 #ifndef __MAC80211_DEBUG_H
2 #define __MAC80211_DEBUG_H
3 #include <net/cfg80211.h>
4 
5 #ifdef CONFIG_MAC80211_IBSS_DEBUG
6 #define MAC80211_IBSS_DEBUG 1
7 #else
8 #define MAC80211_IBSS_DEBUG 0
9 #endif
10 
11 #ifdef CONFIG_MAC80211_PS_DEBUG
12 #define MAC80211_PS_DEBUG 1
13 #else
14 #define MAC80211_PS_DEBUG 0
15 #endif
16 
17 #ifdef CONFIG_MAC80211_HT_DEBUG
18 #define MAC80211_HT_DEBUG 1
19 #else
20 #define MAC80211_HT_DEBUG 0
21 #endif
22 
23 #ifdef CONFIG_MAC80211_MPL_DEBUG
24 #define MAC80211_MPL_DEBUG 1
25 #else
26 #define MAC80211_MPL_DEBUG 0
27 #endif
28 
29 #ifdef CONFIG_MAC80211_MPATH_DEBUG
30 #define MAC80211_MPATH_DEBUG 1
31 #else
32 #define MAC80211_MPATH_DEBUG 0
33 #endif
34 
35 #ifdef CONFIG_MAC80211_MHWMP_DEBUG
36 #define MAC80211_MHWMP_DEBUG 1
37 #else
38 #define MAC80211_MHWMP_DEBUG 0
39 #endif
40 
41 #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
42 #define MAC80211_MESH_SYNC_DEBUG 1
43 #else
44 #define MAC80211_MESH_SYNC_DEBUG 0
45 #endif
46 
47 #ifdef CONFIG_MAC80211_MESH_PS_DEBUG
48 #define MAC80211_MESH_PS_DEBUG 1
49 #else
50 #define MAC80211_MESH_PS_DEBUG 0
51 #endif
52 
53 #ifdef CONFIG_MAC80211_TDLS_DEBUG
54 #define MAC80211_TDLS_DEBUG 1
55 #else
56 #define MAC80211_TDLS_DEBUG 0
57 #endif
58 
59 #ifdef CONFIG_MAC80211_STA_DEBUG
60 #define MAC80211_STA_DEBUG 1
61 #else
62 #define MAC80211_STA_DEBUG 0
63 #endif
64 
65 #ifdef CONFIG_MAC80211_MLME_DEBUG
66 #define MAC80211_MLME_DEBUG 1
67 #else
68 #define MAC80211_MLME_DEBUG 0
69 #endif
70 
71 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
72 void __sdata_info(const char *fmt, ...) __printf(1, 2);
73 void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3);
74 void __sdata_err(const char *fmt, ...) __printf(1, 2);
75 void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
76 	__printf(3, 4);
77 
78 #define _sdata_info(sdata, fmt, ...)					\
79 	__sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
80 #define _sdata_dbg(print, sdata, fmt, ...)				\
81 	__sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__)
82 #define _sdata_err(sdata, fmt, ...)					\
83 	__sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
84 #define _wiphy_dbg(print, wiphy, fmt, ...)				\
85 	__wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__)
86 #else
87 #define _sdata_info(sdata, fmt, ...)					\
88 do {									\
89 	pr_info("%s: " fmt,						\
90 		(sdata)->name, ##__VA_ARGS__);				\
91 } while (0)
92 
93 #define _sdata_dbg(print, sdata, fmt, ...)				\
94 do {									\
95 	if (print)							\
96 		pr_debug("%s: " fmt,					\
97 			 (sdata)->name, ##__VA_ARGS__);			\
98 } while (0)
99 
100 #define _sdata_err(sdata, fmt, ...)					\
101 do {									\
102 	pr_err("%s: " fmt,						\
103 	       (sdata)->name, ##__VA_ARGS__);				\
104 } while (0)
105 
106 #define _wiphy_dbg(print, wiphy, fmt, ...)				\
107 do {									\
108 	if (print)							\
109 		wiphy_dbg((wiphy), fmt, ##__VA_ARGS__);			\
110 } while (0)
111 #endif
112 
113 #define sdata_info(sdata, fmt, ...)					\
114 	_sdata_info(sdata, fmt, ##__VA_ARGS__)
115 #define sdata_err(sdata, fmt, ...)					\
116 	_sdata_err(sdata, fmt, ##__VA_ARGS__)
117 #define sdata_dbg(sdata, fmt, ...)					\
118 	_sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
119 
120 #define ht_dbg(sdata, fmt, ...)						\
121 	_sdata_dbg(MAC80211_HT_DEBUG,					\
122 		   sdata, fmt, ##__VA_ARGS__)
123 
124 #define ht_dbg_ratelimited(sdata, fmt, ...)				\
125 	_sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(),		\
126 		   sdata, fmt, ##__VA_ARGS__)
127 
128 #define ibss_dbg(sdata, fmt, ...)					\
129 	_sdata_dbg(MAC80211_IBSS_DEBUG,					\
130 		   sdata, fmt, ##__VA_ARGS__)
131 
132 #define ps_dbg(sdata, fmt, ...)						\
133 	_sdata_dbg(MAC80211_PS_DEBUG,					\
134 		   sdata, fmt, ##__VA_ARGS__)
135 
136 #define ps_dbg_hw(hw, fmt, ...)						\
137 	_wiphy_dbg(MAC80211_PS_DEBUG,					\
138 		   (hw)->wiphy, fmt, ##__VA_ARGS__)
139 
140 #define ps_dbg_ratelimited(sdata, fmt, ...)				\
141 	_sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(),		\
142 		   sdata, fmt, ##__VA_ARGS__)
143 
144 #define mpl_dbg(sdata, fmt, ...)					\
145 	_sdata_dbg(MAC80211_MPL_DEBUG,					\
146 		   sdata, fmt, ##__VA_ARGS__)
147 
148 #define mpath_dbg(sdata, fmt, ...)					\
149 	_sdata_dbg(MAC80211_MPATH_DEBUG,				\
150 		   sdata, fmt, ##__VA_ARGS__)
151 
152 #define mhwmp_dbg(sdata, fmt, ...)					\
153 	_sdata_dbg(MAC80211_MHWMP_DEBUG,				\
154 		   sdata, fmt, ##__VA_ARGS__)
155 
156 #define msync_dbg(sdata, fmt, ...)					\
157 	_sdata_dbg(MAC80211_MESH_SYNC_DEBUG,				\
158 		   sdata, fmt, ##__VA_ARGS__)
159 
160 #define mps_dbg(sdata, fmt, ...)					\
161 	_sdata_dbg(MAC80211_MESH_PS_DEBUG,				\
162 		   sdata, fmt, ##__VA_ARGS__)
163 
164 #define tdls_dbg(sdata, fmt, ...)					\
165 	_sdata_dbg(MAC80211_TDLS_DEBUG,					\
166 		   sdata, fmt, ##__VA_ARGS__)
167 
168 #define sta_dbg(sdata, fmt, ...)					\
169 	_sdata_dbg(MAC80211_STA_DEBUG,					\
170 		   sdata, fmt, ##__VA_ARGS__)
171 
172 #define mlme_dbg(sdata, fmt, ...)					\
173 	_sdata_dbg(MAC80211_MLME_DEBUG,					\
174 		   sdata, fmt, ##__VA_ARGS__)
175 
176 #define mlme_dbg_ratelimited(sdata, fmt, ...)				\
177 	_sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(),		\
178 		   sdata, fmt, ##__VA_ARGS__)
179 
180 #endif /* __MAC80211_DEBUG_H */
181