sunrpc.h 18.1 KB
Newer Older
1 2 3 4 5 6 7 8
#undef TRACE_SYSTEM
#define TRACE_SYSTEM sunrpc

#if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SUNRPC_H

#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/clnt.h>
9
#include <linux/sunrpc/svc.h>
10
#include <linux/sunrpc/xprtsock.h>
11
#include <linux/sunrpc/svc_xprt.h>
12 13
#include <net/tcp_states.h>
#include <linux/net.h>
14 15
#include <linux/tracepoint.h>

16 17 18 19 20 21 22
DECLARE_EVENT_CLASS(rpc_task_status,

	TP_PROTO(struct rpc_task *task),

	TP_ARGS(task),

	TP_STRUCT__entry(
23 24
		__field(unsigned int, task_id)
		__field(unsigned int, client_id)
25 26 27 28
		__field(int, status)
	),

	TP_fast_assign(
29 30
		__entry->task_id = task->tk_pid;
		__entry->client_id = task->tk_client->cl_clid;
31 32 33
		__entry->status = task->tk_status;
	),

34 35 36
	TP_printk("task:%u@%u, status %d",
		__entry->task_id, __entry->client_id,
		__entry->status)
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
);

DEFINE_EVENT(rpc_task_status, rpc_call_status,
	TP_PROTO(struct rpc_task *task),

	TP_ARGS(task)
);

DEFINE_EVENT(rpc_task_status, rpc_bind_status,
	TP_PROTO(struct rpc_task *task),

	TP_ARGS(task)
);

TRACE_EVENT(rpc_connect_status,
	TP_PROTO(struct rpc_task *task, int status),

	TP_ARGS(task, status),

	TP_STRUCT__entry(
57 58
		__field(unsigned int, task_id)
		__field(unsigned int, client_id)
59 60 61 62
		__field(int, status)
	),

	TP_fast_assign(
63 64
		__entry->task_id = task->tk_pid;
		__entry->client_id = task->tk_client->cl_clid;
65 66 67
		__entry->status = status;
	),

68 69 70
	TP_printk("task:%u@%u, status %d",
		__entry->task_id, __entry->client_id,
		__entry->status)
71 72
);

73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
TRACE_EVENT(rpc_request,
	TP_PROTO(const struct rpc_task *task),

	TP_ARGS(task),

	TP_STRUCT__entry(
		__field(unsigned int, task_id)
		__field(unsigned int, client_id)
		__field(int, version)
		__field(bool, async)
		__string(progname, task->tk_client->cl_program->name)
		__string(procname, rpc_proc_name(task))
	),

	TP_fast_assign(
		__entry->task_id = task->tk_pid;
		__entry->client_id = task->tk_client->cl_clid;
		__entry->version = task->tk_client->cl_vers;
		__entry->async = RPC_IS_ASYNC(task);
		__assign_str(progname, task->tk_client->cl_program->name)
		__assign_str(procname, rpc_proc_name(task))
	),

	TP_printk("task:%u@%u %sv%d %s (%ssync)",
		__entry->task_id, __entry->client_id,
		__get_str(progname), __entry->version,
		__get_str(procname), __entry->async ? "a": ""
		)
);

103 104 105 106 107 108 109
DECLARE_EVENT_CLASS(rpc_task_running,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),

	TP_ARGS(clnt, task, action),

	TP_STRUCT__entry(
110 111
		__field(unsigned int, task_id)
		__field(unsigned int, client_id)
112 113 114 115 116 117 118
		__field(const void *, action)
		__field(unsigned long, runstate)
		__field(int, status)
		__field(unsigned short, flags)
		),

	TP_fast_assign(
119
		__entry->client_id = clnt ? clnt->cl_clid : -1;
120
		__entry->task_id = task->tk_pid;
121 122 123 124 125 126
		__entry->action = action;
		__entry->runstate = task->tk_runstate;
		__entry->status = task->tk_status;
		__entry->flags = task->tk_flags;
		),

127
	TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
128
		__entry->task_id, __entry->client_id,
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
		__entry->flags,
		__entry->runstate,
		__entry->status,
		__entry->action
		)
);

DEFINE_EVENT(rpc_task_running, rpc_task_begin,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),

	TP_ARGS(clnt, task, action)

);

DEFINE_EVENT(rpc_task_running, rpc_task_run_action,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),

	TP_ARGS(clnt, task, action)

);

DEFINE_EVENT(rpc_task_running, rpc_task_complete,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),

	TP_ARGS(clnt, task, action)

);

DECLARE_EVENT_CLASS(rpc_task_queued,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),

	TP_ARGS(clnt, task, q),

	TP_STRUCT__entry(
167 168
		__field(unsigned int, task_id)
		__field(unsigned int, client_id)
169 170 171 172
		__field(unsigned long, timeout)
		__field(unsigned long, runstate)
		__field(int, status)
		__field(unsigned short, flags)
173
		__string(q_name, rpc_qname(q))
174 175 176
		),

	TP_fast_assign(
177 178
		__entry->client_id = clnt->cl_clid;
		__entry->task_id = task->tk_pid;
179 180 181 182
		__entry->timeout = task->tk_timeout;
		__entry->runstate = task->tk_runstate;
		__entry->status = task->tk_status;
		__entry->flags = task->tk_flags;
183
		__assign_str(q_name, rpc_qname(q));
184 185
		),

186 187
	TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
		__entry->task_id, __entry->client_id,
188 189 190 191
		__entry->flags,
		__entry->runstate,
		__entry->status,
		__entry->timeout,
192
		__get_str(q_name)
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
		)
);

DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),

	TP_ARGS(clnt, task, q)

);

DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,

	TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),

	TP_ARGS(clnt, task, q)

);

212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
/*
 * First define the enums in the below macros to be exported to userspace
 * via TRACE_DEFINE_ENUM().
 */
#undef EM
#undef EMe
#define EM(a, b)	TRACE_DEFINE_ENUM(a);
#define EMe(a, b)	TRACE_DEFINE_ENUM(a);

#define RPC_SHOW_SOCKET				\
	EM( SS_FREE, "FREE" )			\
	EM( SS_UNCONNECTED, "UNCONNECTED" )	\
	EM( SS_CONNECTING, "CONNECTING," )	\
	EM( SS_CONNECTED, "CONNECTED," )	\
	EMe(SS_DISCONNECTING, "DISCONNECTING" )

228
#define rpc_show_socket_state(state) \
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244
	__print_symbolic(state, RPC_SHOW_SOCKET)

RPC_SHOW_SOCKET

#define RPC_SHOW_SOCK				\
	EM( TCP_ESTABLISHED, "ESTABLISHED" )	\
	EM( TCP_SYN_SENT, "SYN_SENT" )		\
	EM( TCP_SYN_RECV, "SYN_RECV" )		\
	EM( TCP_FIN_WAIT1, "FIN_WAIT1" )	\
	EM( TCP_FIN_WAIT2, "FIN_WAIT2" )	\
	EM( TCP_TIME_WAIT, "TIME_WAIT" )	\
	EM( TCP_CLOSE, "CLOSE" )		\
	EM( TCP_CLOSE_WAIT, "CLOSE_WAIT" )	\
	EM( TCP_LAST_ACK, "LAST_ACK" )		\
	EM( TCP_LISTEN, "LISTEN" )		\
	EMe( TCP_CLOSING, "CLOSING" )
245 246

#define rpc_show_sock_state(state) \
247 248 249 250 251 252 253 254 255 256 257 258
	__print_symbolic(state, RPC_SHOW_SOCK)

RPC_SHOW_SOCK

/*
 * Now redefine the EM() and EMe() macros to map the enums to the strings
 * that will be printed in the output.
 */
#undef EM
#undef EMe
#define EM(a, b)	{a, b},
#define EMe(a, b)	{a, b}
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362

DECLARE_EVENT_CLASS(xs_socket_event,

		TP_PROTO(
			struct rpc_xprt *xprt,
			struct socket *socket
		),

		TP_ARGS(xprt, socket),

		TP_STRUCT__entry(
			__field(unsigned int, socket_state)
			__field(unsigned int, sock_state)
			__field(unsigned long long, ino)
			__string(dstaddr,
				xprt->address_strings[RPC_DISPLAY_ADDR])
			__string(dstport,
				xprt->address_strings[RPC_DISPLAY_PORT])
		),

		TP_fast_assign(
			struct inode *inode = SOCK_INODE(socket);
			__entry->socket_state = socket->state;
			__entry->sock_state = socket->sk->sk_state;
			__entry->ino = (unsigned long long)inode->i_ino;
			__assign_str(dstaddr,
				xprt->address_strings[RPC_DISPLAY_ADDR]);
			__assign_str(dstport,
				xprt->address_strings[RPC_DISPLAY_PORT]);
		),

		TP_printk(
			"socket:[%llu] dstaddr=%s/%s "
			"state=%u (%s) sk_state=%u (%s)",
			__entry->ino, __get_str(dstaddr), __get_str(dstport),
			__entry->socket_state,
			rpc_show_socket_state(__entry->socket_state),
			__entry->sock_state,
			rpc_show_sock_state(__entry->sock_state)
		)
);
#define DEFINE_RPC_SOCKET_EVENT(name) \
	DEFINE_EVENT(xs_socket_event, name, \
			TP_PROTO( \
				struct rpc_xprt *xprt, \
				struct socket *socket \
			), \
			TP_ARGS(xprt, socket))

DECLARE_EVENT_CLASS(xs_socket_event_done,

		TP_PROTO(
			struct rpc_xprt *xprt,
			struct socket *socket,
			int error
		),

		TP_ARGS(xprt, socket, error),

		TP_STRUCT__entry(
			__field(int, error)
			__field(unsigned int, socket_state)
			__field(unsigned int, sock_state)
			__field(unsigned long long, ino)
			__string(dstaddr,
				xprt->address_strings[RPC_DISPLAY_ADDR])
			__string(dstport,
				xprt->address_strings[RPC_DISPLAY_PORT])
		),

		TP_fast_assign(
			struct inode *inode = SOCK_INODE(socket);
			__entry->socket_state = socket->state;
			__entry->sock_state = socket->sk->sk_state;
			__entry->ino = (unsigned long long)inode->i_ino;
			__entry->error = error;
			__assign_str(dstaddr,
				xprt->address_strings[RPC_DISPLAY_ADDR]);
			__assign_str(dstport,
				xprt->address_strings[RPC_DISPLAY_PORT]);
		),

		TP_printk(
			"error=%d socket:[%llu] dstaddr=%s/%s "
			"state=%u (%s) sk_state=%u (%s)",
			__entry->error,
			__entry->ino, __get_str(dstaddr), __get_str(dstport),
			__entry->socket_state,
			rpc_show_socket_state(__entry->socket_state),
			__entry->sock_state,
			rpc_show_sock_state(__entry->sock_state)
		)
);
#define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
	DEFINE_EVENT(xs_socket_event_done, name, \
			TP_PROTO( \
				struct rpc_xprt *xprt, \
				struct socket *socket, \
				int error \
			), \
			TP_ARGS(xprt, socket, error))

DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
363
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error);
364 365 366 367
DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);

368 369 370 371 372 373
DECLARE_EVENT_CLASS(rpc_xprt_event,
	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),

	TP_ARGS(xprt, xid, status),

	TP_STRUCT__entry(
374
		__field(u32, xid)
375 376 377 378 379 380
		__field(int, status)
		__string(addr, xprt->address_strings[RPC_DISPLAY_ADDR])
		__string(port, xprt->address_strings[RPC_DISPLAY_PORT])
	),

	TP_fast_assign(
381
		__entry->xid = be32_to_cpu(xid);
382 383 384 385 386
		__entry->status = status;
		__assign_str(addr, xprt->address_strings[RPC_DISPLAY_ADDR]);
		__assign_str(port, xprt->address_strings[RPC_DISPLAY_PORT]);
	),

387 388
	TP_printk("peer=[%s]:%s xid=0x%08x status=%d", __get_str(addr),
			__get_str(port), __entry->xid,
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
			__entry->status)
);

DEFINE_EVENT(rpc_xprt_event, xprt_lookup_rqst,
	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
	TP_ARGS(xprt, xid, status));

DEFINE_EVENT(rpc_xprt_event, xprt_transmit,
	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
	TP_ARGS(xprt, xid, status));

DEFINE_EVENT(rpc_xprt_event, xprt_complete_rqst,
	TP_PROTO(struct rpc_xprt *xprt, __be32 xid, int status),
	TP_ARGS(xprt, xid, status));

TRACE_EVENT(xs_tcp_data_ready,
	TP_PROTO(struct rpc_xprt *xprt, int err, unsigned int total),

	TP_ARGS(xprt, err, total),

	TP_STRUCT__entry(
		__field(int, err)
		__field(unsigned int, total)
		__string(addr, xprt ? xprt->address_strings[RPC_DISPLAY_ADDR] :
				"(null)")
		__string(port, xprt ? xprt->address_strings[RPC_DISPLAY_PORT] :
				"(null)")
	),

	TP_fast_assign(
		__entry->err = err;
		__entry->total = total;
		__assign_str(addr, xprt ?
			xprt->address_strings[RPC_DISPLAY_ADDR] : "(null)");
		__assign_str(port, xprt ?
			xprt->address_strings[RPC_DISPLAY_PORT] : "(null)");
	),

	TP_printk("peer=[%s]:%s err=%d total=%u", __get_str(addr),
			__get_str(port), __entry->err, __entry->total)
);

431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
#define rpc_show_sock_xprt_flags(flags) \
	__print_flags(flags, "|", \
		{ TCP_RCV_LAST_FRAG, "TCP_RCV_LAST_FRAG" }, \
		{ TCP_RCV_COPY_FRAGHDR, "TCP_RCV_COPY_FRAGHDR" }, \
		{ TCP_RCV_COPY_XID, "TCP_RCV_COPY_XID" }, \
		{ TCP_RCV_COPY_DATA, "TCP_RCV_COPY_DATA" }, \
		{ TCP_RCV_READ_CALLDIR, "TCP_RCV_READ_CALLDIR" }, \
		{ TCP_RCV_COPY_CALLDIR, "TCP_RCV_COPY_CALLDIR" }, \
		{ TCP_RPC_REPLY, "TCP_RPC_REPLY" })

TRACE_EVENT(xs_tcp_data_recv,
	TP_PROTO(struct sock_xprt *xs),

	TP_ARGS(xs),

	TP_STRUCT__entry(
		__string(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR])
		__string(port, xs->xprt.address_strings[RPC_DISPLAY_PORT])
449
		__field(u32, xid)
450 451 452 453 454 455 456 457 458
		__field(unsigned long, flags)
		__field(unsigned long, copied)
		__field(unsigned int, reclen)
		__field(unsigned long, offset)
	),

	TP_fast_assign(
		__assign_str(addr, xs->xprt.address_strings[RPC_DISPLAY_ADDR]);
		__assign_str(port, xs->xprt.address_strings[RPC_DISPLAY_PORT]);
459
		__entry->xid = be32_to_cpu(xs->tcp_xid);
460 461 462 463 464 465
		__entry->flags = xs->tcp_flags;
		__entry->copied = xs->tcp_copied;
		__entry->reclen = xs->tcp_reclen;
		__entry->offset = xs->tcp_offset;
	),

466 467
	TP_printk("peer=[%s]:%s xid=0x%08x flags=%s copied=%lu reclen=%u offset=%lu",
			__get_str(addr), __get_str(port), __entry->xid,
468 469 470 471
			rpc_show_sock_xprt_flags(__entry->flags),
			__entry->copied, __entry->reclen, __entry->offset)
);

472 473 474 475
#define show_rqstp_flags(flags)						\
	__print_flags(flags, "|",					\
		{ (1UL << RQ_SECURE),		"RQ_SECURE"},		\
		{ (1UL << RQ_LOCAL),		"RQ_LOCAL"},		\
476
		{ (1UL << RQ_USEDEFERRAL),	"RQ_USEDEFERRAL"},	\
477
		{ (1UL << RQ_DROPME),		"RQ_DROPME"},		\
478
		{ (1UL << RQ_SPLICE_OK),	"RQ_SPLICE_OK"},	\
479 480
		{ (1UL << RQ_VICTIM),		"RQ_VICTIM"},		\
		{ (1UL << RQ_BUSY),		"RQ_BUSY"})
481

482 483 484 485 486 487 488
TRACE_EVENT(svc_recv,
	TP_PROTO(struct svc_rqst *rqst, int status),

	TP_ARGS(rqst, status),

	TP_STRUCT__entry(
		__field(struct sockaddr *, addr)
489
		__field(u32, xid)
490
		__field(int, status)
491
		__field(unsigned long, flags)
492 493 494 495
	),

	TP_fast_assign(
		__entry->addr = (struct sockaddr *)&rqst->rq_addr;
496
		__entry->xid = status > 0 ? be32_to_cpu(rqst->rq_xid) : 0;
497
		__entry->status = status;
498
		__entry->flags = rqst->rq_flags;
499 500
	),

501 502
	TP_printk("addr=%pIScp xid=0x%08x status=%d flags=%s", __entry->addr,
			__entry->xid, __entry->status,
503
			show_rqstp_flags(__entry->flags))
504 505
);

506 507 508 509 510 511 512
DECLARE_EVENT_CLASS(svc_rqst_event,

	TP_PROTO(struct svc_rqst *rqst),

	TP_ARGS(rqst),

	TP_STRUCT__entry(
513
		__field(u32, xid)
514 515 516 517 518
		__field(unsigned long, flags)
		__dynamic_array(unsigned char, addr, rqst->rq_addrlen)
	),

	TP_fast_assign(
519
		__entry->xid = be32_to_cpu(rqst->rq_xid);
520 521 522 523 524
		__entry->flags = rqst->rq_flags;
		memcpy(__get_dynamic_array(addr),
			&rqst->rq_addr, rqst->rq_addrlen);
	),

525
	TP_printk("addr=%pIScp rq_xid=0x%08x flags=%s",
526
		(struct sockaddr *)__get_dynamic_array(addr),
527
		__entry->xid,
528 529 530 531 532 533 534 535 536 537 538
		show_rqstp_flags(__entry->flags))
);

DEFINE_EVENT(svc_rqst_event, svc_defer,
	TP_PROTO(struct svc_rqst *rqst),
	TP_ARGS(rqst));

DEFINE_EVENT(svc_rqst_event, svc_drop,
	TP_PROTO(struct svc_rqst *rqst),
	TP_ARGS(rqst));

539 540 541 542 543 544 545 546
DECLARE_EVENT_CLASS(svc_rqst_status,

	TP_PROTO(struct svc_rqst *rqst, int status),

	TP_ARGS(rqst, status),

	TP_STRUCT__entry(
		__field(struct sockaddr *, addr)
547
		__field(u32, xid)
548 549
		__field(int, dropme)
		__field(int, status)
550
		__field(unsigned long, flags)
551 552 553 554
	),

	TP_fast_assign(
		__entry->addr = (struct sockaddr *)&rqst->rq_addr;
555
		__entry->xid = be32_to_cpu(rqst->rq_xid);
556
		__entry->status = status;
557
		__entry->flags = rqst->rq_flags;
558 559
	),

560 561
	TP_printk("addr=%pIScp rq_xid=0x%08x status=%d flags=%s",
		__entry->addr, __entry->xid,
562
		__entry->status, show_rqstp_flags(__entry->flags))
563 564 565 566 567 568 569 570 571 572
);

DEFINE_EVENT(svc_rqst_status, svc_process,
	TP_PROTO(struct svc_rqst *rqst, int status),
	TP_ARGS(rqst, status));

DEFINE_EVENT(svc_rqst_status, svc_send,
	TP_PROTO(struct svc_rqst *rqst, int status),
	TP_ARGS(rqst, status));

573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
#define show_svc_xprt_flags(flags)					\
	__print_flags(flags, "|",					\
		{ (1UL << XPT_BUSY),		"XPT_BUSY"},		\
		{ (1UL << XPT_CONN),		"XPT_CONN"},		\
		{ (1UL << XPT_CLOSE),		"XPT_CLOSE"},		\
		{ (1UL << XPT_DATA),		"XPT_DATA"},		\
		{ (1UL << XPT_TEMP),		"XPT_TEMP"},		\
		{ (1UL << XPT_DEAD),		"XPT_DEAD"},		\
		{ (1UL << XPT_CHNGBUF),		"XPT_CHNGBUF"},		\
		{ (1UL << XPT_DEFERRED),	"XPT_DEFERRED"},	\
		{ (1UL << XPT_OLD),		"XPT_OLD"},		\
		{ (1UL << XPT_LISTENER),	"XPT_LISTENER"},	\
		{ (1UL << XPT_CACHE_AUTH),	"XPT_CACHE_AUTH"},	\
		{ (1UL << XPT_LOCAL),		"XPT_LOCAL"})

TRACE_EVENT(svc_xprt_do_enqueue,
	TP_PROTO(struct svc_xprt *xprt, struct svc_rqst *rqst),

	TP_ARGS(xprt, rqst),

	TP_STRUCT__entry(
		__field(struct svc_xprt *, xprt)
595 596
		__field(int, pid)
		__field(unsigned long, flags)
597 598
		__dynamic_array(unsigned char, addr, xprt != NULL ?
			xprt->xpt_remotelen : 0)
599 600 601 602
	),

	TP_fast_assign(
		__entry->xprt = xprt;
603
		__entry->pid = rqst? rqst->rq_task->pid : 0;
604 605 606 607 608 609 610
		if (xprt) {
			memcpy(__get_dynamic_array(addr),
				&xprt->xpt_remote,
				xprt->xpt_remotelen);
			__entry->flags = xprt->xpt_flags;
		} else
			__entry->flags = 0;
611 612 613
	),

	TP_printk("xprt=0x%p addr=%pIScp pid=%d flags=%s", __entry->xprt,
614 615
		__get_dynamic_array_len(addr) != 0 ?
			(struct sockaddr *)__get_dynamic_array(addr) : NULL,
616
		__entry->pid, show_svc_xprt_flags(__entry->flags))
617 618
);

619
DECLARE_EVENT_CLASS(svc_xprt_event,
620 621 622 623 624 625 626
	TP_PROTO(struct svc_xprt *xprt),

	TP_ARGS(xprt),

	TP_STRUCT__entry(
		__field(struct svc_xprt *, xprt)
		__field(unsigned long, flags)
627 628
		__dynamic_array(unsigned char, addr, xprt != NULL ?
			xprt->xpt_remotelen : 0)
629 630 631
	),

	TP_fast_assign(
632 633 634 635 636 637 638 639
		__entry->xprt = xprt;
		if (xprt) {
			memcpy(__get_dynamic_array(addr),
					&xprt->xpt_remote,
					xprt->xpt_remotelen);
			__entry->flags = xprt->xpt_flags;
		} else
			__entry->flags = 0;
640 641 642
	),

	TP_printk("xprt=0x%p addr=%pIScp flags=%s", __entry->xprt,
643 644
		__get_dynamic_array_len(addr) != 0 ?
			(struct sockaddr *)__get_dynamic_array(addr) : NULL,
645 646 647
		show_svc_xprt_flags(__entry->flags))
);

648 649 650 651 652 653 654 655
DEFINE_EVENT(svc_xprt_event, svc_xprt_dequeue,
	TP_PROTO(struct svc_xprt *xprt),
	TP_ARGS(xprt));

DEFINE_EVENT(svc_xprt_event, svc_xprt_no_write_space,
	TP_PROTO(struct svc_xprt *xprt),
	TP_ARGS(xprt));

656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679
TRACE_EVENT(svc_wake_up,
	TP_PROTO(int pid),

	TP_ARGS(pid),

	TP_STRUCT__entry(
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->pid = pid;
	),

	TP_printk("pid=%d", __entry->pid)
);

TRACE_EVENT(svc_handle_xprt,
	TP_PROTO(struct svc_xprt *xprt, int len),

	TP_ARGS(xprt, len),

	TP_STRUCT__entry(
		__field(struct svc_xprt *, xprt)
		__field(int, len)
680
		__field(unsigned long, flags)
681 682
		__dynamic_array(unsigned char, addr, xprt != NULL ?
			xprt->xpt_remotelen : 0)
683 684 685 686 687
	),

	TP_fast_assign(
		__entry->xprt = xprt;
		__entry->len = len;
688 689 690 691 692 693 694
		if (xprt) {
			memcpy(__get_dynamic_array(addr),
					&xprt->xpt_remote,
					xprt->xpt_remotelen);
			__entry->flags = xprt->xpt_flags;
		} else
			__entry->flags = 0;
695 696 697
	),

	TP_printk("xprt=0x%p addr=%pIScp len=%d flags=%s", __entry->xprt,
698 699
		__get_dynamic_array_len(addr) != 0 ?
			(struct sockaddr *)__get_dynamic_array(addr) : NULL,
700
		__entry->len, show_svc_xprt_flags(__entry->flags))
701
);
702 703 704 705 706 707 708 709


DECLARE_EVENT_CLASS(svc_deferred_event,
	TP_PROTO(struct svc_deferred_req *dr),

	TP_ARGS(dr),

	TP_STRUCT__entry(
710
		__field(u32, xid)
711 712 713 714
		__dynamic_array(unsigned char, addr, dr->addrlen)
	),

	TP_fast_assign(
715 716
		__entry->xid = be32_to_cpu(*(__be32 *)(dr->args +
						       (dr->xprt_hlen>>2)));
717 718 719
		memcpy(__get_dynamic_array(addr), &dr->addr, dr->addrlen);
	),

720
	TP_printk("addr=%pIScp xid=0x%08x",
721
		(struct sockaddr *)__get_dynamic_array(addr),
722
		__entry->xid)
723 724 725 726 727 728 729 730
);

DEFINE_EVENT(svc_deferred_event, svc_drop_deferred,
	TP_PROTO(struct svc_deferred_req *dr),
	TP_ARGS(dr));
DEFINE_EVENT(svc_deferred_event, svc_revisit_deferred,
	TP_PROTO(struct svc_deferred_req *dr),
	TP_ARGS(dr));
731 732 733
#endif /* _TRACE_SUNRPC_H */

#include <trace/define_trace.h>