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