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