39123c06a5661316a80dd677b43b1e581a17e2e7
[platform/kernel/linux-exynos.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_tx_data,
687             TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
688                      rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
689
690             TP_ARGS(call, seq, serial, flags, retrans, lose),
691
692             TP_STRUCT__entry(
693                     __field(struct rxrpc_call *,        call            )
694                     __field(rxrpc_seq_t,                seq             )
695                     __field(rxrpc_serial_t,             serial          )
696                     __field(u8,                         flags           )
697                     __field(bool,                       retrans         )
698                     __field(bool,                       lose            )
699                              ),
700
701             TP_fast_assign(
702                     __entry->call = call;
703                     __entry->seq = seq;
704                     __entry->serial = serial;
705                     __entry->flags = flags;
706                     __entry->retrans = retrans;
707                     __entry->lose = lose;
708                            ),
709
710             TP_printk("c=%p DATA %08x q=%08x fl=%02x%s%s",
711                       __entry->call,
712                       __entry->serial,
713                       __entry->seq,
714                       __entry->flags,
715                       __entry->retrans ? " *RETRANS*" : "",
716                       __entry->lose ? " *LOSE*" : "")
717             );
718
719 TRACE_EVENT(rxrpc_tx_ack,
720             TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
721                      rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial,
722                      u8 reason, u8 n_acks),
723
724             TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks),
725
726             TP_STRUCT__entry(
727                     __field(struct rxrpc_call *,        call            )
728                     __field(rxrpc_serial_t,             serial          )
729                     __field(rxrpc_seq_t,                ack_first       )
730                     __field(rxrpc_serial_t,             ack_serial      )
731                     __field(u8,                         reason          )
732                     __field(u8,                         n_acks          )
733                              ),
734
735             TP_fast_assign(
736                     __entry->call = call;
737                     __entry->serial = serial;
738                     __entry->ack_first = ack_first;
739                     __entry->ack_serial = ack_serial;
740                     __entry->reason = reason;
741                     __entry->n_acks = n_acks;
742                            ),
743
744             TP_printk(" c=%p ACK  %08x %s f=%08x r=%08x n=%u",
745                       __entry->call,
746                       __entry->serial,
747                       __print_symbolic(__entry->reason, rxrpc_ack_names),
748                       __entry->ack_first,
749                       __entry->ack_serial,
750                       __entry->n_acks)
751             );
752
753 TRACE_EVENT(rxrpc_receive,
754             TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
755                      rxrpc_serial_t serial, rxrpc_seq_t seq),
756
757             TP_ARGS(call, why, serial, seq),
758
759             TP_STRUCT__entry(
760                     __field(struct rxrpc_call *,        call            )
761                     __field(enum rxrpc_receive_trace,   why             )
762                     __field(rxrpc_serial_t,             serial          )
763                     __field(rxrpc_seq_t,                seq             )
764                     __field(rxrpc_seq_t,                hard_ack        )
765                     __field(rxrpc_seq_t,                top             )
766                              ),
767
768             TP_fast_assign(
769                     __entry->call = call;
770                     __entry->why = why;
771                     __entry->serial = serial;
772                     __entry->seq = seq;
773                     __entry->hard_ack = call->rx_hard_ack;
774                     __entry->top = call->rx_top;
775                            ),
776
777             TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
778                       __entry->call,
779                       __print_symbolic(__entry->why, rxrpc_receive_traces),
780                       __entry->serial,
781                       __entry->seq,
782                       __entry->hard_ack,
783                       __entry->top)
784             );
785
786 TRACE_EVENT(rxrpc_recvmsg,
787             TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
788                      rxrpc_seq_t seq, unsigned int offset, unsigned int len,
789                      int ret),
790
791             TP_ARGS(call, why, seq, offset, len, ret),
792
793             TP_STRUCT__entry(
794                     __field(struct rxrpc_call *,        call            )
795                     __field(enum rxrpc_recvmsg_trace,   why             )
796                     __field(rxrpc_seq_t,                seq             )
797                     __field(unsigned int,               offset          )
798                     __field(unsigned int,               len             )
799                     __field(int,                        ret             )
800                              ),
801
802             TP_fast_assign(
803                     __entry->call = call;
804                     __entry->why = why;
805                     __entry->seq = seq;
806                     __entry->offset = offset;
807                     __entry->len = len;
808                     __entry->ret = ret;
809                            ),
810
811             TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
812                       __entry->call,
813                       __print_symbolic(__entry->why, rxrpc_recvmsg_traces),
814                       __entry->seq,
815                       __entry->offset,
816                       __entry->len,
817                       __entry->ret)
818             );
819
820 TRACE_EVENT(rxrpc_rtt_tx,
821             TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
822                      rxrpc_serial_t send_serial),
823
824             TP_ARGS(call, why, send_serial),
825
826             TP_STRUCT__entry(
827                     __field(struct rxrpc_call *,        call            )
828                     __field(enum rxrpc_rtt_tx_trace,    why             )
829                     __field(rxrpc_serial_t,             send_serial     )
830                              ),
831
832             TP_fast_assign(
833                     __entry->call = call;
834                     __entry->why = why;
835                     __entry->send_serial = send_serial;
836                            ),
837
838             TP_printk("c=%p %s sr=%08x",
839                       __entry->call,
840                       __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
841                       __entry->send_serial)
842             );
843
844 TRACE_EVENT(rxrpc_rtt_rx,
845             TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
846                      rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
847                      s64 rtt, u8 nr, s64 avg),
848
849             TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
850
851             TP_STRUCT__entry(
852                     __field(struct rxrpc_call *,        call            )
853                     __field(enum rxrpc_rtt_rx_trace,    why             )
854                     __field(u8,                         nr              )
855                     __field(rxrpc_serial_t,             send_serial     )
856                     __field(rxrpc_serial_t,             resp_serial     )
857                     __field(s64,                        rtt             )
858                     __field(u64,                        avg             )
859                              ),
860
861             TP_fast_assign(
862                     __entry->call = call;
863                     __entry->why = why;
864                     __entry->send_serial = send_serial;
865                     __entry->resp_serial = resp_serial;
866                     __entry->rtt = rtt;
867                     __entry->nr = nr;
868                     __entry->avg = avg;
869                            ),
870
871             TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
872                       __entry->call,
873                       __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
874                       __entry->send_serial,
875                       __entry->resp_serial,
876                       __entry->rtt,
877                       __entry->nr,
878                       __entry->avg)
879             );
880
881 TRACE_EVENT(rxrpc_timer,
882             TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why,
883                      ktime_t now, unsigned long now_j),
884
885             TP_ARGS(call, why, now, now_j),
886
887             TP_STRUCT__entry(
888                     __field(struct rxrpc_call *,                call            )
889                     __field(enum rxrpc_timer_trace,             why             )
890                     __field_struct(ktime_t,                     now             )
891                     __field_struct(ktime_t,                     expire_at       )
892                     __field_struct(ktime_t,                     ack_at          )
893                     __field_struct(ktime_t,                     resend_at       )
894                     __field(unsigned long,                      now_j           )
895                     __field(unsigned long,                      timer           )
896                              ),
897
898             TP_fast_assign(
899                     __entry->call       = call;
900                     __entry->why        = why;
901                     __entry->now        = now;
902                     __entry->expire_at  = call->expire_at;
903                     __entry->ack_at     = call->ack_at;
904                     __entry->resend_at  = call->resend_at;
905                     __entry->now_j      = now_j;
906                     __entry->timer      = call->timer.expires;
907                            ),
908
909             TP_printk("c=%p %s x=%lld a=%lld r=%lld t=%ld",
910                       __entry->call,
911                       __print_symbolic(__entry->why, rxrpc_timer_traces),
912                       ktime_to_ns(ktime_sub(__entry->expire_at, __entry->now)),
913                       ktime_to_ns(ktime_sub(__entry->ack_at, __entry->now)),
914                       ktime_to_ns(ktime_sub(__entry->resend_at, __entry->now)),
915                       __entry->timer - __entry->now_j)
916             );
917
918 TRACE_EVENT(rxrpc_rx_lose,
919             TP_PROTO(struct rxrpc_skb_priv *sp),
920
921             TP_ARGS(sp),
922
923             TP_STRUCT__entry(
924                     __field_struct(struct rxrpc_host_header,    hdr             )
925                              ),
926
927             TP_fast_assign(
928                     memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
929                            ),
930
931             TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*",
932                       __entry->hdr.epoch, __entry->hdr.cid,
933                       __entry->hdr.callNumber, __entry->hdr.serviceId,
934                       __entry->hdr.serial, __entry->hdr.seq,
935                       __entry->hdr.type, __entry->hdr.flags,
936                       __entry->hdr.type <= 15 ?
937                       __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
938             );
939
940 TRACE_EVENT(rxrpc_propose_ack,
941             TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
942                      u8 ack_reason, rxrpc_serial_t serial, bool immediate,
943                      bool background, enum rxrpc_propose_ack_outcome outcome),
944
945             TP_ARGS(call, why, ack_reason, serial, immediate, background,
946                     outcome),
947
948             TP_STRUCT__entry(
949                     __field(struct rxrpc_call *,                call            )
950                     __field(enum rxrpc_propose_ack_trace,       why             )
951                     __field(rxrpc_serial_t,                     serial          )
952                     __field(u8,                                 ack_reason      )
953                     __field(bool,                               immediate       )
954                     __field(bool,                               background      )
955                     __field(enum rxrpc_propose_ack_outcome,     outcome         )
956                              ),
957
958             TP_fast_assign(
959                     __entry->call       = call;
960                     __entry->why        = why;
961                     __entry->serial     = serial;
962                     __entry->ack_reason = ack_reason;
963                     __entry->immediate  = immediate;
964                     __entry->background = background;
965                     __entry->outcome    = outcome;
966                            ),
967
968             TP_printk("c=%p %s %s r=%08x i=%u b=%u%s",
969                       __entry->call,
970                       __print_symbolic(__entry->why, rxrpc_propose_ack_traces),
971                       __print_symbolic(__entry->ack_reason, rxrpc_ack_names),
972                       __entry->serial,
973                       __entry->immediate,
974                       __entry->background,
975                       __print_symbolic(__entry->outcome, rxrpc_propose_ack_outcomes))
976             );
977
978 TRACE_EVENT(rxrpc_retransmit,
979             TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
980                      s64 expiry),
981
982             TP_ARGS(call, seq, annotation, expiry),
983
984             TP_STRUCT__entry(
985                     __field(struct rxrpc_call *,        call            )
986                     __field(rxrpc_seq_t,                seq             )
987                     __field(u8,                         annotation      )
988                     __field(s64,                        expiry          )
989                              ),
990
991             TP_fast_assign(
992                     __entry->call = call;
993                     __entry->seq = seq;
994                     __entry->annotation = annotation;
995                     __entry->expiry = expiry;
996                            ),
997
998             TP_printk("c=%p q=%x a=%02x xp=%lld",
999                       __entry->call,
1000                       __entry->seq,
1001                       __entry->annotation,
1002                       __entry->expiry)
1003             );
1004
1005 TRACE_EVENT(rxrpc_congest,
1006             TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary,
1007                      rxrpc_serial_t ack_serial, enum rxrpc_congest_change change),
1008
1009             TP_ARGS(call, summary, ack_serial, change),
1010
1011             TP_STRUCT__entry(
1012                     __field(struct rxrpc_call *,                call            )
1013                     __field(enum rxrpc_congest_change,          change          )
1014                     __field(rxrpc_seq_t,                        hard_ack        )
1015                     __field(rxrpc_seq_t,                        top             )
1016                     __field(rxrpc_seq_t,                        lowest_nak      )
1017                     __field(rxrpc_serial_t,                     ack_serial      )
1018                     __field_struct(struct rxrpc_ack_summary,    sum             )
1019                              ),
1020
1021             TP_fast_assign(
1022                     __entry->call       = call;
1023                     __entry->change     = change;
1024                     __entry->hard_ack   = call->tx_hard_ack;
1025                     __entry->top        = call->tx_top;
1026                     __entry->lowest_nak = call->acks_lowest_nak;
1027                     __entry->ack_serial = ack_serial;
1028                     memcpy(&__entry->sum, summary, sizeof(__entry->sum));
1029                            ),
1030
1031             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",
1032                       __entry->call,
1033                       __entry->ack_serial,
1034                       __print_symbolic(__entry->sum.ack_reason, rxrpc_ack_names),
1035                       __entry->hard_ack,
1036                       __print_symbolic(__entry->sum.mode, rxrpc_congest_modes),
1037                       __entry->sum.cwnd,
1038                       __entry->sum.ssthresh,
1039                       __entry->sum.nr_acks, __entry->sum.nr_nacks,
1040                       __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks,
1041                       __entry->sum.nr_rot_new_acks,
1042                       __entry->top - __entry->hard_ack,
1043                       __entry->sum.cumulative_acks,
1044                       __entry->sum.dup_acks,
1045                       __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "",
1046                       __print_symbolic(__entry->change, rxrpc_congest_changes),
1047                       __entry->sum.retrans_timeo ? " rTxTo" : "")
1048             );
1049
1050 TRACE_EVENT(rxrpc_disconnect_call,
1051             TP_PROTO(struct rxrpc_call *call),
1052
1053             TP_ARGS(call),
1054
1055             TP_STRUCT__entry(
1056                     __field(struct rxrpc_call *,        call            )
1057                     __field(u32,                        abort_code      )
1058                              ),
1059
1060             TP_fast_assign(
1061                     __entry->call = call;
1062                     __entry->abort_code = call->abort_code;
1063                            ),
1064
1065             TP_printk("c=%p ab=%08x",
1066                       __entry->call,
1067                       __entry->abort_code)
1068             );
1069
1070 TRACE_EVENT(rxrpc_improper_term,
1071             TP_PROTO(struct rxrpc_call *call),
1072
1073             TP_ARGS(call),
1074
1075             TP_STRUCT__entry(
1076                     __field(struct rxrpc_call *,        call            )
1077                     __field(u32,                        abort_code      )
1078                              ),
1079
1080             TP_fast_assign(
1081                     __entry->call = call;
1082                     __entry->abort_code = call->abort_code;
1083                            ),
1084
1085             TP_printk("c=%p ab=%08x",
1086                       __entry->call,
1087                       __entry->abort_code)
1088             );
1089
1090 #endif /* _TRACE_RXRPC_H */
1091
1092 /* This part must be outside protection */
1093 #include <trace/define_trace.h>