trace_rx.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. /*
  2. * Copyright(c) 2015 - 2017 Intel Corporation.
  3. *
  4. * This file is provided under a dual BSD/GPLv2 license. When using or
  5. * redistributing this file, you may do so under either license.
  6. *
  7. * GPL LICENSE SUMMARY
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * BSD LICENSE
  19. *
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions
  22. * are met:
  23. *
  24. * - Redistributions of source code must retain the above copyright
  25. * notice, this list of conditions and the following disclaimer.
  26. * - Redistributions in binary form must reproduce the above copyright
  27. * notice, this list of conditions and the following disclaimer in
  28. * the documentation and/or other materials provided with the
  29. * distribution.
  30. * - Neither the name of Intel Corporation nor the names of its
  31. * contributors may be used to endorse or promote products derived
  32. * from this software without specific prior written permission.
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  35. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  36. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  37. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  38. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  39. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  40. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  41. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  42. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  44. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. *
  46. */
  47. #if !defined(__HFI1_TRACE_RX_H) || defined(TRACE_HEADER_MULTI_READ)
  48. #define __HFI1_TRACE_RX_H
  49. #include <linux/tracepoint.h>
  50. #include <linux/trace_seq.h>
  51. #include "hfi.h"
  52. #define tidtype_name(type) { PT_##type, #type }
  53. #define show_tidtype(type) \
  54. __print_symbolic(type, \
  55. tidtype_name(EXPECTED), \
  56. tidtype_name(EAGER), \
  57. tidtype_name(INVALID)) \
  58. #undef TRACE_SYSTEM
  59. #define TRACE_SYSTEM hfi1_rx
  60. TRACE_EVENT(hfi1_rcvhdr,
  61. TP_PROTO(struct hfi1_devdata *dd,
  62. u32 ctxt,
  63. u64 eflags,
  64. u32 etype,
  65. u32 hlen,
  66. u32 tlen,
  67. u32 updegr,
  68. u32 etail
  69. ),
  70. TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail),
  71. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  72. __field(u64, eflags)
  73. __field(u32, ctxt)
  74. __field(u32, etype)
  75. __field(u32, hlen)
  76. __field(u32, tlen)
  77. __field(u32, updegr)
  78. __field(u32, etail)
  79. ),
  80. TP_fast_assign(DD_DEV_ASSIGN(dd);
  81. __entry->eflags = eflags;
  82. __entry->ctxt = ctxt;
  83. __entry->etype = etype;
  84. __entry->hlen = hlen;
  85. __entry->tlen = tlen;
  86. __entry->updegr = updegr;
  87. __entry->etail = etail;
  88. ),
  89. TP_printk(
  90. "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d",
  91. __get_str(dev),
  92. __entry->ctxt,
  93. __entry->eflags,
  94. __entry->etype, show_packettype(__entry->etype),
  95. __entry->hlen,
  96. __entry->tlen,
  97. __entry->updegr,
  98. __entry->etail
  99. )
  100. );
  101. TRACE_EVENT(hfi1_receive_interrupt,
  102. TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd),
  103. TP_ARGS(dd, rcd),
  104. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  105. __field(u32, ctxt)
  106. __field(u8, slow_path)
  107. __field(u8, dma_rtail)
  108. ),
  109. TP_fast_assign(DD_DEV_ASSIGN(dd);
  110. __entry->ctxt = rcd->ctxt;
  111. if (rcd->do_interrupt ==
  112. &handle_receive_interrupt) {
  113. __entry->slow_path = 1;
  114. __entry->dma_rtail = 0xFF;
  115. } else if (rcd->do_interrupt ==
  116. &handle_receive_interrupt_dma_rtail){
  117. __entry->dma_rtail = 1;
  118. __entry->slow_path = 0;
  119. } else if (rcd->do_interrupt ==
  120. &handle_receive_interrupt_nodma_rtail) {
  121. __entry->dma_rtail = 0;
  122. __entry->slow_path = 0;
  123. }
  124. ),
  125. TP_printk("[%s] ctxt %d SlowPath: %d DmaRtail: %d",
  126. __get_str(dev),
  127. __entry->ctxt,
  128. __entry->slow_path,
  129. __entry->dma_rtail
  130. )
  131. );
  132. DECLARE_EVENT_CLASS(
  133. hfi1_exp_tid_reg_unreg,
  134. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr,
  135. u32 npages, unsigned long va, unsigned long pa,
  136. dma_addr_t dma),
  137. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma),
  138. TP_STRUCT__entry(
  139. __field(unsigned int, ctxt)
  140. __field(u16, subctxt)
  141. __field(u32, rarr)
  142. __field(u32, npages)
  143. __field(unsigned long, va)
  144. __field(unsigned long, pa)
  145. __field(dma_addr_t, dma)
  146. ),
  147. TP_fast_assign(
  148. __entry->ctxt = ctxt;
  149. __entry->subctxt = subctxt;
  150. __entry->rarr = rarr;
  151. __entry->npages = npages;
  152. __entry->va = va;
  153. __entry->pa = pa;
  154. __entry->dma = dma;
  155. ),
  156. TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx, va:0x%lx dma:0x%llx",
  157. __entry->ctxt,
  158. __entry->subctxt,
  159. __entry->rarr,
  160. __entry->npages,
  161. __entry->pa,
  162. __entry->va,
  163. __entry->dma
  164. )
  165. );
  166. DEFINE_EVENT(
  167. hfi1_exp_tid_reg_unreg, hfi1_exp_tid_unreg,
  168. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages,
  169. unsigned long va, unsigned long pa, dma_addr_t dma),
  170. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma));
  171. DEFINE_EVENT(
  172. hfi1_exp_tid_reg_unreg, hfi1_exp_tid_reg,
  173. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages,
  174. unsigned long va, unsigned long pa, dma_addr_t dma),
  175. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma));
  176. TRACE_EVENT(
  177. hfi1_put_tid,
  178. TP_PROTO(struct hfi1_devdata *dd,
  179. u32 index, u32 type, unsigned long pa, u16 order),
  180. TP_ARGS(dd, index, type, pa, order),
  181. TP_STRUCT__entry(
  182. DD_DEV_ENTRY(dd)
  183. __field(unsigned long, pa);
  184. __field(u32, index);
  185. __field(u32, type);
  186. __field(u16, order);
  187. ),
  188. TP_fast_assign(
  189. DD_DEV_ASSIGN(dd);
  190. __entry->pa = pa;
  191. __entry->index = index;
  192. __entry->type = type;
  193. __entry->order = order;
  194. ),
  195. TP_printk("[%s] type %s pa %lx index %u order %u",
  196. __get_str(dev),
  197. show_tidtype(__entry->type),
  198. __entry->pa,
  199. __entry->index,
  200. __entry->order
  201. )
  202. );
  203. TRACE_EVENT(hfi1_exp_tid_inval,
  204. TP_PROTO(unsigned int ctxt, u16 subctxt, unsigned long va, u32 rarr,
  205. u32 npages, dma_addr_t dma),
  206. TP_ARGS(ctxt, subctxt, va, rarr, npages, dma),
  207. TP_STRUCT__entry(
  208. __field(unsigned int, ctxt)
  209. __field(u16, subctxt)
  210. __field(unsigned long, va)
  211. __field(u32, rarr)
  212. __field(u32, npages)
  213. __field(dma_addr_t, dma)
  214. ),
  215. TP_fast_assign(
  216. __entry->ctxt = ctxt;
  217. __entry->subctxt = subctxt;
  218. __entry->va = va;
  219. __entry->rarr = rarr;
  220. __entry->npages = npages;
  221. __entry->dma = dma;
  222. ),
  223. TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx dma: 0x%llx",
  224. __entry->ctxt,
  225. __entry->subctxt,
  226. __entry->rarr,
  227. __entry->npages,
  228. __entry->va,
  229. __entry->dma
  230. )
  231. );
  232. TRACE_EVENT(hfi1_mmu_invalidate,
  233. TP_PROTO(unsigned int ctxt, u16 subctxt, const char *type,
  234. unsigned long start, unsigned long end),
  235. TP_ARGS(ctxt, subctxt, type, start, end),
  236. TP_STRUCT__entry(
  237. __field(unsigned int, ctxt)
  238. __field(u16, subctxt)
  239. __string(type, type)
  240. __field(unsigned long, start)
  241. __field(unsigned long, end)
  242. ),
  243. TP_fast_assign(
  244. __entry->ctxt = ctxt;
  245. __entry->subctxt = subctxt;
  246. __assign_str(type, type);
  247. __entry->start = start;
  248. __entry->end = end;
  249. ),
  250. TP_printk("[%3u:%02u] MMU Invalidate (%s) 0x%lx - 0x%lx",
  251. __entry->ctxt,
  252. __entry->subctxt,
  253. __get_str(type),
  254. __entry->start,
  255. __entry->end
  256. )
  257. );
  258. #endif /* __HFI1_TRACE_RX_H */
  259. #undef TRACE_INCLUDE_PATH
  260. #undef TRACE_INCLUDE_FILE
  261. #define TRACE_INCLUDE_PATH .
  262. #define TRACE_INCLUDE_FILE trace_rx
  263. #include <trace/define_trace.h>