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 DECLARE_EVENT_CLASS(cma_fsm_class
,
23 const struct rdma_id_private
*id_priv
31 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
32 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
36 __entry
->cm_id
= id_priv
->res
.id
;
37 __entry
->tos
= id_priv
->tos
;
38 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
39 sizeof(struct sockaddr_in6
));
40 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
41 sizeof(struct sockaddr_in6
));
44 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u",
45 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
49 #define DEFINE_CMA_FSM_EVENT(name) \
50 DEFINE_EVENT(cma_fsm_class, cm_##name, \
52 const struct rdma_id_private *id_priv \
56 DEFINE_CMA_FSM_EVENT(send_rtu
);
57 DEFINE_CMA_FSM_EVENT(send_rej
);
58 DEFINE_CMA_FSM_EVENT(send_mra
);
59 DEFINE_CMA_FSM_EVENT(send_sidr_req
);
60 DEFINE_CMA_FSM_EVENT(send_sidr_rep
);
61 DEFINE_CMA_FSM_EVENT(disconnect
);
62 DEFINE_CMA_FSM_EVENT(sent_drep
);
63 DEFINE_CMA_FSM_EVENT(sent_dreq
);
64 DEFINE_CMA_FSM_EVENT(id_destroy
);
66 TRACE_EVENT(cm_id_attach
,
68 const struct rdma_id_private
*id_priv
,
69 const struct ib_device
*device
72 TP_ARGS(id_priv
, device
),
76 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
77 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
78 __string(devname
, device
->name
)
82 __entry
->cm_id
= id_priv
->res
.id
;
83 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
84 sizeof(struct sockaddr_in6
));
85 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
86 sizeof(struct sockaddr_in6
));
87 __assign_str(devname
, device
->name
);
90 TP_printk("cm.id=%u src=%pISpc dst=%pISpc device=%s",
91 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
,
96 DECLARE_EVENT_CLASS(cma_qp_class
,
98 const struct rdma_id_private
*id_priv
107 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
108 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
112 __entry
->cm_id
= id_priv
->res
.id
;
113 __entry
->tos
= id_priv
->tos
;
114 __entry
->qp_num
= id_priv
->qp_num
;
115 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
116 sizeof(struct sockaddr_in6
));
117 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
118 sizeof(struct sockaddr_in6
));
121 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u qp_num=%u",
122 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
127 #define DEFINE_CMA_QP_EVENT(name) \
128 DEFINE_EVENT(cma_qp_class, cm_##name, \
130 const struct rdma_id_private *id_priv \
134 DEFINE_CMA_QP_EVENT(send_req
);
135 DEFINE_CMA_QP_EVENT(send_rep
);
136 DEFINE_CMA_QP_EVENT(qp_destroy
);
139 * enum ib_wp_type, from include/rdma/ib_verbs.h
141 #define IB_QP_TYPE_LIST \
147 ib_qp_type(RAW_IPV6) \
148 ib_qp_type(RAW_ETHERTYPE) \
149 ib_qp_type(RAW_PACKET) \
150 ib_qp_type(XRC_INI) \
151 ib_qp_type_end(XRC_TGT)
154 #undef ib_qp_type_end
156 #define ib_qp_type(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
157 #define ib_qp_type_end(x) TRACE_DEFINE_ENUM(IB_QPT_##x);
162 #undef ib_qp_type_end
164 #define ib_qp_type(x) { IB_QPT_##x, #x },
165 #define ib_qp_type_end(x) { IB_QPT_##x, #x }
167 #define rdma_show_qp_type(x) \
168 __print_symbolic(x, IB_QP_TYPE_LIST)
171 TRACE_EVENT(cm_qp_create
,
173 const struct rdma_id_private
*id_priv
,
174 const struct ib_pd
*pd
,
175 const struct ib_qp_init_attr
*qp_init_attr
,
179 TP_ARGS(id_priv
, pd
, qp_init_attr
, rc
),
186 __field(u32
, send_wr
)
187 __field(u32
, recv_wr
)
189 __field(unsigned long, qp_type
)
190 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
191 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
195 __entry
->cm_id
= id_priv
->res
.id
;
196 __entry
->pd_id
= pd
->res
.id
;
197 __entry
->tos
= id_priv
->tos
;
198 __entry
->send_wr
= qp_init_attr
->cap
.max_send_wr
;
199 __entry
->recv_wr
= qp_init_attr
->cap
.max_recv_wr
;
202 __entry
->qp_num
= id_priv
->qp_num
;
203 __entry
->qp_type
= id_priv
->id
.qp_type
;
206 __entry
->qp_type
= 0;
208 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
209 sizeof(struct sockaddr_in6
));
210 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
211 sizeof(struct sockaddr_in6
));
214 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u pd.id=%u qp_type=%s"
215 " send_wr=%u recv_wr=%u qp_num=%u rc=%d",
216 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
,
217 __entry
->tos
, __entry
->pd_id
,
218 rdma_show_qp_type(__entry
->qp_type
), __entry
->send_wr
,
219 __entry
->recv_wr
, __entry
->qp_num
, __entry
->rc
223 TRACE_EVENT(cm_req_handler
,
225 const struct rdma_id_private
*id_priv
,
229 TP_ARGS(id_priv
, event
),
234 __field(unsigned long, event
)
235 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
236 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
240 __entry
->cm_id
= id_priv
->res
.id
;
241 __entry
->tos
= id_priv
->tos
;
242 __entry
->event
= event
;
243 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
244 sizeof(struct sockaddr_in6
));
245 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
246 sizeof(struct sockaddr_in6
));
249 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu)",
250 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
251 rdma_show_ib_cm_event(__entry
->event
), __entry
->event
255 TRACE_EVENT(cm_event_handler
,
257 const struct rdma_id_private
*id_priv
,
258 const struct rdma_cm_event
*event
261 TP_ARGS(id_priv
, event
),
266 __field(unsigned long, event
)
268 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
269 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
273 __entry
->cm_id
= id_priv
->res
.id
;
274 __entry
->tos
= id_priv
->tos
;
275 __entry
->event
= event
->event
;
276 __entry
->status
= event
->status
;
277 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
278 sizeof(struct sockaddr_in6
));
279 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
280 sizeof(struct sockaddr_in6
));
283 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s (%lu/%d)",
284 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
285 rdma_show_cm_event(__entry
->event
), __entry
->event
,
290 TRACE_EVENT(cm_event_done
,
292 const struct rdma_id_private
*id_priv
,
293 const struct rdma_cm_event
*event
,
297 TP_ARGS(id_priv
, event
, result
),
302 __field(unsigned long, event
)
304 __array(unsigned char, srcaddr
, sizeof(struct sockaddr_in6
))
305 __array(unsigned char, dstaddr
, sizeof(struct sockaddr_in6
))
309 __entry
->cm_id
= id_priv
->res
.id
;
310 __entry
->tos
= id_priv
->tos
;
311 __entry
->event
= event
->event
;
312 __entry
->result
= result
;
313 memcpy(__entry
->srcaddr
, &id_priv
->id
.route
.addr
.src_addr
,
314 sizeof(struct sockaddr_in6
));
315 memcpy(__entry
->dstaddr
, &id_priv
->id
.route
.addr
.dst_addr
,
316 sizeof(struct sockaddr_in6
));
319 TP_printk("cm.id=%u src=%pISpc dst=%pISpc tos=%u %s consumer returns %d",
320 __entry
->cm_id
, __entry
->srcaddr
, __entry
->dstaddr
, __entry
->tos
,
321 rdma_show_cm_event(__entry
->event
), __entry
->result
325 DECLARE_EVENT_CLASS(cma_client_class
,
327 const struct ib_device
*device
333 __string(name
, device
->name
)
337 __assign_str(name
, device
->name
);
340 TP_printk("device name=%s",
345 #define DEFINE_CMA_CLIENT_EVENT(name) \
346 DEFINE_EVENT(cma_client_class, cm_##name, \
348 const struct ib_device *device \
352 DEFINE_CMA_CLIENT_EVENT(add_one
);
353 DEFINE_CMA_CLIENT_EVENT(remove_one
);
355 #endif /* _TRACE_RDMA_CMA_H */
357 #undef TRACE_INCLUDE_PATH
358 #define TRACE_INCLUDE_PATH .
359 #define TRACE_INCLUDE_FILE cma_trace
361 #include <trace/define_trace.h>