1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (c) 2017, 2018 Oracle. All rights reserved. 4 * 5 * Trace point definitions for the "rpcrdma" subsystem. 6 */ 7 #undef TRACE_SYSTEM 8 #define TRACE_SYSTEM rpcrdma 9 10 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ) 11 #define _TRACE_RPCRDMA_H 12 13 #include <linux/scatterlist.h> 14 #include <linux/sunrpc/rpc_rdma_cid.h> 15 #include <linux/tracepoint.h> 16 #include <rdma/ib_cm.h> 17 #include <trace/events/rdma.h> 18 19 /** 20 ** Event classes 21 **/ 22 23 DECLARE_EVENT_CLASS(rpcrdma_completion_class, 24 TP_PROTO( 25 const struct ib_wc *wc, 26 const struct rpc_rdma_cid *cid 27 ), 28 29 TP_ARGS(wc, cid), 30 31 TP_STRUCT__entry( 32 __field(u32, cq_id) 33 __field(int, completion_id) 34 __field(unsigned long, status) 35 __field(unsigned int, vendor_err) 36 ), 37 38 TP_fast_assign( 39 __entry->cq_id = cid->ci_queue_id; 40 __entry->completion_id = cid->ci_completion_id; 41 __entry->status = wc->status; 42 if (wc->status) 43 __entry->vendor_err = wc->vendor_err; 44 else 45 __entry->vendor_err = 0; 46 ), 47 48 TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)", 49 __entry->cq_id, __entry->completion_id, 50 rdma_show_wc_status(__entry->status), 51 __entry->status, __entry->vendor_err 52 ) 53 ); 54 55 #define DEFINE_COMPLETION_EVENT(name) \ 56 DEFINE_EVENT(rpcrdma_completion_class, name, \ 57 TP_PROTO( \ 58 const struct ib_wc *wc, \ 59 const struct rpc_rdma_cid *cid \ 60 ), \ 61 TP_ARGS(wc, cid)) 62 63 DECLARE_EVENT_CLASS(xprtrdma_reply_event, 64 TP_PROTO( 65 const struct rpcrdma_rep *rep 66 ), 67 68 TP_ARGS(rep), 69 70 TP_STRUCT__entry( 71 __field(const void *, rep) 72 __field(const void *, r_xprt) 73 __field(u32, xid) 74 __field(u32, version) 75 __field(u32, proc) 76 ), 77 78 TP_fast_assign( 79 __entry->rep = rep; 80 __entry->r_xprt = rep->rr_rxprt; 81 __entry->xid = be32_to_cpu(rep->rr_xid); 82 __entry->version = be32_to_cpu(rep->rr_vers); 83 __entry->proc = be32_to_cpu(rep->rr_proc); 84 ), 85 86 TP_printk("rxprt %p xid=0x%08x rep=%p: version %u proc %u", 87 __entry->r_xprt, __entry->xid, __entry->rep, 88 __entry->version, __entry->proc 89 ) 90 ); 91 92 #define DEFINE_REPLY_EVENT(name) \ 93 DEFINE_EVENT(xprtrdma_reply_event, name, \ 94 TP_PROTO( \ 95 const struct rpcrdma_rep *rep \ 96 ), \ 97 TP_ARGS(rep)) 98 99 DECLARE_EVENT_CLASS(xprtrdma_rxprt, 100 TP_PROTO( 101 const struct rpcrdma_xprt *r_xprt 102 ), 103 104 TP_ARGS(r_xprt), 105 106 TP_STRUCT__entry( 107 __field(const void *, r_xprt) 108 __string(addr, rpcrdma_addrstr(r_xprt)) 109 __string(port, rpcrdma_portstr(r_xprt)) 110 ), 111 112 TP_fast_assign( 113 __entry->r_xprt = r_xprt; 114 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 115 __assign_str(port, rpcrdma_portstr(r_xprt)); 116 ), 117 118 TP_printk("peer=[%s]:%s r_xprt=%p", 119 __get_str(addr), __get_str(port), __entry->r_xprt 120 ) 121 ); 122 123 #define DEFINE_RXPRT_EVENT(name) \ 124 DEFINE_EVENT(xprtrdma_rxprt, name, \ 125 TP_PROTO( \ 126 const struct rpcrdma_xprt *r_xprt \ 127 ), \ 128 TP_ARGS(r_xprt)) 129 130 DECLARE_EVENT_CLASS(xprtrdma_connect_class, 131 TP_PROTO( 132 const struct rpcrdma_xprt *r_xprt, 133 int rc 134 ), 135 136 TP_ARGS(r_xprt, rc), 137 138 TP_STRUCT__entry( 139 __field(const void *, r_xprt) 140 __field(int, rc) 141 __field(int, connect_status) 142 __string(addr, rpcrdma_addrstr(r_xprt)) 143 __string(port, rpcrdma_portstr(r_xprt)) 144 ), 145 146 TP_fast_assign( 147 __entry->r_xprt = r_xprt; 148 __entry->rc = rc; 149 __entry->connect_status = r_xprt->rx_ep->re_connect_status; 150 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 151 __assign_str(port, rpcrdma_portstr(r_xprt)); 152 ), 153 154 TP_printk("peer=[%s]:%s r_xprt=%p: rc=%d connection status=%d", 155 __get_str(addr), __get_str(port), __entry->r_xprt, 156 __entry->rc, __entry->connect_status 157 ) 158 ); 159 160 #define DEFINE_CONN_EVENT(name) \ 161 DEFINE_EVENT(xprtrdma_connect_class, xprtrdma_##name, \ 162 TP_PROTO( \ 163 const struct rpcrdma_xprt *r_xprt, \ 164 int rc \ 165 ), \ 166 TP_ARGS(r_xprt, rc)) 167 168 DECLARE_EVENT_CLASS(xprtrdma_rdch_event, 169 TP_PROTO( 170 const struct rpc_task *task, 171 unsigned int pos, 172 struct rpcrdma_mr *mr, 173 int nsegs 174 ), 175 176 TP_ARGS(task, pos, mr, nsegs), 177 178 TP_STRUCT__entry( 179 __field(unsigned int, task_id) 180 __field(unsigned int, client_id) 181 __field(unsigned int, pos) 182 __field(int, nents) 183 __field(u32, handle) 184 __field(u32, length) 185 __field(u64, offset) 186 __field(int, nsegs) 187 ), 188 189 TP_fast_assign( 190 __entry->task_id = task->tk_pid; 191 __entry->client_id = task->tk_client->cl_clid; 192 __entry->pos = pos; 193 __entry->nents = mr->mr_nents; 194 __entry->handle = mr->mr_handle; 195 __entry->length = mr->mr_length; 196 __entry->offset = mr->mr_offset; 197 __entry->nsegs = nsegs; 198 ), 199 200 TP_printk("task:%u@%u pos=%u %u@0x%016llx:0x%08x (%s)", 201 __entry->task_id, __entry->client_id, 202 __entry->pos, __entry->length, 203 (unsigned long long)__entry->offset, __entry->handle, 204 __entry->nents < __entry->nsegs ? "more" : "last" 205 ) 206 ); 207 208 #define DEFINE_RDCH_EVENT(name) \ 209 DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\ 210 TP_PROTO( \ 211 const struct rpc_task *task, \ 212 unsigned int pos, \ 213 struct rpcrdma_mr *mr, \ 214 int nsegs \ 215 ), \ 216 TP_ARGS(task, pos, mr, nsegs)) 217 218 DECLARE_EVENT_CLASS(xprtrdma_wrch_event, 219 TP_PROTO( 220 const struct rpc_task *task, 221 struct rpcrdma_mr *mr, 222 int nsegs 223 ), 224 225 TP_ARGS(task, mr, nsegs), 226 227 TP_STRUCT__entry( 228 __field(unsigned int, task_id) 229 __field(unsigned int, client_id) 230 __field(int, nents) 231 __field(u32, handle) 232 __field(u32, length) 233 __field(u64, offset) 234 __field(int, nsegs) 235 ), 236 237 TP_fast_assign( 238 __entry->task_id = task->tk_pid; 239 __entry->client_id = task->tk_client->cl_clid; 240 __entry->nents = mr->mr_nents; 241 __entry->handle = mr->mr_handle; 242 __entry->length = mr->mr_length; 243 __entry->offset = mr->mr_offset; 244 __entry->nsegs = nsegs; 245 ), 246 247 TP_printk("task:%u@%u %u@0x%016llx:0x%08x (%s)", 248 __entry->task_id, __entry->client_id, 249 __entry->length, (unsigned long long)__entry->offset, 250 __entry->handle, 251 __entry->nents < __entry->nsegs ? "more" : "last" 252 ) 253 ); 254 255 #define DEFINE_WRCH_EVENT(name) \ 256 DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\ 257 TP_PROTO( \ 258 const struct rpc_task *task, \ 259 struct rpcrdma_mr *mr, \ 260 int nsegs \ 261 ), \ 262 TP_ARGS(task, mr, nsegs)) 263 264 DECLARE_EVENT_CLASS(xprtrdma_frwr_done, 265 TP_PROTO( 266 const struct ib_wc *wc, 267 const struct rpcrdma_frwr *frwr 268 ), 269 270 TP_ARGS(wc, frwr), 271 272 TP_STRUCT__entry( 273 __field(u32, mr_id) 274 __field(unsigned int, status) 275 __field(unsigned int, vendor_err) 276 ), 277 278 TP_fast_assign( 279 __entry->mr_id = frwr->fr_mr->res.id; 280 __entry->status = wc->status; 281 __entry->vendor_err = __entry->status ? wc->vendor_err : 0; 282 ), 283 284 TP_printk( 285 "mr.id=%u: %s (%u/0x%x)", 286 __entry->mr_id, rdma_show_wc_status(__entry->status), 287 __entry->status, __entry->vendor_err 288 ) 289 ); 290 291 #define DEFINE_FRWR_DONE_EVENT(name) \ 292 DEFINE_EVENT(xprtrdma_frwr_done, name, \ 293 TP_PROTO( \ 294 const struct ib_wc *wc, \ 295 const struct rpcrdma_frwr *frwr \ 296 ), \ 297 TP_ARGS(wc, frwr)) 298 299 TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL); 300 TRACE_DEFINE_ENUM(DMA_TO_DEVICE); 301 TRACE_DEFINE_ENUM(DMA_FROM_DEVICE); 302 TRACE_DEFINE_ENUM(DMA_NONE); 303 304 #define xprtrdma_show_direction(x) \ 305 __print_symbolic(x, \ 306 { DMA_BIDIRECTIONAL, "BIDIR" }, \ 307 { DMA_TO_DEVICE, "TO_DEVICE" }, \ 308 { DMA_FROM_DEVICE, "FROM_DEVICE" }, \ 309 { DMA_NONE, "NONE" }) 310 311 DECLARE_EVENT_CLASS(xprtrdma_mr, 312 TP_PROTO( 313 const struct rpcrdma_mr *mr 314 ), 315 316 TP_ARGS(mr), 317 318 TP_STRUCT__entry( 319 __field(u32, mr_id) 320 __field(int, nents) 321 __field(u32, handle) 322 __field(u32, length) 323 __field(u64, offset) 324 __field(u32, dir) 325 ), 326 327 TP_fast_assign( 328 __entry->mr_id = mr->frwr.fr_mr->res.id; 329 __entry->nents = mr->mr_nents; 330 __entry->handle = mr->mr_handle; 331 __entry->length = mr->mr_length; 332 __entry->offset = mr->mr_offset; 333 __entry->dir = mr->mr_dir; 334 ), 335 336 TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)", 337 __entry->mr_id, __entry->nents, __entry->length, 338 (unsigned long long)__entry->offset, __entry->handle, 339 xprtrdma_show_direction(__entry->dir) 340 ) 341 ); 342 343 #define DEFINE_MR_EVENT(name) \ 344 DEFINE_EVENT(xprtrdma_mr, xprtrdma_mr_##name, \ 345 TP_PROTO( \ 346 const struct rpcrdma_mr *mr \ 347 ), \ 348 TP_ARGS(mr)) 349 350 DECLARE_EVENT_CLASS(xprtrdma_cb_event, 351 TP_PROTO( 352 const struct rpc_rqst *rqst 353 ), 354 355 TP_ARGS(rqst), 356 357 TP_STRUCT__entry( 358 __field(const void *, rqst) 359 __field(const void *, rep) 360 __field(const void *, req) 361 __field(u32, xid) 362 ), 363 364 TP_fast_assign( 365 __entry->rqst = rqst; 366 __entry->req = rpcr_to_rdmar(rqst); 367 __entry->rep = rpcr_to_rdmar(rqst)->rl_reply; 368 __entry->xid = be32_to_cpu(rqst->rq_xid); 369 ), 370 371 TP_printk("xid=0x%08x, rqst=%p req=%p rep=%p", 372 __entry->xid, __entry->rqst, __entry->req, __entry->rep 373 ) 374 ); 375 376 #define DEFINE_CB_EVENT(name) \ 377 DEFINE_EVENT(xprtrdma_cb_event, name, \ 378 TP_PROTO( \ 379 const struct rpc_rqst *rqst \ 380 ), \ 381 TP_ARGS(rqst)) 382 383 /** 384 ** Connection events 385 **/ 386 387 TRACE_EVENT(xprtrdma_inline_thresh, 388 TP_PROTO( 389 const struct rpcrdma_ep *ep 390 ), 391 392 TP_ARGS(ep), 393 394 TP_STRUCT__entry( 395 __field(unsigned int, inline_send) 396 __field(unsigned int, inline_recv) 397 __field(unsigned int, max_send) 398 __field(unsigned int, max_recv) 399 __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 400 __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 401 ), 402 403 TP_fast_assign( 404 const struct rdma_cm_id *id = ep->re_id; 405 406 __entry->inline_send = ep->re_inline_send; 407 __entry->inline_recv = ep->re_inline_recv; 408 __entry->max_send = ep->re_max_inline_send; 409 __entry->max_recv = ep->re_max_inline_recv; 410 memcpy(__entry->srcaddr, &id->route.addr.src_addr, 411 sizeof(struct sockaddr_in6)); 412 memcpy(__entry->dstaddr, &id->route.addr.dst_addr, 413 sizeof(struct sockaddr_in6)); 414 ), 415 416 TP_printk("%pISpc -> %pISpc neg send/recv=%u/%u, calc send/recv=%u/%u", 417 __entry->srcaddr, __entry->dstaddr, 418 __entry->inline_send, __entry->inline_recv, 419 __entry->max_send, __entry->max_recv 420 ) 421 ); 422 423 DEFINE_CONN_EVENT(connect); 424 DEFINE_CONN_EVENT(disconnect); 425 426 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc); 427 428 TRACE_EVENT(xprtrdma_op_connect, 429 TP_PROTO( 430 const struct rpcrdma_xprt *r_xprt, 431 unsigned long delay 432 ), 433 434 TP_ARGS(r_xprt, delay), 435 436 TP_STRUCT__entry( 437 __field(const void *, r_xprt) 438 __field(unsigned long, delay) 439 __string(addr, rpcrdma_addrstr(r_xprt)) 440 __string(port, rpcrdma_portstr(r_xprt)) 441 ), 442 443 TP_fast_assign( 444 __entry->r_xprt = r_xprt; 445 __entry->delay = delay; 446 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 447 __assign_str(port, rpcrdma_portstr(r_xprt)); 448 ), 449 450 TP_printk("peer=[%s]:%s r_xprt=%p delay=%lu", 451 __get_str(addr), __get_str(port), __entry->r_xprt, 452 __entry->delay 453 ) 454 ); 455 456 457 TRACE_EVENT(xprtrdma_op_set_cto, 458 TP_PROTO( 459 const struct rpcrdma_xprt *r_xprt, 460 unsigned long connect, 461 unsigned long reconnect 462 ), 463 464 TP_ARGS(r_xprt, connect, reconnect), 465 466 TP_STRUCT__entry( 467 __field(const void *, r_xprt) 468 __field(unsigned long, connect) 469 __field(unsigned long, reconnect) 470 __string(addr, rpcrdma_addrstr(r_xprt)) 471 __string(port, rpcrdma_portstr(r_xprt)) 472 ), 473 474 TP_fast_assign( 475 __entry->r_xprt = r_xprt; 476 __entry->connect = connect; 477 __entry->reconnect = reconnect; 478 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 479 __assign_str(port, rpcrdma_portstr(r_xprt)); 480 ), 481 482 TP_printk("peer=[%s]:%s r_xprt=%p: connect=%lu reconnect=%lu", 483 __get_str(addr), __get_str(port), __entry->r_xprt, 484 __entry->connect / HZ, __entry->reconnect / HZ 485 ) 486 ); 487 488 TRACE_EVENT(xprtrdma_qp_event, 489 TP_PROTO( 490 const struct rpcrdma_ep *ep, 491 const struct ib_event *event 492 ), 493 494 TP_ARGS(ep, event), 495 496 TP_STRUCT__entry( 497 __field(unsigned long, event) 498 __string(name, event->device->name) 499 __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6)) 500 __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6)) 501 ), 502 503 TP_fast_assign( 504 const struct rdma_cm_id *id = ep->re_id; 505 506 __entry->event = event->event; 507 __assign_str(name, event->device->name); 508 memcpy(__entry->srcaddr, &id->route.addr.src_addr, 509 sizeof(struct sockaddr_in6)); 510 memcpy(__entry->dstaddr, &id->route.addr.dst_addr, 511 sizeof(struct sockaddr_in6)); 512 ), 513 514 TP_printk("%pISpc -> %pISpc device=%s %s (%lu)", 515 __entry->srcaddr, __entry->dstaddr, __get_str(name), 516 rdma_show_ib_event(__entry->event), __entry->event 517 ) 518 ); 519 520 /** 521 ** Call events 522 **/ 523 524 TRACE_EVENT(xprtrdma_createmrs, 525 TP_PROTO( 526 const struct rpcrdma_xprt *r_xprt, 527 unsigned int count 528 ), 529 530 TP_ARGS(r_xprt, count), 531 532 TP_STRUCT__entry( 533 __field(const void *, r_xprt) 534 __string(addr, rpcrdma_addrstr(r_xprt)) 535 __string(port, rpcrdma_portstr(r_xprt)) 536 __field(unsigned int, count) 537 ), 538 539 TP_fast_assign( 540 __entry->r_xprt = r_xprt; 541 __entry->count = count; 542 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 543 __assign_str(port, rpcrdma_portstr(r_xprt)); 544 ), 545 546 TP_printk("peer=[%s]:%s r_xprt=%p: created %u MRs", 547 __get_str(addr), __get_str(port), __entry->r_xprt, 548 __entry->count 549 ) 550 ); 551 552 TRACE_EVENT(xprtrdma_mr_get, 553 TP_PROTO( 554 const struct rpcrdma_req *req 555 ), 556 557 TP_ARGS(req), 558 559 TP_STRUCT__entry( 560 __field(const void *, req) 561 __field(unsigned int, task_id) 562 __field(unsigned int, client_id) 563 __field(u32, xid) 564 ), 565 566 TP_fast_assign( 567 const struct rpc_rqst *rqst = &req->rl_slot; 568 569 __entry->req = req; 570 __entry->task_id = rqst->rq_task->tk_pid; 571 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 572 __entry->xid = be32_to_cpu(rqst->rq_xid); 573 ), 574 575 TP_printk("task:%u@%u xid=0x%08x req=%p", 576 __entry->task_id, __entry->client_id, __entry->xid, 577 __entry->req 578 ) 579 ); 580 581 TRACE_EVENT(xprtrdma_nomrs, 582 TP_PROTO( 583 const struct rpcrdma_req *req 584 ), 585 586 TP_ARGS(req), 587 588 TP_STRUCT__entry( 589 __field(const void *, req) 590 __field(unsigned int, task_id) 591 __field(unsigned int, client_id) 592 __field(u32, xid) 593 ), 594 595 TP_fast_assign( 596 const struct rpc_rqst *rqst = &req->rl_slot; 597 598 __entry->req = req; 599 __entry->task_id = rqst->rq_task->tk_pid; 600 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 601 __entry->xid = be32_to_cpu(rqst->rq_xid); 602 ), 603 604 TP_printk("task:%u@%u xid=0x%08x req=%p", 605 __entry->task_id, __entry->client_id, __entry->xid, 606 __entry->req 607 ) 608 ); 609 610 DEFINE_RDCH_EVENT(read); 611 DEFINE_WRCH_EVENT(write); 612 DEFINE_WRCH_EVENT(reply); 613 614 TRACE_DEFINE_ENUM(rpcrdma_noch); 615 TRACE_DEFINE_ENUM(rpcrdma_noch_pullup); 616 TRACE_DEFINE_ENUM(rpcrdma_noch_mapped); 617 TRACE_DEFINE_ENUM(rpcrdma_readch); 618 TRACE_DEFINE_ENUM(rpcrdma_areadch); 619 TRACE_DEFINE_ENUM(rpcrdma_writech); 620 TRACE_DEFINE_ENUM(rpcrdma_replych); 621 622 #define xprtrdma_show_chunktype(x) \ 623 __print_symbolic(x, \ 624 { rpcrdma_noch, "inline" }, \ 625 { rpcrdma_noch_pullup, "pullup" }, \ 626 { rpcrdma_noch_mapped, "mapped" }, \ 627 { rpcrdma_readch, "read list" }, \ 628 { rpcrdma_areadch, "*read list" }, \ 629 { rpcrdma_writech, "write list" }, \ 630 { rpcrdma_replych, "reply chunk" }) 631 632 TRACE_EVENT(xprtrdma_marshal, 633 TP_PROTO( 634 const struct rpcrdma_req *req, 635 unsigned int rtype, 636 unsigned int wtype 637 ), 638 639 TP_ARGS(req, rtype, wtype), 640 641 TP_STRUCT__entry( 642 __field(unsigned int, task_id) 643 __field(unsigned int, client_id) 644 __field(u32, xid) 645 __field(unsigned int, hdrlen) 646 __field(unsigned int, headlen) 647 __field(unsigned int, pagelen) 648 __field(unsigned int, taillen) 649 __field(unsigned int, rtype) 650 __field(unsigned int, wtype) 651 ), 652 653 TP_fast_assign( 654 const struct rpc_rqst *rqst = &req->rl_slot; 655 656 __entry->task_id = rqst->rq_task->tk_pid; 657 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 658 __entry->xid = be32_to_cpu(rqst->rq_xid); 659 __entry->hdrlen = req->rl_hdrbuf.len; 660 __entry->headlen = rqst->rq_snd_buf.head[0].iov_len; 661 __entry->pagelen = rqst->rq_snd_buf.page_len; 662 __entry->taillen = rqst->rq_snd_buf.tail[0].iov_len; 663 __entry->rtype = rtype; 664 __entry->wtype = wtype; 665 ), 666 667 TP_printk("task:%u@%u xid=0x%08x: hdr=%u xdr=%u/%u/%u %s/%s", 668 __entry->task_id, __entry->client_id, __entry->xid, 669 __entry->hdrlen, 670 __entry->headlen, __entry->pagelen, __entry->taillen, 671 xprtrdma_show_chunktype(__entry->rtype), 672 xprtrdma_show_chunktype(__entry->wtype) 673 ) 674 ); 675 676 TRACE_EVENT(xprtrdma_marshal_failed, 677 TP_PROTO(const struct rpc_rqst *rqst, 678 int ret 679 ), 680 681 TP_ARGS(rqst, ret), 682 683 TP_STRUCT__entry( 684 __field(unsigned int, task_id) 685 __field(unsigned int, client_id) 686 __field(u32, xid) 687 __field(int, ret) 688 ), 689 690 TP_fast_assign( 691 __entry->task_id = rqst->rq_task->tk_pid; 692 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 693 __entry->xid = be32_to_cpu(rqst->rq_xid); 694 __entry->ret = ret; 695 ), 696 697 TP_printk("task:%u@%u xid=0x%08x: ret=%d", 698 __entry->task_id, __entry->client_id, __entry->xid, 699 __entry->ret 700 ) 701 ); 702 703 TRACE_EVENT(xprtrdma_prepsend_failed, 704 TP_PROTO(const struct rpc_rqst *rqst, 705 int ret 706 ), 707 708 TP_ARGS(rqst, ret), 709 710 TP_STRUCT__entry( 711 __field(unsigned int, task_id) 712 __field(unsigned int, client_id) 713 __field(u32, xid) 714 __field(int, ret) 715 ), 716 717 TP_fast_assign( 718 __entry->task_id = rqst->rq_task->tk_pid; 719 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 720 __entry->xid = be32_to_cpu(rqst->rq_xid); 721 __entry->ret = ret; 722 ), 723 724 TP_printk("task:%u@%u xid=0x%08x: ret=%d", 725 __entry->task_id, __entry->client_id, __entry->xid, 726 __entry->ret 727 ) 728 ); 729 730 TRACE_EVENT(xprtrdma_post_send, 731 TP_PROTO( 732 const struct rpcrdma_req *req 733 ), 734 735 TP_ARGS(req), 736 737 TP_STRUCT__entry( 738 __field(const void *, req) 739 __field(const void *, sc) 740 __field(unsigned int, task_id) 741 __field(unsigned int, client_id) 742 __field(int, num_sge) 743 __field(int, signaled) 744 ), 745 746 TP_fast_assign( 747 const struct rpc_rqst *rqst = &req->rl_slot; 748 749 __entry->task_id = rqst->rq_task->tk_pid; 750 __entry->client_id = rqst->rq_task->tk_client ? 751 rqst->rq_task->tk_client->cl_clid : -1; 752 __entry->req = req; 753 __entry->sc = req->rl_sendctx; 754 __entry->num_sge = req->rl_wr.num_sge; 755 __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED; 756 ), 757 758 TP_printk("task:%u@%u req=%p sc=%p (%d SGE%s) %s", 759 __entry->task_id, __entry->client_id, 760 __entry->req, __entry->sc, __entry->num_sge, 761 (__entry->num_sge == 1 ? "" : "s"), 762 (__entry->signaled ? "signaled" : "") 763 ) 764 ); 765 766 TRACE_EVENT(xprtrdma_post_recv, 767 TP_PROTO( 768 const struct rpcrdma_rep *rep 769 ), 770 771 TP_ARGS(rep), 772 773 TP_STRUCT__entry( 774 __field(const void *, rep) 775 ), 776 777 TP_fast_assign( 778 __entry->rep = rep; 779 ), 780 781 TP_printk("rep=%p", 782 __entry->rep 783 ) 784 ); 785 786 TRACE_EVENT(xprtrdma_post_recvs, 787 TP_PROTO( 788 const struct rpcrdma_xprt *r_xprt, 789 unsigned int count, 790 int status 791 ), 792 793 TP_ARGS(r_xprt, count, status), 794 795 TP_STRUCT__entry( 796 __field(const void *, r_xprt) 797 __field(unsigned int, count) 798 __field(int, status) 799 __field(int, posted) 800 __string(addr, rpcrdma_addrstr(r_xprt)) 801 __string(port, rpcrdma_portstr(r_xprt)) 802 ), 803 804 TP_fast_assign( 805 __entry->r_xprt = r_xprt; 806 __entry->count = count; 807 __entry->status = status; 808 __entry->posted = r_xprt->rx_ep->re_receive_count; 809 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 810 __assign_str(port, rpcrdma_portstr(r_xprt)); 811 ), 812 813 TP_printk("peer=[%s]:%s r_xprt=%p: %u new recvs, %d active (rc %d)", 814 __get_str(addr), __get_str(port), __entry->r_xprt, 815 __entry->count, __entry->posted, __entry->status 816 ) 817 ); 818 819 TRACE_EVENT(xprtrdma_post_linv, 820 TP_PROTO( 821 const struct rpcrdma_req *req, 822 int status 823 ), 824 825 TP_ARGS(req, status), 826 827 TP_STRUCT__entry( 828 __field(const void *, req) 829 __field(int, status) 830 __field(u32, xid) 831 ), 832 833 TP_fast_assign( 834 __entry->req = req; 835 __entry->status = status; 836 __entry->xid = be32_to_cpu(req->rl_slot.rq_xid); 837 ), 838 839 TP_printk("req=%p xid=0x%08x status=%d", 840 __entry->req, __entry->xid, __entry->status 841 ) 842 ); 843 844 /** 845 ** Completion events 846 **/ 847 848 TRACE_EVENT(xprtrdma_wc_send, 849 TP_PROTO( 850 const struct rpcrdma_sendctx *sc, 851 const struct ib_wc *wc 852 ), 853 854 TP_ARGS(sc, wc), 855 856 TP_STRUCT__entry( 857 __field(const void *, req) 858 __field(const void *, sc) 859 __field(unsigned int, unmap_count) 860 __field(unsigned int, status) 861 __field(unsigned int, vendor_err) 862 ), 863 864 TP_fast_assign( 865 __entry->req = sc->sc_req; 866 __entry->sc = sc; 867 __entry->unmap_count = sc->sc_unmap_count; 868 __entry->status = wc->status; 869 __entry->vendor_err = __entry->status ? wc->vendor_err : 0; 870 ), 871 872 TP_printk("req=%p sc=%p unmapped=%u: %s (%u/0x%x)", 873 __entry->req, __entry->sc, __entry->unmap_count, 874 rdma_show_wc_status(__entry->status), 875 __entry->status, __entry->vendor_err 876 ) 877 ); 878 879 TRACE_EVENT(xprtrdma_wc_receive, 880 TP_PROTO( 881 const struct ib_wc *wc 882 ), 883 884 TP_ARGS(wc), 885 886 TP_STRUCT__entry( 887 __field(const void *, rep) 888 __field(u32, byte_len) 889 __field(unsigned int, status) 890 __field(u32, vendor_err) 891 ), 892 893 TP_fast_assign( 894 __entry->rep = container_of(wc->wr_cqe, struct rpcrdma_rep, 895 rr_cqe); 896 __entry->status = wc->status; 897 if (wc->status) { 898 __entry->byte_len = 0; 899 __entry->vendor_err = wc->vendor_err; 900 } else { 901 __entry->byte_len = wc->byte_len; 902 __entry->vendor_err = 0; 903 } 904 ), 905 906 TP_printk("rep=%p %u bytes: %s (%u/0x%x)", 907 __entry->rep, __entry->byte_len, 908 rdma_show_wc_status(__entry->status), 909 __entry->status, __entry->vendor_err 910 ) 911 ); 912 913 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_fastreg); 914 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li); 915 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_wake); 916 DEFINE_FRWR_DONE_EVENT(xprtrdma_wc_li_done); 917 918 TRACE_EVENT(xprtrdma_frwr_alloc, 919 TP_PROTO( 920 const struct rpcrdma_mr *mr, 921 int rc 922 ), 923 924 TP_ARGS(mr, rc), 925 926 TP_STRUCT__entry( 927 __field(u32, mr_id) 928 __field(int, rc) 929 ), 930 931 TP_fast_assign( 932 __entry->mr_id = mr->frwr.fr_mr->res.id; 933 __entry->rc = rc; 934 ), 935 936 TP_printk("mr.id=%u: rc=%d", 937 __entry->mr_id, __entry->rc 938 ) 939 ); 940 941 TRACE_EVENT(xprtrdma_frwr_dereg, 942 TP_PROTO( 943 const struct rpcrdma_mr *mr, 944 int rc 945 ), 946 947 TP_ARGS(mr, rc), 948 949 TP_STRUCT__entry( 950 __field(u32, mr_id) 951 __field(int, nents) 952 __field(u32, handle) 953 __field(u32, length) 954 __field(u64, offset) 955 __field(u32, dir) 956 __field(int, rc) 957 ), 958 959 TP_fast_assign( 960 __entry->mr_id = mr->frwr.fr_mr->res.id; 961 __entry->nents = mr->mr_nents; 962 __entry->handle = mr->mr_handle; 963 __entry->length = mr->mr_length; 964 __entry->offset = mr->mr_offset; 965 __entry->dir = mr->mr_dir; 966 __entry->rc = rc; 967 ), 968 969 TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s): rc=%d", 970 __entry->mr_id, __entry->nents, __entry->length, 971 (unsigned long long)__entry->offset, __entry->handle, 972 xprtrdma_show_direction(__entry->dir), 973 __entry->rc 974 ) 975 ); 976 977 TRACE_EVENT(xprtrdma_frwr_sgerr, 978 TP_PROTO( 979 const struct rpcrdma_mr *mr, 980 int sg_nents 981 ), 982 983 TP_ARGS(mr, sg_nents), 984 985 TP_STRUCT__entry( 986 __field(u32, mr_id) 987 __field(u64, addr) 988 __field(u32, dir) 989 __field(int, nents) 990 ), 991 992 TP_fast_assign( 993 __entry->mr_id = mr->frwr.fr_mr->res.id; 994 __entry->addr = mr->mr_sg->dma_address; 995 __entry->dir = mr->mr_dir; 996 __entry->nents = sg_nents; 997 ), 998 999 TP_printk("mr.id=%u DMA addr=0x%llx (%s) sg_nents=%d", 1000 __entry->mr_id, __entry->addr, 1001 xprtrdma_show_direction(__entry->dir), 1002 __entry->nents 1003 ) 1004 ); 1005 1006 TRACE_EVENT(xprtrdma_frwr_maperr, 1007 TP_PROTO( 1008 const struct rpcrdma_mr *mr, 1009 int num_mapped 1010 ), 1011 1012 TP_ARGS(mr, num_mapped), 1013 1014 TP_STRUCT__entry( 1015 __field(u32, mr_id) 1016 __field(u64, addr) 1017 __field(u32, dir) 1018 __field(int, num_mapped) 1019 __field(int, nents) 1020 ), 1021 1022 TP_fast_assign( 1023 __entry->mr_id = mr->frwr.fr_mr->res.id; 1024 __entry->addr = mr->mr_sg->dma_address; 1025 __entry->dir = mr->mr_dir; 1026 __entry->num_mapped = num_mapped; 1027 __entry->nents = mr->mr_nents; 1028 ), 1029 1030 TP_printk("mr.id=%u DMA addr=0x%llx (%s) nents=%d of %d", 1031 __entry->mr_id, __entry->addr, 1032 xprtrdma_show_direction(__entry->dir), 1033 __entry->num_mapped, __entry->nents 1034 ) 1035 ); 1036 1037 DEFINE_MR_EVENT(localinv); 1038 DEFINE_MR_EVENT(map); 1039 DEFINE_MR_EVENT(unmap); 1040 DEFINE_MR_EVENT(reminv); 1041 DEFINE_MR_EVENT(recycle); 1042 1043 TRACE_EVENT(xprtrdma_dma_maperr, 1044 TP_PROTO( 1045 u64 addr 1046 ), 1047 1048 TP_ARGS(addr), 1049 1050 TP_STRUCT__entry( 1051 __field(u64, addr) 1052 ), 1053 1054 TP_fast_assign( 1055 __entry->addr = addr; 1056 ), 1057 1058 TP_printk("dma addr=0x%llx\n", __entry->addr) 1059 ); 1060 1061 /** 1062 ** Reply events 1063 **/ 1064 1065 TRACE_EVENT(xprtrdma_reply, 1066 TP_PROTO( 1067 const struct rpc_task *task, 1068 const struct rpcrdma_rep *rep, 1069 const struct rpcrdma_req *req, 1070 unsigned int credits 1071 ), 1072 1073 TP_ARGS(task, rep, req, credits), 1074 1075 TP_STRUCT__entry( 1076 __field(unsigned int, task_id) 1077 __field(unsigned int, client_id) 1078 __field(const void *, rep) 1079 __field(const void *, req) 1080 __field(u32, xid) 1081 __field(unsigned int, credits) 1082 ), 1083 1084 TP_fast_assign( 1085 __entry->task_id = task->tk_pid; 1086 __entry->client_id = task->tk_client->cl_clid; 1087 __entry->rep = rep; 1088 __entry->req = req; 1089 __entry->xid = be32_to_cpu(rep->rr_xid); 1090 __entry->credits = credits; 1091 ), 1092 1093 TP_printk("task:%u@%u xid=0x%08x, %u credits, rep=%p -> req=%p", 1094 __entry->task_id, __entry->client_id, __entry->xid, 1095 __entry->credits, __entry->rep, __entry->req 1096 ) 1097 ); 1098 1099 TRACE_EVENT(xprtrdma_defer_cmp, 1100 TP_PROTO( 1101 const struct rpcrdma_rep *rep 1102 ), 1103 1104 TP_ARGS(rep), 1105 1106 TP_STRUCT__entry( 1107 __field(unsigned int, task_id) 1108 __field(unsigned int, client_id) 1109 __field(const void *, rep) 1110 __field(u32, xid) 1111 ), 1112 1113 TP_fast_assign( 1114 __entry->task_id = rep->rr_rqst->rq_task->tk_pid; 1115 __entry->client_id = rep->rr_rqst->rq_task->tk_client->cl_clid; 1116 __entry->rep = rep; 1117 __entry->xid = be32_to_cpu(rep->rr_xid); 1118 ), 1119 1120 TP_printk("task:%u@%u xid=0x%08x rep=%p", 1121 __entry->task_id, __entry->client_id, __entry->xid, 1122 __entry->rep 1123 ) 1124 ); 1125 1126 DEFINE_REPLY_EVENT(xprtrdma_reply_vers); 1127 DEFINE_REPLY_EVENT(xprtrdma_reply_rqst); 1128 DEFINE_REPLY_EVENT(xprtrdma_reply_short); 1129 DEFINE_REPLY_EVENT(xprtrdma_reply_hdr); 1130 1131 TRACE_EVENT(xprtrdma_err_vers, 1132 TP_PROTO( 1133 const struct rpc_rqst *rqst, 1134 __be32 *min, 1135 __be32 *max 1136 ), 1137 1138 TP_ARGS(rqst, min, max), 1139 1140 TP_STRUCT__entry( 1141 __field(unsigned int, task_id) 1142 __field(unsigned int, client_id) 1143 __field(u32, xid) 1144 __field(u32, min) 1145 __field(u32, max) 1146 ), 1147 1148 TP_fast_assign( 1149 __entry->task_id = rqst->rq_task->tk_pid; 1150 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1151 __entry->xid = be32_to_cpu(rqst->rq_xid); 1152 __entry->min = be32_to_cpup(min); 1153 __entry->max = be32_to_cpup(max); 1154 ), 1155 1156 TP_printk("task:%u@%u xid=0x%08x versions=[%u, %u]", 1157 __entry->task_id, __entry->client_id, __entry->xid, 1158 __entry->min, __entry->max 1159 ) 1160 ); 1161 1162 TRACE_EVENT(xprtrdma_err_chunk, 1163 TP_PROTO( 1164 const struct rpc_rqst *rqst 1165 ), 1166 1167 TP_ARGS(rqst), 1168 1169 TP_STRUCT__entry( 1170 __field(unsigned int, task_id) 1171 __field(unsigned int, client_id) 1172 __field(u32, xid) 1173 ), 1174 1175 TP_fast_assign( 1176 __entry->task_id = rqst->rq_task->tk_pid; 1177 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1178 __entry->xid = be32_to_cpu(rqst->rq_xid); 1179 ), 1180 1181 TP_printk("task:%u@%u xid=0x%08x", 1182 __entry->task_id, __entry->client_id, __entry->xid 1183 ) 1184 ); 1185 1186 TRACE_EVENT(xprtrdma_err_unrecognized, 1187 TP_PROTO( 1188 const struct rpc_rqst *rqst, 1189 __be32 *procedure 1190 ), 1191 1192 TP_ARGS(rqst, procedure), 1193 1194 TP_STRUCT__entry( 1195 __field(unsigned int, task_id) 1196 __field(unsigned int, client_id) 1197 __field(u32, xid) 1198 __field(u32, procedure) 1199 ), 1200 1201 TP_fast_assign( 1202 __entry->task_id = rqst->rq_task->tk_pid; 1203 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1204 __entry->procedure = be32_to_cpup(procedure); 1205 ), 1206 1207 TP_printk("task:%u@%u xid=0x%08x procedure=%u", 1208 __entry->task_id, __entry->client_id, __entry->xid, 1209 __entry->procedure 1210 ) 1211 ); 1212 1213 TRACE_EVENT(xprtrdma_fixup, 1214 TP_PROTO( 1215 const struct rpc_rqst *rqst, 1216 unsigned long fixup 1217 ), 1218 1219 TP_ARGS(rqst, fixup), 1220 1221 TP_STRUCT__entry( 1222 __field(unsigned int, task_id) 1223 __field(unsigned int, client_id) 1224 __field(unsigned long, fixup) 1225 __field(size_t, headlen) 1226 __field(unsigned int, pagelen) 1227 __field(size_t, taillen) 1228 ), 1229 1230 TP_fast_assign( 1231 __entry->task_id = rqst->rq_task->tk_pid; 1232 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1233 __entry->fixup = fixup; 1234 __entry->headlen = rqst->rq_rcv_buf.head[0].iov_len; 1235 __entry->pagelen = rqst->rq_rcv_buf.page_len; 1236 __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len; 1237 ), 1238 1239 TP_printk("task:%u@%u fixup=%lu xdr=%zu/%u/%zu", 1240 __entry->task_id, __entry->client_id, __entry->fixup, 1241 __entry->headlen, __entry->pagelen, __entry->taillen 1242 ) 1243 ); 1244 1245 TRACE_EVENT(xprtrdma_decode_seg, 1246 TP_PROTO( 1247 u32 handle, 1248 u32 length, 1249 u64 offset 1250 ), 1251 1252 TP_ARGS(handle, length, offset), 1253 1254 TP_STRUCT__entry( 1255 __field(u32, handle) 1256 __field(u32, length) 1257 __field(u64, offset) 1258 ), 1259 1260 TP_fast_assign( 1261 __entry->handle = handle; 1262 __entry->length = length; 1263 __entry->offset = offset; 1264 ), 1265 1266 TP_printk("%u@0x%016llx:0x%08x", 1267 __entry->length, (unsigned long long)__entry->offset, 1268 __entry->handle 1269 ) 1270 ); 1271 1272 /** 1273 ** Callback events 1274 **/ 1275 1276 TRACE_EVENT(xprtrdma_cb_setup, 1277 TP_PROTO( 1278 const struct rpcrdma_xprt *r_xprt, 1279 unsigned int reqs 1280 ), 1281 1282 TP_ARGS(r_xprt, reqs), 1283 1284 TP_STRUCT__entry( 1285 __field(const void *, r_xprt) 1286 __field(unsigned int, reqs) 1287 __string(addr, rpcrdma_addrstr(r_xprt)) 1288 __string(port, rpcrdma_portstr(r_xprt)) 1289 ), 1290 1291 TP_fast_assign( 1292 __entry->r_xprt = r_xprt; 1293 __entry->reqs = reqs; 1294 __assign_str(addr, rpcrdma_addrstr(r_xprt)); 1295 __assign_str(port, rpcrdma_portstr(r_xprt)); 1296 ), 1297 1298 TP_printk("peer=[%s]:%s r_xprt=%p: %u reqs", 1299 __get_str(addr), __get_str(port), 1300 __entry->r_xprt, __entry->reqs 1301 ) 1302 ); 1303 1304 DEFINE_CB_EVENT(xprtrdma_cb_call); 1305 DEFINE_CB_EVENT(xprtrdma_cb_reply); 1306 1307 TRACE_EVENT(xprtrdma_leaked_rep, 1308 TP_PROTO( 1309 const struct rpc_rqst *rqst, 1310 const struct rpcrdma_rep *rep 1311 ), 1312 1313 TP_ARGS(rqst, rep), 1314 1315 TP_STRUCT__entry( 1316 __field(unsigned int, task_id) 1317 __field(unsigned int, client_id) 1318 __field(u32, xid) 1319 __field(const void *, rep) 1320 ), 1321 1322 TP_fast_assign( 1323 __entry->task_id = rqst->rq_task->tk_pid; 1324 __entry->client_id = rqst->rq_task->tk_client->cl_clid; 1325 __entry->xid = be32_to_cpu(rqst->rq_xid); 1326 __entry->rep = rep; 1327 ), 1328 1329 TP_printk("task:%u@%u xid=0x%08x rep=%p", 1330 __entry->task_id, __entry->client_id, __entry->xid, 1331 __entry->rep 1332 ) 1333 ); 1334 1335 /** 1336 ** Server-side RPC/RDMA events 1337 **/ 1338 1339 DECLARE_EVENT_CLASS(svcrdma_accept_class, 1340 TP_PROTO( 1341 const struct svcxprt_rdma *rdma, 1342 long status 1343 ), 1344 1345 TP_ARGS(rdma, status), 1346 1347 TP_STRUCT__entry( 1348 __field(long, status) 1349 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1350 ), 1351 1352 TP_fast_assign( 1353 __entry->status = status; 1354 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1355 ), 1356 1357 TP_printk("addr=%s status=%ld", 1358 __get_str(addr), __entry->status 1359 ) 1360 ); 1361 1362 #define DEFINE_ACCEPT_EVENT(name) \ 1363 DEFINE_EVENT(svcrdma_accept_class, svcrdma_##name##_err, \ 1364 TP_PROTO( \ 1365 const struct svcxprt_rdma *rdma, \ 1366 long status \ 1367 ), \ 1368 TP_ARGS(rdma, status)) 1369 1370 DEFINE_ACCEPT_EVENT(pd); 1371 DEFINE_ACCEPT_EVENT(qp); 1372 DEFINE_ACCEPT_EVENT(fabric); 1373 DEFINE_ACCEPT_EVENT(initdepth); 1374 DEFINE_ACCEPT_EVENT(accept); 1375 1376 TRACE_DEFINE_ENUM(RDMA_MSG); 1377 TRACE_DEFINE_ENUM(RDMA_NOMSG); 1378 TRACE_DEFINE_ENUM(RDMA_MSGP); 1379 TRACE_DEFINE_ENUM(RDMA_DONE); 1380 TRACE_DEFINE_ENUM(RDMA_ERROR); 1381 1382 #define show_rpcrdma_proc(x) \ 1383 __print_symbolic(x, \ 1384 { RDMA_MSG, "RDMA_MSG" }, \ 1385 { RDMA_NOMSG, "RDMA_NOMSG" }, \ 1386 { RDMA_MSGP, "RDMA_MSGP" }, \ 1387 { RDMA_DONE, "RDMA_DONE" }, \ 1388 { RDMA_ERROR, "RDMA_ERROR" }) 1389 1390 TRACE_EVENT(svcrdma_decode_rqst, 1391 TP_PROTO( 1392 const struct svc_rdma_recv_ctxt *ctxt, 1393 __be32 *p, 1394 unsigned int hdrlen 1395 ), 1396 1397 TP_ARGS(ctxt, p, hdrlen), 1398 1399 TP_STRUCT__entry( 1400 __field(u32, cq_id) 1401 __field(int, completion_id) 1402 __field(u32, xid) 1403 __field(u32, vers) 1404 __field(u32, proc) 1405 __field(u32, credits) 1406 __field(unsigned int, hdrlen) 1407 ), 1408 1409 TP_fast_assign( 1410 __entry->cq_id = ctxt->rc_cid.ci_queue_id; 1411 __entry->completion_id = ctxt->rc_cid.ci_completion_id; 1412 __entry->xid = be32_to_cpup(p++); 1413 __entry->vers = be32_to_cpup(p++); 1414 __entry->credits = be32_to_cpup(p++); 1415 __entry->proc = be32_to_cpup(p); 1416 __entry->hdrlen = hdrlen; 1417 ), 1418 1419 TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u", 1420 __entry->cq_id, __entry->completion_id, 1421 __entry->xid, __entry->vers, __entry->credits, 1422 show_rpcrdma_proc(__entry->proc), __entry->hdrlen) 1423 ); 1424 1425 TRACE_EVENT(svcrdma_decode_short_err, 1426 TP_PROTO( 1427 const struct svc_rdma_recv_ctxt *ctxt, 1428 unsigned int hdrlen 1429 ), 1430 1431 TP_ARGS(ctxt, hdrlen), 1432 1433 TP_STRUCT__entry( 1434 __field(u32, cq_id) 1435 __field(int, completion_id) 1436 __field(unsigned int, hdrlen) 1437 ), 1438 1439 TP_fast_assign( 1440 __entry->cq_id = ctxt->rc_cid.ci_queue_id; 1441 __entry->completion_id = ctxt->rc_cid.ci_completion_id; 1442 __entry->hdrlen = hdrlen; 1443 ), 1444 1445 TP_printk("cq.id=%u cid=%d hdrlen=%u", 1446 __entry->cq_id, __entry->completion_id, 1447 __entry->hdrlen) 1448 ); 1449 1450 DECLARE_EVENT_CLASS(svcrdma_badreq_event, 1451 TP_PROTO( 1452 const struct svc_rdma_recv_ctxt *ctxt, 1453 __be32 *p 1454 ), 1455 1456 TP_ARGS(ctxt, p), 1457 1458 TP_STRUCT__entry( 1459 __field(u32, cq_id) 1460 __field(int, completion_id) 1461 __field(u32, xid) 1462 __field(u32, vers) 1463 __field(u32, proc) 1464 __field(u32, credits) 1465 ), 1466 1467 TP_fast_assign( 1468 __entry->cq_id = ctxt->rc_cid.ci_queue_id; 1469 __entry->completion_id = ctxt->rc_cid.ci_completion_id; 1470 __entry->xid = be32_to_cpup(p++); 1471 __entry->vers = be32_to_cpup(p++); 1472 __entry->credits = be32_to_cpup(p++); 1473 __entry->proc = be32_to_cpup(p); 1474 ), 1475 1476 TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%u", 1477 __entry->cq_id, __entry->completion_id, 1478 __entry->xid, __entry->vers, __entry->credits, __entry->proc) 1479 ); 1480 1481 #define DEFINE_BADREQ_EVENT(name) \ 1482 DEFINE_EVENT(svcrdma_badreq_event, \ 1483 svcrdma_decode_##name##_err, \ 1484 TP_PROTO( \ 1485 const struct svc_rdma_recv_ctxt *ctxt, \ 1486 __be32 *p \ 1487 ), \ 1488 TP_ARGS(ctxt, p)) 1489 1490 DEFINE_BADREQ_EVENT(badvers); 1491 DEFINE_BADREQ_EVENT(drop); 1492 DEFINE_BADREQ_EVENT(badproc); 1493 DEFINE_BADREQ_EVENT(parse); 1494 1495 DECLARE_EVENT_CLASS(svcrdma_segment_event, 1496 TP_PROTO( 1497 u32 handle, 1498 u32 length, 1499 u64 offset 1500 ), 1501 1502 TP_ARGS(handle, length, offset), 1503 1504 TP_STRUCT__entry( 1505 __field(u32, handle) 1506 __field(u32, length) 1507 __field(u64, offset) 1508 ), 1509 1510 TP_fast_assign( 1511 __entry->handle = handle; 1512 __entry->length = length; 1513 __entry->offset = offset; 1514 ), 1515 1516 TP_printk("%u@0x%016llx:0x%08x", 1517 __entry->length, (unsigned long long)__entry->offset, 1518 __entry->handle 1519 ) 1520 ); 1521 1522 #define DEFINE_SEGMENT_EVENT(name) \ 1523 DEFINE_EVENT(svcrdma_segment_event, svcrdma_##name,\ 1524 TP_PROTO( \ 1525 u32 handle, \ 1526 u32 length, \ 1527 u64 offset \ 1528 ), \ 1529 TP_ARGS(handle, length, offset)) 1530 1531 DEFINE_SEGMENT_EVENT(decode_wseg); 1532 DEFINE_SEGMENT_EVENT(encode_rseg); 1533 DEFINE_SEGMENT_EVENT(send_rseg); 1534 DEFINE_SEGMENT_EVENT(encode_wseg); 1535 DEFINE_SEGMENT_EVENT(send_wseg); 1536 1537 DECLARE_EVENT_CLASS(svcrdma_chunk_event, 1538 TP_PROTO( 1539 u32 length 1540 ), 1541 1542 TP_ARGS(length), 1543 1544 TP_STRUCT__entry( 1545 __field(u32, length) 1546 ), 1547 1548 TP_fast_assign( 1549 __entry->length = length; 1550 ), 1551 1552 TP_printk("length=%u", 1553 __entry->length 1554 ) 1555 ); 1556 1557 #define DEFINE_CHUNK_EVENT(name) \ 1558 DEFINE_EVENT(svcrdma_chunk_event, svcrdma_##name, \ 1559 TP_PROTO( \ 1560 u32 length \ 1561 ), \ 1562 TP_ARGS(length)) 1563 1564 DEFINE_CHUNK_EVENT(send_pzr); 1565 DEFINE_CHUNK_EVENT(encode_write_chunk); 1566 DEFINE_CHUNK_EVENT(send_write_chunk); 1567 DEFINE_CHUNK_EVENT(encode_read_chunk); 1568 DEFINE_CHUNK_EVENT(send_reply_chunk); 1569 1570 TRACE_EVENT(svcrdma_send_read_chunk, 1571 TP_PROTO( 1572 u32 length, 1573 u32 position 1574 ), 1575 1576 TP_ARGS(length, position), 1577 1578 TP_STRUCT__entry( 1579 __field(u32, length) 1580 __field(u32, position) 1581 ), 1582 1583 TP_fast_assign( 1584 __entry->length = length; 1585 __entry->position = position; 1586 ), 1587 1588 TP_printk("length=%u position=%u", 1589 __entry->length, __entry->position 1590 ) 1591 ); 1592 1593 DECLARE_EVENT_CLASS(svcrdma_error_event, 1594 TP_PROTO( 1595 __be32 xid 1596 ), 1597 1598 TP_ARGS(xid), 1599 1600 TP_STRUCT__entry( 1601 __field(u32, xid) 1602 ), 1603 1604 TP_fast_assign( 1605 __entry->xid = be32_to_cpu(xid); 1606 ), 1607 1608 TP_printk("xid=0x%08x", 1609 __entry->xid 1610 ) 1611 ); 1612 1613 #define DEFINE_ERROR_EVENT(name) \ 1614 DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name, \ 1615 TP_PROTO( \ 1616 __be32 xid \ 1617 ), \ 1618 TP_ARGS(xid)) 1619 1620 DEFINE_ERROR_EVENT(vers); 1621 DEFINE_ERROR_EVENT(chunk); 1622 1623 /** 1624 ** Server-side RDMA API events 1625 **/ 1626 1627 DECLARE_EVENT_CLASS(svcrdma_dma_map_class, 1628 TP_PROTO( 1629 const struct svcxprt_rdma *rdma, 1630 u64 dma_addr, 1631 u32 length 1632 ), 1633 1634 TP_ARGS(rdma, dma_addr, length), 1635 1636 TP_STRUCT__entry( 1637 __field(u64, dma_addr) 1638 __field(u32, length) 1639 __string(device, rdma->sc_cm_id->device->name) 1640 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1641 ), 1642 1643 TP_fast_assign( 1644 __entry->dma_addr = dma_addr; 1645 __entry->length = length; 1646 __assign_str(device, rdma->sc_cm_id->device->name); 1647 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1648 ), 1649 1650 TP_printk("addr=%s device=%s dma_addr=%llu length=%u", 1651 __get_str(addr), __get_str(device), 1652 __entry->dma_addr, __entry->length 1653 ) 1654 ); 1655 1656 #define DEFINE_SVC_DMA_EVENT(name) \ 1657 DEFINE_EVENT(svcrdma_dma_map_class, svcrdma_##name, \ 1658 TP_PROTO( \ 1659 const struct svcxprt_rdma *rdma,\ 1660 u64 dma_addr, \ 1661 u32 length \ 1662 ), \ 1663 TP_ARGS(rdma, dma_addr, length)) 1664 1665 DEFINE_SVC_DMA_EVENT(dma_map_page); 1666 DEFINE_SVC_DMA_EVENT(dma_unmap_page); 1667 1668 TRACE_EVENT(svcrdma_dma_map_rw_err, 1669 TP_PROTO( 1670 const struct svcxprt_rdma *rdma, 1671 unsigned int nents, 1672 int status 1673 ), 1674 1675 TP_ARGS(rdma, nents, status), 1676 1677 TP_STRUCT__entry( 1678 __field(int, status) 1679 __field(unsigned int, nents) 1680 __string(device, rdma->sc_cm_id->device->name) 1681 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1682 ), 1683 1684 TP_fast_assign( 1685 __entry->status = status; 1686 __entry->nents = nents; 1687 __assign_str(device, rdma->sc_cm_id->device->name); 1688 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1689 ), 1690 1691 TP_printk("addr=%s device=%s nents=%u status=%d", 1692 __get_str(addr), __get_str(device), __entry->nents, 1693 __entry->status 1694 ) 1695 ); 1696 1697 TRACE_EVENT(svcrdma_no_rwctx_err, 1698 TP_PROTO( 1699 const struct svcxprt_rdma *rdma, 1700 unsigned int num_sges 1701 ), 1702 1703 TP_ARGS(rdma, num_sges), 1704 1705 TP_STRUCT__entry( 1706 __field(unsigned int, num_sges) 1707 __string(device, rdma->sc_cm_id->device->name) 1708 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1709 ), 1710 1711 TP_fast_assign( 1712 __entry->num_sges = num_sges; 1713 __assign_str(device, rdma->sc_cm_id->device->name); 1714 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1715 ), 1716 1717 TP_printk("addr=%s device=%s num_sges=%d", 1718 __get_str(addr), __get_str(device), __entry->num_sges 1719 ) 1720 ); 1721 1722 TRACE_EVENT(svcrdma_page_overrun_err, 1723 TP_PROTO( 1724 const struct svcxprt_rdma *rdma, 1725 const struct svc_rqst *rqst, 1726 unsigned int pageno 1727 ), 1728 1729 TP_ARGS(rdma, rqst, pageno), 1730 1731 TP_STRUCT__entry( 1732 __field(unsigned int, pageno) 1733 __field(u32, xid) 1734 __string(device, rdma->sc_cm_id->device->name) 1735 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1736 ), 1737 1738 TP_fast_assign( 1739 __entry->pageno = pageno; 1740 __entry->xid = __be32_to_cpu(rqst->rq_xid); 1741 __assign_str(device, rdma->sc_cm_id->device->name); 1742 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1743 ), 1744 1745 TP_printk("addr=%s device=%s xid=0x%08x pageno=%u", __get_str(addr), 1746 __get_str(device), __entry->xid, __entry->pageno 1747 ) 1748 ); 1749 1750 TRACE_EVENT(svcrdma_small_wrch_err, 1751 TP_PROTO( 1752 const struct svcxprt_rdma *rdma, 1753 unsigned int remaining, 1754 unsigned int seg_no, 1755 unsigned int num_segs 1756 ), 1757 1758 TP_ARGS(rdma, remaining, seg_no, num_segs), 1759 1760 TP_STRUCT__entry( 1761 __field(unsigned int, remaining) 1762 __field(unsigned int, seg_no) 1763 __field(unsigned int, num_segs) 1764 __string(device, rdma->sc_cm_id->device->name) 1765 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1766 ), 1767 1768 TP_fast_assign( 1769 __entry->remaining = remaining; 1770 __entry->seg_no = seg_no; 1771 __entry->num_segs = num_segs; 1772 __assign_str(device, rdma->sc_cm_id->device->name); 1773 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1774 ), 1775 1776 TP_printk("addr=%s device=%s remaining=%u seg_no=%u num_segs=%u", 1777 __get_str(addr), __get_str(device), __entry->remaining, 1778 __entry->seg_no, __entry->num_segs 1779 ) 1780 ); 1781 1782 TRACE_EVENT(svcrdma_send_pullup, 1783 TP_PROTO( 1784 unsigned int len 1785 ), 1786 1787 TP_ARGS(len), 1788 1789 TP_STRUCT__entry( 1790 __field(unsigned int, len) 1791 ), 1792 1793 TP_fast_assign( 1794 __entry->len = len; 1795 ), 1796 1797 TP_printk("len=%u", __entry->len) 1798 ); 1799 1800 TRACE_EVENT(svcrdma_send_err, 1801 TP_PROTO( 1802 const struct svc_rqst *rqst, 1803 int status 1804 ), 1805 1806 TP_ARGS(rqst, status), 1807 1808 TP_STRUCT__entry( 1809 __field(int, status) 1810 __field(u32, xid) 1811 __string(addr, rqst->rq_xprt->xpt_remotebuf) 1812 ), 1813 1814 TP_fast_assign( 1815 __entry->status = status; 1816 __entry->xid = __be32_to_cpu(rqst->rq_xid); 1817 __assign_str(addr, rqst->rq_xprt->xpt_remotebuf); 1818 ), 1819 1820 TP_printk("addr=%s xid=0x%08x status=%d", __get_str(addr), 1821 __entry->xid, __entry->status 1822 ) 1823 ); 1824 1825 TRACE_EVENT(svcrdma_post_send, 1826 TP_PROTO( 1827 const struct svc_rdma_send_ctxt *ctxt 1828 ), 1829 1830 TP_ARGS(ctxt), 1831 1832 TP_STRUCT__entry( 1833 __field(u32, cq_id) 1834 __field(int, completion_id) 1835 __field(unsigned int, num_sge) 1836 __field(u32, inv_rkey) 1837 ), 1838 1839 TP_fast_assign( 1840 const struct ib_send_wr *wr = &ctxt->sc_send_wr; 1841 1842 __entry->cq_id = ctxt->sc_cid.ci_queue_id; 1843 __entry->completion_id = ctxt->sc_cid.ci_completion_id; 1844 __entry->num_sge = wr->num_sge; 1845 __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ? 1846 wr->ex.invalidate_rkey : 0; 1847 ), 1848 1849 TP_printk("cq_id=%u cid=%d num_sge=%u inv_rkey=0x%08x", 1850 __entry->cq_id, __entry->completion_id, 1851 __entry->num_sge, __entry->inv_rkey 1852 ) 1853 ); 1854 1855 DEFINE_COMPLETION_EVENT(svcrdma_wc_send); 1856 1857 TRACE_EVENT(svcrdma_post_recv, 1858 TP_PROTO( 1859 const struct svc_rdma_recv_ctxt *ctxt 1860 ), 1861 1862 TP_ARGS(ctxt), 1863 1864 TP_STRUCT__entry( 1865 __field(u32, cq_id) 1866 __field(int, completion_id) 1867 ), 1868 1869 TP_fast_assign( 1870 __entry->cq_id = ctxt->rc_cid.ci_queue_id; 1871 __entry->completion_id = ctxt->rc_cid.ci_completion_id; 1872 ), 1873 1874 TP_printk("cq.id=%d cid=%d", 1875 __entry->cq_id, __entry->completion_id 1876 ) 1877 ); 1878 1879 DEFINE_COMPLETION_EVENT(svcrdma_wc_receive); 1880 1881 TRACE_EVENT(svcrdma_rq_post_err, 1882 TP_PROTO( 1883 const struct svcxprt_rdma *rdma, 1884 int status 1885 ), 1886 1887 TP_ARGS(rdma, status), 1888 1889 TP_STRUCT__entry( 1890 __field(int, status) 1891 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1892 ), 1893 1894 TP_fast_assign( 1895 __entry->status = status; 1896 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1897 ), 1898 1899 TP_printk("addr=%s status=%d", 1900 __get_str(addr), __entry->status 1901 ) 1902 ); 1903 1904 TRACE_EVENT(svcrdma_post_chunk, 1905 TP_PROTO( 1906 const struct rpc_rdma_cid *cid, 1907 int sqecount 1908 ), 1909 1910 TP_ARGS(cid, sqecount), 1911 1912 TP_STRUCT__entry( 1913 __field(u32, cq_id) 1914 __field(int, completion_id) 1915 __field(int, sqecount) 1916 ), 1917 1918 TP_fast_assign( 1919 __entry->cq_id = cid->ci_queue_id; 1920 __entry->completion_id = cid->ci_completion_id; 1921 __entry->sqecount = sqecount; 1922 ), 1923 1924 TP_printk("cq.id=%u cid=%d sqecount=%d", 1925 __entry->cq_id, __entry->completion_id, 1926 __entry->sqecount 1927 ) 1928 ); 1929 1930 DEFINE_COMPLETION_EVENT(svcrdma_wc_read); 1931 DEFINE_COMPLETION_EVENT(svcrdma_wc_write); 1932 1933 TRACE_EVENT(svcrdma_qp_error, 1934 TP_PROTO( 1935 const struct ib_event *event, 1936 const struct sockaddr *sap 1937 ), 1938 1939 TP_ARGS(event, sap), 1940 1941 TP_STRUCT__entry( 1942 __field(unsigned int, event) 1943 __string(device, event->device->name) 1944 __array(__u8, addr, INET6_ADDRSTRLEN + 10) 1945 ), 1946 1947 TP_fast_assign( 1948 __entry->event = event->event; 1949 __assign_str(device, event->device->name); 1950 snprintf(__entry->addr, sizeof(__entry->addr) - 1, 1951 "%pISpc", sap); 1952 ), 1953 1954 TP_printk("addr=%s dev=%s event=%s (%u)", 1955 __entry->addr, __get_str(device), 1956 rdma_show_ib_event(__entry->event), __entry->event 1957 ) 1958 ); 1959 1960 DECLARE_EVENT_CLASS(svcrdma_sendqueue_event, 1961 TP_PROTO( 1962 const struct svcxprt_rdma *rdma 1963 ), 1964 1965 TP_ARGS(rdma), 1966 1967 TP_STRUCT__entry( 1968 __field(int, avail) 1969 __field(int, depth) 1970 __string(addr, rdma->sc_xprt.xpt_remotebuf) 1971 ), 1972 1973 TP_fast_assign( 1974 __entry->avail = atomic_read(&rdma->sc_sq_avail); 1975 __entry->depth = rdma->sc_sq_depth; 1976 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 1977 ), 1978 1979 TP_printk("addr=%s sc_sq_avail=%d/%d", 1980 __get_str(addr), __entry->avail, __entry->depth 1981 ) 1982 ); 1983 1984 #define DEFINE_SQ_EVENT(name) \ 1985 DEFINE_EVENT(svcrdma_sendqueue_event, svcrdma_sq_##name,\ 1986 TP_PROTO( \ 1987 const struct svcxprt_rdma *rdma \ 1988 ), \ 1989 TP_ARGS(rdma)) 1990 1991 DEFINE_SQ_EVENT(full); 1992 DEFINE_SQ_EVENT(retry); 1993 1994 TRACE_EVENT(svcrdma_sq_post_err, 1995 TP_PROTO( 1996 const struct svcxprt_rdma *rdma, 1997 int status 1998 ), 1999 2000 TP_ARGS(rdma, status), 2001 2002 TP_STRUCT__entry( 2003 __field(int, avail) 2004 __field(int, depth) 2005 __field(int, status) 2006 __string(addr, rdma->sc_xprt.xpt_remotebuf) 2007 ), 2008 2009 TP_fast_assign( 2010 __entry->avail = atomic_read(&rdma->sc_sq_avail); 2011 __entry->depth = rdma->sc_sq_depth; 2012 __entry->status = status; 2013 __assign_str(addr, rdma->sc_xprt.xpt_remotebuf); 2014 ), 2015 2016 TP_printk("addr=%s sc_sq_avail=%d/%d status=%d", 2017 __get_str(addr), __entry->avail, __entry->depth, 2018 __entry->status 2019 ) 2020 ); 2021 2022 #endif /* _TRACE_RPCRDMA_H */ 2023 2024 #include <trace/define_trace.h> 2025