debug.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. #ifndef __MAC80211_DEBUG_H
  2. #define __MAC80211_DEBUG_H
  3. #include <net/cfg80211.h>
  4. #ifdef CONFIG_MAC80211_OCB_DEBUG
  5. #define MAC80211_OCB_DEBUG 1
  6. #else
  7. #define MAC80211_OCB_DEBUG 0
  8. #endif
  9. #ifdef CONFIG_MAC80211_IBSS_DEBUG
  10. #define MAC80211_IBSS_DEBUG 1
  11. #else
  12. #define MAC80211_IBSS_DEBUG 0
  13. #endif
  14. #ifdef CONFIG_MAC80211_PS_DEBUG
  15. #define MAC80211_PS_DEBUG 1
  16. #else
  17. #define MAC80211_PS_DEBUG 0
  18. #endif
  19. #ifdef CONFIG_MAC80211_HT_DEBUG
  20. #define MAC80211_HT_DEBUG 1
  21. #else
  22. #define MAC80211_HT_DEBUG 0
  23. #endif
  24. #ifdef CONFIG_MAC80211_MPL_DEBUG
  25. #define MAC80211_MPL_DEBUG 1
  26. #else
  27. #define MAC80211_MPL_DEBUG 0
  28. #endif
  29. #ifdef CONFIG_MAC80211_MPATH_DEBUG
  30. #define MAC80211_MPATH_DEBUG 1
  31. #else
  32. #define MAC80211_MPATH_DEBUG 0
  33. #endif
  34. #ifdef CONFIG_MAC80211_MHWMP_DEBUG
  35. #define MAC80211_MHWMP_DEBUG 1
  36. #else
  37. #define MAC80211_MHWMP_DEBUG 0
  38. #endif
  39. #ifdef CONFIG_MAC80211_MESH_SYNC_DEBUG
  40. #define MAC80211_MESH_SYNC_DEBUG 1
  41. #else
  42. #define MAC80211_MESH_SYNC_DEBUG 0
  43. #endif
  44. #ifdef CONFIG_MAC80211_MESH_CSA_DEBUG
  45. #define MAC80211_MESH_CSA_DEBUG 1
  46. #else
  47. #define MAC80211_MESH_CSA_DEBUG 0
  48. #endif
  49. #ifdef CONFIG_MAC80211_MESH_PS_DEBUG
  50. #define MAC80211_MESH_PS_DEBUG 1
  51. #else
  52. #define MAC80211_MESH_PS_DEBUG 0
  53. #endif
  54. #ifdef CONFIG_MAC80211_TDLS_DEBUG
  55. #define MAC80211_TDLS_DEBUG 1
  56. #else
  57. #define MAC80211_TDLS_DEBUG 0
  58. #endif
  59. #ifdef CONFIG_MAC80211_STA_DEBUG
  60. #define MAC80211_STA_DEBUG 1
  61. #else
  62. #define MAC80211_STA_DEBUG 0
  63. #endif
  64. #ifdef CONFIG_MAC80211_MLME_DEBUG
  65. #define MAC80211_MLME_DEBUG 1
  66. #else
  67. #define MAC80211_MLME_DEBUG 0
  68. #endif
  69. #ifdef CONFIG_MAC80211_MESSAGE_TRACING
  70. void __sdata_info(const char *fmt, ...) __printf(1, 2);
  71. void __sdata_dbg(bool print, const char *fmt, ...) __printf(2, 3);
  72. void __sdata_err(const char *fmt, ...) __printf(1, 2);
  73. void __wiphy_dbg(struct wiphy *wiphy, bool print, const char *fmt, ...)
  74. __printf(3, 4);
  75. #define _sdata_info(sdata, fmt, ...) \
  76. __sdata_info("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
  77. #define _sdata_dbg(print, sdata, fmt, ...) \
  78. __sdata_dbg(print, "%s: " fmt, (sdata)->name, ##__VA_ARGS__)
  79. #define _sdata_err(sdata, fmt, ...) \
  80. __sdata_err("%s: " fmt, (sdata)->name, ##__VA_ARGS__)
  81. #define _wiphy_dbg(print, wiphy, fmt, ...) \
  82. __wiphy_dbg(wiphy, print, fmt, ##__VA_ARGS__)
  83. #else
  84. #define _sdata_info(sdata, fmt, ...) \
  85. do { \
  86. pr_info("%s: " fmt, \
  87. (sdata)->name, ##__VA_ARGS__); \
  88. } while (0)
  89. #define _sdata_dbg(print, sdata, fmt, ...) \
  90. do { \
  91. if (print) \
  92. pr_debug("%s: " fmt, \
  93. (sdata)->name, ##__VA_ARGS__); \
  94. } while (0)
  95. #define _sdata_err(sdata, fmt, ...) \
  96. do { \
  97. pr_err("%s: " fmt, \
  98. (sdata)->name, ##__VA_ARGS__); \
  99. } while (0)
  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. #define sdata_info(sdata, fmt, ...) \
  107. _sdata_info(sdata, fmt, ##__VA_ARGS__)
  108. #define sdata_err(sdata, fmt, ...) \
  109. _sdata_err(sdata, fmt, ##__VA_ARGS__)
  110. #define sdata_dbg(sdata, fmt, ...) \
  111. _sdata_dbg(1, sdata, fmt, ##__VA_ARGS__)
  112. #define ht_dbg(sdata, fmt, ...) \
  113. _sdata_dbg(MAC80211_HT_DEBUG, \
  114. sdata, fmt, ##__VA_ARGS__)
  115. #define ht_dbg_ratelimited(sdata, fmt, ...) \
  116. _sdata_dbg(MAC80211_HT_DEBUG && net_ratelimit(), \
  117. sdata, fmt, ##__VA_ARGS__)
  118. #define ocb_dbg(sdata, fmt, ...) \
  119. _sdata_dbg(MAC80211_OCB_DEBUG, \
  120. sdata, fmt, ##__VA_ARGS__)
  121. #define ibss_dbg(sdata, fmt, ...) \
  122. _sdata_dbg(MAC80211_IBSS_DEBUG, \
  123. sdata, fmt, ##__VA_ARGS__)
  124. #define ps_dbg(sdata, fmt, ...) \
  125. _sdata_dbg(MAC80211_PS_DEBUG, \
  126. sdata, fmt, ##__VA_ARGS__)
  127. #define ps_dbg_hw(hw, fmt, ...) \
  128. _wiphy_dbg(MAC80211_PS_DEBUG, \
  129. (hw)->wiphy, fmt, ##__VA_ARGS__)
  130. #define ps_dbg_ratelimited(sdata, fmt, ...) \
  131. _sdata_dbg(MAC80211_PS_DEBUG && net_ratelimit(), \
  132. sdata, fmt, ##__VA_ARGS__)
  133. #define mpl_dbg(sdata, fmt, ...) \
  134. _sdata_dbg(MAC80211_MPL_DEBUG, \
  135. sdata, fmt, ##__VA_ARGS__)
  136. #define mpath_dbg(sdata, fmt, ...) \
  137. _sdata_dbg(MAC80211_MPATH_DEBUG, \
  138. sdata, fmt, ##__VA_ARGS__)
  139. #define mhwmp_dbg(sdata, fmt, ...) \
  140. _sdata_dbg(MAC80211_MHWMP_DEBUG, \
  141. sdata, fmt, ##__VA_ARGS__)
  142. #define msync_dbg(sdata, fmt, ...) \
  143. _sdata_dbg(MAC80211_MESH_SYNC_DEBUG, \
  144. sdata, fmt, ##__VA_ARGS__)
  145. #define mcsa_dbg(sdata, fmt, ...) \
  146. _sdata_dbg(MAC80211_MESH_CSA_DEBUG, \
  147. sdata, fmt, ##__VA_ARGS__)
  148. #define mps_dbg(sdata, fmt, ...) \
  149. _sdata_dbg(MAC80211_MESH_PS_DEBUG, \
  150. sdata, fmt, ##__VA_ARGS__)
  151. #define tdls_dbg(sdata, fmt, ...) \
  152. _sdata_dbg(MAC80211_TDLS_DEBUG, \
  153. sdata, fmt, ##__VA_ARGS__)
  154. #define sta_dbg(sdata, fmt, ...) \
  155. _sdata_dbg(MAC80211_STA_DEBUG, \
  156. sdata, fmt, ##__VA_ARGS__)
  157. #define mlme_dbg(sdata, fmt, ...) \
  158. _sdata_dbg(MAC80211_MLME_DEBUG, \
  159. sdata, fmt, ##__VA_ARGS__)
  160. #define mlme_dbg_ratelimited(sdata, fmt, ...) \
  161. _sdata_dbg(MAC80211_MLME_DEBUG && net_ratelimit(), \
  162. sdata, fmt, ##__VA_ARGS__)
  163. #endif /* __MAC80211_DEBUG_H */