xref: /openbmc/linux/include/trace/events/ib_umad.h (revision 07c7c6bf)
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 
3 /*
4  * Copyright (c) 2018 Intel Corporation.  All rights reserved.
5  *
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM ib_umad
10 
11 #if !defined(_TRACE_IB_UMAD_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_IB_UMAD_H
13 
14 #include <linux/tracepoint.h>
15 
16 DECLARE_EVENT_CLASS(ib_umad_template,
17 	TP_PROTO(struct ib_umad_file *file, struct ib_user_mad_hdr *umad_hdr,
18 		 struct ib_mad_hdr *mad_hdr),
19 	TP_ARGS(file, umad_hdr, mad_hdr),
20 
21 	TP_STRUCT__entry(
22 		__field(u8, port_num)
23 		__field(u8, sl)
24 		__field(u8, path_bits)
25 		__field(u8, grh_present)
26 		__field(u32, id)
27 		__field(u32, status)
28 		__field(u32, timeout_ms)
29 		__field(u32, retires)
30 		__field(u32, length)
31 		__field(u32, qpn)
32 		__field(u32, qkey)
33 		__field(u8, gid_index)
34 		__field(u8, hop_limit)
35 		__field(u16, lid)
36 		__field(u16, attr_id)
37 		__field(u16, pkey_index)
38 		__field(u8, base_version)
39 		__field(u8, mgmt_class)
40 		__field(u8, class_version)
41 		__field(u8, method)
42 		__field(u32, flow_label)
43 		__field(u16, mad_status)
44 		__field(u16, class_specific)
45 		__field(u32, attr_mod)
46 		__field(u64, tid)
47 		__array(u8, gid, 16)
48 		__field(u32, dev_index)
49 		__field(u8,  traffic_class)
50 	),
51 
52 	TP_fast_assign(
53 		__entry->dev_index = file->port->ib_dev->index;
54 		__entry->port_num = file->port->port_num;
55 
56 		__entry->id = umad_hdr->id;
57 		__entry->status = umad_hdr->status;
58 		__entry->timeout_ms = umad_hdr->timeout_ms;
59 		__entry->retires = umad_hdr->retries;
60 		__entry->length = umad_hdr->length;
61 		__entry->qpn = umad_hdr->qpn;
62 		__entry->qkey = umad_hdr->qkey;
63 		__entry->lid = umad_hdr->lid;
64 		__entry->sl = umad_hdr->sl;
65 		__entry->path_bits = umad_hdr->path_bits;
66 		__entry->grh_present = umad_hdr->grh_present;
67 		__entry->gid_index = umad_hdr->gid_index;
68 		__entry->hop_limit = umad_hdr->hop_limit;
69 		__entry->traffic_class = umad_hdr->traffic_class;
70 		memcpy(__entry->gid, umad_hdr->gid, sizeof(umad_hdr->gid));
71 		__entry->flow_label = umad_hdr->flow_label;
72 		__entry->pkey_index = umad_hdr->pkey_index;
73 
74 		__entry->base_version = mad_hdr->base_version;
75 		__entry->mgmt_class = mad_hdr->mgmt_class;
76 		__entry->class_version = mad_hdr->class_version;
77 		__entry->method = mad_hdr->method;
78 		__entry->mad_status = mad_hdr->status;
79 		__entry->class_specific = mad_hdr->class_specific;
80 		__entry->tid = mad_hdr->tid;
81 		__entry->attr_id = mad_hdr->attr_id;
82 		__entry->attr_mod = mad_hdr->attr_mod;
83 	),
84 
85 	TP_printk("%d:%d umad_hdr: id 0x%08x status 0x%08x ms %u ret %u " \
86 		  "len %u QP%u qkey 0x%08x lid 0x%04x sl %u path_bits 0x%x " \
87 		  "grh 0x%x gidi %u hop_lim %u traf_cl %u gid %pI6c " \
88 		  "flow 0x%08x pkeyi %u  MAD: base_ver 0x%x class 0x%x " \
89 		  "class_ver 0x%x method 0x%x status 0x%04x " \
90 		  "class_specific 0x%04x tid 0x%016llx attr_id 0x%04x " \
91 		  "attr_mod 0x%08x ",
92 		__entry->dev_index, __entry->port_num,
93 		__entry->id, __entry->status, __entry->timeout_ms,
94 		__entry->retires, __entry->length, be32_to_cpu(__entry->qpn),
95 		be32_to_cpu(__entry->qkey), be16_to_cpu(__entry->lid),
96 		__entry->sl, __entry->path_bits, __entry->grh_present,
97 		__entry->gid_index, __entry->hop_limit,
98 		__entry->traffic_class, &__entry->gid,
99 		be32_to_cpu(__entry->flow_label), __entry->pkey_index,
100 		__entry->base_version, __entry->mgmt_class,
101 		__entry->class_version, __entry->method,
102 		be16_to_cpu(__entry->mad_status),
103 		be16_to_cpu(__entry->class_specific),
104 		be64_to_cpu(__entry->tid), be16_to_cpu(__entry->attr_id),
105 		be32_to_cpu(__entry->attr_mod)
106 	)
107 );
108 
109 DEFINE_EVENT(ib_umad_template, ib_umad_write,
110 	TP_PROTO(struct ib_umad_file *file, struct ib_user_mad_hdr *umad_hdr,
111 		 struct ib_mad_hdr *mad_hdr),
112 	TP_ARGS(file, umad_hdr, mad_hdr));
113 
114 DEFINE_EVENT(ib_umad_template, ib_umad_read_recv,
115 	TP_PROTO(struct ib_umad_file *file, struct ib_user_mad_hdr *umad_hdr,
116 		 struct ib_mad_hdr *mad_hdr),
117 	TP_ARGS(file, umad_hdr, mad_hdr));
118 
119 DEFINE_EVENT(ib_umad_template, ib_umad_read_send,
120 	TP_PROTO(struct ib_umad_file *file, struct ib_user_mad_hdr *umad_hdr,
121 		 struct ib_mad_hdr *mad_hdr),
122 	TP_ARGS(file, umad_hdr, mad_hdr));
123 
124 #endif /* _TRACE_IB_UMAD_H */
125 
126 #include <trace/define_trace.h>
127