xref: /openbmc/linux/include/trace/events/sunrpc.h (revision 5a158981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM sunrpc
4 
5 #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_SUNRPC_H
7 
8 #include <linux/sunrpc/sched.h>
9 #include <linux/sunrpc/clnt.h>
10 #include <linux/sunrpc/svc.h>
11 #include <linux/sunrpc/xprtsock.h>
12 #include <linux/sunrpc/svc_xprt.h>
13 #include <net/tcp_states.h>
14 #include <linux/net.h>
15 #include <linux/tracepoint.h>
16 
17 TRACE_DEFINE_ENUM(RPC_AUTH_OK);
18 TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED);
19 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED);
20 TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF);
21 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF);
22 TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK);
23 TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM);
24 TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM);
25 
26 #define rpc_show_auth_stat(status)					\
27 	__print_symbolic(status,					\
28 		{ RPC_AUTH_OK,			"AUTH_OK" },		\
29 		{ RPC_AUTH_BADCRED,		"BADCRED" },		\
30 		{ RPC_AUTH_REJECTEDCRED,	"REJECTEDCRED" },	\
31 		{ RPC_AUTH_BADVERF,		"BADVERF" },		\
32 		{ RPC_AUTH_REJECTEDVERF,	"REJECTEDVERF" },	\
33 		{ RPC_AUTH_TOOWEAK,		"TOOWEAK" },		\
34 		{ RPCSEC_GSS_CREDPROBLEM,	"GSS_CREDPROBLEM" },	\
35 		{ RPCSEC_GSS_CTXPROBLEM,	"GSS_CTXPROBLEM" })	\
36 
37 DECLARE_EVENT_CLASS(rpc_task_status,
38 
39 	TP_PROTO(const struct rpc_task *task),
40 
41 	TP_ARGS(task),
42 
43 	TP_STRUCT__entry(
44 		__field(unsigned int, task_id)
45 		__field(unsigned int, client_id)
46 		__field(int, status)
47 	),
48 
49 	TP_fast_assign(
50 		__entry->task_id = task->tk_pid;
51 		__entry->client_id = task->tk_client->cl_clid;
52 		__entry->status = task->tk_status;
53 	),
54 
55 	TP_printk("task:%u@%u status=%d",
56 		__entry->task_id, __entry->client_id,
57 		__entry->status)
58 );
59 #define DEFINE_RPC_STATUS_EVENT(name) \
60 	DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
61 			TP_PROTO( \
62 				const struct rpc_task *task \
63 			), \
64 			TP_ARGS(task))
65 
66 DEFINE_RPC_STATUS_EVENT(call);
67 DEFINE_RPC_STATUS_EVENT(bind);
68 DEFINE_RPC_STATUS_EVENT(connect);
69 
70 TRACE_EVENT(rpc_request,
71 	TP_PROTO(const struct rpc_task *task),
72 
73 	TP_ARGS(task),
74 
75 	TP_STRUCT__entry(
76 		__field(unsigned int, task_id)
77 		__field(unsigned int, client_id)
78 		__field(int, version)
79 		__field(bool, async)
80 		__string(progname, task->tk_client->cl_program->name)
81 		__string(procname, rpc_proc_name(task))
82 	),
83 
84 	TP_fast_assign(
85 		__entry->task_id = task->tk_pid;
86 		__entry->client_id = task->tk_client->cl_clid;
87 		__entry->version = task->tk_client->cl_vers;
88 		__entry->async = RPC_IS_ASYNC(task);
89 		__assign_str(progname, task->tk_client->cl_program->name)
90 		__assign_str(procname, rpc_proc_name(task))
91 	),
92 
93 	TP_printk("task:%u@%u %sv%d %s (%ssync)",
94 		__entry->task_id, __entry->client_id,
95 		__get_str(progname), __entry->version,
96 		__get_str(procname), __entry->async ? "a": ""
97 		)
98 );
99 
100 TRACE_DEFINE_ENUM(RPC_TASK_ASYNC);
101 TRACE_DEFINE_ENUM(RPC_TASK_SWAPPER);
102 TRACE_DEFINE_ENUM(RPC_CALL_MAJORSEEN);
103 TRACE_DEFINE_ENUM(RPC_TASK_ROOTCREDS);
104 TRACE_DEFINE_ENUM(RPC_TASK_DYNAMIC);
105 TRACE_DEFINE_ENUM(RPC_TASK_SOFT);
106 TRACE_DEFINE_ENUM(RPC_TASK_SOFTCONN);
107 TRACE_DEFINE_ENUM(RPC_TASK_SENT);
108 TRACE_DEFINE_ENUM(RPC_TASK_TIMEOUT);
109 TRACE_DEFINE_ENUM(RPC_TASK_NOCONNECT);
110 TRACE_DEFINE_ENUM(RPC_TASK_NO_RETRANS_TIMEOUT);
111 
112 #define rpc_show_task_flags(flags)					\
113 	__print_flags(flags, "|",					\
114 		{ RPC_TASK_ASYNC, "ASYNC" },				\
115 		{ RPC_TASK_SWAPPER, "SWAPPER" },			\
116 		{ RPC_CALL_MAJORSEEN, "MAJORSEEN" },			\
117 		{ RPC_TASK_ROOTCREDS, "ROOTCREDS" },			\
118 		{ RPC_TASK_DYNAMIC, "DYNAMIC" },			\
119 		{ RPC_TASK_SOFT, "SOFT" },				\
120 		{ RPC_TASK_SOFTCONN, "SOFTCONN" },			\
121 		{ RPC_TASK_SENT, "SENT" },				\
122 		{ RPC_TASK_TIMEOUT, "TIMEOUT" },			\
123 		{ RPC_TASK_NOCONNECT, "NOCONNECT" },			\
124 		{ RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" })
125 
126 TRACE_DEFINE_ENUM(RPC_TASK_RUNNING);
127 TRACE_DEFINE_ENUM(RPC_TASK_QUEUED);
128 TRACE_DEFINE_ENUM(RPC_TASK_ACTIVE);
129 TRACE_DEFINE_ENUM(RPC_TASK_NEED_XMIT);
130 TRACE_DEFINE_ENUM(RPC_TASK_NEED_RECV);
131 TRACE_DEFINE_ENUM(RPC_TASK_MSG_PIN_WAIT);
132 TRACE_DEFINE_ENUM(RPC_TASK_SIGNALLED);
133 
134 #define rpc_show_runstate(flags)					\
135 	__print_flags(flags, "|",					\
136 		{ (1UL << RPC_TASK_RUNNING), "RUNNING" },		\
137 		{ (1UL << RPC_TASK_QUEUED), "QUEUED" },			\
138 		{ (1UL << RPC_TASK_ACTIVE), "ACTIVE" },			\
139 		{ (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" },		\
140 		{ (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" },		\
141 		{ (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" },	\
142 		{ (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" })
143 
144 DECLARE_EVENT_CLASS(rpc_task_running,
145 
146 	TP_PROTO(const struct rpc_task *task, const void *action),
147 
148 	TP_ARGS(task, action),
149 
150 	TP_STRUCT__entry(
151 		__field(unsigned int, task_id)
152 		__field(unsigned int, client_id)
153 		__field(const void *, action)
154 		__field(unsigned long, runstate)
155 		__field(int, status)
156 		__field(unsigned short, flags)
157 		),
158 
159 	TP_fast_assign(
160 		__entry->client_id = task->tk_client ?
161 				     task->tk_client->cl_clid : -1;
162 		__entry->task_id = task->tk_pid;
163 		__entry->action = action;
164 		__entry->runstate = task->tk_runstate;
165 		__entry->status = task->tk_status;
166 		__entry->flags = task->tk_flags;
167 		),
168 
169 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps",
170 		__entry->task_id, __entry->client_id,
171 		rpc_show_task_flags(__entry->flags),
172 		rpc_show_runstate(__entry->runstate),
173 		__entry->status,
174 		__entry->action
175 		)
176 );
177 #define DEFINE_RPC_RUNNING_EVENT(name) \
178 	DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
179 			TP_PROTO( \
180 				const struct rpc_task *task, \
181 				const void *action \
182 			), \
183 			TP_ARGS(task, action))
184 
185 DEFINE_RPC_RUNNING_EVENT(begin);
186 DEFINE_RPC_RUNNING_EVENT(run_action);
187 DEFINE_RPC_RUNNING_EVENT(complete);
188 DEFINE_RPC_RUNNING_EVENT(end);
189 
190 DECLARE_EVENT_CLASS(rpc_task_queued,
191 
192 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
193 
194 	TP_ARGS(task, q),
195 
196 	TP_STRUCT__entry(
197 		__field(unsigned int, task_id)
198 		__field(unsigned int, client_id)
199 		__field(unsigned long, timeout)
200 		__field(unsigned long, runstate)
201 		__field(int, status)
202 		__field(unsigned short, flags)
203 		__string(q_name, rpc_qname(q))
204 		),
205 
206 	TP_fast_assign(
207 		__entry->client_id = task->tk_client ?
208 				     task->tk_client->cl_clid : -1;
209 		__entry->task_id = task->tk_pid;
210 		__entry->timeout = rpc_task_timeout(task);
211 		__entry->runstate = task->tk_runstate;
212 		__entry->status = task->tk_status;
213 		__entry->flags = task->tk_flags;
214 		__assign_str(q_name, rpc_qname(q));
215 		),
216 
217 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
218 		__entry->task_id, __entry->client_id,
219 		rpc_show_task_flags(__entry->flags),
220 		rpc_show_runstate(__entry->runstate),
221 		__entry->status,
222 		__entry->timeout,
223 		__get_str(q_name)
224 		)
225 );
226 #define DEFINE_RPC_QUEUED_EVENT(name) \
227 	DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
228 			TP_PROTO( \
229 				const struct rpc_task *task, \
230 				const struct rpc_wait_queue *q \
231 			), \
232 			TP_ARGS(task, q))
233 
234 DEFINE_RPC_QUEUED_EVENT(sleep);
235 DEFINE_RPC_QUEUED_EVENT(wakeup);
236 
237 DECLARE_EVENT_CLASS(rpc_failure,
238 
239 	TP_PROTO(const struct rpc_task *task),
240 
241 	TP_ARGS(task),
242 
243 	TP_STRUCT__entry(
244 		__field(unsigned int, task_id)
245 		__field(unsigned int, client_id)
246 	),
247 
248 	TP_fast_assign(
249 		__entry->task_id = task->tk_pid;
250 		__entry->client_id = task->tk_client->cl_clid;
251 	),
252 
253 	TP_printk("task:%u@%u",
254 		__entry->task_id, __entry->client_id)
255 );
256 
257 #define DEFINE_RPC_FAILURE(name)					\
258 	DEFINE_EVENT(rpc_failure, rpc_bad_##name,			\
259 			TP_PROTO(					\
260 				const struct rpc_task *task		\
261 			),						\
262 			TP_ARGS(task))
263 
264 DEFINE_RPC_FAILURE(callhdr);
265 DEFINE_RPC_FAILURE(verifier);
266 
267 DECLARE_EVENT_CLASS(rpc_reply_event,
268 
269 	TP_PROTO(
270 		const struct rpc_task *task
271 	),
272 
273 	TP_ARGS(task),
274 
275 	TP_STRUCT__entry(
276 		__field(unsigned int, task_id)
277 		__field(unsigned int, client_id)
278 		__field(u32, xid)
279 		__string(progname, task->tk_client->cl_program->name)
280 		__field(u32, version)
281 		__string(procname, rpc_proc_name(task))
282 		__string(servername, task->tk_xprt->servername)
283 	),
284 
285 	TP_fast_assign(
286 		__entry->task_id = task->tk_pid;
287 		__entry->client_id = task->tk_client->cl_clid;
288 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
289 		__assign_str(progname, task->tk_client->cl_program->name)
290 		__entry->version = task->tk_client->cl_vers;
291 		__assign_str(procname, rpc_proc_name(task))
292 		__assign_str(servername, task->tk_xprt->servername)
293 	),
294 
295 	TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s",
296 		__entry->task_id, __entry->client_id, __get_str(servername),
297 		__entry->xid, __get_str(progname), __entry->version,
298 		__get_str(procname))
299 )
300 
301 #define DEFINE_RPC_REPLY_EVENT(name)					\
302 	DEFINE_EVENT(rpc_reply_event, rpc__##name,			\
303 			TP_PROTO(					\
304 				const struct rpc_task *task		\
305 			),						\
306 			TP_ARGS(task))
307 
308 DEFINE_RPC_REPLY_EVENT(prog_unavail);
309 DEFINE_RPC_REPLY_EVENT(prog_mismatch);
310 DEFINE_RPC_REPLY_EVENT(proc_unavail);
311 DEFINE_RPC_REPLY_EVENT(garbage_args);
312 DEFINE_RPC_REPLY_EVENT(unparsable);
313 DEFINE_RPC_REPLY_EVENT(mismatch);
314 DEFINE_RPC_REPLY_EVENT(stale_creds);
315 DEFINE_RPC_REPLY_EVENT(bad_creds);
316 DEFINE_RPC_REPLY_EVENT(auth_tooweak);
317 
318 TRACE_EVENT(rpc_stats_latency,
319 
320 	TP_PROTO(
321 		const struct rpc_task *task,
322 		ktime_t backlog,
323 		ktime_t rtt,
324 		ktime_t execute
325 	),
326 
327 	TP_ARGS(task, backlog, rtt, execute),
328 
329 	TP_STRUCT__entry(
330 		__field(unsigned int, task_id)
331 		__field(unsigned int, client_id)
332 		__field(u32, xid)
333 		__field(int, version)
334 		__string(progname, task->tk_client->cl_program->name)
335 		__string(procname, rpc_proc_name(task))
336 		__field(unsigned long, backlog)
337 		__field(unsigned long, rtt)
338 		__field(unsigned long, execute)
339 	),
340 
341 	TP_fast_assign(
342 		__entry->client_id = task->tk_client->cl_clid;
343 		__entry->task_id = task->tk_pid;
344 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
345 		__entry->version = task->tk_client->cl_vers;
346 		__assign_str(progname, task->tk_client->cl_program->name)
347 		__assign_str(procname, rpc_proc_name(task))
348 		__entry->backlog = ktime_to_us(backlog);
349 		__entry->rtt = ktime_to_us(rtt);
350 		__entry->execute = ktime_to_us(execute);
351 	),
352 
353 	TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
354 		__entry->task_id, __entry->client_id, __entry->xid,
355 		__get_str(progname), __entry->version, __get_str(procname),
356 		__entry->backlog, __entry->rtt, __entry->execute)
357 );
358 
359 TRACE_EVENT(rpc_xdr_overflow,
360 	TP_PROTO(
361 		const struct xdr_stream *xdr,
362 		size_t requested
363 	),
364 
365 	TP_ARGS(xdr, requested),
366 
367 	TP_STRUCT__entry(
368 		__field(unsigned int, task_id)
369 		__field(unsigned int, client_id)
370 		__field(int, version)
371 		__field(size_t, requested)
372 		__field(const void *, end)
373 		__field(const void *, p)
374 		__field(const void *, head_base)
375 		__field(size_t, head_len)
376 		__field(const void *, tail_base)
377 		__field(size_t, tail_len)
378 		__field(unsigned int, page_len)
379 		__field(unsigned int, len)
380 		__string(progname,
381 			 xdr->rqst->rq_task->tk_client->cl_program->name)
382 		__string(procedure,
383 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
384 	),
385 
386 	TP_fast_assign(
387 		if (xdr->rqst) {
388 			const struct rpc_task *task = xdr->rqst->rq_task;
389 
390 			__entry->task_id = task->tk_pid;
391 			__entry->client_id = task->tk_client->cl_clid;
392 			__assign_str(progname,
393 				     task->tk_client->cl_program->name)
394 			__entry->version = task->tk_client->cl_vers;
395 			__assign_str(procedure, task->tk_msg.rpc_proc->p_name)
396 		} else {
397 			__entry->task_id = 0;
398 			__entry->client_id = 0;
399 			__assign_str(progname, "unknown")
400 			__entry->version = 0;
401 			__assign_str(procedure, "unknown")
402 		}
403 		__entry->requested = requested;
404 		__entry->end = xdr->end;
405 		__entry->p = xdr->p;
406 		__entry->head_base = xdr->buf->head[0].iov_base,
407 		__entry->head_len = xdr->buf->head[0].iov_len,
408 		__entry->page_len = xdr->buf->page_len,
409 		__entry->tail_base = xdr->buf->tail[0].iov_base,
410 		__entry->tail_len = xdr->buf->tail[0].iov_len,
411 		__entry->len = xdr->buf->len;
412 	),
413 
414 	TP_printk(
415 		"task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
416 		__entry->task_id, __entry->client_id,
417 		__get_str(progname), __entry->version, __get_str(procedure),
418 		__entry->requested, __entry->p, __entry->end,
419 		__entry->head_base, __entry->head_len,
420 		__entry->page_len,
421 		__entry->tail_base, __entry->tail_len,
422 		__entry->len
423 	)
424 );
425 
426 TRACE_EVENT(rpc_xdr_alignment,
427 	TP_PROTO(
428 		const struct xdr_stream *xdr,
429 		size_t offset,
430 		unsigned int copied
431 	),
432 
433 	TP_ARGS(xdr, offset, copied),
434 
435 	TP_STRUCT__entry(
436 		__field(unsigned int, task_id)
437 		__field(unsigned int, client_id)
438 		__field(int, version)
439 		__field(size_t, offset)
440 		__field(unsigned int, copied)
441 		__field(const void *, head_base)
442 		__field(size_t, head_len)
443 		__field(const void *, tail_base)
444 		__field(size_t, tail_len)
445 		__field(unsigned int, page_len)
446 		__field(unsigned int, len)
447 		__string(progname,
448 			 xdr->rqst->rq_task->tk_client->cl_program->name)
449 		__string(procedure,
450 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
451 	),
452 
453 	TP_fast_assign(
454 		const struct rpc_task *task = xdr->rqst->rq_task;
455 
456 		__entry->task_id = task->tk_pid;
457 		__entry->client_id = task->tk_client->cl_clid;
458 		__assign_str(progname,
459 			     task->tk_client->cl_program->name)
460 		__entry->version = task->tk_client->cl_vers;
461 		__assign_str(procedure, task->tk_msg.rpc_proc->p_name)
462 
463 		__entry->offset = offset;
464 		__entry->copied = copied;
465 		__entry->head_base = xdr->buf->head[0].iov_base,
466 		__entry->head_len = xdr->buf->head[0].iov_len,
467 		__entry->page_len = xdr->buf->page_len,
468 		__entry->tail_base = xdr->buf->tail[0].iov_base,
469 		__entry->tail_len = xdr->buf->tail[0].iov_len,
470 		__entry->len = xdr->buf->len;
471 	),
472 
473 	TP_printk(
474 		"task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
475 		__entry->task_id, __entry->client_id,
476 		__get_str(progname), __entry->version, __get_str(procedure),
477 		__entry->offset, __entry->copied,
478 		__entry->head_base, __entry->head_len,
479 		__entry->page_len,
480 		__entry->tail_base, __entry->tail_len,
481 		__entry->len
482 	)
483 );
484 
485 TRACE_EVENT(rpc_reply_pages,
486 	TP_PROTO(
487 		const struct rpc_rqst *req
488 	),
489 
490 	TP_ARGS(req),
491 
492 	TP_STRUCT__entry(
493 		__field(unsigned int, task_id)
494 		__field(unsigned int, client_id)
495 		__field(const void *, head_base)
496 		__field(size_t, head_len)
497 		__field(const void *, tail_base)
498 		__field(size_t, tail_len)
499 		__field(unsigned int, page_len)
500 	),
501 
502 	TP_fast_assign(
503 		__entry->task_id = req->rq_task->tk_pid;
504 		__entry->client_id = req->rq_task->tk_client->cl_clid;
505 
506 		__entry->head_base = req->rq_rcv_buf.head[0].iov_base;
507 		__entry->head_len = req->rq_rcv_buf.head[0].iov_len;
508 		__entry->page_len = req->rq_rcv_buf.page_len;
509 		__entry->tail_base = req->rq_rcv_buf.tail[0].iov_base;
510 		__entry->tail_len = req->rq_rcv_buf.tail[0].iov_len;
511 	),
512 
513 	TP_printk(
514 		"task:%u@%u xdr=[%p,%zu]/%u/[%p,%zu]\n",
515 		__entry->task_id, __entry->client_id,
516 		__entry->head_base, __entry->head_len,
517 		__entry->page_len,
518 		__entry->tail_base, __entry->tail_len
519 	)
520 );
521 
522 /*
523  * First define the enums in the below macros to be exported to userspace
524  * via TRACE_DEFINE_ENUM().
525  */
526 #undef EM
527 #undef EMe
528 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
529 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
530 
531 #define RPC_SHOW_SOCKET				\
532 	EM( SS_FREE, "FREE" )			\
533 	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
534 	EM( SS_CONNECTING, "CONNECTING," )	\
535 	EM( SS_CONNECTED, "CONNECTED," )	\
536 	EMe(SS_DISCONNECTING, "DISCONNECTING" )
537 
538 #define rpc_show_socket_state(state) \
539 	__print_symbolic(state, RPC_SHOW_SOCKET)
540 
541 RPC_SHOW_SOCKET
542 
543 #define RPC_SHOW_SOCK				\
544 	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
545 	EM( TCP_SYN_SENT, "SYN_SENT" )		\
546 	EM( TCP_SYN_RECV, "SYN_RECV" )		\
547 	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
548 	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
549 	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
550 	EM( TCP_CLOSE, "CLOSE" )		\
551 	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
552 	EM( TCP_LAST_ACK, "LAST_ACK" )		\
553 	EM( TCP_LISTEN, "LISTEN" )		\
554 	EMe( TCP_CLOSING, "CLOSING" )
555 
556 #define rpc_show_sock_state(state) \
557 	__print_symbolic(state, RPC_SHOW_SOCK)
558 
559 RPC_SHOW_SOCK
560 
561 /*
562  * Now redefine the EM() and EMe() macros to map the enums to the strings
563  * that will be printed in the output.
564  */
565 #undef EM
566 #undef EMe
567 #define EM(a, b)	{a, b},
568 #define EMe(a, b)	{a, b}
569 
570 DECLARE_EVENT_CLASS(xs_socket_event,
571 
572 		TP_PROTO(
573 			struct rpc_xprt *xprt,
574 			struct socket *socket
575 		),
576 
577 		TP_ARGS(xprt, socket),
578 
579 		TP_STRUCT__entry(
580 			__field(unsigned int, socket_state)
581 			__field(unsigned int, sock_state)
582 			__field(unsigned long long, ino)
583 			__string(dstaddr,
584 				xprt->address_strings[RPC_DISPLAY_ADDR])
585 			__string(dstport,
586 				xprt->address_strings[RPC_DISPLAY_PORT])
587 		),
588 
589 		TP_fast_assign(
590 			struct inode *inode = SOCK_INODE(socket);
591 			__entry->socket_state = socket->state;
592 			__entry->sock_state = socket->sk->sk_state;
593 			__entry->ino = (unsigned long long)inode->i_ino;
594 			__assign_str(dstaddr,
595 				xprt->address_strings[RPC_DISPLAY_ADDR]);
596 			__assign_str(dstport,
597 				xprt->address_strings[RPC_DISPLAY_PORT]);
598 		),
599 
600 		TP_printk(
601 			"socket:[%llu] dstaddr=%s/%s "
602 			"state=%u (%s) sk_state=%u (%s)",
603 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
604 			__entry->socket_state,
605 			rpc_show_socket_state(__entry->socket_state),
606 			__entry->sock_state,
607 			rpc_show_sock_state(__entry->sock_state)
608 		)
609 );
610 #define DEFINE_RPC_SOCKET_EVENT(name) \
611 	DEFINE_EVENT(xs_socket_event, name, \
612 			TP_PROTO( \
613 				struct rpc_xprt *xprt, \
614 				struct socket *socket \
615 			), \
616 			TP_ARGS(xprt, socket))
617 
618 DECLARE_EVENT_CLASS(xs_socket_event_done,
619 
620 		TP_PROTO(
621 			struct rpc_xprt *xprt,
622 			struct socket *socket,
623 			int error
624 		),
625 
626 		TP_ARGS(xprt, socket, error),
627 
628 		TP_STRUCT__entry(
629 			__field(int, error)
630 			__field(unsigned int, socket_state)
631 			__field(unsigned int, sock_state)
632 			__field(unsigned long long, ino)
633 			__string(dstaddr,
634 				xprt->address_strings[RPC_DISPLAY_ADDR])
635 			__string(dstport,
636 				xprt->address_strings[RPC_DISPLAY_PORT])
637 		),
638 
639 		TP_fast_assign(
640 			struct inode *inode = SOCK_INODE(socket);
641 			__entry->socket_state = socket->state;
642 			__entry->sock_state = socket->sk->sk_state;
643 			__entry->ino = (unsigned long long)inode->i_ino;
644 			__entry->error = error;
645 			__assign_str(dstaddr,
646 				xprt->address_strings[RPC_DISPLAY_ADDR]);
647 			__assign_str(dstport,
648 				xprt->address_strings[RPC_DISPLAY_PORT]);
649 		),
650 
651 		TP_printk(
652 			"error=%d socket:[%llu] dstaddr=%s/%s "
653 			"state=%u (%s) sk_state=%u (%s)",
654 			__entry->error,
655 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
656 			__entry->socket_state,
657 			rpc_show_socket_state(__entry->socket_state),
658 			__entry->sock_state,
659 			rpc_show_sock_state(__entry->sock_state)
660 		)
661 );
662 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
663 	DEFINE_EVENT(xs_socket_event_done, name, \
664 			TP_PROTO( \
665 				struct rpc_xprt *xprt, \
666 				struct socket *socket, \
667 				int error \
668 			), \
669 			TP_ARGS(xprt, socket, error))
670 
671 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
672 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
673 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
674 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
675 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
676 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
677 
678 DECLARE_EVENT_CLASS(rpc_xprt_event,
679 	TP_PROTO(
680 		const struct rpc_xprt *xprt,
681 		__be32 xid,
682 		int status
683 	),
684 
685 	TP_ARGS(xprt, xid, status),
686 
687 	TP_STRUCT__entry(
688 		__field(u32, xid)
689 		__field(int, status)
690 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
691 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
692 	),
693 
694 	TP_fast_assign(
695 		__entry->xid = be32_to_cpu(xid);
696 		__entry->status = status;
697 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
698 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
699 	),
700 
701 	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
702 			__get_str(port), __entry->xid,
703 			__entry->status)
704 );
705 #define DEFINE_RPC_XPRT_EVENT(name) \
706 	DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
707 			TP_PROTO( \
708 				const struct rpc_xprt *xprt, \
709 				__be32 xid, \
710 				int status \
711 			), \
712 			TP_ARGS(xprt, xid, status))
713 
714 DEFINE_RPC_XPRT_EVENT(timer);
715 DEFINE_RPC_XPRT_EVENT(lookup_rqst);
716 DEFINE_RPC_XPRT_EVENT(complete_rqst);
717 
718 TRACE_EVENT(xprt_transmit,
719 	TP_PROTO(
720 		const struct rpc_rqst *rqst,
721 		int status
722 	),
723 
724 	TP_ARGS(rqst, status),
725 
726 	TP_STRUCT__entry(
727 		__field(unsigned int, task_id)
728 		__field(unsigned int, client_id)
729 		__field(u32, xid)
730 		__field(u32, seqno)
731 		__field(int, status)
732 	),
733 
734 	TP_fast_assign(
735 		__entry->task_id = rqst->rq_task->tk_pid;
736 		__entry->client_id = rqst->rq_task->tk_client ?
737 			rqst->rq_task->tk_client->cl_clid : -1;
738 		__entry->xid = be32_to_cpu(rqst->rq_xid);
739 		__entry->seqno = rqst->rq_seqno;
740 		__entry->status = status;
741 	),
742 
743 	TP_printk(
744 		"task:%u@%u xid=0x%08x seqno=%u status=%d",
745 		__entry->task_id, __entry->client_id, __entry->xid,
746 		__entry->seqno, __entry->status)
747 );
748 
749 TRACE_EVENT(xprt_enq_xmit,
750 	TP_PROTO(
751 		const struct rpc_task *task,
752 		int stage
753 	),
754 
755 	TP_ARGS(task, stage),
756 
757 	TP_STRUCT__entry(
758 		__field(unsigned int, task_id)
759 		__field(unsigned int, client_id)
760 		__field(u32, xid)
761 		__field(u32, seqno)
762 		__field(int, stage)
763 	),
764 
765 	TP_fast_assign(
766 		__entry->task_id = task->tk_pid;
767 		__entry->client_id = task->tk_client ?
768 			task->tk_client->cl_clid : -1;
769 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
770 		__entry->seqno = task->tk_rqstp->rq_seqno;
771 		__entry->stage = stage;
772 	),
773 
774 	TP_printk(
775 		"task:%u@%u xid=0x%08x seqno=%u stage=%d",
776 		__entry->task_id, __entry->client_id, __entry->xid,
777 		__entry->seqno, __entry->stage)
778 );
779 
780 TRACE_EVENT(xprt_ping,
781 	TP_PROTO(const struct rpc_xprt *xprt, int status),
782 
783 	TP_ARGS(xprt, status),
784 
785 	TP_STRUCT__entry(
786 		__field(int, status)
787 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
788 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
789 	),
790 
791 	TP_fast_assign(
792 		__entry->status = status;
793 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
794 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
795 	),
796 
797 	TP_printk("peer=[%s]:%s status=%d",
798 			__get_str(addr), __get_str(port), __entry->status)
799 );
800 
801 DECLARE_EVENT_CLASS(xprt_writelock_event,
802 	TP_PROTO(
803 		const struct rpc_xprt *xprt, const struct rpc_task *task
804 	),
805 
806 	TP_ARGS(xprt, task),
807 
808 	TP_STRUCT__entry(
809 		__field(unsigned int, task_id)
810 		__field(unsigned int, client_id)
811 		__field(unsigned int, snd_task_id)
812 	),
813 
814 	TP_fast_assign(
815 		if (task) {
816 			__entry->task_id = task->tk_pid;
817 			__entry->client_id = task->tk_client ?
818 					     task->tk_client->cl_clid : -1;
819 		} else {
820 			__entry->task_id = -1;
821 			__entry->client_id = -1;
822 		}
823 		__entry->snd_task_id = xprt->snd_task ?
824 					xprt->snd_task->tk_pid : -1;
825 	),
826 
827 	TP_printk("task:%u@%u snd_task:%u",
828 			__entry->task_id, __entry->client_id,
829 			__entry->snd_task_id)
830 );
831 
832 #define DEFINE_WRITELOCK_EVENT(name) \
833 	DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
834 			TP_PROTO( \
835 				const struct rpc_xprt *xprt, \
836 				const struct rpc_task *task \
837 			), \
838 			TP_ARGS(xprt, task))
839 
840 DEFINE_WRITELOCK_EVENT(reserve_xprt);
841 DEFINE_WRITELOCK_EVENT(release_xprt);
842 
843 DECLARE_EVENT_CLASS(xprt_cong_event,
844 	TP_PROTO(
845 		const struct rpc_xprt *xprt, const struct rpc_task *task
846 	),
847 
848 	TP_ARGS(xprt, task),
849 
850 	TP_STRUCT__entry(
851 		__field(unsigned int, task_id)
852 		__field(unsigned int, client_id)
853 		__field(unsigned int, snd_task_id)
854 		__field(unsigned long, cong)
855 		__field(unsigned long, cwnd)
856 		__field(bool, wait)
857 	),
858 
859 	TP_fast_assign(
860 		if (task) {
861 			__entry->task_id = task->tk_pid;
862 			__entry->client_id = task->tk_client ?
863 					     task->tk_client->cl_clid : -1;
864 		} else {
865 			__entry->task_id = -1;
866 			__entry->client_id = -1;
867 		}
868 		__entry->snd_task_id = xprt->snd_task ?
869 					xprt->snd_task->tk_pid : -1;
870 		__entry->cong = xprt->cong;
871 		__entry->cwnd = xprt->cwnd;
872 		__entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
873 	),
874 
875 	TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s",
876 			__entry->task_id, __entry->client_id,
877 			__entry->snd_task_id, __entry->cong, __entry->cwnd,
878 			__entry->wait ? " (wait)" : "")
879 );
880 
881 #define DEFINE_CONG_EVENT(name) \
882 	DEFINE_EVENT(xprt_cong_event, xprt_##name, \
883 			TP_PROTO( \
884 				const struct rpc_xprt *xprt, \
885 				const struct rpc_task *task \
886 			), \
887 			TP_ARGS(xprt, task))
888 
889 DEFINE_CONG_EVENT(reserve_cong);
890 DEFINE_CONG_EVENT(release_cong);
891 DEFINE_CONG_EVENT(get_cong);
892 DEFINE_CONG_EVENT(put_cong);
893 
894 TRACE_EVENT(xs_stream_read_data,
895 	TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
896 
897 	TP_ARGS(xprt, err, total),
898 
899 	TP_STRUCT__entry(
900 		__field(ssize_t, err)
901 		__field(size_t, total)
902 		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
903 				"(null)")
904 		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
905 				"(null)")
906 	),
907 
908 	TP_fast_assign(
909 		__entry->err = err;
910 		__entry->total = total;
911 		__assign_str(addr, xprt ?
912 			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
913 		__assign_str(port, xprt ?
914 			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
915 	),
916 
917 	TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
918 			__get_str(port), __entry->err, __entry->total)
919 );
920 
921 TRACE_EVENT(xs_stream_read_request,
922 	TP_PROTO(struct sock_xprt *xs),
923 
924 	TP_ARGS(xs),
925 
926 	TP_STRUCT__entry(
927 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
928 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
929 		__field(u32, xid)
930 		__field(unsigned long, copied)
931 		__field(unsigned int, reclen)
932 		__field(unsigned int, offset)
933 	),
934 
935 	TP_fast_assign(
936 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
937 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
938 		__entry->xid = be32_to_cpu(xs->recv.xid);
939 		__entry->copied = xs->recv.copied;
940 		__entry->reclen = xs->recv.len;
941 		__entry->offset = xs->recv.offset;
942 	),
943 
944 	TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
945 			__get_str(addr), __get_str(port), __entry->xid,
946 			__entry->copied, __entry->reclen, __entry->offset)
947 );
948 
949 #define show_rqstp_flags(flags)						\
950 	__print_flags(flags, "|",					\
951 		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
952 		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
953 		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
954 		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
955 		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
956 		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
957 		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
958 
959 TRACE_EVENT(svc_recv,
960 	TP_PROTO(struct svc_rqst *rqst, int len),
961 
962 	TP_ARGS(rqst, len),
963 
964 	TP_STRUCT__entry(
965 		__field(u32, xid)
966 		__field(int, len)
967 		__field(unsigned long, flags)
968 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
969 	),
970 
971 	TP_fast_assign(
972 		__entry->xid = be32_to_cpu(rqst->rq_xid);
973 		__entry->len = len;
974 		__entry->flags = rqst->rq_flags;
975 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
976 	),
977 
978 	TP_printk("addr=%s xid=0x%08x len=%d flags=%s",
979 			__get_str(addr), __entry->xid, __entry->len,
980 			show_rqstp_flags(__entry->flags))
981 );
982 
983 #define svc_show_status(status)				\
984 	__print_symbolic(status,			\
985 		{ SVC_GARBAGE,	"SVC_GARBAGE" },	\
986 		{ SVC_SYSERR,	"SVC_SYSERR" },		\
987 		{ SVC_VALID,	"SVC_VALID" },		\
988 		{ SVC_NEGATIVE,	"SVC_NEGATIVE" },	\
989 		{ SVC_OK,	"SVC_OK" },		\
990 		{ SVC_DROP,	"SVC_DROP" },		\
991 		{ SVC_CLOSE,	"SVC_CLOSE" },		\
992 		{ SVC_DENIED,	"SVC_DENIED" },		\
993 		{ SVC_PENDING,	"SVC_PENDING" },	\
994 		{ SVC_COMPLETE,	"SVC_COMPLETE" })
995 
996 TRACE_EVENT(svc_authenticate,
997 	TP_PROTO(const struct svc_rqst *rqst, int auth_res, __be32 auth_stat),
998 
999 	TP_ARGS(rqst, auth_res, auth_stat),
1000 
1001 	TP_STRUCT__entry(
1002 		__field(u32, xid)
1003 		__field(unsigned long, svc_status)
1004 		__field(unsigned long, auth_stat)
1005 	),
1006 
1007 	TP_fast_assign(
1008 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1009 		__entry->svc_status = auth_res;
1010 		__entry->auth_stat = be32_to_cpu(auth_stat);
1011 	),
1012 
1013 	TP_printk("xid=0x%08x auth_res=%s auth_stat=%s",
1014 			__entry->xid, svc_show_status(__entry->svc_status),
1015 			rpc_show_auth_stat(__entry->auth_stat))
1016 );
1017 
1018 TRACE_EVENT(svc_process,
1019 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
1020 
1021 	TP_ARGS(rqst, name),
1022 
1023 	TP_STRUCT__entry(
1024 		__field(u32, xid)
1025 		__field(u32, vers)
1026 		__field(u32, proc)
1027 		__string(service, name)
1028 		__string(addr, rqst->rq_xprt ?
1029 			 rqst->rq_xprt->xpt_remotebuf : "(null)")
1030 	),
1031 
1032 	TP_fast_assign(
1033 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1034 		__entry->vers = rqst->rq_vers;
1035 		__entry->proc = rqst->rq_proc;
1036 		__assign_str(service, name);
1037 		__assign_str(addr, rqst->rq_xprt ?
1038 			     rqst->rq_xprt->xpt_remotebuf : "(null)");
1039 	),
1040 
1041 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%u",
1042 			__get_str(addr), __entry->xid,
1043 			__get_str(service), __entry->vers, __entry->proc)
1044 );
1045 
1046 DECLARE_EVENT_CLASS(svc_rqst_event,
1047 
1048 	TP_PROTO(
1049 		const struct svc_rqst *rqst
1050 	),
1051 
1052 	TP_ARGS(rqst),
1053 
1054 	TP_STRUCT__entry(
1055 		__field(u32, xid)
1056 		__field(unsigned long, flags)
1057 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1058 	),
1059 
1060 	TP_fast_assign(
1061 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1062 		__entry->flags = rqst->rq_flags;
1063 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1064 	),
1065 
1066 	TP_printk("addr=%s xid=0x%08x flags=%s",
1067 			__get_str(addr), __entry->xid,
1068 			show_rqstp_flags(__entry->flags))
1069 );
1070 #define DEFINE_SVC_RQST_EVENT(name) \
1071 	DEFINE_EVENT(svc_rqst_event, svc_##name, \
1072 			TP_PROTO( \
1073 				const struct svc_rqst *rqst \
1074 			), \
1075 			TP_ARGS(rqst))
1076 
1077 DEFINE_SVC_RQST_EVENT(defer);
1078 DEFINE_SVC_RQST_EVENT(drop);
1079 
1080 DECLARE_EVENT_CLASS(svc_rqst_status,
1081 
1082 	TP_PROTO(struct svc_rqst *rqst, int status),
1083 
1084 	TP_ARGS(rqst, status),
1085 
1086 	TP_STRUCT__entry(
1087 		__field(u32, xid)
1088 		__field(int, status)
1089 		__field(unsigned long, flags)
1090 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1091 	),
1092 
1093 	TP_fast_assign(
1094 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1095 		__entry->status = status;
1096 		__entry->flags = rqst->rq_flags;
1097 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1098 	),
1099 
1100 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
1101 		  __get_str(addr), __entry->xid,
1102 		  __entry->status, show_rqstp_flags(__entry->flags))
1103 );
1104 
1105 DEFINE_EVENT(svc_rqst_status, svc_send,
1106 	TP_PROTO(struct svc_rqst *rqst, int status),
1107 	TP_ARGS(rqst, status));
1108 
1109 #define show_svc_xprt_flags(flags)					\
1110 	__print_flags(flags, "|",					\
1111 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
1112 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
1113 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
1114 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
1115 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
1116 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
1117 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
1118 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
1119 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
1120 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
1121 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
1122 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
1123 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
1124 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
1125 
1126 TRACE_EVENT(svc_xprt_do_enqueue,
1127 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
1128 
1129 	TP_ARGS(xprt, rqst),
1130 
1131 	TP_STRUCT__entry(
1132 		__field(struct svc_xprt *, xprt)
1133 		__field(int, pid)
1134 		__field(unsigned long, flags)
1135 		__string(addr, xprt->xpt_remotebuf)
1136 	),
1137 
1138 	TP_fast_assign(
1139 		__entry->xprt = xprt;
1140 		__entry->pid = rqst? rqst->rq_task->pid : 0;
1141 		__entry->flags = xprt->xpt_flags;
1142 		__assign_str(addr, xprt->xpt_remotebuf);
1143 	),
1144 
1145 	TP_printk("xprt=%p addr=%s pid=%d flags=%s",
1146 			__entry->xprt, __get_str(addr),
1147 			__entry->pid, show_svc_xprt_flags(__entry->flags))
1148 );
1149 
1150 DECLARE_EVENT_CLASS(svc_xprt_event,
1151 	TP_PROTO(struct svc_xprt *xprt),
1152 
1153 	TP_ARGS(xprt),
1154 
1155 	TP_STRUCT__entry(
1156 		__field(struct svc_xprt *, xprt)
1157 		__field(unsigned long, flags)
1158 		__string(addr, xprt->xpt_remotebuf)
1159 	),
1160 
1161 	TP_fast_assign(
1162 		__entry->xprt = xprt;
1163 		__entry->flags = xprt->xpt_flags;
1164 		__assign_str(addr, xprt->xpt_remotebuf);
1165 	),
1166 
1167 	TP_printk("xprt=%p addr=%s flags=%s",
1168 			__entry->xprt, __get_str(addr),
1169 			show_svc_xprt_flags(__entry->flags))
1170 );
1171 
1172 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
1173 	TP_PROTO(struct svc_xprt *xprt),
1174 	TP_ARGS(xprt));
1175 
1176 TRACE_EVENT(svc_xprt_dequeue,
1177 	TP_PROTO(struct svc_rqst *rqst),
1178 
1179 	TP_ARGS(rqst),
1180 
1181 	TP_STRUCT__entry(
1182 		__field(struct svc_xprt *, xprt)
1183 		__field(unsigned long, flags)
1184 		__field(unsigned long, wakeup)
1185 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1186 	),
1187 
1188 	TP_fast_assign(
1189 		__entry->xprt = rqst->rq_xprt;
1190 		__entry->flags = rqst->rq_xprt->xpt_flags;
1191 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
1192 							rqst->rq_qtime));
1193 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1194 	),
1195 
1196 	TP_printk("xprt=%p addr=%s flags=%s wakeup-us=%lu",
1197 			__entry->xprt, __get_str(addr),
1198 			show_svc_xprt_flags(__entry->flags),
1199 			__entry->wakeup)
1200 );
1201 
1202 TRACE_EVENT(svc_wake_up,
1203 	TP_PROTO(int pid),
1204 
1205 	TP_ARGS(pid),
1206 
1207 	TP_STRUCT__entry(
1208 		__field(int, pid)
1209 	),
1210 
1211 	TP_fast_assign(
1212 		__entry->pid = pid;
1213 	),
1214 
1215 	TP_printk("pid=%d", __entry->pid)
1216 );
1217 
1218 TRACE_EVENT(svc_handle_xprt,
1219 	TP_PROTO(struct svc_xprt *xprt, int len),
1220 
1221 	TP_ARGS(xprt, len),
1222 
1223 	TP_STRUCT__entry(
1224 		__field(struct svc_xprt *, xprt)
1225 		__field(int, len)
1226 		__field(unsigned long, flags)
1227 		__string(addr, xprt->xpt_remotebuf)
1228 	),
1229 
1230 	TP_fast_assign(
1231 		__entry->xprt = xprt;
1232 		__entry->len = len;
1233 		__entry->flags = xprt->xpt_flags;
1234 		__assign_str(addr, xprt->xpt_remotebuf);
1235 	),
1236 
1237 	TP_printk("xprt=%p addr=%s len=%d flags=%s",
1238 		__entry->xprt, __get_str(addr),
1239 		__entry->len, show_svc_xprt_flags(__entry->flags))
1240 );
1241 
1242 TRACE_EVENT(svc_stats_latency,
1243 	TP_PROTO(const struct svc_rqst *rqst),
1244 
1245 	TP_ARGS(rqst),
1246 
1247 	TP_STRUCT__entry(
1248 		__field(u32, xid)
1249 		__field(unsigned long, execute)
1250 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1251 	),
1252 
1253 	TP_fast_assign(
1254 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1255 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
1256 							 rqst->rq_stime));
1257 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1258 	),
1259 
1260 	TP_printk("addr=%s xid=0x%08x execute-us=%lu",
1261 		__get_str(addr), __entry->xid, __entry->execute)
1262 );
1263 
1264 DECLARE_EVENT_CLASS(svc_deferred_event,
1265 	TP_PROTO(
1266 		const struct svc_deferred_req *dr
1267 	),
1268 
1269 	TP_ARGS(dr),
1270 
1271 	TP_STRUCT__entry(
1272 		__field(u32, xid)
1273 		__string(addr, dr->xprt->xpt_remotebuf)
1274 	),
1275 
1276 	TP_fast_assign(
1277 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
1278 						       (dr->xprt_hlen>>2)));
1279 		__assign_str(addr, dr->xprt->xpt_remotebuf);
1280 	),
1281 
1282 	TP_printk("addr=%s xid=0x%08x", __get_str(addr), __entry->xid)
1283 );
1284 #define DEFINE_SVC_DEFERRED_EVENT(name) \
1285 	DEFINE_EVENT(svc_deferred_event, svc_##name##_deferred, \
1286 			TP_PROTO( \
1287 				const struct svc_deferred_req *dr \
1288 			), \
1289 			TP_ARGS(dr))
1290 
1291 DEFINE_SVC_DEFERRED_EVENT(drop);
1292 DEFINE_SVC_DEFERRED_EVENT(revisit);
1293 
1294 #endif /* _TRACE_SUNRPC_H */
1295 
1296 #include <trace/define_trace.h>
1297