WIP FPC-III support
[linux/fpc-iii.git] / drivers / infiniband / core / cm_trace.h
blobe9d282679ef15542e05f32a7867c018edcd38a65
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Trace point definitions for the RDMA Connect Manager.
5 * Author: Chuck Lever <chuck.lever@oracle.com>
7 * Copyright (c) 2020 Oracle and/or its affiliates.
8 */
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM ib_cma
13 #if !defined(_TRACE_IB_CMA_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_IB_CMA_H
17 #include <linux/tracepoint.h>
18 #include <rdma/ib_cm.h>
19 #include <trace/events/rdma.h>
22 * enum ib_cm_state, from include/rdma/ib_cm.h
24 #define IB_CM_STATE_LIST \
25 ib_cm_state(IDLE) \
26 ib_cm_state(LISTEN) \
27 ib_cm_state(REQ_SENT) \
28 ib_cm_state(REQ_RCVD) \
29 ib_cm_state(MRA_REQ_SENT) \
30 ib_cm_state(MRA_REQ_RCVD) \
31 ib_cm_state(REP_SENT) \
32 ib_cm_state(REP_RCVD) \
33 ib_cm_state(MRA_REP_SENT) \
34 ib_cm_state(MRA_REP_RCVD) \
35 ib_cm_state(ESTABLISHED) \
36 ib_cm_state(DREQ_SENT) \
37 ib_cm_state(DREQ_RCVD) \
38 ib_cm_state(TIMEWAIT) \
39 ib_cm_state(SIDR_REQ_SENT) \
40 ib_cm_state_end(SIDR_REQ_RCVD)
42 #undef ib_cm_state
43 #undef ib_cm_state_end
44 #define ib_cm_state(x) TRACE_DEFINE_ENUM(IB_CM_##x);
45 #define ib_cm_state_end(x) TRACE_DEFINE_ENUM(IB_CM_##x);
47 IB_CM_STATE_LIST
49 #undef ib_cm_state
50 #undef ib_cm_state_end
51 #define ib_cm_state(x) { IB_CM_##x, #x },
52 #define ib_cm_state_end(x) { IB_CM_##x, #x }
54 #define show_ib_cm_state(x) \
55 __print_symbolic(x, IB_CM_STATE_LIST)
58 * enum ib_cm_lap_state, from include/rdma/ib_cm.h
60 #define IB_CM_LAP_STATE_LIST \
61 ib_cm_lap_state(LAP_UNINIT) \
62 ib_cm_lap_state(LAP_IDLE) \
63 ib_cm_lap_state(LAP_SENT) \
64 ib_cm_lap_state(LAP_RCVD) \
65 ib_cm_lap_state(MRA_LAP_SENT) \
66 ib_cm_lap_state_end(MRA_LAP_RCVD)
68 #undef ib_cm_lap_state
69 #undef ib_cm_lap_state_end
70 #define ib_cm_lap_state(x) TRACE_DEFINE_ENUM(IB_CM_##x);
71 #define ib_cm_lap_state_end(x) TRACE_DEFINE_ENUM(IB_CM_##x);
73 IB_CM_LAP_STATE_LIST
75 #undef ib_cm_lap_state
76 #undef ib_cm_lap_state_end
77 #define ib_cm_lap_state(x) { IB_CM_##x, #x },
78 #define ib_cm_lap_state_end(x) { IB_CM_##x, #x }
80 #define show_ib_cm_lap_state(x) \
81 __print_symbolic(x, IB_CM_LAP_STATE_LIST)
84 * enum ib_cm_rej_reason, from include/rdma/ib_cm.h
86 #define IB_CM_REJ_REASON_LIST \
87 ib_cm_rej_reason(REJ_NO_QP) \
88 ib_cm_rej_reason(REJ_NO_EEC) \
89 ib_cm_rej_reason(REJ_NO_RESOURCES) \
90 ib_cm_rej_reason(REJ_TIMEOUT) \
91 ib_cm_rej_reason(REJ_UNSUPPORTED) \
92 ib_cm_rej_reason(REJ_INVALID_COMM_ID) \
93 ib_cm_rej_reason(REJ_INVALID_COMM_INSTANCE) \
94 ib_cm_rej_reason(REJ_INVALID_SERVICE_ID) \
95 ib_cm_rej_reason(REJ_INVALID_TRANSPORT_TYPE) \
96 ib_cm_rej_reason(REJ_STALE_CONN) \
97 ib_cm_rej_reason(REJ_RDC_NOT_EXIST) \
98 ib_cm_rej_reason(REJ_INVALID_GID) \
99 ib_cm_rej_reason(REJ_INVALID_LID) \
100 ib_cm_rej_reason(REJ_INVALID_SL) \
101 ib_cm_rej_reason(REJ_INVALID_TRAFFIC_CLASS) \
102 ib_cm_rej_reason(REJ_INVALID_HOP_LIMIT) \
103 ib_cm_rej_reason(REJ_INVALID_PACKET_RATE) \
104 ib_cm_rej_reason(REJ_INVALID_ALT_GID) \
105 ib_cm_rej_reason(REJ_INVALID_ALT_LID) \
106 ib_cm_rej_reason(REJ_INVALID_ALT_SL) \
107 ib_cm_rej_reason(REJ_INVALID_ALT_TRAFFIC_CLASS) \
108 ib_cm_rej_reason(REJ_INVALID_ALT_HOP_LIMIT) \
109 ib_cm_rej_reason(REJ_INVALID_ALT_PACKET_RATE) \
110 ib_cm_rej_reason(REJ_PORT_CM_REDIRECT) \
111 ib_cm_rej_reason(REJ_PORT_REDIRECT) \
112 ib_cm_rej_reason(REJ_INVALID_MTU) \
113 ib_cm_rej_reason(REJ_INSUFFICIENT_RESP_RESOURCES) \
114 ib_cm_rej_reason(REJ_CONSUMER_DEFINED) \
115 ib_cm_rej_reason(REJ_INVALID_RNR_RETRY) \
116 ib_cm_rej_reason(REJ_DUPLICATE_LOCAL_COMM_ID) \
117 ib_cm_rej_reason(REJ_INVALID_CLASS_VERSION) \
118 ib_cm_rej_reason(REJ_INVALID_FLOW_LABEL) \
119 ib_cm_rej_reason(REJ_INVALID_ALT_FLOW_LABEL) \
120 ib_cm_rej_reason_end(REJ_VENDOR_OPTION_NOT_SUPPORTED)
122 #undef ib_cm_rej_reason
123 #undef ib_cm_rej_reason_end
124 #define ib_cm_rej_reason(x) TRACE_DEFINE_ENUM(IB_CM_##x);
125 #define ib_cm_rej_reason_end(x) TRACE_DEFINE_ENUM(IB_CM_##x);
127 IB_CM_REJ_REASON_LIST
129 #undef ib_cm_rej_reason
130 #undef ib_cm_rej_reason_end
131 #define ib_cm_rej_reason(x) { IB_CM_##x, #x },
132 #define ib_cm_rej_reason_end(x) { IB_CM_##x, #x }
134 #define show_ib_cm_rej_reason(x) \
135 __print_symbolic(x, IB_CM_REJ_REASON_LIST)
137 DECLARE_EVENT_CLASS(icm_id_class,
138 TP_PROTO(
139 const struct ib_cm_id *cm_id
142 TP_ARGS(cm_id),
144 TP_STRUCT__entry(
145 __field(const void *, cm_id) /* for eBPF scripts */
146 __field(unsigned int, local_id)
147 __field(unsigned int, remote_id)
148 __field(unsigned long, state)
149 __field(unsigned long, lap_state)
152 TP_fast_assign(
153 __entry->cm_id = cm_id;
154 __entry->local_id = be32_to_cpu(cm_id->local_id);
155 __entry->remote_id = be32_to_cpu(cm_id->remote_id);
156 __entry->state = cm_id->state;
157 __entry->lap_state = cm_id->lap_state;
160 TP_printk("local_id=%u remote_id=%u state=%s lap_state=%s",
161 __entry->local_id, __entry->remote_id,
162 show_ib_cm_state(__entry->state),
163 show_ib_cm_lap_state(__entry->lap_state)
167 #define DEFINE_CM_SEND_EVENT(name) \
168 DEFINE_EVENT(icm_id_class, \
169 icm_send_##name, \
170 TP_PROTO( \
171 const struct ib_cm_id *cm_id \
172 ), \
173 TP_ARGS(cm_id))
175 DEFINE_CM_SEND_EVENT(req);
176 DEFINE_CM_SEND_EVENT(rep);
177 DEFINE_CM_SEND_EVENT(dup_req);
178 DEFINE_CM_SEND_EVENT(dup_rep);
179 DEFINE_CM_SEND_EVENT(rtu);
180 DEFINE_CM_SEND_EVENT(mra);
181 DEFINE_CM_SEND_EVENT(sidr_req);
182 DEFINE_CM_SEND_EVENT(sidr_rep);
183 DEFINE_CM_SEND_EVENT(dreq);
184 DEFINE_CM_SEND_EVENT(drep);
186 TRACE_EVENT(icm_send_rej,
187 TP_PROTO(
188 const struct ib_cm_id *cm_id,
189 enum ib_cm_rej_reason reason
192 TP_ARGS(cm_id, reason),
194 TP_STRUCT__entry(
195 __field(const void *, cm_id)
196 __field(u32, local_id)
197 __field(u32, remote_id)
198 __field(unsigned long, state)
199 __field(unsigned long, reason)
202 TP_fast_assign(
203 __entry->cm_id = cm_id;
204 __entry->local_id = be32_to_cpu(cm_id->local_id);
205 __entry->remote_id = be32_to_cpu(cm_id->remote_id);
206 __entry->state = cm_id->state;
207 __entry->reason = reason;
210 TP_printk("local_id=%u remote_id=%u state=%s reason=%s",
211 __entry->local_id, __entry->remote_id,
212 show_ib_cm_state(__entry->state),
213 show_ib_cm_rej_reason(__entry->reason)
217 #define DEFINE_CM_ERR_EVENT(name) \
218 DEFINE_EVENT(icm_id_class, \
219 icm_##name##_err, \
220 TP_PROTO( \
221 const struct ib_cm_id *cm_id \
222 ), \
223 TP_ARGS(cm_id))
225 DEFINE_CM_ERR_EVENT(send_cm_rtu);
226 DEFINE_CM_ERR_EVENT(establish);
227 DEFINE_CM_ERR_EVENT(no_listener);
228 DEFINE_CM_ERR_EVENT(send_drep);
229 DEFINE_CM_ERR_EVENT(dreq_unknown);
230 DEFINE_CM_ERR_EVENT(send_unknown_rej);
231 DEFINE_CM_ERR_EVENT(rej_unknown);
232 DEFINE_CM_ERR_EVENT(send_mra_unknown);
233 DEFINE_CM_ERR_EVENT(mra_unknown);
234 DEFINE_CM_ERR_EVENT(qp_init);
235 DEFINE_CM_ERR_EVENT(qp_rtr);
236 DEFINE_CM_ERR_EVENT(qp_rts);
238 DEFINE_EVENT(icm_id_class, \
239 icm_dreq_skipped, \
240 TP_PROTO( \
241 const struct ib_cm_id *cm_id \
242 ), \
243 TP_ARGS(cm_id) \
246 DECLARE_EVENT_CLASS(icm_local_class,
247 TP_PROTO(
248 unsigned int local_id,
249 unsigned int remote_id
252 TP_ARGS(local_id, remote_id),
254 TP_STRUCT__entry(
255 __field(unsigned int, local_id)
256 __field(unsigned int, remote_id)
259 TP_fast_assign(
260 __entry->local_id = local_id;
261 __entry->remote_id = remote_id;
264 TP_printk("local_id=%u remote_id=%u",
265 __entry->local_id, __entry->remote_id
269 #define DEFINE_CM_LOCAL_EVENT(name) \
270 DEFINE_EVENT(icm_local_class, \
271 icm_##name, \
272 TP_PROTO( \
273 unsigned int local_id, \
274 unsigned int remote_id \
275 ), \
276 TP_ARGS(local_id, remote_id))
278 DEFINE_CM_LOCAL_EVENT(issue_rej);
279 DEFINE_CM_LOCAL_EVENT(issue_drep);
280 DEFINE_CM_LOCAL_EVENT(staleconn_err);
281 DEFINE_CM_LOCAL_EVENT(no_priv_err);
283 DECLARE_EVENT_CLASS(icm_remote_class,
284 TP_PROTO(
285 u32 remote_id
288 TP_ARGS(remote_id),
290 TP_STRUCT__entry(
291 __field(u32, remote_id)
294 TP_fast_assign(
295 __entry->remote_id = remote_id;
298 TP_printk("remote_id=%u",
299 __entry->remote_id
303 #define DEFINE_CM_REMOTE_EVENT(name) \
304 DEFINE_EVENT(icm_remote_class, \
305 icm_##name, \
306 TP_PROTO( \
307 u32 remote_id \
308 ), \
309 TP_ARGS(remote_id))
311 DEFINE_CM_REMOTE_EVENT(remote_no_priv_err);
312 DEFINE_CM_REMOTE_EVENT(insert_failed_err);
314 TRACE_EVENT(icm_send_rep_err,
315 TP_PROTO(
316 __be32 local_id,
317 enum ib_cm_state state
320 TP_ARGS(local_id, state),
322 TP_STRUCT__entry(
323 __field(unsigned int, local_id)
324 __field(unsigned long, state)
327 TP_fast_assign(
328 __entry->local_id = be32_to_cpu(local_id);
329 __entry->state = state;
332 TP_printk("local_id=%u state=%s",
333 __entry->local_id, show_ib_cm_state(__entry->state)
337 TRACE_EVENT(icm_rep_unknown_err,
338 TP_PROTO(
339 unsigned int local_id,
340 unsigned int remote_id,
341 enum ib_cm_state state
344 TP_ARGS(local_id, remote_id, state),
346 TP_STRUCT__entry(
347 __field(unsigned int, local_id)
348 __field(unsigned int, remote_id)
349 __field(unsigned long, state)
352 TP_fast_assign(
353 __entry->local_id = local_id;
354 __entry->remote_id = remote_id;
355 __entry->state = state;
358 TP_printk("local_id=%u remote_id=%u state=%s",
359 __entry->local_id, __entry->remote_id,
360 show_ib_cm_state(__entry->state)
364 TRACE_EVENT(icm_handler_err,
365 TP_PROTO(
366 enum ib_cm_event_type event
369 TP_ARGS(event),
371 TP_STRUCT__entry(
372 __field(unsigned long, event)
375 TP_fast_assign(
376 __entry->event = event;
379 TP_printk("unhandled event=%s",
380 rdma_show_ib_cm_event(__entry->event)
384 TRACE_EVENT(icm_mad_send_err,
385 TP_PROTO(
386 enum ib_cm_state state,
387 enum ib_wc_status wc_status
390 TP_ARGS(state, wc_status),
392 TP_STRUCT__entry(
393 __field(unsigned long, state)
394 __field(unsigned long, wc_status)
397 TP_fast_assign(
398 __entry->state = state;
399 __entry->wc_status = wc_status;
402 TP_printk("state=%s completion status=%s",
403 show_ib_cm_state(__entry->state),
404 rdma_show_wc_status(__entry->wc_status)
408 #endif /* _TRACE_IB_CMA_H */
410 #undef TRACE_INCLUDE_PATH
411 #define TRACE_INCLUDE_PATH ../../drivers/infiniband/core
412 #define TRACE_INCLUDE_FILE cm_trace
414 #include <trace/define_trace.h>