Merge tag 'nfs-for-4.13-3' of git://git.linux-nfs.org/projects/anna/linux-nfs
[sfrench/cifs-2.6.git] / include / trace / events / rxrpc.h
1 /* AF_RXRPC tracepoints
2  *
3  * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
4  * Written by David Howells (dhowells@redhat.com)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public Licence
8  * as published by the Free Software Foundation; either version
9  * 2 of the Licence, or (at your option) any later version.
10  */
11 #undef TRACE_SYSTEM
12 #define TRACE_SYSTEM rxrpc
13
14 #if !defined(_TRACE_RXRPC_H) || defined(TRACE_HEADER_MULTI_READ)
15 #define _TRACE_RXRPC_H
16
17 #include <linux/tracepoint.h>
18
19 /*
20  * Define enums for tracing information.
21  *
22  * These should all be kept sorted, making it easier to match the string
23  * mapping tables further on.
24  */
25 #ifndef __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY
26 #define __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY
27
28 enum rxrpc_skb_trace {
29         rxrpc_skb_rx_cleaned,
30         rxrpc_skb_rx_freed,
31         rxrpc_skb_rx_got,
32         rxrpc_skb_rx_lost,
33         rxrpc_skb_rx_purged,
34         rxrpc_skb_rx_received,
35         rxrpc_skb_rx_rotated,
36         rxrpc_skb_rx_seen,
37         rxrpc_skb_tx_cleaned,
38         rxrpc_skb_tx_freed,
39         rxrpc_skb_tx_got,
40         rxrpc_skb_tx_new,
41         rxrpc_skb_tx_rotated,
42         rxrpc_skb_tx_seen,
43 };
44
45 enum rxrpc_conn_trace {
46         rxrpc_conn_got,
47         rxrpc_conn_new_client,
48         rxrpc_conn_new_service,
49         rxrpc_conn_put_client,
50         rxrpc_conn_put_service,
51         rxrpc_conn_queued,
52         rxrpc_conn_seen,
53 };
54
55 enum rxrpc_client_trace {
56         rxrpc_client_activate_chans,
57         rxrpc_client_alloc,
58         rxrpc_client_chan_activate,
59         rxrpc_client_chan_disconnect,
60         rxrpc_client_chan_pass,
61         rxrpc_client_chan_unstarted,
62         rxrpc_client_cleanup,
63         rxrpc_client_count,
64         rxrpc_client_discard,
65         rxrpc_client_duplicate,
66         rxrpc_client_exposed,
67         rxrpc_client_replace,
68         rxrpc_client_to_active,
69         rxrpc_client_to_culled,
70         rxrpc_client_to_idle,
71         rxrpc_client_to_inactive,
72         rxrpc_client_to_upgrade,
73         rxrpc_client_to_waiting,
74         rxrpc_client_uncount,
75 };
76
77 enum rxrpc_call_trace {
78         rxrpc_call_connected,
79         rxrpc_call_error,
80         rxrpc_call_got,
81         rxrpc_call_got_kernel,
82         rxrpc_call_got_userid,
83         rxrpc_call_new_client,
84         rxrpc_call_new_service,
85         rxrpc_call_put,
86         rxrpc_call_put_kernel,
87         rxrpc_call_put_noqueue,
88         rxrpc_call_put_userid,
89         rxrpc_call_queued,
90         rxrpc_call_queued_ref,
91         rxrpc_call_release,
92         rxrpc_call_seen,
93 };
94
95 enum rxrpc_transmit_trace {
96         rxrpc_transmit_await_reply,
97         rxrpc_transmit_end,
98         rxrpc_transmit_queue,
99         rxrpc_transmit_queue_last,
100         rxrpc_transmit_rotate,
101         rxrpc_transmit_rotate_last,
102         rxrpc_transmit_wait,
103 };
104
105 enum rxrpc_receive_trace {
106         rxrpc_receive_end,
107         rxrpc_receive_front,
108         rxrpc_receive_incoming,
109         rxrpc_receive_queue,
110         rxrpc_receive_queue_last,
111         rxrpc_receive_rotate,
112 };
113
114 enum rxrpc_recvmsg_trace {
115         rxrpc_recvmsg_cont,
116         rxrpc_recvmsg_data_return,
117         rxrpc_recvmsg_dequeue,
118         rxrpc_recvmsg_enter,
119         rxrpc_recvmsg_full,
120         rxrpc_recvmsg_hole,
121         rxrpc_recvmsg_next,
122         rxrpc_recvmsg_requeue,
123         rxrpc_recvmsg_return,
124         rxrpc_recvmsg_terminal,
125         rxrpc_recvmsg_to_be_accepted,
126         rxrpc_recvmsg_wait,
127 };
128
129 enum rxrpc_rtt_tx_trace {
130         rxrpc_rtt_tx_data,
131         rxrpc_rtt_tx_ping,
132 };
133
134 enum rxrpc_rtt_rx_trace {
135         rxrpc_rtt_rx_ping_response,
136         rxrpc_rtt_rx_requested_ack,
137 };
138
139 enum rxrpc_timer_trace {
140         rxrpc_timer_begin,
141         rxrpc_timer_expired,
142         rxrpc_timer_init_for_reply,
143         rxrpc_timer_init_for_send_reply,
144         rxrpc_timer_set_for_ack,
145         rxrpc_timer_set_for_ping,
146         rxrpc_timer_set_for_resend,
147         rxrpc_timer_set_for_send,
148 };
149
150 enum rxrpc_propose_ack_trace {
151         rxrpc_propose_ack_client_tx_end,
152         rxrpc_propose_ack_input_data,
153         rxrpc_propose_ack_ping_for_lost_ack,
154         rxrpc_propose_ack_ping_for_lost_reply,
155         rxrpc_propose_ack_ping_for_params,
156         rxrpc_propose_ack_processing_op,
157         rxrpc_propose_ack_respond_to_ack,
158         rxrpc_propose_ack_respond_to_ping,
159         rxrpc_propose_ack_retry_tx,
160         rxrpc_propose_ack_rotate_rx,
161         rxrpc_propose_ack_terminal_ack,
162 };
163
164 enum rxrpc_propose_ack_outcome {
165         rxrpc_propose_ack_subsume,
166         rxrpc_propose_ack_update,
167         rxrpc_propose_ack_use,
168 };
169
170 enum rxrpc_congest_change {
171         rxrpc_cong_begin_retransmission,
172         rxrpc_cong_cleared_nacks,
173         rxrpc_cong_new_low_nack,
174         rxrpc_cong_no_change,
175         rxrpc_cong_progress,
176         rxrpc_cong_retransmit_again,
177         rxrpc_cong_rtt_window_end,
178         rxrpc_cong_saw_nack,
179 };
180
181 #endif /* end __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY */
182
183 /*
184  * Declare tracing information enums and their string mappings for display.
185  */
186 #define rxrpc_skb_traces \
187         EM(rxrpc_skb_rx_cleaned,                "Rx CLN") \
188         EM(rxrpc_skb_rx_freed,                  "Rx FRE") \
189         EM(rxrpc_skb_rx_got,                    "Rx GOT") \
190         EM(rxrpc_skb_rx_lost,                   "Rx *L*") \
191         EM(rxrpc_skb_rx_purged,                 "Rx PUR") \
192         EM(rxrpc_skb_rx_received,               "Rx RCV") \
193         EM(rxrpc_skb_rx_rotated,                "Rx ROT") \
194         EM(rxrpc_skb_rx_seen,                   "Rx SEE") \
195         EM(rxrpc_skb_tx_cleaned,                "Tx CLN") \
196         EM(rxrpc_skb_tx_freed,                  "Tx FRE") \
197         EM(rxrpc_skb_tx_got,                    "Tx GOT") \
198         EM(rxrpc_skb_tx_new,                    "Tx NEW") \
199         EM(rxrpc_skb_tx_rotated,                "Tx ROT") \
200         E_(rxrpc_skb_tx_seen,                   "Tx SEE")
201
202 #define rxrpc_conn_traces \
203         EM(rxrpc_conn_got,                      "GOT") \
204         EM(rxrpc_conn_new_client,               "NWc") \
205         EM(rxrpc_conn_new_service,              "NWs") \
206         EM(rxrpc_conn_put_client,               "PTc") \
207         EM(rxrpc_conn_put_service,              "PTs") \
208         EM(rxrpc_conn_queued,                   "QUE") \
209         E_(rxrpc_conn_seen,                     "SEE")
210
211 #define rxrpc_client_traces \
212         EM(rxrpc_client_activate_chans,         "Activa") \
213         EM(rxrpc_client_alloc,                  "Alloc ") \
214         EM(rxrpc_client_chan_activate,          "ChActv") \
215         EM(rxrpc_client_chan_disconnect,        "ChDisc") \
216         EM(rxrpc_client_chan_pass,              "ChPass") \
217         EM(rxrpc_client_chan_unstarted,         "ChUnst") \
218         EM(rxrpc_client_cleanup,                "Clean ") \
219         EM(rxrpc_client_count,                  "Count ") \
220         EM(rxrpc_client_discard,                "Discar") \
221         EM(rxrpc_client_duplicate,              "Duplic") \
222         EM(rxrpc_client_exposed,                "Expose") \
223         EM(rxrpc_client_replace,                "Replac") \
224         EM(rxrpc_client_to_active,              "->Actv") \
225         EM(rxrpc_client_to_culled,              "->Cull") \
226         EM(rxrpc_client_to_idle,                "->Idle") \
227         EM(rxrpc_client_to_inactive,            "->Inac") \
228         EM(rxrpc_client_to_upgrade,             "->Upgd") \
229         EM(rxrpc_client_to_waiting,             "->Wait") \
230         E_(rxrpc_client_uncount,                "Uncoun")
231
232 #define rxrpc_conn_cache_states \
233         EM(RXRPC_CONN_CLIENT_INACTIVE,          "Inac") \
234         EM(RXRPC_CONN_CLIENT_WAITING,           "Wait") \
235         EM(RXRPC_CONN_CLIENT_ACTIVE,            "Actv") \
236         EM(RXRPC_CONN_CLIENT_UPGRADE,           "Upgd") \
237         EM(RXRPC_CONN_CLIENT_CULLED,            "Cull") \
238         E_(RXRPC_CONN_CLIENT_IDLE,              "Idle") \
239
240 #define rxrpc_call_traces \
241         EM(rxrpc_call_connected,                "CON") \
242         EM(rxrpc_call_error,                    "*E*") \
243         EM(rxrpc_call_got,                      "GOT") \
244         EM(rxrpc_call_got_kernel,               "Gke") \
245         EM(rxrpc_call_got_userid,               "Gus") \
246         EM(rxrpc_call_new_client,               "NWc") \
247         EM(rxrpc_call_new_service,              "NWs") \
248         EM(rxrpc_call_put,                      "PUT") \
249         EM(rxrpc_call_put_kernel,               "Pke") \
250         EM(rxrpc_call_put_noqueue,              "PNQ") \
251         EM(rxrpc_call_put_userid,               "Pus") \
252         EM(rxrpc_call_queued,                   "QUE") \
253         EM(rxrpc_call_queued_ref,               "QUR") \
254         EM(rxrpc_call_release,                  "RLS") \
255         E_(rxrpc_call_seen,                     "SEE")
256
257 #define rxrpc_transmit_traces \
258         EM(rxrpc_transmit_await_reply,          "AWR") \
259         EM(rxrpc_transmit_end,                  "END") \
260         EM(rxrpc_transmit_queue,                "QUE") \
261         EM(rxrpc_transmit_queue_last,           "QLS") \
262         EM(rxrpc_transmit_rotate,               "ROT") \
263         EM(rxrpc_transmit_rotate_last,          "RLS") \
264         E_(rxrpc_transmit_wait,                 "WAI")
265
266 #define rxrpc_receive_traces \
267         EM(rxrpc_receive_end,                   "END") \
268         EM(rxrpc_receive_front,                 "FRN") \
269         EM(rxrpc_receive_incoming,              "INC") \
270         EM(rxrpc_receive_queue,                 "QUE") \
271         EM(rxrpc_receive_queue_last,            "QLS") \
272         E_(rxrpc_receive_rotate,                "ROT")
273
274 #define rxrpc_recvmsg_traces \
275         EM(rxrpc_recvmsg_cont,                  "CONT") \
276         EM(rxrpc_recvmsg_data_return,           "DATA") \
277         EM(rxrpc_recvmsg_dequeue,               "DEQU") \
278         EM(rxrpc_recvmsg_enter,                 "ENTR") \
279         EM(rxrpc_recvmsg_full,                  "FULL") \
280         EM(rxrpc_recvmsg_hole,                  "HOLE") \
281         EM(rxrpc_recvmsg_next,                  "NEXT") \
282         EM(rxrpc_recvmsg_requeue,               "REQU") \
283         EM(rxrpc_recvmsg_return,                "RETN") \
284         EM(rxrpc_recvmsg_terminal,              "TERM") \
285         EM(rxrpc_recvmsg_to_be_accepted,        "TBAC") \
286         E_(rxrpc_recvmsg_wait,                  "WAIT")
287
288 #define rxrpc_rtt_tx_traces \
289         EM(rxrpc_rtt_tx_data,                   "DATA") \
290         E_(rxrpc_rtt_tx_ping,                   "PING")
291
292 #define rxrpc_rtt_rx_traces \
293         EM(rxrpc_rtt_rx_ping_response,          "PONG") \
294         E_(rxrpc_rtt_rx_requested_ack,          "RACK")
295
296 #define rxrpc_timer_traces \
297         EM(rxrpc_timer_begin,                   "Begin ") \
298         EM(rxrpc_timer_expired,                 "*EXPR*") \
299         EM(rxrpc_timer_init_for_reply,          "IniRpl") \
300         EM(rxrpc_timer_init_for_send_reply,     "SndRpl") \
301         EM(rxrpc_timer_set_for_ack,             "SetAck") \
302         EM(rxrpc_timer_set_for_ping,            "SetPng") \
303         EM(rxrpc_timer_set_for_resend,          "SetRTx") \
304         E_(rxrpc_timer_set_for_send,            "SetTx ")
305
306 #define rxrpc_propose_ack_traces \
307         EM(rxrpc_propose_ack_client_tx_end,     "ClTxEnd") \
308         EM(rxrpc_propose_ack_input_data,        "DataIn ") \
309         EM(rxrpc_propose_ack_ping_for_lost_ack, "LostAck") \
310         EM(rxrpc_propose_ack_ping_for_lost_reply, "LostRpl") \
311         EM(rxrpc_propose_ack_ping_for_params,   "Params ") \
312         EM(rxrpc_propose_ack_processing_op,     "ProcOp ") \
313         EM(rxrpc_propose_ack_respond_to_ack,    "Rsp2Ack") \
314         EM(rxrpc_propose_ack_respond_to_ping,   "Rsp2Png") \
315         EM(rxrpc_propose_ack_retry_tx,          "RetryTx") \
316         EM(rxrpc_propose_ack_rotate_rx,         "RxAck  ") \
317         E_(rxrpc_propose_ack_terminal_ack,      "ClTerm ")
318
319 #define rxrpc_propose_ack_outcomes \
320         EM(rxrpc_propose_ack_subsume,           " Subsume") \
321         EM(rxrpc_propose_ack_update,            " Update") \
322         E_(rxrpc_propose_ack_use,               "")
323
324 #define rxrpc_congest_modes \
325         EM(RXRPC_CALL_CONGEST_AVOIDANCE,        "CongAvoid") \
326         EM(RXRPC_CALL_FAST_RETRANSMIT,          "FastReTx ") \
327         EM(RXRPC_CALL_PACKET_LOSS,              "PktLoss  ") \
328         E_(RXRPC_CALL_SLOW_START,               "SlowStart")
329
330 #define rxrpc_congest_changes \
331         EM(rxrpc_cong_begin_retransmission,     " Retrans") \
332         EM(rxrpc_cong_cleared_nacks,            " Cleared") \
333         EM(rxrpc_cong_new_low_nack,             " NewLowN") \
334         EM(rxrpc_cong_no_change,                "") \
335         EM(rxrpc_cong_progress,                 " Progres") \
336         EM(rxrpc_cong_retransmit_again,         " ReTxAgn") \
337         EM(rxrpc_cong_rtt_window_end,           " RttWinE") \
338         E_(rxrpc_cong_saw_nack,                 " SawNack")
339
340 #define rxrpc_pkts \
341         EM(0,                                   "?00") \
342         EM(RXRPC_PACKET_TYPE_DATA,              "DATA") \
343         EM(RXRPC_PACKET_TYPE_ACK,               "ACK") \
344         EM(RXRPC_PACKET_TYPE_BUSY,              "BUSY") \
345         EM(RXRPC_PACKET_TYPE_ABORT,             "ABORT") \
346         EM(RXRPC_PACKET_TYPE_ACKALL,            "ACKALL") \
347         EM(RXRPC_PACKET_TYPE_CHALLENGE,         "CHALL") \
348         EM(RXRPC_PACKET_TYPE_RESPONSE,          "RESP") \
349         EM(RXRPC_PACKET_TYPE_DEBUG,             "DEBUG") \
350         EM(9,                                   "?09") \
351         EM(10,                                  "?10") \
352         EM(11,                                  "?11") \
353         EM(12,                                  "?12") \
354         EM(RXRPC_PACKET_TYPE_VERSION,           "VERSION") \
355         EM(14,                                  "?14") \
356         E_(15,                                  "?15")
357
358 #define rxrpc_ack_names \
359         EM(0,                                   "-0-") \
360         EM(RXRPC_ACK_REQUESTED,                 "REQ") \
361         EM(RXRPC_ACK_DUPLICATE,                 "DUP") \
362         EM(RXRPC_ACK_OUT_OF_SEQUENCE,           "OOS") \
363         EM(RXRPC_ACK_EXCEEDS_WINDOW,            "WIN") \
364         EM(RXRPC_ACK_NOSPACE,                   "MEM") \
365         EM(RXRPC_ACK_PING,                      "PNG") \
366         EM(RXRPC_ACK_PING_RESPONSE,             "PNR") \
367         EM(RXRPC_ACK_DELAY,                     "DLY") \
368         EM(RXRPC_ACK_IDLE,                      "IDL") \
369         E_(RXRPC_ACK__INVALID,                  "-?-")
370
371 /*
372  * Export enum symbols via userspace.
373  */
374 #undef EM
375 #undef E_
376 #define EM(a, b) TRACE_DEFINE_ENUM(a);
377 #define E_(a, b) TRACE_DEFINE_ENUM(a);
378
379 rxrpc_skb_traces;
380 rxrpc_conn_traces;
381 rxrpc_client_traces;
382 rxrpc_call_traces;
383 rxrpc_transmit_traces;
384 rxrpc_receive_traces;
385 rxrpc_recvmsg_traces;
386 rxrpc_rtt_tx_traces;
387 rxrpc_rtt_rx_traces;
388 rxrpc_timer_traces;
389 rxrpc_propose_ack_traces;
390 rxrpc_propose_ack_outcomes;
391 rxrpc_congest_changes;
392
393 /*
394  * Now redefine the EM() and E_() macros to map the enums to the strings that
395  * will be printed in the output.
396  */
397 #undef EM
398 #undef E_
399 #define EM(a, b)        { a, b },
400 #define E_(a, b)        { a, b }
401
402 TRACE_EVENT(rxrpc_conn,
403             TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
404                      int usage, const void *where),
405
406             TP_ARGS(conn, op, usage, where),
407
408             TP_STRUCT__entry(
409                     __field(struct rxrpc_connection *,  conn            )
410                     __field(int,                        op              )
411                     __field(int,                        usage           )
412                     __field(const void *,               where           )
413                              ),
414
415             TP_fast_assign(
416                     __entry->conn = conn;
417                     __entry->op = op;
418                     __entry->usage = usage;
419                     __entry->where = where;
420                            ),
421
422             TP_printk("C=%p %s u=%d sp=%pSR",
423                       __entry->conn,
424                       __print_symbolic(__entry->op, rxrpc_conn_traces),
425                       __entry->usage,
426                       __entry->where)
427             );
428
429 TRACE_EVENT(rxrpc_client,
430             TP_PROTO(struct rxrpc_connection *conn, int channel,
431                      enum rxrpc_client_trace op),
432
433             TP_ARGS(conn, channel, op),
434
435             TP_STRUCT__entry(
436                     __field(struct rxrpc_connection *,  conn            )
437                     __field(u32,                        cid             )
438                     __field(int,                        channel         )
439                     __field(int,                        usage           )
440                     __field(enum rxrpc_client_trace,    op              )
441                     __field(enum rxrpc_conn_cache_state, cs             )
442                              ),
443
444             TP_fast_assign(
445                     __entry->conn = conn;
446                     __entry->channel = channel;
447                     __entry->usage = atomic_read(&conn->usage);
448                     __entry->op = op;
449                     __entry->cid = conn->proto.cid;
450                     __entry->cs = conn->cache_state;
451                            ),
452
453             TP_printk("C=%p h=%2d %s %s i=%08x u=%d",
454                       __entry->conn,
455                       __entry->channel,
456                       __print_symbolic(__entry->op, rxrpc_client_traces),
457                       __print_symbolic(__entry->cs, rxrpc_conn_cache_states),
458                       __entry->cid,
459                       __entry->usage)
460             );
461
462 TRACE_EVENT(rxrpc_call,
463             TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
464                      int usage, const void *where, const void *aux),
465
466             TP_ARGS(call, op, usage, where, aux),
467
468             TP_STRUCT__entry(
469                     __field(struct rxrpc_call *,        call            )
470                     __field(int,                        op              )
471                     __field(int,                        usage           )
472                     __field(const void *,               where           )
473                     __field(const void *,               aux             )
474                              ),
475
476             TP_fast_assign(
477                     __entry->call = call;
478                     __entry->op = op;
479                     __entry->usage = usage;
480                     __entry->where = where;
481                     __entry->aux = aux;
482                            ),
483
484             TP_printk("c=%p %s u=%d sp=%pSR a=%p",
485                       __entry->call,
486                       __print_symbolic(__entry->op, rxrpc_call_traces),
487                       __entry->usage,
488                       __entry->where,
489                       __entry->aux)
490             );
491
492 TRACE_EVENT(rxrpc_skb,
493             TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op,
494                      int usage, int mod_count, const void *where),
495
496             TP_ARGS(skb, op, usage, mod_count, where),
497
498             TP_STRUCT__entry(
499                     __field(struct sk_buff *,           skb             )
500                     __field(enum rxrpc_skb_trace,       op              )
501                     __field(int,                        usage           )
502                     __field(int,                        mod_count       )
503                     __field(const void *,               where           )
504                              ),
505
506             TP_fast_assign(
507                     __entry->skb = skb;
508                     __entry->op = op;
509                     __entry->usage = usage;
510                     __entry->mod_count = mod_count;
511                     __entry->where = where;
512                            ),
513
514             TP_printk("s=%p %s u=%d m=%d p=%pSR",
515                       __entry->skb,
516                       __print_symbolic(__entry->op, rxrpc_skb_traces),
517                       __entry->usage,
518                       __entry->mod_count,
519                       __entry->where)
520             );
521
522 TRACE_EVENT(rxrpc_rx_packet,
523             TP_PROTO(struct rxrpc_skb_priv *sp),
524
525             TP_ARGS(sp),
526
527             TP_STRUCT__entry(
528                     __field_struct(struct rxrpc_host_header,    hdr             )
529                              ),
530
531             TP_fast_assign(
532                     memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
533                            ),
534
535             TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s",
536                       __entry->hdr.epoch, __entry->hdr.cid,
537                       __entry->hdr.callNumber, __entry->hdr.serviceId,
538                       __entry->hdr.serial, __entry->hdr.seq,
539                       __entry->hdr.type, __entry->hdr.flags,
540                       __entry->hdr.type <= 15 ?
541                       __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
542             );
543
544 TRACE_EVENT(rxrpc_rx_done,
545             TP_PROTO(int result, int abort_code),
546
547             TP_ARGS(result, abort_code),
548
549             TP_STRUCT__entry(
550                     __field(int,                        result          )
551                     __field(int,                        abort_code      )
552                              ),
553
554             TP_fast_assign(
555                     __entry->result = result;
556                     __entry->abort_code = abort_code;
557                            ),
558
559             TP_printk("r=%d a=%d", __entry->result, __entry->abort_code)
560             );
561
562 TRACE_EVENT(rxrpc_abort,
563             TP_PROTO(const char *why, u32 cid, u32 call_id, rxrpc_seq_t seq,
564                      int abort_code, int error),
565
566             TP_ARGS(why, cid, call_id, seq, abort_code, error),
567
568             TP_STRUCT__entry(
569                     __array(char,                       why, 4          )
570                     __field(u32,                        cid             )
571                     __field(u32,                        call_id         )
572                     __field(rxrpc_seq_t,                seq             )
573                     __field(int,                        abort_code      )
574                     __field(int,                        error           )
575                              ),
576
577             TP_fast_assign(
578                     memcpy(__entry->why, why, 4);
579                     __entry->cid = cid;
580                     __entry->call_id = call_id;
581                     __entry->abort_code = abort_code;
582                     __entry->error = error;
583                     __entry->seq = seq;
584                            ),
585
586             TP_printk("%08x:%08x s=%u a=%d e=%d %s",
587                       __entry->cid, __entry->call_id, __entry->seq,
588                       __entry->abort_code, __entry->error, __entry->why)
589             );
590
591 TRACE_EVENT(rxrpc_transmit,
592             TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why),
593
594             TP_ARGS(call, why),
595
596             TP_STRUCT__entry(
597                     __field(struct rxrpc_call *,        call            )
598                     __field(enum rxrpc_transmit_trace,  why             )
599                     __field(rxrpc_seq_t,                tx_hard_ack     )
600                     __field(rxrpc_seq_t,                tx_top          )
601                     __field(int,                        tx_winsize      )
602                              ),
603
604             TP_fast_assign(
605                     __entry->call = call;
606                     __entry->why = why;
607                     __entry->tx_hard_ack = call->tx_hard_ack;
608                     __entry->tx_top = call->tx_top;
609                     __entry->tx_winsize = call->tx_winsize;
610                            ),
611
612             TP_printk("c=%p %s f=%08x n=%u/%u",
613                       __entry->call,
614                       __print_symbolic(__entry->why, rxrpc_transmit_traces),
615                       __entry->tx_hard_ack + 1,
616                       __entry->tx_top - __entry->tx_hard_ack,
617                       __entry->tx_winsize)
618             );
619
620 TRACE_EVENT(rxrpc_rx_data,
621             TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
622                      rxrpc_serial_t serial, u8 flags, u8 anno),
623
624             TP_ARGS(call, seq, serial, flags, anno),
625
626             TP_STRUCT__entry(
627                     __field(struct rxrpc_call *,        call            )
628                     __field(rxrpc_seq_t,                seq             )
629                     __field(rxrpc_serial_t,             serial          )
630                     __field(u8,                         flags           )
631                     __field(u8,                         anno            )
632                              ),
633
634             TP_fast_assign(
635                     __entry->call = call;
636                     __entry->seq = seq;
637                     __entry->serial = serial;
638                     __entry->flags = flags;
639                     __entry->anno = anno;
640                            ),
641
642             TP_printk("c=%p DATA %08x q=%08x fl=%02x a=%02x",
643                       __entry->call,
644                       __entry->serial,
645                       __entry->seq,
646                       __entry->flags,
647                       __entry->anno)
648             );
649
650 TRACE_EVENT(rxrpc_rx_ack,
651             TP_PROTO(struct rxrpc_call *call,
652                      rxrpc_serial_t serial, rxrpc_serial_t ack_serial,
653                      rxrpc_seq_t first, rxrpc_seq_t prev, u8 reason, u8 n_acks),
654
655             TP_ARGS(call, serial, ack_serial, first, prev, reason, n_acks),
656
657             TP_STRUCT__entry(
658                     __field(struct rxrpc_call *,        call            )
659                     __field(rxrpc_serial_t,             serial          )
660                     __field(rxrpc_serial_t,             ack_serial      )
661                     __field(rxrpc_seq_t,                first           )
662                     __field(rxrpc_seq_t,                prev            )
663                     __field(u8,                         reason          )
664                     __field(u8,                         n_acks          )
665                              ),
666
667             TP_fast_assign(
668                     __entry->call = call;
669                     __entry->serial = serial;
670                     __entry->ack_serial = ack_serial;
671                     __entry->first = first;
672                     __entry->prev = prev;
673                     __entry->reason = reason;
674                     __entry->n_acks = n_acks;
675                            ),
676
677             TP_printk("c=%p %08x %s r=%08x f=%08x p=%08x n=%u",
678                       __entry->call,
679                       __entry->serial,
680                       __print_symbolic(__entry->reason, rxrpc_ack_names),
681                       __entry->ack_serial,
682                       __entry->first,
683                       __entry->prev,
684                       __entry->n_acks)
685             );
686
687 TRACE_EVENT(rxrpc_rx_abort,
688             TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
689                      u32 abort_code),
690
691             TP_ARGS(call, serial, abort_code),
692
693             TP_STRUCT__entry(
694                     __field(struct rxrpc_call *,        call            )
695                     __field(rxrpc_serial_t,             serial          )
696                     __field(u32,                        abort_code      )
697                              ),
698
699             TP_fast_assign(
700                     __entry->call = call;
701                     __entry->serial = serial;
702                     __entry->abort_code = abort_code;
703                            ),
704
705             TP_printk("c=%p ABORT %08x ac=%d",
706                       __entry->call,
707                       __entry->serial,
708                       __entry->abort_code)
709             );
710
711 TRACE_EVENT(rxrpc_rx_rwind_change,
712             TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
713                      u32 rwind, bool wake),
714
715             TP_ARGS(call, serial, rwind, wake),
716
717             TP_STRUCT__entry(
718                     __field(struct rxrpc_call *,        call            )
719                     __field(rxrpc_serial_t,             serial          )
720                     __field(u32,                        rwind           )
721                     __field(bool,                       wake            )
722                              ),
723
724             TP_fast_assign(
725                     __entry->call = call;
726                     __entry->serial = serial;
727                     __entry->rwind = rwind;
728                     __entry->wake = wake;
729                            ),
730
731             TP_printk("c=%p %08x rw=%u%s",
732                       __entry->call,
733                       __entry->serial,
734                       __entry->rwind,
735                       __entry->wake ? " wake" : "")
736             );
737
738 TRACE_EVENT(rxrpc_tx_data,
739             TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
740                      rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
741
742             TP_ARGS(call, seq, serial, flags, retrans, lose),
743
744             TP_STRUCT__entry(
745                     __field(struct rxrpc_call *,        call            )
746                     __field(rxrpc_seq_t,                seq             )
747                     __field(rxrpc_serial_t,             serial          )
748                     __field(u8,                         flags           )
749                     __field(bool,                       retrans         )
750                     __field(bool,                       lose            )
751                              ),
752
753             TP_fast_assign(
754                     __entry->call = call;
755                     __entry->seq = seq;
756                     __entry->serial = serial;
757                     __entry->flags = flags;
758                     __entry->retrans = retrans;
759                     __entry->lose = lose;
760                            ),
761
762             TP_printk("c=%p DATA %08x q=%08x fl=%02x%s%s",
763                       __entry->call,
764                       __entry->serial,
765                       __entry->seq,
766                       __entry->flags,
767                       __entry->retrans ? " *RETRANS*" : "",
768                       __entry->lose ? " *LOSE*" : "")
769             );
770
771 TRACE_EVENT(rxrpc_tx_ack,
772             TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
773                      rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial,
774                      u8 reason, u8 n_acks),
775
776             TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks),
777
778             TP_STRUCT__entry(
779                     __field(struct rxrpc_call *,        call            )
780                     __field(rxrpc_serial_t,             serial          )
781                     __field(rxrpc_seq_t,                ack_first       )
782                     __field(rxrpc_serial_t,             ack_serial      )
783                     __field(u8,                         reason          )
784                     __field(u8,                         n_acks          )
785                              ),
786
787             TP_fast_assign(
788                     __entry->call = call;
789                     __entry->serial = serial;
790                     __entry->ack_first = ack_first;
791                     __entry->ack_serial = ack_serial;
792                     __entry->reason = reason;
793                     __entry->n_acks = n_acks;
794                            ),
795
796             TP_printk(" c=%p ACK  %08x %s f=%08x r=%08x n=%u",
797                       __entry->call,
798                       __entry->serial,
799                       __print_symbolic(__entry->reason, rxrpc_ack_names),
800                       __entry->ack_first,
801                       __entry->ack_serial,
802                       __entry->n_acks)
803             );
804
805 TRACE_EVENT(rxrpc_receive,
806             TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
807                      rxrpc_serial_t serial, rxrpc_seq_t seq),
808
809             TP_ARGS(call, why, serial, seq),
810
811             TP_STRUCT__entry(
812                     __field(struct rxrpc_call *,        call            )
813                     __field(enum rxrpc_receive_trace,   why             )
814                     __field(rxrpc_serial_t,             serial          )
815                     __field(rxrpc_seq_t,                seq             )
816                     __field(rxrpc_seq_t,                hard_ack        )
817                     __field(rxrpc_seq_t,                top             )
818                              ),
819
820             TP_fast_assign(
821                     __entry->call = call;
822                     __entry->why = why;
823                     __entry->serial = serial;
824                     __entry->seq = seq;
825                     __entry->hard_ack = call->rx_hard_ack;
826                     __entry->top = call->rx_top;
827                            ),
828
829             TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
830                       __entry->call,
831                       __print_symbolic(__entry->why, rxrpc_receive_traces),
832                       __entry->serial,
833                       __entry->seq,
834                       __entry->hard_ack,
835                       __entry->top)
836             );
837
838 TRACE_EVENT(rxrpc_recvmsg,
839             TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
840                      rxrpc_seq_t seq, unsigned int offset, unsigned int len,
841                      int ret),
842
843             TP_ARGS(call, why, seq, offset, len, ret),
844
845             TP_STRUCT__entry(
846                     __field(struct rxrpc_call *,        call            )
847                     __field(enum rxrpc_recvmsg_trace,   why             )
848                     __field(rxrpc_seq_t,                seq             )
849                     __field(unsigned int,               offset          )
850                     __field(unsigned int,               len             )
851                     __field(int,                        ret             )
852                              ),
853
854             TP_fast_assign(
855                     __entry->call = call;
856                     __entry->why = why;
857                     __entry->seq = seq;
858                     __entry->offset = offset;
859                     __entry->len = len;
860                     __entry->ret = ret;
861                            ),
862
863             TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
864                       __entry->call,
865                       __print_symbolic(__entry->why, rxrpc_recvmsg_traces),
866                       __entry->seq,
867                       __entry->offset,
868                       __entry->len,
869                       __entry->ret)
870             );
871
872 TRACE_EVENT(rxrpc_rtt_tx,
873             TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
874                      rxrpc_serial_t send_serial),
875
876             TP_ARGS(call, why, send_serial),
877
878             TP_STRUCT__entry(
879                     __field(struct rxrpc_call *,        call            )
880                     __field(enum rxrpc_rtt_tx_trace,    why             )
881                     __field(rxrpc_serial_t,             send_serial     )
882                              ),
883
884             TP_fast_assign(
885                     __entry->call = call;
886                     __entry->why = why;
887                     __entry->send_serial = send_serial;
888                            ),
889
890             TP_printk("c=%p %s sr=%08x",
891                       __entry->call,
892                       __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
893                       __entry->send_serial)
894             );
895
896 TRACE_EVENT(rxrpc_rtt_rx,
897             TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
898                      rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
899                      s64 rtt, u8 nr, s64 avg),
900
901             TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
902
903             TP_STRUCT__entry(
904                     __field(struct rxrpc_call *,        call            )
905                     __field(enum rxrpc_rtt_rx_trace,    why             )
906                     __field(u8,                         nr              )
907                     __field(rxrpc_serial_t,             send_serial     )
908                     __field(rxrpc_serial_t,             resp_serial     )
909                     __field(s64,                        rtt             )
910                     __field(u64,                        avg             )
911                              ),
912
913             TP_fast_assign(
914                     __entry->call = call;
915                     __entry->why = why;
916                     __entry->send_serial = send_serial;
917                     __entry->resp_serial = resp_serial;
918                     __entry->rtt = rtt;
919                     __entry->nr = nr;
920                     __entry->avg = avg;
921                            ),
922
923             TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
924                       __entry->call,
925                       __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
926                       __entry->send_serial,
927                       __entry->resp_serial,
928                       __entry->rtt,
929                       __entry->nr,
930                       __entry->avg)
931             );
932
933 TRACE_EVENT(rxrpc_timer,
934             TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why,
935                      ktime_t now, unsigned long now_j),
936
937             TP_ARGS(call, why, now, now_j),
938
939             TP_STRUCT__entry(
940                     __field(struct rxrpc_call *,                call            )
941                     __field(enum rxrpc_timer_trace,             why             )
942                     __field_struct(ktime_t,                     now             )
943                     __field_struct(ktime_t,                     expire_at       )
944                     __field_struct(ktime_t,                     ack_at          )
945                     __field_struct(ktime_t,                     resend_at       )
946                     __field(unsigned long,                      now_j           )
947                     __field(unsigned long,                      timer           )
948                              ),
949
950             TP_fast_assign(
951                     __entry->call       = call;
952                     __entry->why        = why;
953                     __entry->now        = now;
954                     __entry->expire_at  = call->expire_at;
955                     __entry->ack_at     = call->ack_at;
956                     __entry->resend_at  = call->resend_at;
957                     __entry->now_j      = now_j;
958                     __entry->timer      = call->timer.expires;
959                            ),
960
961             TP_printk("c=%p %s x=%lld a=%lld r=%lld t=%ld",
962                       __entry->call,
963                       __print_symbolic(__entry->why, rxrpc_timer_traces),
964                       ktime_to_ns(ktime_sub(__entry->expire_at, __entry->now)),
965                       ktime_to_ns(ktime_sub(__entry->ack_at, __entry->now)),
966                       ktime_to_ns(ktime_sub(__entry->resend_at, __entry->now)),
967                       __entry->timer - __entry->now_j)
968             );
969
970 TRACE_EVENT(rxrpc_rx_lose,
971             TP_PROTO(struct rxrpc_skb_priv *sp),
972
973             TP_ARGS(sp),
974
975             TP_STRUCT__entry(
976                     __field_struct(struct rxrpc_host_header,    hdr             )
977                              ),
978
979             TP_fast_assign(
980                     memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
981                            ),
982
983             TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*",
984                       __entry->hdr.epoch, __entry->hdr.cid,
985                       __entry->hdr.callNumber, __entry->hdr.serviceId,
986                       __entry->hdr.serial, __entry->hdr.seq,
987                       __entry->hdr.type, __entry->hdr.flags,
988                       __entry->hdr.type <= 15 ?
989                       __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
990             );
991
992 TRACE_EVENT(rxrpc_propose_ack,
993             TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
994                      u8 ack_reason, rxrpc_serial_t serial, bool immediate,
995                      bool background, enum rxrpc_propose_ack_outcome outcome),
996
997             TP_ARGS(call, why, ack_reason, serial, immediate, background,
998                     outcome),
999
1000             TP_STRUCT__entry(
1001                     __field(struct rxrpc_call *,                call            )
1002                     __field(enum rxrpc_propose_ack_trace,       why             )
1003                     __field(rxrpc_serial_t,                     serial          )
1004                     __field(u8,                                 ack_reason      )
1005                     __field(bool,                               immediate       )
1006                     __field(bool,                               background      )
1007                     __field(enum rxrpc_propose_ack_outcome,     outcome         )
1008                              ),
1009
1010             TP_fast_assign(
1011                     __entry->call       = call;
1012                     __entry->why        = why;
1013                     __entry->serial     = serial;
1014                     __entry->ack_reason = ack_reason;
1015                     __entry->immediate  = immediate;
1016                     __entry->background = background;
1017                     __entry->outcome    = outcome;
1018                            ),
1019
1020             TP_printk("c=%p %s %s r=%08x i=%u b=%u%s",
1021                       __entry->call,
1022                       __print_symbolic(__entry->why, rxrpc_propose_ack_traces),
1023                       __print_symbolic(__entry->ack_reason, rxrpc_ack_names),
1024                       __entry->serial,
1025                       __entry->immediate,
1026                       __entry->background,
1027                       __print_symbolic(__entry->outcome, rxrpc_propose_ack_outcomes))
1028             );
1029
1030 TRACE_EVENT(rxrpc_retransmit,
1031             TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
1032                      s64 expiry),
1033
1034             TP_ARGS(call, seq, annotation, expiry),
1035
1036             TP_STRUCT__entry(
1037                     __field(struct rxrpc_call *,        call            )
1038                     __field(rxrpc_seq_t,                seq             )
1039                     __field(u8,                         annotation      )
1040                     __field(s64,                        expiry          )
1041                              ),
1042
1043             TP_fast_assign(
1044                     __entry->call = call;
1045                     __entry->seq = seq;
1046                     __entry->annotation = annotation;
1047                     __entry->expiry = expiry;
1048                            ),
1049
1050             TP_printk("c=%p q=%x a=%02x xp=%lld",
1051                       __entry->call,
1052                       __entry->seq,
1053                       __entry->annotation,
1054                       __entry->expiry)
1055             );
1056
1057 TRACE_EVENT(rxrpc_congest,
1058             TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary,
1059                      rxrpc_serial_t ack_serial, enum rxrpc_congest_change change),
1060
1061             TP_ARGS(call, summary, ack_serial, change),
1062
1063             TP_STRUCT__entry(
1064                     __field(struct rxrpc_call *,                call            )
1065                     __field(enum rxrpc_congest_change,          change          )
1066                     __field(rxrpc_seq_t,                        hard_ack        )
1067                     __field(rxrpc_seq_t,                        top             )
1068                     __field(rxrpc_seq_t,                        lowest_nak      )
1069                     __field(rxrpc_serial_t,                     ack_serial      )
1070                     __field_struct(struct rxrpc_ack_summary,    sum             )
1071                              ),
1072
1073             TP_fast_assign(
1074                     __entry->call       = call;
1075                     __entry->change     = change;
1076                     __entry->hard_ack   = call->tx_hard_ack;
1077                     __entry->top        = call->tx_top;
1078                     __entry->lowest_nak = call->acks_lowest_nak;
1079                     __entry->ack_serial = ack_serial;
1080                     memcpy(&__entry->sum, summary, sizeof(__entry->sum));
1081                            ),
1082
1083             TP_printk("c=%p %08x %s %08x %s cw=%u ss=%u nr=%u,%u nw=%u,%u r=%u b=%u u=%u d=%u l=%x%s%s%s",
1084                       __entry->call,
1085                       __entry->ack_serial,
1086                       __print_symbolic(__entry->sum.ack_reason, rxrpc_ack_names),
1087                       __entry->hard_ack,
1088                       __print_symbolic(__entry->sum.mode, rxrpc_congest_modes),
1089                       __entry->sum.cwnd,
1090                       __entry->sum.ssthresh,
1091                       __entry->sum.nr_acks, __entry->sum.nr_nacks,
1092                       __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks,
1093                       __entry->sum.nr_rot_new_acks,
1094                       __entry->top - __entry->hard_ack,
1095                       __entry->sum.cumulative_acks,
1096                       __entry->sum.dup_acks,
1097                       __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "",
1098                       __print_symbolic(__entry->change, rxrpc_congest_changes),
1099                       __entry->sum.retrans_timeo ? " rTxTo" : "")
1100             );
1101
1102 TRACE_EVENT(rxrpc_disconnect_call,
1103             TP_PROTO(struct rxrpc_call *call),
1104
1105             TP_ARGS(call),
1106
1107             TP_STRUCT__entry(
1108                     __field(struct rxrpc_call *,        call            )
1109                     __field(u32,                        abort_code      )
1110                              ),
1111
1112             TP_fast_assign(
1113                     __entry->call = call;
1114                     __entry->abort_code = call->abort_code;
1115                            ),
1116
1117             TP_printk("c=%p ab=%08x",
1118                       __entry->call,
1119                       __entry->abort_code)
1120             );
1121
1122 TRACE_EVENT(rxrpc_improper_term,
1123             TP_PROTO(struct rxrpc_call *call),
1124
1125             TP_ARGS(call),
1126
1127             TP_STRUCT__entry(
1128                     __field(struct rxrpc_call *,        call            )
1129                     __field(u32,                        abort_code      )
1130                              ),
1131
1132             TP_fast_assign(
1133                     __entry->call = call;
1134                     __entry->abort_code = call->abort_code;
1135                            ),
1136
1137             TP_printk("c=%p ab=%08x",
1138                       __entry->call,
1139                       __entry->abort_code)
1140             );
1141
1142 TRACE_EVENT(rxrpc_rx_eproto,
1143             TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
1144                      const char *why),
1145
1146             TP_ARGS(call, serial, why),
1147
1148             TP_STRUCT__entry(
1149                     __field(struct rxrpc_call *,        call            )
1150                     __field(rxrpc_serial_t,             serial          )
1151                     __field(const char *,               why             )
1152                              ),
1153
1154             TP_fast_assign(
1155                     __entry->call = call;
1156                     __entry->serial = serial;
1157                     __entry->why = why;
1158                            ),
1159
1160             TP_printk("c=%p EPROTO %08x %s",
1161                       __entry->call,
1162                       __entry->serial,
1163                       __entry->why)
1164             );
1165
1166 TRACE_EVENT(rxrpc_connect_call,
1167             TP_PROTO(struct rxrpc_call *call),
1168
1169             TP_ARGS(call),
1170
1171             TP_STRUCT__entry(
1172                     __field(struct rxrpc_call *,        call            )
1173                     __field(unsigned long,              user_call_ID    )
1174                     __field(u32,                        cid             )
1175                     __field(u32,                        call_id         )
1176                              ),
1177
1178             TP_fast_assign(
1179                     __entry->call = call;
1180                     __entry->user_call_ID = call->user_call_ID;
1181                     __entry->cid = call->cid;
1182                     __entry->call_id = call->call_id;
1183                            ),
1184
1185             TP_printk("c=%p u=%p %08x:%08x",
1186                       __entry->call,
1187                       (void *)__entry->user_call_ID,
1188                       __entry->cid,
1189                       __entry->call_id)
1190             );
1191
1192 #endif /* _TRACE_RXRPC_H */
1193
1194 /* This part must be outside protection */
1195 #include <trace/define_trace.h>