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