1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright(c) 2015 - 2018 Intel Corporation.
4  */
5 
6 #if !defined(__HFI1_TRACE_RX_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define __HFI1_TRACE_RX_H
8 
9 #include <linux/tracepoint.h>
10 #include <linux/trace_seq.h>
11 
12 #include "hfi.h"
13 
14 #define tidtype_name(type) { PT_##type, #type }
15 #define show_tidtype(type)                   \
16 __print_symbolic(type,                       \
17 	tidtype_name(EXPECTED),              \
18 	tidtype_name(EAGER),                 \
19 	tidtype_name(INVALID))               \
20 
21 #undef TRACE_SYSTEM
22 #define TRACE_SYSTEM hfi1_rx
23 
24 TRACE_EVENT(hfi1_rcvhdr,
25 	    TP_PROTO(struct hfi1_packet *packet),
26 	    TP_ARGS(packet),
27 	    TP_STRUCT__entry(DD_DEV_ENTRY(packet->rcd->dd)
28 			     __field(u64, eflags)
29 			     __field(u32, ctxt)
30 			     __field(u32, etype)
31 			     __field(u32, hlen)
32 			     __field(u32, tlen)
33 			     __field(u32, updegr)
34 			     __field(u32, etail)
35 			     ),
36 	     TP_fast_assign(DD_DEV_ASSIGN(packet->rcd->dd);
37 			    __entry->eflags = rhf_err_flags(packet->rhf);
38 			    __entry->ctxt = packet->rcd->ctxt;
39 			    __entry->etype = packet->etype;
40 			    __entry->hlen = packet->hlen;
41 			    __entry->tlen = packet->tlen;
42 			    __entry->updegr = packet->updegr;
43 			    __entry->etail = rhf_egr_index(packet->rhf);
44 			    ),
45 	     TP_printk(
46 		"[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d",
47 		__get_str(dev),
48 		__entry->ctxt,
49 		__entry->eflags,
50 		__entry->etype, show_packettype(__entry->etype),
51 		__entry->hlen,
52 		__entry->tlen,
53 		__entry->updegr,
54 		__entry->etail
55 		)
56 );
57 
58 TRACE_EVENT(hfi1_receive_interrupt,
59 	    TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd),
60 	    TP_ARGS(dd, rcd),
61 	    TP_STRUCT__entry(DD_DEV_ENTRY(dd)
62 			     __field(u32, ctxt)
63 			     __field(u8, slow_path)
64 			     __field(u8, dma_rtail)
65 			     ),
66 	    TP_fast_assign(DD_DEV_ASSIGN(dd);
67 			__entry->ctxt = rcd->ctxt;
68 			__entry->slow_path = hfi1_is_slowpath(rcd);
69 			__entry->dma_rtail = get_dma_rtail_setting(rcd);
70 			),
71 	    TP_printk("[%s] ctxt %d SlowPath: %d DmaRtail: %d",
72 		      __get_str(dev),
73 		      __entry->ctxt,
74 		      __entry->slow_path,
75 		      __entry->dma_rtail
76 		      )
77 );
78 
79 TRACE_EVENT(hfi1_mmu_invalidate,
80 	    TP_PROTO(unsigned int ctxt, u16 subctxt, const char *type,
81 		     unsigned long start, unsigned long end),
82 	    TP_ARGS(ctxt, subctxt, type, start, end),
83 	    TP_STRUCT__entry(
84 			     __field(unsigned int, ctxt)
85 			     __field(u16, subctxt)
86 			     __string(type, type)
87 			     __field(unsigned long, start)
88 			     __field(unsigned long, end)
89 			     ),
90 	    TP_fast_assign(
91 			__entry->ctxt = ctxt;
92 			__entry->subctxt = subctxt;
93 			__assign_str(type);
94 			__entry->start = start;
95 			__entry->end = end;
96 	    ),
97 	    TP_printk("[%3u:%02u] MMU Invalidate (%s) 0x%lx - 0x%lx",
98 		      __entry->ctxt,
99 		      __entry->subctxt,
100 		      __get_str(type),
101 		      __entry->start,
102 		      __entry->end
103 		      )
104 	    );
105 
106 #endif /* __HFI1_TRACE_RX_H */
107 
108 #undef TRACE_INCLUDE_PATH
109 #undef TRACE_INCLUDE_FILE
110 #define TRACE_INCLUDE_PATH .
111 #define TRACE_INCLUDE_FILE trace_rx
112 #include <trace/define_trace.h>
113