1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Trace point definitions for the RDMA Connect Manager.
5 * Author: Chuck Lever <chuck.lever@oracle.com>
7 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
11 #define TRACE_SYSTEM rdma_cma
13 #if !defined(_TRACE_RDMA_CMA_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_RDMA_CMA_H
17 #include <linux/tracepoint.h>
18 #include <trace/events/rdma.h>
21 * enum ib_cm_event_type, from include/rdma/ib_cm.h
23 #define IB_CM_EVENT_LIST \
24 ib_cm_event(REQ_ERROR) \
25 ib_cm_event(REQ_RECEIVED) \
26 ib_cm_event(REP_ERROR) \
27 ib_cm_event(REP_RECEIVED) \
28 ib_cm_event(RTU_RECEIVED) \
29 ib_cm_event(USER_ESTABLISHED) \
30 ib_cm_event(DREQ_ERROR) \
31 ib_cm_event(DREQ_RECEIVED) \
32 ib_cm_event(DREP_RECEIVED) \
33 ib_cm_event(TIMEWAIT_EXIT) \
34 ib_cm_event(MRA_RECEIVED) \
35 ib_cm_event(REJ_RECEIVED) \
36 ib_cm_event(LAP_ERROR) \
37 ib_cm_event(LAP_RECEIVED) \
38 ib_cm_event(APR_RECEIVED) \
39 ib_cm_event(SIDR_REQ_ERROR) \
40 ib_cm_event(SIDR_REQ_RECEIVED) \
41 ib_cm_event_end(SIDR_REP_RECEIVED)
44 #undef ib_cm_event_end
46 #define ib_cm_event(x) TRACE_DEFINE_ENUM(IB_CM_##x);
47 #define ib_cm_event_end(x) TRACE_DEFINE_ENUM(IB_CM_##x);
52 #undef ib_cm_event_end
54 #define ib_cm_event(x) { IB_CM_##x, #x },
55 #define ib_cm_event_end(x) { IB_CM_##x, #x }
57 #define rdma_show_ib_cm_event(x) \
58 __print_symbolic(x, IB_CM_EVENT_LIST)
61 DECLARE_EVENT_CLASS(cma_fsm_class
,
63 const struct rdma_id_private
*id_priv
71 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
72 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
76 __entry
->cm_id
= id_priv
->res
.id
;
77 __entry
->tos
= id_priv
->tos
;
78 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
79 sizeof(struct sockaddr_in6
));
80 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
81 sizeof(struct sockaddr_in6
));
84 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u",
85 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
89 #define DEFINE_CMA_FSM_EVENT(name) \
90 DEFINE_EVENT(cma_fsm_class, cm_##name, \
92 const struct rdma_id_private *id_priv \
96 DEFINE_CMA_FSM_EVENT(send_rtu
);
97 DEFINE_CMA_FSM_EVENT(send_rej
);
98 DEFINE_CMA_FSM_EVENT(send_mra
);
99 DEFINE_CMA_FSM_EVENT(send_sidr_req
);
100 DEFINE_CMA_FSM_EVENT(send_sidr_rep
);
101 DEFINE_CMA_FSM_EVENT(disconnect
);
102 DEFINE_CMA_FSM_EVENT(sent_drep
);
103 DEFINE_CMA_FSM_EVENT(sent_dreq
);
104 DEFINE_CMA_FSM_EVENT(id_destroy
);
106 TRACE_EVENT(cm_id_create
,
108 const struct rdma_id_private
*id_priv
118 __entry
->cm_id
= id_priv
->res
.id
;
121 TP_printk("cm.id=%u",
126 DECLARE_EVENT_CLASS(cma_qp_class
,
128 const struct rdma_id_private
*id_priv
137 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
138 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
142 __entry
->cm_id
= id_priv
->res
.id
;
143 __entry
->tos
= id_priv
->tos
;
144 __entry
->qp_num
= id_priv
->qp_num
;
145 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
146 sizeof(struct sockaddr_in6
));
147 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
148 sizeof(struct sockaddr_in6
));
151 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u qp_num=%u",
152 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
157 #define DEFINE_CMA_QP_EVENT(name) \
158 DEFINE_EVENT(cma_qp_class, cm_##name, \
160 const struct rdma_id_private *id_priv \
164 DEFINE_CMA_QP_EVENT(send_req
);
165 DEFINE_CMA_QP_EVENT(send_rep
);
166 DEFINE_CMA_QP_EVENT(qp_destroy
);
169 * enum ib_wp_type, from include/rdma/ib_verbs.h
171 #define IB_QP_TYPE_LIST \
177 ib_qp_type(RAW_IPV6) \
178 ib_qp_type(RAW_ETHERTYPE) \
179 ib_qp_type(RAW_PACKET) \
180 ib_qp_type(XRC_INI) \
181 ib_qp_type_end(XRC_TGT)
184 #undef ib_qp_type_end
186 #define ib_qp_type(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
187 #define ib_qp_type_end(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
192 #undef ib_qp_type_end
194 #define ib_qp_type(x) { IB_QPT_##x, #x },
195 #define ib_qp_type_end(x) { IB_QPT_##x, #x }
197 #define rdma_show_qp_type(x) \
198 __print_symbolic(x, IB_QP_TYPE_LIST)
201 TRACE_EVENT(cm_qp_create
,
203 const struct rdma_id_private
*id_priv
,
204 const struct ib_pd
*pd
,
205 const struct ib_qp_init_attr
*qp_init_attr
,
209 TP_ARGS(id_priv
, pd
, qp_init_attr
, rc
),
216 __field(u32
, send_wr
)
217 __field(u32
, recv_wr
)
219 __field(unsigned long, qp_type
)
220 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
221 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
225 __entry
->cm_id
= id_priv
->res
.id
;
226 __entry
->pd_id
= pd
->res
.id
;
227 __entry
->tos
= id_priv
->tos
;
228 __entry
->send_wr
= qp_init_attr
->cap
.max_send_wr
;
229 __entry
->recv_wr
= qp_init_attr
->cap
.max_recv_wr
;
232 __entry
->qp_num
= id_priv
->qp_num
;
233 __entry
->qp_type
= id_priv
->id
.qp_type
;
236 __entry
->qp_type
= 0;
238 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
239 sizeof(struct sockaddr_in6
));
240 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
241 sizeof(struct sockaddr_in6
));
244 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u pd.id=%u qp_type=%s"
245 " send_wr=%u recv_wr=%u qp_num=%u rc=%d",
246 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
,
247 __entry
->tos
, __entry
->pd_id
,
248 rdma_show_qp_type(__entry
->qp_type
), __entry
->send_wr
,
249 __entry
->recv_wr
, __entry
->qp_num
, __entry
->rc
253 TRACE_EVENT(cm_req_handler
,
255 const struct rdma_id_private
*id_priv
,
259 TP_ARGS(id_priv
, event
),
264 __field(unsigned long, event
)
265 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
266 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
270 __entry
->cm_id
= id_priv
->res
.id
;
271 __entry
->tos
= id_priv
->tos
;
272 __entry
->event
= event
;
273 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
274 sizeof(struct sockaddr_in6
));
275 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
276 sizeof(struct sockaddr_in6
));
279 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu)",
280 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
281 rdma_show_ib_cm_event(__entry
->event
), __entry
->event
285 TRACE_EVENT(cm_event_handler
,
287 const struct rdma_id_private
*id_priv
,
288 const struct rdma_cm_event
*event
291 TP_ARGS(id_priv
, event
),
296 __field(unsigned long, event
)
298 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
299 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
303 __entry
->cm_id
= id_priv
->res
.id
;
304 __entry
->tos
= id_priv
->tos
;
305 __entry
->event
= event
->event
;
306 __entry
->status
= event
->status
;
307 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
308 sizeof(struct sockaddr_in6
));
309 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
310 sizeof(struct sockaddr_in6
));
313 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu/%d)",
314 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
315 rdma_show_cm_event(__entry
->event
), __entry
->event
,
320 TRACE_EVENT(cm_event_done
,
322 const struct rdma_id_private
*id_priv
,
323 const struct rdma_cm_event
*event
,
327 TP_ARGS(id_priv
, event
, result
),
332 __field(unsigned long, event
)
334 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
335 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
339 __entry
->cm_id
= id_priv
->res
.id
;
340 __entry
->tos
= id_priv
->tos
;
341 __entry
->event
= event
->event
;
342 __entry
->result
= result
;
343 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
344 sizeof(struct sockaddr_in6
));
345 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
346 sizeof(struct sockaddr_in6
));
349 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s consumer returns %d",
350 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
351 rdma_show_cm_event(__entry
->event
), __entry
->result
355 DECLARE_EVENT_CLASS(cma_client_class
,
357 const struct ib_device
*device
363 __string(name
, device
->name
)
367 __assign_str(name
, device
->name
);
370 TP_printk("device name=%s",
375 #define DEFINE_CMA_CLIENT_EVENT(name) \
376 DEFINE_EVENT(cma_client_class, cm_##name, \
378 const struct ib_device *device \
382 DEFINE_CMA_CLIENT_EVENT(add_one
);
383 DEFINE_CMA_CLIENT_EVENT(remove_one
);
385 #endif /* _TRACE_RDMA_CMA_H */
387 #undef TRACE_INCLUDE_PATH
388 #define TRACE_INCLUDE_PATH .
389 #define TRACE_INCLUDE_FILE cma_trace
391 #include <trace/define_trace.h>