trace_rx.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. /*
  2. * Copyright(c) 2015, 2016 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. #define packettype_name(etype) { RHF_RCV_TYPE_##etype, #etype }
  61. #define show_packettype(etype) \
  62. __print_symbolic(etype, \
  63. packettype_name(EXPECTED), \
  64. packettype_name(EAGER), \
  65. packettype_name(IB), \
  66. packettype_name(ERROR), \
  67. packettype_name(BYPASS))
  68. TRACE_EVENT(hfi1_rcvhdr,
  69. TP_PROTO(struct hfi1_devdata *dd,
  70. u32 ctxt,
  71. u64 eflags,
  72. u32 etype,
  73. u32 hlen,
  74. u32 tlen,
  75. u32 updegr,
  76. u32 etail
  77. ),
  78. TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail),
  79. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  80. __field(u64, eflags)
  81. __field(u32, ctxt)
  82. __field(u32, etype)
  83. __field(u32, hlen)
  84. __field(u32, tlen)
  85. __field(u32, updegr)
  86. __field(u32, etail)
  87. ),
  88. TP_fast_assign(DD_DEV_ASSIGN(dd);
  89. __entry->eflags = eflags;
  90. __entry->ctxt = ctxt;
  91. __entry->etype = etype;
  92. __entry->hlen = hlen;
  93. __entry->tlen = tlen;
  94. __entry->updegr = updegr;
  95. __entry->etail = etail;
  96. ),
  97. TP_printk(
  98. "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d",
  99. __get_str(dev),
  100. __entry->ctxt,
  101. __entry->eflags,
  102. __entry->etype, show_packettype(__entry->etype),
  103. __entry->hlen,
  104. __entry->tlen,
  105. __entry->updegr,
  106. __entry->etail
  107. )
  108. );
  109. TRACE_EVENT(hfi1_receive_interrupt,
  110. TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd),
  111. TP_ARGS(dd, rcd),
  112. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  113. __field(u32, ctxt)
  114. __field(u8, slow_path)
  115. __field(u8, dma_rtail)
  116. ),
  117. TP_fast_assign(DD_DEV_ASSIGN(dd);
  118. __entry->ctxt = rcd->ctxt;
  119. if (rcd->do_interrupt ==
  120. &handle_receive_interrupt) {
  121. __entry->slow_path = 1;
  122. __entry->dma_rtail = 0xFF;
  123. } else if (rcd->do_interrupt ==
  124. &handle_receive_interrupt_dma_rtail){
  125. __entry->dma_rtail = 1;
  126. __entry->slow_path = 0;
  127. } else if (rcd->do_interrupt ==
  128. &handle_receive_interrupt_nodma_rtail) {
  129. __entry->dma_rtail = 0;
  130. __entry->slow_path = 0;
  131. }
  132. ),
  133. TP_printk("[%s] ctxt %d SlowPath: %d DmaRtail: %d",
  134. __get_str(dev),
  135. __entry->ctxt,
  136. __entry->slow_path,
  137. __entry->dma_rtail
  138. )
  139. );
  140. DECLARE_EVENT_CLASS(
  141. hfi1_exp_tid_reg_unreg,
  142. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr,
  143. u32 npages, unsigned long va, unsigned long pa,
  144. dma_addr_t dma),
  145. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma),
  146. TP_STRUCT__entry(
  147. __field(unsigned int, ctxt)
  148. __field(u16, subctxt)
  149. __field(u32, rarr)
  150. __field(u32, npages)
  151. __field(unsigned long, va)
  152. __field(unsigned long, pa)
  153. __field(dma_addr_t, dma)
  154. ),
  155. TP_fast_assign(
  156. __entry->ctxt = ctxt;
  157. __entry->subctxt = subctxt;
  158. __entry->rarr = rarr;
  159. __entry->npages = npages;
  160. __entry->va = va;
  161. __entry->pa = pa;
  162. __entry->dma = dma;
  163. ),
  164. TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx, va:0x%lx dma:0x%llx",
  165. __entry->ctxt,
  166. __entry->subctxt,
  167. __entry->rarr,
  168. __entry->npages,
  169. __entry->pa,
  170. __entry->va,
  171. __entry->dma
  172. )
  173. );
  174. DEFINE_EVENT(
  175. hfi1_exp_tid_reg_unreg, hfi1_exp_tid_unreg,
  176. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages,
  177. unsigned long va, unsigned long pa, dma_addr_t dma),
  178. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma));
  179. DEFINE_EVENT(
  180. hfi1_exp_tid_reg_unreg, hfi1_exp_tid_reg,
  181. TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages,
  182. unsigned long va, unsigned long pa, dma_addr_t dma),
  183. TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma));
  184. TRACE_EVENT(
  185. hfi1_put_tid,
  186. TP_PROTO(struct hfi1_devdata *dd,
  187. u32 index, u32 type, unsigned long pa, u16 order),
  188. TP_ARGS(dd, index, type, pa, order),
  189. TP_STRUCT__entry(
  190. DD_DEV_ENTRY(dd)
  191. __field(unsigned long, pa);
  192. __field(u32, index);
  193. __field(u32, type);
  194. __field(u16, order);
  195. ),
  196. TP_fast_assign(
  197. DD_DEV_ASSIGN(dd);
  198. __entry->pa = pa;
  199. __entry->index = index;
  200. __entry->type = type;
  201. __entry->order = order;
  202. ),
  203. TP_printk("[%s] type %s pa %lx index %u order %u",
  204. __get_str(dev),
  205. show_tidtype(__entry->type),
  206. __entry->pa,
  207. __entry->index,
  208. __entry->order
  209. )
  210. );
  211. TRACE_EVENT(hfi1_exp_tid_inval,
  212. TP_PROTO(unsigned int ctxt, u16 subctxt, unsigned long va, u32 rarr,
  213. u32 npages, dma_addr_t dma),
  214. TP_ARGS(ctxt, subctxt, va, rarr, npages, dma),
  215. TP_STRUCT__entry(
  216. __field(unsigned int, ctxt)
  217. __field(u16, subctxt)
  218. __field(unsigned long, va)
  219. __field(u32, rarr)
  220. __field(u32, npages)
  221. __field(dma_addr_t, dma)
  222. ),
  223. TP_fast_assign(
  224. __entry->ctxt = ctxt;
  225. __entry->subctxt = subctxt;
  226. __entry->va = va;
  227. __entry->rarr = rarr;
  228. __entry->npages = npages;
  229. __entry->dma = dma;
  230. ),
  231. TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx dma: 0x%llx",
  232. __entry->ctxt,
  233. __entry->subctxt,
  234. __entry->rarr,
  235. __entry->npages,
  236. __entry->va,
  237. __entry->dma
  238. )
  239. );
  240. TRACE_EVENT(hfi1_mmu_invalidate,
  241. TP_PROTO(unsigned int ctxt, u16 subctxt, const char *type,
  242. unsigned long start, unsigned long end),
  243. TP_ARGS(ctxt, subctxt, type, start, end),
  244. TP_STRUCT__entry(
  245. __field(unsigned int, ctxt)
  246. __field(u16, subctxt)
  247. __string(type, type)
  248. __field(unsigned long, start)
  249. __field(unsigned long, end)
  250. ),
  251. TP_fast_assign(
  252. __entry->ctxt = ctxt;
  253. __entry->subctxt = subctxt;
  254. __assign_str(type, type);
  255. __entry->start = start;
  256. __entry->end = end;
  257. ),
  258. TP_printk("[%3u:%02u] MMU Invalidate (%s) 0x%lx - 0x%lx",
  259. __entry->ctxt,
  260. __entry->subctxt,
  261. __get_str(type),
  262. __entry->start,
  263. __entry->end
  264. )
  265. );
  266. #endif /* __HFI1_TRACE_RX_H */
  267. #undef TRACE_INCLUDE_PATH
  268. #undef TRACE_INCLUDE_FILE
  269. #define TRACE_INCLUDE_PATH .
  270. #define TRACE_INCLUDE_FILE trace_rx
  271. #include <trace/define_trace.h>