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