debug.h 4.5 KB

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