diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-06-22 05:29:50 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-06-24 05:32:29 -0400 |
commit | bdcbd8e0e3ffdad32b14b6373e67bfcf5fd3f002 (patch) | |
tree | b636f2229570dc95edef997272bd0656cf19224d /net/mac80211/debug.h | |
parent | d3b2fb53c7f82903880769d406c11c7e619b11a4 (diff) |
mac80211: clean up debugging
There are a few things that make the logging and
debugging in mac80211 less useful than it should
be right now:
* a lot of messages should be pr_info, not pr_debug
* wholesale use of pr_debug makes it require *both*
Kconfig and dynamic configuration
* there are still a lot of ifdefs
* the style is very inconsistent, sometimes the
sdata->name is printed in front
Clean up everything, introducing new macros and
separating out the station MLME debugging into
a new Kconfig symbol.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/debug.h')
-rw-r--r-- | net/mac80211/debug.h | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/net/mac80211/debug.h b/net/mac80211/debug.h new file mode 100644 index 000000000000..6e6bbb9a9d41 --- /dev/null +++ b/net/mac80211/debug.h | |||
@@ -0,0 +1,152 @@ | |||
1 | #ifndef __MAC80211_DEBUG_H | ||
2 | #define __MAC80211_DEBUG_H | ||
3 | |||
4 | #ifdef CONFIG_MAC80211_IBSS_DEBUG | ||
5 | #define MAC80211_IBSS_DEBUG 1 | ||
6 | #else | ||
7 | #define MAC80211_IBSS_DEBUG 0 | ||
8 | #endif | ||
9 | |||
10 | #ifdef CONFIG_MAC80211_PS_DEBUG | ||
11 | #define MAC80211_PS_DEBUG 1 | ||
12 | #else | ||
13 | #define MAC80211_PS_DEBUG 0 | ||
14 | #endif | ||
15 | |||
16 | #ifdef CONFIG_MAC80211_HT_DEBUG | ||
17 | #define MAC80211_HT_DEBUG 1 | ||
18 | #else | ||
19 | #define MAC80211_HT_DEBUG 0 | ||
20 | #endif | ||
21 | |||
22 | #ifdef CONFIG_MAC80211_MPL_DEBUG | ||
23 | #define MAC80211_MPL_DEBUG 1 | ||
24 | #else | ||
25 | #define MAC80211_MPL_DEBUG 0 | ||
26 | #endif | ||
27 | |||
28 | #ifdef CONFIG_MAC80211_MPATH_DEBUG | ||
29 | #define MAC80211_MPATH_DEBUG 1 | ||
30 | #else | ||
31 | #define MAC80211_MPATH_DEBUG 0 | ||
32 | #endif | ||
33 | |||
34 | #ifdef CONFIG_MAC80211_MHWMP_DEBUG | ||
35 | #define MAC80211_MHWMP_DEBUG 1 | ||
36 | #else | ||
37 | #define MAC80211_MHWMP_DEBUG 0 | ||
38 | #endif | ||
39 | |||
40 | #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG | ||
41 | #define MAC80211_MESH_SYNC_DEBUG 1 | ||
42 | #else | ||
43 | #define MAC80211_MESH_SYNC_DEBUG 0 | ||
44 | #endif | ||
45 | |||
46 | #ifdef CONFIG_MAC80211_TDLS_DEBUG | ||
47 | #define MAC80211_TDLS_DEBUG 1 | ||
48 | #else | ||
49 | #define MAC80211_TDLS_DEBUG 0 | ||
50 | #endif | ||
51 | |||
52 | #ifdef CONFIG_MAC80211_STA_DEBUG | ||
53 | #define MAC80211_STA_DEBUG 1 | ||
54 | #else | ||
55 | #define MAC80211_STA_DEBUG 0 | ||
56 | #endif | ||
57 | |||
58 | #ifdef CONFIG_MAC80211_MLME_DEBUG | ||
59 | #define MAC80211_MLME_DEBUG 1 | ||
60 | #else | ||
61 | #define MAC80211_MLME_DEBUG 0 | ||
62 | #endif | ||
63 | |||
64 | #define _sdata_info(sdata, fmt, ...) \ | ||
65 | do { \ | ||
66 | pr_info("%s: " fmt, \ | ||
67 | (sdata)->name, ##__VA_ARGS__); \ | ||
68 | } while (0) | ||
69 | |||
70 | #define _sdata_dbg(print, sdata, fmt, ...) \ | ||
71 | do { \ | ||
72 | if (print) \ | ||
73 | pr_debug("%s: " fmt, \ | ||
74 | (sdata)->name, ##__VA_ARGS__); \ | ||
75 | } while (0) | ||
76 | |||
77 | #define _sdata_err(sdata, fmt, ...) \ | ||
78 | do { \ | ||
79 | pr_err("%s: " fmt, \ | ||
80 | (sdata)->name, ##__VA_ARGS__); \ | ||
81 | } while (0) | ||
82 | |||
83 | #define _wiphy_dbg(print, wiphy, fmt, ...) \ | ||
84 | do { \ | ||
85 | if (print) \ | ||
86 | wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \ | ||
87 | } while (0) | ||
88 | |||
89 | #define sdata_info(sdata, fmt, ...) \ | ||
90 | _sdata_info(sdata, fmt, ##__VA_ARGS__) | ||
91 | #define sdata_err(sdata, fmt, ...) \ | ||
92 | _sdata_err(sdata, fmt, ##__VA_ARGS__) | ||
93 | #define sdata_dbg(sdata, fmt, ...) \ | ||
94 | _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__) | ||
95 | |||
96 | #define ht_dbg(sdata, fmt, ...) \ | ||
97 | _sdata_dbg(MAC80211_HT_DEBUG, \ | ||
98 | sdata, fmt, ##__VA_ARGS__) | ||
99 | |||
100 | #define ht_dbg_ratelimited(sdata, fmt, ...) \ | ||
101 | _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \ | ||
102 | sdata, fmt, ##__VA_ARGS__) | ||
103 | |||
104 | #define ibss_dbg(sdata, fmt, ...) \ | ||
105 | _sdata_dbg(MAC80211_IBSS_DEBUG, \ | ||
106 | sdata, fmt, ##__VA_ARGS__) | ||
107 | |||
108 | #define ps_dbg(sdata, fmt, ...) \ | ||
109 | _sdata_dbg(MAC80211_PS_DEBUG, \ | ||
110 | sdata, fmt, ##__VA_ARGS__) | ||
111 | |||
112 | #define ps_dbg_hw(hw, fmt, ...) \ | ||
113 | _wiphy_dbg(MAC80211_PS_DEBUG, \ | ||
114 | (hw)->wiphy, fmt, ##__VA_ARGS__) | ||
115 | |||
116 | #define ps_dbg_ratelimited(sdata, fmt, ...) \ | ||
117 | _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \ | ||
118 | sdata, fmt, ##__VA_ARGS__) | ||
119 | |||
120 | #define mpl_dbg(sdata, fmt, ...) \ | ||
121 | _sdata_dbg(MAC80211_MPL_DEBUG, \ | ||
122 | sdata, fmt, ##__VA_ARGS__) | ||
123 | |||
124 | #define mpath_dbg(sdata, fmt, ...) \ | ||
125 | _sdata_dbg(MAC80211_MPATH_DEBUG, \ | ||
126 | sdata, fmt, ##__VA_ARGS__) | ||
127 | |||
128 | #define mhwmp_dbg(sdata, fmt, ...) \ | ||
129 | _sdata_dbg(MAC80211_MHWMP_DEBUG, \ | ||
130 | sdata, fmt, ##__VA_ARGS__) | ||
131 | |||
132 | #define msync_dbg(sdata, fmt, ...) \ | ||
133 | _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \ | ||
134 | sdata, fmt, ##__VA_ARGS__) | ||
135 | |||
136 | #define tdls_dbg(sdata, fmt, ...) \ | ||
137 | _sdata_dbg(MAC80211_TDLS_DEBUG, \ | ||
138 | sdata, fmt, ##__VA_ARGS__) | ||
139 | |||
140 | #define sta_dbg(sdata, fmt, ...) \ | ||
141 | _sdata_dbg(MAC80211_STA_DEBUG, \ | ||
142 | sdata, fmt, ##__VA_ARGS__) | ||
143 | |||
144 | #define mlme_dbg(sdata, fmt, ...) \ | ||
145 | _sdata_dbg(MAC80211_MLME_DEBUG, \ | ||
146 | sdata, fmt, ##__VA_ARGS__) | ||
147 | |||
148 | #define mlme_dbg_ratelimited(sdata, fmt, ...) \ | ||
149 | _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \ | ||
150 | sdata, fmt, ##__VA_ARGS__) | ||
151 | |||
152 | #endif /* __MAC80211_DEBUG_H */ | ||