xref: /openbmc/linux/include/trace/events/rpcrdma.h (revision e2c75e76)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (c) 2017 Oracle.  All rights reserved.
4  */
5 #undef TRACE_SYSTEM
6 #define TRACE_SYSTEM rpcrdma
7 
8 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _TRACE_RPCRDMA_H
10 
11 #include <linux/tracepoint.h>
12 #include <trace/events/rdma.h>
13 
14 /**
15  ** Event classes
16  **/
17 
18 DECLARE_EVENT_CLASS(xprtrdma_reply_event,
19 	TP_PROTO(
20 		const struct rpcrdma_rep *rep
21 	),
22 
23 	TP_ARGS(rep),
24 
25 	TP_STRUCT__entry(
26 		__field(const void *, rep)
27 		__field(const void *, r_xprt)
28 		__field(u32, xid)
29 		__field(u32, version)
30 		__field(u32, proc)
31 	),
32 
33 	TP_fast_assign(
34 		__entry->rep = rep;
35 		__entry->r_xprt = rep->rr_rxprt;
36 		__entry->xid = be32_to_cpu(rep->rr_xid);
37 		__entry->version = be32_to_cpu(rep->rr_vers);
38 		__entry->proc = be32_to_cpu(rep->rr_proc);
39 	),
40 
41 	TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u",
42 		__entry->r_xprt, __entry->xid, __entry->rep,
43 		__entry->version, __entry->proc
44 	)
45 );
46 
47 #define DEFINE_REPLY_EVENT(name)					\
48 		DEFINE_EVENT(xprtrdma_reply_event, name,		\
49 				TP_PROTO(				\
50 					const struct rpcrdma_rep *rep	\
51 				),					\
52 				TP_ARGS(rep))
53 
54 DECLARE_EVENT_CLASS(xprtrdma_rxprt,
55 	TP_PROTO(
56 		const struct rpcrdma_xprt *r_xprt
57 	),
58 
59 	TP_ARGS(r_xprt),
60 
61 	TP_STRUCT__entry(
62 		__field(const void *, r_xprt)
63 		__string(addr, rpcrdma_addrstr(r_xprt))
64 		__string(port, rpcrdma_portstr(r_xprt))
65 	),
66 
67 	TP_fast_assign(
68 		__entry->r_xprt = r_xprt;
69 		__assign_str(addr, rpcrdma_addrstr(r_xprt));
70 		__assign_str(port, rpcrdma_portstr(r_xprt));
71 	),
72 
73 	TP_printk("peer=[%s]:%s r_xprt=%p",
74 		__get_str(addr), __get_str(port), __entry->r_xprt
75 	)
76 );
77 
78 #define DEFINE_RXPRT_EVENT(name)					\
79 		DEFINE_EVENT(xprtrdma_rxprt, name,			\
80 				TP_PROTO(				\
81 					const struct rpcrdma_xprt *r_xprt \
82 				),					\
83 				TP_ARGS(r_xprt))
84 
85 DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
86 	TP_PROTO(
87 		const struct rpc_task *task,
88 		unsigned int pos,
89 		struct rpcrdma_mr *mr,
90 		int nsegs
91 	),
92 
93 	TP_ARGS(task, pos, mr, nsegs),
94 
95 	TP_STRUCT__entry(
96 		__field(unsigned int, task_id)
97 		__field(unsigned int, client_id)
98 		__field(const void *, mr)
99 		__field(unsigned int, pos)
100 		__field(int, nents)
101 		__field(u32, handle)
102 		__field(u32, length)
103 		__field(u64, offset)
104 		__field(int, nsegs)
105 	),
106 
107 	TP_fast_assign(
108 		__entry->task_id = task->tk_pid;
109 		__entry->client_id = task->tk_client->cl_clid;
110 		__entry->mr = mr;
111 		__entry->pos = pos;
112 		__entry->nents = mr->mr_nents;
113 		__entry->handle = mr->mr_handle;
114 		__entry->length = mr->mr_length;
115 		__entry->offset = mr->mr_offset;
116 		__entry->nsegs = nsegs;
117 	),
118 
119 	TP_printk("task:%u@%u mr=%p pos=%u %u@0x%016llx:0x%08x (%s)",
120 		__entry->task_id, __entry->client_id, __entry->mr,
121 		__entry->pos, __entry->length,
122 		(unsigned long long)__entry->offset, __entry->handle,
123 		__entry->nents < __entry->nsegs ? "more" : "last"
124 	)
125 );
126 
127 #define DEFINE_RDCH_EVENT(name)						\
128 		DEFINE_EVENT(xprtrdma_rdch_event, name,			\
129 				TP_PROTO(				\
130 					const struct rpc_task *task,	\
131 					unsigned int pos,		\
132 					struct rpcrdma_mr *mr,		\
133 					int nsegs			\
134 				),					\
135 				TP_ARGS(task, pos, mr, nsegs))
136 
137 DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
138 	TP_PROTO(
139 		const struct rpc_task *task,
140 		struct rpcrdma_mr *mr,
141 		int nsegs
142 	),
143 
144 	TP_ARGS(task, mr, nsegs),
145 
146 	TP_STRUCT__entry(
147 		__field(unsigned int, task_id)
148 		__field(unsigned int, client_id)
149 		__field(const void *, mr)
150 		__field(int, nents)
151 		__field(u32, handle)
152 		__field(u32, length)
153 		__field(u64, offset)
154 		__field(int, nsegs)
155 	),
156 
157 	TP_fast_assign(
158 		__entry->task_id = task->tk_pid;
159 		__entry->client_id = task->tk_client->cl_clid;
160 		__entry->mr = mr;
161 		__entry->nents = mr->mr_nents;
162 		__entry->handle = mr->mr_handle;
163 		__entry->length = mr->mr_length;
164 		__entry->offset = mr->mr_offset;
165 		__entry->nsegs = nsegs;
166 	),
167 
168 	TP_printk("task:%u@%u mr=%p %u@0x%016llx:0x%08x (%s)",
169 		__entry->task_id, __entry->client_id, __entry->mr,
170 		__entry->length, (unsigned long long)__entry->offset,
171 		__entry->handle,
172 		__entry->nents < __entry->nsegs ? "more" : "last"
173 	)
174 );
175 
176 #define DEFINE_WRCH_EVENT(name)						\
177 		DEFINE_EVENT(xprtrdma_wrch_event, name,			\
178 				TP_PROTO(				\
179 					const struct rpc_task *task,	\
180 					struct rpcrdma_mr *mr,		\
181 					int nsegs			\
182 				),					\
183 				TP_ARGS(task, mr, nsegs))
184 
185 TRACE_DEFINE_ENUM(FRWR_IS_INVALID);
186 TRACE_DEFINE_ENUM(FRWR_IS_VALID);
187 TRACE_DEFINE_ENUM(FRWR_FLUSHED_FR);
188 TRACE_DEFINE_ENUM(FRWR_FLUSHED_LI);
189 
190 #define xprtrdma_show_frwr_state(x)					\
191 		__print_symbolic(x,					\
192 				{ FRWR_IS_INVALID, "INVALID" },		\
193 				{ FRWR_IS_VALID, "VALID" },		\
194 				{ FRWR_FLUSHED_FR, "FLUSHED_FR" },	\
195 				{ FRWR_FLUSHED_LI, "FLUSHED_LI" })
196 
197 DECLARE_EVENT_CLASS(xprtrdma_frwr_done,
198 	TP_PROTO(
199 		const struct ib_wc *wc,
200 		const struct rpcrdma_frwr *frwr
201 	),
202 
203 	TP_ARGS(wc, frwr),
204 
205 	TP_STRUCT__entry(
206 		__field(const void *, mr)
207 		__field(unsigned int, state)
208 		__field(unsigned int, status)
209 		__field(unsigned int, vendor_err)
210 	),
211 
212 	TP_fast_assign(
213 		__entry->mr = container_of(frwr, struct rpcrdma_mr, frwr);
214 		__entry->state = frwr->fr_state;
215 		__entry->status = wc->status;
216 		__entry->vendor_err = __entry->status ? wc->vendor_err : 0;
217 	),
218 
219 	TP_printk(
220 		"mr=%p state=%s: %s (%u/0x%x)",
221 		__entry->mr, xprtrdma_show_frwr_state(__entry->state),
222 		rdma_show_wc_status(__entry->status),
223 		__entry->status, __entry->vendor_err
224 	)
225 );
226 
227 #define DEFINE_FRWR_DONE_EVENT(name)					\
228 		DEFINE_EVENT(xprtrdma_frwr_done, name,			\
229 				TP_PROTO(				\
230 					const struct ib_wc *wc,		\
231 					const struct rpcrdma_frwr *frwr	\
232 				),					\
233 				TP_ARGS(wc, frwr))
234 
235 DECLARE_EVENT_CLASS(xprtrdma_mr,
236 	TP_PROTO(
237 		const struct rpcrdma_mr *mr
238 	),
239 
240 	TP_ARGS(mr),
241 
242 	TP_STRUCT__entry(
243 		__field(const void *, mr)
244 		__field(u32, handle)
245 		__field(u32, length)
246 		__field(u64, offset)
247 	),
248 
249 	TP_fast_assign(
250 		__entry->mr = mr;
251 		__entry->handle = mr->mr_handle;
252 		__entry->length = mr->mr_length;
253 		__entry->offset = mr->mr_offset;
254 	),
255 
256 	TP_printk("mr=%p %u@0x%016llx:0x%08x",
257 		__entry->mr, __entry->length,
258 		(unsigned long long)__entry->offset,
259 		__entry->handle
260 	)
261 );
262 
263 #define DEFINE_MR_EVENT(name) \
264 		DEFINE_EVENT(xprtrdma_mr, name, \
265 				TP_PROTO( \
266 					const struct rpcrdma_mr *mr \
267 				), \
268 				TP_ARGS(mr))
269 
270 DECLARE_EVENT_CLASS(xprtrdma_cb_event,
271 	TP_PROTO(
272 		const struct rpc_rqst *rqst
273 	),
274 
275 	TP_ARGS(rqst),
276 
277 	TP_STRUCT__entry(
278 		__field(const void *, rqst)
279 		__field(const void *, rep)
280 		__field(const void *, req)
281 		__field(u32, xid)
282 	),
283 
284 	TP_fast_assign(
285 		__entry->rqst = rqst;
286 		__entry->req = rpcr_to_rdmar(rqst);
287 		__entry->rep = rpcr_to_rdmar(rqst)->rl_reply;
288 		__entry->xid = be32_to_cpu(rqst->rq_xid);
289 	),
290 
291 	TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p",
292 		__entry->xid, __entry->rqst, __entry->req, __entry->rep
293 	)
294 );
295 
296 #define DEFINE_CB_EVENT(name)						\
297 		DEFINE_EVENT(xprtrdma_cb_event, name,			\
298 				TP_PROTO(				\
299 					const struct rpc_rqst *rqst	\
300 				),					\
301 				TP_ARGS(rqst))
302 
303 /**
304  ** Connection events
305  **/
306 
307 TRACE_EVENT(xprtrdma_conn_upcall,
308 	TP_PROTO(
309 		const struct rpcrdma_xprt *r_xprt,
310 		struct rdma_cm_event *event
311 	),
312 
313 	TP_ARGS(r_xprt, event),
314 
315 	TP_STRUCT__entry(
316 		__field(const void *, r_xprt)
317 		__field(unsigned int, event)
318 		__field(int, status)
319 		__string(addr, rpcrdma_addrstr(r_xprt))
320 		__string(port, rpcrdma_portstr(r_xprt))
321 	),
322 
323 	TP_fast_assign(
324 		__entry->r_xprt = r_xprt;
325 		__entry->event = event->event;
326 		__entry->status = event->status;
327 		__assign_str(addr, rpcrdma_addrstr(r_xprt));
328 		__assign_str(port, rpcrdma_portstr(r_xprt));
329 	),
330 
331 	TP_printk("peer=[%s]:%s r_xprt=%p: %s (%u/%d)",
332 		__get_str(addr), __get_str(port),
333 		__entry->r_xprt, rdma_show_cm_event(__entry->event),
334 		__entry->event, __entry->status
335 	)
336 );
337 
338 TRACE_EVENT(xprtrdma_disconnect,
339 	TP_PROTO(
340 		const struct rpcrdma_xprt *r_xprt,
341 		int status
342 	),
343 
344 	TP_ARGS(r_xprt, status),
345 
346 	TP_STRUCT__entry(
347 		__field(const void *, r_xprt)
348 		__field(int, status)
349 		__field(int, connected)
350 		__string(addr, rpcrdma_addrstr(r_xprt))
351 		__string(port, rpcrdma_portstr(r_xprt))
352 	),
353 
354 	TP_fast_assign(
355 		__entry->r_xprt = r_xprt;
356 		__entry->status = status;
357 		__entry->connected = r_xprt->rx_ep.rep_connected;
358 		__assign_str(addr, rpcrdma_addrstr(r_xprt));
359 		__assign_str(port, rpcrdma_portstr(r_xprt));
360 	),
361 
362 	TP_printk("peer=[%s]:%s r_xprt=%p: status=%d %sconnected",
363 		__get_str(addr), __get_str(port),
364 		__entry->r_xprt, __entry->status,
365 		__entry->connected == 1 ? "still " : "dis"
366 	)
367 );
368 
369 DEFINE_RXPRT_EVENT(xprtrdma_conn_start);
370 DEFINE_RXPRT_EVENT(xprtrdma_conn_tout);
371 DEFINE_RXPRT_EVENT(xprtrdma_create);
372 DEFINE_RXPRT_EVENT(xprtrdma_destroy);
373 DEFINE_RXPRT_EVENT(xprtrdma_remove);
374 DEFINE_RXPRT_EVENT(xprtrdma_reinsert);
375 DEFINE_RXPRT_EVENT(xprtrdma_reconnect);
376 DEFINE_RXPRT_EVENT(xprtrdma_inject_dsc);
377 
378 TRACE_EVENT(xprtrdma_qp_error,
379 	TP_PROTO(
380 		const struct rpcrdma_xprt *r_xprt,
381 		const struct ib_event *event
382 	),
383 
384 	TP_ARGS(r_xprt, event),
385 
386 	TP_STRUCT__entry(
387 		__field(const void *, r_xprt)
388 		__field(unsigned int, event)
389 		__string(name, event->device->name)
390 		__string(addr, rpcrdma_addrstr(r_xprt))
391 		__string(port, rpcrdma_portstr(r_xprt))
392 	),
393 
394 	TP_fast_assign(
395 		__entry->r_xprt = r_xprt;
396 		__entry->event = event->event;
397 		__assign_str(name, event->device->name);
398 		__assign_str(addr, rpcrdma_addrstr(r_xprt));
399 		__assign_str(port, rpcrdma_portstr(r_xprt));
400 	),
401 
402 	TP_printk("peer=[%s]:%s r_xprt=%p: dev %s: %s (%u)",
403 		__get_str(addr), __get_str(port), __entry->r_xprt,
404 		__get_str(name), rdma_show_ib_event(__entry->event),
405 		__entry->event
406 	)
407 );
408 
409 /**
410  ** Call events
411  **/
412 
413 TRACE_EVENT(xprtrdma_createmrs,
414 	TP_PROTO(
415 		const struct rpcrdma_xprt *r_xprt,
416 		unsigned int count
417 	),
418 
419 	TP_ARGS(r_xprt, count),
420 
421 	TP_STRUCT__entry(
422 		__field(const void *, r_xprt)
423 		__field(unsigned int, count)
424 	),
425 
426 	TP_fast_assign(
427 		__entry->r_xprt = r_xprt;
428 		__entry->count = count;
429 	),
430 
431 	TP_printk("r_xprt=%p: created %u MRs",
432 		__entry->r_xprt, __entry->count
433 	)
434 );
435 
436 DEFINE_RXPRT_EVENT(xprtrdma_nomrs);
437 
438 DEFINE_RDCH_EVENT(xprtrdma_read_chunk);
439 DEFINE_WRCH_EVENT(xprtrdma_write_chunk);
440 DEFINE_WRCH_EVENT(xprtrdma_reply_chunk);
441 
442 TRACE_DEFINE_ENUM(rpcrdma_noch);
443 TRACE_DEFINE_ENUM(rpcrdma_readch);
444 TRACE_DEFINE_ENUM(rpcrdma_areadch);
445 TRACE_DEFINE_ENUM(rpcrdma_writech);
446 TRACE_DEFINE_ENUM(rpcrdma_replych);
447 
448 #define xprtrdma_show_chunktype(x)					\
449 		__print_symbolic(x,					\
450 				{ rpcrdma_noch, "inline" },		\
451 				{ rpcrdma_readch, "read list" },	\
452 				{ rpcrdma_areadch, "*read list" },	\
453 				{ rpcrdma_writech, "write list" },	\
454 				{ rpcrdma_replych, "reply chunk" })
455 
456 TRACE_EVENT(xprtrdma_marshal,
457 	TP_PROTO(
458 		const struct rpc_rqst *rqst,
459 		unsigned int hdrlen,
460 		unsigned int rtype,
461 		unsigned int wtype
462 	),
463 
464 	TP_ARGS(rqst, hdrlen, rtype, wtype),
465 
466 	TP_STRUCT__entry(
467 		__field(unsigned int, task_id)
468 		__field(unsigned int, client_id)
469 		__field(u32, xid)
470 		__field(unsigned int, hdrlen)
471 		__field(unsigned int, headlen)
472 		__field(unsigned int, pagelen)
473 		__field(unsigned int, taillen)
474 		__field(unsigned int, rtype)
475 		__field(unsigned int, wtype)
476 	),
477 
478 	TP_fast_assign(
479 		__entry->task_id = rqst->rq_task->tk_pid;
480 		__entry->client_id = rqst->rq_task->tk_client->cl_clid;
481 		__entry->xid = be32_to_cpu(rqst->rq_xid);
482 		__entry->hdrlen = hdrlen;
483 		__entry->headlen = rqst->rq_snd_buf.head[0].iov_len;
484 		__entry->pagelen = rqst->rq_snd_buf.page_len;
485 		__entry->taillen = rqst->rq_snd_buf.tail[0].iov_len;
486 		__entry->rtype = rtype;
487 		__entry->wtype = wtype;
488 	),
489 
490 	TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s",
491 		__entry->task_id, __entry->client_id, __entry->xid,
492 		__entry->hdrlen,
493 		__entry->headlen, __entry->pagelen, __entry->taillen,
494 		xprtrdma_show_chunktype(__entry->rtype),
495 		xprtrdma_show_chunktype(__entry->wtype)
496 	)
497 );
498 
499 TRACE_EVENT(xprtrdma_post_send,
500 	TP_PROTO(
501 		const struct rpcrdma_req *req,
502 		int status
503 	),
504 
505 	TP_ARGS(req, status),
506 
507 	TP_STRUCT__entry(
508 		__field(const void *, req)
509 		__field(int, num_sge)
510 		__field(bool, signaled)
511 		__field(int, status)
512 	),
513 
514 	TP_fast_assign(
515 		__entry->req = req;
516 		__entry->num_sge = req->rl_sendctx->sc_wr.num_sge;
517 		__entry->signaled = req->rl_sendctx->sc_wr.send_flags &
518 				    IB_SEND_SIGNALED;
519 		__entry->status = status;
520 	),
521 
522 	TP_printk("req=%p, %d SGEs%s, status=%d",
523 		__entry->req, __entry->num_sge,
524 		(__entry->signaled ? ", signaled" : ""),
525 		__entry->status
526 	)
527 );
528 
529 TRACE_EVENT(xprtrdma_post_recv,
530 	TP_PROTO(
531 		const struct rpcrdma_rep *rep,
532 		int status
533 	),
534 
535 	TP_ARGS(rep, status),
536 
537 	TP_STRUCT__entry(
538 		__field(const void *, rep)
539 		__field(int, status)
540 	),
541 
542 	TP_fast_assign(
543 		__entry->rep = rep;
544 		__entry->status = status;
545 	),
546 
547 	TP_printk("rep=%p status=%d",
548 		__entry->rep, __entry->status
549 	)
550 );
551 
552 /**
553  ** Completion events
554  **/
555 
556 TRACE_EVENT(xprtrdma_wc_send,
557 	TP_PROTO(
558 		const struct rpcrdma_sendctx *sc,
559 		const struct ib_wc *wc
560 	),
561 
562 	TP_ARGS(sc, wc),
563 
564 	TP_STRUCT__entry(
565 		__field(const void *, req)
566 		__field(unsigned int, unmap_count)
567 		__field(unsigned int, status)
568 		__field(unsigned int, vendor_err)
569 	),
570 
571 	TP_fast_assign(
572 		__entry->req = sc->sc_req;
573 		__entry->unmap_count = sc->sc_unmap_count;
574 		__entry->status = wc->status;
575 		__entry->vendor_err = __entry->status ? wc->vendor_err : 0;
576 	),
577 
578 	TP_printk("req=%p, unmapped %u pages: %s (%u/0x%x)",
579 		__entry->req, __entry->unmap_count,
580 		rdma_show_wc_status(__entry->status),
581 		__entry->status, __entry->vendor_err
582 	)
583 );
584 
585 TRACE_EVENT(xprtrdma_wc_receive,
586 	TP_PROTO(
587 		const struct rpcrdma_rep *rep,
588 		const struct ib_wc *wc
589 	),
590 
591 	TP_ARGS(rep, wc),
592 
593 	TP_STRUCT__entry(
594 		__field(const void *, rep)
595 		__field(unsigned int, byte_len)
596 		__field(unsigned int, status)
597 		__field(unsigned int, vendor_err)
598 	),
599 
600 	TP_fast_assign(
601 		__entry->rep = rep;
602 		__entry->byte_len = wc->byte_len;
603 		__entry->status = wc->status;
604 		__entry->vendor_err = __entry->status ? wc->vendor_err : 0;
605 	),
606 
607 	TP_printk("rep=%p, %u bytes: %s (%u/0x%x)",
608 		__entry->rep, __entry->byte_len,
609 		rdma_show_wc_status(__entry->status),
610 		__entry->status, __entry->vendor_err
611 	)
612 );
613 
614 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg);
615 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li);
616 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake);
617 
618 DEFINE_MR_EVENT(xprtrdma_localinv);
619 DEFINE_MR_EVENT(xprtrdma_dma_unmap);
620 DEFINE_MR_EVENT(xprtrdma_remoteinv);
621 DEFINE_MR_EVENT(xprtrdma_recover_mr);
622 
623 /**
624  ** Reply events
625  **/
626 
627 TRACE_EVENT(xprtrdma_reply,
628 	TP_PROTO(
629 		const struct rpc_task *task,
630 		const struct rpcrdma_rep *rep,
631 		const struct rpcrdma_req *req,
632 		unsigned int credits
633 	),
634 
635 	TP_ARGS(task, rep, req, credits),
636 
637 	TP_STRUCT__entry(
638 		__field(unsigned int, task_id)
639 		__field(unsigned int, client_id)
640 		__field(const void *, rep)
641 		__field(const void *, req)
642 		__field(u32, xid)
643 		__field(unsigned int, credits)
644 	),
645 
646 	TP_fast_assign(
647 		__entry->task_id = task->tk_pid;
648 		__entry->client_id = task->tk_client->cl_clid;
649 		__entry->rep = rep;
650 		__entry->req = req;
651 		__entry->xid = be32_to_cpu(rep->rr_xid);
652 		__entry->credits = credits;
653 	),
654 
655 	TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p",
656 		__entry->task_id, __entry->client_id, __entry->xid,
657 		__entry->credits, __entry->rep, __entry->req
658 	)
659 );
660 
661 TRACE_EVENT(xprtrdma_defer_cmp,
662 	TP_PROTO(
663 		const struct rpcrdma_rep *rep
664 	),
665 
666 	TP_ARGS(rep),
667 
668 	TP_STRUCT__entry(
669 		__field(unsigned int, task_id)
670 		__field(unsigned int, client_id)
671 		__field(const void *, rep)
672 		__field(u32, xid)
673 	),
674 
675 	TP_fast_assign(
676 		__entry->task_id = rep->rr_rqst->rq_task->tk_pid;
677 		__entry->client_id = rep->rr_rqst->rq_task->tk_client->cl_clid;
678 		__entry->rep = rep;
679 		__entry->xid = be32_to_cpu(rep->rr_xid);
680 	),
681 
682 	TP_printk("task:%u@%u xid=0x%08x rep=%p",
683 		__entry->task_id, __entry->client_id, __entry->xid,
684 		__entry->rep
685 	)
686 );
687 
688 DEFINE_REPLY_EVENT(xprtrdma_reply_vers);
689 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst);
690 DEFINE_REPLY_EVENT(xprtrdma_reply_short);
691 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr);
692 
693 TRACE_EVENT(xprtrdma_fixup,
694 	TP_PROTO(
695 		const struct rpc_rqst *rqst,
696 		int len,
697 		int hdrlen
698 	),
699 
700 	TP_ARGS(rqst, len, hdrlen),
701 
702 	TP_STRUCT__entry(
703 		__field(unsigned int, task_id)
704 		__field(unsigned int, client_id)
705 		__field(const void *, base)
706 		__field(int, len)
707 		__field(int, hdrlen)
708 	),
709 
710 	TP_fast_assign(
711 		__entry->task_id = rqst->rq_task->tk_pid;
712 		__entry->client_id = rqst->rq_task->tk_client->cl_clid;
713 		__entry->base = rqst->rq_rcv_buf.head[0].iov_base;
714 		__entry->len = len;
715 		__entry->hdrlen = hdrlen;
716 	),
717 
718 	TP_printk("task:%u@%u base=%p len=%d hdrlen=%d",
719 		__entry->task_id, __entry->client_id,
720 		__entry->base, __entry->len, __entry->hdrlen
721 	)
722 );
723 
724 TRACE_EVENT(xprtrdma_fixup_pg,
725 	TP_PROTO(
726 		const struct rpc_rqst *rqst,
727 		int pageno,
728 		const void *pos,
729 		int len,
730 		int curlen
731 	),
732 
733 	TP_ARGS(rqst, pageno, pos, len, curlen),
734 
735 	TP_STRUCT__entry(
736 		__field(unsigned int, task_id)
737 		__field(unsigned int, client_id)
738 		__field(const void *, pos)
739 		__field(int, pageno)
740 		__field(int, len)
741 		__field(int, curlen)
742 	),
743 
744 	TP_fast_assign(
745 		__entry->task_id = rqst->rq_task->tk_pid;
746 		__entry->client_id = rqst->rq_task->tk_client->cl_clid;
747 		__entry->pos = pos;
748 		__entry->pageno = pageno;
749 		__entry->len = len;
750 		__entry->curlen = curlen;
751 	),
752 
753 	TP_printk("task:%u@%u pageno=%d pos=%p len=%d curlen=%d",
754 		__entry->task_id, __entry->client_id,
755 		__entry->pageno, __entry->pos, __entry->len, __entry->curlen
756 	)
757 );
758 
759 TRACE_EVENT(xprtrdma_decode_seg,
760 	TP_PROTO(
761 		u32 handle,
762 		u32 length,
763 		u64 offset
764 	),
765 
766 	TP_ARGS(handle, length, offset),
767 
768 	TP_STRUCT__entry(
769 		__field(u32, handle)
770 		__field(u32, length)
771 		__field(u64, offset)
772 	),
773 
774 	TP_fast_assign(
775 		__entry->handle = handle;
776 		__entry->length = length;
777 		__entry->offset = offset;
778 	),
779 
780 	TP_printk("%u@0x%016llx:0x%08x",
781 		__entry->length, (unsigned long long)__entry->offset,
782 		__entry->handle
783 	)
784 );
785 
786 /**
787  ** Allocation/release of rpcrdma_reqs and rpcrdma_reps
788  **/
789 
790 TRACE_EVENT(xprtrdma_allocate,
791 	TP_PROTO(
792 		const struct rpc_task *task,
793 		const struct rpcrdma_req *req
794 	),
795 
796 	TP_ARGS(task, req),
797 
798 	TP_STRUCT__entry(
799 		__field(unsigned int, task_id)
800 		__field(unsigned int, client_id)
801 		__field(const void *, req)
802 		__field(const void *, rep)
803 		__field(size_t, callsize)
804 		__field(size_t, rcvsize)
805 	),
806 
807 	TP_fast_assign(
808 		__entry->task_id = task->tk_pid;
809 		__entry->client_id = task->tk_client->cl_clid;
810 		__entry->req = req;
811 		__entry->rep = req ? req->rl_reply : NULL;
812 		__entry->callsize = task->tk_rqstp->rq_callsize;
813 		__entry->rcvsize = task->tk_rqstp->rq_rcvsize;
814 	),
815 
816 	TP_printk("task:%u@%u req=%p rep=%p (%zu, %zu)",
817 		__entry->task_id, __entry->client_id,
818 		__entry->req, __entry->rep,
819 		__entry->callsize, __entry->rcvsize
820 	)
821 );
822 
823 TRACE_EVENT(xprtrdma_rpc_done,
824 	TP_PROTO(
825 		const struct rpc_task *task,
826 		const struct rpcrdma_req *req
827 	),
828 
829 	TP_ARGS(task, req),
830 
831 	TP_STRUCT__entry(
832 		__field(unsigned int, task_id)
833 		__field(unsigned int, client_id)
834 		__field(const void *, req)
835 		__field(const void *, rep)
836 	),
837 
838 	TP_fast_assign(
839 		__entry->task_id = task->tk_pid;
840 		__entry->client_id = task->tk_client->cl_clid;
841 		__entry->req = req;
842 		__entry->rep = req->rl_reply;
843 	),
844 
845 	TP_printk("task:%u@%u req=%p rep=%p",
846 		__entry->task_id, __entry->client_id,
847 		__entry->req, __entry->rep
848 	)
849 );
850 
851 DEFINE_RXPRT_EVENT(xprtrdma_noreps);
852 
853 /**
854  ** Callback events
855  **/
856 
857 TRACE_EVENT(xprtrdma_cb_setup,
858 	TP_PROTO(
859 		const struct rpcrdma_xprt *r_xprt,
860 		unsigned int reqs
861 	),
862 
863 	TP_ARGS(r_xprt, reqs),
864 
865 	TP_STRUCT__entry(
866 		__field(const void *, r_xprt)
867 		__field(unsigned int, reqs)
868 		__string(addr, rpcrdma_addrstr(r_xprt))
869 		__string(port, rpcrdma_portstr(r_xprt))
870 	),
871 
872 	TP_fast_assign(
873 		__entry->r_xprt = r_xprt;
874 		__entry->reqs = reqs;
875 		__assign_str(addr, rpcrdma_addrstr(r_xprt));
876 		__assign_str(port, rpcrdma_portstr(r_xprt));
877 	),
878 
879 	TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs",
880 		__get_str(addr), __get_str(port),
881 		__entry->r_xprt, __entry->reqs
882 	)
883 );
884 
885 DEFINE_CB_EVENT(xprtrdma_cb_call);
886 DEFINE_CB_EVENT(xprtrdma_cb_reply);
887 
888 #endif /* _TRACE_RPCRDMA_H */
889 
890 #include <trace/define_trace.h>
891