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_TDLS_DEBUG 48 #define MAC80211_TDLS_DEBUG 1 49 #else 50 #define MAC80211_TDLS_DEBUG 0 51 #endif 52 53 #ifdef CONFIG_MAC80211_STA_DEBUG 54 #define MAC80211_STA_DEBUG 1 55 #else 56 #define MAC80211_STA_DEBUG 0 57 #endif 58 59 #ifdef CONFIG_MAC80211_MLME_DEBUG 60 #define MAC80211_MLME_DEBUG 1 61 #else 62 #define MAC80211_MLME_DEBUG 0 63 #endif 64 65 #ifdef CONFIG_MAC80211_MESSAGE_TRACING 66 void __sdata_info(const char *fmt, ...) __printf(1, 2); 67 void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3); 68 void __sdata_err(const char *fmt, ...) __printf(1, 2); 69 void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...) 70 __printf(3, 4); 71 72 #define _sdata_info(sdata, fmt, ...) \ 73 __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__) 74 #define _sdata_dbg(print, sdata, fmt, ...) \ 75 __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__) 76 #define _sdata_err(sdata, fmt, ...) \ 77 __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__) 78 #define _wiphy_dbg(print, wiphy, fmt, ...) \ 79 __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__) 80 #else 81 #define _sdata_info(sdata, fmt, ...) \ 82 do { \ 83 pr_info("%s: " fmt, \ 84 (sdata)->name, ##__VA_ARGS__); \ 85 } while (0) 86 87 #define _sdata_dbg(print, sdata, fmt, ...) \ 88 do { \ 89 if (print) \ 90 pr_debug("%s: " fmt, \ 91 (sdata)->name, ##__VA_ARGS__); \ 92 } while (0) 93 94 #define _sdata_err(sdata, fmt, ...) \ 95 do { \ 96 pr_err("%s: " fmt, \ 97 (sdata)->name, ##__VA_ARGS__); \ 98 } while (0) 99 100 #define _wiphy_dbg(print, wiphy, fmt, ...) \ 101 do { \ 102 if (print) \ 103 wiphy_dbg((wiphy), fmt, ##__VA_ARGS__); \ 104 } while (0) 105 #endif 106 107 #define sdata_info(sdata, fmt, ...) \ 108 _sdata_info(sdata, fmt, ##__VA_ARGS__) 109 #define sdata_err(sdata, fmt, ...) \ 110 _sdata_err(sdata, fmt, ##__VA_ARGS__) 111 #define sdata_dbg(sdata, fmt, ...) \ 112 _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__) 113 114 #define ht_dbg(sdata, fmt, ...) \ 115 _sdata_dbg(MAC80211_HT_DEBUG, \ 116 sdata, fmt, ##__VA_ARGS__) 117 118 #define ht_dbg_ratelimited(sdata, fmt, ...) \ 119 _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \ 120 sdata, fmt, ##__VA_ARGS__) 121 122 #define ibss_dbg(sdata, fmt, ...) \ 123 _sdata_dbg(MAC80211_IBSS_DEBUG, \ 124 sdata, fmt, ##__VA_ARGS__) 125 126 #define ps_dbg(sdata, fmt, ...) \ 127 _sdata_dbg(MAC80211_PS_DEBUG, \ 128 sdata, fmt, ##__VA_ARGS__) 129 130 #define ps_dbg_hw(hw, fmt, ...) \ 131 _wiphy_dbg(MAC80211_PS_DEBUG, \ 132 (hw)->wiphy, fmt, ##__VA_ARGS__) 133 134 #define ps_dbg_ratelimited(sdata, fmt, ...) \ 135 _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \ 136 sdata, fmt, ##__VA_ARGS__) 137 138 #define mpl_dbg(sdata, fmt, ...) \ 139 _sdata_dbg(MAC80211_MPL_DEBUG, \ 140 sdata, fmt, ##__VA_ARGS__) 141 142 #define mpath_dbg(sdata, fmt, ...) \ 143 _sdata_dbg(MAC80211_MPATH_DEBUG, \ 144 sdata, fmt, ##__VA_ARGS__) 145 146 #define mhwmp_dbg(sdata, fmt, ...) \ 147 _sdata_dbg(MAC80211_MHWMP_DEBUG, \ 148 sdata, fmt, ##__VA_ARGS__) 149 150 #define msync_dbg(sdata, fmt, ...) \ 151 _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \ 152 sdata, fmt, ##__VA_ARGS__) 153 154 #define tdls_dbg(sdata, fmt, ...) \ 155 _sdata_dbg(MAC80211_TDLS_DEBUG, \ 156 sdata, fmt, ##__VA_ARGS__) 157 158 #define sta_dbg(sdata, fmt, ...) \ 159 _sdata_dbg(MAC80211_STA_DEBUG, \ 160 sdata, fmt, ##__VA_ARGS__) 161 162 #define mlme_dbg(sdata, fmt, ...) \ 163 _sdata_dbg(MAC80211_MLME_DEBUG, \ 164 sdata, fmt, ##__VA_ARGS__) 165 166 #define mlme_dbg_ratelimited(sdata, fmt, ...) \ 167 _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \ 168 sdata, fmt, ##__VA_ARGS__) 169 170 #endif /* __MAC80211_DEBUG_H */ 171