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