rxrpc.h 42.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* AF_RXRPC tracepoints
 *
 * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public Licence
 * as published by the Free Software Foundation; either version
 * 2 of the Licence, or (at your option) any later version.
 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM rxrpc

#if !defined(_TRACE_RXRPC_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_RXRPC_H

#include <linux/tracepoint.h>
18
#include <linux/errqueue.h>
19

20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
/*
 * Define enums for tracing information.
 *
 * These should all be kept sorted, making it easier to match the string
 * mapping tables further on.
 */
#ifndef __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY
#define __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY

enum rxrpc_skb_trace {
	rxrpc_skb_rx_cleaned,
	rxrpc_skb_rx_freed,
	rxrpc_skb_rx_got,
	rxrpc_skb_rx_lost,
	rxrpc_skb_rx_purged,
	rxrpc_skb_rx_received,
	rxrpc_skb_rx_rotated,
	rxrpc_skb_rx_seen,
	rxrpc_skb_tx_cleaned,
	rxrpc_skb_tx_freed,
	rxrpc_skb_tx_got,
	rxrpc_skb_tx_new,
	rxrpc_skb_tx_rotated,
	rxrpc_skb_tx_seen,
};

46 47 48 49 50 51 52 53
enum rxrpc_local_trace {
	rxrpc_local_got,
	rxrpc_local_new,
	rxrpc_local_processing,
	rxrpc_local_put,
	rxrpc_local_queued,
};

54 55 56 57 58 59 60 61
enum rxrpc_peer_trace {
	rxrpc_peer_got,
	rxrpc_peer_new,
	rxrpc_peer_processing,
	rxrpc_peer_put,
	rxrpc_peer_queued_error,
};

62 63 64 65 66 67 68
enum rxrpc_conn_trace {
	rxrpc_conn_got,
	rxrpc_conn_new_client,
	rxrpc_conn_new_service,
	rxrpc_conn_put_client,
	rxrpc_conn_put_service,
	rxrpc_conn_queued,
D
David Howells 已提交
69
	rxrpc_conn_reap_service,
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
	rxrpc_conn_seen,
};

enum rxrpc_client_trace {
	rxrpc_client_activate_chans,
	rxrpc_client_alloc,
	rxrpc_client_chan_activate,
	rxrpc_client_chan_disconnect,
	rxrpc_client_chan_pass,
	rxrpc_client_chan_unstarted,
	rxrpc_client_cleanup,
	rxrpc_client_count,
	rxrpc_client_discard,
	rxrpc_client_duplicate,
	rxrpc_client_exposed,
	rxrpc_client_replace,
	rxrpc_client_to_active,
	rxrpc_client_to_culled,
	rxrpc_client_to_idle,
	rxrpc_client_to_inactive,
	rxrpc_client_to_upgrade,
	rxrpc_client_to_waiting,
	rxrpc_client_uncount,
};

enum rxrpc_call_trace {
	rxrpc_call_connected,
	rxrpc_call_error,
	rxrpc_call_got,
	rxrpc_call_got_kernel,
	rxrpc_call_got_userid,
	rxrpc_call_new_client,
	rxrpc_call_new_service,
	rxrpc_call_put,
	rxrpc_call_put_kernel,
	rxrpc_call_put_noqueue,
	rxrpc_call_put_userid,
	rxrpc_call_queued,
	rxrpc_call_queued_ref,
	rxrpc_call_release,
	rxrpc_call_seen,
};

enum rxrpc_transmit_trace {
	rxrpc_transmit_await_reply,
	rxrpc_transmit_end,
	rxrpc_transmit_queue,
	rxrpc_transmit_queue_last,
	rxrpc_transmit_rotate,
	rxrpc_transmit_rotate_last,
	rxrpc_transmit_wait,
};

enum rxrpc_receive_trace {
	rxrpc_receive_end,
	rxrpc_receive_front,
	rxrpc_receive_incoming,
	rxrpc_receive_queue,
	rxrpc_receive_queue_last,
	rxrpc_receive_rotate,
};

enum rxrpc_recvmsg_trace {
	rxrpc_recvmsg_cont,
	rxrpc_recvmsg_data_return,
	rxrpc_recvmsg_dequeue,
	rxrpc_recvmsg_enter,
	rxrpc_recvmsg_full,
	rxrpc_recvmsg_hole,
	rxrpc_recvmsg_next,
140
	rxrpc_recvmsg_requeue,
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
	rxrpc_recvmsg_return,
	rxrpc_recvmsg_terminal,
	rxrpc_recvmsg_to_be_accepted,
	rxrpc_recvmsg_wait,
};

enum rxrpc_rtt_tx_trace {
	rxrpc_rtt_tx_data,
	rxrpc_rtt_tx_ping,
};

enum rxrpc_rtt_rx_trace {
	rxrpc_rtt_rx_ping_response,
	rxrpc_rtt_rx_requested_ack,
};

enum rxrpc_timer_trace {
	rxrpc_timer_begin,
D
David Howells 已提交
159 160 161
	rxrpc_timer_exp_ack,
	rxrpc_timer_exp_hard,
	rxrpc_timer_exp_idle,
D
David Howells 已提交
162
	rxrpc_timer_exp_keepalive,
163
	rxrpc_timer_exp_lost_ack,
D
David Howells 已提交
164 165 166
	rxrpc_timer_exp_normal,
	rxrpc_timer_exp_ping,
	rxrpc_timer_exp_resend,
167 168 169
	rxrpc_timer_expired,
	rxrpc_timer_init_for_reply,
	rxrpc_timer_init_for_send_reply,
D
David Howells 已提交
170
	rxrpc_timer_restart,
171
	rxrpc_timer_set_for_ack,
D
David Howells 已提交
172 173
	rxrpc_timer_set_for_hard,
	rxrpc_timer_set_for_idle,
D
David Howells 已提交
174
	rxrpc_timer_set_for_keepalive,
175
	rxrpc_timer_set_for_lost_ack,
D
David Howells 已提交
176
	rxrpc_timer_set_for_normal,
177 178 179 180 181 182 183 184
	rxrpc_timer_set_for_ping,
	rxrpc_timer_set_for_resend,
	rxrpc_timer_set_for_send,
};

enum rxrpc_propose_ack_trace {
	rxrpc_propose_ack_client_tx_end,
	rxrpc_propose_ack_input_data,
D
David Howells 已提交
185
	rxrpc_propose_ack_ping_for_keepalive,
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
	rxrpc_propose_ack_ping_for_lost_ack,
	rxrpc_propose_ack_ping_for_lost_reply,
	rxrpc_propose_ack_ping_for_params,
	rxrpc_propose_ack_processing_op,
	rxrpc_propose_ack_respond_to_ack,
	rxrpc_propose_ack_respond_to_ping,
	rxrpc_propose_ack_retry_tx,
	rxrpc_propose_ack_rotate_rx,
	rxrpc_propose_ack_terminal_ack,
};

enum rxrpc_propose_ack_outcome {
	rxrpc_propose_ack_subsume,
	rxrpc_propose_ack_update,
	rxrpc_propose_ack_use,
};

enum rxrpc_congest_change {
	rxrpc_cong_begin_retransmission,
	rxrpc_cong_cleared_nacks,
	rxrpc_cong_new_low_nack,
	rxrpc_cong_no_change,
	rxrpc_cong_progress,
	rxrpc_cong_retransmit_again,
	rxrpc_cong_rtt_window_end,
	rxrpc_cong_saw_nack,
};

D
David Howells 已提交
214 215 216 217 218 219 220 221 222 223 224 225
enum rxrpc_tx_point {
	rxrpc_tx_point_call_abort,
	rxrpc_tx_point_call_ack,
	rxrpc_tx_point_call_data_frag,
	rxrpc_tx_point_call_data_nofrag,
	rxrpc_tx_point_call_final_resend,
	rxrpc_tx_point_conn_abort,
	rxrpc_tx_point_rxkad_challenge,
	rxrpc_tx_point_rxkad_response,
	rxrpc_tx_point_reject,
	rxrpc_tx_point_version_keepalive,
	rxrpc_tx_point_version_reply,
226 227
};

228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
#endif /* end __RXRPC_DECLARE_TRACE_ENUMS_ONCE_ONLY */

/*
 * Declare tracing information enums and their string mappings for display.
 */
#define rxrpc_skb_traces \
	EM(rxrpc_skb_rx_cleaned,		"Rx CLN") \
	EM(rxrpc_skb_rx_freed,			"Rx FRE") \
	EM(rxrpc_skb_rx_got,			"Rx GOT") \
	EM(rxrpc_skb_rx_lost,			"Rx *L*") \
	EM(rxrpc_skb_rx_purged,			"Rx PUR") \
	EM(rxrpc_skb_rx_received,		"Rx RCV") \
	EM(rxrpc_skb_rx_rotated,		"Rx ROT") \
	EM(rxrpc_skb_rx_seen,			"Rx SEE") \
	EM(rxrpc_skb_tx_cleaned,		"Tx CLN") \
	EM(rxrpc_skb_tx_freed,			"Tx FRE") \
	EM(rxrpc_skb_tx_got,			"Tx GOT") \
	EM(rxrpc_skb_tx_new,			"Tx NEW") \
	EM(rxrpc_skb_tx_rotated,		"Tx ROT") \
	E_(rxrpc_skb_tx_seen,			"Tx SEE")

249 250 251 252 253 254 255
#define rxrpc_local_traces \
	EM(rxrpc_local_got,			"GOT") \
	EM(rxrpc_local_new,			"NEW") \
	EM(rxrpc_local_processing,		"PRO") \
	EM(rxrpc_local_put,			"PUT") \
	E_(rxrpc_local_queued,			"QUE")

256 257 258 259 260 261 262
#define rxrpc_peer_traces \
	EM(rxrpc_peer_got,			"GOT") \
	EM(rxrpc_peer_new,			"NEW") \
	EM(rxrpc_peer_processing,		"PRO") \
	EM(rxrpc_peer_put,			"PUT") \
	E_(rxrpc_peer_queued_error,		"QER")

263 264 265 266 267 268 269
#define rxrpc_conn_traces \
	EM(rxrpc_conn_got,			"GOT") \
	EM(rxrpc_conn_new_client,		"NWc") \
	EM(rxrpc_conn_new_service,		"NWs") \
	EM(rxrpc_conn_put_client,		"PTc") \
	EM(rxrpc_conn_put_service,		"PTs") \
	EM(rxrpc_conn_queued,			"QUE") \
D
David Howells 已提交
270
	EM(rxrpc_conn_reap_service,		"RPs") \
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
	E_(rxrpc_conn_seen,			"SEE")

#define rxrpc_client_traces \
	EM(rxrpc_client_activate_chans,		"Activa") \
	EM(rxrpc_client_alloc,			"Alloc ") \
	EM(rxrpc_client_chan_activate,		"ChActv") \
	EM(rxrpc_client_chan_disconnect,	"ChDisc") \
	EM(rxrpc_client_chan_pass,		"ChPass") \
	EM(rxrpc_client_chan_unstarted,		"ChUnst") \
	EM(rxrpc_client_cleanup,		"Clean ") \
	EM(rxrpc_client_count,			"Count ") \
	EM(rxrpc_client_discard,		"Discar") \
	EM(rxrpc_client_duplicate,		"Duplic") \
	EM(rxrpc_client_exposed,		"Expose") \
	EM(rxrpc_client_replace,		"Replac") \
	EM(rxrpc_client_to_active,		"->Actv") \
	EM(rxrpc_client_to_culled,		"->Cull") \
	EM(rxrpc_client_to_idle,		"->Idle") \
	EM(rxrpc_client_to_inactive,		"->Inac") \
	EM(rxrpc_client_to_upgrade,		"->Upgd") \
	EM(rxrpc_client_to_waiting,		"->Wait") \
	E_(rxrpc_client_uncount,		"Uncoun")

#define rxrpc_conn_cache_states \
	EM(RXRPC_CONN_CLIENT_INACTIVE,		"Inac") \
	EM(RXRPC_CONN_CLIENT_WAITING,		"Wait") \
	EM(RXRPC_CONN_CLIENT_ACTIVE,		"Actv") \
298
	EM(RXRPC_CONN_CLIENT_UPGRADE,		"Upgd") \
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
	EM(RXRPC_CONN_CLIENT_CULLED,		"Cull") \
	E_(RXRPC_CONN_CLIENT_IDLE,		"Idle") \

#define rxrpc_call_traces \
	EM(rxrpc_call_connected,		"CON") \
	EM(rxrpc_call_error,			"*E*") \
	EM(rxrpc_call_got,			"GOT") \
	EM(rxrpc_call_got_kernel,		"Gke") \
	EM(rxrpc_call_got_userid,		"Gus") \
	EM(rxrpc_call_new_client,		"NWc") \
	EM(rxrpc_call_new_service,		"NWs") \
	EM(rxrpc_call_put,			"PUT") \
	EM(rxrpc_call_put_kernel,		"Pke") \
	EM(rxrpc_call_put_noqueue,		"PNQ") \
	EM(rxrpc_call_put_userid,		"Pus") \
	EM(rxrpc_call_queued,			"QUE") \
	EM(rxrpc_call_queued_ref,		"QUR") \
	EM(rxrpc_call_release,			"RLS") \
	E_(rxrpc_call_seen,			"SEE")

#define rxrpc_transmit_traces \
	EM(rxrpc_transmit_await_reply,		"AWR") \
	EM(rxrpc_transmit_end,			"END") \
	EM(rxrpc_transmit_queue,		"QUE") \
	EM(rxrpc_transmit_queue_last,		"QLS") \
	EM(rxrpc_transmit_rotate,		"ROT") \
	EM(rxrpc_transmit_rotate_last,		"RLS") \
	E_(rxrpc_transmit_wait,			"WAI")

#define rxrpc_receive_traces \
	EM(rxrpc_receive_end,			"END") \
	EM(rxrpc_receive_front,			"FRN") \
	EM(rxrpc_receive_incoming,		"INC") \
	EM(rxrpc_receive_queue,			"QUE") \
	EM(rxrpc_receive_queue_last,		"QLS") \
	E_(rxrpc_receive_rotate,		"ROT")

#define rxrpc_recvmsg_traces \
	EM(rxrpc_recvmsg_cont,			"CONT") \
	EM(rxrpc_recvmsg_data_return,		"DATA") \
	EM(rxrpc_recvmsg_dequeue,		"DEQU") \
	EM(rxrpc_recvmsg_enter,			"ENTR") \
	EM(rxrpc_recvmsg_full,			"FULL") \
	EM(rxrpc_recvmsg_hole,			"HOLE") \
	EM(rxrpc_recvmsg_next,			"NEXT") \
344
	EM(rxrpc_recvmsg_requeue,		"REQU") \
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
	EM(rxrpc_recvmsg_return,		"RETN") \
	EM(rxrpc_recvmsg_terminal,		"TERM") \
	EM(rxrpc_recvmsg_to_be_accepted,	"TBAC") \
	E_(rxrpc_recvmsg_wait,			"WAIT")

#define rxrpc_rtt_tx_traces \
	EM(rxrpc_rtt_tx_data,			"DATA") \
	E_(rxrpc_rtt_tx_ping,			"PING")

#define rxrpc_rtt_rx_traces \
	EM(rxrpc_rtt_rx_ping_response,		"PONG") \
	E_(rxrpc_rtt_rx_requested_ack,		"RACK")

#define rxrpc_timer_traces \
	EM(rxrpc_timer_begin,			"Begin ") \
	EM(rxrpc_timer_expired,			"*EXPR*") \
D
David Howells 已提交
361 362 363
	EM(rxrpc_timer_exp_ack,			"ExpAck") \
	EM(rxrpc_timer_exp_hard,		"ExpHrd") \
	EM(rxrpc_timer_exp_idle,		"ExpIdl") \
D
David Howells 已提交
364
	EM(rxrpc_timer_exp_keepalive,		"ExpKA ") \
365
	EM(rxrpc_timer_exp_lost_ack,		"ExpLoA") \
D
David Howells 已提交
366 367 368
	EM(rxrpc_timer_exp_normal,		"ExpNml") \
	EM(rxrpc_timer_exp_ping,		"ExpPng") \
	EM(rxrpc_timer_exp_resend,		"ExpRsn") \
369 370
	EM(rxrpc_timer_init_for_reply,		"IniRpl") \
	EM(rxrpc_timer_init_for_send_reply,	"SndRpl") \
D
David Howells 已提交
371
	EM(rxrpc_timer_restart,			"Restrt") \
372
	EM(rxrpc_timer_set_for_ack,		"SetAck") \
D
David Howells 已提交
373 374
	EM(rxrpc_timer_set_for_hard,		"SetHrd") \
	EM(rxrpc_timer_set_for_idle,		"SetIdl") \
D
David Howells 已提交
375
	EM(rxrpc_timer_set_for_keepalive,	"KeepAl") \
376
	EM(rxrpc_timer_set_for_lost_ack,	"SetLoA") \
D
David Howells 已提交
377
	EM(rxrpc_timer_set_for_normal,		"SetNml") \
378 379
	EM(rxrpc_timer_set_for_ping,		"SetPng") \
	EM(rxrpc_timer_set_for_resend,		"SetRTx") \
D
David Howells 已提交
380
	E_(rxrpc_timer_set_for_send,		"SetSnd")
381 382 383 384

#define rxrpc_propose_ack_traces \
	EM(rxrpc_propose_ack_client_tx_end,	"ClTxEnd") \
	EM(rxrpc_propose_ack_input_data,	"DataIn ") \
D
David Howells 已提交
385
	EM(rxrpc_propose_ack_ping_for_keepalive, "KeepAlv") \
386 387 388 389 390 391 392 393 394 395 396 397 398
	EM(rxrpc_propose_ack_ping_for_lost_ack,	"LostAck") \
	EM(rxrpc_propose_ack_ping_for_lost_reply, "LostRpl") \
	EM(rxrpc_propose_ack_ping_for_params,	"Params ") \
	EM(rxrpc_propose_ack_processing_op,	"ProcOp ") \
	EM(rxrpc_propose_ack_respond_to_ack,	"Rsp2Ack") \
	EM(rxrpc_propose_ack_respond_to_ping,	"Rsp2Png") \
	EM(rxrpc_propose_ack_retry_tx,		"RetryTx") \
	EM(rxrpc_propose_ack_rotate_rx,		"RxAck  ") \
	E_(rxrpc_propose_ack_terminal_ack,	"ClTerm ")

#define rxrpc_propose_ack_outcomes \
	EM(rxrpc_propose_ack_subsume,		" Subsume") \
	EM(rxrpc_propose_ack_update,		" Update") \
399
	E_(rxrpc_propose_ack_use,		" New")
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447

#define rxrpc_congest_modes \
	EM(RXRPC_CALL_CONGEST_AVOIDANCE,	"CongAvoid") \
	EM(RXRPC_CALL_FAST_RETRANSMIT,		"FastReTx ") \
	EM(RXRPC_CALL_PACKET_LOSS,		"PktLoss  ") \
	E_(RXRPC_CALL_SLOW_START,		"SlowStart")

#define rxrpc_congest_changes \
	EM(rxrpc_cong_begin_retransmission,	" Retrans") \
	EM(rxrpc_cong_cleared_nacks,		" Cleared") \
	EM(rxrpc_cong_new_low_nack,		" NewLowN") \
	EM(rxrpc_cong_no_change,		"") \
	EM(rxrpc_cong_progress,			" Progres") \
	EM(rxrpc_cong_retransmit_again,		" ReTxAgn") \
	EM(rxrpc_cong_rtt_window_end,		" RttWinE") \
	E_(rxrpc_cong_saw_nack,			" SawNack")

#define rxrpc_pkts \
	EM(0,					"?00") \
	EM(RXRPC_PACKET_TYPE_DATA,		"DATA") \
	EM(RXRPC_PACKET_TYPE_ACK,		"ACK") \
	EM(RXRPC_PACKET_TYPE_BUSY,		"BUSY") \
	EM(RXRPC_PACKET_TYPE_ABORT,		"ABORT") \
	EM(RXRPC_PACKET_TYPE_ACKALL,		"ACKALL") \
	EM(RXRPC_PACKET_TYPE_CHALLENGE,		"CHALL") \
	EM(RXRPC_PACKET_TYPE_RESPONSE,		"RESP") \
	EM(RXRPC_PACKET_TYPE_DEBUG,		"DEBUG") \
	EM(9,					"?09") \
	EM(10,					"?10") \
	EM(11,					"?11") \
	EM(12,					"?12") \
	EM(RXRPC_PACKET_TYPE_VERSION,		"VERSION") \
	EM(14,					"?14") \
	E_(15,					"?15")

#define rxrpc_ack_names \
	EM(0,					"-0-") \
	EM(RXRPC_ACK_REQUESTED,			"REQ") \
	EM(RXRPC_ACK_DUPLICATE,			"DUP") \
	EM(RXRPC_ACK_OUT_OF_SEQUENCE,		"OOS") \
	EM(RXRPC_ACK_EXCEEDS_WINDOW,		"WIN") \
	EM(RXRPC_ACK_NOSPACE,			"MEM") \
	EM(RXRPC_ACK_PING,			"PNG") \
	EM(RXRPC_ACK_PING_RESPONSE,		"PNR") \
	EM(RXRPC_ACK_DELAY,			"DLY") \
	EM(RXRPC_ACK_IDLE,			"IDL") \
	E_(RXRPC_ACK__INVALID,			"-?-")

D
David Howells 已提交
448 449 450 451 452 453 454
#define rxrpc_completions \
	EM(RXRPC_CALL_SUCCEEDED,		"Succeeded") \
	EM(RXRPC_CALL_REMOTELY_ABORTED,		"RemoteAbort") \
	EM(RXRPC_CALL_LOCALLY_ABORTED,		"LocalAbort") \
	EM(RXRPC_CALL_LOCAL_ERROR,		"LocalError") \
	E_(RXRPC_CALL_NETWORK_ERROR,		"NetError")

D
David Howells 已提交
455 456 457 458 459 460 461 462 463 464 465 466
#define rxrpc_tx_points \
	EM(rxrpc_tx_point_call_abort,		"CallAbort") \
	EM(rxrpc_tx_point_call_ack,		"CallAck") \
	EM(rxrpc_tx_point_call_data_frag,	"CallDataFrag") \
	EM(rxrpc_tx_point_call_data_nofrag,	"CallDataNofrag") \
	EM(rxrpc_tx_point_call_final_resend,	"CallFinalResend") \
	EM(rxrpc_tx_point_conn_abort,		"ConnAbort") \
	EM(rxrpc_tx_point_reject,		"Reject") \
	EM(rxrpc_tx_point_rxkad_challenge,	"RxkadChall") \
	EM(rxrpc_tx_point_rxkad_response,	"RxkadResp") \
	EM(rxrpc_tx_point_version_keepalive,	"VerKeepalive") \
	E_(rxrpc_tx_point_version_reply,	"VerReply")
467

468 469 470 471 472 473 474 475 476
/*
 * Export enum symbols via userspace.
 */
#undef EM
#undef E_
#define EM(a, b) TRACE_DEFINE_ENUM(a);
#define E_(a, b) TRACE_DEFINE_ENUM(a);

rxrpc_skb_traces;
477
rxrpc_local_traces;
478 479 480 481 482 483 484 485 486 487 488
rxrpc_conn_traces;
rxrpc_client_traces;
rxrpc_call_traces;
rxrpc_transmit_traces;
rxrpc_receive_traces;
rxrpc_recvmsg_traces;
rxrpc_rtt_tx_traces;
rxrpc_rtt_rx_traces;
rxrpc_timer_traces;
rxrpc_propose_ack_traces;
rxrpc_propose_ack_outcomes;
D
David Howells 已提交
489
rxrpc_congest_modes;
490
rxrpc_congest_changes;
D
David Howells 已提交
491
rxrpc_tx_points;
492 493 494 495 496 497 498 499 500 501

/*
 * Now redefine the EM() and E_() macros to map the enums to the strings that
 * will be printed in the output.
 */
#undef EM
#undef E_
#define EM(a, b)	{ a, b },
#define E_(a, b)	{ a, b }

502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528
TRACE_EVENT(rxrpc_local,
	    TP_PROTO(struct rxrpc_local *local, enum rxrpc_local_trace op,
		     int usage, const void *where),

	    TP_ARGS(local, op, usage, where),

	    TP_STRUCT__entry(
		    __field(unsigned int,	local		)
		    __field(int,		op		)
		    __field(int,		usage		)
		    __field(const void *,	where		)
			     ),

	    TP_fast_assign(
		    __entry->local = local->debug_id;
		    __entry->op = op;
		    __entry->usage = usage;
		    __entry->where = where;
			   ),

	    TP_printk("L=%08x %s u=%d sp=%pSR",
		      __entry->local,
		      __print_symbolic(__entry->op, rxrpc_local_traces),
		      __entry->usage,
		      __entry->where)
	    );

529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555
TRACE_EVENT(rxrpc_peer,
	    TP_PROTO(struct rxrpc_peer *peer, enum rxrpc_peer_trace op,
		     int usage, const void *where),

	    TP_ARGS(peer, op, usage, where),

	    TP_STRUCT__entry(
		    __field(unsigned int,	peer		)
		    __field(int,		op		)
		    __field(int,		usage		)
		    __field(const void *,	where		)
			     ),

	    TP_fast_assign(
		    __entry->peer = peer->debug_id;
		    __entry->op = op;
		    __entry->usage = usage;
		    __entry->where = where;
			   ),

	    TP_printk("P=%08x %s u=%d sp=%pSR",
		      __entry->peer,
		      __print_symbolic(__entry->op, rxrpc_peer_traces),
		      __entry->usage,
		      __entry->where)
	    );

556 557 558 559 560 561 562
TRACE_EVENT(rxrpc_conn,
	    TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op,
		     int usage, const void *where),

	    TP_ARGS(conn, op, usage, where),

	    TP_STRUCT__entry(
563 564 565 566
		    __field(unsigned int,	conn		)
		    __field(int,		op		)
		    __field(int,		usage		)
		    __field(const void *,	where		)
567 568 569
			     ),

	    TP_fast_assign(
570
		    __entry->conn = conn->debug_id;
571 572 573 574 575
		    __entry->op = op;
		    __entry->usage = usage;
		    __entry->where = where;
			   ),

576
	    TP_printk("C=%08x %s u=%d sp=%pSR",
577
		      __entry->conn,
578
		      __print_symbolic(__entry->op, rxrpc_conn_traces),
579 580 581 582 583 584 585 586 587 588 589
		      __entry->usage,
		      __entry->where)
	    );

TRACE_EVENT(rxrpc_client,
	    TP_PROTO(struct rxrpc_connection *conn, int channel,
		     enum rxrpc_client_trace op),

	    TP_ARGS(conn, channel, op),

	    TP_STRUCT__entry(
590
		    __field(unsigned int,		conn		)
591 592 593 594 595 596 597 598
		    __field(u32,			cid		)
		    __field(int,			channel		)
		    __field(int,			usage		)
		    __field(enum rxrpc_client_trace,	op		)
		    __field(enum rxrpc_conn_cache_state, cs		)
			     ),

	    TP_fast_assign(
599
		    __entry->conn = conn->debug_id;
600 601 602 603 604 605 606
		    __entry->channel = channel;
		    __entry->usage = atomic_read(&conn->usage);
		    __entry->op = op;
		    __entry->cid = conn->proto.cid;
		    __entry->cs = conn->cache_state;
			   ),

607
	    TP_printk("C=%08x h=%2d %s %s i=%08x u=%d",
608 609
		      __entry->conn,
		      __entry->channel,
610 611
		      __print_symbolic(__entry->op, rxrpc_client_traces),
		      __print_symbolic(__entry->cs, rxrpc_conn_cache_states),
612 613 614 615
		      __entry->cid,
		      __entry->usage)
	    );

D
David Howells 已提交
616
TRACE_EVENT(rxrpc_call,
617
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op,
618
		     int usage, const void *where, const void *aux),
D
David Howells 已提交
619

620
	    TP_ARGS(call, op, usage, where, aux),
D
David Howells 已提交
621 622

	    TP_STRUCT__entry(
623
		    __field(unsigned int,		call		)
D
David Howells 已提交
624 625 626 627 628 629 630
		    __field(int,			op		)
		    __field(int,			usage		)
		    __field(const void *,		where		)
		    __field(const void *,		aux		)
			     ),

	    TP_fast_assign(
631
		    __entry->call = call->debug_id;
D
David Howells 已提交
632 633 634 635 636 637
		    __entry->op = op;
		    __entry->usage = usage;
		    __entry->where = where;
		    __entry->aux = aux;
			   ),

638
	    TP_printk("c=%08x %s u=%d sp=%pSR a=%p",
D
David Howells 已提交
639
		      __entry->call,
640
		      __print_symbolic(__entry->op, rxrpc_call_traces),
D
David Howells 已提交
641 642 643 644 645
		      __entry->usage,
		      __entry->where,
		      __entry->aux)
	    );

646
TRACE_EVENT(rxrpc_skb,
D
David Howells 已提交
647 648
	    TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op,
		     int usage, int mod_count, const void *where),
649 650 651 652 653

	    TP_ARGS(skb, op, usage, mod_count, where),

	    TP_STRUCT__entry(
		    __field(struct sk_buff *,		skb		)
D
David Howells 已提交
654
		    __field(enum rxrpc_skb_trace,	op		)
655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
		    __field(int,			usage		)
		    __field(int,			mod_count	)
		    __field(const void *,		where		)
			     ),

	    TP_fast_assign(
		    __entry->skb = skb;
		    __entry->op = op;
		    __entry->usage = usage;
		    __entry->mod_count = mod_count;
		    __entry->where = where;
			   ),

	    TP_printk("s=%p %s u=%d m=%d p=%pSR",
		      __entry->skb,
670
		      __print_symbolic(__entry->op, rxrpc_skb_traces),
671 672 673 674 675
		      __entry->usage,
		      __entry->mod_count,
		      __entry->where)
	    );

676 677 678 679 680 681 682 683 684 685 686 687 688
TRACE_EVENT(rxrpc_rx_packet,
	    TP_PROTO(struct rxrpc_skb_priv *sp),

	    TP_ARGS(sp),

	    TP_STRUCT__entry(
		    __field_struct(struct rxrpc_host_header,	hdr		)
			     ),

	    TP_fast_assign(
		    memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
			   ),

689
	    TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s",
690 691 692
		      __entry->hdr.epoch, __entry->hdr.cid,
		      __entry->hdr.callNumber, __entry->hdr.serviceId,
		      __entry->hdr.serial, __entry->hdr.seq,
693
		      __entry->hdr.type, __entry->hdr.flags,
694 695
		      __entry->hdr.type <= 15 ?
		      __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715
	    );

TRACE_EVENT(rxrpc_rx_done,
	    TP_PROTO(int result, int abort_code),

	    TP_ARGS(result, abort_code),

	    TP_STRUCT__entry(
		    __field(int,			result		)
		    __field(int,			abort_code	)
			     ),

	    TP_fast_assign(
		    __entry->result = result;
		    __entry->abort_code = abort_code;
			   ),

	    TP_printk("r=%d a=%d", __entry->result, __entry->abort_code)
	    );

716
TRACE_EVENT(rxrpc_abort,
717 718
	    TP_PROTO(unsigned int call_nr, const char *why, u32 cid, u32 call_id,
		     rxrpc_seq_t seq, int abort_code, int error),
719

720
	    TP_ARGS(call_nr, why, cid, call_id, seq, abort_code, error),
721 722

	    TP_STRUCT__entry(
723
		    __field(unsigned int,		call_nr		)
724 725 726 727 728 729 730 731 732 733
		    __array(char,			why, 4		)
		    __field(u32,			cid		)
		    __field(u32,			call_id		)
		    __field(rxrpc_seq_t,		seq		)
		    __field(int,			abort_code	)
		    __field(int,			error		)
			     ),

	    TP_fast_assign(
		    memcpy(__entry->why, why, 4);
734
		    __entry->call_nr = call_nr;
735 736 737 738 739 740 741
		    __entry->cid = cid;
		    __entry->call_id = call_id;
		    __entry->abort_code = abort_code;
		    __entry->error = error;
		    __entry->seq = seq;
			   ),

742 743
	    TP_printk("c=%08x %08x:%08x s=%u a=%d e=%d %s",
		      __entry->call_nr,
744 745 746 747
		      __entry->cid, __entry->call_id, __entry->seq,
		      __entry->abort_code, __entry->error, __entry->why)
	    );

D
David Howells 已提交
748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773
TRACE_EVENT(rxrpc_call_complete,
	    TP_PROTO(struct rxrpc_call *call),

	    TP_ARGS(call),

	    TP_STRUCT__entry(
		    __field(unsigned int,		call		)
		    __field(enum rxrpc_call_completion,	compl		)
		    __field(int,			error		)
		    __field(u32,			abort_code	)
			     ),

	    TP_fast_assign(
		    __entry->call = call->debug_id;
		    __entry->compl = call->completion;
		    __entry->error = call->error;
		    __entry->abort_code = call->abort_code;
			   ),

	    TP_printk("c=%08x %s r=%d ac=%d",
		      __entry->call,
		      __print_symbolic(__entry->compl, rxrpc_completions),
		      __entry->error,
		      __entry->abort_code)
	    );

774 775 776 777 778 779
TRACE_EVENT(rxrpc_transmit,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why),

	    TP_ARGS(call, why),

	    TP_STRUCT__entry(
780
		    __field(unsigned int,		call		)
781 782 783
		    __field(enum rxrpc_transmit_trace,	why		)
		    __field(rxrpc_seq_t,		tx_hard_ack	)
		    __field(rxrpc_seq_t,		tx_top		)
D
David Howells 已提交
784
		    __field(int,			tx_winsize	)
785 786 787
			     ),

	    TP_fast_assign(
788
		    __entry->call = call->debug_id;
789 790 791
		    __entry->why = why;
		    __entry->tx_hard_ack = call->tx_hard_ack;
		    __entry->tx_top = call->tx_top;
D
David Howells 已提交
792
		    __entry->tx_winsize = call->tx_winsize;
793 794
			   ),

795
	    TP_printk("c=%08x %s f=%08x n=%u/%u",
796
		      __entry->call,
797
		      __print_symbolic(__entry->why, rxrpc_transmit_traces),
798
		      __entry->tx_hard_ack + 1,
D
David Howells 已提交
799 800 801 802 803
		      __entry->tx_top - __entry->tx_hard_ack,
		      __entry->tx_winsize)
	    );

TRACE_EVENT(rxrpc_rx_data,
D
David Howells 已提交
804
	    TP_PROTO(unsigned int call, rxrpc_seq_t seq,
D
David Howells 已提交
805 806 807 808 809
		     rxrpc_serial_t serial, u8 flags, u8 anno),

	    TP_ARGS(call, seq, serial, flags, anno),

	    TP_STRUCT__entry(
810
		    __field(unsigned int,		call		)
D
David Howells 已提交
811 812 813 814 815 816 817
		    __field(rxrpc_seq_t,		seq		)
		    __field(rxrpc_serial_t,		serial		)
		    __field(u8,				flags		)
		    __field(u8,				anno		)
			     ),

	    TP_fast_assign(
D
David Howells 已提交
818
		    __entry->call = call;
D
David Howells 已提交
819 820 821 822 823 824
		    __entry->seq = seq;
		    __entry->serial = serial;
		    __entry->flags = flags;
		    __entry->anno = anno;
			   ),

825
	    TP_printk("c=%08x DATA %08x q=%08x fl=%02x a=%02x",
D
David Howells 已提交
826 827 828 829 830
		      __entry->call,
		      __entry->serial,
		      __entry->seq,
		      __entry->flags,
		      __entry->anno)
831 832
	    );

833
TRACE_EVENT(rxrpc_rx_ack,
D
David Howells 已提交
834 835 836
	    TP_PROTO(struct rxrpc_call *call,
		     rxrpc_serial_t serial, rxrpc_serial_t ack_serial,
		     rxrpc_seq_t first, rxrpc_seq_t prev, u8 reason, u8 n_acks),
837

D
David Howells 已提交
838
	    TP_ARGS(call, serial, ack_serial, first, prev, reason, n_acks),
839 840

	    TP_STRUCT__entry(
841
		    __field(unsigned int,		call		)
D
David Howells 已提交
842 843
		    __field(rxrpc_serial_t,		serial		)
		    __field(rxrpc_serial_t,		ack_serial	)
844
		    __field(rxrpc_seq_t,		first		)
D
David Howells 已提交
845
		    __field(rxrpc_seq_t,		prev		)
846 847 848 849 850
		    __field(u8,				reason		)
		    __field(u8,				n_acks		)
			     ),

	    TP_fast_assign(
851
		    __entry->call = call->debug_id;
D
David Howells 已提交
852 853
		    __entry->serial = serial;
		    __entry->ack_serial = ack_serial;
854
		    __entry->first = first;
D
David Howells 已提交
855
		    __entry->prev = prev;
856 857 858 859
		    __entry->reason = reason;
		    __entry->n_acks = n_acks;
			   ),

860
	    TP_printk("c=%08x %08x %s r=%08x f=%08x p=%08x n=%u",
861
		      __entry->call,
D
David Howells 已提交
862
		      __entry->serial,
863
		      __print_symbolic(__entry->reason, rxrpc_ack_names),
D
David Howells 已提交
864
		      __entry->ack_serial,
865
		      __entry->first,
D
David Howells 已提交
866
		      __entry->prev,
867 868 869
		      __entry->n_acks)
	    );

D
David Howells 已提交
870 871 872 873 874 875 876
TRACE_EVENT(rxrpc_rx_abort,
	    TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
		     u32 abort_code),

	    TP_ARGS(call, serial, abort_code),

	    TP_STRUCT__entry(
877
		    __field(unsigned int,		call		)
D
David Howells 已提交
878 879 880 881 882
		    __field(rxrpc_serial_t,		serial		)
		    __field(u32,			abort_code	)
			     ),

	    TP_fast_assign(
883
		    __entry->call = call->debug_id;
D
David Howells 已提交
884 885 886 887
		    __entry->serial = serial;
		    __entry->abort_code = abort_code;
			   ),

888
	    TP_printk("c=%08x ABORT %08x ac=%d",
D
David Howells 已提交
889 890 891 892 893
		      __entry->call,
		      __entry->serial,
		      __entry->abort_code)
	    );

894 895 896 897 898 899 900
TRACE_EVENT(rxrpc_rx_rwind_change,
	    TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
		     u32 rwind, bool wake),

	    TP_ARGS(call, serial, rwind, wake),

	    TP_STRUCT__entry(
901
		    __field(unsigned int,		call		)
902 903 904 905 906 907
		    __field(rxrpc_serial_t,		serial		)
		    __field(u32,			rwind		)
		    __field(bool,			wake		)
			     ),

	    TP_fast_assign(
908
		    __entry->call = call->debug_id;
909 910 911 912 913
		    __entry->serial = serial;
		    __entry->rwind = rwind;
		    __entry->wake = wake;
			   ),

914
	    TP_printk("c=%08x %08x rw=%u%s",
915 916 917 918 919 920
		      __entry->call,
		      __entry->serial,
		      __entry->rwind,
		      __entry->wake ? " wake" : "")
	    );

D
David Howells 已提交
921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
TRACE_EVENT(rxrpc_tx_packet,
	    TP_PROTO(unsigned int call_id, struct rxrpc_wire_header *whdr,
		     enum rxrpc_tx_point where),

	    TP_ARGS(call_id, whdr, where),

	    TP_STRUCT__entry(
		    __field(unsigned int,			call	)
		    __field(enum rxrpc_tx_point,		where	)
		    __field_struct(struct rxrpc_wire_header,	whdr	)
			     ),

	    TP_fast_assign(
		    __entry->call = call_id;
		    memcpy(&__entry->whdr, whdr, sizeof(__entry->whdr));
			   ),

	    TP_printk("c=%08x %08x:%08x:%08x:%04x %08x %08x %02x %02x %s %s",
		      __entry->call,
		      ntohl(__entry->whdr.epoch),
		      ntohl(__entry->whdr.cid),
		      ntohl(__entry->whdr.callNumber),
		      ntohs(__entry->whdr.serviceId),
		      ntohl(__entry->whdr.serial),
		      ntohl(__entry->whdr.seq),
		      __entry->whdr.type, __entry->whdr.flags,
		      __entry->whdr.type <= 15 ?
		      __print_symbolic(__entry->whdr.type, rxrpc_pkts) : "?UNK",
		      __print_symbolic(__entry->where, rxrpc_tx_points))
	    );

952 953
TRACE_EVENT(rxrpc_tx_data,
	    TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq,
954
		     rxrpc_serial_t serial, u8 flags, bool retrans, bool lose),
955

956
	    TP_ARGS(call, seq, serial, flags, retrans, lose),
957 958

	    TP_STRUCT__entry(
959
		    __field(unsigned int,		call		)
960 961
		    __field(rxrpc_seq_t,		seq		)
		    __field(rxrpc_serial_t,		serial		)
D
David Howells 已提交
962 963
		    __field(u32,			cid		)
		    __field(u32,			call_id		)
964
		    __field(u8,				flags		)
965
		    __field(bool,			retrans		)
966 967 968 969
		    __field(bool,			lose		)
			     ),

	    TP_fast_assign(
970
		    __entry->call = call->debug_id;
D
David Howells 已提交
971 972
		    __entry->cid = call->cid;
		    __entry->call_id = call->call_id;
973 974 975
		    __entry->seq = seq;
		    __entry->serial = serial;
		    __entry->flags = flags;
976
		    __entry->retrans = retrans;
977 978 979
		    __entry->lose = lose;
			   ),

D
David Howells 已提交
980
	    TP_printk("c=%08x DATA %08x:%08x %08x q=%08x fl=%02x%s%s",
981
		      __entry->call,
D
David Howells 已提交
982 983
		      __entry->cid,
		      __entry->call_id,
984 985 986
		      __entry->serial,
		      __entry->seq,
		      __entry->flags,
987
		      __entry->retrans ? " *RETRANS*" : "",
988 989 990
		      __entry->lose ? " *LOSE*" : "")
	    );

991
TRACE_EVENT(rxrpc_tx_ack,
D
David Howells 已提交
992
	    TP_PROTO(unsigned int call, rxrpc_serial_t serial,
993 994
		     rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial,
		     u8 reason, u8 n_acks),
995

996
	    TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks),
997 998

	    TP_STRUCT__entry(
999
		    __field(unsigned int,		call		)
1000
		    __field(rxrpc_serial_t,		serial		)
1001 1002
		    __field(rxrpc_seq_t,		ack_first	)
		    __field(rxrpc_serial_t,		ack_serial	)
1003 1004 1005 1006 1007
		    __field(u8,				reason		)
		    __field(u8,				n_acks		)
			     ),

	    TP_fast_assign(
D
David Howells 已提交
1008
		    __entry->call = call;
1009
		    __entry->serial = serial;
1010 1011
		    __entry->ack_first = ack_first;
		    __entry->ack_serial = ack_serial;
1012 1013 1014 1015
		    __entry->reason = reason;
		    __entry->n_acks = n_acks;
			   ),

1016
	    TP_printk(" c=%08x ACK  %08x %s f=%08x r=%08x n=%u",
1017 1018
		      __entry->call,
		      __entry->serial,
1019
		      __print_symbolic(__entry->reason, rxrpc_ack_names),
1020 1021
		      __entry->ack_first,
		      __entry->ack_serial,
1022 1023 1024
		      __entry->n_acks)
	    );

1025 1026 1027 1028 1029 1030 1031
TRACE_EVENT(rxrpc_receive,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why,
		     rxrpc_serial_t serial, rxrpc_seq_t seq),

	    TP_ARGS(call, why, serial, seq),

	    TP_STRUCT__entry(
1032
		    __field(unsigned int,		call		)
1033 1034 1035 1036 1037 1038 1039 1040
		    __field(enum rxrpc_receive_trace,	why		)
		    __field(rxrpc_serial_t,		serial		)
		    __field(rxrpc_seq_t,		seq		)
		    __field(rxrpc_seq_t,		hard_ack	)
		    __field(rxrpc_seq_t,		top		)
			     ),

	    TP_fast_assign(
1041
		    __entry->call = call->debug_id;
1042 1043 1044 1045 1046 1047 1048
		    __entry->why = why;
		    __entry->serial = serial;
		    __entry->seq = seq;
		    __entry->hard_ack = call->rx_hard_ack;
		    __entry->top = call->rx_top;
			   ),

1049
	    TP_printk("c=%08x %s r=%08x q=%08x w=%08x-%08x",
1050
		      __entry->call,
1051
		      __print_symbolic(__entry->why, rxrpc_receive_traces),
1052 1053 1054 1055 1056 1057
		      __entry->serial,
		      __entry->seq,
		      __entry->hard_ack,
		      __entry->top)
	    );

1058 1059 1060 1061 1062 1063 1064 1065
TRACE_EVENT(rxrpc_recvmsg,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why,
		     rxrpc_seq_t seq, unsigned int offset, unsigned int len,
		     int ret),

	    TP_ARGS(call, why, seq, offset, len, ret),

	    TP_STRUCT__entry(
1066
		    __field(unsigned int,		call		)
1067 1068 1069 1070 1071 1072 1073 1074
		    __field(enum rxrpc_recvmsg_trace,	why		)
		    __field(rxrpc_seq_t,		seq		)
		    __field(unsigned int,		offset		)
		    __field(unsigned int,		len		)
		    __field(int,			ret		)
			     ),

	    TP_fast_assign(
1075
		    __entry->call = call->debug_id;
1076 1077 1078 1079 1080 1081 1082
		    __entry->why = why;
		    __entry->seq = seq;
		    __entry->offset = offset;
		    __entry->len = len;
		    __entry->ret = ret;
			   ),

1083
	    TP_printk("c=%08x %s q=%08x o=%u l=%u ret=%d",
1084
		      __entry->call,
1085
		      __print_symbolic(__entry->why, rxrpc_recvmsg_traces),
1086 1087 1088 1089 1090 1091
		      __entry->seq,
		      __entry->offset,
		      __entry->len,
		      __entry->ret)
	    );

D
David Howells 已提交
1092 1093 1094 1095 1096 1097 1098
TRACE_EVENT(rxrpc_rtt_tx,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why,
		     rxrpc_serial_t send_serial),

	    TP_ARGS(call, why, send_serial),

	    TP_STRUCT__entry(
1099
		    __field(unsigned int,		call		)
D
David Howells 已提交
1100 1101 1102 1103 1104
		    __field(enum rxrpc_rtt_tx_trace,	why		)
		    __field(rxrpc_serial_t,		send_serial	)
			     ),

	    TP_fast_assign(
1105
		    __entry->call = call->debug_id;
D
David Howells 已提交
1106 1107 1108 1109
		    __entry->why = why;
		    __entry->send_serial = send_serial;
			   ),

1110
	    TP_printk("c=%08x %s sr=%08x",
D
David Howells 已提交
1111
		      __entry->call,
1112
		      __print_symbolic(__entry->why, rxrpc_rtt_tx_traces),
D
David Howells 已提交
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123
		      __entry->send_serial)
	    );

TRACE_EVENT(rxrpc_rtt_rx,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
		     rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial,
		     s64 rtt, u8 nr, s64 avg),

	    TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg),

	    TP_STRUCT__entry(
1124
		    __field(unsigned int,		call		)
D
David Howells 已提交
1125 1126 1127 1128 1129 1130 1131 1132 1133
		    __field(enum rxrpc_rtt_rx_trace,	why		)
		    __field(u8,				nr		)
		    __field(rxrpc_serial_t,		send_serial	)
		    __field(rxrpc_serial_t,		resp_serial	)
		    __field(s64,			rtt		)
		    __field(u64,			avg		)
			     ),

	    TP_fast_assign(
1134
		    __entry->call = call->debug_id;
D
David Howells 已提交
1135 1136 1137 1138 1139 1140 1141 1142
		    __entry->why = why;
		    __entry->send_serial = send_serial;
		    __entry->resp_serial = resp_serial;
		    __entry->rtt = rtt;
		    __entry->nr = nr;
		    __entry->avg = avg;
			   ),

1143
	    TP_printk("c=%08x %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld",
D
David Howells 已提交
1144
		      __entry->call,
1145
		      __print_symbolic(__entry->why, rxrpc_rtt_rx_traces),
D
David Howells 已提交
1146 1147 1148 1149 1150 1151 1152
		      __entry->send_serial,
		      __entry->resp_serial,
		      __entry->rtt,
		      __entry->nr,
		      __entry->avg)
	    );

1153 1154
TRACE_EVENT(rxrpc_timer,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why,
D
David Howells 已提交
1155
		     unsigned long now),
1156

D
David Howells 已提交
1157
	    TP_ARGS(call, why, now),
1158 1159

	    TP_STRUCT__entry(
1160
		    __field(unsigned int,			call		)
1161
		    __field(enum rxrpc_timer_trace,		why		)
D
David Howells 已提交
1162 1163
		    __field(long,				now		)
		    __field(long,				ack_at		)
1164
		    __field(long,				ack_lost_at	)
D
David Howells 已提交
1165 1166 1167 1168 1169 1170
		    __field(long,				resend_at	)
		    __field(long,				ping_at		)
		    __field(long,				expect_rx_by	)
		    __field(long,				expect_req_by	)
		    __field(long,				expect_term_by	)
		    __field(long,				timer		)
1171 1172 1173
			     ),

	    TP_fast_assign(
1174
		    __entry->call		= call->debug_id;
D
David Howells 已提交
1175 1176 1177
		    __entry->why		= why;
		    __entry->now		= now;
		    __entry->ack_at		= call->ack_at;
1178
		    __entry->ack_lost_at	= call->ack_lost_at;
D
David Howells 已提交
1179 1180 1181 1182 1183
		    __entry->resend_at		= call->resend_at;
		    __entry->expect_rx_by	= call->expect_rx_by;
		    __entry->expect_req_by	= call->expect_req_by;
		    __entry->expect_term_by	= call->expect_term_by;
		    __entry->timer		= call->timer.expires;
1184 1185
			   ),

1186
	    TP_printk("c=%08x %s a=%ld la=%ld r=%ld xr=%ld xq=%ld xt=%ld t=%ld",
1187
		      __entry->call,
1188
		      __print_symbolic(__entry->why, rxrpc_timer_traces),
D
David Howells 已提交
1189
		      __entry->ack_at - __entry->now,
1190
		      __entry->ack_lost_at - __entry->now,
D
David Howells 已提交
1191 1192 1193 1194 1195
		      __entry->resend_at - __entry->now,
		      __entry->expect_rx_by - __entry->now,
		      __entry->expect_req_by - __entry->now,
		      __entry->expect_term_by - __entry->now,
		      __entry->timer - __entry->now)
1196 1197
	    );

1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215
TRACE_EVENT(rxrpc_rx_lose,
	    TP_PROTO(struct rxrpc_skb_priv *sp),

	    TP_ARGS(sp),

	    TP_STRUCT__entry(
		    __field_struct(struct rxrpc_host_header,	hdr		)
			     ),

	    TP_fast_assign(
		    memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr));
			   ),

	    TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*",
		      __entry->hdr.epoch, __entry->hdr.cid,
		      __entry->hdr.callNumber, __entry->hdr.serviceId,
		      __entry->hdr.serial, __entry->hdr.seq,
		      __entry->hdr.type, __entry->hdr.flags,
1216 1217
		      __entry->hdr.type <= 15 ?
		      __print_symbolic(__entry->hdr.type, rxrpc_pkts) : "?UNK")
1218 1219
	    );

1220 1221 1222 1223 1224 1225 1226 1227 1228
TRACE_EVENT(rxrpc_propose_ack,
	    TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why,
		     u8 ack_reason, rxrpc_serial_t serial, bool immediate,
		     bool background, enum rxrpc_propose_ack_outcome outcome),

	    TP_ARGS(call, why, ack_reason, serial, immediate, background,
		    outcome),

	    TP_STRUCT__entry(
1229
		    __field(unsigned int,			call		)
1230 1231 1232 1233 1234 1235 1236 1237 1238
		    __field(enum rxrpc_propose_ack_trace,	why		)
		    __field(rxrpc_serial_t,			serial		)
		    __field(u8,					ack_reason	)
		    __field(bool,				immediate	)
		    __field(bool,				background	)
		    __field(enum rxrpc_propose_ack_outcome,	outcome		)
			     ),

	    TP_fast_assign(
1239
		    __entry->call	= call->debug_id;
1240 1241 1242 1243 1244 1245 1246 1247
		    __entry->why	= why;
		    __entry->serial	= serial;
		    __entry->ack_reason	= ack_reason;
		    __entry->immediate	= immediate;
		    __entry->background	= background;
		    __entry->outcome	= outcome;
			   ),

1248
	    TP_printk("c=%08x %s %s r=%08x i=%u b=%u%s",
1249
		      __entry->call,
1250 1251
		      __print_symbolic(__entry->why, rxrpc_propose_ack_traces),
		      __print_symbolic(__entry->ack_reason, rxrpc_ack_names),
1252 1253 1254
		      __entry->serial,
		      __entry->immediate,
		      __entry->background,
1255
		      __print_symbolic(__entry->outcome, rxrpc_propose_ack_outcomes))
1256 1257
	    );

1258 1259 1260 1261 1262 1263 1264
TRACE_EVENT(rxrpc_retransmit,
	    TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation,
		     s64 expiry),

	    TP_ARGS(call, seq, annotation, expiry),

	    TP_STRUCT__entry(
1265
		    __field(unsigned int,		call		)
1266 1267 1268 1269 1270 1271
		    __field(rxrpc_seq_t,		seq		)
		    __field(u8,				annotation	)
		    __field(s64,			expiry		)
			     ),

	    TP_fast_assign(
1272
		    __entry->call = call->debug_id;
1273 1274 1275 1276 1277
		    __entry->seq = seq;
		    __entry->annotation = annotation;
		    __entry->expiry = expiry;
			   ),

1278
	    TP_printk("c=%08x q=%x a=%02x xp=%lld",
1279 1280 1281 1282 1283 1284
		      __entry->call,
		      __entry->seq,
		      __entry->annotation,
		      __entry->expiry)
	    );

D
David Howells 已提交
1285 1286 1287 1288 1289 1290 1291
TRACE_EVENT(rxrpc_congest,
	    TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary,
		     rxrpc_serial_t ack_serial, enum rxrpc_congest_change change),

	    TP_ARGS(call, summary, ack_serial, change),

	    TP_STRUCT__entry(
1292
		    __field(unsigned int,			call		)
D
David Howells 已提交
1293 1294 1295 1296 1297 1298 1299 1300 1301
		    __field(enum rxrpc_congest_change,		change		)
		    __field(rxrpc_seq_t,			hard_ack	)
		    __field(rxrpc_seq_t,			top		)
		    __field(rxrpc_seq_t,			lowest_nak	)
		    __field(rxrpc_serial_t,			ack_serial	)
		    __field_struct(struct rxrpc_ack_summary,	sum		)
			     ),

	    TP_fast_assign(
1302
		    __entry->call	= call->debug_id;
D
David Howells 已提交
1303 1304 1305 1306 1307 1308 1309 1310
		    __entry->change	= change;
		    __entry->hard_ack	= call->tx_hard_ack;
		    __entry->top	= call->tx_top;
		    __entry->lowest_nak	= call->acks_lowest_nak;
		    __entry->ack_serial	= ack_serial;
		    memcpy(&__entry->sum, summary, sizeof(__entry->sum));
			   ),

1311
	    TP_printk("c=%08x r=%08x %s q=%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",
D
David Howells 已提交
1312 1313
		      __entry->call,
		      __entry->ack_serial,
1314
		      __print_symbolic(__entry->sum.ack_reason, rxrpc_ack_names),
D
David Howells 已提交
1315
		      __entry->hard_ack,
1316
		      __print_symbolic(__entry->sum.mode, rxrpc_congest_modes),
D
David Howells 已提交
1317 1318 1319 1320 1321 1322 1323 1324 1325
		      __entry->sum.cwnd,
		      __entry->sum.ssthresh,
		      __entry->sum.nr_acks, __entry->sum.nr_nacks,
		      __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks,
		      __entry->sum.nr_rot_new_acks,
		      __entry->top - __entry->hard_ack,
		      __entry->sum.cumulative_acks,
		      __entry->sum.dup_acks,
		      __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "",
1326
		      __print_symbolic(__entry->change, rxrpc_congest_changes),
D
David Howells 已提交
1327 1328 1329
		      __entry->sum.retrans_timeo ? " rTxTo" : "")
	    );

D
David Howells 已提交
1330 1331 1332 1333 1334 1335
TRACE_EVENT(rxrpc_disconnect_call,
	    TP_PROTO(struct rxrpc_call *call),

	    TP_ARGS(call),

	    TP_STRUCT__entry(
1336
		    __field(unsigned int,		call		)
D
David Howells 已提交
1337 1338 1339 1340
		    __field(u32,			abort_code	)
			     ),

	    TP_fast_assign(
1341
		    __entry->call = call->debug_id;
D
David Howells 已提交
1342 1343 1344
		    __entry->abort_code = call->abort_code;
			   ),

1345
	    TP_printk("c=%08x ab=%08x",
D
David Howells 已提交
1346 1347 1348 1349 1350 1351 1352 1353 1354 1355
		      __entry->call,
		      __entry->abort_code)
	    );

TRACE_EVENT(rxrpc_improper_term,
	    TP_PROTO(struct rxrpc_call *call),

	    TP_ARGS(call),

	    TP_STRUCT__entry(
1356
		    __field(unsigned int,		call		)
D
David Howells 已提交
1357 1358 1359 1360
		    __field(u32,			abort_code	)
			     ),

	    TP_fast_assign(
1361
		    __entry->call = call->debug_id;
D
David Howells 已提交
1362 1363 1364
		    __entry->abort_code = call->abort_code;
			   ),

1365
	    TP_printk("c=%08x ab=%08x",
D
David Howells 已提交
1366 1367 1368 1369
		      __entry->call,
		      __entry->abort_code)
	    );

1370 1371 1372 1373 1374 1375 1376
TRACE_EVENT(rxrpc_rx_eproto,
	    TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial,
		     const char *why),

	    TP_ARGS(call, serial, why),

	    TP_STRUCT__entry(
1377
		    __field(unsigned int,		call		)
1378 1379 1380 1381 1382
		    __field(rxrpc_serial_t,		serial		)
		    __field(const char *,		why		)
			     ),

	    TP_fast_assign(
1383
		    __entry->call = call->debug_id;
1384 1385 1386 1387
		    __entry->serial = serial;
		    __entry->why = why;
			   ),

1388
	    TP_printk("c=%08x EPROTO %08x %s",
1389 1390 1391 1392 1393
		      __entry->call,
		      __entry->serial,
		      __entry->why)
	    );

1394 1395 1396 1397 1398 1399
TRACE_EVENT(rxrpc_connect_call,
	    TP_PROTO(struct rxrpc_call *call),

	    TP_ARGS(call),

	    TP_STRUCT__entry(
1400
		    __field(unsigned int,		call		)
1401 1402 1403 1404 1405 1406
		    __field(unsigned long,		user_call_ID	)
		    __field(u32,			cid		)
		    __field(u32,			call_id		)
			     ),

	    TP_fast_assign(
1407
		    __entry->call = call->debug_id;
1408 1409 1410 1411 1412
		    __entry->user_call_ID = call->user_call_ID;
		    __entry->cid = call->cid;
		    __entry->call_id = call->call_id;
			   ),

1413
	    TP_printk("c=%08x u=%p %08x:%08x",
1414 1415 1416 1417 1418 1419
		      __entry->call,
		      (void *)__entry->user_call_ID,
		      __entry->cid,
		      __entry->call_id)
	    );

D
David Howells 已提交
1420 1421 1422 1423 1424 1425
TRACE_EVENT(rxrpc_resend,
	    TP_PROTO(struct rxrpc_call *call, int ix),

	    TP_ARGS(call, ix),

	    TP_STRUCT__entry(
1426
		    __field(unsigned int,		call		)
D
David Howells 已提交
1427 1428 1429 1430 1431
		    __field(int,			ix		)
		    __array(u8,				anno, 64	)
			     ),

	    TP_fast_assign(
1432
		    __entry->call = call->debug_id;
D
David Howells 已提交
1433 1434 1435 1436
		    __entry->ix = ix;
		    memcpy(__entry->anno, call->rxtx_annotations, 64);
			   ),

1437
	    TP_printk("c=%08x ix=%u a=%64phN",
D
David Howells 已提交
1438 1439 1440 1441 1442
		      __entry->call,
		      __entry->ix,
		      __entry->anno)
	    );

1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471
TRACE_EVENT(rxrpc_rx_icmp,
	    TP_PROTO(struct rxrpc_peer *peer, struct sock_extended_err *ee,
		     struct sockaddr_rxrpc *srx),

	    TP_ARGS(peer, ee, srx),

	    TP_STRUCT__entry(
		    __field(unsigned int,			peer	)
		    __field_struct(struct sock_extended_err,	ee	)
		    __field_struct(struct sockaddr_rxrpc,	srx	)
			     ),

	    TP_fast_assign(
		    __entry->peer = peer->debug_id;
		    memcpy(&__entry->ee, ee, sizeof(__entry->ee));
		    memcpy(&__entry->srx, srx, sizeof(__entry->srx));
			   ),

	    TP_printk("P=%08x o=%u t=%u c=%u i=%u d=%u e=%d %pISp",
		      __entry->peer,
		      __entry->ee.ee_origin,
		      __entry->ee.ee_type,
		      __entry->ee.ee_code,
		      __entry->ee.ee_info,
		      __entry->ee.ee_data,
		      __entry->ee.ee_errno,
		      &__entry->srx.transport)
	    );

1472 1473
TRACE_EVENT(rxrpc_tx_fail,
	    TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial, int ret,
D
David Howells 已提交
1474
		     enum rxrpc_tx_point where),
1475

D
David Howells 已提交
1476
	    TP_ARGS(debug_id, serial, ret, where),
1477 1478 1479 1480 1481

	    TP_STRUCT__entry(
		    __field(unsigned int,		debug_id	)
		    __field(rxrpc_serial_t,		serial		)
		    __field(int,			ret		)
D
David Howells 已提交
1482
		    __field(enum rxrpc_tx_point,	where		)
1483 1484 1485 1486 1487 1488
			     ),

	    TP_fast_assign(
		    __entry->debug_id = debug_id;
		    __entry->serial = serial;
		    __entry->ret = ret;
D
David Howells 已提交
1489
		    __entry->where = where;
1490 1491 1492 1493 1494 1495
			   ),

	    TP_printk("c=%08x r=%x ret=%d %s",
		      __entry->debug_id,
		      __entry->serial,
		      __entry->ret,
D
David Howells 已提交
1496
		      __print_symbolic(__entry->where, rxrpc_tx_points))
1497 1498
	    );

1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530
TRACE_EVENT(rxrpc_call_reset,
	    TP_PROTO(struct rxrpc_call *call),

	    TP_ARGS(call),

	    TP_STRUCT__entry(
		    __field(unsigned int,		debug_id	)
		    __field(u32,			cid		)
		    __field(u32,			call_id		)
		    __field(rxrpc_serial_t,		call_serial	)
		    __field(rxrpc_serial_t,		conn_serial	)
		    __field(rxrpc_seq_t,		tx_seq		)
		    __field(rxrpc_seq_t,		rx_seq		)
			     ),

	    TP_fast_assign(
		    __entry->debug_id = call->debug_id;
		    __entry->cid = call->cid;
		    __entry->call_id = call->call_id;
		    __entry->call_serial = call->rx_serial;
		    __entry->conn_serial = call->conn->hi_serial;
		    __entry->tx_seq = call->tx_hard_ack;
		    __entry->rx_seq = call->ackr_seen;
			   ),

	    TP_printk("c=%08x %08x:%08x r=%08x/%08x tx=%08x rx=%08x",
		      __entry->debug_id,
		      __entry->cid, __entry->call_id,
		      __entry->call_serial, __entry->conn_serial,
		      __entry->tx_seq, __entry->rx_seq)
	    );

D
David Howells 已提交
1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550
TRACE_EVENT(rxrpc_notify_socket,
	    TP_PROTO(unsigned int debug_id, rxrpc_serial_t serial),

	    TP_ARGS(debug_id, serial),

	    TP_STRUCT__entry(
		    __field(unsigned int,		debug_id	)
		    __field(rxrpc_serial_t,		serial		)
			     ),

	    TP_fast_assign(
		    __entry->debug_id = debug_id;
		    __entry->serial = serial;
			   ),

	    TP_printk("c=%08x r=%08x",
		      __entry->debug_id,
		      __entry->serial)
	    );

1551 1552 1553 1554
#endif /* _TRACE_RXRPC_H */

/* This part must be outside protection */
#include <trace/define_trace.h>