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