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