1 /* SPDX-License-Identifier: GPL-2.0 */
4 * Copyright (C) 2022 - 2023 Intel Corporation
6 #ifndef __MAC80211_DEBUG_H
7 #define __MAC80211_DEBUG_H
8 #include <net/cfg80211.h>
10 #ifdef CONFIG_MAC80211_OCB_DEBUG
11 #define MAC80211_OCB_DEBUG 1
13 #define MAC80211_OCB_DEBUG 0
16 #ifdef CONFIG_MAC80211_IBSS_DEBUG
17 #define MAC80211_IBSS_DEBUG 1
19 #define MAC80211_IBSS_DEBUG 0
22 #ifdef CONFIG_MAC80211_PS_DEBUG
23 #define MAC80211_PS_DEBUG 1
25 #define MAC80211_PS_DEBUG 0
28 #ifdef CONFIG_MAC80211_HT_DEBUG
29 #define MAC80211_HT_DEBUG 1
31 #define MAC80211_HT_DEBUG 0
34 #ifdef CONFIG_MAC80211_MPL_DEBUG
35 #define MAC80211_MPL_DEBUG 1
37 #define MAC80211_MPL_DEBUG 0
40 #ifdef CONFIG_MAC80211_MPATH_DEBUG
41 #define MAC80211_MPATH_DEBUG 1
43 #define MAC80211_MPATH_DEBUG 0
46 #ifdef CONFIG_MAC80211_MHWMP_DEBUG
47 #define MAC80211_MHWMP_DEBUG 1
49 #define MAC80211_MHWMP_DEBUG 0
52 #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
53 #define MAC80211_MESH_SYNC_DEBUG 1
55 #define MAC80211_MESH_SYNC_DEBUG 0
58 #ifdef CONFIG_MAC80211_MESH_CSA_DEBUG
59 #define MAC80211_MESH_CSA_DEBUG 1
61 #define MAC80211_MESH_CSA_DEBUG 0
64 #ifdef CONFIG_MAC80211_MESH_PS_DEBUG
65 #define MAC80211_MESH_PS_DEBUG 1
67 #define MAC80211_MESH_PS_DEBUG 0
70 #ifdef CONFIG_MAC80211_TDLS_DEBUG
71 #define MAC80211_TDLS_DEBUG 1
73 #define MAC80211_TDLS_DEBUG 0
76 #ifdef CONFIG_MAC80211_STA_DEBUG
77 #define MAC80211_STA_DEBUG 1
79 #define MAC80211_STA_DEBUG 0
82 #ifdef CONFIG_MAC80211_MLME_DEBUG
83 #define MAC80211_MLME_DEBUG 1
85 #define MAC80211_MLME_DEBUG 0
88 #ifdef CONFIG_MAC80211_MESSAGE_TRACING
89 void __sdata_info(const char *fmt, ...) __printf(1, 2);
90 void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3);
91 void __sdata_err(const char *fmt, ...) __printf(1, 2);
92 void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
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__)
104 #define _sdata_info(sdata, fmt, ...) \
106 pr_info("%s: " fmt, \
107 (sdata)->name, ##__VA_ARGS__); \
110 #define _sdata_dbg(print, sdata, fmt, ...) \
113 pr_debug("%s: " fmt, \
114 (sdata)->name, ##__VA_ARGS__); \
117 #define _sdata_err(sdata, fmt, ...) \
120 (sdata)->name, ##__VA_ARGS__); \
123 #define _wiphy_dbg(print, wiphy, fmt, ...) \
126 wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \
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__)
137 #define link_info(link, fmt, ...) \
139 if (ieee80211_vif_is_mld(&(link)->sdata->vif)) \
140 _sdata_info((link)->sdata, "[link %d] " fmt, \
144 _sdata_info((link)->sdata, fmt, ##__VA_ARGS__); \
146 #define link_err(link, fmt, ...) \
148 if (ieee80211_vif_is_mld(&(link)->sdata->vif)) \
149 _sdata_err((link)->sdata, "[link %d] " fmt, \
153 _sdata_err((link)->sdata, fmt, ##__VA_ARGS__); \
155 #define link_dbg(link, fmt, ...) \
157 if (ieee80211_vif_is_mld(&(link)->sdata->vif)) \
158 _sdata_dbg(1, (link)->sdata, "[link %d] " fmt, \
162 _sdata_dbg(1, (link)->sdata, fmt, \
166 #define ht_dbg(sdata, fmt, ...) \
167 _sdata_dbg(MAC80211_HT_DEBUG, \
168 sdata, fmt, ##__VA_ARGS__)
170 #define ht_dbg_ratelimited(sdata, fmt, ...) \
171 _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \
172 sdata, fmt, ##__VA_ARGS__)
174 #define ocb_dbg(sdata, fmt, ...) \
175 _sdata_dbg(MAC80211_OCB_DEBUG, \
176 sdata, fmt, ##__VA_ARGS__)
178 #define ibss_dbg(sdata, fmt, ...) \
179 _sdata_dbg(MAC80211_IBSS_DEBUG, \
180 sdata, fmt, ##__VA_ARGS__)
182 #define ps_dbg(sdata, fmt, ...) \
183 _sdata_dbg(MAC80211_PS_DEBUG, \
184 sdata, fmt, ##__VA_ARGS__)
186 #define ps_dbg_hw(hw, fmt, ...) \
187 _wiphy_dbg(MAC80211_PS_DEBUG, \
188 (hw)->wiphy, fmt, ##__VA_ARGS__)
190 #define ps_dbg_ratelimited(sdata, fmt, ...) \
191 _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \
192 sdata, fmt, ##__VA_ARGS__)
194 #define mpl_dbg(sdata, fmt, ...) \
195 _sdata_dbg(MAC80211_MPL_DEBUG, \
196 sdata, fmt, ##__VA_ARGS__)
198 #define mpath_dbg(sdata, fmt, ...) \
199 _sdata_dbg(MAC80211_MPATH_DEBUG, \
200 sdata, fmt, ##__VA_ARGS__)
202 #define mhwmp_dbg(sdata, fmt, ...) \
203 _sdata_dbg(MAC80211_MHWMP_DEBUG, \
204 sdata, fmt, ##__VA_ARGS__)
206 #define msync_dbg(sdata, fmt, ...) \
207 _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \
208 sdata, fmt, ##__VA_ARGS__)
210 #define mcsa_dbg(sdata, fmt, ...) \
211 _sdata_dbg(MAC80211_MESH_CSA_DEBUG, \
212 sdata, fmt, ##__VA_ARGS__)
214 #define mps_dbg(sdata, fmt, ...) \
215 _sdata_dbg(MAC80211_MESH_PS_DEBUG, \
216 sdata, fmt, ##__VA_ARGS__)
218 #define tdls_dbg(sdata, fmt, ...) \
219 _sdata_dbg(MAC80211_TDLS_DEBUG, \
220 sdata, fmt, ##__VA_ARGS__)
222 #define sta_dbg(sdata, fmt, ...) \
223 _sdata_dbg(MAC80211_STA_DEBUG, \
224 sdata, fmt, ##__VA_ARGS__)
226 #define mlme_dbg(sdata, fmt, ...) \
227 _sdata_dbg(MAC80211_MLME_DEBUG, \
228 sdata, fmt, ##__VA_ARGS__)
230 #define mlme_dbg_ratelimited(sdata, fmt, ...) \
231 _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \
232 sdata, fmt, ##__VA_ARGS__)
234 #endif /* __MAC80211_DEBUG_H */