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(unsigned int, task_id
)
21 __field(unsigned int, client_id
)
26 __entry
->task_id
= task
->tk_pid
;
27 __entry
->client_id
= task
->tk_client
->cl_clid
;
28 __entry
->status
= task
->tk_status
;
31 TP_printk("task:%u@%u, status %d",
32 __entry
->task_id
, __entry
->client_id
,
36 DEFINE_EVENT(rpc_task_status
, rpc_call_status
,
37 TP_PROTO(struct rpc_task
*task
),
42 DEFINE_EVENT(rpc_task_status
, rpc_bind_status
,
43 TP_PROTO(struct rpc_task
*task
),
48 TRACE_EVENT(rpc_connect_status
,
49 TP_PROTO(struct rpc_task
*task
, int status
),
51 TP_ARGS(task
, status
),
54 __field(unsigned int, task_id
)
55 __field(unsigned int, client_id
)
60 __entry
->task_id
= task
->tk_pid
;
61 __entry
->client_id
= task
->tk_client
->cl_clid
;
62 __entry
->status
= status
;
65 TP_printk("task:%u@%u, status %d",
66 __entry
->task_id
, __entry
->client_id
,
70 DECLARE_EVENT_CLASS(rpc_task_running
,
72 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
74 TP_ARGS(clnt
, task
, action
),
77 __field(unsigned int, task_id
)
78 __field(unsigned int, client_id
)
79 __field(const void *, action
)
80 __field(unsigned long, runstate
)
82 __field(unsigned short, flags
)
86 __entry
->client_id
= clnt
->cl_clid
;
87 __entry
->task_id
= task
->tk_pid
;
88 __entry
->action
= action
;
89 __entry
->runstate
= task
->tk_runstate
;
90 __entry
->status
= task
->tk_status
;
91 __entry
->flags
= task
->tk_flags
;
94 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d action=%pf",
95 __entry
->task_id
, __entry
->client_id
,
103 DEFINE_EVENT(rpc_task_running
, rpc_task_begin
,
105 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
107 TP_ARGS(clnt
, task
, action
)
111 DEFINE_EVENT(rpc_task_running
, rpc_task_run_action
,
113 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
115 TP_ARGS(clnt
, task
, action
)
119 DEFINE_EVENT(rpc_task_running
, rpc_task_complete
,
121 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const void *action
),
123 TP_ARGS(clnt
, task
, action
)
127 DECLARE_EVENT_CLASS(rpc_task_queued
,
129 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
131 TP_ARGS(clnt
, task
, q
),
134 __field(unsigned int, task_id
)
135 __field(unsigned int, client_id
)
136 __field(unsigned long, timeout
)
137 __field(unsigned long, runstate
)
139 __field(unsigned short, flags
)
140 __string(q_name
, rpc_qname(q
))
144 __entry
->client_id
= clnt
->cl_clid
;
145 __entry
->task_id
= task
->tk_pid
;
146 __entry
->timeout
= task
->tk_timeout
;
147 __entry
->runstate
= task
->tk_runstate
;
148 __entry
->status
= task
->tk_status
;
149 __entry
->flags
= task
->tk_flags
;
150 __assign_str(q_name
, rpc_qname(q
));
153 TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d timeout=%lu queue=%s",
154 __entry
->task_id
, __entry
->client_id
,
163 DEFINE_EVENT(rpc_task_queued
, rpc_task_sleep
,
165 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
167 TP_ARGS(clnt
, task
, q
)
171 DEFINE_EVENT(rpc_task_queued
, rpc_task_wakeup
,
173 TP_PROTO(const struct rpc_clnt
*clnt
, const struct rpc_task
*task
, const struct rpc_wait_queue
*q
),
175 TP_ARGS(clnt
, task
, q
)
179 #define rpc_show_socket_state(state) \
180 __print_symbolic(state, \
181 { SS_FREE, "FREE" }, \
182 { SS_UNCONNECTED, "UNCONNECTED" }, \
183 { SS_CONNECTING, "CONNECTING," }, \
184 { SS_CONNECTED, "CONNECTED," }, \
185 { SS_DISCONNECTING, "DISCONNECTING" })
187 #define rpc_show_sock_state(state) \
188 __print_symbolic(state, \
189 { TCP_ESTABLISHED, "ESTABLISHED" }, \
190 { TCP_SYN_SENT, "SYN_SENT" }, \
191 { TCP_SYN_RECV, "SYN_RECV" }, \
192 { TCP_FIN_WAIT1, "FIN_WAIT1" }, \
193 { TCP_FIN_WAIT2, "FIN_WAIT2" }, \
194 { TCP_TIME_WAIT, "TIME_WAIT" }, \
195 { TCP_CLOSE, "CLOSE" }, \
196 { TCP_CLOSE_WAIT, "CLOSE_WAIT" }, \
197 { TCP_LAST_ACK, "LAST_ACK" }, \
198 { TCP_LISTEN, "LISTEN" }, \
199 { TCP_CLOSING, "CLOSING" })
201 DECLARE_EVENT_CLASS(xs_socket_event
,
204 struct rpc_xprt
*xprt
,
205 struct socket
*socket
208 TP_ARGS(xprt
, socket
),
211 __field(unsigned int, socket_state
)
212 __field(unsigned int, sock_state
)
213 __field(unsigned long long, ino
)
215 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
217 xprt
->address_strings
[RPC_DISPLAY_PORT
])
221 struct inode
*inode
= SOCK_INODE(socket
);
222 __entry
->socket_state
= socket
->state
;
223 __entry
->sock_state
= socket
->sk
->sk_state
;
224 __entry
->ino
= (unsigned long long)inode
->i_ino
;
225 __assign_str(dstaddr
,
226 xprt
->address_strings
[RPC_DISPLAY_ADDR
]);
227 __assign_str(dstport
,
228 xprt
->address_strings
[RPC_DISPLAY_PORT
]);
232 "socket:[%llu] dstaddr=%s/%s "
233 "state=%u (%s) sk_state=%u (%s)",
234 __entry
->ino
, __get_str(dstaddr
), __get_str(dstport
),
235 __entry
->socket_state
,
236 rpc_show_socket_state(__entry
->socket_state
),
238 rpc_show_sock_state(__entry
->sock_state
)
241 #define DEFINE_RPC_SOCKET_EVENT(name) \
242 DEFINE_EVENT(xs_socket_event, name, \
244 struct rpc_xprt *xprt, \
245 struct socket *socket \
247 TP_ARGS(xprt, socket))
249 DECLARE_EVENT_CLASS(xs_socket_event_done
,
252 struct rpc_xprt
*xprt
,
253 struct socket
*socket
,
257 TP_ARGS(xprt
, socket
, error
),
261 __field(unsigned int, socket_state
)
262 __field(unsigned int, sock_state
)
263 __field(unsigned long long, ino
)
265 xprt
->address_strings
[RPC_DISPLAY_ADDR
])
267 xprt
->address_strings
[RPC_DISPLAY_PORT
])
271 struct inode
*inode
= SOCK_INODE(socket
);
272 __entry
->socket_state
= socket
->state
;
273 __entry
->sock_state
= socket
->sk
->sk_state
;
274 __entry
->ino
= (unsigned long long)inode
->i_ino
;
275 __entry
->error
= error
;
276 __assign_str(dstaddr
,
277 xprt
->address_strings
[RPC_DISPLAY_ADDR
]);
278 __assign_str(dstport
,
279 xprt
->address_strings
[RPC_DISPLAY_PORT
]);
283 "error=%d socket:[%llu] dstaddr=%s/%s "
284 "state=%u (%s) sk_state=%u (%s)",
286 __entry
->ino
, __get_str(dstaddr
), __get_str(dstport
),
287 __entry
->socket_state
,
288 rpc_show_socket_state(__entry
->socket_state
),
290 rpc_show_sock_state(__entry
->sock_state
)
293 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
294 DEFINE_EVENT(xs_socket_event_done, name, \
296 struct rpc_xprt *xprt, \
297 struct socket *socket, \
300 TP_ARGS(xprt, socket, error))
302 DEFINE_RPC_SOCKET_EVENT(rpc_socket_state_change
);
303 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_connect
);
304 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection
);
305 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close
);
306 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown
);
308 #endif /* _TRACE_SUNRPC_H */
310 #include <trace/define_trace.h>