blob: 8a707f8a41c3df76b682032cf180eda869a49e1d [file] [log] [blame]
Trond Myklebust82b0a4c2012-01-20 14:52:23 -05001#undef TRACE_SYSTEM
2#define TRACE_SYSTEM sunrpc
3
4#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SUNRPC_H
6
7#include <linux/sunrpc/sched.h>
8#include <linux/sunrpc/clnt.h>
Jeff Layton860a0d92014-10-28 14:24:12 -04009#include <linux/sunrpc/svc.h>
Jeff Layton1a867a02014-10-28 14:24:14 -040010#include <linux/sunrpc/xprtsock.h>
Jeff Layton83a712e2014-11-21 14:19:31 -050011#include <linux/sunrpc/svc_xprt.h>
Trond Myklebust40b5ea02013-09-04 12:16:23 -040012#include <net/tcp_states.h>
13#include <linux/net.h>
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050014#include <linux/tracepoint.h>
15
Steve Dickson5753cba2012-02-06 10:08:08 -050016DECLARE_EVENT_CLASS(rpc_task_status,
17
18 TP_PROTO(struct rpc_task *task),
19
20 TP_ARGS(task),
21
22 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040023 __field(unsigned int, task_id)
24 __field(unsigned int, client_id)
Steve Dickson5753cba2012-02-06 10:08:08 -050025 __field(int, status)
26 ),
27
28 TP_fast_assign(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040029 __entry->task_id = task->tk_pid;
30 __entry->client_id = task->tk_client->cl_clid;
Steve Dickson5753cba2012-02-06 10:08:08 -050031 __entry->status = task->tk_status;
32 ),
33
Trond Myklebust92cb6c52013-09-04 22:09:50 -040034 TP_printk("task:%u@%u, status %d",
35 __entry->task_id, __entry->client_id,
36 __entry->status)
Steve Dickson5753cba2012-02-06 10:08:08 -050037);
38
39DEFINE_EVENT(rpc_task_status, rpc_call_status,
40 TP_PROTO(struct rpc_task *task),
41
42 TP_ARGS(task)
43);
44
45DEFINE_EVENT(rpc_task_status, rpc_bind_status,
46 TP_PROTO(struct rpc_task *task),
47
48 TP_ARGS(task)
49);
50
51TRACE_EVENT(rpc_connect_status,
52 TP_PROTO(struct rpc_task *task, int status),
53
54 TP_ARGS(task, status),
55
56 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040057 __field(unsigned int, task_id)
58 __field(unsigned int, client_id)
Steve Dickson5753cba2012-02-06 10:08:08 -050059 __field(int, status)
60 ),
61
62 TP_fast_assign(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040063 __entry->task_id = task->tk_pid;
64 __entry->client_id = task->tk_client->cl_clid;
Steve Dickson5753cba2012-02-06 10:08:08 -050065 __entry->status = status;
66 ),
67
Trond Myklebust92cb6c52013-09-04 22:09:50 -040068 TP_printk("task:%u@%u, status %d",
69 __entry->task_id, __entry->client_id,
70 __entry->status)
Steve Dickson5753cba2012-02-06 10:08:08 -050071);
72
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050073DECLARE_EVENT_CLASS(rpc_task_running,
74
75 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
76
77 TP_ARGS(clnt, task, action),
78
79 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -040080 __field(unsigned int, task_id)
81 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050082 __field(const void *, action)
83 __field(unsigned long, runstate)
84 __field(int, status)
85 __field(unsigned short, flags)
86 ),
87
88 TP_fast_assign(
Ditang Chen2ca310f2014-03-07 13:27:57 +080089 __entry->client_id = clnt ? clnt->cl_clid : -1;
Trond Myklebust92cb6c52013-09-04 22:09:50 -040090 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050091 __entry->action = action;
92 __entry->runstate = task->tk_runstate;
93 __entry->status = task->tk_status;
94 __entry->flags = task->tk_flags;
95 ),
96
Ditang Chen2ca310f2014-03-07 13:27:57 +080097 TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
Trond Myklebust92cb6c52013-09-04 22:09:50 -040098 __entry->task_id, __entry->client_id,
Trond Myklebust82b0a4c2012-01-20 14:52:23 -050099 __entry->flags,
100 __entry->runstate,
101 __entry->status,
102 __entry->action
103 )
104);
105
106DEFINE_EVENT(rpc_task_running, rpc_task_begin,
107
108 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
109
110 TP_ARGS(clnt, task, action)
111
112);
113
114DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
115
116 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
117
118 TP_ARGS(clnt, task, action)
119
120);
121
122DEFINE_EVENT(rpc_task_running, rpc_task_complete,
123
124 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
125
126 TP_ARGS(clnt, task, action)
127
128);
129
130DECLARE_EVENT_CLASS(rpc_task_queued,
131
132 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
133
134 TP_ARGS(clnt, task, q),
135
136 TP_STRUCT__entry(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400137 __field(unsigned int, task_id)
138 __field(unsigned int, client_id)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500139 __field(unsigned long, timeout)
140 __field(unsigned long, runstate)
141 __field(int, status)
142 __field(unsigned short, flags)
Trond Myklebust85c0d242012-02-06 10:31:35 -0500143 __string(q_name, rpc_qname(q))
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500144 ),
145
146 TP_fast_assign(
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400147 __entry->client_id = clnt->cl_clid;
148 __entry->task_id = task->tk_pid;
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500149 __entry->timeout = task->tk_timeout;
150 __entry->runstate = task->tk_runstate;
151 __entry->status = task->tk_status;
152 __entry->flags = task->tk_flags;
Trond Myklebust85c0d242012-02-06 10:31:35 -0500153 __assign_str(q_name, rpc_qname(q));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500154 ),
155
Trond Myklebust92cb6c52013-09-04 22:09:50 -0400156 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
157 __entry->task_id, __entry->client_id,
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500158 __entry->flags,
159 __entry->runstate,
160 __entry->status,
161 __entry->timeout,
Trond Myklebust85c0d242012-02-06 10:31:35 -0500162 __get_str(q_name)
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500163 )
164);
165
166DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
167
168 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
169
170 TP_ARGS(clnt, task, q)
171
172);
173
174DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
175
176 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
177
178 TP_ARGS(clnt, task, q)
179
180);
181
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400182/*
183 * First define the enums in the below macros to be exported to userspace
184 * via TRACE_DEFINE_ENUM().
185 */
186#undef EM
187#undef EMe
188#define EM(a, b) TRACE_DEFINE_ENUM(a);
189#define EMe(a, b) TRACE_DEFINE_ENUM(a);
190
191#define RPC_SHOW_SOCKET \
192 EM( SS_FREE, "FREE" ) \
193 EM( SS_UNCONNECTED, "UNCONNECTED" ) \
194 EM( SS_CONNECTING, "CONNECTING," ) \
195 EM( SS_CONNECTED, "CONNECTED," ) \
196 EMe(SS_DISCONNECTING, "DISCONNECTING" )
197
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400198#define rpc_show_socket_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400199 __print_symbolic(state, RPC_SHOW_SOCKET)
200
201RPC_SHOW_SOCKET
202
203#define RPC_SHOW_SOCK \
204 EM( TCP_ESTABLISHED, "ESTABLISHED" ) \
205 EM( TCP_SYN_SENT, "SYN_SENT" ) \
206 EM( TCP_SYN_RECV, "SYN_RECV" ) \
207 EM( TCP_FIN_WAIT1, "FIN_WAIT1" ) \
208 EM( TCP_FIN_WAIT2, "FIN_WAIT2" ) \
209 EM( TCP_TIME_WAIT, "TIME_WAIT" ) \
210 EM( TCP_CLOSE, "CLOSE" ) \
211 EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" ) \
212 EM( TCP_LAST_ACK, "LAST_ACK" ) \
213 EM( TCP_LISTEN, "LISTEN" ) \
214 EMe( TCP_CLOSING, "CLOSING" )
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400215
216#define rpc_show_sock_state(state) \
Steven Rostedt (Red Hat)6ba16ee2015-03-27 16:53:03 -0400217 __print_symbolic(state, RPC_SHOW_SOCK)
218
219RPC_SHOW_SOCK
220
221/*
222 * Now redefine the EM() and EMe() macros to map the enums to the strings
223 * that will be printed in the output.
224 */
225#undef EM
226#undef EMe
227#define EM(a, b) {a, b},
228#define EMe(a, b) {a, b}
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400229
230DECLARE_EVENT_CLASS(xs_socket_event,
231
232 TP_PROTO(
233 struct rpc_xprt *xprt,
234 struct socket *socket
235 ),
236
237 TP_ARGS(xprt, socket),
238
239 TP_STRUCT__entry(
240 __field(unsigned int, socket_state)
241 __field(unsigned int, sock_state)
242 __field(unsigned long long, ino)
243 __string(dstaddr,
244 xprt->address_strings[RPC_DISPLAY_ADDR])
245 __string(dstport,
246 xprt->address_strings[RPC_DISPLAY_PORT])
247 ),
248
249 TP_fast_assign(
250 struct inode *inode = SOCK_INODE(socket);
251 __entry->socket_state = socket->state;
252 __entry->sock_state = socket->sk->sk_state;
253 __entry->ino = (unsigned long long)inode->i_ino;
254 __assign_str(dstaddr,
255 xprt->address_strings[RPC_DISPLAY_ADDR]);
256 __assign_str(dstport,
257 xprt->address_strings[RPC_DISPLAY_PORT]);
258 ),
259
260 TP_printk(
261 "socket:[%llu] dstaddr=%s/%s "
262 "state=%u (%s) sk_state=%u (%s)",
263 __entry->ino, __get_str(dstaddr), __get_str(dstport),
264 __entry->socket_state,
265 rpc_show_socket_state(__entry->socket_state),
266 __entry->sock_state,
267 rpc_show_sock_state(__entry->sock_state)
268 )
269);
270#define DEFINE_RPC_SOCKET_EVENT(name) \
271 DEFINE_EVENT(xs_socket_event, name, \
272 TP_PROTO( \
273 struct rpc_xprt *xprt, \
274 struct socket *socket \
275 ), \
276 TP_ARGS(xprt, socket))
277
278DECLARE_EVENT_CLASS(xs_socket_event_done,
279
280 TP_PROTO(
281 struct rpc_xprt *xprt,
282 struct socket *socket,
283 int error
284 ),
285
286 TP_ARGS(xprt, socket, error),
287
288 TP_STRUCT__entry(
289 __field(int, error)
290 __field(unsigned int, socket_state)
291 __field(unsigned int, sock_state)
292 __field(unsigned long long, ino)
293 __string(dstaddr,
294 xprt->address_strings[RPC_DISPLAY_ADDR])
295 __string(dstport,
296 xprt->address_strings[RPC_DISPLAY_PORT])
297 ),
298
299 TP_fast_assign(
300 struct inode *inode = SOCK_INODE(socket);
301 __entry->socket_state = socket->state;
302 __entry->sock_state = socket->sk->sk_state;
303 __entry->ino = (unsigned long long)inode->i_ino;
304 __entry->error = error;
305 __assign_str(dstaddr,
306 xprt->address_strings[RPC_DISPLAY_ADDR]);
307 __assign_str(dstport,
308 xprt->address_strings[RPC_DISPLAY_PORT]);
309 ),
310
311 TP_printk(
312 "error=%d socket:[%llu] dstaddr=%s/%s "
313 "state=%u (%s) sk_state=%u (%s)",
314 __entry->error,
315 __entry->ino, __get_str(dstaddr), __get_str(dstport),
316 __entry->socket_state,
317 rpc_show_socket_state(__entry->socket_state),
318 __entry->sock_state,
319 rpc_show_sock_state(__entry->sock_state)
320 )
321);
322#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
323 DEFINE_EVENT(xs_socket_event_done, name, \
324 TP_PROTO( \
325 struct rpc_xprt *xprt, \
326 struct socket *socket, \
327 int error \
328 ), \
329 TP_ARGS(xprt, socket, error))
330
331DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
332DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
Trond Myklebuste8353c762013-12-31 13:39:22 -0500333DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
Trond Myklebust40b5ea02013-09-04 12:16:23 -0400334DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
335DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
336DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
337
Jeff Layton3705ad62014-10-28 14:24:13 -0400338DECLARE_EVENT_CLASS(rpc_xprt_event,
339 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
340
341 TP_ARGS(xprt, xid, status),
342
343 TP_STRUCT__entry(
344 __field(__be32, xid)
345 __field(int, status)
346 __string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
347 __string(port, xprt->address_strings[RPC_DISPLAY_PORT])
348 ),
349
350 TP_fast_assign(
351 __entry->xid = xid;
352 __entry->status = status;
353 __assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
354 __assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
355 ),
356
Jeff Layton1a867a02014-10-28 14:24:14 -0400357 TP_printk("peer=[%s]:%s xid=0x%x status=%d", __get_str(addr),
Jeff Layton3705ad62014-10-28 14:24:13 -0400358 __get_str(port), be32_to_cpu(__entry->xid),
359 __entry->status)
360);
361
362DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
363 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
364 TP_ARGS(xprt, xid, status));
365
366DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
367 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
368 TP_ARGS(xprt, xid, status));
369
370DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
371 TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
372 TP_ARGS(xprt, xid, status));
373
374TRACE_EVENT(xs_tcp_data_ready,
375 TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),
376
377 TP_ARGS(xprt, err, total),
378
379 TP_STRUCT__entry(
380 __field(int, err)
381 __field(unsigned int, total)
382 __string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
383 "(null)")
384 __string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
385 "(null)")
386 ),
387
388 TP_fast_assign(
389 __entry->err = err;
390 __entry->total = total;
391 __assign_str(addr, xprt ?
392 xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
393 __assign_str(port, xprt ?
394 xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
395 ),
396
397 TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
398 __get_str(port), __entry->err, __entry->total)
399);
400
Jeff Layton1a867a02014-10-28 14:24:14 -0400401#define rpc_show_sock_xprt_flags(flags) \
402 __print_flags(flags, "|", \
403 { TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
404 { TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
405 { TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
406 { TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
407 { TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
408 { TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
409 { TCP_RPC_REPLY, "TCP_RPC_REPLY" })
410
411TRACE_EVENT(xs_tcp_data_recv,
412 TP_PROTO(struct sock_xprt *xs),
413
414 TP_ARGS(xs),
415
416 TP_STRUCT__entry(
417 __string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
418 __string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
419 __field(__be32, xid)
420 __field(unsigned long, flags)
421 __field(unsigned long, copied)
422 __field(unsigned int, reclen)
423 __field(unsigned long, offset)
424 ),
425
426 TP_fast_assign(
427 __assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
428 __assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
429 __entry->xid = xs->tcp_xid;
430 __entry->flags = xs->tcp_flags;
431 __entry->copied = xs->tcp_copied;
432 __entry->reclen = xs->tcp_reclen;
433 __entry->offset = xs->tcp_offset;
434 ),
435
436 TP_printk("peer=[%s]:%s xid=0x%x flags=%s copied=%lu reclen=%u offset=%lu",
437 __get_str(addr), __get_str(port), be32_to_cpu(__entry->xid),
438 rpc_show_sock_xprt_flags(__entry->flags),
439 __entry->copied, __entry->reclen, __entry->offset)
440);
441
Jeff Layton30660e04b2014-11-19 07:51:16 -0500442#define show_rqstp_flags(flags) \
443 __print_flags(flags, "|", \
444 { (1UL << RQ_SECURE), "RQ_SECURE"}, \
445 { (1UL << RQ_LOCAL), "RQ_LOCAL"}, \
Jeff Layton78b65eb2014-11-19 07:51:17 -0500446 { (1UL << RQ_USEDEFERRAL), "RQ_USEDEFERRAL"}, \
Jeff Layton779fb0f2014-11-19 07:51:18 -0500447 { (1UL << RQ_DROPME), "RQ_DROPME"}, \
Jeff Layton81244382014-11-21 14:19:28 -0500448 { (1UL << RQ_SPLICE_OK), "RQ_SPLICE_OK"}, \
Jeff Laytonb1691bc2014-11-21 14:19:30 -0500449 { (1UL << RQ_VICTIM), "RQ_VICTIM"}, \
450 { (1UL << RQ_BUSY), "RQ_BUSY"})
Jeff Layton4d152e22014-11-19 07:51:14 -0500451
Jeff Layton860a0d92014-10-28 14:24:12 -0400452TRACE_EVENT(svc_recv,
453 TP_PROTO(struct svc_rqst *rqst, int status),
454
455 TP_ARGS(rqst, status),
456
457 TP_STRUCT__entry(
458 __field(struct sockaddr *, addr)
459 __field(__be32, xid)
460 __field(int, status)
Jeff Layton4d152e22014-11-19 07:51:14 -0500461 __field(unsigned long, flags)
Jeff Layton860a0d92014-10-28 14:24:12 -0400462 ),
463
464 TP_fast_assign(
465 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
466 __entry->xid = status > 0 ? rqst->rq_xid : 0;
467 __entry->status = status;
Jeff Layton4d152e22014-11-19 07:51:14 -0500468 __entry->flags = rqst->rq_flags;
Jeff Layton860a0d92014-10-28 14:24:12 -0400469 ),
470
Jeff Layton4d152e22014-11-19 07:51:14 -0500471 TP_printk("addr=%pIScp xid=0x%x status=%d flags=%s", __entry->addr,
472 be32_to_cpu(__entry->xid), __entry->status,
473 show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -0400474);
475
Trond Myklebust104f6352016-06-24 10:55:46 -0400476DECLARE_EVENT_CLASS(svc_rqst_event,
477
478 TP_PROTO(struct svc_rqst *rqst),
479
480 TP_ARGS(rqst),
481
482 TP_STRUCT__entry(
483 __field(__be32, xid)
484 __field(unsigned long, flags)
485 __dynamic_array(unsigned char, addr, rqst->rq_addrlen)
486 ),
487
488 TP_fast_assign(
489 __entry->xid = rqst->rq_xid;
490 __entry->flags = rqst->rq_flags;
491 memcpy(__get_dynamic_array(addr),
492 &rqst->rq_addr, rqst->rq_addrlen);
493 ),
494
495 TP_printk("addr=%pIScp rq_xid=0x%x flags=%s",
496 (struct sockaddr *)__get_dynamic_array(addr),
497 be32_to_cpu(__entry->xid),
498 show_rqstp_flags(__entry->flags))
499);
500
501DEFINE_EVENT(svc_rqst_event, svc_defer,
502 TP_PROTO(struct svc_rqst *rqst),
503 TP_ARGS(rqst));
504
505DEFINE_EVENT(svc_rqst_event, svc_drop,
506 TP_PROTO(struct svc_rqst *rqst),
507 TP_ARGS(rqst));
508
Jeff Layton860a0d92014-10-28 14:24:12 -0400509DECLARE_EVENT_CLASS(svc_rqst_status,
510
511 TP_PROTO(struct svc_rqst *rqst, int status),
512
513 TP_ARGS(rqst, status),
514
515 TP_STRUCT__entry(
516 __field(struct sockaddr *, addr)
517 __field(__be32, xid)
518 __field(int, dropme)
519 __field(int, status)
Jeff Layton4d152e22014-11-19 07:51:14 -0500520 __field(unsigned long, flags)
Jeff Layton860a0d92014-10-28 14:24:12 -0400521 ),
522
523 TP_fast_assign(
524 __entry->addr = (struct sockaddr *)&rqst->rq_addr;
525 __entry->xid = rqst->rq_xid;
Jeff Layton860a0d92014-10-28 14:24:12 -0400526 __entry->status = status;
Jeff Layton4d152e22014-11-19 07:51:14 -0500527 __entry->flags = rqst->rq_flags;
Jeff Layton860a0d92014-10-28 14:24:12 -0400528 ),
529
Jeff Layton78b65eb2014-11-19 07:51:17 -0500530 TP_printk("addr=%pIScp rq_xid=0x%x status=%d flags=%s",
531 __entry->addr, be32_to_cpu(__entry->xid),
Jeff Layton4d152e22014-11-19 07:51:14 -0500532 __entry->status, show_rqstp_flags(__entry->flags))
Jeff Layton860a0d92014-10-28 14:24:12 -0400533);
534
535DEFINE_EVENT(svc_rqst_status, svc_process,
536 TP_PROTO(struct svc_rqst *rqst, int status),
537 TP_ARGS(rqst, status));
538
539DEFINE_EVENT(svc_rqst_status, svc_send,
540 TP_PROTO(struct svc_rqst *rqst, int status),
541 TP_ARGS(rqst, status));
542
Jeff Layton83a712e2014-11-21 14:19:31 -0500543#define show_svc_xprt_flags(flags) \
544 __print_flags(flags, "|", \
545 { (1UL << XPT_BUSY), "XPT_BUSY"}, \
546 { (1UL << XPT_CONN), "XPT_CONN"}, \
547 { (1UL << XPT_CLOSE), "XPT_CLOSE"}, \
548 { (1UL << XPT_DATA), "XPT_DATA"}, \
549 { (1UL << XPT_TEMP), "XPT_TEMP"}, \
550 { (1UL << XPT_DEAD), "XPT_DEAD"}, \
551 { (1UL << XPT_CHNGBUF), "XPT_CHNGBUF"}, \
552 { (1UL << XPT_DEFERRED), "XPT_DEFERRED"}, \
553 { (1UL << XPT_OLD), "XPT_OLD"}, \
554 { (1UL << XPT_LISTENER), "XPT_LISTENER"}, \
555 { (1UL << XPT_CACHE_AUTH), "XPT_CACHE_AUTH"}, \
556 { (1UL << XPT_LOCAL), "XPT_LOCAL"})
557
558TRACE_EVENT(svc_xprt_do_enqueue,
559 TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),
560
561 TP_ARGS(xprt, rqst),
562
563 TP_STRUCT__entry(
564 __field(struct svc_xprt *, xprt)
Pratyush Anand051ac382015-08-27 10:01:33 +0530565 __field(int, pid)
566 __field(unsigned long, flags)
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400567 __dynamic_array(unsigned char, addr, xprt != NULL ?
568 xprt->xpt_remotelen : 0)
Jeff Layton83a712e2014-11-21 14:19:31 -0500569 ),
570
571 TP_fast_assign(
572 __entry->xprt = xprt;
Pratyush Anand051ac382015-08-27 10:01:33 +0530573 __entry->pid = rqst? rqst->rq_task->pid : 0;
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400574 if (xprt) {
575 memcpy(__get_dynamic_array(addr),
576 &xprt->xpt_remote,
577 xprt->xpt_remotelen);
578 __entry->flags = xprt->xpt_flags;
579 } else
580 __entry->flags = 0;
Jeff Layton83a712e2014-11-21 14:19:31 -0500581 ),
582
583 TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400584 __get_dynamic_array_len(addr) != 0 ?
585 (struct sockaddr *)__get_dynamic_array(addr) : NULL,
Pratyush Anand051ac382015-08-27 10:01:33 +0530586 __entry->pid, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -0500587);
588
Trond Myklebust82ea2d72016-06-24 10:55:45 -0400589DECLARE_EVENT_CLASS(svc_xprt_event,
Jeff Layton83a712e2014-11-21 14:19:31 -0500590 TP_PROTO(struct svc_xprt *xprt),
591
592 TP_ARGS(xprt),
593
594 TP_STRUCT__entry(
595 __field(struct svc_xprt *, xprt)
Jeff Layton83a712e2014-11-21 14:19:31 -0500596 __field(unsigned long, flags)
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400597 __dynamic_array(unsigned char, addr, xprt != NULL ?
598 xprt->xpt_remotelen : 0)
Jeff Layton83a712e2014-11-21 14:19:31 -0500599 ),
600
601 TP_fast_assign(
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400602 __entry->xprt = xprt;
603 if (xprt) {
604 memcpy(__get_dynamic_array(addr),
605 &xprt->xpt_remote,
606 xprt->xpt_remotelen);
607 __entry->flags = xprt->xpt_flags;
608 } else
609 __entry->flags = 0;
Jeff Layton83a712e2014-11-21 14:19:31 -0500610 ),
611
612 TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt,
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400613 __get_dynamic_array_len(addr) != 0 ?
614 (struct sockaddr *)__get_dynamic_array(addr) : NULL,
Jeff Layton83a712e2014-11-21 14:19:31 -0500615 show_svc_xprt_flags(__entry->flags))
616);
617
Trond Myklebust82ea2d72016-06-24 10:55:45 -0400618DEFINE_EVENT(svc_xprt_event, svc_xprt_dequeue,
619 TP_PROTO(struct svc_xprt *xprt),
620 TP_ARGS(xprt));
621
622DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
623 TP_PROTO(struct svc_xprt *xprt),
624 TP_ARGS(xprt));
625
Jeff Layton83a712e2014-11-21 14:19:31 -0500626TRACE_EVENT(svc_wake_up,
627 TP_PROTO(int pid),
628
629 TP_ARGS(pid),
630
631 TP_STRUCT__entry(
632 __field(int, pid)
633 ),
634
635 TP_fast_assign(
636 __entry->pid = pid;
637 ),
638
639 TP_printk("pid=%d", __entry->pid)
640);
641
642TRACE_EVENT(svc_handle_xprt,
643 TP_PROTO(struct svc_xprt *xprt, int len),
644
645 TP_ARGS(xprt, len),
646
647 TP_STRUCT__entry(
648 __field(struct svc_xprt *, xprt)
649 __field(int, len)
Pratyush Anand051ac382015-08-27 10:01:33 +0530650 __field(unsigned long, flags)
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400651 __dynamic_array(unsigned char, addr, xprt != NULL ?
652 xprt->xpt_remotelen : 0)
Jeff Layton83a712e2014-11-21 14:19:31 -0500653 ),
654
655 TP_fast_assign(
656 __entry->xprt = xprt;
657 __entry->len = len;
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400658 if (xprt) {
659 memcpy(__get_dynamic_array(addr),
660 &xprt->xpt_remote,
661 xprt->xpt_remotelen);
662 __entry->flags = xprt->xpt_flags;
663 } else
664 __entry->flags = 0;
Jeff Layton83a712e2014-11-21 14:19:31 -0500665 ),
666
667 TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
Trond Myklebustdb1bb442016-06-24 10:55:44 -0400668 __get_dynamic_array_len(addr) != 0 ?
669 (struct sockaddr *)__get_dynamic_array(addr) : NULL,
Pratyush Anand051ac382015-08-27 10:01:33 +0530670 __entry->len, show_svc_xprt_flags(__entry->flags))
Jeff Layton83a712e2014-11-21 14:19:31 -0500671);
Trond Myklebust104f6352016-06-24 10:55:46 -0400672
673
674DECLARE_EVENT_CLASS(svc_deferred_event,
675 TP_PROTO(struct svc_deferred_req *dr),
676
677 TP_ARGS(dr),
678
679 TP_STRUCT__entry(
680 __field(__be32, xid)
681 __dynamic_array(unsigned char, addr, dr->addrlen)
682 ),
683
684 TP_fast_assign(
685 __entry->xid = *(__be32 *)(dr->args + (dr->xprt_hlen>>2));
686 memcpy(__get_dynamic_array(addr), &dr->addr, dr->addrlen);
687 ),
688
689 TP_printk("addr=%pIScp xid=0x%x",
690 (struct sockaddr *)__get_dynamic_array(addr),
691 be32_to_cpu(__entry->xid))
692);
693
694DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
695 TP_PROTO(struct svc_deferred_req *dr),
696 TP_ARGS(dr));
697DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
698 TP_PROTO(struct svc_deferred_req *dr),
699 TP_ARGS(dr));
Trond Myklebust82b0a4c2012-01-20 14:52:23 -0500700#endif /* _TRACE_SUNRPC_H */
701
702#include <trace/define_trace.h>