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