iwl-devtrace-iwlwifi.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
  4. * Copyright(c) 2015 Intel Mobile Communications GmbH
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of version 2 of the GNU General Public License as
  8. * published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along with
  16. * this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  18. *
  19. * The full GNU General Public License is included in this distribution in the
  20. * file called LICENSE.
  21. *
  22. * Contact Information:
  23. * Intel Linux Wireless <ilw@linux.intel.com>
  24. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  25. *
  26. *****************************************************************************/
  27. #if !defined(__IWLWIFI_DEVICE_TRACE_IWLWIFI) || defined(TRACE_HEADER_MULTI_READ)
  28. #define __IWLWIFI_DEVICE_TRACE_IWLWIFI
  29. #include <linux/tracepoint.h>
  30. #undef TRACE_SYSTEM
  31. #define TRACE_SYSTEM iwlwifi
  32. TRACE_EVENT(iwlwifi_dev_hcmd,
  33. TP_PROTO(const struct device *dev,
  34. struct iwl_host_cmd *cmd, u16 total_size,
  35. struct iwl_cmd_header *hdr),
  36. TP_ARGS(dev, cmd, total_size, hdr),
  37. TP_STRUCT__entry(
  38. DEV_ENTRY
  39. __dynamic_array(u8, hcmd, total_size)
  40. __field(u32, flags)
  41. ),
  42. TP_fast_assign(
  43. int i, offset = sizeof(*hdr);
  44. DEV_ASSIGN;
  45. __entry->flags = cmd->flags;
  46. memcpy(__get_dynamic_array(hcmd), hdr, sizeof(*hdr));
  47. for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
  48. if (!cmd->len[i])
  49. continue;
  50. memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
  51. cmd->data[i], cmd->len[i]);
  52. offset += cmd->len[i];
  53. }
  54. ),
  55. TP_printk("[%s] hcmd %#.2x (%ssync)",
  56. __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[0],
  57. __entry->flags & CMD_ASYNC ? "a" : "")
  58. );
  59. TRACE_EVENT(iwlwifi_dev_rx,
  60. TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
  61. struct iwl_rx_packet *pkt, size_t len),
  62. TP_ARGS(dev, trans, pkt, len),
  63. TP_STRUCT__entry(
  64. DEV_ENTRY
  65. __field(u8, cmd)
  66. __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, pkt, len))
  67. ),
  68. TP_fast_assign(
  69. DEV_ASSIGN;
  70. __entry->cmd = pkt->hdr.cmd;
  71. memcpy(__get_dynamic_array(rxbuf), pkt,
  72. iwl_rx_trace_len(trans, pkt, len));
  73. ),
  74. TP_printk("[%s] RX cmd %#.2x",
  75. __get_str(dev), __entry->cmd)
  76. );
  77. TRACE_EVENT(iwlwifi_dev_tx,
  78. TP_PROTO(const struct device *dev, struct sk_buff *skb,
  79. void *tfd, size_t tfdlen,
  80. void *buf0, size_t buf0_len,
  81. void *buf1, size_t buf1_len),
  82. TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
  83. TP_STRUCT__entry(
  84. DEV_ENTRY
  85. __field(size_t, framelen)
  86. __dynamic_array(u8, tfd, tfdlen)
  87. /*
  88. * Do not insert between or below these items,
  89. * we want to keep the frame together (except
  90. * for the possible padding).
  91. */
  92. __dynamic_array(u8, buf0, buf0_len)
  93. __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len)
  94. ),
  95. TP_fast_assign(
  96. DEV_ASSIGN;
  97. __entry->framelen = buf0_len + buf1_len;
  98. memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
  99. memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
  100. if (!iwl_trace_data(skb))
  101. memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
  102. ),
  103. TP_printk("[%s] TX %.2x (%zu bytes)",
  104. __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
  105. __entry->framelen)
  106. );
  107. TRACE_EVENT(iwlwifi_dev_ucode_error,
  108. TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low,
  109. u32 data1, u32 data2, u32 line, u32 blink1,
  110. u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
  111. u32 gp1, u32 gp2, u32 gp3, u32 major, u32 minor, u32 hw_ver,
  112. u32 brd_ver),
  113. TP_ARGS(dev, desc, tsf_low, data1, data2, line,
  114. blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
  115. gp3, major, minor, hw_ver, brd_ver),
  116. TP_STRUCT__entry(
  117. DEV_ENTRY
  118. __field(u32, desc)
  119. __field(u32, tsf_low)
  120. __field(u32, data1)
  121. __field(u32, data2)
  122. __field(u32, line)
  123. __field(u32, blink1)
  124. __field(u32, blink2)
  125. __field(u32, ilink1)
  126. __field(u32, ilink2)
  127. __field(u32, bcon_time)
  128. __field(u32, gp1)
  129. __field(u32, gp2)
  130. __field(u32, gp3)
  131. __field(u32, major)
  132. __field(u32, minor)
  133. __field(u32, hw_ver)
  134. __field(u32, brd_ver)
  135. ),
  136. TP_fast_assign(
  137. DEV_ASSIGN;
  138. __entry->desc = desc;
  139. __entry->tsf_low = tsf_low;
  140. __entry->data1 = data1;
  141. __entry->data2 = data2;
  142. __entry->line = line;
  143. __entry->blink1 = blink1;
  144. __entry->blink2 = blink2;
  145. __entry->ilink1 = ilink1;
  146. __entry->ilink2 = ilink2;
  147. __entry->bcon_time = bcon_time;
  148. __entry->gp1 = gp1;
  149. __entry->gp2 = gp2;
  150. __entry->gp3 = gp3;
  151. __entry->major = major;
  152. __entry->minor = minor;
  153. __entry->hw_ver = hw_ver;
  154. __entry->brd_ver = brd_ver;
  155. ),
  156. TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, "
  157. "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
  158. "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X major 0x%08X "
  159. "minor 0x%08X hw 0x%08X brd 0x%08X",
  160. __get_str(dev), __entry->desc, __entry->tsf_low,
  161. __entry->data1,
  162. __entry->data2, __entry->line, __entry->blink1,
  163. __entry->blink2, __entry->ilink1, __entry->ilink2,
  164. __entry->bcon_time, __entry->gp1, __entry->gp2,
  165. __entry->gp3, __entry->major, __entry->minor,
  166. __entry->hw_ver, __entry->brd_ver)
  167. );
  168. TRACE_EVENT(iwlwifi_dev_ucode_event,
  169. TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
  170. TP_ARGS(dev, time, data, ev),
  171. TP_STRUCT__entry(
  172. DEV_ENTRY
  173. __field(u32, time)
  174. __field(u32, data)
  175. __field(u32, ev)
  176. ),
  177. TP_fast_assign(
  178. DEV_ASSIGN;
  179. __entry->time = time;
  180. __entry->data = data;
  181. __entry->ev = ev;
  182. ),
  183. TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
  184. __get_str(dev), __entry->time, __entry->data, __entry->ev)
  185. );
  186. #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
  187. #undef TRACE_INCLUDE_PATH
  188. #define TRACE_INCLUDE_PATH .
  189. #undef TRACE_INCLUDE_FILE
  190. #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
  191. #include <trace/define_trace.h>