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 TRACE_EVENT(rxrpc_conn, 20 TP_PROTO(struct rxrpc_connection *conn, enum rxrpc_conn_trace op, 21 int usage, const void *where), 22 23 TP_ARGS(conn, op, usage, where), 24 25 TP_STRUCT__entry( 26 __field(struct rxrpc_connection *, conn ) 27 __field(int, op ) 28 __field(int, usage ) 29 __field(const void *, where ) 30 ), 31 32 TP_fast_assign( 33 __entry->conn = conn; 34 __entry->op = op; 35 __entry->usage = usage; 36 __entry->where = where; 37 ), 38 39 TP_printk("C=%p %s u=%d sp=%pSR", 40 __entry->conn, 41 rxrpc_conn_traces[__entry->op], 42 __entry->usage, 43 __entry->where) 44 ); 45 46 TRACE_EVENT(rxrpc_client, 47 TP_PROTO(struct rxrpc_connection *conn, int channel, 48 enum rxrpc_client_trace op), 49 50 TP_ARGS(conn, channel, op), 51 52 TP_STRUCT__entry( 53 __field(struct rxrpc_connection *, conn ) 54 __field(u32, cid ) 55 __field(int, channel ) 56 __field(int, usage ) 57 __field(enum rxrpc_client_trace, op ) 58 __field(enum rxrpc_conn_cache_state, cs ) 59 ), 60 61 TP_fast_assign( 62 __entry->conn = conn; 63 __entry->channel = channel; 64 __entry->usage = atomic_read(&conn->usage); 65 __entry->op = op; 66 __entry->cid = conn->proto.cid; 67 __entry->cs = conn->cache_state; 68 ), 69 70 TP_printk("C=%p h=%2d %s %s i=%08x u=%d", 71 __entry->conn, 72 __entry->channel, 73 rxrpc_client_traces[__entry->op], 74 rxrpc_conn_cache_states[__entry->cs], 75 __entry->cid, 76 __entry->usage) 77 ); 78 79 TRACE_EVENT(rxrpc_call, 80 TP_PROTO(struct rxrpc_call *call, enum rxrpc_call_trace op, 81 int usage, const void *where, const void *aux), 82 83 TP_ARGS(call, op, usage, where, aux), 84 85 TP_STRUCT__entry( 86 __field(struct rxrpc_call *, call ) 87 __field(int, op ) 88 __field(int, usage ) 89 __field(const void *, where ) 90 __field(const void *, aux ) 91 ), 92 93 TP_fast_assign( 94 __entry->call = call; 95 __entry->op = op; 96 __entry->usage = usage; 97 __entry->where = where; 98 __entry->aux = aux; 99 ), 100 101 TP_printk("c=%p %s u=%d sp=%pSR a=%p", 102 __entry->call, 103 rxrpc_call_traces[__entry->op], 104 __entry->usage, 105 __entry->where, 106 __entry->aux) 107 ); 108 109 TRACE_EVENT(rxrpc_skb, 110 TP_PROTO(struct sk_buff *skb, enum rxrpc_skb_trace op, 111 int usage, int mod_count, const void *where), 112 113 TP_ARGS(skb, op, usage, mod_count, where), 114 115 TP_STRUCT__entry( 116 __field(struct sk_buff *, skb ) 117 __field(enum rxrpc_skb_trace, op ) 118 __field(int, usage ) 119 __field(int, mod_count ) 120 __field(const void *, where ) 121 ), 122 123 TP_fast_assign( 124 __entry->skb = skb; 125 __entry->op = op; 126 __entry->usage = usage; 127 __entry->mod_count = mod_count; 128 __entry->where = where; 129 ), 130 131 TP_printk("s=%p %s u=%d m=%d p=%pSR", 132 __entry->skb, 133 rxrpc_skb_traces[__entry->op], 134 __entry->usage, 135 __entry->mod_count, 136 __entry->where) 137 ); 138 139 TRACE_EVENT(rxrpc_rx_packet, 140 TP_PROTO(struct rxrpc_skb_priv *sp), 141 142 TP_ARGS(sp), 143 144 TP_STRUCT__entry( 145 __field_struct(struct rxrpc_host_header, hdr ) 146 ), 147 148 TP_fast_assign( 149 memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr)); 150 ), 151 152 TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s", 153 __entry->hdr.epoch, __entry->hdr.cid, 154 __entry->hdr.callNumber, __entry->hdr.serviceId, 155 __entry->hdr.serial, __entry->hdr.seq, 156 __entry->hdr.type, __entry->hdr.flags, 157 __entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK") 158 ); 159 160 TRACE_EVENT(rxrpc_rx_done, 161 TP_PROTO(int result, int abort_code), 162 163 TP_ARGS(result, abort_code), 164 165 TP_STRUCT__entry( 166 __field(int, result ) 167 __field(int, abort_code ) 168 ), 169 170 TP_fast_assign( 171 __entry->result = result; 172 __entry->abort_code = abort_code; 173 ), 174 175 TP_printk("r=%d a=%d", __entry->result, __entry->abort_code) 176 ); 177 178 TRACE_EVENT(rxrpc_abort, 179 TP_PROTO(const char *why, u32 cid, u32 call_id, rxrpc_seq_t seq, 180 int abort_code, int error), 181 182 TP_ARGS(why, cid, call_id, seq, abort_code, error), 183 184 TP_STRUCT__entry( 185 __array(char, why, 4 ) 186 __field(u32, cid ) 187 __field(u32, call_id ) 188 __field(rxrpc_seq_t, seq ) 189 __field(int, abort_code ) 190 __field(int, error ) 191 ), 192 193 TP_fast_assign( 194 memcpy(__entry->why, why, 4); 195 __entry->cid = cid; 196 __entry->call_id = call_id; 197 __entry->abort_code = abort_code; 198 __entry->error = error; 199 __entry->seq = seq; 200 ), 201 202 TP_printk("%08x:%08x s=%u a=%d e=%d %s", 203 __entry->cid, __entry->call_id, __entry->seq, 204 __entry->abort_code, __entry->error, __entry->why) 205 ); 206 207 TRACE_EVENT(rxrpc_transmit, 208 TP_PROTO(struct rxrpc_call *call, enum rxrpc_transmit_trace why), 209 210 TP_ARGS(call, why), 211 212 TP_STRUCT__entry( 213 __field(struct rxrpc_call *, call ) 214 __field(enum rxrpc_transmit_trace, why ) 215 __field(rxrpc_seq_t, tx_hard_ack ) 216 __field(rxrpc_seq_t, tx_top ) 217 ), 218 219 TP_fast_assign( 220 __entry->call = call; 221 __entry->why = why; 222 __entry->tx_hard_ack = call->tx_hard_ack; 223 __entry->tx_top = call->tx_top; 224 ), 225 226 TP_printk("c=%p %s f=%08x n=%u", 227 __entry->call, 228 rxrpc_transmit_traces[__entry->why], 229 __entry->tx_hard_ack + 1, 230 __entry->tx_top - __entry->tx_hard_ack) 231 ); 232 233 TRACE_EVENT(rxrpc_rx_ack, 234 TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t first, u8 reason, u8 n_acks), 235 236 TP_ARGS(call, first, reason, n_acks), 237 238 TP_STRUCT__entry( 239 __field(struct rxrpc_call *, call ) 240 __field(rxrpc_seq_t, first ) 241 __field(u8, reason ) 242 __field(u8, n_acks ) 243 ), 244 245 TP_fast_assign( 246 __entry->call = call; 247 __entry->first = first; 248 __entry->reason = reason; 249 __entry->n_acks = n_acks; 250 ), 251 252 TP_printk("c=%p %s f=%08x n=%u", 253 __entry->call, 254 rxrpc_ack_names[__entry->reason], 255 __entry->first, 256 __entry->n_acks) 257 ); 258 259 TRACE_EVENT(rxrpc_tx_data, 260 TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, 261 rxrpc_serial_t serial, u8 flags, bool retrans, bool lose), 262 263 TP_ARGS(call, seq, serial, flags, retrans, lose), 264 265 TP_STRUCT__entry( 266 __field(struct rxrpc_call *, call ) 267 __field(rxrpc_seq_t, seq ) 268 __field(rxrpc_serial_t, serial ) 269 __field(u8, flags ) 270 __field(bool, retrans ) 271 __field(bool, lose ) 272 ), 273 274 TP_fast_assign( 275 __entry->call = call; 276 __entry->seq = seq; 277 __entry->serial = serial; 278 __entry->flags = flags; 279 __entry->retrans = retrans; 280 __entry->lose = lose; 281 ), 282 283 TP_printk("c=%p DATA %08x q=%08x fl=%02x%s%s", 284 __entry->call, 285 __entry->serial, 286 __entry->seq, 287 __entry->flags, 288 __entry->retrans ? " *RETRANS*" : "", 289 __entry->lose ? " *LOSE*" : "") 290 ); 291 292 TRACE_EVENT(rxrpc_tx_ack, 293 TP_PROTO(struct rxrpc_call *call, rxrpc_serial_t serial, 294 rxrpc_seq_t ack_first, rxrpc_serial_t ack_serial, 295 u8 reason, u8 n_acks), 296 297 TP_ARGS(call, serial, ack_first, ack_serial, reason, n_acks), 298 299 TP_STRUCT__entry( 300 __field(struct rxrpc_call *, call ) 301 __field(rxrpc_serial_t, serial ) 302 __field(rxrpc_seq_t, ack_first ) 303 __field(rxrpc_serial_t, ack_serial ) 304 __field(u8, reason ) 305 __field(u8, n_acks ) 306 ), 307 308 TP_fast_assign( 309 __entry->call = call; 310 __entry->serial = serial; 311 __entry->ack_first = ack_first; 312 __entry->ack_serial = ack_serial; 313 __entry->reason = reason; 314 __entry->n_acks = n_acks; 315 ), 316 317 TP_printk(" c=%p ACK %08x %s f=%08x r=%08x n=%u", 318 __entry->call, 319 __entry->serial, 320 rxrpc_ack_names[__entry->reason], 321 __entry->ack_first, 322 __entry->ack_serial, 323 __entry->n_acks) 324 ); 325 326 TRACE_EVENT(rxrpc_receive, 327 TP_PROTO(struct rxrpc_call *call, enum rxrpc_receive_trace why, 328 rxrpc_serial_t serial, rxrpc_seq_t seq), 329 330 TP_ARGS(call, why, serial, seq), 331 332 TP_STRUCT__entry( 333 __field(struct rxrpc_call *, call ) 334 __field(enum rxrpc_receive_trace, why ) 335 __field(rxrpc_serial_t, serial ) 336 __field(rxrpc_seq_t, seq ) 337 __field(rxrpc_seq_t, hard_ack ) 338 __field(rxrpc_seq_t, top ) 339 ), 340 341 TP_fast_assign( 342 __entry->call = call; 343 __entry->why = why; 344 __entry->serial = serial; 345 __entry->seq = seq; 346 __entry->hard_ack = call->rx_hard_ack; 347 __entry->top = call->rx_top; 348 ), 349 350 TP_printk("c=%p %s r=%08x q=%08x w=%08x-%08x", 351 __entry->call, 352 rxrpc_receive_traces[__entry->why], 353 __entry->serial, 354 __entry->seq, 355 __entry->hard_ack, 356 __entry->top) 357 ); 358 359 TRACE_EVENT(rxrpc_recvmsg, 360 TP_PROTO(struct rxrpc_call *call, enum rxrpc_recvmsg_trace why, 361 rxrpc_seq_t seq, unsigned int offset, unsigned int len, 362 int ret), 363 364 TP_ARGS(call, why, seq, offset, len, ret), 365 366 TP_STRUCT__entry( 367 __field(struct rxrpc_call *, call ) 368 __field(enum rxrpc_recvmsg_trace, why ) 369 __field(rxrpc_seq_t, seq ) 370 __field(unsigned int, offset ) 371 __field(unsigned int, len ) 372 __field(int, ret ) 373 ), 374 375 TP_fast_assign( 376 __entry->call = call; 377 __entry->why = why; 378 __entry->seq = seq; 379 __entry->offset = offset; 380 __entry->len = len; 381 __entry->ret = ret; 382 ), 383 384 TP_printk("c=%p %s q=%08x o=%u l=%u ret=%d", 385 __entry->call, 386 rxrpc_recvmsg_traces[__entry->why], 387 __entry->seq, 388 __entry->offset, 389 __entry->len, 390 __entry->ret) 391 ); 392 393 TRACE_EVENT(rxrpc_rtt_tx, 394 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_tx_trace why, 395 rxrpc_serial_t send_serial), 396 397 TP_ARGS(call, why, send_serial), 398 399 TP_STRUCT__entry( 400 __field(struct rxrpc_call *, call ) 401 __field(enum rxrpc_rtt_tx_trace, why ) 402 __field(rxrpc_serial_t, send_serial ) 403 ), 404 405 TP_fast_assign( 406 __entry->call = call; 407 __entry->why = why; 408 __entry->send_serial = send_serial; 409 ), 410 411 TP_printk("c=%p %s sr=%08x", 412 __entry->call, 413 rxrpc_rtt_tx_traces[__entry->why], 414 __entry->send_serial) 415 ); 416 417 TRACE_EVENT(rxrpc_rtt_rx, 418 TP_PROTO(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why, 419 rxrpc_serial_t send_serial, rxrpc_serial_t resp_serial, 420 s64 rtt, u8 nr, s64 avg), 421 422 TP_ARGS(call, why, send_serial, resp_serial, rtt, nr, avg), 423 424 TP_STRUCT__entry( 425 __field(struct rxrpc_call *, call ) 426 __field(enum rxrpc_rtt_rx_trace, why ) 427 __field(u8, nr ) 428 __field(rxrpc_serial_t, send_serial ) 429 __field(rxrpc_serial_t, resp_serial ) 430 __field(s64, rtt ) 431 __field(u64, avg ) 432 ), 433 434 TP_fast_assign( 435 __entry->call = call; 436 __entry->why = why; 437 __entry->send_serial = send_serial; 438 __entry->resp_serial = resp_serial; 439 __entry->rtt = rtt; 440 __entry->nr = nr; 441 __entry->avg = avg; 442 ), 443 444 TP_printk("c=%p %s sr=%08x rr=%08x rtt=%lld nr=%u avg=%lld", 445 __entry->call, 446 rxrpc_rtt_rx_traces[__entry->why], 447 __entry->send_serial, 448 __entry->resp_serial, 449 __entry->rtt, 450 __entry->nr, 451 __entry->avg) 452 ); 453 454 TRACE_EVENT(rxrpc_timer, 455 TP_PROTO(struct rxrpc_call *call, enum rxrpc_timer_trace why, 456 ktime_t now, unsigned long now_j), 457 458 TP_ARGS(call, why, now, now_j), 459 460 TP_STRUCT__entry( 461 __field(struct rxrpc_call *, call ) 462 __field(enum rxrpc_timer_trace, why ) 463 __field_struct(ktime_t, now ) 464 __field_struct(ktime_t, expire_at ) 465 __field_struct(ktime_t, ack_at ) 466 __field_struct(ktime_t, resend_at ) 467 __field(unsigned long, now_j ) 468 __field(unsigned long, timer ) 469 ), 470 471 TP_fast_assign( 472 __entry->call = call; 473 __entry->why = why; 474 __entry->now = now; 475 __entry->expire_at = call->expire_at; 476 __entry->ack_at = call->ack_at; 477 __entry->resend_at = call->resend_at; 478 __entry->now_j = now_j; 479 __entry->timer = call->timer.expires; 480 ), 481 482 TP_printk("c=%p %s x=%lld a=%lld r=%lld t=%ld", 483 __entry->call, 484 rxrpc_timer_traces[__entry->why], 485 ktime_to_ns(ktime_sub(__entry->expire_at, __entry->now)), 486 ktime_to_ns(ktime_sub(__entry->ack_at, __entry->now)), 487 ktime_to_ns(ktime_sub(__entry->resend_at, __entry->now)), 488 __entry->timer - __entry->now_j) 489 ); 490 491 TRACE_EVENT(rxrpc_rx_lose, 492 TP_PROTO(struct rxrpc_skb_priv *sp), 493 494 TP_ARGS(sp), 495 496 TP_STRUCT__entry( 497 __field_struct(struct rxrpc_host_header, hdr ) 498 ), 499 500 TP_fast_assign( 501 memcpy(&__entry->hdr, &sp->hdr, sizeof(__entry->hdr)); 502 ), 503 504 TP_printk("%08x:%08x:%08x:%04x %08x %08x %02x %02x %s *LOSE*", 505 __entry->hdr.epoch, __entry->hdr.cid, 506 __entry->hdr.callNumber, __entry->hdr.serviceId, 507 __entry->hdr.serial, __entry->hdr.seq, 508 __entry->hdr.type, __entry->hdr.flags, 509 __entry->hdr.type <= 15 ? rxrpc_pkts[__entry->hdr.type] : "?UNK") 510 ); 511 512 TRACE_EVENT(rxrpc_propose_ack, 513 TP_PROTO(struct rxrpc_call *call, enum rxrpc_propose_ack_trace why, 514 u8 ack_reason, rxrpc_serial_t serial, bool immediate, 515 bool background, enum rxrpc_propose_ack_outcome outcome), 516 517 TP_ARGS(call, why, ack_reason, serial, immediate, background, 518 outcome), 519 520 TP_STRUCT__entry( 521 __field(struct rxrpc_call *, call ) 522 __field(enum rxrpc_propose_ack_trace, why ) 523 __field(rxrpc_serial_t, serial ) 524 __field(u8, ack_reason ) 525 __field(bool, immediate ) 526 __field(bool, background ) 527 __field(enum rxrpc_propose_ack_outcome, outcome ) 528 ), 529 530 TP_fast_assign( 531 __entry->call = call; 532 __entry->why = why; 533 __entry->serial = serial; 534 __entry->ack_reason = ack_reason; 535 __entry->immediate = immediate; 536 __entry->background = background; 537 __entry->outcome = outcome; 538 ), 539 540 TP_printk("c=%p %s %s r=%08x i=%u b=%u%s", 541 __entry->call, 542 rxrpc_propose_ack_traces[__entry->why], 543 rxrpc_ack_names[__entry->ack_reason], 544 __entry->serial, 545 __entry->immediate, 546 __entry->background, 547 rxrpc_propose_ack_outcomes[__entry->outcome]) 548 ); 549 550 TRACE_EVENT(rxrpc_retransmit, 551 TP_PROTO(struct rxrpc_call *call, rxrpc_seq_t seq, u8 annotation, 552 s64 expiry), 553 554 TP_ARGS(call, seq, annotation, expiry), 555 556 TP_STRUCT__entry( 557 __field(struct rxrpc_call *, call ) 558 __field(rxrpc_seq_t, seq ) 559 __field(u8, annotation ) 560 __field(s64, expiry ) 561 ), 562 563 TP_fast_assign( 564 __entry->call = call; 565 __entry->seq = seq; 566 __entry->annotation = annotation; 567 __entry->expiry = expiry; 568 ), 569 570 TP_printk("c=%p q=%x a=%02x xp=%lld", 571 __entry->call, 572 __entry->seq, 573 __entry->annotation, 574 __entry->expiry) 575 ); 576 577 TRACE_EVENT(rxrpc_congest, 578 TP_PROTO(struct rxrpc_call *call, struct rxrpc_ack_summary *summary, 579 rxrpc_serial_t ack_serial, enum rxrpc_congest_change change), 580 581 TP_ARGS(call, summary, ack_serial, change), 582 583 TP_STRUCT__entry( 584 __field(struct rxrpc_call *, call ) 585 __field(enum rxrpc_congest_change, change ) 586 __field(rxrpc_seq_t, hard_ack ) 587 __field(rxrpc_seq_t, top ) 588 __field(rxrpc_seq_t, lowest_nak ) 589 __field(rxrpc_serial_t, ack_serial ) 590 __field_struct(struct rxrpc_ack_summary, sum ) 591 ), 592 593 TP_fast_assign( 594 __entry->call = call; 595 __entry->change = change; 596 __entry->hard_ack = call->tx_hard_ack; 597 __entry->top = call->tx_top; 598 __entry->lowest_nak = call->acks_lowest_nak; 599 __entry->ack_serial = ack_serial; 600 memcpy(&__entry->sum, summary, sizeof(__entry->sum)); 601 ), 602 603 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", 604 __entry->call, 605 __entry->ack_serial, 606 rxrpc_ack_names[__entry->sum.ack_reason], 607 __entry->hard_ack, 608 rxrpc_congest_modes[__entry->sum.mode], 609 __entry->sum.cwnd, 610 __entry->sum.ssthresh, 611 __entry->sum.nr_acks, __entry->sum.nr_nacks, 612 __entry->sum.nr_new_acks, __entry->sum.nr_new_nacks, 613 __entry->sum.nr_rot_new_acks, 614 __entry->top - __entry->hard_ack, 615 __entry->sum.cumulative_acks, 616 __entry->sum.dup_acks, 617 __entry->lowest_nak, __entry->sum.new_low_nack ? "!" : "", 618 rxrpc_congest_changes[__entry->change], 619 __entry->sum.retrans_timeo ? " rTxTo" : "") 620 ); 621 622 #endif /* _TRACE_RXRPC_H */ 623 624 /* This part must be outside protection */ 625 #include <trace/define_trace.h> 626