xref: /linux/include/trace/events/sunrpc.h (revision 9052e9c95d908d6c3d7570aadc8898e1d871c8bb)
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(SOCK_STREAM);
18 TRACE_DEFINE_ENUM(SOCK_DGRAM);
19 TRACE_DEFINE_ENUM(SOCK_RAW);
20 TRACE_DEFINE_ENUM(SOCK_RDM);
21 TRACE_DEFINE_ENUM(SOCK_SEQPACKET);
22 TRACE_DEFINE_ENUM(SOCK_DCCP);
23 TRACE_DEFINE_ENUM(SOCK_PACKET);
24 
25 #define show_socket_type(type)					\
26 	__print_symbolic(type,					\
27 		{ SOCK_STREAM,		"STREAM" },		\
28 		{ SOCK_DGRAM,		"DGRAM" },		\
29 		{ SOCK_RAW,		"RAW" },		\
30 		{ SOCK_RDM,		"RDM" },		\
31 		{ SOCK_SEQPACKET,	"SEQPACKET" },		\
32 		{ SOCK_DCCP,		"DCCP" },		\
33 		{ SOCK_PACKET,		"PACKET" })
34 
35 /* This list is known to be incomplete, add new enums as needed. */
36 TRACE_DEFINE_ENUM(AF_UNSPEC);
37 TRACE_DEFINE_ENUM(AF_UNIX);
38 TRACE_DEFINE_ENUM(AF_LOCAL);
39 TRACE_DEFINE_ENUM(AF_INET);
40 TRACE_DEFINE_ENUM(AF_INET6);
41 
42 #define rpc_show_address_family(family)				\
43 	__print_symbolic(family,				\
44 		{ AF_UNSPEC,		"AF_UNSPEC" },		\
45 		{ AF_UNIX,		"AF_UNIX" },		\
46 		{ AF_LOCAL,		"AF_LOCAL" },		\
47 		{ AF_INET,		"AF_INET" },		\
48 		{ AF_INET6,		"AF_INET6" })
49 
50 DECLARE_EVENT_CLASS(rpc_xdr_buf_class,
51 	TP_PROTO(
52 		const struct rpc_task *task,
53 		const struct xdr_buf *xdr
54 	),
55 
56 	TP_ARGS(task, xdr),
57 
58 	TP_STRUCT__entry(
59 		__field(unsigned int, task_id)
60 		__field(unsigned int, client_id)
61 		__field(const void *, head_base)
62 		__field(size_t, head_len)
63 		__field(const void *, tail_base)
64 		__field(size_t, tail_len)
65 		__field(unsigned int, page_len)
66 		__field(unsigned int, msg_len)
67 	),
68 
69 	TP_fast_assign(
70 		__entry->task_id = task->tk_pid;
71 		__entry->client_id = task->tk_client ?
72 				     task->tk_client->cl_clid : -1;
73 		__entry->head_base = xdr->head[0].iov_base;
74 		__entry->head_len = xdr->head[0].iov_len;
75 		__entry->tail_base = xdr->tail[0].iov_base;
76 		__entry->tail_len = xdr->tail[0].iov_len;
77 		__entry->page_len = xdr->page_len;
78 		__entry->msg_len = xdr->len;
79 	),
80 
81 	TP_printk("task:%u@%u head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
82 		__entry->task_id, __entry->client_id,
83 		__entry->head_base, __entry->head_len, __entry->page_len,
84 		__entry->tail_base, __entry->tail_len, __entry->msg_len
85 	)
86 );
87 
88 #define DEFINE_RPCXDRBUF_EVENT(name)					\
89 		DEFINE_EVENT(rpc_xdr_buf_class,				\
90 				rpc_xdr_##name,				\
91 				TP_PROTO(				\
92 					const struct rpc_task *task,	\
93 					const struct xdr_buf *xdr	\
94 				),					\
95 				TP_ARGS(task, xdr))
96 
97 DEFINE_RPCXDRBUF_EVENT(sendto);
98 DEFINE_RPCXDRBUF_EVENT(recvfrom);
99 DEFINE_RPCXDRBUF_EVENT(reply_pages);
100 
101 
102 DECLARE_EVENT_CLASS(rpc_clnt_class,
103 	TP_PROTO(
104 		const struct rpc_clnt *clnt
105 	),
106 
107 	TP_ARGS(clnt),
108 
109 	TP_STRUCT__entry(
110 		__field(unsigned int, client_id)
111 	),
112 
113 	TP_fast_assign(
114 		__entry->client_id = clnt->cl_clid;
115 	),
116 
117 	TP_printk("clid=%u", __entry->client_id)
118 );
119 
120 #define DEFINE_RPC_CLNT_EVENT(name)					\
121 		DEFINE_EVENT(rpc_clnt_class,				\
122 				rpc_clnt_##name,			\
123 				TP_PROTO(				\
124 					const struct rpc_clnt *clnt	\
125 				),					\
126 				TP_ARGS(clnt))
127 
128 DEFINE_RPC_CLNT_EVENT(free);
129 DEFINE_RPC_CLNT_EVENT(killall);
130 DEFINE_RPC_CLNT_EVENT(shutdown);
131 DEFINE_RPC_CLNT_EVENT(release);
132 DEFINE_RPC_CLNT_EVENT(replace_xprt);
133 DEFINE_RPC_CLNT_EVENT(replace_xprt_err);
134 
135 TRACE_EVENT(rpc_clnt_new,
136 	TP_PROTO(
137 		const struct rpc_clnt *clnt,
138 		const struct rpc_xprt *xprt,
139 		const char *program,
140 		const char *server
141 	),
142 
143 	TP_ARGS(clnt, xprt, program, server),
144 
145 	TP_STRUCT__entry(
146 		__field(unsigned int, client_id)
147 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
148 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
149 		__string(program, program)
150 		__string(server, server)
151 	),
152 
153 	TP_fast_assign(
154 		__entry->client_id = clnt->cl_clid;
155 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
156 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
157 		__assign_str(program, program);
158 		__assign_str(server, server);
159 	),
160 
161 	TP_printk("client=%u peer=[%s]:%s program=%s server=%s",
162 		__entry->client_id, __get_str(addr), __get_str(port),
163 		__get_str(program), __get_str(server))
164 );
165 
166 TRACE_EVENT(rpc_clnt_new_err,
167 	TP_PROTO(
168 		const char *program,
169 		const char *server,
170 		int error
171 	),
172 
173 	TP_ARGS(program, server, error),
174 
175 	TP_STRUCT__entry(
176 		__field(int, error)
177 		__string(program, program)
178 		__string(server, server)
179 	),
180 
181 	TP_fast_assign(
182 		__entry->error = error;
183 		__assign_str(program, program);
184 		__assign_str(server, server);
185 	),
186 
187 	TP_printk("program=%s server=%s error=%d",
188 		__get_str(program), __get_str(server), __entry->error)
189 );
190 
191 TRACE_EVENT(rpc_clnt_clone_err,
192 	TP_PROTO(
193 		const struct rpc_clnt *clnt,
194 		int error
195 	),
196 
197 	TP_ARGS(clnt, error),
198 
199 	TP_STRUCT__entry(
200 		__field(unsigned int, client_id)
201 		__field(int, error)
202 	),
203 
204 	TP_fast_assign(
205 		__entry->client_id = clnt->cl_clid;
206 		__entry->error = error;
207 	),
208 
209 	TP_printk("client=%u error=%d", __entry->client_id, __entry->error)
210 );
211 
212 
213 TRACE_DEFINE_ENUM(RPC_AUTH_OK);
214 TRACE_DEFINE_ENUM(RPC_AUTH_BADCRED);
215 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDCRED);
216 TRACE_DEFINE_ENUM(RPC_AUTH_BADVERF);
217 TRACE_DEFINE_ENUM(RPC_AUTH_REJECTEDVERF);
218 TRACE_DEFINE_ENUM(RPC_AUTH_TOOWEAK);
219 TRACE_DEFINE_ENUM(RPCSEC_GSS_CREDPROBLEM);
220 TRACE_DEFINE_ENUM(RPCSEC_GSS_CTXPROBLEM);
221 
222 #define rpc_show_auth_stat(status)					\
223 	__print_symbolic(status,					\
224 		{ RPC_AUTH_OK,			"AUTH_OK" },		\
225 		{ RPC_AUTH_BADCRED,		"BADCRED" },		\
226 		{ RPC_AUTH_REJECTEDCRED,	"REJECTEDCRED" },	\
227 		{ RPC_AUTH_BADVERF,		"BADVERF" },		\
228 		{ RPC_AUTH_REJECTEDVERF,	"REJECTEDVERF" },	\
229 		{ RPC_AUTH_TOOWEAK,		"TOOWEAK" },		\
230 		{ RPCSEC_GSS_CREDPROBLEM,	"GSS_CREDPROBLEM" },	\
231 		{ RPCSEC_GSS_CTXPROBLEM,	"GSS_CTXPROBLEM" })	\
232 
233 DECLARE_EVENT_CLASS(rpc_task_status,
234 
235 	TP_PROTO(const struct rpc_task *task),
236 
237 	TP_ARGS(task),
238 
239 	TP_STRUCT__entry(
240 		__field(unsigned int, task_id)
241 		__field(unsigned int, client_id)
242 		__field(int, status)
243 	),
244 
245 	TP_fast_assign(
246 		__entry->task_id = task->tk_pid;
247 		__entry->client_id = task->tk_client->cl_clid;
248 		__entry->status = task->tk_status;
249 	),
250 
251 	TP_printk("task:%u@%u status=%d",
252 		__entry->task_id, __entry->client_id,
253 		__entry->status)
254 );
255 #define DEFINE_RPC_STATUS_EVENT(name) \
256 	DEFINE_EVENT(rpc_task_status, rpc_##name##_status, \
257 			TP_PROTO( \
258 				const struct rpc_task *task \
259 			), \
260 			TP_ARGS(task))
261 
262 DEFINE_RPC_STATUS_EVENT(call);
263 DEFINE_RPC_STATUS_EVENT(connect);
264 DEFINE_RPC_STATUS_EVENT(timeout);
265 DEFINE_RPC_STATUS_EVENT(retry_refresh);
266 DEFINE_RPC_STATUS_EVENT(refresh);
267 
268 TRACE_EVENT(rpc_request,
269 	TP_PROTO(const struct rpc_task *task),
270 
271 	TP_ARGS(task),
272 
273 	TP_STRUCT__entry(
274 		__field(unsigned int, task_id)
275 		__field(unsigned int, client_id)
276 		__field(int, version)
277 		__field(bool, async)
278 		__string(progname, task->tk_client->cl_program->name)
279 		__string(procname, rpc_proc_name(task))
280 	),
281 
282 	TP_fast_assign(
283 		__entry->task_id = task->tk_pid;
284 		__entry->client_id = task->tk_client->cl_clid;
285 		__entry->version = task->tk_client->cl_vers;
286 		__entry->async = RPC_IS_ASYNC(task);
287 		__assign_str(progname, task->tk_client->cl_program->name);
288 		__assign_str(procname, rpc_proc_name(task));
289 	),
290 
291 	TP_printk("task:%u@%u %sv%d %s (%ssync)",
292 		__entry->task_id, __entry->client_id,
293 		__get_str(progname), __entry->version,
294 		__get_str(procname), __entry->async ? "a": ""
295 		)
296 );
297 
298 #define rpc_show_task_flags(flags)					\
299 	__print_flags(flags, "|",					\
300 		{ RPC_TASK_ASYNC, "ASYNC" },				\
301 		{ RPC_TASK_SWAPPER, "SWAPPER" },			\
302 		{ RPC_TASK_MOVEABLE, "MOVEABLE" },			\
303 		{ RPC_TASK_NULLCREDS, "NULLCREDS" },			\
304 		{ RPC_CALL_MAJORSEEN, "MAJORSEEN" },			\
305 		{ RPC_TASK_ROOTCREDS, "ROOTCREDS" },			\
306 		{ RPC_TASK_DYNAMIC, "DYNAMIC" },			\
307 		{ RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" },		\
308 		{ RPC_TASK_SOFT, "SOFT" },				\
309 		{ RPC_TASK_SOFTCONN, "SOFTCONN" },			\
310 		{ RPC_TASK_SENT, "SENT" },				\
311 		{ RPC_TASK_TIMEOUT, "TIMEOUT" },			\
312 		{ RPC_TASK_NOCONNECT, "NOCONNECT" },			\
313 		{ RPC_TASK_NO_RETRANS_TIMEOUT, "NORTO" },		\
314 		{ RPC_TASK_CRED_NOREF, "CRED_NOREF" })
315 
316 #define rpc_show_runstate(flags)					\
317 	__print_flags(flags, "|",					\
318 		{ (1UL << RPC_TASK_RUNNING), "RUNNING" },		\
319 		{ (1UL << RPC_TASK_QUEUED), "QUEUED" },			\
320 		{ (1UL << RPC_TASK_ACTIVE), "ACTIVE" },			\
321 		{ (1UL << RPC_TASK_NEED_XMIT), "NEED_XMIT" },		\
322 		{ (1UL << RPC_TASK_NEED_RECV), "NEED_RECV" },		\
323 		{ (1UL << RPC_TASK_MSG_PIN_WAIT), "MSG_PIN_WAIT" },	\
324 		{ (1UL << RPC_TASK_SIGNALLED), "SIGNALLED" })
325 
326 DECLARE_EVENT_CLASS(rpc_task_running,
327 
328 	TP_PROTO(const struct rpc_task *task, const void *action),
329 
330 	TP_ARGS(task, action),
331 
332 	TP_STRUCT__entry(
333 		__field(unsigned int, task_id)
334 		__field(unsigned int, client_id)
335 		__field(const void *, action)
336 		__field(unsigned long, runstate)
337 		__field(int, status)
338 		__field(unsigned short, flags)
339 		),
340 
341 	TP_fast_assign(
342 		__entry->client_id = task->tk_client ?
343 				     task->tk_client->cl_clid : -1;
344 		__entry->task_id = task->tk_pid;
345 		__entry->action = action;
346 		__entry->runstate = task->tk_runstate;
347 		__entry->status = task->tk_status;
348 		__entry->flags = task->tk_flags;
349 		),
350 
351 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d action=%ps",
352 		__entry->task_id, __entry->client_id,
353 		rpc_show_task_flags(__entry->flags),
354 		rpc_show_runstate(__entry->runstate),
355 		__entry->status,
356 		__entry->action
357 		)
358 );
359 #define DEFINE_RPC_RUNNING_EVENT(name) \
360 	DEFINE_EVENT(rpc_task_running, rpc_task_##name, \
361 			TP_PROTO( \
362 				const struct rpc_task *task, \
363 				const void *action \
364 			), \
365 			TP_ARGS(task, action))
366 
367 DEFINE_RPC_RUNNING_EVENT(begin);
368 DEFINE_RPC_RUNNING_EVENT(run_action);
369 DEFINE_RPC_RUNNING_EVENT(sync_sleep);
370 DEFINE_RPC_RUNNING_EVENT(sync_wake);
371 DEFINE_RPC_RUNNING_EVENT(complete);
372 DEFINE_RPC_RUNNING_EVENT(timeout);
373 DEFINE_RPC_RUNNING_EVENT(signalled);
374 DEFINE_RPC_RUNNING_EVENT(end);
375 
376 DECLARE_EVENT_CLASS(rpc_task_queued,
377 
378 	TP_PROTO(const struct rpc_task *task, const struct rpc_wait_queue *q),
379 
380 	TP_ARGS(task, q),
381 
382 	TP_STRUCT__entry(
383 		__field(unsigned int, task_id)
384 		__field(unsigned int, client_id)
385 		__field(unsigned long, timeout)
386 		__field(unsigned long, runstate)
387 		__field(int, status)
388 		__field(unsigned short, flags)
389 		__string(q_name, rpc_qname(q))
390 		),
391 
392 	TP_fast_assign(
393 		__entry->client_id = task->tk_client ?
394 				     task->tk_client->cl_clid : -1;
395 		__entry->task_id = task->tk_pid;
396 		__entry->timeout = rpc_task_timeout(task);
397 		__entry->runstate = task->tk_runstate;
398 		__entry->status = task->tk_status;
399 		__entry->flags = task->tk_flags;
400 		__assign_str(q_name, rpc_qname(q));
401 		),
402 
403 	TP_printk("task:%u@%d flags=%s runstate=%s status=%d timeout=%lu queue=%s",
404 		__entry->task_id, __entry->client_id,
405 		rpc_show_task_flags(__entry->flags),
406 		rpc_show_runstate(__entry->runstate),
407 		__entry->status,
408 		__entry->timeout,
409 		__get_str(q_name)
410 		)
411 );
412 #define DEFINE_RPC_QUEUED_EVENT(name) \
413 	DEFINE_EVENT(rpc_task_queued, rpc_task_##name, \
414 			TP_PROTO( \
415 				const struct rpc_task *task, \
416 				const struct rpc_wait_queue *q \
417 			), \
418 			TP_ARGS(task, q))
419 
420 DEFINE_RPC_QUEUED_EVENT(sleep);
421 DEFINE_RPC_QUEUED_EVENT(wakeup);
422 
423 DECLARE_EVENT_CLASS(rpc_failure,
424 
425 	TP_PROTO(const struct rpc_task *task),
426 
427 	TP_ARGS(task),
428 
429 	TP_STRUCT__entry(
430 		__field(unsigned int, task_id)
431 		__field(unsigned int, client_id)
432 	),
433 
434 	TP_fast_assign(
435 		__entry->task_id = task->tk_pid;
436 		__entry->client_id = task->tk_client->cl_clid;
437 	),
438 
439 	TP_printk("task:%u@%u",
440 		__entry->task_id, __entry->client_id)
441 );
442 
443 #define DEFINE_RPC_FAILURE(name)					\
444 	DEFINE_EVENT(rpc_failure, rpc_bad_##name,			\
445 			TP_PROTO(					\
446 				const struct rpc_task *task		\
447 			),						\
448 			TP_ARGS(task))
449 
450 DEFINE_RPC_FAILURE(callhdr);
451 DEFINE_RPC_FAILURE(verifier);
452 
453 DECLARE_EVENT_CLASS(rpc_reply_event,
454 
455 	TP_PROTO(
456 		const struct rpc_task *task
457 	),
458 
459 	TP_ARGS(task),
460 
461 	TP_STRUCT__entry(
462 		__field(unsigned int, task_id)
463 		__field(unsigned int, client_id)
464 		__field(u32, xid)
465 		__string(progname, task->tk_client->cl_program->name)
466 		__field(u32, version)
467 		__string(procname, rpc_proc_name(task))
468 		__string(servername, task->tk_xprt->servername)
469 	),
470 
471 	TP_fast_assign(
472 		__entry->task_id = task->tk_pid;
473 		__entry->client_id = task->tk_client->cl_clid;
474 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
475 		__assign_str(progname, task->tk_client->cl_program->name);
476 		__entry->version = task->tk_client->cl_vers;
477 		__assign_str(procname, rpc_proc_name(task));
478 		__assign_str(servername, task->tk_xprt->servername);
479 	),
480 
481 	TP_printk("task:%u@%d server=%s xid=0x%08x %sv%d %s",
482 		__entry->task_id, __entry->client_id, __get_str(servername),
483 		__entry->xid, __get_str(progname), __entry->version,
484 		__get_str(procname))
485 )
486 
487 #define DEFINE_RPC_REPLY_EVENT(name)					\
488 	DEFINE_EVENT(rpc_reply_event, rpc__##name,			\
489 			TP_PROTO(					\
490 				const struct rpc_task *task		\
491 			),						\
492 			TP_ARGS(task))
493 
494 DEFINE_RPC_REPLY_EVENT(prog_unavail);
495 DEFINE_RPC_REPLY_EVENT(prog_mismatch);
496 DEFINE_RPC_REPLY_EVENT(proc_unavail);
497 DEFINE_RPC_REPLY_EVENT(garbage_args);
498 DEFINE_RPC_REPLY_EVENT(unparsable);
499 DEFINE_RPC_REPLY_EVENT(mismatch);
500 DEFINE_RPC_REPLY_EVENT(stale_creds);
501 DEFINE_RPC_REPLY_EVENT(bad_creds);
502 DEFINE_RPC_REPLY_EVENT(auth_tooweak);
503 
504 #define DEFINE_RPCB_ERROR_EVENT(name)					\
505 	DEFINE_EVENT(rpc_reply_event, rpcb_##name##_err,		\
506 			TP_PROTO(					\
507 				const struct rpc_task *task		\
508 			),						\
509 			TP_ARGS(task))
510 
511 DEFINE_RPCB_ERROR_EVENT(prog_unavail);
512 DEFINE_RPCB_ERROR_EVENT(timeout);
513 DEFINE_RPCB_ERROR_EVENT(bind_version);
514 DEFINE_RPCB_ERROR_EVENT(unreachable);
515 DEFINE_RPCB_ERROR_EVENT(unrecognized);
516 
517 TRACE_EVENT(rpc_buf_alloc,
518 	TP_PROTO(
519 		const struct rpc_task *task,
520 		int status
521 	),
522 
523 	TP_ARGS(task, status),
524 
525 	TP_STRUCT__entry(
526 		__field(unsigned int, task_id)
527 		__field(unsigned int, client_id)
528 		__field(size_t, callsize)
529 		__field(size_t, recvsize)
530 		__field(int, status)
531 	),
532 
533 	TP_fast_assign(
534 		__entry->task_id = task->tk_pid;
535 		__entry->client_id = task->tk_client->cl_clid;
536 		__entry->callsize = task->tk_rqstp->rq_callsize;
537 		__entry->recvsize = task->tk_rqstp->rq_rcvsize;
538 		__entry->status = status;
539 	),
540 
541 	TP_printk("task:%u@%u callsize=%zu recvsize=%zu status=%d",
542 		__entry->task_id, __entry->client_id,
543 		__entry->callsize, __entry->recvsize, __entry->status
544 	)
545 );
546 
547 TRACE_EVENT(rpc_call_rpcerror,
548 	TP_PROTO(
549 		const struct rpc_task *task,
550 		int tk_status,
551 		int rpc_status
552 	),
553 
554 	TP_ARGS(task, tk_status, rpc_status),
555 
556 	TP_STRUCT__entry(
557 		__field(unsigned int, task_id)
558 		__field(unsigned int, client_id)
559 		__field(int, tk_status)
560 		__field(int, rpc_status)
561 	),
562 
563 	TP_fast_assign(
564 		__entry->client_id = task->tk_client->cl_clid;
565 		__entry->task_id = task->tk_pid;
566 		__entry->tk_status = tk_status;
567 		__entry->rpc_status = rpc_status;
568 	),
569 
570 	TP_printk("task:%u@%u tk_status=%d rpc_status=%d",
571 		__entry->task_id, __entry->client_id,
572 		__entry->tk_status, __entry->rpc_status)
573 );
574 
575 TRACE_EVENT(rpc_stats_latency,
576 
577 	TP_PROTO(
578 		const struct rpc_task *task,
579 		ktime_t backlog,
580 		ktime_t rtt,
581 		ktime_t execute
582 	),
583 
584 	TP_ARGS(task, backlog, rtt, execute),
585 
586 	TP_STRUCT__entry(
587 		__field(unsigned int, task_id)
588 		__field(unsigned int, client_id)
589 		__field(u32, xid)
590 		__field(int, version)
591 		__string(progname, task->tk_client->cl_program->name)
592 		__string(procname, rpc_proc_name(task))
593 		__field(unsigned long, backlog)
594 		__field(unsigned long, rtt)
595 		__field(unsigned long, execute)
596 	),
597 
598 	TP_fast_assign(
599 		__entry->client_id = task->tk_client->cl_clid;
600 		__entry->task_id = task->tk_pid;
601 		__entry->xid = be32_to_cpu(task->tk_rqstp->rq_xid);
602 		__entry->version = task->tk_client->cl_vers;
603 		__assign_str(progname, task->tk_client->cl_program->name);
604 		__assign_str(procname, rpc_proc_name(task));
605 		__entry->backlog = ktime_to_us(backlog);
606 		__entry->rtt = ktime_to_us(rtt);
607 		__entry->execute = ktime_to_us(execute);
608 	),
609 
610 	TP_printk("task:%u@%d xid=0x%08x %sv%d %s backlog=%lu rtt=%lu execute=%lu",
611 		__entry->task_id, __entry->client_id, __entry->xid,
612 		__get_str(progname), __entry->version, __get_str(procname),
613 		__entry->backlog, __entry->rtt, __entry->execute)
614 );
615 
616 TRACE_EVENT(rpc_xdr_overflow,
617 	TP_PROTO(
618 		const struct xdr_stream *xdr,
619 		size_t requested
620 	),
621 
622 	TP_ARGS(xdr, requested),
623 
624 	TP_STRUCT__entry(
625 		__field(unsigned int, task_id)
626 		__field(unsigned int, client_id)
627 		__field(int, version)
628 		__field(size_t, requested)
629 		__field(const void *, end)
630 		__field(const void *, p)
631 		__field(const void *, head_base)
632 		__field(size_t, head_len)
633 		__field(const void *, tail_base)
634 		__field(size_t, tail_len)
635 		__field(unsigned int, page_len)
636 		__field(unsigned int, len)
637 		__string(progname, xdr->rqst ?
638 			 xdr->rqst->rq_task->tk_client->cl_program->name : "unknown")
639 		__string(procedure, xdr->rqst ?
640 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name : "unknown")
641 	),
642 
643 	TP_fast_assign(
644 		if (xdr->rqst) {
645 			const struct rpc_task *task = xdr->rqst->rq_task;
646 
647 			__entry->task_id = task->tk_pid;
648 			__entry->client_id = task->tk_client->cl_clid;
649 			__assign_str(progname,
650 				     task->tk_client->cl_program->name);
651 			__entry->version = task->tk_client->cl_vers;
652 			__assign_str(procedure, task->tk_msg.rpc_proc->p_name);
653 		} else {
654 			__entry->task_id = 0;
655 			__entry->client_id = 0;
656 			__assign_str(progname, "unknown");
657 			__entry->version = 0;
658 			__assign_str(procedure, "unknown");
659 		}
660 		__entry->requested = requested;
661 		__entry->end = xdr->end;
662 		__entry->p = xdr->p;
663 		__entry->head_base = xdr->buf->head[0].iov_base,
664 		__entry->head_len = xdr->buf->head[0].iov_len,
665 		__entry->page_len = xdr->buf->page_len,
666 		__entry->tail_base = xdr->buf->tail[0].iov_base,
667 		__entry->tail_len = xdr->buf->tail[0].iov_len,
668 		__entry->len = xdr->buf->len;
669 	),
670 
671 	TP_printk(
672 		"task:%u@%u %sv%d %s requested=%zu p=%p end=%p xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
673 		__entry->task_id, __entry->client_id,
674 		__get_str(progname), __entry->version, __get_str(procedure),
675 		__entry->requested, __entry->p, __entry->end,
676 		__entry->head_base, __entry->head_len,
677 		__entry->page_len,
678 		__entry->tail_base, __entry->tail_len,
679 		__entry->len
680 	)
681 );
682 
683 TRACE_EVENT(rpc_xdr_alignment,
684 	TP_PROTO(
685 		const struct xdr_stream *xdr,
686 		size_t offset,
687 		unsigned int copied
688 	),
689 
690 	TP_ARGS(xdr, offset, copied),
691 
692 	TP_STRUCT__entry(
693 		__field(unsigned int, task_id)
694 		__field(unsigned int, client_id)
695 		__field(int, version)
696 		__field(size_t, offset)
697 		__field(unsigned int, copied)
698 		__field(const void *, head_base)
699 		__field(size_t, head_len)
700 		__field(const void *, tail_base)
701 		__field(size_t, tail_len)
702 		__field(unsigned int, page_len)
703 		__field(unsigned int, len)
704 		__string(progname,
705 			 xdr->rqst->rq_task->tk_client->cl_program->name)
706 		__string(procedure,
707 			 xdr->rqst->rq_task->tk_msg.rpc_proc->p_name)
708 	),
709 
710 	TP_fast_assign(
711 		const struct rpc_task *task = xdr->rqst->rq_task;
712 
713 		__entry->task_id = task->tk_pid;
714 		__entry->client_id = task->tk_client->cl_clid;
715 		__assign_str(progname,
716 			     task->tk_client->cl_program->name);
717 		__entry->version = task->tk_client->cl_vers;
718 		__assign_str(procedure, task->tk_msg.rpc_proc->p_name);
719 
720 		__entry->offset = offset;
721 		__entry->copied = copied;
722 		__entry->head_base = xdr->buf->head[0].iov_base,
723 		__entry->head_len = xdr->buf->head[0].iov_len,
724 		__entry->page_len = xdr->buf->page_len,
725 		__entry->tail_base = xdr->buf->tail[0].iov_base,
726 		__entry->tail_len = xdr->buf->tail[0].iov_len,
727 		__entry->len = xdr->buf->len;
728 	),
729 
730 	TP_printk(
731 		"task:%u@%u %sv%d %s offset=%zu copied=%u xdr=[%p,%zu]/%u/[%p,%zu]/%u\n",
732 		__entry->task_id, __entry->client_id,
733 		__get_str(progname), __entry->version, __get_str(procedure),
734 		__entry->offset, __entry->copied,
735 		__entry->head_base, __entry->head_len,
736 		__entry->page_len,
737 		__entry->tail_base, __entry->tail_len,
738 		__entry->len
739 	)
740 );
741 
742 /*
743  * First define the enums in the below macros to be exported to userspace
744  * via TRACE_DEFINE_ENUM().
745  */
746 #undef EM
747 #undef EMe
748 #define EM(a, b)	TRACE_DEFINE_ENUM(a);
749 #define EMe(a, b)	TRACE_DEFINE_ENUM(a);
750 
751 #define RPC_SHOW_SOCKET				\
752 	EM( SS_FREE, "FREE" )			\
753 	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
754 	EM( SS_CONNECTING, "CONNECTING" )	\
755 	EM( SS_CONNECTED, "CONNECTED" )		\
756 	EMe( SS_DISCONNECTING, "DISCONNECTING" )
757 
758 #define rpc_show_socket_state(state) \
759 	__print_symbolic(state, RPC_SHOW_SOCKET)
760 
761 RPC_SHOW_SOCKET
762 
763 #define RPC_SHOW_SOCK				\
764 	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
765 	EM( TCP_SYN_SENT, "SYN_SENT" )		\
766 	EM( TCP_SYN_RECV, "SYN_RECV" )		\
767 	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
768 	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
769 	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
770 	EM( TCP_CLOSE, "CLOSE" )		\
771 	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
772 	EM( TCP_LAST_ACK, "LAST_ACK" )		\
773 	EM( TCP_LISTEN, "LISTEN" )		\
774 	EMe( TCP_CLOSING, "CLOSING" )
775 
776 #define rpc_show_sock_state(state) \
777 	__print_symbolic(state, RPC_SHOW_SOCK)
778 
779 RPC_SHOW_SOCK
780 
781 /*
782  * Now redefine the EM() and EMe() macros to map the enums to the strings
783  * that will be printed in the output.
784  */
785 #undef EM
786 #undef EMe
787 #define EM(a, b)	{a, b},
788 #define EMe(a, b)	{a, b}
789 
790 DECLARE_EVENT_CLASS(xs_socket_event,
791 
792 		TP_PROTO(
793 			struct rpc_xprt *xprt,
794 			struct socket *socket
795 		),
796 
797 		TP_ARGS(xprt, socket),
798 
799 		TP_STRUCT__entry(
800 			__field(unsigned int, socket_state)
801 			__field(unsigned int, sock_state)
802 			__field(unsigned long long, ino)
803 			__string(dstaddr,
804 				xprt->address_strings[RPC_DISPLAY_ADDR])
805 			__string(dstport,
806 				xprt->address_strings[RPC_DISPLAY_PORT])
807 		),
808 
809 		TP_fast_assign(
810 			struct inode *inode = SOCK_INODE(socket);
811 			__entry->socket_state = socket->state;
812 			__entry->sock_state = socket->sk->sk_state;
813 			__entry->ino = (unsigned long long)inode->i_ino;
814 			__assign_str(dstaddr,
815 				xprt->address_strings[RPC_DISPLAY_ADDR]);
816 			__assign_str(dstport,
817 				xprt->address_strings[RPC_DISPLAY_PORT]);
818 		),
819 
820 		TP_printk(
821 			"socket:[%llu] dstaddr=%s/%s "
822 			"state=%u (%s) sk_state=%u (%s)",
823 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
824 			__entry->socket_state,
825 			rpc_show_socket_state(__entry->socket_state),
826 			__entry->sock_state,
827 			rpc_show_sock_state(__entry->sock_state)
828 		)
829 );
830 #define DEFINE_RPC_SOCKET_EVENT(name) \
831 	DEFINE_EVENT(xs_socket_event, name, \
832 			TP_PROTO( \
833 				struct rpc_xprt *xprt, \
834 				struct socket *socket \
835 			), \
836 			TP_ARGS(xprt, socket))
837 
838 DECLARE_EVENT_CLASS(xs_socket_event_done,
839 
840 		TP_PROTO(
841 			struct rpc_xprt *xprt,
842 			struct socket *socket,
843 			int error
844 		),
845 
846 		TP_ARGS(xprt, socket, error),
847 
848 		TP_STRUCT__entry(
849 			__field(int, error)
850 			__field(unsigned int, socket_state)
851 			__field(unsigned int, sock_state)
852 			__field(unsigned long long, ino)
853 			__string(dstaddr,
854 				xprt->address_strings[RPC_DISPLAY_ADDR])
855 			__string(dstport,
856 				xprt->address_strings[RPC_DISPLAY_PORT])
857 		),
858 
859 		TP_fast_assign(
860 			struct inode *inode = SOCK_INODE(socket);
861 			__entry->socket_state = socket->state;
862 			__entry->sock_state = socket->sk->sk_state;
863 			__entry->ino = (unsigned long long)inode->i_ino;
864 			__entry->error = error;
865 			__assign_str(dstaddr,
866 				xprt->address_strings[RPC_DISPLAY_ADDR]);
867 			__assign_str(dstport,
868 				xprt->address_strings[RPC_DISPLAY_PORT]);
869 		),
870 
871 		TP_printk(
872 			"error=%d socket:[%llu] dstaddr=%s/%s "
873 			"state=%u (%s) sk_state=%u (%s)",
874 			__entry->error,
875 			__entry->ino, __get_str(dstaddr), __get_str(dstport),
876 			__entry->socket_state,
877 			rpc_show_socket_state(__entry->socket_state),
878 			__entry->sock_state,
879 			rpc_show_sock_state(__entry->sock_state)
880 		)
881 );
882 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
883 	DEFINE_EVENT(xs_socket_event_done, name, \
884 			TP_PROTO( \
885 				struct rpc_xprt *xprt, \
886 				struct socket *socket, \
887 				int error \
888 			), \
889 			TP_ARGS(xprt, socket, error))
890 
891 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
892 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
893 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
894 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
895 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
896 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
897 
898 TRACE_EVENT(rpc_socket_nospace,
899 	TP_PROTO(
900 		const struct rpc_rqst *rqst,
901 		const struct sock_xprt *transport
902 	),
903 
904 	TP_ARGS(rqst, transport),
905 
906 	TP_STRUCT__entry(
907 		__field(unsigned int, task_id)
908 		__field(unsigned int, client_id)
909 		__field(unsigned int, total)
910 		__field(unsigned int, remaining)
911 	),
912 
913 	TP_fast_assign(
914 		__entry->task_id = rqst->rq_task->tk_pid;
915 		__entry->client_id = rqst->rq_task->tk_client->cl_clid;
916 		__entry->total = rqst->rq_slen;
917 		__entry->remaining = rqst->rq_slen - transport->xmit.offset;
918 	),
919 
920 	TP_printk("task:%u@%u total=%u remaining=%u",
921 		__entry->task_id, __entry->client_id,
922 		__entry->total, __entry->remaining
923 	)
924 );
925 
926 #define rpc_show_xprt_state(x)						\
927 	__print_flags(x, "|",						\
928 		{ (1UL << XPRT_LOCKED),		"LOCKED"},		\
929 		{ (1UL << XPRT_CONNECTED),	"CONNECTED"},		\
930 		{ (1UL << XPRT_CONNECTING),	"CONNECTING"},		\
931 		{ (1UL << XPRT_CLOSE_WAIT),	"CLOSE_WAIT"},		\
932 		{ (1UL << XPRT_BOUND),		"BOUND"},		\
933 		{ (1UL << XPRT_BINDING),	"BINDING"},		\
934 		{ (1UL << XPRT_CLOSING),	"CLOSING"},		\
935 		{ (1UL << XPRT_OFFLINE),	"OFFLINE"},		\
936 		{ (1UL << XPRT_REMOVE),		"REMOVE"},		\
937 		{ (1UL << XPRT_CONGESTED),	"CONGESTED"},		\
938 		{ (1UL << XPRT_CWND_WAIT),	"CWND_WAIT"},		\
939 		{ (1UL << XPRT_WRITE_SPACE),	"WRITE_SPACE"})
940 
941 DECLARE_EVENT_CLASS(rpc_xprt_lifetime_class,
942 	TP_PROTO(
943 		const struct rpc_xprt *xprt
944 	),
945 
946 	TP_ARGS(xprt),
947 
948 	TP_STRUCT__entry(
949 		__field(unsigned long, state)
950 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
951 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
952 	),
953 
954 	TP_fast_assign(
955 		__entry->state = xprt->state;
956 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
957 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
958 	),
959 
960 	TP_printk("peer=[%s]:%s state=%s",
961 		__get_str(addr), __get_str(port),
962 		rpc_show_xprt_state(__entry->state))
963 );
964 
965 #define DEFINE_RPC_XPRT_LIFETIME_EVENT(name) \
966 	DEFINE_EVENT(rpc_xprt_lifetime_class, \
967 			xprt_##name, \
968 			TP_PROTO( \
969 				const struct rpc_xprt *xprt \
970 			), \
971 			TP_ARGS(xprt))
972 
973 DEFINE_RPC_XPRT_LIFETIME_EVENT(create);
974 DEFINE_RPC_XPRT_LIFETIME_EVENT(connect);
975 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_auto);
976 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_done);
977 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_force);
978 DEFINE_RPC_XPRT_LIFETIME_EVENT(disconnect_cleanup);
979 DEFINE_RPC_XPRT_LIFETIME_EVENT(destroy);
980 
981 DECLARE_EVENT_CLASS(rpc_xprt_event,
982 	TP_PROTO(
983 		const struct rpc_xprt *xprt,
984 		__be32 xid,
985 		int status
986 	),
987 
988 	TP_ARGS(xprt, xid, status),
989 
990 	TP_STRUCT__entry(
991 		__field(u32, xid)
992 		__field(int, status)
993 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
994 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
995 	),
996 
997 	TP_fast_assign(
998 		__entry->xid = be32_to_cpu(xid);
999 		__entry->status = status;
1000 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1001 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1002 	),
1003 
1004 	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
1005 			__get_str(port), __entry->xid,
1006 			__entry->status)
1007 );
1008 #define DEFINE_RPC_XPRT_EVENT(name) \
1009 	DEFINE_EVENT(rpc_xprt_event, xprt_##name, \
1010 			TP_PROTO( \
1011 				const struct rpc_xprt *xprt, \
1012 				__be32 xid, \
1013 				int status \
1014 			), \
1015 			TP_ARGS(xprt, xid, status))
1016 
1017 DEFINE_RPC_XPRT_EVENT(timer);
1018 DEFINE_RPC_XPRT_EVENT(lookup_rqst);
1019 
1020 TRACE_EVENT(xprt_transmit,
1021 	TP_PROTO(
1022 		const struct rpc_rqst *rqst,
1023 		int status
1024 	),
1025 
1026 	TP_ARGS(rqst, status),
1027 
1028 	TP_STRUCT__entry(
1029 		__field(unsigned int, task_id)
1030 		__field(unsigned int, client_id)
1031 		__field(u32, xid)
1032 		__field(u32, seqno)
1033 		__field(int, status)
1034 	),
1035 
1036 	TP_fast_assign(
1037 		__entry->task_id = rqst->rq_task->tk_pid;
1038 		__entry->client_id = rqst->rq_task->tk_client ?
1039 			rqst->rq_task->tk_client->cl_clid : -1;
1040 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1041 		__entry->seqno = rqst->rq_seqno;
1042 		__entry->status = status;
1043 	),
1044 
1045 	TP_printk(
1046 		"task:%u@%u xid=0x%08x seqno=%u status=%d",
1047 		__entry->task_id, __entry->client_id, __entry->xid,
1048 		__entry->seqno, __entry->status)
1049 );
1050 
1051 TRACE_EVENT(xprt_retransmit,
1052 	TP_PROTO(
1053 		const struct rpc_rqst *rqst
1054 	),
1055 
1056 	TP_ARGS(rqst),
1057 
1058 	TP_STRUCT__entry(
1059 		__field(unsigned int, task_id)
1060 		__field(unsigned int, client_id)
1061 		__field(u32, xid)
1062 		__field(int, ntrans)
1063 		__field(int, version)
1064 		__field(unsigned long, timeout)
1065 		__string(progname,
1066 			 rqst->rq_task->tk_client->cl_program->name)
1067 		__string(procname, rpc_proc_name(rqst->rq_task))
1068 	),
1069 
1070 	TP_fast_assign(
1071 		struct rpc_task *task = rqst->rq_task;
1072 
1073 		__entry->task_id = task->tk_pid;
1074 		__entry->client_id = task->tk_client ?
1075 			task->tk_client->cl_clid : -1;
1076 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1077 		__entry->ntrans = rqst->rq_ntrans;
1078 		__entry->timeout = task->tk_timeout;
1079 		__assign_str(progname,
1080 			     task->tk_client->cl_program->name);
1081 		__entry->version = task->tk_client->cl_vers;
1082 		__assign_str(procname, rpc_proc_name(task));
1083 	),
1084 
1085 	TP_printk(
1086 		"task:%u@%u xid=0x%08x %sv%d %s ntrans=%d timeout=%lu",
1087 		__entry->task_id, __entry->client_id, __entry->xid,
1088 		__get_str(progname), __entry->version, __get_str(procname),
1089 		__entry->ntrans, __entry->timeout
1090 	)
1091 );
1092 
1093 TRACE_EVENT(xprt_ping,
1094 	TP_PROTO(const struct rpc_xprt *xprt, int status),
1095 
1096 	TP_ARGS(xprt, status),
1097 
1098 	TP_STRUCT__entry(
1099 		__field(int, status)
1100 		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
1101 		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
1102 	),
1103 
1104 	TP_fast_assign(
1105 		__entry->status = status;
1106 		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
1107 		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
1108 	),
1109 
1110 	TP_printk("peer=[%s]:%s status=%d",
1111 			__get_str(addr), __get_str(port), __entry->status)
1112 );
1113 
1114 DECLARE_EVENT_CLASS(xprt_writelock_event,
1115 	TP_PROTO(
1116 		const struct rpc_xprt *xprt, const struct rpc_task *task
1117 	),
1118 
1119 	TP_ARGS(xprt, task),
1120 
1121 	TP_STRUCT__entry(
1122 		__field(unsigned int, task_id)
1123 		__field(unsigned int, client_id)
1124 		__field(unsigned int, snd_task_id)
1125 	),
1126 
1127 	TP_fast_assign(
1128 		if (task) {
1129 			__entry->task_id = task->tk_pid;
1130 			__entry->client_id = task->tk_client ?
1131 					     task->tk_client->cl_clid : -1;
1132 		} else {
1133 			__entry->task_id = -1;
1134 			__entry->client_id = -1;
1135 		}
1136 		__entry->snd_task_id = xprt->snd_task ?
1137 					xprt->snd_task->tk_pid : -1;
1138 	),
1139 
1140 	TP_printk("task:%u@%u snd_task:%u",
1141 			__entry->task_id, __entry->client_id,
1142 			__entry->snd_task_id)
1143 );
1144 
1145 #define DEFINE_WRITELOCK_EVENT(name) \
1146 	DEFINE_EVENT(xprt_writelock_event, xprt_##name, \
1147 			TP_PROTO( \
1148 				const struct rpc_xprt *xprt, \
1149 				const struct rpc_task *task \
1150 			), \
1151 			TP_ARGS(xprt, task))
1152 
1153 DEFINE_WRITELOCK_EVENT(reserve_xprt);
1154 DEFINE_WRITELOCK_EVENT(release_xprt);
1155 
1156 DECLARE_EVENT_CLASS(xprt_cong_event,
1157 	TP_PROTO(
1158 		const struct rpc_xprt *xprt, const struct rpc_task *task
1159 	),
1160 
1161 	TP_ARGS(xprt, task),
1162 
1163 	TP_STRUCT__entry(
1164 		__field(unsigned int, task_id)
1165 		__field(unsigned int, client_id)
1166 		__field(unsigned int, snd_task_id)
1167 		__field(unsigned long, cong)
1168 		__field(unsigned long, cwnd)
1169 		__field(bool, wait)
1170 	),
1171 
1172 	TP_fast_assign(
1173 		if (task) {
1174 			__entry->task_id = task->tk_pid;
1175 			__entry->client_id = task->tk_client ?
1176 					     task->tk_client->cl_clid : -1;
1177 		} else {
1178 			__entry->task_id = -1;
1179 			__entry->client_id = -1;
1180 		}
1181 		__entry->snd_task_id = xprt->snd_task ?
1182 					xprt->snd_task->tk_pid : -1;
1183 		__entry->cong = xprt->cong;
1184 		__entry->cwnd = xprt->cwnd;
1185 		__entry->wait = test_bit(XPRT_CWND_WAIT, &xprt->state);
1186 	),
1187 
1188 	TP_printk("task:%u@%u snd_task:%u cong=%lu cwnd=%lu%s",
1189 			__entry->task_id, __entry->client_id,
1190 			__entry->snd_task_id, __entry->cong, __entry->cwnd,
1191 			__entry->wait ? " (wait)" : "")
1192 );
1193 
1194 #define DEFINE_CONG_EVENT(name) \
1195 	DEFINE_EVENT(xprt_cong_event, xprt_##name, \
1196 			TP_PROTO( \
1197 				const struct rpc_xprt *xprt, \
1198 				const struct rpc_task *task \
1199 			), \
1200 			TP_ARGS(xprt, task))
1201 
1202 DEFINE_CONG_EVENT(reserve_cong);
1203 DEFINE_CONG_EVENT(release_cong);
1204 DEFINE_CONG_EVENT(get_cong);
1205 DEFINE_CONG_EVENT(put_cong);
1206 
1207 TRACE_EVENT(xprt_reserve,
1208 	TP_PROTO(
1209 		const struct rpc_rqst *rqst
1210 	),
1211 
1212 	TP_ARGS(rqst),
1213 
1214 	TP_STRUCT__entry(
1215 		__field(unsigned int, task_id)
1216 		__field(unsigned int, client_id)
1217 		__field(u32, xid)
1218 	),
1219 
1220 	TP_fast_assign(
1221 		__entry->task_id = rqst->rq_task->tk_pid;
1222 		__entry->client_id = rqst->rq_task->tk_client->cl_clid;
1223 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1224 	),
1225 
1226 	TP_printk("task:%u@%u xid=0x%08x",
1227 		__entry->task_id, __entry->client_id, __entry->xid
1228 	)
1229 );
1230 
1231 TRACE_EVENT(xs_stream_read_data,
1232 	TP_PROTO(struct rpc_xprt *xprt, ssize_t err, size_t total),
1233 
1234 	TP_ARGS(xprt, err, total),
1235 
1236 	TP_STRUCT__entry(
1237 		__field(ssize_t, err)
1238 		__field(size_t, total)
1239 		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
1240 				"(null)")
1241 		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
1242 				"(null)")
1243 	),
1244 
1245 	TP_fast_assign(
1246 		__entry->err = err;
1247 		__entry->total = total;
1248 		__assign_str(addr, xprt ?
1249 			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
1250 		__assign_str(port, xprt ?
1251 			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
1252 	),
1253 
1254 	TP_printk("peer=[%s]:%s err=%zd total=%zu", __get_str(addr),
1255 			__get_str(port), __entry->err, __entry->total)
1256 );
1257 
1258 TRACE_EVENT(xs_stream_read_request,
1259 	TP_PROTO(struct sock_xprt *xs),
1260 
1261 	TP_ARGS(xs),
1262 
1263 	TP_STRUCT__entry(
1264 		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
1265 		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
1266 		__field(u32, xid)
1267 		__field(unsigned long, copied)
1268 		__field(unsigned int, reclen)
1269 		__field(unsigned int, offset)
1270 	),
1271 
1272 	TP_fast_assign(
1273 		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
1274 		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
1275 		__entry->xid = be32_to_cpu(xs->recv.xid);
1276 		__entry->copied = xs->recv.copied;
1277 		__entry->reclen = xs->recv.len;
1278 		__entry->offset = xs->recv.offset;
1279 	),
1280 
1281 	TP_printk("peer=[%s]:%s xid=0x%08x copied=%lu reclen=%u offset=%u",
1282 			__get_str(addr), __get_str(port), __entry->xid,
1283 			__entry->copied, __entry->reclen, __entry->offset)
1284 );
1285 
1286 TRACE_EVENT(rpcb_getport,
1287 	TP_PROTO(
1288 		const struct rpc_clnt *clnt,
1289 		const struct rpc_task *task,
1290 		unsigned int bind_version
1291 	),
1292 
1293 	TP_ARGS(clnt, task, bind_version),
1294 
1295 	TP_STRUCT__entry(
1296 		__field(unsigned int, task_id)
1297 		__field(unsigned int, client_id)
1298 		__field(unsigned int, program)
1299 		__field(unsigned int, version)
1300 		__field(int, protocol)
1301 		__field(unsigned int, bind_version)
1302 		__string(servername, task->tk_xprt->servername)
1303 	),
1304 
1305 	TP_fast_assign(
1306 		__entry->task_id = task->tk_pid;
1307 		__entry->client_id = clnt->cl_clid;
1308 		__entry->program = clnt->cl_prog;
1309 		__entry->version = clnt->cl_vers;
1310 		__entry->protocol = task->tk_xprt->prot;
1311 		__entry->bind_version = bind_version;
1312 		__assign_str(servername, task->tk_xprt->servername);
1313 	),
1314 
1315 	TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u",
1316 		__entry->task_id, __entry->client_id, __get_str(servername),
1317 		__entry->program, __entry->version, __entry->protocol,
1318 		__entry->bind_version
1319 	)
1320 );
1321 
1322 TRACE_EVENT(rpcb_setport,
1323 	TP_PROTO(
1324 		const struct rpc_task *task,
1325 		int status,
1326 		unsigned short port
1327 	),
1328 
1329 	TP_ARGS(task, status, port),
1330 
1331 	TP_STRUCT__entry(
1332 		__field(unsigned int, task_id)
1333 		__field(unsigned int, client_id)
1334 		__field(int, status)
1335 		__field(unsigned short, port)
1336 	),
1337 
1338 	TP_fast_assign(
1339 		__entry->task_id = task->tk_pid;
1340 		__entry->client_id = task->tk_client->cl_clid;
1341 		__entry->status = status;
1342 		__entry->port = port;
1343 	),
1344 
1345 	TP_printk("task:%u@%u status=%d port=%u",
1346 		__entry->task_id, __entry->client_id,
1347 		__entry->status, __entry->port
1348 	)
1349 );
1350 
1351 TRACE_EVENT(pmap_register,
1352 	TP_PROTO(
1353 		u32 program,
1354 		u32 version,
1355 		int protocol,
1356 		unsigned short port
1357 	),
1358 
1359 	TP_ARGS(program, version, protocol, port),
1360 
1361 	TP_STRUCT__entry(
1362 		__field(unsigned int, program)
1363 		__field(unsigned int, version)
1364 		__field(int, protocol)
1365 		__field(unsigned int, port)
1366 	),
1367 
1368 	TP_fast_assign(
1369 		__entry->program = program;
1370 		__entry->version = version;
1371 		__entry->protocol = protocol;
1372 		__entry->port = port;
1373 	),
1374 
1375 	TP_printk("program=%u version=%u protocol=%d port=%u",
1376 		__entry->program, __entry->version,
1377 		__entry->protocol, __entry->port
1378 	)
1379 );
1380 
1381 TRACE_EVENT(rpcb_register,
1382 	TP_PROTO(
1383 		u32 program,
1384 		u32 version,
1385 		const char *addr,
1386 		const char *netid
1387 	),
1388 
1389 	TP_ARGS(program, version, addr, netid),
1390 
1391 	TP_STRUCT__entry(
1392 		__field(unsigned int, program)
1393 		__field(unsigned int, version)
1394 		__string(addr, addr)
1395 		__string(netid, netid)
1396 	),
1397 
1398 	TP_fast_assign(
1399 		__entry->program = program;
1400 		__entry->version = version;
1401 		__assign_str(addr, addr);
1402 		__assign_str(netid, netid);
1403 	),
1404 
1405 	TP_printk("program=%u version=%u addr=%s netid=%s",
1406 		__entry->program, __entry->version,
1407 		__get_str(addr), __get_str(netid)
1408 	)
1409 );
1410 
1411 TRACE_EVENT(rpcb_unregister,
1412 	TP_PROTO(
1413 		u32 program,
1414 		u32 version,
1415 		const char *netid
1416 	),
1417 
1418 	TP_ARGS(program, version, netid),
1419 
1420 	TP_STRUCT__entry(
1421 		__field(unsigned int, program)
1422 		__field(unsigned int, version)
1423 		__string(netid, netid)
1424 	),
1425 
1426 	TP_fast_assign(
1427 		__entry->program = program;
1428 		__entry->version = version;
1429 		__assign_str(netid, netid);
1430 	),
1431 
1432 	TP_printk("program=%u version=%u netid=%s",
1433 		__entry->program, __entry->version, __get_str(netid)
1434 	)
1435 );
1436 
1437 /* Record an xdr_buf containing a fully-formed RPC message */
1438 DECLARE_EVENT_CLASS(svc_xdr_msg_class,
1439 	TP_PROTO(
1440 		const struct xdr_buf *xdr
1441 	),
1442 
1443 	TP_ARGS(xdr),
1444 
1445 	TP_STRUCT__entry(
1446 		__field(u32, xid)
1447 		__field(const void *, head_base)
1448 		__field(size_t, head_len)
1449 		__field(const void *, tail_base)
1450 		__field(size_t, tail_len)
1451 		__field(unsigned int, page_len)
1452 		__field(unsigned int, msg_len)
1453 	),
1454 
1455 	TP_fast_assign(
1456 		__be32 *p = (__be32 *)xdr->head[0].iov_base;
1457 
1458 		__entry->xid = be32_to_cpu(*p);
1459 		__entry->head_base = p;
1460 		__entry->head_len = xdr->head[0].iov_len;
1461 		__entry->tail_base = xdr->tail[0].iov_base;
1462 		__entry->tail_len = xdr->tail[0].iov_len;
1463 		__entry->page_len = xdr->page_len;
1464 		__entry->msg_len = xdr->len;
1465 	),
1466 
1467 	TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
1468 		__entry->xid,
1469 		__entry->head_base, __entry->head_len, __entry->page_len,
1470 		__entry->tail_base, __entry->tail_len, __entry->msg_len
1471 	)
1472 );
1473 
1474 #define DEFINE_SVCXDRMSG_EVENT(name)					\
1475 		DEFINE_EVENT(svc_xdr_msg_class,				\
1476 				svc_xdr_##name,				\
1477 				TP_PROTO(				\
1478 					const struct xdr_buf *xdr	\
1479 				),					\
1480 				TP_ARGS(xdr))
1481 
1482 DEFINE_SVCXDRMSG_EVENT(recvfrom);
1483 
1484 /* Record an xdr_buf containing arbitrary data, tagged with an XID */
1485 DECLARE_EVENT_CLASS(svc_xdr_buf_class,
1486 	TP_PROTO(
1487 		__be32 xid,
1488 		const struct xdr_buf *xdr
1489 	),
1490 
1491 	TP_ARGS(xid, xdr),
1492 
1493 	TP_STRUCT__entry(
1494 		__field(u32, xid)
1495 		__field(const void *, head_base)
1496 		__field(size_t, head_len)
1497 		__field(const void *, tail_base)
1498 		__field(size_t, tail_len)
1499 		__field(unsigned int, page_len)
1500 		__field(unsigned int, msg_len)
1501 	),
1502 
1503 	TP_fast_assign(
1504 		__entry->xid = be32_to_cpu(xid);
1505 		__entry->head_base = xdr->head[0].iov_base;
1506 		__entry->head_len = xdr->head[0].iov_len;
1507 		__entry->tail_base = xdr->tail[0].iov_base;
1508 		__entry->tail_len = xdr->tail[0].iov_len;
1509 		__entry->page_len = xdr->page_len;
1510 		__entry->msg_len = xdr->len;
1511 	),
1512 
1513 	TP_printk("xid=0x%08x head=[%p,%zu] page=%u tail=[%p,%zu] len=%u",
1514 		__entry->xid,
1515 		__entry->head_base, __entry->head_len, __entry->page_len,
1516 		__entry->tail_base, __entry->tail_len, __entry->msg_len
1517 	)
1518 );
1519 
1520 #define DEFINE_SVCXDRBUF_EVENT(name)					\
1521 		DEFINE_EVENT(svc_xdr_buf_class,				\
1522 				svc_xdr_##name,				\
1523 				TP_PROTO(				\
1524 					__be32 xid,			\
1525 					const struct xdr_buf *xdr	\
1526 				),					\
1527 				TP_ARGS(xid, xdr))
1528 
1529 DEFINE_SVCXDRBUF_EVENT(sendto);
1530 
1531 /*
1532  * from include/linux/sunrpc/svc.h
1533  */
1534 #define SVC_RQST_FLAG_LIST						\
1535 	svc_rqst_flag(SECURE)						\
1536 	svc_rqst_flag(LOCAL)						\
1537 	svc_rqst_flag(USEDEFERRAL)					\
1538 	svc_rqst_flag(DROPME)						\
1539 	svc_rqst_flag(SPLICE_OK)					\
1540 	svc_rqst_flag(VICTIM)						\
1541 	svc_rqst_flag(BUSY)						\
1542 	svc_rqst_flag_end(DATA)
1543 
1544 #undef svc_rqst_flag
1545 #undef svc_rqst_flag_end
1546 #define svc_rqst_flag(x)	TRACE_DEFINE_ENUM(RQ_##x);
1547 #define svc_rqst_flag_end(x)	TRACE_DEFINE_ENUM(RQ_##x);
1548 
1549 SVC_RQST_FLAG_LIST
1550 
1551 #undef svc_rqst_flag
1552 #undef svc_rqst_flag_end
1553 #define svc_rqst_flag(x)	{ BIT(RQ_##x), #x },
1554 #define svc_rqst_flag_end(x)	{ BIT(RQ_##x), #x }
1555 
1556 #define show_rqstp_flags(flags)						\
1557 		__print_flags(flags, "|", SVC_RQST_FLAG_LIST)
1558 
1559 TRACE_DEFINE_ENUM(SVC_GARBAGE);
1560 TRACE_DEFINE_ENUM(SVC_SYSERR);
1561 TRACE_DEFINE_ENUM(SVC_VALID);
1562 TRACE_DEFINE_ENUM(SVC_NEGATIVE);
1563 TRACE_DEFINE_ENUM(SVC_OK);
1564 TRACE_DEFINE_ENUM(SVC_DROP);
1565 TRACE_DEFINE_ENUM(SVC_CLOSE);
1566 TRACE_DEFINE_ENUM(SVC_DENIED);
1567 TRACE_DEFINE_ENUM(SVC_PENDING);
1568 TRACE_DEFINE_ENUM(SVC_COMPLETE);
1569 
1570 #define svc_show_status(status)				\
1571 	__print_symbolic(status,			\
1572 		{ SVC_GARBAGE,	"SVC_GARBAGE" },	\
1573 		{ SVC_SYSERR,	"SVC_SYSERR" },		\
1574 		{ SVC_VALID,	"SVC_VALID" },		\
1575 		{ SVC_NEGATIVE,	"SVC_NEGATIVE" },	\
1576 		{ SVC_OK,	"SVC_OK" },		\
1577 		{ SVC_DROP,	"SVC_DROP" },		\
1578 		{ SVC_CLOSE,	"SVC_CLOSE" },		\
1579 		{ SVC_DENIED,	"SVC_DENIED" },		\
1580 		{ SVC_PENDING,	"SVC_PENDING" },	\
1581 		{ SVC_COMPLETE,	"SVC_COMPLETE" })
1582 
1583 TRACE_EVENT(svc_authenticate,
1584 	TP_PROTO(const struct svc_rqst *rqst, int auth_res),
1585 
1586 	TP_ARGS(rqst, auth_res),
1587 
1588 	TP_STRUCT__entry(
1589 		__field(u32, xid)
1590 		__field(unsigned long, svc_status)
1591 		__field(unsigned long, auth_stat)
1592 	),
1593 
1594 	TP_fast_assign(
1595 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1596 		__entry->svc_status = auth_res;
1597 		__entry->auth_stat = be32_to_cpu(rqst->rq_auth_stat);
1598 	),
1599 
1600 	TP_printk("xid=0x%08x auth_res=%s auth_stat=%s",
1601 			__entry->xid, svc_show_status(__entry->svc_status),
1602 			rpc_show_auth_stat(__entry->auth_stat))
1603 );
1604 
1605 TRACE_EVENT(svc_process,
1606 	TP_PROTO(const struct svc_rqst *rqst, const char *name),
1607 
1608 	TP_ARGS(rqst, name),
1609 
1610 	TP_STRUCT__entry(
1611 		__field(u32, xid)
1612 		__field(u32, vers)
1613 		__field(u32, proc)
1614 		__string(service, name)
1615 		__string(procedure, svc_proc_name(rqst))
1616 		__string(addr, rqst->rq_xprt ?
1617 			 rqst->rq_xprt->xpt_remotebuf : "(null)")
1618 	),
1619 
1620 	TP_fast_assign(
1621 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1622 		__entry->vers = rqst->rq_vers;
1623 		__entry->proc = rqst->rq_proc;
1624 		__assign_str(service, name);
1625 		__assign_str(procedure, svc_proc_name(rqst));
1626 		__assign_str(addr, rqst->rq_xprt ?
1627 			     rqst->rq_xprt->xpt_remotebuf : "(null)");
1628 	),
1629 
1630 	TP_printk("addr=%s xid=0x%08x service=%s vers=%u proc=%s",
1631 			__get_str(addr), __entry->xid,
1632 			__get_str(service), __entry->vers,
1633 			__get_str(procedure)
1634 	)
1635 );
1636 
1637 DECLARE_EVENT_CLASS(svc_rqst_event,
1638 
1639 	TP_PROTO(
1640 		const struct svc_rqst *rqst
1641 	),
1642 
1643 	TP_ARGS(rqst),
1644 
1645 	TP_STRUCT__entry(
1646 		__field(u32, xid)
1647 		__field(unsigned long, flags)
1648 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1649 	),
1650 
1651 	TP_fast_assign(
1652 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1653 		__entry->flags = rqst->rq_flags;
1654 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1655 	),
1656 
1657 	TP_printk("addr=%s xid=0x%08x flags=%s",
1658 			__get_str(addr), __entry->xid,
1659 			show_rqstp_flags(__entry->flags))
1660 );
1661 #define DEFINE_SVC_RQST_EVENT(name) \
1662 	DEFINE_EVENT(svc_rqst_event, svc_##name, \
1663 			TP_PROTO( \
1664 				const struct svc_rqst *rqst \
1665 			), \
1666 			TP_ARGS(rqst))
1667 
1668 DEFINE_SVC_RQST_EVENT(defer);
1669 DEFINE_SVC_RQST_EVENT(drop);
1670 
1671 DECLARE_EVENT_CLASS(svc_rqst_status,
1672 
1673 	TP_PROTO(struct svc_rqst *rqst, int status),
1674 
1675 	TP_ARGS(rqst, status),
1676 
1677 	TP_STRUCT__entry(
1678 		__field(u32, xid)
1679 		__field(int, status)
1680 		__field(unsigned long, flags)
1681 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1682 	),
1683 
1684 	TP_fast_assign(
1685 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1686 		__entry->status = status;
1687 		__entry->flags = rqst->rq_flags;
1688 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1689 	),
1690 
1691 	TP_printk("addr=%s xid=0x%08x status=%d flags=%s",
1692 		  __get_str(addr), __entry->xid,
1693 		  __entry->status, show_rqstp_flags(__entry->flags))
1694 );
1695 
1696 DEFINE_EVENT(svc_rqst_status, svc_send,
1697 	TP_PROTO(struct svc_rqst *rqst, int status),
1698 	TP_ARGS(rqst, status));
1699 
1700 #define show_svc_xprt_flags(flags)					\
1701 	__print_flags(flags, "|",					\
1702 		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
1703 		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
1704 		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
1705 		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
1706 		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
1707 		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
1708 		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
1709 		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
1710 		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
1711 		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
1712 		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
1713 		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"},		\
1714 		{ (1UL << XPT_KILL_TEMP),	"XPT_KILL_TEMP"},	\
1715 		{ (1UL << XPT_CONG_CTRL),	"XPT_CONG_CTRL"})
1716 
1717 TRACE_EVENT(svc_xprt_create_err,
1718 	TP_PROTO(
1719 		const char *program,
1720 		const char *protocol,
1721 		struct sockaddr *sap,
1722 		const struct svc_xprt *xprt
1723 	),
1724 
1725 	TP_ARGS(program, protocol, sap, xprt),
1726 
1727 	TP_STRUCT__entry(
1728 		__field(long, error)
1729 		__string(program, program)
1730 		__string(protocol, protocol)
1731 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
1732 	),
1733 
1734 	TP_fast_assign(
1735 		__entry->error = PTR_ERR(xprt);
1736 		__assign_str(program, program);
1737 		__assign_str(protocol, protocol);
1738 		memcpy(__entry->addr, sap, sizeof(__entry->addr));
1739 	),
1740 
1741 	TP_printk("addr=%pISpc program=%s protocol=%s error=%ld",
1742 		__entry->addr, __get_str(program), __get_str(protocol),
1743 		__entry->error)
1744 );
1745 
1746 TRACE_EVENT(svc_xprt_do_enqueue,
1747 	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
1748 
1749 	TP_ARGS(xprt, rqst),
1750 
1751 	TP_STRUCT__entry(
1752 		__field(int, pid)
1753 		__field(unsigned long, flags)
1754 		__string(addr, xprt->xpt_remotebuf)
1755 	),
1756 
1757 	TP_fast_assign(
1758 		__entry->pid = rqst? rqst->rq_task->pid : 0;
1759 		__entry->flags = xprt->xpt_flags;
1760 		__assign_str(addr, xprt->xpt_remotebuf);
1761 	),
1762 
1763 	TP_printk("addr=%s pid=%d flags=%s", __get_str(addr),
1764 		__entry->pid, show_svc_xprt_flags(__entry->flags))
1765 );
1766 
1767 DECLARE_EVENT_CLASS(svc_xprt_event,
1768 	TP_PROTO(struct svc_xprt *xprt),
1769 
1770 	TP_ARGS(xprt),
1771 
1772 	TP_STRUCT__entry(
1773 		__field(unsigned long, flags)
1774 		__string(addr, xprt->xpt_remotebuf)
1775 	),
1776 
1777 	TP_fast_assign(
1778 		__entry->flags = xprt->xpt_flags;
1779 		__assign_str(addr, xprt->xpt_remotebuf);
1780 	),
1781 
1782 	TP_printk("addr=%s flags=%s", __get_str(addr),
1783 		show_svc_xprt_flags(__entry->flags))
1784 );
1785 
1786 #define DEFINE_SVC_XPRT_EVENT(name) \
1787 	DEFINE_EVENT(svc_xprt_event, svc_xprt_##name, \
1788 			TP_PROTO( \
1789 				struct svc_xprt *xprt \
1790 			), \
1791 			TP_ARGS(xprt))
1792 
1793 DEFINE_SVC_XPRT_EVENT(received);
1794 DEFINE_SVC_XPRT_EVENT(no_write_space);
1795 DEFINE_SVC_XPRT_EVENT(close);
1796 DEFINE_SVC_XPRT_EVENT(detach);
1797 DEFINE_SVC_XPRT_EVENT(free);
1798 
1799 TRACE_EVENT(svc_xprt_accept,
1800 	TP_PROTO(
1801 		const struct svc_xprt *xprt,
1802 		const char *service
1803 	),
1804 
1805 	TP_ARGS(xprt, service),
1806 
1807 	TP_STRUCT__entry(
1808 		__string(addr, xprt->xpt_remotebuf)
1809 		__string(protocol, xprt->xpt_class->xcl_name)
1810 		__string(service, service)
1811 	),
1812 
1813 	TP_fast_assign(
1814 		__assign_str(addr, xprt->xpt_remotebuf);
1815 		__assign_str(protocol, xprt->xpt_class->xcl_name);
1816 		__assign_str(service, service);
1817 	),
1818 
1819 	TP_printk("addr=%s protocol=%s service=%s",
1820 		__get_str(addr), __get_str(protocol), __get_str(service)
1821 	)
1822 );
1823 
1824 TRACE_EVENT(svc_xprt_dequeue,
1825 	TP_PROTO(struct svc_rqst *rqst),
1826 
1827 	TP_ARGS(rqst),
1828 
1829 	TP_STRUCT__entry(
1830 		__field(unsigned long, flags)
1831 		__field(unsigned long, wakeup)
1832 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1833 	),
1834 
1835 	TP_fast_assign(
1836 		__entry->flags = rqst->rq_xprt->xpt_flags;
1837 		__entry->wakeup = ktime_to_us(ktime_sub(ktime_get(),
1838 							rqst->rq_qtime));
1839 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1840 	),
1841 
1842 	TP_printk("addr=%s flags=%s wakeup-us=%lu", __get_str(addr),
1843 		show_svc_xprt_flags(__entry->flags), __entry->wakeup)
1844 );
1845 
1846 TRACE_EVENT(svc_wake_up,
1847 	TP_PROTO(int pid),
1848 
1849 	TP_ARGS(pid),
1850 
1851 	TP_STRUCT__entry(
1852 		__field(int, pid)
1853 	),
1854 
1855 	TP_fast_assign(
1856 		__entry->pid = pid;
1857 	),
1858 
1859 	TP_printk("pid=%d", __entry->pid)
1860 );
1861 
1862 TRACE_EVENT(svc_handle_xprt,
1863 	TP_PROTO(struct svc_xprt *xprt, int len),
1864 
1865 	TP_ARGS(xprt, len),
1866 
1867 	TP_STRUCT__entry(
1868 		__field(int, len)
1869 		__field(unsigned long, flags)
1870 		__string(addr, xprt->xpt_remotebuf)
1871 	),
1872 
1873 	TP_fast_assign(
1874 		__entry->len = len;
1875 		__entry->flags = xprt->xpt_flags;
1876 		__assign_str(addr, xprt->xpt_remotebuf);
1877 	),
1878 
1879 	TP_printk("addr=%s len=%d flags=%s", __get_str(addr),
1880 		__entry->len, show_svc_xprt_flags(__entry->flags))
1881 );
1882 
1883 TRACE_EVENT(svc_stats_latency,
1884 	TP_PROTO(const struct svc_rqst *rqst),
1885 
1886 	TP_ARGS(rqst),
1887 
1888 	TP_STRUCT__entry(
1889 		__field(u32, xid)
1890 		__field(unsigned long, execute)
1891 		__string(procedure, svc_proc_name(rqst))
1892 		__string(addr, rqst->rq_xprt->xpt_remotebuf)
1893 	),
1894 
1895 	TP_fast_assign(
1896 		__entry->xid = be32_to_cpu(rqst->rq_xid);
1897 		__entry->execute = ktime_to_us(ktime_sub(ktime_get(),
1898 							 rqst->rq_stime));
1899 		__assign_str(procedure, svc_proc_name(rqst));
1900 		__assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1901 	),
1902 
1903 	TP_printk("addr=%s xid=0x%08x proc=%s execute-us=%lu",
1904 		__get_str(addr), __entry->xid, __get_str(procedure),
1905 		__entry->execute)
1906 );
1907 
1908 DECLARE_EVENT_CLASS(svc_deferred_event,
1909 	TP_PROTO(
1910 		const struct svc_deferred_req *dr
1911 	),
1912 
1913 	TP_ARGS(dr),
1914 
1915 	TP_STRUCT__entry(
1916 		__field(const void *, dr)
1917 		__field(u32, xid)
1918 		__string(addr, dr->xprt->xpt_remotebuf)
1919 	),
1920 
1921 	TP_fast_assign(
1922 		__entry->dr = dr;
1923 		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
1924 						       (dr->xprt_hlen>>2)));
1925 		__assign_str(addr, dr->xprt->xpt_remotebuf);
1926 	),
1927 
1928 	TP_printk("addr=%s dr=%p xid=0x%08x", __get_str(addr), __entry->dr,
1929 		__entry->xid)
1930 );
1931 
1932 #define DEFINE_SVC_DEFERRED_EVENT(name) \
1933 	DEFINE_EVENT(svc_deferred_event, svc_defer_##name, \
1934 			TP_PROTO( \
1935 				const struct svc_deferred_req *dr \
1936 			), \
1937 			TP_ARGS(dr))
1938 
1939 DEFINE_SVC_DEFERRED_EVENT(drop);
1940 DEFINE_SVC_DEFERRED_EVENT(queue);
1941 DEFINE_SVC_DEFERRED_EVENT(recv);
1942 
1943 TRACE_EVENT(svcsock_new_socket,
1944 	TP_PROTO(
1945 		const struct socket *socket
1946 	),
1947 
1948 	TP_ARGS(socket),
1949 
1950 	TP_STRUCT__entry(
1951 		__field(unsigned long, type)
1952 		__field(unsigned long, family)
1953 		__field(bool, listener)
1954 	),
1955 
1956 	TP_fast_assign(
1957 		__entry->type = socket->type;
1958 		__entry->family = socket->sk->sk_family;
1959 		__entry->listener = (socket->sk->sk_state == TCP_LISTEN);
1960 	),
1961 
1962 	TP_printk("type=%s family=%s%s",
1963 		show_socket_type(__entry->type),
1964 		rpc_show_address_family(__entry->family),
1965 		__entry->listener ? " (listener)" : ""
1966 	)
1967 );
1968 
1969 TRACE_EVENT(svcsock_marker,
1970 	TP_PROTO(
1971 		const struct svc_xprt *xprt,
1972 		__be32 marker
1973 	),
1974 
1975 	TP_ARGS(xprt, marker),
1976 
1977 	TP_STRUCT__entry(
1978 		__field(unsigned int, length)
1979 		__field(bool, last)
1980 		__string(addr, xprt->xpt_remotebuf)
1981 	),
1982 
1983 	TP_fast_assign(
1984 		__entry->length = be32_to_cpu(marker) & RPC_FRAGMENT_SIZE_MASK;
1985 		__entry->last = be32_to_cpu(marker) & RPC_LAST_STREAM_FRAGMENT;
1986 		__assign_str(addr, xprt->xpt_remotebuf);
1987 	),
1988 
1989 	TP_printk("addr=%s length=%u%s", __get_str(addr),
1990 		__entry->length, __entry->last ? " (last)" : "")
1991 );
1992 
1993 DECLARE_EVENT_CLASS(svcsock_class,
1994 	TP_PROTO(
1995 		const struct svc_xprt *xprt,
1996 		ssize_t result
1997 	),
1998 
1999 	TP_ARGS(xprt, result),
2000 
2001 	TP_STRUCT__entry(
2002 		__field(ssize_t, result)
2003 		__field(unsigned long, flags)
2004 		__string(addr, xprt->xpt_remotebuf)
2005 	),
2006 
2007 	TP_fast_assign(
2008 		__entry->result = result;
2009 		__entry->flags = xprt->xpt_flags;
2010 		__assign_str(addr, xprt->xpt_remotebuf);
2011 	),
2012 
2013 	TP_printk("addr=%s result=%zd flags=%s", __get_str(addr),
2014 		__entry->result, show_svc_xprt_flags(__entry->flags)
2015 	)
2016 );
2017 
2018 #define DEFINE_SVCSOCK_EVENT(name) \
2019 	DEFINE_EVENT(svcsock_class, svcsock_##name, \
2020 			TP_PROTO( \
2021 				const struct svc_xprt *xprt, \
2022 				ssize_t result \
2023 			), \
2024 			TP_ARGS(xprt, result))
2025 
2026 DEFINE_SVCSOCK_EVENT(udp_send);
2027 DEFINE_SVCSOCK_EVENT(udp_recv);
2028 DEFINE_SVCSOCK_EVENT(udp_recv_err);
2029 DEFINE_SVCSOCK_EVENT(tcp_send);
2030 DEFINE_SVCSOCK_EVENT(tcp_recv);
2031 DEFINE_SVCSOCK_EVENT(tcp_recv_eagain);
2032 DEFINE_SVCSOCK_EVENT(tcp_recv_err);
2033 DEFINE_SVCSOCK_EVENT(data_ready);
2034 DEFINE_SVCSOCK_EVENT(write_space);
2035 
2036 TRACE_EVENT(svcsock_tcp_recv_short,
2037 	TP_PROTO(
2038 		const struct svc_xprt *xprt,
2039 		u32 expected,
2040 		u32 received
2041 	),
2042 
2043 	TP_ARGS(xprt, expected, received),
2044 
2045 	TP_STRUCT__entry(
2046 		__field(u32, expected)
2047 		__field(u32, received)
2048 		__field(unsigned long, flags)
2049 		__string(addr, xprt->xpt_remotebuf)
2050 	),
2051 
2052 	TP_fast_assign(
2053 		__entry->expected = expected;
2054 		__entry->received = received;
2055 		__entry->flags = xprt->xpt_flags;
2056 		__assign_str(addr, xprt->xpt_remotebuf);
2057 	),
2058 
2059 	TP_printk("addr=%s flags=%s expected=%u received=%u",
2060 		__get_str(addr), show_svc_xprt_flags(__entry->flags),
2061 		__entry->expected, __entry->received
2062 	)
2063 );
2064 
2065 TRACE_EVENT(svcsock_tcp_state,
2066 	TP_PROTO(
2067 		const struct svc_xprt *xprt,
2068 		const struct socket *socket
2069 	),
2070 
2071 	TP_ARGS(xprt, socket),
2072 
2073 	TP_STRUCT__entry(
2074 		__field(unsigned long, socket_state)
2075 		__field(unsigned long, sock_state)
2076 		__field(unsigned long, flags)
2077 		__string(addr, xprt->xpt_remotebuf)
2078 	),
2079 
2080 	TP_fast_assign(
2081 		__entry->socket_state = socket->state;
2082 		__entry->sock_state = socket->sk->sk_state;
2083 		__entry->flags = xprt->xpt_flags;
2084 		__assign_str(addr, xprt->xpt_remotebuf);
2085 	),
2086 
2087 	TP_printk("addr=%s state=%s sk_state=%s flags=%s", __get_str(addr),
2088 		rpc_show_socket_state(__entry->socket_state),
2089 		rpc_show_sock_state(__entry->sock_state),
2090 		show_svc_xprt_flags(__entry->flags)
2091 	)
2092 );
2093 
2094 DECLARE_EVENT_CLASS(svcsock_accept_class,
2095 	TP_PROTO(
2096 		const struct svc_xprt *xprt,
2097 		const char *service,
2098 		long status
2099 	),
2100 
2101 	TP_ARGS(xprt, service, status),
2102 
2103 	TP_STRUCT__entry(
2104 		__field(long, status)
2105 		__string(service, service)
2106 		__array(unsigned char, addr, sizeof(struct sockaddr_in6))
2107 	),
2108 
2109 	TP_fast_assign(
2110 		__entry->status = status;
2111 		__assign_str(service, service);
2112 		memcpy(__entry->addr, &xprt->xpt_local, sizeof(__entry->addr));
2113 	),
2114 
2115 	TP_printk("listener=%pISpc service=%s status=%ld",
2116 		__entry->addr, __get_str(service), __entry->status
2117 	)
2118 );
2119 
2120 #define DEFINE_ACCEPT_EVENT(name) \
2121 	DEFINE_EVENT(svcsock_accept_class, svcsock_##name##_err, \
2122 			TP_PROTO( \
2123 				const struct svc_xprt *xprt, \
2124 				const char *service, \
2125 				long status \
2126 			), \
2127 			TP_ARGS(xprt, service, status))
2128 
2129 DEFINE_ACCEPT_EVENT(accept);
2130 DEFINE_ACCEPT_EVENT(getpeername);
2131 
2132 DECLARE_EVENT_CLASS(cache_event,
2133 	TP_PROTO(
2134 		const struct cache_detail *cd,
2135 		const struct cache_head *h
2136 	),
2137 
2138 	TP_ARGS(cd, h),
2139 
2140 	TP_STRUCT__entry(
2141 		__field(const struct cache_head *, h)
2142 		__string(name, cd->name)
2143 	),
2144 
2145 	TP_fast_assign(
2146 		__entry->h = h;
2147 		__assign_str(name, cd->name);
2148 	),
2149 
2150 	TP_printk("cache=%s entry=%p", __get_str(name), __entry->h)
2151 );
2152 #define DEFINE_CACHE_EVENT(name) \
2153 	DEFINE_EVENT(cache_event, name, \
2154 			TP_PROTO( \
2155 				const struct cache_detail *cd, \
2156 				const struct cache_head *h \
2157 			), \
2158 			TP_ARGS(cd, h))
2159 DEFINE_CACHE_EVENT(cache_entry_expired);
2160 DEFINE_CACHE_EVENT(cache_entry_upcall);
2161 DEFINE_CACHE_EVENT(cache_entry_update);
2162 DEFINE_CACHE_EVENT(cache_entry_make_negative);
2163 DEFINE_CACHE_EVENT(cache_entry_no_listener);
2164 
2165 DECLARE_EVENT_CLASS(register_class,
2166 	TP_PROTO(
2167 		const char *program,
2168 		const u32 version,
2169 		const int family,
2170 		const unsigned short protocol,
2171 		const unsigned short port,
2172 		int error
2173 	),
2174 
2175 	TP_ARGS(program, version, family, protocol, port, error),
2176 
2177 	TP_STRUCT__entry(
2178 		__field(u32, version)
2179 		__field(unsigned long, family)
2180 		__field(unsigned short, protocol)
2181 		__field(unsigned short, port)
2182 		__field(int, error)
2183 		__string(program, program)
2184 	),
2185 
2186 	TP_fast_assign(
2187 		__entry->version = version;
2188 		__entry->family = family;
2189 		__entry->protocol = protocol;
2190 		__entry->port = port;
2191 		__entry->error = error;
2192 		__assign_str(program, program);
2193 	),
2194 
2195 	TP_printk("program=%sv%u proto=%s port=%u family=%s error=%d",
2196 		__get_str(program), __entry->version,
2197 		__entry->protocol == IPPROTO_UDP ? "udp" : "tcp",
2198 		__entry->port, rpc_show_address_family(__entry->family),
2199 		__entry->error
2200 	)
2201 );
2202 
2203 #define DEFINE_REGISTER_EVENT(name) \
2204 	DEFINE_EVENT(register_class, svc_##name, \
2205 			TP_PROTO( \
2206 				const char *program, \
2207 				const u32 version, \
2208 				const int family, \
2209 				const unsigned short protocol, \
2210 				const unsigned short port, \
2211 				int error \
2212 			), \
2213 			TP_ARGS(program, version, family, protocol, \
2214 				port, error))
2215 
2216 DEFINE_REGISTER_EVENT(register);
2217 DEFINE_REGISTER_EVENT(noregister);
2218 
2219 TRACE_EVENT(svc_unregister,
2220 	TP_PROTO(
2221 		const char *program,
2222 		const u32 version,
2223 		int error
2224 	),
2225 
2226 	TP_ARGS(program, version, error),
2227 
2228 	TP_STRUCT__entry(
2229 		__field(u32, version)
2230 		__field(int, error)
2231 		__string(program, program)
2232 	),
2233 
2234 	TP_fast_assign(
2235 		__entry->version = version;
2236 		__entry->error = error;
2237 		__assign_str(program, program);
2238 	),
2239 
2240 	TP_printk("program=%sv%u error=%d",
2241 		__get_str(program), __entry->version, __entry->error
2242 	)
2243 );
2244 
2245 #endif /* _TRACE_SUNRPC_H */
2246 
2247 #include <trace/define_trace.h>
2248