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