Merge tag 'platform-drivers-x86-v4.15-1' of git://git.infradead.org/linux-platform...
[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(struct sockaddr *, addr)
490                 __field(u32, xid)
491                 __field(int, status)
492                 __field(unsigned long, flags)
493         ),
494
495         TP_fast_assign(
496                 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
497                 __entry->xid = status > 0 ? be32_to_cpu(rqst->rq_xid) : 0;
498                 __entry->status = status;
499                 __entry->flags = rqst->rq_flags;
500         ),
501
502         TP_printk("addr=%pIScp xid=0x%08x status=%d flags=%s", __entry->addr,
503                         __entry->xid, __entry->status,
504                         show_rqstp_flags(__entry->flags))
505 );
506
507 DECLARE_EVENT_CLASS(svc_rqst_event,
508
509         TP_PROTO(struct svc_rqst *rqst),
510
511         TP_ARGS(rqst),
512
513         TP_STRUCT__entry(
514                 __field(u32, xid)
515                 __field(unsigned long, flags)
516                 __dynamic_array(unsigned char, addr, rqst->rq_addrlen)
517         ),
518
519         TP_fast_assign(
520                 __entry->xid = be32_to_cpu(rqst->rq_xid);
521                 __entry->flags = rqst->rq_flags;
522                 memcpy(__get_dynamic_array(addr),
523                         &rqst->rq_addr, rqst->rq_addrlen);
524         ),
525
526         TP_printk("addr=%pIScp rq_xid=0x%08x flags=%s",
527                 (struct sockaddr *)__get_dynamic_array(addr),
528                 __entry->xid,
529                 show_rqstp_flags(__entry->flags))
530 );
531
532 DEFINE_EVENT(svc_rqst_event, svc_defer,
533         TP_PROTO(struct svc_rqst *rqst),
534         TP_ARGS(rqst));
535
536 DEFINE_EVENT(svc_rqst_event, svc_drop,
537         TP_PROTO(struct svc_rqst *rqst),
538         TP_ARGS(rqst));
539
540 DECLARE_EVENT_CLASS(svc_rqst_status,
541
542         TP_PROTO(struct svc_rqst *rqst, int status),
543
544         TP_ARGS(rqst, status),
545
546         TP_STRUCT__entry(
547                 __field(struct sockaddr *, addr)
548                 __field(u32, xid)
549                 __field(int, dropme)
550                 __field(int, status)
551                 __field(unsigned long, flags)
552         ),
553
554         TP_fast_assign(
555                 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
556                 __entry->xid = be32_to_cpu(rqst->rq_xid);
557                 __entry->status = status;
558                 __entry->flags = rqst->rq_flags;
559         ),
560
561         TP_printk("addr=%pIScp rq_xid=0x%08x status=%d flags=%s",
562                 __entry->addr, __entry->xid,
563                 __entry->status, show_rqstp_flags(__entry->flags))
564 );
565
566 DEFINE_EVENT(svc_rqst_status, svc_process,
567         TP_PROTO(struct svc_rqst *rqst, int status),
568         TP_ARGS(rqst, status));
569
570 DEFINE_EVENT(svc_rqst_status, svc_send,
571         TP_PROTO(struct svc_rqst *rqst, int status),
572         TP_ARGS(rqst, status));
573
574 #define show_svc_xprt_flags(flags)                                      \
575         __print_flags(flags, "|",                                       \
576                 { (1UL << XPT_BUSY),            "XPT_BUSY"},            \
577                 { (1UL << XPT_CONN),            "XPT_CONN"},            \
578                 { (1UL << XPT_CLOSE),           "XPT_CLOSE"},           \
579                 { (1UL << XPT_DATA),            "XPT_DATA"},            \
580                 { (1UL << XPT_TEMP),            "XPT_TEMP"},            \
581                 { (1UL << XPT_DEAD),            "XPT_DEAD"},            \
582                 { (1UL << XPT_CHNGBUF),         "XPT_CHNGBUF"},         \
583                 { (1UL << XPT_DEFERRED),        "XPT_DEFERRED"},        \
584                 { (1UL << XPT_OLD),             "XPT_OLD"},             \
585                 { (1UL << XPT_LISTENER),        "XPT_LISTENER"},        \
586                 { (1UL << XPT_CACHE_AUTH),      "XPT_CACHE_AUTH"},      \
587                 { (1UL << XPT_LOCAL),           "XPT_LOCAL"})
588
589 TRACE_EVENT(svc_xprt_do_enqueue,
590         TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
591
592         TP_ARGS(xprt, rqst),
593
594         TP_STRUCT__entry(
595                 __field(struct svc_xprt *, xprt)
596                 __field(int, pid)
597                 __field(unsigned long, flags)
598                 __dynamic_array(unsigned char, addr, xprt != NULL ?
599                         xprt->xpt_remotelen : 0)
600         ),
601
602         TP_fast_assign(
603                 __entry->xprt = xprt;
604                 __entry->pid = rqst? rqst->rq_task->pid : 0;
605                 if (xprt) {
606                         memcpy(__get_dynamic_array(addr),
607                                 &xprt->xpt_remote,
608                                 xprt->xpt_remotelen);
609                         __entry->flags = xprt->xpt_flags;
610                 } else
611                         __entry->flags = 0;
612         ),
613
614         TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
615                 __get_dynamic_array_len(addr) != 0 ?
616                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
617                 __entry->pid, show_svc_xprt_flags(__entry->flags))
618 );
619
620 DECLARE_EVENT_CLASS(svc_xprt_event,
621         TP_PROTO(struct svc_xprt *xprt),
622
623         TP_ARGS(xprt),
624
625         TP_STRUCT__entry(
626                 __field(struct svc_xprt *, xprt)
627                 __field(unsigned long, flags)
628                 __dynamic_array(unsigned char, addr, xprt != NULL ?
629                         xprt->xpt_remotelen : 0)
630         ),
631
632         TP_fast_assign(
633                 __entry->xprt = xprt;
634                 if (xprt) {
635                         memcpy(__get_dynamic_array(addr),
636                                         &xprt->xpt_remote,
637                                         xprt->xpt_remotelen);
638                         __entry->flags = xprt->xpt_flags;
639                 } else
640                         __entry->flags = 0;
641         ),
642
643         TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt,
644                 __get_dynamic_array_len(addr) != 0 ?
645                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
646                 show_svc_xprt_flags(__entry->flags))
647 );
648
649 DEFINE_EVENT(svc_xprt_event, svc_xprt_dequeue,
650         TP_PROTO(struct svc_xprt *xprt),
651         TP_ARGS(xprt));
652
653 DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
654         TP_PROTO(struct svc_xprt *xprt),
655         TP_ARGS(xprt));
656
657 TRACE_EVENT(svc_wake_up,
658         TP_PROTO(int pid),
659
660         TP_ARGS(pid),
661
662         TP_STRUCT__entry(
663                 __field(int, pid)
664         ),
665
666         TP_fast_assign(
667                 __entry->pid = pid;
668         ),
669
670         TP_printk("pid=%d", __entry->pid)
671 );
672
673 TRACE_EVENT(svc_handle_xprt,
674         TP_PROTO(struct svc_xprt *xprt, int len),
675
676         TP_ARGS(xprt, len),
677
678         TP_STRUCT__entry(
679                 __field(struct svc_xprt *, xprt)
680                 __field(int, len)
681                 __field(unsigned long, flags)
682                 __dynamic_array(unsigned char, addr, xprt != NULL ?
683                         xprt->xpt_remotelen : 0)
684         ),
685
686         TP_fast_assign(
687                 __entry->xprt = xprt;
688                 __entry->len = len;
689                 if (xprt) {
690                         memcpy(__get_dynamic_array(addr),
691                                         &xprt->xpt_remote,
692                                         xprt->xpt_remotelen);
693                         __entry->flags = xprt->xpt_flags;
694                 } else
695                         __entry->flags = 0;
696         ),
697
698         TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
699                 __get_dynamic_array_len(addr) != 0 ?
700                         (struct sockaddr *)__get_dynamic_array(addr) : NULL,
701                 __entry->len, show_svc_xprt_flags(__entry->flags))
702 );
703
704
705 DECLARE_EVENT_CLASS(svc_deferred_event,
706         TP_PROTO(struct svc_deferred_req *dr),
707
708         TP_ARGS(dr),
709
710         TP_STRUCT__entry(
711                 __field(u32, xid)
712                 __dynamic_array(unsigned char, addr, dr->addrlen)
713         ),
714
715         TP_fast_assign(
716                 __entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
717                                                        (dr->xprt_hlen>>2)));
718                 memcpy(__get_dynamic_array(addr), &dr->addr, dr->addrlen);
719         ),
720
721         TP_printk("addr=%pIScp xid=0x%08x",
722                 (struct sockaddr *)__get_dynamic_array(addr),
723                 __entry->xid)
724 );
725
726 DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
727         TP_PROTO(struct svc_deferred_req *dr),
728         TP_ARGS(dr));
729 DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
730         TP_PROTO(struct svc_deferred_req *dr),
731         TP_ARGS(dr));
732 #endif /* _TRACE_SUNRPC_H */
733
734 #include <trace/define_trace.h>