debug.h 5.0 KB

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