trace.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. /* Based on net/wireless/trace.h */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM cfg802154
  4. #if !defined(__RDEV_CFG802154_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
  5. #define __RDEV_CFG802154_OPS_TRACE
  6. #include <linux/tracepoint.h>
  7. #include <net/cfg802154.h>
  8. #define MAXNAME 32
  9. #define WPAN_PHY_ENTRY __array(char, wpan_phy_name, MAXNAME)
  10. #define WPAN_PHY_ASSIGN strlcpy(__entry->wpan_phy_name, \
  11. wpan_phy_name(wpan_phy), \
  12. MAXNAME)
  13. #define WPAN_PHY_PR_FMT "%s"
  14. #define WPAN_PHY_PR_ARG __entry->wpan_phy_name
  15. #define WPAN_DEV_ENTRY __field(u32, identifier)
  16. #define WPAN_DEV_ASSIGN (__entry->identifier) = (!IS_ERR_OR_NULL(wpan_dev) \
  17. ? wpan_dev->identifier : 0)
  18. #define WPAN_DEV_PR_FMT "wpan_dev(%u)"
  19. #define WPAN_DEV_PR_ARG (__entry->identifier)
  20. #define WPAN_CCA_ENTRY __field(enum nl802154_cca_modes, cca_mode) \
  21. __field(enum nl802154_cca_opts, cca_opt)
  22. #define WPAN_CCA_ASSIGN \
  23. do { \
  24. (__entry->cca_mode) = cca->mode; \
  25. (__entry->cca_opt) = cca->opt; \
  26. } while (0)
  27. #define WPAN_CCA_PR_FMT "cca_mode: %d, cca_opt: %d"
  28. #define WPAN_CCA_PR_ARG __entry->cca_mode, __entry->cca_opt
  29. #define BOOL_TO_STR(bo) (bo) ? "true" : "false"
  30. /*************************************************************
  31. * rdev->ops traces *
  32. *************************************************************/
  33. DECLARE_EVENT_CLASS(wpan_phy_only_evt,
  34. TP_PROTO(struct wpan_phy *wpan_phy),
  35. TP_ARGS(wpan_phy),
  36. TP_STRUCT__entry(
  37. WPAN_PHY_ENTRY
  38. ),
  39. TP_fast_assign(
  40. WPAN_PHY_ASSIGN;
  41. ),
  42. TP_printk(WPAN_PHY_PR_FMT, WPAN_PHY_PR_ARG)
  43. );
  44. DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_suspend,
  45. TP_PROTO(struct wpan_phy *wpan_phy),
  46. TP_ARGS(wpan_phy)
  47. );
  48. DEFINE_EVENT(wpan_phy_only_evt, 802154_rdev_resume,
  49. TP_PROTO(struct wpan_phy *wpan_phy),
  50. TP_ARGS(wpan_phy)
  51. );
  52. TRACE_EVENT(802154_rdev_add_virtual_intf,
  53. TP_PROTO(struct wpan_phy *wpan_phy, char *name,
  54. enum nl802154_iftype type, __le64 extended_addr),
  55. TP_ARGS(wpan_phy, name, type, extended_addr),
  56. TP_STRUCT__entry(
  57. WPAN_PHY_ENTRY
  58. __string(vir_intf_name, name ? name : "<noname>")
  59. __field(enum nl802154_iftype, type)
  60. __field(__le64, extended_addr)
  61. ),
  62. TP_fast_assign(
  63. WPAN_PHY_ASSIGN;
  64. __assign_str(vir_intf_name, name ? name : "<noname>");
  65. __entry->type = type;
  66. __entry->extended_addr = extended_addr;
  67. ),
  68. TP_printk(WPAN_PHY_PR_FMT ", virtual intf name: %s, type: %d, extended addr: 0x%llx",
  69. WPAN_PHY_PR_ARG, __get_str(vir_intf_name), __entry->type,
  70. __le64_to_cpu(__entry->extended_addr))
  71. );
  72. TRACE_EVENT(802154_rdev_del_virtual_intf,
  73. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev),
  74. TP_ARGS(wpan_phy, wpan_dev),
  75. TP_STRUCT__entry(
  76. WPAN_PHY_ENTRY
  77. WPAN_DEV_ENTRY
  78. ),
  79. TP_fast_assign(
  80. WPAN_PHY_ASSIGN;
  81. WPAN_DEV_ASSIGN;
  82. ),
  83. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT, WPAN_PHY_PR_ARG,
  84. WPAN_DEV_PR_ARG)
  85. );
  86. TRACE_EVENT(802154_rdev_set_channel,
  87. TP_PROTO(struct wpan_phy *wpan_phy, u8 page, u8 channel),
  88. TP_ARGS(wpan_phy, page, channel),
  89. TP_STRUCT__entry(
  90. WPAN_PHY_ENTRY
  91. __field(u8, page)
  92. __field(u8, channel)
  93. ),
  94. TP_fast_assign(
  95. WPAN_PHY_ASSIGN;
  96. __entry->page = page;
  97. __entry->channel = channel;
  98. ),
  99. TP_printk(WPAN_PHY_PR_FMT ", page: %d, channel: %d", WPAN_PHY_PR_ARG,
  100. __entry->page, __entry->channel)
  101. );
  102. TRACE_EVENT(802154_rdev_set_tx_power,
  103. TP_PROTO(struct wpan_phy *wpan_phy, s32 power),
  104. TP_ARGS(wpan_phy, power),
  105. TP_STRUCT__entry(
  106. WPAN_PHY_ENTRY
  107. __field(s32, power)
  108. ),
  109. TP_fast_assign(
  110. WPAN_PHY_ASSIGN;
  111. __entry->power = power;
  112. ),
  113. TP_printk(WPAN_PHY_PR_FMT ", mbm: %d", WPAN_PHY_PR_ARG,
  114. __entry->power)
  115. );
  116. TRACE_EVENT(802154_rdev_set_cca_mode,
  117. TP_PROTO(struct wpan_phy *wpan_phy, const struct wpan_phy_cca *cca),
  118. TP_ARGS(wpan_phy, cca),
  119. TP_STRUCT__entry(
  120. WPAN_PHY_ENTRY
  121. WPAN_CCA_ENTRY
  122. ),
  123. TP_fast_assign(
  124. WPAN_PHY_ASSIGN;
  125. WPAN_CCA_ASSIGN;
  126. ),
  127. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_CCA_PR_FMT, WPAN_PHY_PR_ARG,
  128. WPAN_CCA_PR_ARG)
  129. );
  130. TRACE_EVENT(802154_rdev_set_cca_ed_level,
  131. TP_PROTO(struct wpan_phy *wpan_phy, s32 ed_level),
  132. TP_ARGS(wpan_phy, ed_level),
  133. TP_STRUCT__entry(
  134. WPAN_PHY_ENTRY
  135. __field(s32, ed_level)
  136. ),
  137. TP_fast_assign(
  138. WPAN_PHY_ASSIGN;
  139. __entry->ed_level = ed_level;
  140. ),
  141. TP_printk(WPAN_PHY_PR_FMT ", ed level: %d", WPAN_PHY_PR_ARG,
  142. __entry->ed_level)
  143. );
  144. DECLARE_EVENT_CLASS(802154_le16_template,
  145. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  146. __le16 le16arg),
  147. TP_ARGS(wpan_phy, wpan_dev, le16arg),
  148. TP_STRUCT__entry(
  149. WPAN_PHY_ENTRY
  150. WPAN_DEV_ENTRY
  151. __field(__le16, le16arg)
  152. ),
  153. TP_fast_assign(
  154. WPAN_PHY_ASSIGN;
  155. WPAN_DEV_ASSIGN;
  156. __entry->le16arg = le16arg;
  157. ),
  158. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", pan id: 0x%04x",
  159. WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
  160. __le16_to_cpu(__entry->le16arg))
  161. );
  162. DEFINE_EVENT(802154_le16_template, 802154_rdev_set_pan_id,
  163. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  164. __le16 le16arg),
  165. TP_ARGS(wpan_phy, wpan_dev, le16arg)
  166. );
  167. DEFINE_EVENT_PRINT(802154_le16_template, 802154_rdev_set_short_addr,
  168. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  169. __le16 le16arg),
  170. TP_ARGS(wpan_phy, wpan_dev, le16arg),
  171. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT ", short addr: 0x%04x",
  172. WPAN_PHY_PR_ARG, WPAN_DEV_PR_ARG,
  173. __le16_to_cpu(__entry->le16arg))
  174. );
  175. TRACE_EVENT(802154_rdev_set_backoff_exponent,
  176. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  177. u8 min_be, u8 max_be),
  178. TP_ARGS(wpan_phy, wpan_dev, min_be, max_be),
  179. TP_STRUCT__entry(
  180. WPAN_PHY_ENTRY
  181. WPAN_DEV_ENTRY
  182. __field(u8, min_be)
  183. __field(u8, max_be)
  184. ),
  185. TP_fast_assign(
  186. WPAN_PHY_ASSIGN;
  187. WPAN_DEV_ASSIGN;
  188. __entry->min_be = min_be;
  189. __entry->max_be = max_be;
  190. ),
  191. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
  192. ", min be: %d, max be: %d", WPAN_PHY_PR_ARG,
  193. WPAN_DEV_PR_ARG, __entry->min_be, __entry->max_be)
  194. );
  195. TRACE_EVENT(802154_rdev_set_csma_backoffs,
  196. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  197. u8 max_csma_backoffs),
  198. TP_ARGS(wpan_phy, wpan_dev, max_csma_backoffs),
  199. TP_STRUCT__entry(
  200. WPAN_PHY_ENTRY
  201. WPAN_DEV_ENTRY
  202. __field(u8, max_csma_backoffs)
  203. ),
  204. TP_fast_assign(
  205. WPAN_PHY_ASSIGN;
  206. WPAN_DEV_ASSIGN;
  207. __entry->max_csma_backoffs = max_csma_backoffs;
  208. ),
  209. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
  210. ", max csma backoffs: %d", WPAN_PHY_PR_ARG,
  211. WPAN_DEV_PR_ARG, __entry->max_csma_backoffs)
  212. );
  213. TRACE_EVENT(802154_rdev_set_max_frame_retries,
  214. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  215. s8 max_frame_retries),
  216. TP_ARGS(wpan_phy, wpan_dev, max_frame_retries),
  217. TP_STRUCT__entry(
  218. WPAN_PHY_ENTRY
  219. WPAN_DEV_ENTRY
  220. __field(s8, max_frame_retries)
  221. ),
  222. TP_fast_assign(
  223. WPAN_PHY_ASSIGN;
  224. WPAN_DEV_ASSIGN;
  225. __entry->max_frame_retries = max_frame_retries;
  226. ),
  227. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
  228. ", max frame retries: %d", WPAN_PHY_PR_ARG,
  229. WPAN_DEV_PR_ARG, __entry->max_frame_retries)
  230. );
  231. TRACE_EVENT(802154_rdev_set_lbt_mode,
  232. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  233. bool mode),
  234. TP_ARGS(wpan_phy, wpan_dev, mode),
  235. TP_STRUCT__entry(
  236. WPAN_PHY_ENTRY
  237. WPAN_DEV_ENTRY
  238. __field(bool, mode)
  239. ),
  240. TP_fast_assign(
  241. WPAN_PHY_ASSIGN;
  242. WPAN_DEV_ASSIGN;
  243. __entry->mode = mode;
  244. ),
  245. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
  246. ", lbt mode: %s", WPAN_PHY_PR_ARG,
  247. WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->mode))
  248. );
  249. TRACE_EVENT(802154_rdev_set_ackreq_default,
  250. TP_PROTO(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev,
  251. bool ackreq),
  252. TP_ARGS(wpan_phy, wpan_dev, ackreq),
  253. TP_STRUCT__entry(
  254. WPAN_PHY_ENTRY
  255. WPAN_DEV_ENTRY
  256. __field(bool, ackreq)
  257. ),
  258. TP_fast_assign(
  259. WPAN_PHY_ASSIGN;
  260. WPAN_DEV_ASSIGN;
  261. __entry->ackreq = ackreq;
  262. ),
  263. TP_printk(WPAN_PHY_PR_FMT ", " WPAN_DEV_PR_FMT
  264. ", ackreq default: %s", WPAN_PHY_PR_ARG,
  265. WPAN_DEV_PR_ARG, BOOL_TO_STR(__entry->ackreq))
  266. );
  267. TRACE_EVENT(802154_rdev_return_int,
  268. TP_PROTO(struct wpan_phy *wpan_phy, int ret),
  269. TP_ARGS(wpan_phy, ret),
  270. TP_STRUCT__entry(
  271. WPAN_PHY_ENTRY
  272. __field(int, ret)
  273. ),
  274. TP_fast_assign(
  275. WPAN_PHY_ASSIGN;
  276. __entry->ret = ret;
  277. ),
  278. TP_printk(WPAN_PHY_PR_FMT ", returned: %d", WPAN_PHY_PR_ARG,
  279. __entry->ret)
  280. );
  281. #endif /* !__RDEV_CFG802154_OPS_TRACE || TRACE_HEADER_MULTI_READ */
  282. #undef TRACE_INCLUDE_PATH
  283. #define TRACE_INCLUDE_PATH .
  284. #undef TRACE_INCLUDE_FILE
  285. #define TRACE_INCLUDE_FILE trace
  286. #include <trace/define_trace.h>