trace_rx.h 8.2 KB

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