iwl-devtrace.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009 - 2010 Intel Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called LICENSE.
  20. *
  21. * Contact Information:
  22. * Intel Linux Wireless <ilw@linux.intel.com>
  23. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  24. *
  25. *****************************************************************************/
  26. #if !defined(__IWLWIFI_DEVICE_TRACE) || defined(TRACE_HEADER_MULTI_READ)
  27. #define __IWLWIFI_DEVICE_TRACE
  28. #include <linux/tracepoint.h>
  29. #include "iwl-dev.h"
  30. #if !defined(CONFIG_IWLWIFI_DEVICE_TRACING) || defined(__CHECKER__)
  31. #undef TRACE_EVENT
  32. #define TRACE_EVENT(name, proto, ...) \
  33. static inline void trace_ ## name(proto) {}
  34. #endif
  35. #define PRIV_ENTRY __field(struct iwl_priv *, priv)
  36. #define PRIV_ASSIGN __entry->priv = priv
  37. #undef TRACE_SYSTEM
  38. #define TRACE_SYSTEM iwlwifi_io
  39. TRACE_EVENT(iwlwifi_dev_ioread32,
  40. TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
  41. TP_ARGS(priv, offs, val),
  42. TP_STRUCT__entry(
  43. PRIV_ENTRY
  44. __field(u32, offs)
  45. __field(u32, val)
  46. ),
  47. TP_fast_assign(
  48. PRIV_ASSIGN;
  49. __entry->offs = offs;
  50. __entry->val = val;
  51. ),
  52. TP_printk("[%p] read io[%#x] = %#x", __entry->priv, __entry->offs, __entry->val)
  53. );
  54. TRACE_EVENT(iwlwifi_dev_iowrite8,
  55. TP_PROTO(struct iwl_priv *priv, u32 offs, u8 val),
  56. TP_ARGS(priv, offs, val),
  57. TP_STRUCT__entry(
  58. PRIV_ENTRY
  59. __field(u32, offs)
  60. __field(u8, val)
  61. ),
  62. TP_fast_assign(
  63. PRIV_ASSIGN;
  64. __entry->offs = offs;
  65. __entry->val = val;
  66. ),
  67. TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
  68. );
  69. TRACE_EVENT(iwlwifi_dev_iowrite32,
  70. TP_PROTO(struct iwl_priv *priv, u32 offs, u32 val),
  71. TP_ARGS(priv, offs, val),
  72. TP_STRUCT__entry(
  73. PRIV_ENTRY
  74. __field(u32, offs)
  75. __field(u32, val)
  76. ),
  77. TP_fast_assign(
  78. PRIV_ASSIGN;
  79. __entry->offs = offs;
  80. __entry->val = val;
  81. ),
  82. TP_printk("[%p] write io[%#x] = %#x)", __entry->priv, __entry->offs, __entry->val)
  83. );
  84. #undef TRACE_SYSTEM
  85. #define TRACE_SYSTEM iwlwifi_ucode
  86. TRACE_EVENT(iwlwifi_dev_ucode_cont_event,
  87. TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
  88. TP_ARGS(priv, time, data, ev),
  89. TP_STRUCT__entry(
  90. PRIV_ENTRY
  91. __field(u32, time)
  92. __field(u32, data)
  93. __field(u32, ev)
  94. ),
  95. TP_fast_assign(
  96. PRIV_ASSIGN;
  97. __entry->time = time;
  98. __entry->data = data;
  99. __entry->ev = ev;
  100. ),
  101. TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
  102. __entry->priv, __entry->time, __entry->data, __entry->ev)
  103. );
  104. TRACE_EVENT(iwlwifi_dev_ucode_wrap_event,
  105. TP_PROTO(struct iwl_priv *priv, u32 wraps, u32 n_entry, u32 p_entry),
  106. TP_ARGS(priv, wraps, n_entry, p_entry),
  107. TP_STRUCT__entry(
  108. PRIV_ENTRY
  109. __field(u32, wraps)
  110. __field(u32, n_entry)
  111. __field(u32, p_entry)
  112. ),
  113. TP_fast_assign(
  114. PRIV_ASSIGN;
  115. __entry->wraps = wraps;
  116. __entry->n_entry = n_entry;
  117. __entry->p_entry = p_entry;
  118. ),
  119. TP_printk("[%p] wraps=#%02d n=0x%X p=0x%X",
  120. __entry->priv, __entry->wraps, __entry->n_entry,
  121. __entry->p_entry)
  122. );
  123. #undef TRACE_SYSTEM
  124. #define TRACE_SYSTEM iwlwifi
  125. TRACE_EVENT(iwlwifi_dev_hcmd,
  126. TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
  127. TP_ARGS(priv, hcmd, len, flags),
  128. TP_STRUCT__entry(
  129. PRIV_ENTRY
  130. __dynamic_array(u8, hcmd, len)
  131. __field(u32, flags)
  132. ),
  133. TP_fast_assign(
  134. PRIV_ASSIGN;
  135. memcpy(__get_dynamic_array(hcmd), hcmd, len);
  136. __entry->flags = flags;
  137. ),
  138. TP_printk("[%p] hcmd %#.2x (%ssync)",
  139. __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
  140. __entry->flags & CMD_ASYNC ? "a" : "")
  141. );
  142. TRACE_EVENT(iwlwifi_dev_rx,
  143. TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
  144. TP_ARGS(priv, rxbuf, len),
  145. TP_STRUCT__entry(
  146. PRIV_ENTRY
  147. __dynamic_array(u8, rxbuf, len)
  148. ),
  149. TP_fast_assign(
  150. PRIV_ASSIGN;
  151. memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
  152. ),
  153. TP_printk("[%p] RX cmd %#.2x",
  154. __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
  155. );
  156. TRACE_EVENT(iwlwifi_dev_tx,
  157. TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
  158. void *buf0, size_t buf0_len,
  159. void *buf1, size_t buf1_len),
  160. TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
  161. TP_STRUCT__entry(
  162. PRIV_ENTRY
  163. __field(size_t, framelen)
  164. __dynamic_array(u8, tfd, tfdlen)
  165. /*
  166. * Do not insert between or below these items,
  167. * we want to keep the frame together (except
  168. * for the possible padding).
  169. */
  170. __dynamic_array(u8, buf0, buf0_len)
  171. __dynamic_array(u8, buf1, buf1_len)
  172. ),
  173. TP_fast_assign(
  174. PRIV_ASSIGN;
  175. __entry->framelen = buf0_len + buf1_len;
  176. memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
  177. memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
  178. memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
  179. ),
  180. TP_printk("[%p] TX %.2x (%zu bytes)",
  181. __entry->priv,
  182. ((u8 *)__get_dynamic_array(buf0))[0],
  183. __entry->framelen)
  184. );
  185. TRACE_EVENT(iwlwifi_dev_ucode_error,
  186. TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
  187. u32 data1, u32 data2, u32 line, u32 blink1,
  188. u32 blink2, u32 ilink1, u32 ilink2),
  189. TP_ARGS(priv, desc, time, data1, data2, line,
  190. blink1, blink2, ilink1, ilink2),
  191. TP_STRUCT__entry(
  192. PRIV_ENTRY
  193. __field(u32, desc)
  194. __field(u32, time)
  195. __field(u32, data1)
  196. __field(u32, data2)
  197. __field(u32, line)
  198. __field(u32, blink1)
  199. __field(u32, blink2)
  200. __field(u32, ilink1)
  201. __field(u32, ilink2)
  202. ),
  203. TP_fast_assign(
  204. PRIV_ASSIGN;
  205. __entry->desc = desc;
  206. __entry->time = time;
  207. __entry->data1 = data1;
  208. __entry->data2 = data2;
  209. __entry->line = line;
  210. __entry->blink1 = blink1;
  211. __entry->blink2 = blink2;
  212. __entry->ilink1 = ilink1;
  213. __entry->ilink2 = ilink2;
  214. ),
  215. TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
  216. "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
  217. __entry->priv, __entry->desc, __entry->time, __entry->data1,
  218. __entry->data2, __entry->line, __entry->blink1,
  219. __entry->blink2, __entry->ilink1, __entry->ilink2)
  220. );
  221. TRACE_EVENT(iwlwifi_dev_ucode_event,
  222. TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
  223. TP_ARGS(priv, time, data, ev),
  224. TP_STRUCT__entry(
  225. PRIV_ENTRY
  226. __field(u32, time)
  227. __field(u32, data)
  228. __field(u32, ev)
  229. ),
  230. TP_fast_assign(
  231. PRIV_ASSIGN;
  232. __entry->time = time;
  233. __entry->data = data;
  234. __entry->ev = ev;
  235. ),
  236. TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
  237. __entry->priv, __entry->time, __entry->data, __entry->ev)
  238. );
  239. #endif /* __IWLWIFI_DEVICE_TRACE */
  240. #undef TRACE_INCLUDE_PATH
  241. #define TRACE_INCLUDE_PATH .
  242. #undef TRACE_INCLUDE_FILE
  243. #define TRACE_INCLUDE_FILE iwl-devtrace
  244. #include <trace/define_trace.h>