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