8c153f68509e297225db7614f8e706479476bb9c
[sfrench/cifs-2.6.git] / include / trace / events / sunrpc.h
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 DECLARE_EVENT_CLASS(rpc_task_status,
18
19         TP_PROTO(struct rpc_task *task),
20
21         TP_ARGS(task),
22
23         TP_STRUCT__entry(
24                 __field(unsigned int, task_id)
25                 __field(unsigned int, client_id)
26                 __field(int, status)
27         ),
28
29         TP_fast_assign(
30                 __entry->task_id = task->tk_pid;
31                 __entry->client_id = task->tk_client->cl_clid;
32                 __entry->status = task->tk_status;
33         ),
34
35         TP_printk("task:%u@%u, status %d",
36                 __entry->task_id, __entry->client_id,
37                 __entry->status)
38 );
39
40 DEFINE_EVENT(rpc_task_status, rpc_call_status,
41         TP_PROTO(struct rpc_task *task),
42
43         TP_ARGS(task)
44 );
45
46 DEFINE_EVENT(rpc_task_status, rpc_bind_status,
47         TP_PROTO(struct rpc_task *task),
48
49         TP_ARGS(task)
50 );
51
52 TRACE_EVENT(rpc_connect_status,
53         TP_PROTO(struct rpc_task *task, int status),
54
55         TP_ARGS(task, status),
56
57         TP_STRUCT__entry(
58                 __field(unsigned int, task_id)
59                 __field(unsigned int, client_id)
60                 __field(int, status)
61         ),
62
63         TP_fast_assign(
64                 __entry->task_id = task->tk_pid;
65                 __entry->client_id = task->tk_client->cl_clid;
66                 __entry->status = status;
67         ),
68
69         TP_printk("task:%u@%u, status %d",
70                 __entry->task_id, __entry->client_id,
71                 __entry->status)
72 );
73
74 TRACE_EVENT(rpc_request,
75         TP_PROTO(const struct rpc_task *task),
76
77         TP_ARGS(task),
78
79         TP_STRUCT__entry(
80                 __field(unsigned int, task_id)
81                 __field(unsigned int, client_id)
82                 __field(int, version)
83                 __field(bool, async)
84                 __string(progname, task->tk_client->cl_program->name)
85                 __string(procname, rpc_proc_name(task))
86         ),
87
88         TP_fast_assign(
89                 __entry->task_id = task->tk_pid;
90                 __entry->client_id = task->tk_client->cl_clid;
91                 __entry->version = task->tk_client->cl_vers;
92                 __entry->async = RPC_IS_ASYNC(task);
93                 __assign_str(progname, task->tk_client->cl_program->name)
94                 __assign_str(procname, rpc_proc_name(task))
95         ),
96
97         TP_printk("task:%u@%u %sv%d %s (%ssync)",
98                 __entry->task_id, __entry->client_id,
99                 __get_str(progname), __entry->version,
100                 __get_str(procname), __entry->async ? "a": ""
101                 )
102 );
103
104 DECLARE_EVENT_CLASS(rpc_task_running,
105
106         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
107
108         TP_ARGS(clnt, task, action),
109
110         TP_STRUCT__entry(
111                 __field(unsigned int, task_id)
112                 __field(unsigned int, client_id)
113                 __field(const void *, action)
114                 __field(unsigned long, runstate)
115                 __field(int, status)
116                 __field(unsigned short, flags)
117                 ),
118
119         TP_fast_assign(
120                 __entry->client_id = clnt ? clnt->cl_clid : -1;
121                 __entry->task_id = task->tk_pid;
122                 __entry->action = action;
123                 __entry->runstate = task->tk_runstate;
124                 __entry->status = task->tk_status;
125                 __entry->flags = task->tk_flags;
126                 ),
127
128         TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
129                 __entry->task_id, __entry->client_id,
130                 __entry->flags,
131                 __entry->runstate,
132                 __entry->status,
133                 __entry->action
134                 )
135 );
136
137 DEFINE_EVENT(rpc_task_running, rpc_task_begin,
138
139         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
140
141         TP_ARGS(clnt, task, action)
142
143 );
144
145 DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
146
147         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
148
149         TP_ARGS(clnt, task, action)
150
151 );
152
153 DEFINE_EVENT(rpc_task_running, rpc_task_complete,
154
155         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
156
157         TP_ARGS(clnt, task, action)
158
159 );
160
161 DECLARE_EVENT_CLASS(rpc_task_queued,
162
163         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
164
165         TP_ARGS(clnt, task, q),
166
167         TP_STRUCT__entry(
168                 __field(unsigned int, task_id)
169                 __field(unsigned int, client_id)
170                 __field(unsigned long, timeout)
171                 __field(unsigned long, runstate)
172                 __field(int, status)
173                 __field(unsigned short, flags)
174                 __string(q_name, rpc_qname(q))
175                 ),
176
177         TP_fast_assign(
178                 __entry->client_id = clnt->cl_clid;
179                 __entry->task_id = task->tk_pid;
180                 __entry->timeout = task->tk_timeout;
181                 __entry->runstate = task->tk_runstate;
182                 __entry->status = task->tk_status;
183                 __entry->flags = task->tk_flags;
184                 __assign_str(q_name, rpc_qname(q));
185                 ),
186
187         TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
188                 __entry->task_id, __entry->client_id,
189                 __entry->flags,
190                 __entry->runstate,
191                 __entry->status,
192                 __entry->timeout,
193                 __get_str(q_name)
194                 )
195 );
196
197 DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
198
199         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
200
201         TP_ARGS(clnt, task, q)
202
203 );
204
205 DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
206
207         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
208
209         TP_ARGS(clnt, task, q)
210
211 );
212
213 /*
214  * First define the enums in the below macros to be exported to userspace
215  * via TRACE_DEFINE_ENUM().
216  */
217 #undef EM
218 #undef EMe
219 #define EM(a, b)        TRACE_DEFINE_ENUM(a);
220 #define EMe(a, b)       TRACE_DEFINE_ENUM(a);
221
222 #define RPC_SHOW_SOCKET                         \
223         EM( SS_FREE, "FREE" )                   \
224         EM( SS_UNCONNECTED, "UNCONNECTED" )     \
225         EM( SS_CONNECTING, "CONNECTING," )      \
226         EM( SS_CONNECTED, "CONNECTED," )        \
227         EMe(SS_DISCONNECTING, "DISCONNECTING" )
228
229 #define rpc_show_socket_state(state) \
230         __print_symbolic(state, RPC_SHOW_SOCKET)
231
232 RPC_SHOW_SOCKET
233
234 #define RPC_SHOW_SOCK                           \
235         EM( TCP_ESTABLISHED, "ESTABLISHED" )    \
236         EM( TCP_SYN_SENT, "SYN_SENT" )          \
237         EM( TCP_SYN_RECV, "SYN_RECV" )          \
238         EM( TCP_FIN_WAIT1, "FIN_WAIT1" )        \
239         EM( TCP_FIN_WAIT2, "FIN_WAIT2" )        \
240         EM( TCP_TIME_WAIT, "TIME_WAIT" )        \
241         EM( TCP_CLOSE, "CLOSE" )                \
242         EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )      \
243         EM( TCP_LAST_ACK, "LAST_ACK" )          \
244         EM( TCP_LISTEN, "LISTEN" )              \
245         EMe( TCP_CLOSING, "CLOSING" )
246
247 #define rpc_show_sock_state(state) \
248         __print_symbolic(state, RPC_SHOW_SOCK)
249
250 RPC_SHOW_SOCK
251
252 /*
253  * Now redefine the EM() and EMe() macros to map the enums to the strings
254  * that will be printed in the output.
255  */
256 #undef EM
257 #undef EMe
258 #define EM(a, b)        {a, b},
259 #define EMe(a, b)       {a, b}
260
261 DECLARE_EVENT_CLASS(xs_socket_event,
262
263                 TP_PROTO(
264                         struct rpc_xprt *xprt,
265                         struct socket *socket
266                 ),
267
268                 TP_ARGS(xprt, socket),
269
270                 TP_STRUCT__entry(
271                         __field(unsigned int, socket_state)
272                         __field(unsigned int, sock_state)
273                         __field(unsigned long long, ino)
274                         __string(dstaddr,
275                                 xprt->address_strings[RPC_DISPLAY_ADDR])
276                         __string(dstport,
277                                 xprt->address_strings[RPC_DISPLAY_PORT])
278                 ),
279
280                 TP_fast_assign(
281                         struct inode *inode = SOCK_INODE(socket);
282                         __entry->socket_state = socket->state;
283                         __entry->sock_state = socket->sk->sk_state;
284                         __entry->ino = (unsigned long long)inode->i_ino;
285                         __assign_str(dstaddr,
286                                 xprt->address_strings[RPC_DISPLAY_ADDR]);
287                         __assign_str(dstport,
288                                 xprt->address_strings[RPC_DISPLAY_PORT]);
289                 ),
290
291                 TP_printk(
292                         "socket:[%llu] dstaddr=%s/%s "
293                         "state=%u (%s) sk_state=%u (%s)",
294                         __entry->ino, __get_str(dstaddr), __get_str(dstport),
295                         __entry->socket_state,
296                         rpc_show_socket_state(__entry->socket_state),
297                         __entry->sock_state,
298                         rpc_show_sock_state(__entry->sock_state)
299                 )
300 );
301 #define DEFINE_RPC_SOCKET_EVENT(name) \
302         DEFINE_EVENT(xs_socket_event, name, \
303                         TP_PROTO( \
304                                 struct rpc_xprt *xprt, \
305                                 struct socket *socket \
306                         ), \
307                         TP_ARGS(xprt, socket))
308
309 DECLARE_EVENT_CLASS(xs_socket_event_done,
310
311                 TP_PROTO(
312                         struct rpc_xprt *xprt,
313                         struct socket *socket,
314                         int error
315                 ),
316
317                 TP_ARGS(xprt, socket, error),
318
319                 TP_STRUCT__entry(
320                         __field(int, error)
321                         __field(unsigned int, socket_state)
322                         __field(unsigned int, sock_state)
323                         __field(unsigned long long, ino)
324                         __string(dstaddr,
325                                 xprt->address_strings[RPC_DISPLAY_ADDR])
326                         __string(dstport,
327                                 xprt->address_strings[RPC_DISPLAY_PORT])
328                 ),
329
330                 TP_fast_assign(
331                         struct inode *inode = SOCK_INODE(socket);
332                         __entry->socket_state = socket->state;
333                         __entry->sock_state = socket->sk->sk_state;
334                         __entry->ino = (unsigned long long)inode->i_ino;
335                         __entry->error = error;
336                         __assign_str(dstaddr,
337                                 xprt->address_strings[RPC_DISPLAY_ADDR]);
338                         __assign_str(dstport,
339                                 xprt->address_strings[RPC_DISPLAY_PORT]);
340                 ),
341
342                 TP_printk(
343                         "error=%d socket:[%llu] dstaddr=%s/%s "
344                         "state=%u (%s) sk_state=%u (%s)",
345                         __entry->error,
346                         __entry->ino, __get_str(dstaddr), __get_str(dstport),
347                         __entry->socket_state,
348                         rpc_show_socket_state(__entry->socket_state),
349                         __entry->sock_state,
350                         rpc_show_sock_state(__entry->sock_state)
351                 )
352 );
353 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
354         DEFINE_EVENT(xs_socket_event_done, name, \
355                         TP_PROTO( \
356                                 struct rpc_xprt *xprt, \
357                                 struct socket *socket, \
358                                 int error \
359                         ), \
360                         TP_ARGS(xprt, socket, error))
361
362 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
363 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
364 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
365 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
366 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
367 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
368
369 DECLARE_EVENT_CLASS(rpc_xprt_event,
370         TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
371
372         TP_ARGS(xprt, xid, status),
373
374         TP_STRUCT__entry(
375                 __field(u32, xid)
376                 __field(int, status)
377                 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
378                 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
379         ),
380
381         TP_fast_assign(
382                 __entry->xid = be32_to_cpu(xid);
383                 __entry->status = status;
384                 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
385                 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
386         ),
387
388         TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
389                         __get_str(port), __entry->xid,
390                         __entry->status)
391 );
392
393 DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
394         TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
395         TP_ARGS(xprt, xid, status));
396
397 DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
398         TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
399         TP_ARGS(xprt, xid, status));
400
401 DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
402         TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
403         TP_ARGS(xprt, xid, status));
404
405 TRACE_EVENT(xs_tcp_data_ready,
406         TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
407
408         TP_ARGS(xprt, err, total),
409
410         TP_STRUCT__entry(
411                 __field(int, err)
412                 __field(unsigned int, total)
413                 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
414                                 "(null)")
415                 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
416                                 "(null)")
417         ),
418
419         TP_fast_assign(
420                 __entry->err = err;
421                 __entry->total = total;
422                 __assign_str(addr, xprt ?
423                         xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
424                 __assign_str(port, xprt ?
425                         xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
426         ),
427
428         TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
429                         __get_str(port), __entry->err, __entry->total)
430 );
431
432 #define rpc_show_sock_xprt_flags(flags) \
433         __print_flags(flags, "|", \
434                 { TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
435                 { TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
436                 { TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
437                 { TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
438                 { TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
439                 { TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
440                 { TCP_RPC_REPLY, "TCP_RPC_REPLY" })
441
442 TRACE_EVENT(xs_tcp_data_recv,
443         TP_PROTO(struct sock_xprt *xs),
444
445         TP_ARGS(xs),
446
447         TP_STRUCT__entry(
448                 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
449                 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
450                 __field(u32, xid)
451                 __field(unsigned long, flags)
452                 __field(unsigned long, copied)
453                 __field(unsigned int, reclen)
454                 __field(unsigned long, offset)
455         ),
456
457         TP_fast_assign(
458                 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
459                 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
460                 __entry->xid = be32_to_cpu(xs->tcp_xid);
461                 __entry->flags = xs->tcp_flags;
462                 __entry->copied = xs->tcp_copied;
463                 __entry->reclen = xs->tcp_reclen;
464                 __entry->offset = xs->tcp_offset;
465         ),
466
467         TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu",
468                         __get_str(addr), __get_str(port), __entry->xid,
469                         rpc_show_sock_xprt_flags(__entry->flags),
470                         __entry->copied, __entry->reclen, __entry->offset)
471 );
472
473 #define show_rqstp_flags(flags)                                         \
474         __print_flags(flags, "|",                                       \
475                 { (1UL << RQ_SECURE),           "RQ_SECURE"},           \
476                 { (1UL << RQ_LOCAL),            "RQ_LOCAL"},            \
477                 { (1UL << RQ_USEDEFERRAL),      "RQ_USEDEFERRAL"},      \
478                 { (1UL << RQ_DROPME),           "RQ_DROPME"},           \
479                 { (1UL << RQ_SPLICE_OK),        "RQ_SPLICE_OK"},        \
480                 { (1UL << RQ_VICTIM),           "RQ_VICTIM"},           \
481                 { (1UL << RQ_BUSY),             "RQ_BUSY"})
482
483 TRACE_EVENT(svc_recv,
484         TP_PROTO(struct svc_rqst *rqst, int status),
485
486         TP_ARGS(rqst, status),
487
488         TP_STRUCT__entry(
489                 __field(u32, xid)
490                 __field(int, status)
491                 __field(unsigned long, flags)
492                 __dynamic_array(unsigned char, addr, rqst->rq_addrlen)
493         ),
494
495         TP_fast_assign(
496                 __entry->xid = status > 0 ? be32_to_cpu(rqst->rq_xid) : 0;
497                 __entry->status = status;
498                 __entry->flags = rqst->rq_flags;
499                 memcpy(__get_dynamic_array(addr),
500                         &rqst->rq_addr, rqst->rq_addrlen);
501         ),
502
503         TP_printk("addr=%pIScp xid=0x%08x status=%d flags=%s",
504                         (struct sockaddr *)__get_dynamic_array(addr),
505                         __entry->xid, __entry->status,
506                         show_rqstp_flags(__entry->flags))
507 );
508
509 DECLARE_EVENT_CLASS(svc_rqst_event,
510
511         TP_PROTO(struct svc_rqst *rqst),
512
513         TP_ARGS(rqst),
514
515         TP_STRUCT__entry(
516                 __field(u32, xid)
517                 __field(unsigned long, flags)
518                 __dynamic_array(unsigned char, addr, rqst->rq_addrlen)
519         ),
520
521         TP_fast_assign(
522                 __entry->xid = be32_to_cpu(rqst->rq_xid);
523                 __entry->flags = rqst->rq_flags;
524                 memcpy(__get_dynamic_array(addr),
525                         &rqst->rq_addr, rqst->rq_addrlen);
526         ),
527
528         TP_printk("addr=%pIScp rq_xid=0x%08x flags=%s",
529                 (struct sockaddr *)__get_dynamic_array(addr),
530                 __entry->xid,
531                 show_rqstp_flags(__entry->flags))
532 );
533
534 DEFINE_EVENT(svc_rqst_event, svc_defer,
535         TP_PROTO(struct svc_rqst *rqst),
536         TP_ARGS(rqst));
537
538 DEFINE_EVENT(svc_rqst_event, svc_drop,
539         TP_PROTO(struct svc_rqst *rqst),
540         TP_ARGS(rqst));
541
542 DECLARE_EVENT_CLASS(svc_rqst_status,
543
544         TP_PROTO(struct svc_rqst *rqst, int status),
545
546         TP_ARGS(rqst, status),
547
548         TP_STRUCT__entry(
549                 __field(u32, xid)
550                 __field(int, status)
551                 __field(unsigned long, flags)
552                 __dynamic_array(unsigned char, addr, rqst->rq_addrlen)
553         ),
554
555         TP_fast_assign(
556                 __entry->xid = be32_to_cpu(rqst->rq_xid);
557                 __entry->status = status;
558                 __entry->flags = rqst->rq_flags;
559                 memcpy(__get_dynamic_array(addr),
560                         &rqst->rq_addr, rqst->rq_addrlen);
561         ),
562
563         TP_printk("addr=%pIScp rq_xid=0x%08x status=%d flags=%s",
564                 (struct sockaddr *)__get_dynamic_array(addr),
565                 __entry->xid,
566                 __entry->status, show_rqstp_flags(__entry->flags))
567 );
568
569 DEFINE_EVENT(svc_rqst_status, svc_process,
570         TP_PROTO(struct svc_rqst *rqst, int status),
571         TP_ARGS(rqst, status));
572
573 DEFINE_EVENT(svc_rqst_status, svc_send,
574         TP_PROTO(struct svc_rqst *rqst, int status),
575         TP_ARGS(rqst, status));
576
577 #define show_svc_xprt_flags(flags)                                      \
578         __print_flags(flags, "|",                                       \
579                 { (1UL << XPT_BUSY),            "XPT_BUSY"},            \
580                 { (1UL << XPT_CONN),            "XPT_CONN"},            \
581                 { (1UL << XPT_CLOSE),           "XPT_CLOSE"},           \
582                 { (1UL << XPT_DATA),            "XPT_DATA"},            \
583                 { (1UL << XPT_TEMP),            "XPT_TEMP"},            \
584                 { (1UL << XPT_DEAD),            "XPT_DEAD"},            \
585                 { (1UL << XPT_CHNGBUF),         "XPT_CHNGBUF"},         \
586                 { (1UL << XPT_DEFERRED),        "XPT_DEFERRED"},        \
587                 { (1UL << XPT_OLD),             "XPT_OLD"},             \
588                 { (1UL << XPT_LISTENER),        "XPT_LISTENER"},        \
589                 { (1UL << XPT_CACHE_AUTH),      "XPT_CACHE_AUTH"},      \
590                 { (1UL << XPT_LOCAL),           "XPT_LOCAL"})
591
592 TRACE_EVENT(svc_xprt_do_enqueue,
593         TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
594
595         TP_ARGS(xprt, rqst),
596
597         TP_STRUCT__entry(
598                 __field(struct svc_xprt *, xprt)
599                 __field(int, pid)
600                 __field(unsigned long, flags)
601                 __dynamic_array(unsigned char, addr, xprt != NULL ?
602                         xprt->xpt_remotelen : 0)
603         ),
604
605         TP_fast_assign(
606                 __entry->xprt = xprt;
607                 __entry->pid = rqst? rqst->rq_task->pid : 0;
608                 if (xprt) {
609                         memcpy(__get_dynamic_array(addr),
610                                 &xprt->xpt_remote,
611                                 xprt->xpt_remotelen);
612                         __entry->flags = xprt->xpt_flags;
613                 } else
614                         __entry->flags = 0;
615         ),
616
617         TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
618                 __get_dynamic_array_len(addr) != 0 ?
619                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
620                 __entry->pid, show_svc_xprt_flags(__entry->flags))
621 );
622
623 DECLARE_EVENT_CLASS(svc_xprt_event,
624         TP_PROTO(struct svc_xprt *xprt),
625
626         TP_ARGS(xprt),
627
628         TP_STRUCT__entry(
629                 __field(struct svc_xprt *, xprt)
630                 __field(unsigned long, flags)
631                 __dynamic_array(unsigned char, addr, xprt != NULL ?
632                         xprt->xpt_remotelen : 0)
633         ),
634
635         TP_fast_assign(
636                 __entry->xprt = xprt;
637                 if (xprt) {
638                         memcpy(__get_dynamic_array(addr),
639                                         &xprt->xpt_remote,
640                                         xprt->xpt_remotelen);
641                         __entry->flags = xprt->xpt_flags;
642                 } else
643                         __entry->flags = 0;
644         ),
645
646         TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt,
647                 __get_dynamic_array_len(addr) != 0 ?
648                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
649                 show_svc_xprt_flags(__entry->flags))
650 );
651
652 DEFINE_EVENT(svc_xprt_event, svc_xprt_dequeue,
653         TP_PROTO(struct svc_xprt *xprt),
654         TP_ARGS(xprt));
655
656 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
657         TP_PROTO(struct svc_xprt *xprt),
658         TP_ARGS(xprt));
659
660 TRACE_EVENT(svc_wake_up,
661         TP_PROTO(int pid),
662
663         TP_ARGS(pid),
664
665         TP_STRUCT__entry(
666                 __field(int, pid)
667         ),
668
669         TP_fast_assign(
670                 __entry->pid = pid;
671         ),
672
673         TP_printk("pid=%d", __entry->pid)
674 );
675
676 TRACE_EVENT(svc_handle_xprt,
677         TP_PROTO(struct svc_xprt *xprt, int len),
678
679         TP_ARGS(xprt, len),
680
681         TP_STRUCT__entry(
682                 __field(struct svc_xprt *, xprt)
683                 __field(int, len)
684                 __field(unsigned long, flags)
685                 __dynamic_array(unsigned char, addr, xprt != NULL ?
686                         xprt->xpt_remotelen : 0)
687         ),
688
689         TP_fast_assign(
690                 __entry->xprt = xprt;
691                 __entry->len = len;
692                 if (xprt) {
693                         memcpy(__get_dynamic_array(addr),
694                                         &xprt->xpt_remote,
695                                         xprt->xpt_remotelen);
696                         __entry->flags = xprt->xpt_flags;
697                 } else
698                         __entry->flags = 0;
699         ),
700
701         TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
702                 __get_dynamic_array_len(addr) != 0 ?
703                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
704                 __entry->len, show_svc_xprt_flags(__entry->flags))
705 );
706
707
708 DECLARE_EVENT_CLASS(svc_deferred_event,
709         TP_PROTO(struct svc_deferred_req *dr),
710
711         TP_ARGS(dr),
712
713         TP_STRUCT__entry(
714                 __field(u32, xid)
715                 __dynamic_array(unsigned char, addr, dr->addrlen)
716         ),
717
718         TP_fast_assign(
719                 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
720                                                        (dr->xprt_hlen>>2)));
721                 memcpy(__get_dynamic_array(addr), &dr->addr, dr->addrlen);
722         ),
723
724         TP_printk("addr=%pIScp xid=0x%08x",
725                 (struct sockaddr *)__get_dynamic_array(addr),
726                 __entry->xid)
727 );
728
729 DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
730         TP_PROTO(struct svc_deferred_req *dr),
731         TP_ARGS(dr));
732 DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
733         TP_PROTO(struct svc_deferred_req *dr),
734         TP_ARGS(dr));
735 #endif /* _TRACE_SUNRPC_H */
736
737 #include <trace/define_trace.h>