]> Pileus Git - ~andy/linux/blob - include/trace/events/sunrpc.h
ARM: at91: fix network interface ordering for sama5d36
[~andy/linux] / include / trace / events / sunrpc.h
1 #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>
9 #include <net/tcp_states.h>
10 #include <linux/net.h>
11 #include <linux/tracepoint.h>
12
13 DECLARE_EVENT_CLASS(rpc_task_status,
14
15         TP_PROTO(struct rpc_task *task),
16
17         TP_ARGS(task),
18
19         TP_STRUCT__entry(
20                 __field(unsigned int, task_id)
21                 __field(unsigned int, client_id)
22                 __field(int, status)
23         ),
24
25         TP_fast_assign(
26                 __entry->task_id = task->tk_pid;
27                 __entry->client_id = task->tk_client->cl_clid;
28                 __entry->status = task->tk_status;
29         ),
30
31         TP_printk("task:%u@%u, status %d",
32                 __entry->task_id, __entry->client_id,
33                 __entry->status)
34 );
35
36 DEFINE_EVENT(rpc_task_status, rpc_call_status,
37         TP_PROTO(struct rpc_task *task),
38
39         TP_ARGS(task)
40 );
41
42 DEFINE_EVENT(rpc_task_status, rpc_bind_status,
43         TP_PROTO(struct rpc_task *task),
44
45         TP_ARGS(task)
46 );
47
48 TRACE_EVENT(rpc_connect_status,
49         TP_PROTO(struct rpc_task *task, int status),
50
51         TP_ARGS(task, status),
52
53         TP_STRUCT__entry(
54                 __field(unsigned int, task_id)
55                 __field(unsigned int, client_id)
56                 __field(int, status)
57         ),
58
59         TP_fast_assign(
60                 __entry->task_id = task->tk_pid;
61                 __entry->client_id = task->tk_client->cl_clid;
62                 __entry->status = status;
63         ),
64
65         TP_printk("task:%u@%u, status %d",
66                 __entry->task_id, __entry->client_id,
67                 __entry->status)
68 );
69
70 DECLARE_EVENT_CLASS(rpc_task_running,
71
72         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
73
74         TP_ARGS(clnt, task, action),
75
76         TP_STRUCT__entry(
77                 __field(unsigned int, task_id)
78                 __field(unsigned int, client_id)
79                 __field(const void *, action)
80                 __field(unsigned long, runstate)
81                 __field(int, status)
82                 __field(unsigned short, flags)
83                 ),
84
85         TP_fast_assign(
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;
92                 ),
93
94         TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d action=%pf",
95                 __entry->task_id, __entry->client_id,
96                 __entry->flags,
97                 __entry->runstate,
98                 __entry->status,
99                 __entry->action
100                 )
101 );
102
103 DEFINE_EVENT(rpc_task_running, rpc_task_begin,
104
105         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
106
107         TP_ARGS(clnt, task, action)
108
109 );
110
111 DEFINE_EVENT(rpc_task_running, rpc_task_run_action,
112
113         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
114
115         TP_ARGS(clnt, task, action)
116
117 );
118
119 DEFINE_EVENT(rpc_task_running, rpc_task_complete,
120
121         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const void *action),
122
123         TP_ARGS(clnt, task, action)
124
125 );
126
127 DECLARE_EVENT_CLASS(rpc_task_queued,
128
129         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
130
131         TP_ARGS(clnt, task, q),
132
133         TP_STRUCT__entry(
134                 __field(unsigned int, task_id)
135                 __field(unsigned int, client_id)
136                 __field(unsigned long, timeout)
137                 __field(unsigned long, runstate)
138                 __field(int, status)
139                 __field(unsigned short, flags)
140                 __string(q_name, rpc_qname(q))
141                 ),
142
143         TP_fast_assign(
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));
151                 ),
152
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,
155                 __entry->flags,
156                 __entry->runstate,
157                 __entry->status,
158                 __entry->timeout,
159                 __get_str(q_name)
160                 )
161 );
162
163 DEFINE_EVENT(rpc_task_queued, rpc_task_sleep,
164
165         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
166
167         TP_ARGS(clnt, task, q)
168
169 );
170
171 DEFINE_EVENT(rpc_task_queued, rpc_task_wakeup,
172
173         TP_PROTO(const struct rpc_clnt *clnt, const struct rpc_task *task, const struct rpc_wait_queue *q),
174
175         TP_ARGS(clnt, task, q)
176
177 );
178
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" })
186
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" })
200
201 DECLARE_EVENT_CLASS(xs_socket_event,
202
203                 TP_PROTO(
204                         struct rpc_xprt *xprt,
205                         struct socket *socket
206                 ),
207
208                 TP_ARGS(xprt, socket),
209
210                 TP_STRUCT__entry(
211                         __field(unsigned int, socket_state)
212                         __field(unsigned int, sock_state)
213                         __field(unsigned long long, ino)
214                         __string(dstaddr,
215                                 xprt->address_strings[RPC_DISPLAY_ADDR])
216                         __string(dstport,
217                                 xprt->address_strings[RPC_DISPLAY_PORT])
218                 ),
219
220                 TP_fast_assign(
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]);
229                 ),
230
231                 TP_printk(
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),
237                         __entry->sock_state,
238                         rpc_show_sock_state(__entry->sock_state)
239                 )
240 );
241 #define DEFINE_RPC_SOCKET_EVENT(name) \
242         DEFINE_EVENT(xs_socket_event, name, \
243                         TP_PROTO( \
244                                 struct rpc_xprt *xprt, \
245                                 struct socket *socket \
246                         ), \
247                         TP_ARGS(xprt, socket))
248
249 DECLARE_EVENT_CLASS(xs_socket_event_done,
250
251                 TP_PROTO(
252                         struct rpc_xprt *xprt,
253                         struct socket *socket,
254                         int error
255                 ),
256
257                 TP_ARGS(xprt, socket, error),
258
259                 TP_STRUCT__entry(
260                         __field(int, error)
261                         __field(unsigned int, socket_state)
262                         __field(unsigned int, sock_state)
263                         __field(unsigned long long, ino)
264                         __string(dstaddr,
265                                 xprt->address_strings[RPC_DISPLAY_ADDR])
266                         __string(dstport,
267                                 xprt->address_strings[RPC_DISPLAY_PORT])
268                 ),
269
270                 TP_fast_assign(
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]);
280                 ),
281
282                 TP_printk(
283                         "error=%d socket:[%llu] dstaddr=%s/%s "
284                         "state=%u (%s) sk_state=%u (%s)",
285                         __entry->error,
286                         __entry->ino, __get_str(dstaddr), __get_str(dstport),
287                         __entry->socket_state,
288                         rpc_show_socket_state(__entry->socket_state),
289                         __entry->sock_state,
290                         rpc_show_sock_state(__entry->sock_state)
291                 )
292 );
293 #define DEFINE_RPC_SOCKET_EVENT_DONE(name) \
294         DEFINE_EVENT(xs_socket_event_done, name, \
295                         TP_PROTO( \
296                                 struct rpc_xprt *xprt, \
297                                 struct socket *socket, \
298                                 int error \
299                         ), \
300                         TP_ARGS(xprt, socket, error))
301
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_error);
305 DEFINE_RPC_SOCKET_EVENT_DONE(rpc_socket_reset_connection);
306 DEFINE_RPC_SOCKET_EVENT(rpc_socket_close);
307 DEFINE_RPC_SOCKET_EVENT(rpc_socket_shutdown);
308
309 #endif /* _TRACE_SUNRPC_H */
310
311 #include <trace/define_trace.h>