trace.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /* Based on net/mac80211/trace.h */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM mac802154
  4. #if !defined(__MAC802154_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
  5. #define __MAC802154_DRIVER_TRACE
  6. #include <linux/tracepoint.h>
  7. #include <net/mac802154.h>
  8. #include "ieee802154_i.h"
  9. #define MAXNAME 32
  10. #define LOCAL_ENTRY __array(char, wpan_phy_name, MAXNAME)
  11. #define LOCAL_ASSIGN strlcpy(__entry->wpan_phy_name, \
  12. wpan_phy_name(local->hw.phy), MAXNAME)
  13. #define LOCAL_PR_FMT "%s"
  14. #define LOCAL_PR_ARG __entry->wpan_phy_name
  15. #define CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
  16. __field(enum nl802154_cca_opts, cca_opt)
  17. #define CCA_ASSIGN \
  18. do { \
  19. (__entry->cca_mode) = cca->mode; \
  20. (__entry->cca_opt) = cca->opt; \
  21. } while (0)
  22. #define CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
  23. #define CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
  24. #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
  25. /* Tracing for driver callbacks */
  26. DECLARE_EVENT_CLASS(local_only_evt,
  27. TP_PROTO(struct ieee802154_local *local),
  28. TP_ARGS(local),
  29. TP_STRUCT__entry(
  30. LOCAL_ENTRY
  31. ),
  32. TP_fast_assign(
  33. LOCAL_ASSIGN;
  34. ),
  35. TP_printk(LOCAL_PR_FMT, LOCAL_PR_ARG)
  36. );
  37. DEFINE_EVENT(local_only_evt, 802154_drv_return_void,
  38. TP_PROTO(struct ieee802154_local *local),
  39. TP_ARGS(local)
  40. );
  41. TRACE_EVENT(802154_drv_return_int,
  42. TP_PROTO(struct ieee802154_local *local, int ret),
  43. TP_ARGS(local, ret),
  44. TP_STRUCT__entry(
  45. LOCAL_ENTRY
  46. __field(int, ret)
  47. ),
  48. TP_fast_assign(
  49. LOCAL_ASSIGN;
  50. __entry->ret = ret;
  51. ),
  52. TP_printk(LOCAL_PR_FMT ", returned: %d", LOCAL_PR_ARG,
  53. __entry->ret)
  54. );
  55. DEFINE_EVENT(local_only_evt, 802154_drv_start,
  56. TP_PROTO(struct ieee802154_local *local),
  57. TP_ARGS(local)
  58. );
  59. DEFINE_EVENT(local_only_evt, 802154_drv_stop,
  60. TP_PROTO(struct ieee802154_local *local),
  61. TP_ARGS(local)
  62. );
  63. TRACE_EVENT(802154_drv_set_channel,
  64. TP_PROTO(struct ieee802154_local *local, u8 page, u8 channel),
  65. TP_ARGS(local, page, channel),
  66. TP_STRUCT__entry(
  67. LOCAL_ENTRY
  68. __field(u8, page)
  69. __field(u8, channel)
  70. ),
  71. TP_fast_assign(
  72. LOCAL_ASSIGN;
  73. __entry->page = page;
  74. __entry->channel = channel;
  75. ),
  76. TP_printk(LOCAL_PR_FMT ", page: %d, channel: %d", LOCAL_PR_ARG,
  77. __entry->page, __entry->channel)
  78. );
  79. TRACE_EVENT(802154_drv_set_cca_mode,
  80. TP_PROTO(struct ieee802154_local *local,
  81. const struct wpan_phy_cca *cca),
  82. TP_ARGS(local, cca),
  83. TP_STRUCT__entry(
  84. LOCAL_ENTRY
  85. CCA_ENTRY
  86. ),
  87. TP_fast_assign(
  88. LOCAL_ASSIGN;
  89. CCA_ASSIGN;
  90. ),
  91. TP_printk(LOCAL_PR_FMT ", " CCA_PR_FMT, LOCAL_PR_ARG,
  92. CCA_PR_ARG)
  93. );
  94. TRACE_EVENT(802154_drv_set_cca_ed_level,
  95. TP_PROTO(struct ieee802154_local *local, s32 mbm),
  96. TP_ARGS(local, mbm),
  97. TP_STRUCT__entry(
  98. LOCAL_ENTRY
  99. __field(s32, mbm)
  100. ),
  101. TP_fast_assign(
  102. LOCAL_ASSIGN;
  103. __entry->mbm = mbm;
  104. ),
  105. TP_printk(LOCAL_PR_FMT ", ed level: %d", LOCAL_PR_ARG,
  106. __entry->mbm)
  107. );
  108. TRACE_EVENT(802154_drv_set_tx_power,
  109. TP_PROTO(struct ieee802154_local *local, s32 power),
  110. TP_ARGS(local, power),
  111. TP_STRUCT__entry(
  112. LOCAL_ENTRY
  113. __field(s32, power)
  114. ),
  115. TP_fast_assign(
  116. LOCAL_ASSIGN;
  117. __entry->power = power;
  118. ),
  119. TP_printk(LOCAL_PR_FMT ", mbm: %d", LOCAL_PR_ARG,
  120. __entry->power)
  121. );
  122. TRACE_EVENT(802154_drv_set_lbt_mode,
  123. TP_PROTO(struct ieee802154_local *local, bool mode),
  124. TP_ARGS(local, mode),
  125. TP_STRUCT__entry(
  126. LOCAL_ENTRY
  127. __field(bool, mode)
  128. ),
  129. TP_fast_assign(
  130. LOCAL_ASSIGN;
  131. __entry->mode = mode;
  132. ),
  133. TP_printk(LOCAL_PR_FMT ", lbt mode: %s", LOCAL_PR_ARG,
  134. BOOL_TO_STR(__entry->mode))
  135. );
  136. TRACE_EVENT(802154_drv_set_short_addr,
  137. TP_PROTO(struct ieee802154_local *local, __le16 short_addr),
  138. TP_ARGS(local, short_addr),
  139. TP_STRUCT__entry(
  140. LOCAL_ENTRY
  141. __field(__le16, short_addr)
  142. ),
  143. TP_fast_assign(
  144. LOCAL_ASSIGN;
  145. __entry->short_addr = short_addr;
  146. ),
  147. TP_printk(LOCAL_PR_FMT ", short addr: 0x%04x", LOCAL_PR_ARG,
  148. le16_to_cpu(__entry->short_addr))
  149. );
  150. TRACE_EVENT(802154_drv_set_pan_id,
  151. TP_PROTO(struct ieee802154_local *local, __le16 pan_id),
  152. TP_ARGS(local, pan_id),
  153. TP_STRUCT__entry(
  154. LOCAL_ENTRY
  155. __field(__le16, pan_id)
  156. ),
  157. TP_fast_assign(
  158. LOCAL_ASSIGN;
  159. __entry->pan_id = pan_id;
  160. ),
  161. TP_printk(LOCAL_PR_FMT ", pan id: 0x%04x", LOCAL_PR_ARG,
  162. le16_to_cpu(__entry->pan_id))
  163. );
  164. TRACE_EVENT(802154_drv_set_extended_addr,
  165. TP_PROTO(struct ieee802154_local *local, __le64 extended_addr),
  166. TP_ARGS(local, extended_addr),
  167. TP_STRUCT__entry(
  168. LOCAL_ENTRY
  169. __field(__le64, extended_addr)
  170. ),
  171. TP_fast_assign(
  172. LOCAL_ASSIGN;
  173. __entry->extended_addr = extended_addr;
  174. ),
  175. TP_printk(LOCAL_PR_FMT ", extended addr: 0x%llx", LOCAL_PR_ARG,
  176. le64_to_cpu(__entry->extended_addr))
  177. );
  178. TRACE_EVENT(802154_drv_set_pan_coord,
  179. TP_PROTO(struct ieee802154_local *local, bool is_coord),
  180. TP_ARGS(local, is_coord),
  181. TP_STRUCT__entry(
  182. LOCAL_ENTRY
  183. __field(bool, is_coord)
  184. ),
  185. TP_fast_assign(
  186. LOCAL_ASSIGN;
  187. __entry->is_coord = is_coord;
  188. ),
  189. TP_printk(LOCAL_PR_FMT ", is_coord: %s", LOCAL_PR_ARG,
  190. BOOL_TO_STR(__entry->is_coord))
  191. );
  192. TRACE_EVENT(802154_drv_set_csma_params,
  193. TP_PROTO(struct ieee802154_local *local, u8 min_be, u8 max_be,
  194. u8 max_csma_backoffs),
  195. TP_ARGS(local, min_be, max_be, max_csma_backoffs),
  196. TP_STRUCT__entry(
  197. LOCAL_ENTRY
  198. __field(u8, min_be)
  199. __field(u8, max_be)
  200. __field(u8, max_csma_backoffs)
  201. ),
  202. TP_fast_assign(
  203. LOCAL_ASSIGN,
  204. __entry->min_be = min_be;
  205. __entry->max_be = max_be;
  206. __entry->max_csma_backoffs = max_csma_backoffs;
  207. ),
  208. TP_printk(LOCAL_PR_FMT ", min be: %d, max be: %d, max csma backoffs: %d",
  209. LOCAL_PR_ARG, __entry->min_be, __entry->max_be,
  210. __entry->max_csma_backoffs)
  211. );
  212. TRACE_EVENT(802154_drv_set_max_frame_retries,
  213. TP_PROTO(struct ieee802154_local *local, s8 max_frame_retries),
  214. TP_ARGS(local, max_frame_retries),
  215. TP_STRUCT__entry(
  216. LOCAL_ENTRY
  217. __field(s8, max_frame_retries)
  218. ),
  219. TP_fast_assign(
  220. LOCAL_ASSIGN;
  221. __entry->max_frame_retries = max_frame_retries;
  222. ),
  223. TP_printk(LOCAL_PR_FMT ", max frame retries: %d", LOCAL_PR_ARG,
  224. __entry->max_frame_retries)
  225. );
  226. TRACE_EVENT(802154_drv_set_promiscuous_mode,
  227. TP_PROTO(struct ieee802154_local *local, bool on),
  228. TP_ARGS(local, on),
  229. TP_STRUCT__entry(
  230. LOCAL_ENTRY
  231. __field(bool, on)
  232. ),
  233. TP_fast_assign(
  234. LOCAL_ASSIGN;
  235. __entry->on = on;
  236. ),
  237. TP_printk(LOCAL_PR_FMT ", promiscuous mode: %s", LOCAL_PR_ARG,
  238. BOOL_TO_STR(__entry->on))
  239. );
  240. #endif /* !__MAC802154_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
  241. #undef TRACE_INCLUDE_PATH
  242. #define TRACE_INCLUDE_PATH .
  243. #undef TRACE_INCLUDE_FILE
  244. #define TRACE_INCLUDE_FILE trace
  245. #include <trace/define_trace.h>