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 <net/tcp_states.h>
10 #include <linux/net.h>
11 #include <linux/tracepoint.h>
13 DECLARE_EVENT_CLASS(rpc_task_status,
15 TP_PROTO(struct rpc_task *task),
20 __field(const struct rpc_task *, task)
21 __field(const struct rpc_clnt *, clnt)
27 __entry->clnt = task->tk_client;
28 __entry->status = task->tk_status;
31 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
34 DEFINE_EVENT(rpc_task_status, rpc_call_status,
35 TP_PROTO(struct rpc_task *task),
40 DEFINE_EVENT(rpc_task_status, rpc_bind_status,
41 TP_PROTO(struct rpc_task *task),
46 TRACE_EVENT(rpc_connect_status,
47 TP_PROTO(struct rpc_task *task, int status),
49 TP_ARGS(task, status),
52 __field(const struct rpc_task *, task)
53 __field(const struct rpc_clnt *, clnt)
59 __entry->clnt = task->tk_client;
60 __entry->status = status;
63 TP_printk("task:%p@%p, status %d",__entry->task, __entry->clnt, __entry->status)
66 DECLARE_EVENT_CLASS(rpc_task_running,
68 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
70 TP_ARGS(clnt, task, action),
73 __field(const struct rpc_clnt *, clnt)
74 __field(const struct rpc_task *, task)
75 __field(const void *, action)
76 __field(unsigned long, runstate)
78 __field(unsigned short, flags)
84 __entry->action = action;
85 __entry->runstate = task->tk_runstate;
86 __entry->status = task->tk_status;
87 __entry->flags = task->tk_flags;
90 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d action=%pf",
100 DEFINE_EVENT(rpc_task_running, rpc_task_begin,
102 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
104 TP_ARGS(clnt, task, action)
108 DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
110 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
112 TP_ARGS(clnt, task, action)
116 DEFINE_EVENT(rpc_task_running, rpc_task_complete,
118 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
120 TP_ARGS(clnt, task, action)
124 DECLARE_EVENT_CLASS(rpc_task_queued,
126 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
128 TP_ARGS(clnt, task, q),
131 __field(const struct rpc_clnt *, clnt)
132 __field(const struct rpc_task *, task)
133 __field(unsigned long, timeout)
134 __field(unsigned long, runstate)
136 __field(unsigned short, flags)
137 __string(q_name, rpc_qname(q))
141 __entry->clnt = clnt;
142 __entry->task = task;
143 __entry->timeout = task->tk_timeout;
144 __entry->runstate = task->tk_runstate;
145 __entry->status = task->tk_status;
146 __entry->flags = task->tk_flags;
147 __assign_str(q_name, rpc_qname(q));
150 TP_printk("task:%p@%p flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
161 DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
163 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
165 TP_ARGS(clnt, task, q)
169 DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
171 TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
173 TP_ARGS(clnt, task, q)
177 #define rpc_show_socket_state(state) \
178 __print_symbolic(state, \
179 { SS_FREE, "FREE" }, \
180 { SS_UNCONNECTED, "UNCONNECTED" }, \
181 { SS_CONNECTING, "CONNECTING," }, \
182 { SS_CONNECTED, "CONNECTED," }, \
183 { SS_DISCONNECTING, "DISCONNECTING" })
185 #define rpc_show_sock_state(state) \
186 __print_symbolic(state, \
187 { TCP_ESTABLISHED, "ESTABLISHED" }, \
188 { TCP_SYN_SENT, "SYN_SENT" }, \
189 { TCP_SYN_RECV, "SYN_RECV" }, \
190 { TCP_FIN_WAIT1, "FIN_WAIT1" }, \
191 { TCP_FIN_WAIT2, "FIN_WAIT2" }, \
192 { TCP_TIME_WAIT, "TIME_WAIT" }, \
193 { TCP_CLOSE, "CLOSE" }, \
194 { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \
195 { TCP_LAST_ACK, "LAST_ACK" }, \
196 { TCP_LISTEN, "LISTEN" }, \
197 { TCP_CLOSING, "CLOSING" })
199 DECLARE_EVENT_CLASS(xs_socket_event,
202 struct rpc_xprt *xprt,
203 struct socket *socket
206 TP_ARGS(xprt, socket),
209 __field(unsigned int, socket_state)
210 __field(unsigned int, sock_state)
211 __field(unsigned long long, ino)
213 xprt->address_strings[RPC_DISPLAY_ADDR])
215 xprt->address_strings[RPC_DISPLAY_PORT])
219 struct inode *inode = SOCK_INODE(socket);
220 __entry->socket_state = socket->state;
221 __entry->sock_state = socket->sk->sk_state;
222 __entry->ino = (unsigned long long)inode->i_ino;
223 __assign_str(dstaddr,
224 xprt->address_strings[RPC_DISPLAY_ADDR]);
225 __assign_str(dstport,
226 xprt->address_strings[RPC_DISPLAY_PORT]);
230 "socket:[%llu] dstaddr=%s/%s "
231 "state=%u (%s) sk_state=%u (%s)",
232 __entry->ino, __get_str(dstaddr), __get_str(dstport),
233 __entry->socket_state,
234 rpc_show_socket_state(__entry->socket_state),
236 rpc_show_sock_state(__entry->sock_state)
239 #define DEFINE_RPC_SOCKET_EVENT(name) \
240 DEFINE_EVENT(xs_socket_event, name, \
242 struct rpc_xprt *xprt, \
243 struct socket *socket \
245 TP_ARGS(xprt, socket))
247 DECLARE_EVENT_CLASS(xs_socket_event_done,
250 struct rpc_xprt *xprt,
251 struct socket *socket,
255 TP_ARGS(xprt, socket, error),
259 __field(unsigned int, socket_state)
260 __field(unsigned int, sock_state)
261 __field(unsigned long long, ino)
263 xprt->address_strings[RPC_DISPLAY_ADDR])
265 xprt->address_strings[RPC_DISPLAY_PORT])
269 struct inode *inode = SOCK_INODE(socket);
270 __entry->socket_state = socket->state;
271 __entry->sock_state = socket->sk->sk_state;
272 __entry->ino = (unsigned long long)inode->i_ino;
273 __entry->error = error;
274 __assign_str(dstaddr,
275 xprt->address_strings[RPC_DISPLAY_ADDR]);
276 __assign_str(dstport,
277 xprt->address_strings[RPC_DISPLAY_PORT]);
281 "error=%d socket:[%llu] dstaddr=%s/%s "
282 "state=%u (%s) sk_state=%u (%s)",
284 __entry->ino, __get_str(dstaddr), __get_str(dstport),
285 __entry->socket_state,
286 rpc_show_socket_state(__entry->socket_state),
288 rpc_show_sock_state(__entry->sock_state)
291 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
292 DEFINE_EVENT(xs_socket_event_done, name, \
294 struct rpc_xprt *xprt, \
295 struct socket *socket, \
298 TP_ARGS(xprt, socket, error))
300 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change);
301 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect);
302 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
303 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
304 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
306 #endif /* _TRACE_SUNRPC_H */
308 #include <trace/define_trace.h>