xref: /openbmc/linux/include/trace/events/rxrpc.h (revision b54a134a7de461f804cf0e28331d0a43ee82fb13)
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 			     ),
599 
600 	    TP_fast_assign(
601 		    __entry->call = call;
602 		    __entry->why = why;
603 		    __entry->tx_hard_ack = call->tx_hard_ack;
604 		    __entry->tx_top = call->tx_top;
605 			   ),
606 
607 	    TP_printk("c=%p %s f=%08x n=%u",
608 		      __entry->call,
609 		      __print_symbolic(__entry->why, rxrpc_transmit_traces),
610 		      __entry->tx_hard_ack + 1,
611 		      __entry->tx_top - __entry->tx_hard_ack)
612 	    );
613 
614 TRACE_EVENT(rxrpc_rx_ack,
615 	    TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first, u8 reason, u8 n_acks),
616 
617 	    TP_ARGS(call, first, reason, n_acks),
618 
619 	    TP_STRUCT__entry(
620 		    __field(struct rxrpc_call *,	call		)
621 		    __field(rxrpc_seq_t,		first		)
622 		    __field(u8,				reason		)
623 		    __field(u8,				n_acks		)
624 			     ),
625 
626 	    TP_fast_assign(
627 		    __entry->call = call;
628 		    __entry->first = first;
629 		    __entry->reason = reason;
630 		    __entry->n_acks = n_acks;
631 			   ),
632 
633 	    TP_printk("c=%p %s f=%08x n=%u",
634 		      __entry->call,
635 		      __print_symbolic(__entry->reason, rxrpc_ack_names),
636 		      __entry->first,
637 		      __entry->n_acks)
638 	    );
639 
640 TRACE_EVENT(rxrpc_tx_data,
641 	    TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
642 		     rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
643 
644 	    TP_ARGS(call, seq, serial, flags, retrans, lose),
645 
646 	    TP_STRUCT__entry(
647 		    __field(struct rxrpc_call *,	call		)
648 		    __field(rxrpc_seq_t,		seq		)
649 		    __field(rxrpc_serial_t,		serial		)
650 		    __field(u8,				flags		)
651 		    __field(bool,			retrans		)
652 		    __field(bool,			lose		)
653 			     ),
654 
655 	    TP_fast_assign(
656 		    __entry->call = call;
657 		    __entry->seq = seq;
658 		    __entry->serial = serial;
659 		    __entry->flags = flags;
660 		    __entry->retrans = retrans;
661 		    __entry->lose = lose;
662 			   ),
663 
664 	    TP_printk("c=%p DATA %08x q=%08x fl=%02x%s%s",
665 		      __entry->call,
666 		      __entry->serial,
667 		      __entry->seq,
668 		      __entry->flags,
669 		      __entry->retrans ? " *RETRANS*" : "",
670 		      __entry->lose ? " *LOSE*" : "")
671 	    );
672 
673 TRACE_EVENT(rxrpc_tx_ack,
674 	    TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
675 		     rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial,
676 		     u8 reason, u8 n_acks),
677 
678 	    TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks),
679 
680 	    TP_STRUCT__entry(
681 		    __field(struct rxrpc_call *,	call		)
682 		    __field(rxrpc_serial_t,		serial		)
683 		    __field(rxrpc_seq_t,		ack_first	)
684 		    __field(rxrpc_serial_t,		ack_serial	)
685 		    __field(u8,				reason		)
686 		    __field(u8,				n_acks		)
687 			     ),
688 
689 	    TP_fast_assign(
690 		    __entry->call = call;
691 		    __entry->serial = serial;
692 		    __entry->ack_first = ack_first;
693 		    __entry->ack_serial = ack_serial;
694 		    __entry->reason = reason;
695 		    __entry->n_acks = n_acks;
696 			   ),
697 
698 	    TP_printk(" c=%p ACK  %08x %s f=%08x r=%08x n=%u",
699 		      __entry->call,
700 		      __entry->serial,
701 		      __print_symbolic(__entry->reason, rxrpc_ack_names),
702 		      __entry->ack_first,
703 		      __entry->ack_serial,
704 		      __entry->n_acks)
705 	    );
706 
707 TRACE_EVENT(rxrpc_receive,
708 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
709 		     rxrpc_serial_t serial, rxrpc_seq_t seq),
710 
711 	    TP_ARGS(call, why, serial, seq),
712 
713 	    TP_STRUCT__entry(
714 		    __field(struct rxrpc_call *,	call		)
715 		    __field(enum rxrpc_receive_trace,	why		)
716 		    __field(rxrpc_serial_t,		serial		)
717 		    __field(rxrpc_seq_t,		seq		)
718 		    __field(rxrpc_seq_t,		hard_ack	)
719 		    __field(rxrpc_seq_t,		top		)
720 			     ),
721 
722 	    TP_fast_assign(
723 		    __entry->call = call;
724 		    __entry->why = why;
725 		    __entry->serial = serial;
726 		    __entry->seq = seq;
727 		    __entry->hard_ack = call->rx_hard_ack;
728 		    __entry->top = call->rx_top;
729 			   ),
730 
731 	    TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x",
732 		      __entry->call,
733 		      __print_symbolic(__entry->why, rxrpc_receive_traces),
734 		      __entry->serial,
735 		      __entry->seq,
736 		      __entry->hard_ack,
737 		      __entry->top)
738 	    );
739 
740 TRACE_EVENT(rxrpc_recvmsg,
741 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
742 		     rxrpc_seq_t seq, unsigned int offset, unsigned int len,
743 		     int ret),
744 
745 	    TP_ARGS(call, why, seq, offset, len, ret),
746 
747 	    TP_STRUCT__entry(
748 		    __field(struct rxrpc_call *,	call		)
749 		    __field(enum rxrpc_recvmsg_trace,	why		)
750 		    __field(rxrpc_seq_t,		seq		)
751 		    __field(unsigned int,		offset		)
752 		    __field(unsigned int,		len		)
753 		    __field(int,			ret		)
754 			     ),
755 
756 	    TP_fast_assign(
757 		    __entry->call = call;
758 		    __entry->why = why;
759 		    __entry->seq = seq;
760 		    __entry->offset = offset;
761 		    __entry->len = len;
762 		    __entry->ret = ret;
763 			   ),
764 
765 	    TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d",
766 		      __entry->call,
767 		      __print_symbolic(__entry->why, rxrpc_recvmsg_traces),
768 		      __entry->seq,
769 		      __entry->offset,
770 		      __entry->len,
771 		      __entry->ret)
772 	    );
773 
774 TRACE_EVENT(rxrpc_rtt_tx,
775 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
776 		     rxrpc_serial_t send_serial),
777 
778 	    TP_ARGS(call, why, send_serial),
779 
780 	    TP_STRUCT__entry(
781 		    __field(struct rxrpc_call *,	call		)
782 		    __field(enum rxrpc_rtt_tx_trace,	why		)
783 		    __field(rxrpc_serial_t,		send_serial	)
784 			     ),
785 
786 	    TP_fast_assign(
787 		    __entry->call = call;
788 		    __entry->why = why;
789 		    __entry->send_serial = send_serial;
790 			   ),
791 
792 	    TP_printk("c=%p %s sr=%08x",
793 		      __entry->call,
794 		      __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
795 		      __entry->send_serial)
796 	    );
797 
798 TRACE_EVENT(rxrpc_rtt_rx,
799 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
800 		     rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
801 		     s64 rtt, u8 nr, s64 avg),
802 
803 	    TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),
804 
805 	    TP_STRUCT__entry(
806 		    __field(struct rxrpc_call *,	call		)
807 		    __field(enum rxrpc_rtt_rx_trace,	why		)
808 		    __field(u8,				nr		)
809 		    __field(rxrpc_serial_t,		send_serial	)
810 		    __field(rxrpc_serial_t,		resp_serial	)
811 		    __field(s64,			rtt		)
812 		    __field(u64,			avg		)
813 			     ),
814 
815 	    TP_fast_assign(
816 		    __entry->call = call;
817 		    __entry->why = why;
818 		    __entry->send_serial = send_serial;
819 		    __entry->resp_serial = resp_serial;
820 		    __entry->rtt = rtt;
821 		    __entry->nr = nr;
822 		    __entry->avg = avg;
823 			   ),
824 
825 	    TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
826 		      __entry->call,
827 		      __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
828 		      __entry->send_serial,
829 		      __entry->resp_serial,
830 		      __entry->rtt,
831 		      __entry->nr,
832 		      __entry->avg)
833 	    );
834 
835 TRACE_EVENT(rxrpc_timer,
836 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why,
837 		     ktime_t now, unsigned long now_j),
838 
839 	    TP_ARGS(call, why, now, now_j),
840 
841 	    TP_STRUCT__entry(
842 		    __field(struct rxrpc_call *,		call		)
843 		    __field(enum rxrpc_timer_trace,		why		)
844 		    __field_struct(ktime_t,			now		)
845 		    __field_struct(ktime_t,			expire_at	)
846 		    __field_struct(ktime_t,			ack_at		)
847 		    __field_struct(ktime_t,			resend_at	)
848 		    __field(unsigned long,			now_j		)
849 		    __field(unsigned long,			timer		)
850 			     ),
851 
852 	    TP_fast_assign(
853 		    __entry->call	= call;
854 		    __entry->why	= why;
855 		    __entry->now	= now;
856 		    __entry->expire_at	= call->expire_at;
857 		    __entry->ack_at	= call->ack_at;
858 		    __entry->resend_at	= call->resend_at;
859 		    __entry->now_j	= now_j;
860 		    __entry->timer	= call->timer.expires;
861 			   ),
862 
863 	    TP_printk("c=%p %s x=%lld a=%lld r=%lld t=%ld",
864 		      __entry->call,
865 		      __print_symbolic(__entry->why, rxrpc_timer_traces),
866 		      ktime_to_ns(ktime_sub(__entry->expire_at, __entry->now)),
867 		      ktime_to_ns(ktime_sub(__entry->ack_at, __entry->now)),
868 		      ktime_to_ns(ktime_sub(__entry->resend_at, __entry->now)),
869 		      __entry->timer - __entry->now_j)
870 	    );
871 
872 TRACE_EVENT(rxrpc_rx_lose,
873 	    TP_PROTO(struct rxrpc_skb_priv *sp),
874 
875 	    TP_ARGS(sp),
876 
877 	    TP_STRUCT__entry(
878 		    __field_struct(struct rxrpc_host_header,	hdr		)
879 			     ),
880 
881 	    TP_fast_assign(
882 		    memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
883 			   ),
884 
885 	    TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*",
886 		      __entry->hdr.epoch, __entry->hdr.cid,
887 		      __entry->hdr.callNumber, __entry->hdr.serviceId,
888 		      __entry->hdr.serial, __entry->hdr.seq,
889 		      __entry->hdr.type, __entry->hdr.flags,
890 		      __entry->hdr.type <= 15 ?
891 		      __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
892 	    );
893 
894 TRACE_EVENT(rxrpc_propose_ack,
895 	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
896 		     u8 ack_reason, rxrpc_serial_t serial, bool immediate,
897 		     bool background, enum rxrpc_propose_ack_outcome outcome),
898 
899 	    TP_ARGS(call, why, ack_reason, serial, immediate, background,
900 		    outcome),
901 
902 	    TP_STRUCT__entry(
903 		    __field(struct rxrpc_call *,		call		)
904 		    __field(enum rxrpc_propose_ack_trace,	why		)
905 		    __field(rxrpc_serial_t,			serial		)
906 		    __field(u8,					ack_reason	)
907 		    __field(bool,				immediate	)
908 		    __field(bool,				background	)
909 		    __field(enum rxrpc_propose_ack_outcome,	outcome		)
910 			     ),
911 
912 	    TP_fast_assign(
913 		    __entry->call	= call;
914 		    __entry->why	= why;
915 		    __entry->serial	= serial;
916 		    __entry->ack_reason	= ack_reason;
917 		    __entry->immediate	= immediate;
918 		    __entry->background	= background;
919 		    __entry->outcome	= outcome;
920 			   ),
921 
922 	    TP_printk("c=%p %s %s r=%08x i=%u b=%u%s",
923 		      __entry->call,
924 		      __print_symbolic(__entry->why, rxrpc_propose_ack_traces),
925 		      __print_symbolic(__entry->ack_reason, rxrpc_ack_names),
926 		      __entry->serial,
927 		      __entry->immediate,
928 		      __entry->background,
929 		      __print_symbolic(__entry->outcome, rxrpc_propose_ack_outcomes))
930 	    );
931 
932 TRACE_EVENT(rxrpc_retransmit,
933 	    TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
934 		     s64 expiry),
935 
936 	    TP_ARGS(call, seq, annotation, expiry),
937 
938 	    TP_STRUCT__entry(
939 		    __field(struct rxrpc_call *,	call		)
940 		    __field(rxrpc_seq_t,		seq		)
941 		    __field(u8,				annotation	)
942 		    __field(s64,			expiry		)
943 			     ),
944 
945 	    TP_fast_assign(
946 		    __entry->call = call;
947 		    __entry->seq = seq;
948 		    __entry->annotation = annotation;
949 		    __entry->expiry = expiry;
950 			   ),
951 
952 	    TP_printk("c=%p q=%x a=%02x xp=%lld",
953 		      __entry->call,
954 		      __entry->seq,
955 		      __entry->annotation,
956 		      __entry->expiry)
957 	    );
958 
959 TRACE_EVENT(rxrpc_congest,
960 	    TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary,
961 		     rxrpc_serial_t ack_serial, enum rxrpc_congest_change change),
962 
963 	    TP_ARGS(call, summary, ack_serial, change),
964 
965 	    TP_STRUCT__entry(
966 		    __field(struct rxrpc_call *,		call		)
967 		    __field(enum rxrpc_congest_change,		change		)
968 		    __field(rxrpc_seq_t,			hard_ack	)
969 		    __field(rxrpc_seq_t,			top		)
970 		    __field(rxrpc_seq_t,			lowest_nak	)
971 		    __field(rxrpc_serial_t,			ack_serial	)
972 		    __field_struct(struct rxrpc_ack_summary,	sum		)
973 			     ),
974 
975 	    TP_fast_assign(
976 		    __entry->call	= call;
977 		    __entry->change	= change;
978 		    __entry->hard_ack	= call->tx_hard_ack;
979 		    __entry->top	= call->tx_top;
980 		    __entry->lowest_nak	= call->acks_lowest_nak;
981 		    __entry->ack_serial	= ack_serial;
982 		    memcpy(&__entry->sum, summary, sizeof(__entry->sum));
983 			   ),
984 
985 	    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",
986 		      __entry->call,
987 		      __entry->ack_serial,
988 		      __print_symbolic(__entry->sum.ack_reason, rxrpc_ack_names),
989 		      __entry->hard_ack,
990 		      __print_symbolic(__entry->sum.mode, rxrpc_congest_modes),
991 		      __entry->sum.cwnd,
992 		      __entry->sum.ssthresh,
993 		      __entry->sum.nr_acks, __entry->sum.nr_nacks,
994 		      __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks,
995 		      __entry->sum.nr_rot_new_acks,
996 		      __entry->top - __entry->hard_ack,
997 		      __entry->sum.cumulative_acks,
998 		      __entry->sum.dup_acks,
999 		      __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "",
1000 		      __print_symbolic(__entry->change, rxrpc_congest_changes),
1001 		      __entry->sum.retrans_timeo ? " rTxTo" : "")
1002 	    );
1003 
1004 #endif /* _TRACE_RXRPC_H */
1005 
1006 /* This part must be outside protection */
1007 #include <trace/define_trace.h>
1008