iwl-devtrace.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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
  86. TRACE_EVENT(iwlwifi_dev_hcmd,
  87. TP_PROTO(struct iwl_priv *priv, void *hcmd, size_t len, u32 flags),
  88. TP_ARGS(priv, hcmd, len, flags),
  89. TP_STRUCT__entry(
  90. PRIV_ENTRY
  91. __dynamic_array(u8, hcmd, len)
  92. __field(u32, flags)
  93. ),
  94. TP_fast_assign(
  95. PRIV_ASSIGN;
  96. memcpy(__get_dynamic_array(hcmd), hcmd, len);
  97. __entry->flags = flags;
  98. ),
  99. TP_printk("[%p] hcmd %#.2x (%ssync)",
  100. __entry->priv, ((u8 *)__get_dynamic_array(hcmd))[0],
  101. __entry->flags & CMD_ASYNC ? "a" : "")
  102. );
  103. TRACE_EVENT(iwlwifi_dev_rx,
  104. TP_PROTO(struct iwl_priv *priv, void *rxbuf, size_t len),
  105. TP_ARGS(priv, rxbuf, len),
  106. TP_STRUCT__entry(
  107. PRIV_ENTRY
  108. __dynamic_array(u8, rxbuf, len)
  109. ),
  110. TP_fast_assign(
  111. PRIV_ASSIGN;
  112. memcpy(__get_dynamic_array(rxbuf), rxbuf, len);
  113. ),
  114. TP_printk("[%p] RX cmd %#.2x",
  115. __entry->priv, ((u8 *)__get_dynamic_array(rxbuf))[4])
  116. );
  117. TRACE_EVENT(iwlwifi_dev_tx,
  118. TP_PROTO(struct iwl_priv *priv, void *tfd, size_t tfdlen,
  119. void *buf0, size_t buf0_len,
  120. void *buf1, size_t buf1_len),
  121. TP_ARGS(priv, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
  122. TP_STRUCT__entry(
  123. PRIV_ENTRY
  124. __field(size_t, framelen)
  125. __dynamic_array(u8, tfd, tfdlen)
  126. /*
  127. * Do not insert between or below these items,
  128. * we want to keep the frame together (except
  129. * for the possible padding).
  130. */
  131. __dynamic_array(u8, buf0, buf0_len)
  132. __dynamic_array(u8, buf1, buf1_len)
  133. ),
  134. TP_fast_assign(
  135. PRIV_ASSIGN;
  136. __entry->framelen = buf0_len + buf1_len;
  137. memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
  138. memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
  139. memcpy(__get_dynamic_array(buf1), buf1, buf0_len);
  140. ),
  141. TP_printk("[%p] TX %.2x (%zu bytes)",
  142. __entry->priv,
  143. ((u8 *)__get_dynamic_array(buf0))[0],
  144. __entry->framelen)
  145. );
  146. TRACE_EVENT(iwlwifi_dev_ucode_error,
  147. TP_PROTO(struct iwl_priv *priv, u32 desc, u32 time,
  148. u32 data1, u32 data2, u32 line, u32 blink1,
  149. u32 blink2, u32 ilink1, u32 ilink2),
  150. TP_ARGS(priv, desc, time, data1, data2, line,
  151. blink1, blink2, ilink1, ilink2),
  152. TP_STRUCT__entry(
  153. PRIV_ENTRY
  154. __field(u32, desc)
  155. __field(u32, time)
  156. __field(u32, data1)
  157. __field(u32, data2)
  158. __field(u32, line)
  159. __field(u32, blink1)
  160. __field(u32, blink2)
  161. __field(u32, ilink1)
  162. __field(u32, ilink2)
  163. ),
  164. TP_fast_assign(
  165. PRIV_ASSIGN;
  166. __entry->desc = desc;
  167. __entry->time = time;
  168. __entry->data1 = data1;
  169. __entry->data2 = data2;
  170. __entry->line = line;
  171. __entry->blink1 = blink1;
  172. __entry->blink2 = blink2;
  173. __entry->ilink1 = ilink1;
  174. __entry->ilink2 = ilink2;
  175. ),
  176. TP_printk("[%p] #%02d %010u data 0x%08X 0x%08X line %u, "
  177. "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X",
  178. __entry->priv, __entry->desc, __entry->time, __entry->data1,
  179. __entry->data2, __entry->line, __entry->blink1,
  180. __entry->blink2, __entry->ilink1, __entry->ilink2)
  181. );
  182. TRACE_EVENT(iwlwifi_dev_ucode_event,
  183. TP_PROTO(struct iwl_priv *priv, u32 time, u32 data, u32 ev),
  184. TP_ARGS(priv, time, data, ev),
  185. TP_STRUCT__entry(
  186. PRIV_ENTRY
  187. __field(u32, time)
  188. __field(u32, data)
  189. __field(u32, ev)
  190. ),
  191. TP_fast_assign(
  192. PRIV_ASSIGN;
  193. __entry->time = time;
  194. __entry->data = data;
  195. __entry->ev = ev;
  196. ),
  197. TP_printk("[%p] EVT_LOGT:%010u:0x%08x:%04u",
  198. __entry->priv, __entry->time, __entry->data, __entry->ev)
  199. );
  200. #endif /* __IWLWIFI_DEVICE_TRACE */
  201. #undef TRACE_INCLUDE_PATH
  202. #define TRACE_INCLUDE_PATH .
  203. #undef TRACE_INCLUDE_FILE
  204. #define TRACE_INCLUDE_FILE iwl-devtrace
  205. #include <trace/define_trace.h>