iwl-devtrace-iwlwifi.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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_wide *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(struct iwl_cmd_header);
  44. if (hdr->group_id)
  45. offset = sizeof(struct iwl_cmd_header_wide);
  46. DEV_ASSIGN;
  47. __entry->flags = cmd->flags;
  48. memcpy(__get_dynamic_array(hcmd), hdr, offset);
  49. for (i = 0; i < IWL_MAX_CMD_TBS_PER_TFD; i++) {
  50. if (!cmd->len[i])
  51. continue;
  52. memcpy((u8 *)__get_dynamic_array(hcmd) + offset,
  53. cmd->data[i], cmd->len[i]);
  54. offset += cmd->len[i];
  55. }
  56. ),
  57. TP_printk("[%s] hcmd %#.2x.%#.2x (%ssync)",
  58. __get_str(dev), ((u8 *)__get_dynamic_array(hcmd))[1],
  59. ((u8 *)__get_dynamic_array(hcmd))[0],
  60. __entry->flags & CMD_ASYNC ? "a" : "")
  61. );
  62. TRACE_EVENT(iwlwifi_dev_rx,
  63. TP_PROTO(const struct device *dev, const struct iwl_trans *trans,
  64. struct iwl_rx_packet *pkt, size_t len),
  65. TP_ARGS(dev, trans, pkt, len),
  66. TP_STRUCT__entry(
  67. DEV_ENTRY
  68. __field(u8, cmd)
  69. __dynamic_array(u8, rxbuf, iwl_rx_trace_len(trans, pkt, len))
  70. ),
  71. TP_fast_assign(
  72. DEV_ASSIGN;
  73. __entry->cmd = pkt->hdr.cmd;
  74. memcpy(__get_dynamic_array(rxbuf), pkt,
  75. iwl_rx_trace_len(trans, pkt, len));
  76. ),
  77. TP_printk("[%s] RX cmd %#.2x",
  78. __get_str(dev), __entry->cmd)
  79. );
  80. TRACE_EVENT(iwlwifi_dev_tx,
  81. TP_PROTO(const struct device *dev, struct sk_buff *skb,
  82. void *tfd, size_t tfdlen,
  83. void *buf0, size_t buf0_len,
  84. void *buf1, size_t buf1_len),
  85. TP_ARGS(dev, skb, tfd, tfdlen, buf0, buf0_len, buf1, buf1_len),
  86. TP_STRUCT__entry(
  87. DEV_ENTRY
  88. __field(size_t, framelen)
  89. __dynamic_array(u8, tfd, tfdlen)
  90. /*
  91. * Do not insert between or below these items,
  92. * we want to keep the frame together (except
  93. * for the possible padding).
  94. */
  95. __dynamic_array(u8, buf0, buf0_len)
  96. __dynamic_array(u8, buf1, iwl_trace_data(skb) ? 0 : buf1_len)
  97. ),
  98. TP_fast_assign(
  99. DEV_ASSIGN;
  100. __entry->framelen = buf0_len + buf1_len;
  101. memcpy(__get_dynamic_array(tfd), tfd, tfdlen);
  102. memcpy(__get_dynamic_array(buf0), buf0, buf0_len);
  103. if (!iwl_trace_data(skb))
  104. memcpy(__get_dynamic_array(buf1), buf1, buf1_len);
  105. ),
  106. TP_printk("[%s] TX %.2x (%zu bytes)",
  107. __get_str(dev), ((u8 *)__get_dynamic_array(buf0))[0],
  108. __entry->framelen)
  109. );
  110. TRACE_EVENT(iwlwifi_dev_ucode_error,
  111. TP_PROTO(const struct device *dev, u32 desc, u32 tsf_low,
  112. u32 data1, u32 data2, u32 line, u32 blink1,
  113. u32 blink2, u32 ilink1, u32 ilink2, u32 bcon_time,
  114. u32 gp1, u32 gp2, u32 gp3, u32 major, u32 minor, u32 hw_ver,
  115. u32 brd_ver),
  116. TP_ARGS(dev, desc, tsf_low, data1, data2, line,
  117. blink1, blink2, ilink1, ilink2, bcon_time, gp1, gp2,
  118. gp3, major, minor, hw_ver, brd_ver),
  119. TP_STRUCT__entry(
  120. DEV_ENTRY
  121. __field(u32, desc)
  122. __field(u32, tsf_low)
  123. __field(u32, data1)
  124. __field(u32, data2)
  125. __field(u32, line)
  126. __field(u32, blink1)
  127. __field(u32, blink2)
  128. __field(u32, ilink1)
  129. __field(u32, ilink2)
  130. __field(u32, bcon_time)
  131. __field(u32, gp1)
  132. __field(u32, gp2)
  133. __field(u32, gp3)
  134. __field(u32, major)
  135. __field(u32, minor)
  136. __field(u32, hw_ver)
  137. __field(u32, brd_ver)
  138. ),
  139. TP_fast_assign(
  140. DEV_ASSIGN;
  141. __entry->desc = desc;
  142. __entry->tsf_low = tsf_low;
  143. __entry->data1 = data1;
  144. __entry->data2 = data2;
  145. __entry->line = line;
  146. __entry->blink1 = blink1;
  147. __entry->blink2 = blink2;
  148. __entry->ilink1 = ilink1;
  149. __entry->ilink2 = ilink2;
  150. __entry->bcon_time = bcon_time;
  151. __entry->gp1 = gp1;
  152. __entry->gp2 = gp2;
  153. __entry->gp3 = gp3;
  154. __entry->major = major;
  155. __entry->minor = minor;
  156. __entry->hw_ver = hw_ver;
  157. __entry->brd_ver = brd_ver;
  158. ),
  159. TP_printk("[%s] #%02d %010u data 0x%08X 0x%08X line %u, "
  160. "blink 0x%05X 0x%05X ilink 0x%05X 0x%05X "
  161. "bcon_tm %010u gp 0x%08X 0x%08X 0x%08X major 0x%08X "
  162. "minor 0x%08X hw 0x%08X brd 0x%08X",
  163. __get_str(dev), __entry->desc, __entry->tsf_low,
  164. __entry->data1,
  165. __entry->data2, __entry->line, __entry->blink1,
  166. __entry->blink2, __entry->ilink1, __entry->ilink2,
  167. __entry->bcon_time, __entry->gp1, __entry->gp2,
  168. __entry->gp3, __entry->major, __entry->minor,
  169. __entry->hw_ver, __entry->brd_ver)
  170. );
  171. TRACE_EVENT(iwlwifi_dev_ucode_event,
  172. TP_PROTO(const struct device *dev, u32 time, u32 data, u32 ev),
  173. TP_ARGS(dev, time, data, ev),
  174. TP_STRUCT__entry(
  175. DEV_ENTRY
  176. __field(u32, time)
  177. __field(u32, data)
  178. __field(u32, ev)
  179. ),
  180. TP_fast_assign(
  181. DEV_ASSIGN;
  182. __entry->time = time;
  183. __entry->data = data;
  184. __entry->ev = ev;
  185. ),
  186. TP_printk("[%s] EVT_LOGT:%010u:0x%08x:%04u",
  187. __get_str(dev), __entry->time, __entry->data, __entry->ev)
  188. );
  189. #endif /* __IWLWIFI_DEVICE_TRACE_IWLWIFI */
  190. #undef TRACE_INCLUDE_PATH
  191. #define TRACE_INCLUDE_PATH .
  192. #undef TRACE_INCLUDE_FILE
  193. #define TRACE_INCLUDE_FILE iwl-devtrace-iwlwifi
  194. #include <trace/define_trace.h>