1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2017, 2018 Oracle. All rights reserved.
5 * Trace point definitions for the "rpcrdma" subsystem.
8 #define TRACE_SYSTEM rpcrdma
10 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_RPCRDMA_H
13 #include <linux/scatterlist.h>
14 #include <linux/tracepoint.h>
15 #include <trace/events/rdma.h>
21 DECLARE_EVENT_CLASS(xprtrdma_reply_event
,
23 const struct rpcrdma_rep
*rep
29 __field(const void *, rep
)
30 __field(const void *, r_xprt
)
38 __entry
->r_xprt
= rep
->rr_rxprt
;
39 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
40 __entry
->version
= be32_to_cpu(rep
->rr_vers
);
41 __entry
->proc
= be32_to_cpu(rep
->rr_proc
);
44 TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u",
45 __entry
->r_xprt
, __entry
->xid
, __entry
->rep
,
46 __entry
->version
, __entry
->proc
50 #define DEFINE_REPLY_EVENT(name) \
51 DEFINE_EVENT(xprtrdma_reply_event, name, \
53 const struct rpcrdma_rep *rep \
57 DECLARE_EVENT_CLASS(xprtrdma_rxprt
,
59 const struct rpcrdma_xprt
*r_xprt
65 __field(const void *, r_xprt
)
66 __string(addr
, rpcrdma_addrstr(r_xprt
))
67 __string(port
, rpcrdma_portstr(r_xprt
))
71 __entry
->r_xprt
= r_xprt
;
72 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
73 __assign_str(port
, rpcrdma_portstr(r_xprt
));
76 TP_printk("peer=[%s]:%s r_xprt=%p",
77 __get_str(addr
), __get_str(port
), __entry
->r_xprt
81 #define DEFINE_RXPRT_EVENT(name) \
82 DEFINE_EVENT(xprtrdma_rxprt, name, \
84 const struct rpcrdma_xprt *r_xprt \
88 DECLARE_EVENT_CLASS(xprtrdma_rdch_event
,
90 const struct rpc_task
*task
,
92 struct rpcrdma_mr
*mr
,
96 TP_ARGS(task
, pos
, mr
, nsegs
),
99 __field(unsigned int, task_id
)
100 __field(unsigned int, client_id
)
101 __field(unsigned int, pos
)
110 __entry
->task_id
= task
->tk_pid
;
111 __entry
->client_id
= task
->tk_client
->cl_clid
;
113 __entry
->nents
= mr
->mr_nents
;
114 __entry
->handle
= mr
->mr_handle
;
115 __entry
->length
= mr
->mr_length
;
116 __entry
->offset
= mr
->mr_offset
;
117 __entry
->nsegs
= nsegs
;
120 TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)",
121 __entry
->task_id
, __entry
->client_id
,
122 __entry
->pos
, __entry
->length
,
123 (unsigned long long)__entry
->offset
, __entry
->handle
,
124 __entry
->nents
< __entry
->nsegs
? "more" : "last"
128 #define DEFINE_RDCH_EVENT(name) \
129 DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\
131 const struct rpc_task *task, \
133 struct rpcrdma_mr *mr, \
136 TP_ARGS(task, pos, mr, nsegs))
138 DECLARE_EVENT_CLASS(xprtrdma_wrch_event
,
140 const struct rpc_task
*task
,
141 struct rpcrdma_mr
*mr
,
145 TP_ARGS(task
, mr
, nsegs
),
148 __field(unsigned int, task_id
)
149 __field(unsigned int, client_id
)
158 __entry
->task_id
= task
->tk_pid
;
159 __entry
->client_id
= task
->tk_client
->cl_clid
;
160 __entry
->nents
= mr
->mr_nents
;
161 __entry
->handle
= mr
->mr_handle
;
162 __entry
->length
= mr
->mr_length
;
163 __entry
->offset
= mr
->mr_offset
;
164 __entry
->nsegs
= nsegs
;
167 TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)",
168 __entry
->task_id
, __entry
->client_id
,
169 __entry
->length
, (unsigned long long)__entry
->offset
,
171 __entry
->nents
< __entry
->nsegs
? "more" : "last"
175 #define DEFINE_WRCH_EVENT(name) \
176 DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\
178 const struct rpc_task *task, \
179 struct rpcrdma_mr *mr, \
182 TP_ARGS(task, mr, nsegs))
184 DECLARE_EVENT_CLASS(xprtrdma_frwr_done
,
186 const struct ib_wc
*wc
,
187 const struct rpcrdma_frwr
*frwr
193 __field(const void *, mr
)
194 __field(unsigned int, status
)
195 __field(unsigned int, vendor_err
)
199 __entry
->mr
= container_of(frwr
, struct rpcrdma_mr
, frwr
);
200 __entry
->status
= wc
->status
;
201 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
205 "mr=%p: %s (%u/0x%x)",
206 __entry
->mr
, rdma_show_wc_status(__entry
->status
),
207 __entry
->status
, __entry
->vendor_err
211 #define DEFINE_FRWR_DONE_EVENT(name) \
212 DEFINE_EVENT(xprtrdma_frwr_done, name, \
214 const struct ib_wc *wc, \
215 const struct rpcrdma_frwr *frwr \
219 TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL
);
220 TRACE_DEFINE_ENUM(DMA_TO_DEVICE
);
221 TRACE_DEFINE_ENUM(DMA_FROM_DEVICE
);
222 TRACE_DEFINE_ENUM(DMA_NONE
);
224 #define xprtrdma_show_direction(x) \
225 __print_symbolic(x, \
226 { DMA_BIDIRECTIONAL, "BIDIR" }, \
227 { DMA_TO_DEVICE, "TO_DEVICE" }, \
228 { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
229 { DMA_NONE, "NONE" })
231 DECLARE_EVENT_CLASS(xprtrdma_mr
,
233 const struct rpcrdma_mr
*mr
239 __field(const void *, mr
)
248 __entry
->handle
= mr
->mr_handle
;
249 __entry
->length
= mr
->mr_length
;
250 __entry
->offset
= mr
->mr_offset
;
251 __entry
->dir
= mr
->mr_dir
;
254 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s)",
255 __entry
->mr
, __entry
->length
,
256 (unsigned long long)__entry
->offset
, __entry
->handle
,
257 xprtrdma_show_direction(__entry
->dir
)
261 #define DEFINE_MR_EVENT(name) \
262 DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \
264 const struct rpcrdma_mr *mr \
268 DECLARE_EVENT_CLASS(xprtrdma_cb_event
,
270 const struct rpc_rqst
*rqst
276 __field(const void *, rqst
)
277 __field(const void *, rep
)
278 __field(const void *, req
)
283 __entry
->rqst
= rqst
;
284 __entry
->req
= rpcr_to_rdmar(rqst
);
285 __entry
->rep
= rpcr_to_rdmar(rqst
)->rl_reply
;
286 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
289 TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p",
290 __entry
->xid
, __entry
->rqst
, __entry
->req
, __entry
->rep
294 #define DEFINE_CB_EVENT(name) \
295 DEFINE_EVENT(xprtrdma_cb_event, name, \
297 const struct rpc_rqst *rqst \
305 TRACE_EVENT(xprtrdma_cm_event
,
307 const struct rpcrdma_xprt
*r_xprt
,
308 struct rdma_cm_event
*event
311 TP_ARGS(r_xprt
, event
),
314 __field(const void *, r_xprt
)
315 __field(unsigned int, event
)
317 __string(addr
, rpcrdma_addrstr(r_xprt
))
318 __string(port
, rpcrdma_portstr(r_xprt
))
322 __entry
->r_xprt
= r_xprt
;
323 __entry
->event
= event
->event
;
324 __entry
->status
= event
->status
;
325 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
326 __assign_str(port
, rpcrdma_portstr(r_xprt
));
329 TP_printk("peer=[%s]:%s r_xprt=%p: %s (%u/%d)",
330 __get_str(addr
), __get_str(port
),
331 __entry
->r_xprt
, rdma_show_cm_event(__entry
->event
),
332 __entry
->event
, __entry
->status
336 TRACE_EVENT(xprtrdma_disconnect
,
338 const struct rpcrdma_xprt
*r_xprt
,
342 TP_ARGS(r_xprt
, status
),
345 __field(const void *, r_xprt
)
347 __field(int, connected
)
348 __string(addr
, rpcrdma_addrstr(r_xprt
))
349 __string(port
, rpcrdma_portstr(r_xprt
))
353 __entry
->r_xprt
= r_xprt
;
354 __entry
->status
= status
;
355 __entry
->connected
= r_xprt
->rx_ep
.rep_connected
;
356 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
357 __assign_str(port
, rpcrdma_portstr(r_xprt
));
360 TP_printk("peer=[%s]:%s r_xprt=%p: status=%d %sconnected",
361 __get_str(addr
), __get_str(port
),
362 __entry
->r_xprt
, __entry
->status
,
363 __entry
->connected
== 1 ? "still " : "dis"
367 DEFINE_RXPRT_EVENT(xprtrdma_conn_start
);
368 DEFINE_RXPRT_EVENT(xprtrdma_conn_tout
);
369 DEFINE_RXPRT_EVENT(xprtrdma_create
);
370 DEFINE_RXPRT_EVENT(xprtrdma_op_destroy
);
371 DEFINE_RXPRT_EVENT(xprtrdma_remove
);
372 DEFINE_RXPRT_EVENT(xprtrdma_reinsert
);
373 DEFINE_RXPRT_EVENT(xprtrdma_reconnect
);
374 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc
);
375 DEFINE_RXPRT_EVENT(xprtrdma_op_close
);
376 DEFINE_RXPRT_EVENT(xprtrdma_op_connect
);
378 TRACE_EVENT(xprtrdma_op_set_cto
,
380 const struct rpcrdma_xprt
*r_xprt
,
381 unsigned long connect
,
382 unsigned long reconnect
385 TP_ARGS(r_xprt
, connect
, reconnect
),
388 __field(const void *, r_xprt
)
389 __field(unsigned long, connect
)
390 __field(unsigned long, reconnect
)
391 __string(addr
, rpcrdma_addrstr(r_xprt
))
392 __string(port
, rpcrdma_portstr(r_xprt
))
396 __entry
->r_xprt
= r_xprt
;
397 __entry
->connect
= connect
;
398 __entry
->reconnect
= reconnect
;
399 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
400 __assign_str(port
, rpcrdma_portstr(r_xprt
));
403 TP_printk("peer=[%s]:%s r_xprt=%p: connect=%lu reconnect=%lu",
404 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
405 __entry
->connect
/ HZ
, __entry
->reconnect
/ HZ
409 TRACE_EVENT(xprtrdma_qp_event
,
411 const struct rpcrdma_xprt
*r_xprt
,
412 const struct ib_event
*event
415 TP_ARGS(r_xprt
, event
),
418 __field(const void *, r_xprt
)
419 __field(unsigned int, event
)
420 __string(name
, event
->device
->name
)
421 __string(addr
, rpcrdma_addrstr(r_xprt
))
422 __string(port
, rpcrdma_portstr(r_xprt
))
426 __entry
->r_xprt
= r_xprt
;
427 __entry
->event
= event
->event
;
428 __assign_str(name
, event
->device
->name
);
429 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
430 __assign_str(port
, rpcrdma_portstr(r_xprt
));
433 TP_printk("peer=[%s]:%s r_xprt=%p: dev %s: %s (%u)",
434 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
435 __get_str(name
), rdma_show_ib_event(__entry
->event
),
444 TRACE_EVENT(xprtrdma_createmrs
,
446 const struct rpcrdma_xprt
*r_xprt
,
450 TP_ARGS(r_xprt
, count
),
453 __field(const void *, r_xprt
)
454 __string(addr
, rpcrdma_addrstr(r_xprt
))
455 __string(port
, rpcrdma_portstr(r_xprt
))
456 __field(unsigned int, count
)
460 __entry
->r_xprt
= r_xprt
;
461 __entry
->count
= count
;
462 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
463 __assign_str(port
, rpcrdma_portstr(r_xprt
));
466 TP_printk("peer=[%s]:%s r_xprt=%p: created %u MRs",
467 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
472 TRACE_EVENT(xprtrdma_mr_get
,
474 const struct rpcrdma_req
*req
480 __field(const void *, req
)
481 __field(unsigned int, task_id
)
482 __field(unsigned int, client_id
)
487 const struct rpc_rqst
*rqst
= &req
->rl_slot
;
490 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
491 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
492 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
495 TP_printk("task:%u@%u xid=0x%08x req=%p",
496 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
501 TRACE_EVENT(xprtrdma_nomrs
,
503 const struct rpcrdma_req
*req
509 __field(const void *, req
)
510 __field(unsigned int, task_id
)
511 __field(unsigned int, client_id
)
516 const struct rpc_rqst
*rqst
= &req
->rl_slot
;
519 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
520 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
521 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
524 TP_printk("task:%u@%u xid=0x%08x req=%p",
525 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
530 DEFINE_RDCH_EVENT(read
);
531 DEFINE_WRCH_EVENT(write
);
532 DEFINE_WRCH_EVENT(reply
);
534 TRACE_DEFINE_ENUM(rpcrdma_noch
);
535 TRACE_DEFINE_ENUM(rpcrdma_readch
);
536 TRACE_DEFINE_ENUM(rpcrdma_areadch
);
537 TRACE_DEFINE_ENUM(rpcrdma_writech
);
538 TRACE_DEFINE_ENUM(rpcrdma_replych
);
540 #define xprtrdma_show_chunktype(x) \
541 __print_symbolic(x, \
542 { rpcrdma_noch, "inline" }, \
543 { rpcrdma_readch, "read list" }, \
544 { rpcrdma_areadch, "*read list" }, \
545 { rpcrdma_writech, "write list" }, \
546 { rpcrdma_replych, "reply chunk" })
548 TRACE_EVENT(xprtrdma_marshal
,
550 const struct rpcrdma_req
*req
,
555 TP_ARGS(req
, rtype
, wtype
),
558 __field(unsigned int, task_id
)
559 __field(unsigned int, client_id
)
561 __field(unsigned int, hdrlen
)
562 __field(unsigned int, headlen
)
563 __field(unsigned int, pagelen
)
564 __field(unsigned int, taillen
)
565 __field(unsigned int, rtype
)
566 __field(unsigned int, wtype
)
570 const struct rpc_rqst
*rqst
= &req
->rl_slot
;
572 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
573 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
574 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
575 __entry
->hdrlen
= req
->rl_hdrbuf
.len
;
576 __entry
->headlen
= rqst
->rq_snd_buf
.head
[0].iov_len
;
577 __entry
->pagelen
= rqst
->rq_snd_buf
.page_len
;
578 __entry
->taillen
= rqst
->rq_snd_buf
.tail
[0].iov_len
;
579 __entry
->rtype
= rtype
;
580 __entry
->wtype
= wtype
;
583 TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s",
584 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
586 __entry
->headlen
, __entry
->pagelen
, __entry
->taillen
,
587 xprtrdma_show_chunktype(__entry
->rtype
),
588 xprtrdma_show_chunktype(__entry
->wtype
)
592 TRACE_EVENT(xprtrdma_marshal_failed
,
593 TP_PROTO(const struct rpc_rqst
*rqst
,
600 __field(unsigned int, task_id
)
601 __field(unsigned int, client_id
)
607 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
608 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
609 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
613 TP_printk("task:%u@%u xid=0x%08x: ret=%d",
614 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
619 TRACE_EVENT(xprtrdma_prepsend_failed
,
620 TP_PROTO(const struct rpc_rqst
*rqst
,
627 __field(unsigned int, task_id
)
628 __field(unsigned int, client_id
)
634 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
635 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
636 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
640 TP_printk("task:%u@%u xid=0x%08x: ret=%d",
641 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
646 TRACE_EVENT(xprtrdma_post_send
,
648 const struct rpcrdma_req
*req
,
652 TP_ARGS(req
, status
),
655 __field(const void *, req
)
656 __field(unsigned int, task_id
)
657 __field(unsigned int, client_id
)
658 __field(int, num_sge
)
659 __field(int, signaled
)
664 const struct rpc_rqst
*rqst
= &req
->rl_slot
;
666 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
667 __entry
->client_id
= rqst
->rq_task
->tk_client
?
668 rqst
->rq_task
->tk_client
->cl_clid
: -1;
670 __entry
->num_sge
= req
->rl_sendctx
->sc_wr
.num_sge
;
671 __entry
->signaled
= req
->rl_sendctx
->sc_wr
.send_flags
&
673 __entry
->status
= status
;
676 TP_printk("task:%u@%u req=%p (%d SGE%s) %sstatus=%d",
677 __entry
->task_id
, __entry
->client_id
,
678 __entry
->req
, __entry
->num_sge
,
679 (__entry
->num_sge
== 1 ? "" : "s"),
680 (__entry
->signaled
? "signaled " : ""),
685 TRACE_EVENT(xprtrdma_post_recv
,
687 const struct rpcrdma_rep
*rep
693 __field(const void *, rep
)
705 TRACE_EVENT(xprtrdma_post_recvs
,
707 const struct rpcrdma_xprt
*r_xprt
,
712 TP_ARGS(r_xprt
, count
, status
),
715 __field(const void *, r_xprt
)
716 __field(unsigned int, count
)
719 __string(addr
, rpcrdma_addrstr(r_xprt
))
720 __string(port
, rpcrdma_portstr(r_xprt
))
724 __entry
->r_xprt
= r_xprt
;
725 __entry
->count
= count
;
726 __entry
->status
= status
;
727 __entry
->posted
= r_xprt
->rx_ep
.rep_receive_count
;
728 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
729 __assign_str(port
, rpcrdma_portstr(r_xprt
));
732 TP_printk("peer=[%s]:%s r_xprt=%p: %u new recvs, %d active (rc %d)",
733 __get_str(addr
), __get_str(port
), __entry
->r_xprt
,
734 __entry
->count
, __entry
->posted
, __entry
->status
738 TRACE_EVENT(xprtrdma_post_linv
,
740 const struct rpcrdma_req
*req
,
744 TP_ARGS(req
, status
),
747 __field(const void *, req
)
754 __entry
->status
= status
;
755 __entry
->xid
= be32_to_cpu(req
->rl_slot
.rq_xid
);
758 TP_printk("req=%p xid=0x%08x status=%d",
759 __entry
->req
, __entry
->xid
, __entry
->status
767 TRACE_EVENT(xprtrdma_wc_send
,
769 const struct rpcrdma_sendctx
*sc
,
770 const struct ib_wc
*wc
776 __field(const void *, req
)
777 __field(unsigned int, unmap_count
)
778 __field(unsigned int, status
)
779 __field(unsigned int, vendor_err
)
783 __entry
->req
= sc
->sc_req
;
784 __entry
->unmap_count
= sc
->sc_unmap_count
;
785 __entry
->status
= wc
->status
;
786 __entry
->vendor_err
= __entry
->status
? wc
->vendor_err
: 0;
789 TP_printk("req=%p, unmapped %u pages: %s (%u/0x%x)",
790 __entry
->req
, __entry
->unmap_count
,
791 rdma_show_wc_status(__entry
->status
),
792 __entry
->status
, __entry
->vendor_err
796 TRACE_EVENT(xprtrdma_wc_receive
,
798 const struct ib_wc
*wc
804 __field(const void *, rep
)
805 __field(u32
, byte_len
)
806 __field(unsigned int, status
)
807 __field(u32
, vendor_err
)
811 __entry
->rep
= container_of(wc
->wr_cqe
, struct rpcrdma_rep
,
813 __entry
->status
= wc
->status
;
815 __entry
->byte_len
= 0;
816 __entry
->vendor_err
= wc
->vendor_err
;
818 __entry
->byte_len
= wc
->byte_len
;
819 __entry
->vendor_err
= 0;
823 TP_printk("rep=%p %u bytes: %s (%u/0x%x)",
824 __entry
->rep
, __entry
->byte_len
,
825 rdma_show_wc_status(__entry
->status
),
826 __entry
->status
, __entry
->vendor_err
830 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg
);
831 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li
);
832 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake
);
833 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_done
);
835 TRACE_EVENT(xprtrdma_frwr_alloc
,
837 const struct rpcrdma_mr
*mr
,
844 __field(const void *, mr
)
853 TP_printk("mr=%p: rc=%d",
854 __entry
->mr
, __entry
->rc
858 TRACE_EVENT(xprtrdma_frwr_dereg
,
860 const struct rpcrdma_mr
*mr
,
867 __field(const void *, mr
)
877 __entry
->handle
= mr
->mr_handle
;
878 __entry
->length
= mr
->mr_length
;
879 __entry
->offset
= mr
->mr_offset
;
880 __entry
->dir
= mr
->mr_dir
;
884 TP_printk("mr=%p %u@0x%016llx:0x%08x (%s): rc=%d",
885 __entry
->mr
, __entry
->length
,
886 (unsigned long long)__entry
->offset
, __entry
->handle
,
887 xprtrdma_show_direction(__entry
->dir
),
892 TRACE_EVENT(xprtrdma_frwr_sgerr
,
894 const struct rpcrdma_mr
*mr
,
898 TP_ARGS(mr
, sg_nents
),
901 __field(const void *, mr
)
909 __entry
->addr
= mr
->mr_sg
->dma_address
;
910 __entry
->dir
= mr
->mr_dir
;
911 __entry
->nents
= sg_nents
;
914 TP_printk("mr=%p dma addr=0x%llx (%s) sg_nents=%d",
915 __entry
->mr
, __entry
->addr
,
916 xprtrdma_show_direction(__entry
->dir
),
921 TRACE_EVENT(xprtrdma_frwr_maperr
,
923 const struct rpcrdma_mr
*mr
,
927 TP_ARGS(mr
, num_mapped
),
930 __field(const void *, mr
)
933 __field(int, num_mapped
)
939 __entry
->addr
= mr
->mr_sg
->dma_address
;
940 __entry
->dir
= mr
->mr_dir
;
941 __entry
->num_mapped
= num_mapped
;
942 __entry
->nents
= mr
->mr_nents
;
945 TP_printk("mr=%p dma addr=0x%llx (%s) nents=%d of %d",
946 __entry
->mr
, __entry
->addr
,
947 xprtrdma_show_direction(__entry
->dir
),
948 __entry
->num_mapped
, __entry
->nents
952 DEFINE_MR_EVENT(localinv
);
953 DEFINE_MR_EVENT(map
);
954 DEFINE_MR_EVENT(unmap
);
955 DEFINE_MR_EVENT(remoteinv
);
956 DEFINE_MR_EVENT(recycle
);
958 TRACE_EVENT(xprtrdma_dma_maperr
,
970 __entry
->addr
= addr
;
973 TP_printk("dma addr=0x%llx\n", __entry
->addr
)
980 TRACE_EVENT(xprtrdma_reply
,
982 const struct rpc_task
*task
,
983 const struct rpcrdma_rep
*rep
,
984 const struct rpcrdma_req
*req
,
988 TP_ARGS(task
, rep
, req
, credits
),
991 __field(unsigned int, task_id
)
992 __field(unsigned int, client_id
)
993 __field(const void *, rep
)
994 __field(const void *, req
)
996 __field(unsigned int, credits
)
1000 __entry
->task_id
= task
->tk_pid
;
1001 __entry
->client_id
= task
->tk_client
->cl_clid
;
1004 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
1005 __entry
->credits
= credits
;
1008 TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p",
1009 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
1010 __entry
->credits
, __entry
->rep
, __entry
->req
1014 TRACE_EVENT(xprtrdma_defer_cmp
,
1016 const struct rpcrdma_rep
*rep
1022 __field(unsigned int, task_id
)
1023 __field(unsigned int, client_id
)
1024 __field(const void *, rep
)
1029 __entry
->task_id
= rep
->rr_rqst
->rq_task
->tk_pid
;
1030 __entry
->client_id
= rep
->rr_rqst
->rq_task
->tk_client
->cl_clid
;
1032 __entry
->xid
= be32_to_cpu(rep
->rr_xid
);
1035 TP_printk("task:%u@%u xid=0x%08x rep=%p",
1036 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
1041 DEFINE_REPLY_EVENT(xprtrdma_reply_vers
);
1042 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst
);
1043 DEFINE_REPLY_EVENT(xprtrdma_reply_short
);
1044 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr
);
1046 TRACE_EVENT(xprtrdma_fixup
,
1048 const struct rpc_rqst
*rqst
,
1053 TP_ARGS(rqst
, len
, hdrlen
),
1056 __field(unsigned int, task_id
)
1057 __field(unsigned int, client_id
)
1058 __field(const void *, base
)
1060 __field(int, hdrlen
)
1064 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
1065 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
1066 __entry
->base
= rqst
->rq_rcv_buf
.head
[0].iov_base
;
1068 __entry
->hdrlen
= hdrlen
;
1071 TP_printk("task:%u@%u base=%p len=%d hdrlen=%d",
1072 __entry
->task_id
, __entry
->client_id
,
1073 __entry
->base
, __entry
->len
, __entry
->hdrlen
1077 TRACE_EVENT(xprtrdma_fixup_pg
,
1079 const struct rpc_rqst
*rqst
,
1086 TP_ARGS(rqst
, pageno
, pos
, len
, curlen
),
1089 __field(unsigned int, task_id
)
1090 __field(unsigned int, client_id
)
1091 __field(const void *, pos
)
1092 __field(int, pageno
)
1094 __field(int, curlen
)
1098 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
1099 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
1101 __entry
->pageno
= pageno
;
1103 __entry
->curlen
= curlen
;
1106 TP_printk("task:%u@%u pageno=%d pos=%p len=%d curlen=%d",
1107 __entry
->task_id
, __entry
->client_id
,
1108 __entry
->pageno
, __entry
->pos
, __entry
->len
, __entry
->curlen
1112 TRACE_EVENT(xprtrdma_decode_seg
,
1119 TP_ARGS(handle
, length
, offset
),
1122 __field(u32
, handle
)
1123 __field(u32
, length
)
1124 __field(u64
, offset
)
1128 __entry
->handle
= handle
;
1129 __entry
->length
= length
;
1130 __entry
->offset
= offset
;
1133 TP_printk("%u@0x%016llx:0x%08x",
1134 __entry
->length
, (unsigned long long)__entry
->offset
,
1140 ** Allocation/release of rpcrdma_reqs and rpcrdma_reps
1143 TRACE_EVENT(xprtrdma_op_allocate
,
1145 const struct rpc_task
*task
,
1146 const struct rpcrdma_req
*req
1152 __field(unsigned int, task_id
)
1153 __field(unsigned int, client_id
)
1154 __field(const void *, req
)
1155 __field(size_t, callsize
)
1156 __field(size_t, rcvsize
)
1160 __entry
->task_id
= task
->tk_pid
;
1161 __entry
->client_id
= task
->tk_client
->cl_clid
;
1163 __entry
->callsize
= task
->tk_rqstp
->rq_callsize
;
1164 __entry
->rcvsize
= task
->tk_rqstp
->rq_rcvsize
;
1167 TP_printk("task:%u@%u req=%p (%zu, %zu)",
1168 __entry
->task_id
, __entry
->client_id
,
1169 __entry
->req
, __entry
->callsize
, __entry
->rcvsize
1173 TRACE_EVENT(xprtrdma_op_free
,
1175 const struct rpc_task
*task
,
1176 const struct rpcrdma_req
*req
1182 __field(unsigned int, task_id
)
1183 __field(unsigned int, client_id
)
1184 __field(const void *, req
)
1185 __field(const void *, rep
)
1189 __entry
->task_id
= task
->tk_pid
;
1190 __entry
->client_id
= task
->tk_client
->cl_clid
;
1192 __entry
->rep
= req
->rl_reply
;
1195 TP_printk("task:%u@%u req=%p rep=%p",
1196 __entry
->task_id
, __entry
->client_id
,
1197 __entry
->req
, __entry
->rep
1205 TRACE_EVENT(xprtrdma_cb_setup
,
1207 const struct rpcrdma_xprt
*r_xprt
,
1211 TP_ARGS(r_xprt
, reqs
),
1214 __field(const void *, r_xprt
)
1215 __field(unsigned int, reqs
)
1216 __string(addr
, rpcrdma_addrstr(r_xprt
))
1217 __string(port
, rpcrdma_portstr(r_xprt
))
1221 __entry
->r_xprt
= r_xprt
;
1222 __entry
->reqs
= reqs
;
1223 __assign_str(addr
, rpcrdma_addrstr(r_xprt
));
1224 __assign_str(port
, rpcrdma_portstr(r_xprt
));
1227 TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs",
1228 __get_str(addr
), __get_str(port
),
1229 __entry
->r_xprt
, __entry
->reqs
1233 DEFINE_CB_EVENT(xprtrdma_cb_call
);
1234 DEFINE_CB_EVENT(xprtrdma_cb_reply
);
1236 TRACE_EVENT(xprtrdma_leaked_rep
,
1238 const struct rpc_rqst
*rqst
,
1239 const struct rpcrdma_rep
*rep
1245 __field(unsigned int, task_id
)
1246 __field(unsigned int, client_id
)
1248 __field(const void *, rep
)
1252 __entry
->task_id
= rqst
->rq_task
->tk_pid
;
1253 __entry
->client_id
= rqst
->rq_task
->tk_client
->cl_clid
;
1254 __entry
->xid
= be32_to_cpu(rqst
->rq_xid
);
1258 TP_printk("task:%u@%u xid=0x%08x rep=%p",
1259 __entry
->task_id
, __entry
->client_id
, __entry
->xid
,
1265 ** Server-side RPC/RDMA events
1268 DECLARE_EVENT_CLASS(svcrdma_xprt_event
,
1270 const struct svc_xprt
*xprt
1276 __field(const void *, xprt
)
1277 __string(addr
, xprt
->xpt_remotebuf
)
1281 __entry
->xprt
= xprt
;
1282 __assign_str(addr
, xprt
->xpt_remotebuf
);
1285 TP_printk("xprt=%p addr=%s",
1286 __entry
->xprt
, __get_str(addr
)
1290 #define DEFINE_XPRT_EVENT(name) \
1291 DEFINE_EVENT(svcrdma_xprt_event, svcrdma_xprt_##name, \
1293 const struct svc_xprt *xprt \
1297 DEFINE_XPRT_EVENT(accept
);
1298 DEFINE_XPRT_EVENT(fail
);
1299 DEFINE_XPRT_EVENT(free
);
1301 TRACE_DEFINE_ENUM(RDMA_MSG
);
1302 TRACE_DEFINE_ENUM(RDMA_NOMSG
);
1303 TRACE_DEFINE_ENUM(RDMA_MSGP
);
1304 TRACE_DEFINE_ENUM(RDMA_DONE
);
1305 TRACE_DEFINE_ENUM(RDMA_ERROR
);
1307 #define show_rpcrdma_proc(x) \
1308 __print_symbolic(x, \
1309 { RDMA_MSG, "RDMA_MSG" }, \
1310 { RDMA_NOMSG, "RDMA_NOMSG" }, \
1311 { RDMA_MSGP, "RDMA_MSGP" }, \
1312 { RDMA_DONE, "RDMA_DONE" }, \
1313 { RDMA_ERROR, "RDMA_ERROR" })
1315 TRACE_EVENT(svcrdma_decode_rqst
,
1327 __field(u32
, credits
)
1328 __field(unsigned int, hdrlen
)
1332 __entry
->xid
= be32_to_cpup(p
++);
1333 __entry
->vers
= be32_to_cpup(p
++);
1334 __entry
->credits
= be32_to_cpup(p
++);
1335 __entry
->proc
= be32_to_cpup(p
);
1336 __entry
->hdrlen
= hdrlen
;
1339 TP_printk("xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u",
1340 __entry
->xid
, __entry
->vers
, __entry
->credits
,
1341 show_rpcrdma_proc(__entry
->proc
), __entry
->hdrlen
)
1344 TRACE_EVENT(svcrdma_decode_short
,
1352 __field(unsigned int, hdrlen
)
1356 __entry
->hdrlen
= hdrlen
;
1359 TP_printk("hdrlen=%u", __entry
->hdrlen
)
1362 DECLARE_EVENT_CLASS(svcrdma_badreq_event
,
1373 __field(u32
, credits
)
1377 __entry
->xid
= be32_to_cpup(p
++);
1378 __entry
->vers
= be32_to_cpup(p
++);
1379 __entry
->credits
= be32_to_cpup(p
++);
1380 __entry
->proc
= be32_to_cpup(p
);
1383 TP_printk("xid=0x%08x vers=%u credits=%u proc=%u",
1384 __entry
->xid
, __entry
->vers
, __entry
->credits
, __entry
->proc
)
1387 #define DEFINE_BADREQ_EVENT(name) \
1388 DEFINE_EVENT(svcrdma_badreq_event, svcrdma_decode_##name,\
1394 DEFINE_BADREQ_EVENT(badvers
);
1395 DEFINE_BADREQ_EVENT(drop
);
1396 DEFINE_BADREQ_EVENT(badproc
);
1397 DEFINE_BADREQ_EVENT(parse
);
1399 DECLARE_EVENT_CLASS(svcrdma_segment_event
,
1406 TP_ARGS(handle
, length
, offset
),
1409 __field(u32
, handle
)
1410 __field(u32
, length
)
1411 __field(u64
, offset
)
1415 __entry
->handle
= handle
;
1416 __entry
->length
= length
;
1417 __entry
->offset
= offset
;
1420 TP_printk("%u@0x%016llx:0x%08x",
1421 __entry
->length
, (unsigned long long)__entry
->offset
,
1426 #define DEFINE_SEGMENT_EVENT(name) \
1427 DEFINE_EVENT(svcrdma_segment_event, svcrdma_encode_##name,\
1433 TP_ARGS(handle, length, offset))
1435 DEFINE_SEGMENT_EVENT(rseg
);
1436 DEFINE_SEGMENT_EVENT(wseg
);
1438 DECLARE_EVENT_CLASS(svcrdma_chunk_event
,
1446 __field(u32
, length
)
1450 __entry
->length
= length
;
1453 TP_printk("length=%u",
1458 #define DEFINE_CHUNK_EVENT(name) \
1459 DEFINE_EVENT(svcrdma_chunk_event, svcrdma_encode_##name,\
1465 DEFINE_CHUNK_EVENT(pzr
);
1466 DEFINE_CHUNK_EVENT(write
);
1467 DEFINE_CHUNK_EVENT(reply
);
1469 TRACE_EVENT(svcrdma_encode_read
,
1475 TP_ARGS(length
, position
),
1478 __field(u32
, length
)
1479 __field(u32
, position
)
1483 __entry
->length
= length
;
1484 __entry
->position
= position
;
1487 TP_printk("length=%u position=%u",
1488 __entry
->length
, __entry
->position
1492 DECLARE_EVENT_CLASS(svcrdma_error_event
,
1504 __entry
->xid
= be32_to_cpu(xid
);
1507 TP_printk("xid=0x%08x",
1512 #define DEFINE_ERROR_EVENT(name) \
1513 DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name, \
1519 DEFINE_ERROR_EVENT(vers
);
1520 DEFINE_ERROR_EVENT(chunk
);
1523 ** Server-side RDMA API events
1526 TRACE_EVENT(svcrdma_dma_map_page
,
1528 const struct svcxprt_rdma
*rdma
,
1532 TP_ARGS(rdma
, page
),
1535 __field(const void *, page
);
1536 __string(device
, rdma
->sc_cm_id
->device
->name
)
1537 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1541 __entry
->page
= page
;
1542 __assign_str(device
, rdma
->sc_cm_id
->device
->name
);
1543 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1546 TP_printk("addr=%s device=%s page=%p",
1547 __get_str(addr
), __get_str(device
), __entry
->page
1551 TRACE_EVENT(svcrdma_dma_map_rwctx
,
1553 const struct svcxprt_rdma
*rdma
,
1557 TP_ARGS(rdma
, status
),
1560 __field(int, status
)
1561 __string(device
, rdma
->sc_cm_id
->device
->name
)
1562 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1566 __entry
->status
= status
;
1567 __assign_str(device
, rdma
->sc_cm_id
->device
->name
);
1568 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1571 TP_printk("addr=%s device=%s status=%d",
1572 __get_str(addr
), __get_str(device
), __entry
->status
1576 TRACE_EVENT(svcrdma_send_failed
,
1578 const struct svc_rqst
*rqst
,
1582 TP_ARGS(rqst
, status
),
1585 __field(int, status
)
1587 __field(const void *, xprt
)
1588 __string(addr
, rqst
->rq_xprt
->xpt_remotebuf
)
1592 __entry
->status
= status
;
1593 __entry
->xid
= __be32_to_cpu(rqst
->rq_xid
);
1594 __entry
->xprt
= rqst
->rq_xprt
;
1595 __assign_str(addr
, rqst
->rq_xprt
->xpt_remotebuf
);
1598 TP_printk("xprt=%p addr=%s xid=0x%08x status=%d",
1599 __entry
->xprt
, __get_str(addr
),
1600 __entry
->xid
, __entry
->status
1604 DECLARE_EVENT_CLASS(svcrdma_sendcomp_event
,
1606 const struct ib_wc
*wc
1612 __field(const void *, cqe
)
1613 __field(unsigned int, status
)
1614 __field(unsigned int, vendor_err
)
1618 __entry
->cqe
= wc
->wr_cqe
;
1619 __entry
->status
= wc
->status
;
1621 __entry
->vendor_err
= wc
->vendor_err
;
1623 __entry
->vendor_err
= 0;
1626 TP_printk("cqe=%p status=%s (%u/0x%x)",
1627 __entry
->cqe
, rdma_show_wc_status(__entry
->status
),
1628 __entry
->status
, __entry
->vendor_err
1632 #define DEFINE_SENDCOMP_EVENT(name) \
1633 DEFINE_EVENT(svcrdma_sendcomp_event, svcrdma_wc_##name, \
1635 const struct ib_wc *wc \
1639 TRACE_EVENT(svcrdma_post_send
,
1641 const struct ib_send_wr
*wr
1647 __field(const void *, cqe
)
1648 __field(unsigned int, num_sge
)
1649 __field(u32
, inv_rkey
)
1653 __entry
->cqe
= wr
->wr_cqe
;
1654 __entry
->num_sge
= wr
->num_sge
;
1655 __entry
->inv_rkey
= (wr
->opcode
== IB_WR_SEND_WITH_INV
) ?
1656 wr
->ex
.invalidate_rkey
: 0;
1659 TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x",
1660 __entry
->cqe
, __entry
->num_sge
,
1665 DEFINE_SENDCOMP_EVENT(send
);
1667 TRACE_EVENT(svcrdma_post_recv
,
1669 const struct ib_recv_wr
*wr
,
1673 TP_ARGS(wr
, status
),
1676 __field(const void *, cqe
)
1677 __field(int, status
)
1681 __entry
->cqe
= wr
->wr_cqe
;
1682 __entry
->status
= status
;
1685 TP_printk("cqe=%p status=%d",
1686 __entry
->cqe
, __entry
->status
1690 TRACE_EVENT(svcrdma_wc_receive
,
1692 const struct ib_wc
*wc
1698 __field(const void *, cqe
)
1699 __field(u32
, byte_len
)
1700 __field(unsigned int, status
)
1701 __field(u32
, vendor_err
)
1705 __entry
->cqe
= wc
->wr_cqe
;
1706 __entry
->status
= wc
->status
;
1708 __entry
->byte_len
= 0;
1709 __entry
->vendor_err
= wc
->vendor_err
;
1711 __entry
->byte_len
= wc
->byte_len
;
1712 __entry
->vendor_err
= 0;
1716 TP_printk("cqe=%p byte_len=%u status=%s (%u/0x%x)",
1717 __entry
->cqe
, __entry
->byte_len
,
1718 rdma_show_wc_status(__entry
->status
),
1719 __entry
->status
, __entry
->vendor_err
1723 TRACE_EVENT(svcrdma_post_rw
,
1729 TP_ARGS(cqe
, sqecount
),
1732 __field(const void *, cqe
)
1733 __field(int, sqecount
)
1738 __entry
->sqecount
= sqecount
;
1741 TP_printk("cqe=%p sqecount=%d",
1742 __entry
->cqe
, __entry
->sqecount
1746 DEFINE_SENDCOMP_EVENT(read
);
1747 DEFINE_SENDCOMP_EVENT(write
);
1749 TRACE_EVENT(svcrdma_cm_event
,
1751 const struct rdma_cm_event
*event
,
1752 const struct sockaddr
*sap
1755 TP_ARGS(event
, sap
),
1758 __field(unsigned int, event
)
1759 __field(int, status
)
1760 __array(__u8
, addr
, INET6_ADDRSTRLEN
+ 10)
1764 __entry
->event
= event
->event
;
1765 __entry
->status
= event
->status
;
1766 snprintf(__entry
->addr
, sizeof(__entry
->addr
) - 1,
1770 TP_printk("addr=%s event=%s (%u/%d)",
1772 rdma_show_cm_event(__entry
->event
),
1773 __entry
->event
, __entry
->status
1777 TRACE_EVENT(svcrdma_qp_error
,
1779 const struct ib_event
*event
,
1780 const struct sockaddr
*sap
1783 TP_ARGS(event
, sap
),
1786 __field(unsigned int, event
)
1787 __string(device
, event
->device
->name
)
1788 __array(__u8
, addr
, INET6_ADDRSTRLEN
+ 10)
1792 __entry
->event
= event
->event
;
1793 __assign_str(device
, event
->device
->name
);
1794 snprintf(__entry
->addr
, sizeof(__entry
->addr
) - 1,
1798 TP_printk("addr=%s dev=%s event=%s (%u)",
1799 __entry
->addr
, __get_str(device
),
1800 rdma_show_ib_event(__entry
->event
), __entry
->event
1804 DECLARE_EVENT_CLASS(svcrdma_sendqueue_event
,
1806 const struct svcxprt_rdma
*rdma
1814 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1818 __entry
->avail
= atomic_read(&rdma
->sc_sq_avail
);
1819 __entry
->depth
= rdma
->sc_sq_depth
;
1820 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1823 TP_printk("addr=%s sc_sq_avail=%d/%d",
1824 __get_str(addr
), __entry
->avail
, __entry
->depth
1828 #define DEFINE_SQ_EVENT(name) \
1829 DEFINE_EVENT(svcrdma_sendqueue_event, svcrdma_sq_##name,\
1831 const struct svcxprt_rdma *rdma \
1835 DEFINE_SQ_EVENT(full
);
1836 DEFINE_SQ_EVENT(retry
);
1838 TRACE_EVENT(svcrdma_sq_post_err
,
1840 const struct svcxprt_rdma
*rdma
,
1844 TP_ARGS(rdma
, status
),
1849 __field(int, status
)
1850 __string(addr
, rdma
->sc_xprt
.xpt_remotebuf
)
1854 __entry
->avail
= atomic_read(&rdma
->sc_sq_avail
);
1855 __entry
->depth
= rdma
->sc_sq_depth
;
1856 __entry
->status
= status
;
1857 __assign_str(addr
, rdma
->sc_xprt
.xpt_remotebuf
);
1860 TP_printk("addr=%s sc_sq_avail=%d/%d status=%d",
1861 __get_str(addr
), __entry
->avail
, __entry
->depth
,
1866 #endif /* _TRACE_RPCRDMA_H */
1868 #include <trace/define_trace.h>