2 #define TRACE_SYSTEM sunrpc
4 #if !defined(_TRACE_SUNRPC_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_SUNRPC_H
7 #include <linux/sunrpc/sched.h>
8 #include <linux/sunrpc/clnt.h>
9 #include <linux/sunrpc/svc.h>
10 #include <net/tcp_states.h>
11 #include <linux/net.h>
12 #include <linux/tracepoint.h>
14 DECLARE_EVENT_CLASS(rpc_task_status
,
16 TP_PROTO(struct rpc_task
*task
),
21 __field(unsigned int, task_id
)
22 __field(unsigned int, client_id
)
27 __entry
->task_id
= task
->tk_pid
;
28 __entry
->client_id
= task
->tk_client
->cl_clid
;
29 __entry
->status
= task
->tk_status
;
32 TP_printk("task:%u@%u, status %d",
33 __entry
->task_id
, __entry
->client_id
,
37 DEFINE_EVENT(rpc_task_status
, rpc_call_status
,
38 TP_PROTO(struct rpc_task
*task
),
43 DEFINE_EVENT(rpc_task_status
, rpc_bind_status
,
44 TP_PROTO(struct rpc_task
*task
),
49 TRACE_EVENT(rpc_connect_status
,
50 TP_PROTO(struct rpc_task
*task
, int status
),
52 TP_ARGS(task
, status
),
55 __field(unsigned int, task_id
)
56 __field(unsigned int, client_id
)
61 __entry
->task_id
= task
->tk_pid
;
62 __entry
->client_id
= task
->tk_client
->cl_clid
;
63 __entry
->status
= status
;
66 TP_printk("task:%u@%u, status %d",
67 __entry
->task_id
, __entry
->client_id
,
71 DECLARE_EVENT_CLASS(rpc_task_running
,
73 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
75 TP_ARGS(clnt
, task
, action
),
78 __field(unsigned int, task_id
)
79 __field(unsigned int, client_id
)
80 __field(const void *, action
)
81 __field(unsigned long, runstate
)
83 __field(unsigned short, flags
)
87 __entry
->client_id
= clnt
? clnt
->cl_clid
: -1;
88 __entry
->task_id
= task
->tk_pid
;
89 __entry
->action
= action
;
90 __entry
->runstate
= task
->tk_runstate
;
91 __entry
->status
= task
->tk_status
;
92 __entry
->flags
= task
->tk_flags
;
95 TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
96 __entry
->task_id
, __entry
->client_id
,
104 DEFINE_EVENT(rpc_task_running
, rpc_task_begin
,
106 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
108 TP_ARGS(clnt
, task
, action
)
112 DEFINE_EVENT(rpc_task_running
, rpc_task_run_action
,
114 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
116 TP_ARGS(clnt
, task
, action
)
120 DEFINE_EVENT(rpc_task_running
, rpc_task_complete
,
122 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
124 TP_ARGS(clnt
, task
, action
)
128 DECLARE_EVENT_CLASS(rpc_task_queued
,
130 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
132 TP_ARGS(clnt
, task
, q
),
135 __field(unsigned int, task_id
)
136 __field(unsigned int, client_id
)
137 __field(unsigned long, timeout
)
138 __field(unsigned long, runstate
)
140 __field(unsigned short, flags
)
141 __string(q_name
, rpc_qname(q
))
145 __entry
->client_id
= clnt
->cl_clid
;
146 __entry
->task_id
= task
->tk_pid
;
147 __entry
->timeout
= task
->tk_timeout
;
148 __entry
->runstate
= task
->tk_runstate
;
149 __entry
->status
= task
->tk_status
;
150 __entry
->flags
= task
->tk_flags
;
151 __assign_str(q_name
, rpc_qname(q
));
154 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
155 __entry
->task_id
, __entry
->client_id
,
164 DEFINE_EVENT(rpc_task_queued
, rpc_task_sleep
,
166 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
168 TP_ARGS(clnt
, task
, q
)
172 DEFINE_EVENT(rpc_task_queued
, rpc_task_wakeup
,
174 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
176 TP_ARGS(clnt
, task
, q
)
180 #define rpc_show_socket_state(state) \
181 __print_symbolic(state, \
182 { SS_FREE, "FREE" }, \
183 { SS_UNCONNECTED, "UNCONNECTED" }, \
184 { SS_CONNECTING, "CONNECTING," }, \
185 { SS_CONNECTED, "CONNECTED," }, \
186 { SS_DISCONNECTING, "DISCONNECTING" })
188 #define rpc_show_sock_state(state) \
189 __print_symbolic(state, \
190 { TCP_ESTABLISHED, "ESTABLISHED" }, \
191 { TCP_SYN_SENT, "SYN_SENT" }, \
192 { TCP_SYN_RECV, "SYN_RECV" }, \
193 { TCP_FIN_WAIT1, "FIN_WAIT1" }, \
194 { TCP_FIN_WAIT2, "FIN_WAIT2" }, \
195 { TCP_TIME_WAIT, "TIME_WAIT" }, \
196 { TCP_CLOSE, "CLOSE" }, \
197 { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \
198 { TCP_LAST_ACK, "LAST_ACK" }, \
199 { TCP_LISTEN, "LISTEN" }, \
200 { TCP_CLOSING, "CLOSING" })
202 DECLARE_EVENT_CLASS(xs_socket_event
,
205 struct rpc_xprt
*xprt
,
206 struct socket
*socket
209 TP_ARGS(xprt
, socket
),
212 __field(unsigned int, socket_state
)
213 __field(unsigned int, sock_state
)
214 __field(unsigned long long, ino
)
216 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
218 xprt
->address_strings
[RPC_DISPLAY_PORT
])
222 struct inode
*inode
= SOCK_INODE(socket
);
223 __entry
->socket_state
= socket
->state
;
224 __entry
->sock_state
= socket
->sk
->sk_state
;
225 __entry
->ino
= (unsigned long long)inode
->i_ino
;
226 __assign_str(dstaddr
,
227 xprt
->address_strings
[RPC_DISPLAY_ADDR
]);
228 __assign_str(dstport
,
229 xprt
->address_strings
[RPC_DISPLAY_PORT
]);
233 "socket:[%llu] dstaddr=%s/%s "
234 "state=%u (%s) sk_state=%u (%s)",
235 __entry
->ino
, __get_str(dstaddr
), __get_str(dstport
),
236 __entry
->socket_state
,
237 rpc_show_socket_state(__entry
->socket_state
),
239 rpc_show_sock_state(__entry
->sock_state
)
242 #define DEFINE_RPC_SOCKET_EVENT(name) \
243 DEFINE_EVENT(xs_socket_event, name, \
245 struct rpc_xprt *xprt, \
246 struct socket *socket \
248 TP_ARGS(xprt, socket))
250 DECLARE_EVENT_CLASS(xs_socket_event_done
,
253 struct rpc_xprt
*xprt
,
254 struct socket
*socket
,
258 TP_ARGS(xprt
, socket
, error
),
262 __field(unsigned int, socket_state
)
263 __field(unsigned int, sock_state
)
264 __field(unsigned long long, ino
)
266 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
268 xprt
->address_strings
[RPC_DISPLAY_PORT
])
272 struct inode
*inode
= SOCK_INODE(socket
);
273 __entry
->socket_state
= socket
->state
;
274 __entry
->sock_state
= socket
->sk
->sk_state
;
275 __entry
->ino
= (unsigned long long)inode
->i_ino
;
276 __entry
->error
= error
;
277 __assign_str(dstaddr
,
278 xprt
->address_strings
[RPC_DISPLAY_ADDR
]);
279 __assign_str(dstport
,
280 xprt
->address_strings
[RPC_DISPLAY_PORT
]);
284 "error=%d socket:[%llu] dstaddr=%s/%s "
285 "state=%u (%s) sk_state=%u (%s)",
287 __entry
->ino
, __get_str(dstaddr
), __get_str(dstport
),
288 __entry
->socket_state
,
289 rpc_show_socket_state(__entry
->socket_state
),
291 rpc_show_sock_state(__entry
->sock_state
)
294 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
295 DEFINE_EVENT(xs_socket_event_done, name, \
297 struct rpc_xprt *xprt, \
298 struct socket *socket, \
301 TP_ARGS(xprt, socket, error))
303 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change
);
304 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect
);
305 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_error
);
306 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection
);
307 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close
);
308 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown
);
310 TRACE_EVENT(svc_recv
,
311 TP_PROTO(struct svc_rqst
*rqst
, int status
),
313 TP_ARGS(rqst
, status
),
316 __field(struct sockaddr
*, addr
)
322 __entry
->addr
= (struct sockaddr
*)&rqst
->rq_addr
;
323 __entry
->xid
= status
> 0 ? rqst
->rq_xid
: 0;
324 __entry
->status
= status
;
327 TP_printk("addr=%pIScp xid=0x%x status=%d", __entry
->addr
,
328 be32_to_cpu(__entry
->xid
), __entry
->status
)
331 DECLARE_EVENT_CLASS(svc_rqst_status
,
333 TP_PROTO(struct svc_rqst
*rqst
, int status
),
335 TP_ARGS(rqst
, status
),
338 __field(struct sockaddr
*, addr
)
345 __entry
->addr
= (struct sockaddr
*)&rqst
->rq_addr
;
346 __entry
->xid
= rqst
->rq_xid
;
347 __entry
->dropme
= (int)rqst
->rq_dropme
;
348 __entry
->status
= status
;
351 TP_printk("addr=%pIScp rq_xid=0x%x dropme=%d status=%d",
352 __entry
->addr
, be32_to_cpu(__entry
->xid
), __entry
->dropme
,
356 DEFINE_EVENT(svc_rqst_status
, svc_process
,
357 TP_PROTO(struct svc_rqst
*rqst
, int status
),
358 TP_ARGS(rqst
, status
));
360 DEFINE_EVENT(svc_rqst_status
, svc_send
,
361 TP_PROTO(struct svc_rqst
*rqst
, int status
),
362 TP_ARGS(rqst
, status
));
364 #endif /* _TRACE_SUNRPC_H */
366 #include <trace/define_trace.h>