Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (c) 2017, 2018 Oracle.  All rights reserved.
0004  *
0005  * Trace point definitions for the "rpcrdma" subsystem.
0006  */
0007 #undef TRACE_SYSTEM
0008 #define TRACE_SYSTEM rpcrdma
0009 
0010 #if !defined(_TRACE_RPCRDMA_H) || defined(TRACE_HEADER_MULTI_READ)
0011 #define _TRACE_RPCRDMA_H
0012 
0013 #include <linux/scatterlist.h>
0014 #include <linux/sunrpc/rpc_rdma_cid.h>
0015 #include <linux/tracepoint.h>
0016 #include <rdma/ib_cm.h>
0017 
0018 #include <trace/events/rdma.h>
0019 #include <trace/events/sunrpc_base.h>
0020 
0021 /**
0022  ** Event classes
0023  **/
0024 
0025 DECLARE_EVENT_CLASS(rpcrdma_completion_class,
0026     TP_PROTO(
0027         const struct ib_wc *wc,
0028         const struct rpc_rdma_cid *cid
0029     ),
0030 
0031     TP_ARGS(wc, cid),
0032 
0033     TP_STRUCT__entry(
0034         __field(u32, cq_id)
0035         __field(int, completion_id)
0036         __field(unsigned long, status)
0037         __field(unsigned int, vendor_err)
0038     ),
0039 
0040     TP_fast_assign(
0041         __entry->cq_id = cid->ci_queue_id;
0042         __entry->completion_id = cid->ci_completion_id;
0043         __entry->status = wc->status;
0044         if (wc->status)
0045             __entry->vendor_err = wc->vendor_err;
0046         else
0047             __entry->vendor_err = 0;
0048     ),
0049 
0050     TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
0051         __entry->cq_id, __entry->completion_id,
0052         rdma_show_wc_status(__entry->status),
0053         __entry->status, __entry->vendor_err
0054     )
0055 );
0056 
0057 #define DEFINE_COMPLETION_EVENT(name)                   \
0058         DEFINE_EVENT(rpcrdma_completion_class, name,        \
0059                 TP_PROTO(               \
0060                     const struct ib_wc *wc,     \
0061                     const struct rpc_rdma_cid *cid  \
0062                 ),                  \
0063                 TP_ARGS(wc, cid))
0064 
0065 DECLARE_EVENT_CLASS(rpcrdma_send_completion_class,
0066     TP_PROTO(
0067         const struct ib_wc *wc,
0068         const struct rpc_rdma_cid *cid
0069     ),
0070 
0071     TP_ARGS(wc, cid),
0072 
0073     TP_STRUCT__entry(
0074         __field(u32, cq_id)
0075         __field(int, completion_id)
0076     ),
0077 
0078     TP_fast_assign(
0079         __entry->cq_id = cid->ci_queue_id;
0080         __entry->completion_id = cid->ci_completion_id;
0081     ),
0082 
0083     TP_printk("cq.id=%u cid=%d",
0084         __entry->cq_id, __entry->completion_id
0085     )
0086 );
0087 
0088 #define DEFINE_SEND_COMPLETION_EVENT(name)              \
0089         DEFINE_EVENT(rpcrdma_send_completion_class, name,   \
0090                 TP_PROTO(               \
0091                     const struct ib_wc *wc,     \
0092                     const struct rpc_rdma_cid *cid  \
0093                 ),                  \
0094                 TP_ARGS(wc, cid))
0095 
0096 DECLARE_EVENT_CLASS(rpcrdma_send_flush_class,
0097     TP_PROTO(
0098         const struct ib_wc *wc,
0099         const struct rpc_rdma_cid *cid
0100     ),
0101 
0102     TP_ARGS(wc, cid),
0103 
0104     TP_STRUCT__entry(
0105         __field(u32, cq_id)
0106         __field(int, completion_id)
0107         __field(unsigned long, status)
0108         __field(unsigned int, vendor_err)
0109     ),
0110 
0111     TP_fast_assign(
0112         __entry->cq_id = cid->ci_queue_id;
0113         __entry->completion_id = cid->ci_completion_id;
0114         __entry->status = wc->status;
0115         __entry->vendor_err = wc->vendor_err;
0116     ),
0117 
0118     TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
0119         __entry->cq_id, __entry->completion_id,
0120         rdma_show_wc_status(__entry->status),
0121         __entry->status, __entry->vendor_err
0122     )
0123 );
0124 
0125 #define DEFINE_SEND_FLUSH_EVENT(name)                   \
0126         DEFINE_EVENT(rpcrdma_send_flush_class, name,        \
0127                 TP_PROTO(               \
0128                     const struct ib_wc *wc,     \
0129                     const struct rpc_rdma_cid *cid  \
0130                 ),                  \
0131                 TP_ARGS(wc, cid))
0132 
0133 DECLARE_EVENT_CLASS(rpcrdma_mr_completion_class,
0134     TP_PROTO(
0135         const struct ib_wc *wc,
0136         const struct rpc_rdma_cid *cid
0137     ),
0138 
0139     TP_ARGS(wc, cid),
0140 
0141     TP_STRUCT__entry(
0142         __field(u32, cq_id)
0143         __field(int, completion_id)
0144         __field(unsigned long, status)
0145         __field(unsigned int, vendor_err)
0146     ),
0147 
0148     TP_fast_assign(
0149         __entry->cq_id = cid->ci_queue_id;
0150         __entry->completion_id = cid->ci_completion_id;
0151         __entry->status = wc->status;
0152         if (wc->status)
0153             __entry->vendor_err = wc->vendor_err;
0154         else
0155             __entry->vendor_err = 0;
0156     ),
0157 
0158     TP_printk("cq.id=%u mr.id=%d status=%s (%lu/0x%x)",
0159         __entry->cq_id, __entry->completion_id,
0160         rdma_show_wc_status(__entry->status),
0161         __entry->status, __entry->vendor_err
0162     )
0163 );
0164 
0165 #define DEFINE_MR_COMPLETION_EVENT(name)                \
0166         DEFINE_EVENT(rpcrdma_mr_completion_class, name,     \
0167                 TP_PROTO(               \
0168                     const struct ib_wc *wc,     \
0169                     const struct rpc_rdma_cid *cid  \
0170                 ),                  \
0171                 TP_ARGS(wc, cid))
0172 
0173 DECLARE_EVENT_CLASS(rpcrdma_receive_completion_class,
0174     TP_PROTO(
0175         const struct ib_wc *wc,
0176         const struct rpc_rdma_cid *cid
0177     ),
0178 
0179     TP_ARGS(wc, cid),
0180 
0181     TP_STRUCT__entry(
0182         __field(u32, cq_id)
0183         __field(int, completion_id)
0184         __field(u32, received)
0185         __field(unsigned long, status)
0186         __field(unsigned int, vendor_err)
0187     ),
0188 
0189     TP_fast_assign(
0190         __entry->cq_id = cid->ci_queue_id;
0191         __entry->completion_id = cid->ci_completion_id;
0192         __entry->status = wc->status;
0193         if (wc->status) {
0194             __entry->received = 0;
0195             __entry->vendor_err = wc->vendor_err;
0196         } else {
0197             __entry->received = wc->byte_len;
0198             __entry->vendor_err = 0;
0199         }
0200     ),
0201 
0202     TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x) received=%u",
0203         __entry->cq_id, __entry->completion_id,
0204         rdma_show_wc_status(__entry->status),
0205         __entry->status, __entry->vendor_err,
0206         __entry->received
0207     )
0208 );
0209 
0210 #define DEFINE_RECEIVE_COMPLETION_EVENT(name)               \
0211         DEFINE_EVENT(rpcrdma_receive_completion_class, name,    \
0212                 TP_PROTO(               \
0213                     const struct ib_wc *wc,     \
0214                     const struct rpc_rdma_cid *cid  \
0215                 ),                  \
0216                 TP_ARGS(wc, cid))
0217 
0218 DECLARE_EVENT_CLASS(rpcrdma_receive_success_class,
0219     TP_PROTO(
0220         const struct ib_wc *wc,
0221         const struct rpc_rdma_cid *cid
0222     ),
0223 
0224     TP_ARGS(wc, cid),
0225 
0226     TP_STRUCT__entry(
0227         __field(u32, cq_id)
0228         __field(int, completion_id)
0229         __field(u32, received)
0230     ),
0231 
0232     TP_fast_assign(
0233         __entry->cq_id = cid->ci_queue_id;
0234         __entry->completion_id = cid->ci_completion_id;
0235         __entry->received = wc->byte_len;
0236     ),
0237 
0238     TP_printk("cq.id=%u cid=%d received=%u",
0239         __entry->cq_id, __entry->completion_id,
0240         __entry->received
0241     )
0242 );
0243 
0244 #define DEFINE_RECEIVE_SUCCESS_EVENT(name)              \
0245         DEFINE_EVENT(rpcrdma_receive_success_class, name,   \
0246                 TP_PROTO(               \
0247                     const struct ib_wc *wc,     \
0248                     const struct rpc_rdma_cid *cid  \
0249                 ),                  \
0250                 TP_ARGS(wc, cid))
0251 
0252 DECLARE_EVENT_CLASS(rpcrdma_receive_flush_class,
0253     TP_PROTO(
0254         const struct ib_wc *wc,
0255         const struct rpc_rdma_cid *cid
0256     ),
0257 
0258     TP_ARGS(wc, cid),
0259 
0260     TP_STRUCT__entry(
0261         __field(u32, cq_id)
0262         __field(int, completion_id)
0263         __field(unsigned long, status)
0264         __field(unsigned int, vendor_err)
0265     ),
0266 
0267     TP_fast_assign(
0268         __entry->cq_id = cid->ci_queue_id;
0269         __entry->completion_id = cid->ci_completion_id;
0270         __entry->status = wc->status;
0271         __entry->vendor_err = wc->vendor_err;
0272     ),
0273 
0274     TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
0275         __entry->cq_id, __entry->completion_id,
0276         rdma_show_wc_status(__entry->status),
0277         __entry->status, __entry->vendor_err
0278     )
0279 );
0280 
0281 #define DEFINE_RECEIVE_FLUSH_EVENT(name)                \
0282         DEFINE_EVENT(rpcrdma_receive_flush_class, name,     \
0283                 TP_PROTO(               \
0284                     const struct ib_wc *wc,     \
0285                     const struct rpc_rdma_cid *cid  \
0286                 ),                  \
0287                 TP_ARGS(wc, cid))
0288 
0289 DECLARE_EVENT_CLASS(xprtrdma_reply_class,
0290     TP_PROTO(
0291         const struct rpcrdma_rep *rep
0292     ),
0293 
0294     TP_ARGS(rep),
0295 
0296     TP_STRUCT__entry(
0297         __field(u32, xid)
0298         __field(u32, version)
0299         __field(u32, proc)
0300         __string(addr, rpcrdma_addrstr(rep->rr_rxprt))
0301         __string(port, rpcrdma_portstr(rep->rr_rxprt))
0302     ),
0303 
0304     TP_fast_assign(
0305         __entry->xid = be32_to_cpu(rep->rr_xid);
0306         __entry->version = be32_to_cpu(rep->rr_vers);
0307         __entry->proc = be32_to_cpu(rep->rr_proc);
0308         __assign_str(addr, rpcrdma_addrstr(rep->rr_rxprt));
0309         __assign_str(port, rpcrdma_portstr(rep->rr_rxprt));
0310     ),
0311 
0312     TP_printk("peer=[%s]:%s xid=0x%08x version=%u proc=%u",
0313         __get_str(addr), __get_str(port),
0314         __entry->xid, __entry->version, __entry->proc
0315     )
0316 );
0317 
0318 #define DEFINE_REPLY_EVENT(name)                    \
0319         DEFINE_EVENT(xprtrdma_reply_class,          \
0320                 xprtrdma_reply_##name##_err,        \
0321                 TP_PROTO(               \
0322                     const struct rpcrdma_rep *rep   \
0323                 ),                  \
0324                 TP_ARGS(rep))
0325 
0326 DECLARE_EVENT_CLASS(xprtrdma_rxprt,
0327     TP_PROTO(
0328         const struct rpcrdma_xprt *r_xprt
0329     ),
0330 
0331     TP_ARGS(r_xprt),
0332 
0333     TP_STRUCT__entry(
0334         __string(addr, rpcrdma_addrstr(r_xprt))
0335         __string(port, rpcrdma_portstr(r_xprt))
0336     ),
0337 
0338     TP_fast_assign(
0339         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0340         __assign_str(port, rpcrdma_portstr(r_xprt));
0341     ),
0342 
0343     TP_printk("peer=[%s]:%s",
0344         __get_str(addr), __get_str(port)
0345     )
0346 );
0347 
0348 #define DEFINE_RXPRT_EVENT(name)                    \
0349         DEFINE_EVENT(xprtrdma_rxprt, name,          \
0350                 TP_PROTO(               \
0351                     const struct rpcrdma_xprt *r_xprt \
0352                 ),                  \
0353                 TP_ARGS(r_xprt))
0354 
0355 DECLARE_EVENT_CLASS(xprtrdma_connect_class,
0356     TP_PROTO(
0357         const struct rpcrdma_xprt *r_xprt,
0358         int rc
0359     ),
0360 
0361     TP_ARGS(r_xprt, rc),
0362 
0363     TP_STRUCT__entry(
0364         __field(int, rc)
0365         __field(int, connect_status)
0366         __string(addr, rpcrdma_addrstr(r_xprt))
0367         __string(port, rpcrdma_portstr(r_xprt))
0368     ),
0369 
0370     TP_fast_assign(
0371         __entry->rc = rc;
0372         __entry->connect_status = r_xprt->rx_ep->re_connect_status;
0373         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0374         __assign_str(port, rpcrdma_portstr(r_xprt));
0375     ),
0376 
0377     TP_printk("peer=[%s]:%s rc=%d connection status=%d",
0378         __get_str(addr), __get_str(port),
0379         __entry->rc, __entry->connect_status
0380     )
0381 );
0382 
0383 #define DEFINE_CONN_EVENT(name)                     \
0384         DEFINE_EVENT(xprtrdma_connect_class, xprtrdma_##name,   \
0385                 TP_PROTO(               \
0386                     const struct rpcrdma_xprt *r_xprt, \
0387                     int rc              \
0388                 ),                  \
0389                 TP_ARGS(r_xprt, rc))
0390 
0391 DECLARE_EVENT_CLASS(xprtrdma_rdch_event,
0392     TP_PROTO(
0393         const struct rpc_task *task,
0394         unsigned int pos,
0395         struct rpcrdma_mr *mr,
0396         int nsegs
0397     ),
0398 
0399     TP_ARGS(task, pos, mr, nsegs),
0400 
0401     TP_STRUCT__entry(
0402         __field(unsigned int, task_id)
0403         __field(unsigned int, client_id)
0404         __field(unsigned int, pos)
0405         __field(int, nents)
0406         __field(u32, handle)
0407         __field(u32, length)
0408         __field(u64, offset)
0409         __field(int, nsegs)
0410     ),
0411 
0412     TP_fast_assign(
0413         __entry->task_id = task->tk_pid;
0414         __entry->client_id = task->tk_client->cl_clid;
0415         __entry->pos = pos;
0416         __entry->nents = mr->mr_nents;
0417         __entry->handle = mr->mr_handle;
0418         __entry->length = mr->mr_length;
0419         __entry->offset = mr->mr_offset;
0420         __entry->nsegs = nsegs;
0421     ),
0422 
0423     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
0424           " pos=%u %u@0x%016llx:0x%08x (%s)",
0425         __entry->task_id, __entry->client_id,
0426         __entry->pos, __entry->length,
0427         (unsigned long long)__entry->offset, __entry->handle,
0428         __entry->nents < __entry->nsegs ? "more" : "last"
0429     )
0430 );
0431 
0432 #define DEFINE_RDCH_EVENT(name)                     \
0433         DEFINE_EVENT(xprtrdma_rdch_event, xprtrdma_chunk_##name,\
0434                 TP_PROTO(               \
0435                     const struct rpc_task *task,    \
0436                     unsigned int pos,       \
0437                     struct rpcrdma_mr *mr,      \
0438                     int nsegs           \
0439                 ),                  \
0440                 TP_ARGS(task, pos, mr, nsegs))
0441 
0442 DECLARE_EVENT_CLASS(xprtrdma_wrch_event,
0443     TP_PROTO(
0444         const struct rpc_task *task,
0445         struct rpcrdma_mr *mr,
0446         int nsegs
0447     ),
0448 
0449     TP_ARGS(task, mr, nsegs),
0450 
0451     TP_STRUCT__entry(
0452         __field(unsigned int, task_id)
0453         __field(unsigned int, client_id)
0454         __field(int, nents)
0455         __field(u32, handle)
0456         __field(u32, length)
0457         __field(u64, offset)
0458         __field(int, nsegs)
0459     ),
0460 
0461     TP_fast_assign(
0462         __entry->task_id = task->tk_pid;
0463         __entry->client_id = task->tk_client->cl_clid;
0464         __entry->nents = mr->mr_nents;
0465         __entry->handle = mr->mr_handle;
0466         __entry->length = mr->mr_length;
0467         __entry->offset = mr->mr_offset;
0468         __entry->nsegs = nsegs;
0469     ),
0470 
0471     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
0472           " %u@0x%016llx:0x%08x (%s)",
0473         __entry->task_id, __entry->client_id,
0474         __entry->length, (unsigned long long)__entry->offset,
0475         __entry->handle,
0476         __entry->nents < __entry->nsegs ? "more" : "last"
0477     )
0478 );
0479 
0480 #define DEFINE_WRCH_EVENT(name)                     \
0481         DEFINE_EVENT(xprtrdma_wrch_event, xprtrdma_chunk_##name,\
0482                 TP_PROTO(               \
0483                     const struct rpc_task *task,    \
0484                     struct rpcrdma_mr *mr,      \
0485                     int nsegs           \
0486                 ),                  \
0487                 TP_ARGS(task, mr, nsegs))
0488 
0489 TRACE_DEFINE_ENUM(DMA_BIDIRECTIONAL);
0490 TRACE_DEFINE_ENUM(DMA_TO_DEVICE);
0491 TRACE_DEFINE_ENUM(DMA_FROM_DEVICE);
0492 TRACE_DEFINE_ENUM(DMA_NONE);
0493 
0494 #define xprtrdma_show_direction(x)                  \
0495         __print_symbolic(x,                 \
0496                 { DMA_BIDIRECTIONAL, "BIDIR" },     \
0497                 { DMA_TO_DEVICE, "TO_DEVICE" },     \
0498                 { DMA_FROM_DEVICE, "FROM_DEVICE" }, \
0499                 { DMA_NONE, "NONE" })
0500 
0501 DECLARE_EVENT_CLASS(xprtrdma_mr_class,
0502     TP_PROTO(
0503         const struct rpcrdma_mr *mr
0504     ),
0505 
0506     TP_ARGS(mr),
0507 
0508     TP_STRUCT__entry(
0509         __field(unsigned int, task_id)
0510         __field(unsigned int, client_id)
0511         __field(u32, mr_id)
0512         __field(int, nents)
0513         __field(u32, handle)
0514         __field(u32, length)
0515         __field(u64, offset)
0516         __field(u32, dir)
0517     ),
0518 
0519     TP_fast_assign(
0520         const struct rpcrdma_req *req = mr->mr_req;
0521 
0522         if (req) {
0523             const struct rpc_task *task = req->rl_slot.rq_task;
0524 
0525             __entry->task_id = task->tk_pid;
0526             __entry->client_id = task->tk_client->cl_clid;
0527         } else {
0528             __entry->task_id = 0;
0529             __entry->client_id = -1;
0530         }
0531         __entry->mr_id  = mr->mr_ibmr->res.id;
0532         __entry->nents  = mr->mr_nents;
0533         __entry->handle = mr->mr_handle;
0534         __entry->length = mr->mr_length;
0535         __entry->offset = mr->mr_offset;
0536         __entry->dir    = mr->mr_dir;
0537     ),
0538 
0539     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
0540           " mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
0541         __entry->task_id, __entry->client_id,
0542         __entry->mr_id, __entry->nents, __entry->length,
0543         (unsigned long long)__entry->offset, __entry->handle,
0544         xprtrdma_show_direction(__entry->dir)
0545     )
0546 );
0547 
0548 #define DEFINE_MR_EVENT(name)                       \
0549         DEFINE_EVENT(xprtrdma_mr_class,             \
0550                 xprtrdma_mr_##name,         \
0551                 TP_PROTO(               \
0552                     const struct rpcrdma_mr *mr \
0553                 ),                  \
0554                 TP_ARGS(mr))
0555 
0556 DECLARE_EVENT_CLASS(xprtrdma_anonymous_mr_class,
0557     TP_PROTO(
0558         const struct rpcrdma_mr *mr
0559     ),
0560 
0561     TP_ARGS(mr),
0562 
0563     TP_STRUCT__entry(
0564         __field(u32, mr_id)
0565         __field(int, nents)
0566         __field(u32, handle)
0567         __field(u32, length)
0568         __field(u64, offset)
0569         __field(u32, dir)
0570     ),
0571 
0572     TP_fast_assign(
0573         __entry->mr_id  = mr->mr_ibmr->res.id;
0574         __entry->nents  = mr->mr_nents;
0575         __entry->handle = mr->mr_handle;
0576         __entry->length = mr->mr_length;
0577         __entry->offset = mr->mr_offset;
0578         __entry->dir    = mr->mr_dir;
0579     ),
0580 
0581     TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s)",
0582         __entry->mr_id, __entry->nents, __entry->length,
0583         (unsigned long long)__entry->offset, __entry->handle,
0584         xprtrdma_show_direction(__entry->dir)
0585     )
0586 );
0587 
0588 #define DEFINE_ANON_MR_EVENT(name)                  \
0589         DEFINE_EVENT(xprtrdma_anonymous_mr_class,       \
0590                 xprtrdma_mr_##name,         \
0591                 TP_PROTO(               \
0592                     const struct rpcrdma_mr *mr \
0593                 ),                  \
0594                 TP_ARGS(mr))
0595 
0596 DECLARE_EVENT_CLASS(xprtrdma_callback_class,
0597     TP_PROTO(
0598         const struct rpcrdma_xprt *r_xprt,
0599         const struct rpc_rqst *rqst
0600     ),
0601 
0602     TP_ARGS(r_xprt, rqst),
0603 
0604     TP_STRUCT__entry(
0605         __field(u32, xid)
0606         __string(addr, rpcrdma_addrstr(r_xprt))
0607         __string(port, rpcrdma_portstr(r_xprt))
0608     ),
0609 
0610     TP_fast_assign(
0611         __entry->xid = be32_to_cpu(rqst->rq_xid);
0612         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0613         __assign_str(port, rpcrdma_portstr(r_xprt));
0614     ),
0615 
0616     TP_printk("peer=[%s]:%s xid=0x%08x",
0617         __get_str(addr), __get_str(port), __entry->xid
0618     )
0619 );
0620 
0621 #define DEFINE_CALLBACK_EVENT(name)                 \
0622         DEFINE_EVENT(xprtrdma_callback_class,           \
0623                 xprtrdma_cb_##name,         \
0624                 TP_PROTO(               \
0625                     const struct rpcrdma_xprt *r_xprt, \
0626                     const struct rpc_rqst *rqst \
0627                 ),                  \
0628                 TP_ARGS(r_xprt, rqst))
0629 
0630 /**
0631  ** Connection events
0632  **/
0633 
0634 TRACE_EVENT(xprtrdma_inline_thresh,
0635     TP_PROTO(
0636         const struct rpcrdma_ep *ep
0637     ),
0638 
0639     TP_ARGS(ep),
0640 
0641     TP_STRUCT__entry(
0642         __field(unsigned int, inline_send)
0643         __field(unsigned int, inline_recv)
0644         __field(unsigned int, max_send)
0645         __field(unsigned int, max_recv)
0646         __array(unsigned char, srcaddr, sizeof(struct sockaddr_in6))
0647         __array(unsigned char, dstaddr, sizeof(struct sockaddr_in6))
0648     ),
0649 
0650     TP_fast_assign(
0651         const struct rdma_cm_id *id = ep->re_id;
0652 
0653         __entry->inline_send = ep->re_inline_send;
0654         __entry->inline_recv = ep->re_inline_recv;
0655         __entry->max_send = ep->re_max_inline_send;
0656         __entry->max_recv = ep->re_max_inline_recv;
0657         memcpy(__entry->srcaddr, &id->route.addr.src_addr,
0658                sizeof(struct sockaddr_in6));
0659         memcpy(__entry->dstaddr, &id->route.addr.dst_addr,
0660                sizeof(struct sockaddr_in6));
0661     ),
0662 
0663     TP_printk("%pISpc -> %pISpc neg send/recv=%u/%u, calc send/recv=%u/%u",
0664         __entry->srcaddr, __entry->dstaddr,
0665         __entry->inline_send, __entry->inline_recv,
0666         __entry->max_send, __entry->max_recv
0667     )
0668 );
0669 
0670 DEFINE_CONN_EVENT(connect);
0671 DEFINE_CONN_EVENT(disconnect);
0672 
0673 DEFINE_RXPRT_EVENT(xprtrdma_op_inject_dsc);
0674 
0675 TRACE_EVENT(xprtrdma_op_connect,
0676     TP_PROTO(
0677         const struct rpcrdma_xprt *r_xprt,
0678         unsigned long delay
0679     ),
0680 
0681     TP_ARGS(r_xprt, delay),
0682 
0683     TP_STRUCT__entry(
0684         __field(unsigned long, delay)
0685         __string(addr, rpcrdma_addrstr(r_xprt))
0686         __string(port, rpcrdma_portstr(r_xprt))
0687     ),
0688 
0689     TP_fast_assign(
0690         __entry->delay = delay;
0691         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0692         __assign_str(port, rpcrdma_portstr(r_xprt));
0693     ),
0694 
0695     TP_printk("peer=[%s]:%s delay=%lu",
0696         __get_str(addr), __get_str(port), __entry->delay
0697     )
0698 );
0699 
0700 
0701 TRACE_EVENT(xprtrdma_op_set_cto,
0702     TP_PROTO(
0703         const struct rpcrdma_xprt *r_xprt,
0704         unsigned long connect,
0705         unsigned long reconnect
0706     ),
0707 
0708     TP_ARGS(r_xprt, connect, reconnect),
0709 
0710     TP_STRUCT__entry(
0711         __field(unsigned long, connect)
0712         __field(unsigned long, reconnect)
0713         __string(addr, rpcrdma_addrstr(r_xprt))
0714         __string(port, rpcrdma_portstr(r_xprt))
0715     ),
0716 
0717     TP_fast_assign(
0718         __entry->connect = connect;
0719         __entry->reconnect = reconnect;
0720         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0721         __assign_str(port, rpcrdma_portstr(r_xprt));
0722     ),
0723 
0724     TP_printk("peer=[%s]:%s connect=%lu reconnect=%lu",
0725         __get_str(addr), __get_str(port),
0726         __entry->connect / HZ, __entry->reconnect / HZ
0727     )
0728 );
0729 
0730 /**
0731  ** Call events
0732  **/
0733 
0734 TRACE_EVENT(xprtrdma_createmrs,
0735     TP_PROTO(
0736         const struct rpcrdma_xprt *r_xprt,
0737         unsigned int count
0738     ),
0739 
0740     TP_ARGS(r_xprt, count),
0741 
0742     TP_STRUCT__entry(
0743         __string(addr, rpcrdma_addrstr(r_xprt))
0744         __string(port, rpcrdma_portstr(r_xprt))
0745         __field(unsigned int, count)
0746     ),
0747 
0748     TP_fast_assign(
0749         __entry->count = count;
0750         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0751         __assign_str(port, rpcrdma_portstr(r_xprt));
0752     ),
0753 
0754     TP_printk("peer=[%s]:%s created %u MRs",
0755         __get_str(addr), __get_str(port), __entry->count
0756     )
0757 );
0758 
0759 TRACE_EVENT(xprtrdma_nomrs_err,
0760     TP_PROTO(
0761         const struct rpcrdma_xprt *r_xprt,
0762         const struct rpcrdma_req *req
0763     ),
0764 
0765     TP_ARGS(r_xprt, req),
0766 
0767     TP_STRUCT__entry(
0768         __field(unsigned int, task_id)
0769         __field(unsigned int, client_id)
0770         __string(addr, rpcrdma_addrstr(r_xprt))
0771         __string(port, rpcrdma_portstr(r_xprt))
0772     ),
0773 
0774     TP_fast_assign(
0775         const struct rpc_rqst *rqst = &req->rl_slot;
0776 
0777         __entry->task_id = rqst->rq_task->tk_pid;
0778         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
0779         __assign_str(addr, rpcrdma_addrstr(r_xprt));
0780         __assign_str(port, rpcrdma_portstr(r_xprt));
0781     ),
0782 
0783     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " peer=[%s]:%s",
0784         __entry->task_id, __entry->client_id,
0785         __get_str(addr), __get_str(port)
0786     )
0787 );
0788 
0789 DEFINE_RDCH_EVENT(read);
0790 DEFINE_WRCH_EVENT(write);
0791 DEFINE_WRCH_EVENT(reply);
0792 DEFINE_WRCH_EVENT(wp);
0793 
0794 TRACE_DEFINE_ENUM(rpcrdma_noch);
0795 TRACE_DEFINE_ENUM(rpcrdma_noch_pullup);
0796 TRACE_DEFINE_ENUM(rpcrdma_noch_mapped);
0797 TRACE_DEFINE_ENUM(rpcrdma_readch);
0798 TRACE_DEFINE_ENUM(rpcrdma_areadch);
0799 TRACE_DEFINE_ENUM(rpcrdma_writech);
0800 TRACE_DEFINE_ENUM(rpcrdma_replych);
0801 
0802 #define xprtrdma_show_chunktype(x)                  \
0803         __print_symbolic(x,                 \
0804                 { rpcrdma_noch, "inline" },     \
0805                 { rpcrdma_noch_pullup, "pullup" },  \
0806                 { rpcrdma_noch_mapped, "mapped" },  \
0807                 { rpcrdma_readch, "read list" },    \
0808                 { rpcrdma_areadch, "*read list" },  \
0809                 { rpcrdma_writech, "write list" },  \
0810                 { rpcrdma_replych, "reply chunk" })
0811 
0812 TRACE_EVENT(xprtrdma_marshal,
0813     TP_PROTO(
0814         const struct rpcrdma_req *req,
0815         unsigned int rtype,
0816         unsigned int wtype
0817     ),
0818 
0819     TP_ARGS(req, rtype, wtype),
0820 
0821     TP_STRUCT__entry(
0822         __field(unsigned int, task_id)
0823         __field(unsigned int, client_id)
0824         __field(u32, xid)
0825         __field(unsigned int, hdrlen)
0826         __field(unsigned int, headlen)
0827         __field(unsigned int, pagelen)
0828         __field(unsigned int, taillen)
0829         __field(unsigned int, rtype)
0830         __field(unsigned int, wtype)
0831     ),
0832 
0833     TP_fast_assign(
0834         const struct rpc_rqst *rqst = &req->rl_slot;
0835 
0836         __entry->task_id = rqst->rq_task->tk_pid;
0837         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
0838         __entry->xid = be32_to_cpu(rqst->rq_xid);
0839         __entry->hdrlen = req->rl_hdrbuf.len;
0840         __entry->headlen = rqst->rq_snd_buf.head[0].iov_len;
0841         __entry->pagelen = rqst->rq_snd_buf.page_len;
0842         __entry->taillen = rqst->rq_snd_buf.tail[0].iov_len;
0843         __entry->rtype = rtype;
0844         __entry->wtype = wtype;
0845     ),
0846 
0847     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER
0848           " xid=0x%08x hdr=%u xdr=%u/%u/%u %s/%s",
0849         __entry->task_id, __entry->client_id, __entry->xid,
0850         __entry->hdrlen,
0851         __entry->headlen, __entry->pagelen, __entry->taillen,
0852         xprtrdma_show_chunktype(__entry->rtype),
0853         xprtrdma_show_chunktype(__entry->wtype)
0854     )
0855 );
0856 
0857 TRACE_EVENT(xprtrdma_marshal_failed,
0858     TP_PROTO(const struct rpc_rqst *rqst,
0859          int ret
0860     ),
0861 
0862     TP_ARGS(rqst, ret),
0863 
0864     TP_STRUCT__entry(
0865         __field(unsigned int, task_id)
0866         __field(unsigned int, client_id)
0867         __field(u32, xid)
0868         __field(int, ret)
0869     ),
0870 
0871     TP_fast_assign(
0872         __entry->task_id = rqst->rq_task->tk_pid;
0873         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
0874         __entry->xid = be32_to_cpu(rqst->rq_xid);
0875         __entry->ret = ret;
0876     ),
0877 
0878     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
0879         __entry->task_id, __entry->client_id, __entry->xid,
0880         __entry->ret
0881     )
0882 );
0883 
0884 TRACE_EVENT(xprtrdma_prepsend_failed,
0885     TP_PROTO(const struct rpc_rqst *rqst,
0886          int ret
0887     ),
0888 
0889     TP_ARGS(rqst, ret),
0890 
0891     TP_STRUCT__entry(
0892         __field(unsigned int, task_id)
0893         __field(unsigned int, client_id)
0894         __field(u32, xid)
0895         __field(int, ret)
0896     ),
0897 
0898     TP_fast_assign(
0899         __entry->task_id = rqst->rq_task->tk_pid;
0900         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
0901         __entry->xid = be32_to_cpu(rqst->rq_xid);
0902         __entry->ret = ret;
0903     ),
0904 
0905     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x ret=%d",
0906         __entry->task_id, __entry->client_id, __entry->xid,
0907         __entry->ret
0908     )
0909 );
0910 
0911 TRACE_EVENT(xprtrdma_post_send,
0912     TP_PROTO(
0913         const struct rpcrdma_req *req
0914     ),
0915 
0916     TP_ARGS(req),
0917 
0918     TP_STRUCT__entry(
0919         __field(u32, cq_id)
0920         __field(int, completion_id)
0921         __field(unsigned int, task_id)
0922         __field(unsigned int, client_id)
0923         __field(int, num_sge)
0924         __field(int, signaled)
0925     ),
0926 
0927     TP_fast_assign(
0928         const struct rpc_rqst *rqst = &req->rl_slot;
0929         const struct rpcrdma_sendctx *sc = req->rl_sendctx;
0930 
0931         __entry->cq_id = sc->sc_cid.ci_queue_id;
0932         __entry->completion_id = sc->sc_cid.ci_completion_id;
0933         __entry->task_id = rqst->rq_task->tk_pid;
0934         __entry->client_id = rqst->rq_task->tk_client ?
0935                      rqst->rq_task->tk_client->cl_clid : -1;
0936         __entry->num_sge = req->rl_wr.num_sge;
0937         __entry->signaled = req->rl_wr.send_flags & IB_SEND_SIGNALED;
0938     ),
0939 
0940     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u cid=%d (%d SGE%s) %s",
0941         __entry->task_id, __entry->client_id,
0942         __entry->cq_id, __entry->completion_id,
0943         __entry->num_sge, (__entry->num_sge == 1 ? "" : "s"),
0944         (__entry->signaled ? "signaled" : "")
0945     )
0946 );
0947 
0948 TRACE_EVENT(xprtrdma_post_send_err,
0949     TP_PROTO(
0950         const struct rpcrdma_xprt *r_xprt,
0951         const struct rpcrdma_req *req,
0952         int rc
0953     ),
0954 
0955     TP_ARGS(r_xprt, req, rc),
0956 
0957     TP_STRUCT__entry(
0958         __field(u32, cq_id)
0959         __field(unsigned int, task_id)
0960         __field(unsigned int, client_id)
0961         __field(int, rc)
0962     ),
0963 
0964     TP_fast_assign(
0965         const struct rpc_rqst *rqst = &req->rl_slot;
0966         const struct rpcrdma_ep *ep = r_xprt->rx_ep;
0967 
0968         __entry->cq_id = ep ? ep->re_attr.recv_cq->res.id : 0;
0969         __entry->task_id = rqst->rq_task->tk_pid;
0970         __entry->client_id = rqst->rq_task->tk_client ?
0971                      rqst->rq_task->tk_client->cl_clid : -1;
0972         __entry->rc = rc;
0973     ),
0974 
0975     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " cq.id=%u rc=%d",
0976         __entry->task_id, __entry->client_id,
0977         __entry->cq_id, __entry->rc
0978     )
0979 );
0980 
0981 TRACE_EVENT(xprtrdma_post_recv,
0982     TP_PROTO(
0983         const struct rpcrdma_rep *rep
0984     ),
0985 
0986     TP_ARGS(rep),
0987 
0988     TP_STRUCT__entry(
0989         __field(u32, cq_id)
0990         __field(int, completion_id)
0991     ),
0992 
0993     TP_fast_assign(
0994         __entry->cq_id = rep->rr_cid.ci_queue_id;
0995         __entry->completion_id = rep->rr_cid.ci_completion_id;
0996     ),
0997 
0998     TP_printk("cq.id=%d cid=%d",
0999         __entry->cq_id, __entry->completion_id
1000     )
1001 );
1002 
1003 TRACE_EVENT(xprtrdma_post_recvs,
1004     TP_PROTO(
1005         const struct rpcrdma_xprt *r_xprt,
1006         unsigned int count
1007     ),
1008 
1009     TP_ARGS(r_xprt, count),
1010 
1011     TP_STRUCT__entry(
1012         __field(u32, cq_id)
1013         __field(unsigned int, count)
1014         __field(int, posted)
1015         __string(addr, rpcrdma_addrstr(r_xprt))
1016         __string(port, rpcrdma_portstr(r_xprt))
1017     ),
1018 
1019     TP_fast_assign(
1020         const struct rpcrdma_ep *ep = r_xprt->rx_ep;
1021 
1022         __entry->cq_id = ep->re_attr.recv_cq->res.id;
1023         __entry->count = count;
1024         __entry->posted = ep->re_receive_count;
1025         __assign_str(addr, rpcrdma_addrstr(r_xprt));
1026         __assign_str(port, rpcrdma_portstr(r_xprt));
1027     ),
1028 
1029     TP_printk("peer=[%s]:%s cq.id=%d %u new recvs, %d active",
1030         __get_str(addr), __get_str(port), __entry->cq_id,
1031         __entry->count, __entry->posted
1032     )
1033 );
1034 
1035 TRACE_EVENT(xprtrdma_post_recvs_err,
1036     TP_PROTO(
1037         const struct rpcrdma_xprt *r_xprt,
1038         int status
1039     ),
1040 
1041     TP_ARGS(r_xprt, status),
1042 
1043     TP_STRUCT__entry(
1044         __field(u32, cq_id)
1045         __field(int, status)
1046         __string(addr, rpcrdma_addrstr(r_xprt))
1047         __string(port, rpcrdma_portstr(r_xprt))
1048     ),
1049 
1050     TP_fast_assign(
1051         const struct rpcrdma_ep *ep = r_xprt->rx_ep;
1052 
1053         __entry->cq_id = ep->re_attr.recv_cq->res.id;
1054         __entry->status = status;
1055         __assign_str(addr, rpcrdma_addrstr(r_xprt));
1056         __assign_str(port, rpcrdma_portstr(r_xprt));
1057     ),
1058 
1059     TP_printk("peer=[%s]:%s cq.id=%d rc=%d",
1060         __get_str(addr), __get_str(port), __entry->cq_id,
1061         __entry->status
1062     )
1063 );
1064 
1065 TRACE_EVENT(xprtrdma_post_linv_err,
1066     TP_PROTO(
1067         const struct rpcrdma_req *req,
1068         int status
1069     ),
1070 
1071     TP_ARGS(req, status),
1072 
1073     TP_STRUCT__entry(
1074         __field(unsigned int, task_id)
1075         __field(unsigned int, client_id)
1076         __field(int, status)
1077     ),
1078 
1079     TP_fast_assign(
1080         const struct rpc_task *task = req->rl_slot.rq_task;
1081 
1082         __entry->task_id = task->tk_pid;
1083         __entry->client_id = task->tk_client->cl_clid;
1084         __entry->status = status;
1085     ),
1086 
1087     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " status=%d",
1088         __entry->task_id, __entry->client_id, __entry->status
1089     )
1090 );
1091 
1092 /**
1093  ** Completion events
1094  **/
1095 
1096 DEFINE_RECEIVE_COMPLETION_EVENT(xprtrdma_wc_receive);
1097 
1098 DEFINE_COMPLETION_EVENT(xprtrdma_wc_send);
1099 DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_fastreg);
1100 DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li);
1101 DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li_wake);
1102 DEFINE_MR_COMPLETION_EVENT(xprtrdma_wc_li_done);
1103 
1104 TRACE_EVENT(xprtrdma_frwr_alloc,
1105     TP_PROTO(
1106         const struct rpcrdma_mr *mr,
1107         int rc
1108     ),
1109 
1110     TP_ARGS(mr, rc),
1111 
1112     TP_STRUCT__entry(
1113         __field(u32, mr_id)
1114         __field(int, rc)
1115     ),
1116 
1117     TP_fast_assign(
1118         __entry->mr_id = mr->mr_ibmr->res.id;
1119         __entry->rc = rc;
1120     ),
1121 
1122     TP_printk("mr.id=%u: rc=%d",
1123         __entry->mr_id, __entry->rc
1124     )
1125 );
1126 
1127 TRACE_EVENT(xprtrdma_frwr_dereg,
1128     TP_PROTO(
1129         const struct rpcrdma_mr *mr,
1130         int rc
1131     ),
1132 
1133     TP_ARGS(mr, rc),
1134 
1135     TP_STRUCT__entry(
1136         __field(u32, mr_id)
1137         __field(int, nents)
1138         __field(u32, handle)
1139         __field(u32, length)
1140         __field(u64, offset)
1141         __field(u32, dir)
1142         __field(int, rc)
1143     ),
1144 
1145     TP_fast_assign(
1146         __entry->mr_id  = mr->mr_ibmr->res.id;
1147         __entry->nents  = mr->mr_nents;
1148         __entry->handle = mr->mr_handle;
1149         __entry->length = mr->mr_length;
1150         __entry->offset = mr->mr_offset;
1151         __entry->dir    = mr->mr_dir;
1152         __entry->rc = rc;
1153     ),
1154 
1155     TP_printk("mr.id=%u nents=%d %u@0x%016llx:0x%08x (%s): rc=%d",
1156         __entry->mr_id, __entry->nents, __entry->length,
1157         (unsigned long long)__entry->offset, __entry->handle,
1158         xprtrdma_show_direction(__entry->dir),
1159         __entry->rc
1160     )
1161 );
1162 
1163 TRACE_EVENT(xprtrdma_frwr_sgerr,
1164     TP_PROTO(
1165         const struct rpcrdma_mr *mr,
1166         int sg_nents
1167     ),
1168 
1169     TP_ARGS(mr, sg_nents),
1170 
1171     TP_STRUCT__entry(
1172         __field(u32, mr_id)
1173         __field(u64, addr)
1174         __field(u32, dir)
1175         __field(int, nents)
1176     ),
1177 
1178     TP_fast_assign(
1179         __entry->mr_id = mr->mr_ibmr->res.id;
1180         __entry->addr = mr->mr_sg->dma_address;
1181         __entry->dir = mr->mr_dir;
1182         __entry->nents = sg_nents;
1183     ),
1184 
1185     TP_printk("mr.id=%u DMA addr=0x%llx (%s) sg_nents=%d",
1186         __entry->mr_id, __entry->addr,
1187         xprtrdma_show_direction(__entry->dir),
1188         __entry->nents
1189     )
1190 );
1191 
1192 TRACE_EVENT(xprtrdma_frwr_maperr,
1193     TP_PROTO(
1194         const struct rpcrdma_mr *mr,
1195         int num_mapped
1196     ),
1197 
1198     TP_ARGS(mr, num_mapped),
1199 
1200     TP_STRUCT__entry(
1201         __field(u32, mr_id)
1202         __field(u64, addr)
1203         __field(u32, dir)
1204         __field(int, num_mapped)
1205         __field(int, nents)
1206     ),
1207 
1208     TP_fast_assign(
1209         __entry->mr_id = mr->mr_ibmr->res.id;
1210         __entry->addr = mr->mr_sg->dma_address;
1211         __entry->dir = mr->mr_dir;
1212         __entry->num_mapped = num_mapped;
1213         __entry->nents = mr->mr_nents;
1214     ),
1215 
1216     TP_printk("mr.id=%u DMA addr=0x%llx (%s) nents=%d of %d",
1217         __entry->mr_id, __entry->addr,
1218         xprtrdma_show_direction(__entry->dir),
1219         __entry->num_mapped, __entry->nents
1220     )
1221 );
1222 
1223 DEFINE_MR_EVENT(fastreg);
1224 DEFINE_MR_EVENT(localinv);
1225 DEFINE_MR_EVENT(reminv);
1226 DEFINE_MR_EVENT(map);
1227 
1228 DEFINE_ANON_MR_EVENT(unmap);
1229 
1230 TRACE_EVENT(xprtrdma_dma_maperr,
1231     TP_PROTO(
1232         u64 addr
1233     ),
1234 
1235     TP_ARGS(addr),
1236 
1237     TP_STRUCT__entry(
1238         __field(u64, addr)
1239     ),
1240 
1241     TP_fast_assign(
1242         __entry->addr = addr;
1243     ),
1244 
1245     TP_printk("dma addr=0x%llx\n", __entry->addr)
1246 );
1247 
1248 /**
1249  ** Reply events
1250  **/
1251 
1252 TRACE_EVENT(xprtrdma_reply,
1253     TP_PROTO(
1254         const struct rpc_task *task,
1255         const struct rpcrdma_rep *rep,
1256         unsigned int credits
1257     ),
1258 
1259     TP_ARGS(task, rep, credits),
1260 
1261     TP_STRUCT__entry(
1262         __field(unsigned int, task_id)
1263         __field(unsigned int, client_id)
1264         __field(u32, xid)
1265         __field(unsigned int, credits)
1266     ),
1267 
1268     TP_fast_assign(
1269         __entry->task_id = task->tk_pid;
1270         __entry->client_id = task->tk_client->cl_clid;
1271         __entry->xid = be32_to_cpu(rep->rr_xid);
1272         __entry->credits = credits;
1273     ),
1274 
1275     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x credits=%u",
1276         __entry->task_id, __entry->client_id, __entry->xid,
1277         __entry->credits
1278     )
1279 );
1280 
1281 DEFINE_REPLY_EVENT(vers);
1282 DEFINE_REPLY_EVENT(rqst);
1283 DEFINE_REPLY_EVENT(short);
1284 DEFINE_REPLY_EVENT(hdr);
1285 
1286 TRACE_EVENT(xprtrdma_err_vers,
1287     TP_PROTO(
1288         const struct rpc_rqst *rqst,
1289         __be32 *min,
1290         __be32 *max
1291     ),
1292 
1293     TP_ARGS(rqst, min, max),
1294 
1295     TP_STRUCT__entry(
1296         __field(unsigned int, task_id)
1297         __field(unsigned int, client_id)
1298         __field(u32, xid)
1299         __field(u32, min)
1300         __field(u32, max)
1301     ),
1302 
1303     TP_fast_assign(
1304         __entry->task_id = rqst->rq_task->tk_pid;
1305         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1306         __entry->xid = be32_to_cpu(rqst->rq_xid);
1307         __entry->min = be32_to_cpup(min);
1308         __entry->max = be32_to_cpup(max);
1309     ),
1310 
1311     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x versions=[%u, %u]",
1312         __entry->task_id, __entry->client_id, __entry->xid,
1313         __entry->min, __entry->max
1314     )
1315 );
1316 
1317 TRACE_EVENT(xprtrdma_err_chunk,
1318     TP_PROTO(
1319         const struct rpc_rqst *rqst
1320     ),
1321 
1322     TP_ARGS(rqst),
1323 
1324     TP_STRUCT__entry(
1325         __field(unsigned int, task_id)
1326         __field(unsigned int, client_id)
1327         __field(u32, xid)
1328     ),
1329 
1330     TP_fast_assign(
1331         __entry->task_id = rqst->rq_task->tk_pid;
1332         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1333         __entry->xid = be32_to_cpu(rqst->rq_xid);
1334     ),
1335 
1336     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x",
1337         __entry->task_id, __entry->client_id, __entry->xid
1338     )
1339 );
1340 
1341 TRACE_EVENT(xprtrdma_err_unrecognized,
1342     TP_PROTO(
1343         const struct rpc_rqst *rqst,
1344         __be32 *procedure
1345     ),
1346 
1347     TP_ARGS(rqst, procedure),
1348 
1349     TP_STRUCT__entry(
1350         __field(unsigned int, task_id)
1351         __field(unsigned int, client_id)
1352         __field(u32, xid)
1353         __field(u32, procedure)
1354     ),
1355 
1356     TP_fast_assign(
1357         __entry->task_id = rqst->rq_task->tk_pid;
1358         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1359         __entry->procedure = be32_to_cpup(procedure);
1360     ),
1361 
1362     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " xid=0x%08x procedure=%u",
1363         __entry->task_id, __entry->client_id, __entry->xid,
1364         __entry->procedure
1365     )
1366 );
1367 
1368 TRACE_EVENT(xprtrdma_fixup,
1369     TP_PROTO(
1370         const struct rpc_rqst *rqst,
1371         unsigned long fixup
1372     ),
1373 
1374     TP_ARGS(rqst, fixup),
1375 
1376     TP_STRUCT__entry(
1377         __field(unsigned int, task_id)
1378         __field(unsigned int, client_id)
1379         __field(unsigned long, fixup)
1380         __field(size_t, headlen)
1381         __field(unsigned int, pagelen)
1382         __field(size_t, taillen)
1383     ),
1384 
1385     TP_fast_assign(
1386         __entry->task_id = rqst->rq_task->tk_pid;
1387         __entry->client_id = rqst->rq_task->tk_client->cl_clid;
1388         __entry->fixup = fixup;
1389         __entry->headlen = rqst->rq_rcv_buf.head[0].iov_len;
1390         __entry->pagelen = rqst->rq_rcv_buf.page_len;
1391         __entry->taillen = rqst->rq_rcv_buf.tail[0].iov_len;
1392     ),
1393 
1394     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER " fixup=%lu xdr=%zu/%u/%zu",
1395         __entry->task_id, __entry->client_id, __entry->fixup,
1396         __entry->headlen, __entry->pagelen, __entry->taillen
1397     )
1398 );
1399 
1400 TRACE_EVENT(xprtrdma_decode_seg,
1401     TP_PROTO(
1402         u32 handle,
1403         u32 length,
1404         u64 offset
1405     ),
1406 
1407     TP_ARGS(handle, length, offset),
1408 
1409     TP_STRUCT__entry(
1410         __field(u32, handle)
1411         __field(u32, length)
1412         __field(u64, offset)
1413     ),
1414 
1415     TP_fast_assign(
1416         __entry->handle = handle;
1417         __entry->length = length;
1418         __entry->offset = offset;
1419     ),
1420 
1421     TP_printk("%u@0x%016llx:0x%08x",
1422         __entry->length, (unsigned long long)__entry->offset,
1423         __entry->handle
1424     )
1425 );
1426 
1427 TRACE_EVENT(xprtrdma_mrs_zap,
1428     TP_PROTO(
1429         const struct rpc_task *task
1430     ),
1431 
1432     TP_ARGS(task),
1433 
1434     TP_STRUCT__entry(
1435         __field(unsigned int, task_id)
1436         __field(unsigned int, client_id)
1437     ),
1438 
1439     TP_fast_assign(
1440         __entry->task_id = task->tk_pid;
1441         __entry->client_id = task->tk_client->cl_clid;
1442     ),
1443 
1444     TP_printk(SUNRPC_TRACE_TASK_SPECIFIER,
1445         __entry->task_id, __entry->client_id
1446     )
1447 );
1448 
1449 /**
1450  ** Callback events
1451  **/
1452 
1453 TRACE_EVENT(xprtrdma_cb_setup,
1454     TP_PROTO(
1455         const struct rpcrdma_xprt *r_xprt,
1456         unsigned int reqs
1457     ),
1458 
1459     TP_ARGS(r_xprt, reqs),
1460 
1461     TP_STRUCT__entry(
1462         __field(unsigned int, reqs)
1463         __string(addr, rpcrdma_addrstr(r_xprt))
1464         __string(port, rpcrdma_portstr(r_xprt))
1465     ),
1466 
1467     TP_fast_assign(
1468         __entry->reqs = reqs;
1469         __assign_str(addr, rpcrdma_addrstr(r_xprt));
1470         __assign_str(port, rpcrdma_portstr(r_xprt));
1471     ),
1472 
1473     TP_printk("peer=[%s]:%s %u reqs",
1474         __get_str(addr), __get_str(port), __entry->reqs
1475     )
1476 );
1477 
1478 DEFINE_CALLBACK_EVENT(call);
1479 DEFINE_CALLBACK_EVENT(reply);
1480 
1481 /**
1482  ** Server-side RPC/RDMA events
1483  **/
1484 
1485 DECLARE_EVENT_CLASS(svcrdma_accept_class,
1486     TP_PROTO(
1487         const struct svcxprt_rdma *rdma,
1488         long status
1489     ),
1490 
1491     TP_ARGS(rdma, status),
1492 
1493     TP_STRUCT__entry(
1494         __field(long, status)
1495         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1496     ),
1497 
1498     TP_fast_assign(
1499         __entry->status = status;
1500         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1501     ),
1502 
1503     TP_printk("addr=%s status=%ld",
1504         __get_str(addr), __entry->status
1505     )
1506 );
1507 
1508 #define DEFINE_ACCEPT_EVENT(name) \
1509         DEFINE_EVENT(svcrdma_accept_class, svcrdma_##name##_err, \
1510                 TP_PROTO( \
1511                     const struct svcxprt_rdma *rdma, \
1512                     long status \
1513                 ), \
1514                 TP_ARGS(rdma, status))
1515 
1516 DEFINE_ACCEPT_EVENT(pd);
1517 DEFINE_ACCEPT_EVENT(qp);
1518 DEFINE_ACCEPT_EVENT(fabric);
1519 DEFINE_ACCEPT_EVENT(initdepth);
1520 DEFINE_ACCEPT_EVENT(accept);
1521 
1522 TRACE_DEFINE_ENUM(RDMA_MSG);
1523 TRACE_DEFINE_ENUM(RDMA_NOMSG);
1524 TRACE_DEFINE_ENUM(RDMA_MSGP);
1525 TRACE_DEFINE_ENUM(RDMA_DONE);
1526 TRACE_DEFINE_ENUM(RDMA_ERROR);
1527 
1528 #define show_rpcrdma_proc(x)                        \
1529         __print_symbolic(x,                 \
1530                 { RDMA_MSG, "RDMA_MSG" },       \
1531                 { RDMA_NOMSG, "RDMA_NOMSG" },       \
1532                 { RDMA_MSGP, "RDMA_MSGP" },     \
1533                 { RDMA_DONE, "RDMA_DONE" },     \
1534                 { RDMA_ERROR, "RDMA_ERROR" })
1535 
1536 TRACE_EVENT(svcrdma_decode_rqst,
1537     TP_PROTO(
1538         const struct svc_rdma_recv_ctxt *ctxt,
1539         __be32 *p,
1540         unsigned int hdrlen
1541     ),
1542 
1543     TP_ARGS(ctxt, p, hdrlen),
1544 
1545     TP_STRUCT__entry(
1546         __field(u32, cq_id)
1547         __field(int, completion_id)
1548         __field(u32, xid)
1549         __field(u32, vers)
1550         __field(u32, proc)
1551         __field(u32, credits)
1552         __field(unsigned int, hdrlen)
1553     ),
1554 
1555     TP_fast_assign(
1556         __entry->cq_id = ctxt->rc_cid.ci_queue_id;
1557         __entry->completion_id = ctxt->rc_cid.ci_completion_id;
1558         __entry->xid = be32_to_cpup(p++);
1559         __entry->vers = be32_to_cpup(p++);
1560         __entry->credits = be32_to_cpup(p++);
1561         __entry->proc = be32_to_cpup(p);
1562         __entry->hdrlen = hdrlen;
1563     ),
1564 
1565     TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%s hdrlen=%u",
1566         __entry->cq_id, __entry->completion_id,
1567         __entry->xid, __entry->vers, __entry->credits,
1568         show_rpcrdma_proc(__entry->proc), __entry->hdrlen)
1569 );
1570 
1571 TRACE_EVENT(svcrdma_decode_short_err,
1572     TP_PROTO(
1573         const struct svc_rdma_recv_ctxt *ctxt,
1574         unsigned int hdrlen
1575     ),
1576 
1577     TP_ARGS(ctxt, hdrlen),
1578 
1579     TP_STRUCT__entry(
1580         __field(u32, cq_id)
1581         __field(int, completion_id)
1582         __field(unsigned int, hdrlen)
1583     ),
1584 
1585     TP_fast_assign(
1586         __entry->cq_id = ctxt->rc_cid.ci_queue_id;
1587         __entry->completion_id = ctxt->rc_cid.ci_completion_id;
1588         __entry->hdrlen = hdrlen;
1589     ),
1590 
1591     TP_printk("cq.id=%u cid=%d hdrlen=%u",
1592         __entry->cq_id, __entry->completion_id,
1593         __entry->hdrlen)
1594 );
1595 
1596 DECLARE_EVENT_CLASS(svcrdma_badreq_event,
1597     TP_PROTO(
1598         const struct svc_rdma_recv_ctxt *ctxt,
1599         __be32 *p
1600     ),
1601 
1602     TP_ARGS(ctxt, p),
1603 
1604     TP_STRUCT__entry(
1605         __field(u32, cq_id)
1606         __field(int, completion_id)
1607         __field(u32, xid)
1608         __field(u32, vers)
1609         __field(u32, proc)
1610         __field(u32, credits)
1611     ),
1612 
1613     TP_fast_assign(
1614         __entry->cq_id = ctxt->rc_cid.ci_queue_id;
1615         __entry->completion_id = ctxt->rc_cid.ci_completion_id;
1616         __entry->xid = be32_to_cpup(p++);
1617         __entry->vers = be32_to_cpup(p++);
1618         __entry->credits = be32_to_cpup(p++);
1619         __entry->proc = be32_to_cpup(p);
1620     ),
1621 
1622     TP_printk("cq.id=%u cid=%d xid=0x%08x vers=%u credits=%u proc=%u",
1623         __entry->cq_id, __entry->completion_id,
1624         __entry->xid, __entry->vers, __entry->credits, __entry->proc)
1625 );
1626 
1627 #define DEFINE_BADREQ_EVENT(name)                   \
1628         DEFINE_EVENT(svcrdma_badreq_event,          \
1629                  svcrdma_decode_##name##_err,       \
1630                 TP_PROTO(               \
1631                     const struct svc_rdma_recv_ctxt *ctxt,  \
1632                     __be32 *p           \
1633                 ),                  \
1634                 TP_ARGS(ctxt, p))
1635 
1636 DEFINE_BADREQ_EVENT(badvers);
1637 DEFINE_BADREQ_EVENT(drop);
1638 DEFINE_BADREQ_EVENT(badproc);
1639 DEFINE_BADREQ_EVENT(parse);
1640 
1641 TRACE_EVENT(svcrdma_encode_wseg,
1642     TP_PROTO(
1643         const struct svc_rdma_send_ctxt *ctxt,
1644         u32 segno,
1645         u32 handle,
1646         u32 length,
1647         u64 offset
1648     ),
1649 
1650     TP_ARGS(ctxt, segno, handle, length, offset),
1651 
1652     TP_STRUCT__entry(
1653         __field(u32, cq_id)
1654         __field(int, completion_id)
1655         __field(u32, segno)
1656         __field(u32, handle)
1657         __field(u32, length)
1658         __field(u64, offset)
1659     ),
1660 
1661     TP_fast_assign(
1662         __entry->cq_id = ctxt->sc_cid.ci_queue_id;
1663         __entry->completion_id = ctxt->sc_cid.ci_completion_id;
1664         __entry->segno = segno;
1665         __entry->handle = handle;
1666         __entry->length = length;
1667         __entry->offset = offset;
1668     ),
1669 
1670     TP_printk("cq_id=%u cid=%d segno=%u %u@0x%016llx:0x%08x",
1671         __entry->cq_id, __entry->completion_id,
1672         __entry->segno, __entry->length,
1673         (unsigned long long)__entry->offset, __entry->handle
1674     )
1675 );
1676 
1677 TRACE_EVENT(svcrdma_decode_rseg,
1678     TP_PROTO(
1679         const struct rpc_rdma_cid *cid,
1680         const struct svc_rdma_chunk *chunk,
1681         const struct svc_rdma_segment *segment
1682     ),
1683 
1684     TP_ARGS(cid, chunk, segment),
1685 
1686     TP_STRUCT__entry(
1687         __field(u32, cq_id)
1688         __field(int, completion_id)
1689         __field(u32, segno)
1690         __field(u32, position)
1691         __field(u32, handle)
1692         __field(u32, length)
1693         __field(u64, offset)
1694     ),
1695 
1696     TP_fast_assign(
1697         __entry->cq_id = cid->ci_queue_id;
1698         __entry->completion_id = cid->ci_completion_id;
1699         __entry->segno = chunk->ch_segcount;
1700         __entry->position = chunk->ch_position;
1701         __entry->handle = segment->rs_handle;
1702         __entry->length = segment->rs_length;
1703         __entry->offset = segment->rs_offset;
1704     ),
1705 
1706     TP_printk("cq_id=%u cid=%d segno=%u position=%u %u@0x%016llx:0x%08x",
1707         __entry->cq_id, __entry->completion_id,
1708         __entry->segno, __entry->position, __entry->length,
1709         (unsigned long long)__entry->offset, __entry->handle
1710     )
1711 );
1712 
1713 TRACE_EVENT(svcrdma_decode_wseg,
1714     TP_PROTO(
1715         const struct rpc_rdma_cid *cid,
1716         const struct svc_rdma_chunk *chunk,
1717         u32 segno
1718     ),
1719 
1720     TP_ARGS(cid, chunk, segno),
1721 
1722     TP_STRUCT__entry(
1723         __field(u32, cq_id)
1724         __field(int, completion_id)
1725         __field(u32, segno)
1726         __field(u32, handle)
1727         __field(u32, length)
1728         __field(u64, offset)
1729     ),
1730 
1731     TP_fast_assign(
1732         const struct svc_rdma_segment *segment =
1733             &chunk->ch_segments[segno];
1734 
1735         __entry->cq_id = cid->ci_queue_id;
1736         __entry->completion_id = cid->ci_completion_id;
1737         __entry->segno = segno;
1738         __entry->handle = segment->rs_handle;
1739         __entry->length = segment->rs_length;
1740         __entry->offset = segment->rs_offset;
1741     ),
1742 
1743     TP_printk("cq_id=%u cid=%d segno=%u %u@0x%016llx:0x%08x",
1744         __entry->cq_id, __entry->completion_id,
1745         __entry->segno, __entry->length,
1746         (unsigned long long)__entry->offset, __entry->handle
1747     )
1748 );
1749 
1750 DECLARE_EVENT_CLASS(svcrdma_error_event,
1751     TP_PROTO(
1752         __be32 xid
1753     ),
1754 
1755     TP_ARGS(xid),
1756 
1757     TP_STRUCT__entry(
1758         __field(u32, xid)
1759     ),
1760 
1761     TP_fast_assign(
1762         __entry->xid = be32_to_cpu(xid);
1763     ),
1764 
1765     TP_printk("xid=0x%08x",
1766         __entry->xid
1767     )
1768 );
1769 
1770 #define DEFINE_ERROR_EVENT(name)                    \
1771         DEFINE_EVENT(svcrdma_error_event, svcrdma_err_##name,   \
1772                 TP_PROTO(               \
1773                     __be32 xid          \
1774                 ),                  \
1775                 TP_ARGS(xid))
1776 
1777 DEFINE_ERROR_EVENT(vers);
1778 DEFINE_ERROR_EVENT(chunk);
1779 
1780 /**
1781  ** Server-side RDMA API events
1782  **/
1783 
1784 DECLARE_EVENT_CLASS(svcrdma_dma_map_class,
1785     TP_PROTO(
1786         const struct svcxprt_rdma *rdma,
1787         u64 dma_addr,
1788         u32 length
1789     ),
1790 
1791     TP_ARGS(rdma, dma_addr, length),
1792 
1793     TP_STRUCT__entry(
1794         __field(u64, dma_addr)
1795         __field(u32, length)
1796         __string(device, rdma->sc_cm_id->device->name)
1797         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1798     ),
1799 
1800     TP_fast_assign(
1801         __entry->dma_addr = dma_addr;
1802         __entry->length = length;
1803         __assign_str(device, rdma->sc_cm_id->device->name);
1804         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1805     ),
1806 
1807     TP_printk("addr=%s device=%s dma_addr=%llu length=%u",
1808         __get_str(addr), __get_str(device),
1809         __entry->dma_addr, __entry->length
1810     )
1811 );
1812 
1813 #define DEFINE_SVC_DMA_EVENT(name)                  \
1814         DEFINE_EVENT(svcrdma_dma_map_class, svcrdma_##name, \
1815                 TP_PROTO(               \
1816                     const struct svcxprt_rdma *rdma,\
1817                     u64 dma_addr,           \
1818                     u32 length          \
1819                 ),                  \
1820                 TP_ARGS(rdma, dma_addr, length))
1821 
1822 DEFINE_SVC_DMA_EVENT(dma_map_page);
1823 DEFINE_SVC_DMA_EVENT(dma_map_err);
1824 DEFINE_SVC_DMA_EVENT(dma_unmap_page);
1825 
1826 TRACE_EVENT(svcrdma_dma_map_rw_err,
1827     TP_PROTO(
1828         const struct svcxprt_rdma *rdma,
1829         unsigned int nents,
1830         int status
1831     ),
1832 
1833     TP_ARGS(rdma, nents, status),
1834 
1835     TP_STRUCT__entry(
1836         __field(int, status)
1837         __field(unsigned int, nents)
1838         __string(device, rdma->sc_cm_id->device->name)
1839         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1840     ),
1841 
1842     TP_fast_assign(
1843         __entry->status = status;
1844         __entry->nents = nents;
1845         __assign_str(device, rdma->sc_cm_id->device->name);
1846         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1847     ),
1848 
1849     TP_printk("addr=%s device=%s nents=%u status=%d",
1850         __get_str(addr), __get_str(device), __entry->nents,
1851         __entry->status
1852     )
1853 );
1854 
1855 TRACE_EVENT(svcrdma_no_rwctx_err,
1856     TP_PROTO(
1857         const struct svcxprt_rdma *rdma,
1858         unsigned int num_sges
1859     ),
1860 
1861     TP_ARGS(rdma, num_sges),
1862 
1863     TP_STRUCT__entry(
1864         __field(unsigned int, num_sges)
1865         __string(device, rdma->sc_cm_id->device->name)
1866         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1867     ),
1868 
1869     TP_fast_assign(
1870         __entry->num_sges = num_sges;
1871         __assign_str(device, rdma->sc_cm_id->device->name);
1872         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1873     ),
1874 
1875     TP_printk("addr=%s device=%s num_sges=%d",
1876         __get_str(addr), __get_str(device), __entry->num_sges
1877     )
1878 );
1879 
1880 TRACE_EVENT(svcrdma_page_overrun_err,
1881     TP_PROTO(
1882         const struct svcxprt_rdma *rdma,
1883         const struct svc_rqst *rqst,
1884         unsigned int pageno
1885     ),
1886 
1887     TP_ARGS(rdma, rqst, pageno),
1888 
1889     TP_STRUCT__entry(
1890         __field(unsigned int, pageno)
1891         __field(u32, xid)
1892         __string(device, rdma->sc_cm_id->device->name)
1893         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1894     ),
1895 
1896     TP_fast_assign(
1897         __entry->pageno = pageno;
1898         __entry->xid = __be32_to_cpu(rqst->rq_xid);
1899         __assign_str(device, rdma->sc_cm_id->device->name);
1900         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1901     ),
1902 
1903     TP_printk("addr=%s device=%s xid=0x%08x pageno=%u", __get_str(addr),
1904         __get_str(device), __entry->xid, __entry->pageno
1905     )
1906 );
1907 
1908 TRACE_EVENT(svcrdma_small_wrch_err,
1909     TP_PROTO(
1910         const struct svcxprt_rdma *rdma,
1911         unsigned int remaining,
1912         unsigned int seg_no,
1913         unsigned int num_segs
1914     ),
1915 
1916     TP_ARGS(rdma, remaining, seg_no, num_segs),
1917 
1918     TP_STRUCT__entry(
1919         __field(unsigned int, remaining)
1920         __field(unsigned int, seg_no)
1921         __field(unsigned int, num_segs)
1922         __string(device, rdma->sc_cm_id->device->name)
1923         __string(addr, rdma->sc_xprt.xpt_remotebuf)
1924     ),
1925 
1926     TP_fast_assign(
1927         __entry->remaining = remaining;
1928         __entry->seg_no = seg_no;
1929         __entry->num_segs = num_segs;
1930         __assign_str(device, rdma->sc_cm_id->device->name);
1931         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
1932     ),
1933 
1934     TP_printk("addr=%s device=%s remaining=%u seg_no=%u num_segs=%u",
1935         __get_str(addr), __get_str(device), __entry->remaining,
1936         __entry->seg_no, __entry->num_segs
1937     )
1938 );
1939 
1940 TRACE_EVENT(svcrdma_send_pullup,
1941     TP_PROTO(
1942         const struct svc_rdma_send_ctxt *ctxt,
1943         unsigned int msglen
1944     ),
1945 
1946     TP_ARGS(ctxt, msglen),
1947 
1948     TP_STRUCT__entry(
1949         __field(u32, cq_id)
1950         __field(int, completion_id)
1951         __field(unsigned int, hdrlen)
1952         __field(unsigned int, msglen)
1953     ),
1954 
1955     TP_fast_assign(
1956         __entry->cq_id = ctxt->sc_cid.ci_queue_id;
1957         __entry->completion_id = ctxt->sc_cid.ci_completion_id;
1958         __entry->hdrlen = ctxt->sc_hdrbuf.len,
1959         __entry->msglen = msglen;
1960     ),
1961 
1962     TP_printk("cq_id=%u cid=%d hdr=%u msg=%u (total %u)",
1963         __entry->cq_id, __entry->completion_id,
1964         __entry->hdrlen, __entry->msglen,
1965         __entry->hdrlen + __entry->msglen)
1966 );
1967 
1968 TRACE_EVENT(svcrdma_send_err,
1969     TP_PROTO(
1970         const struct svc_rqst *rqst,
1971         int status
1972     ),
1973 
1974     TP_ARGS(rqst, status),
1975 
1976     TP_STRUCT__entry(
1977         __field(int, status)
1978         __field(u32, xid)
1979         __string(addr, rqst->rq_xprt->xpt_remotebuf)
1980     ),
1981 
1982     TP_fast_assign(
1983         __entry->status = status;
1984         __entry->xid = __be32_to_cpu(rqst->rq_xid);
1985         __assign_str(addr, rqst->rq_xprt->xpt_remotebuf);
1986     ),
1987 
1988     TP_printk("addr=%s xid=0x%08x status=%d", __get_str(addr),
1989         __entry->xid, __entry->status
1990     )
1991 );
1992 
1993 TRACE_EVENT(svcrdma_post_send,
1994     TP_PROTO(
1995         const struct svc_rdma_send_ctxt *ctxt
1996     ),
1997 
1998     TP_ARGS(ctxt),
1999 
2000     TP_STRUCT__entry(
2001         __field(u32, cq_id)
2002         __field(int, completion_id)
2003         __field(unsigned int, num_sge)
2004         __field(u32, inv_rkey)
2005     ),
2006 
2007     TP_fast_assign(
2008         const struct ib_send_wr *wr = &ctxt->sc_send_wr;
2009 
2010         __entry->cq_id = ctxt->sc_cid.ci_queue_id;
2011         __entry->completion_id = ctxt->sc_cid.ci_completion_id;
2012         __entry->num_sge = wr->num_sge;
2013         __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ?
2014                     wr->ex.invalidate_rkey : 0;
2015     ),
2016 
2017     TP_printk("cq_id=%u cid=%d num_sge=%u inv_rkey=0x%08x",
2018         __entry->cq_id, __entry->completion_id,
2019         __entry->num_sge, __entry->inv_rkey
2020     )
2021 );
2022 
2023 DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_send);
2024 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush);
2025 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err);
2026 
2027 TRACE_EVENT(svcrdma_post_recv,
2028     TP_PROTO(
2029         const struct svc_rdma_recv_ctxt *ctxt
2030     ),
2031 
2032     TP_ARGS(ctxt),
2033 
2034     TP_STRUCT__entry(
2035         __field(u32, cq_id)
2036         __field(int, completion_id)
2037     ),
2038 
2039     TP_fast_assign(
2040         __entry->cq_id = ctxt->rc_cid.ci_queue_id;
2041         __entry->completion_id = ctxt->rc_cid.ci_completion_id;
2042     ),
2043 
2044     TP_printk("cq.id=%d cid=%d",
2045         __entry->cq_id, __entry->completion_id
2046     )
2047 );
2048 
2049 DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv);
2050 DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush);
2051 DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_err);
2052 
2053 TRACE_EVENT(svcrdma_rq_post_err,
2054     TP_PROTO(
2055         const struct svcxprt_rdma *rdma,
2056         int status
2057     ),
2058 
2059     TP_ARGS(rdma, status),
2060 
2061     TP_STRUCT__entry(
2062         __field(int, status)
2063         __string(addr, rdma->sc_xprt.xpt_remotebuf)
2064     ),
2065 
2066     TP_fast_assign(
2067         __entry->status = status;
2068         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
2069     ),
2070 
2071     TP_printk("addr=%s status=%d",
2072         __get_str(addr), __entry->status
2073     )
2074 );
2075 
2076 DECLARE_EVENT_CLASS(svcrdma_post_chunk_class,
2077     TP_PROTO(
2078         const struct rpc_rdma_cid *cid,
2079         int sqecount
2080     ),
2081 
2082     TP_ARGS(cid, sqecount),
2083 
2084     TP_STRUCT__entry(
2085         __field(u32, cq_id)
2086         __field(int, completion_id)
2087         __field(int, sqecount)
2088     ),
2089 
2090     TP_fast_assign(
2091         __entry->cq_id = cid->ci_queue_id;
2092         __entry->completion_id = cid->ci_completion_id;
2093         __entry->sqecount = sqecount;
2094     ),
2095 
2096     TP_printk("cq.id=%u cid=%d sqecount=%d",
2097         __entry->cq_id, __entry->completion_id,
2098         __entry->sqecount
2099     )
2100 );
2101 
2102 #define DEFINE_POST_CHUNK_EVENT(name)                   \
2103         DEFINE_EVENT(svcrdma_post_chunk_class,          \
2104                 svcrdma_post_##name##_chunk,        \
2105                 TP_PROTO(               \
2106                     const struct rpc_rdma_cid *cid, \
2107                     int sqecount            \
2108                 ),                  \
2109                 TP_ARGS(cid, sqecount))
2110 
2111 DEFINE_POST_CHUNK_EVENT(read);
2112 DEFINE_POST_CHUNK_EVENT(write);
2113 DEFINE_POST_CHUNK_EVENT(reply);
2114 
2115 TRACE_EVENT(svcrdma_wc_read,
2116     TP_PROTO(
2117         const struct ib_wc *wc,
2118         const struct rpc_rdma_cid *cid,
2119         unsigned int totalbytes,
2120         const ktime_t posttime
2121     ),
2122 
2123     TP_ARGS(wc, cid, totalbytes, posttime),
2124 
2125     TP_STRUCT__entry(
2126         __field(u32, cq_id)
2127         __field(int, completion_id)
2128         __field(s64, read_latency)
2129         __field(unsigned int, totalbytes)
2130     ),
2131 
2132     TP_fast_assign(
2133         __entry->cq_id = cid->ci_queue_id;
2134         __entry->completion_id = cid->ci_completion_id;
2135         __entry->totalbytes = totalbytes;
2136         __entry->read_latency = ktime_us_delta(ktime_get(), posttime);
2137     ),
2138 
2139     TP_printk("cq.id=%u cid=%d totalbytes=%u latency-us=%lld",
2140         __entry->cq_id, __entry->completion_id,
2141         __entry->totalbytes, __entry->read_latency
2142     )
2143 );
2144 
2145 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush);
2146 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err);
2147 
2148 DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_write);
2149 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush);
2150 DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err);
2151 
2152 TRACE_EVENT(svcrdma_qp_error,
2153     TP_PROTO(
2154         const struct ib_event *event,
2155         const struct sockaddr *sap
2156     ),
2157 
2158     TP_ARGS(event, sap),
2159 
2160     TP_STRUCT__entry(
2161         __field(unsigned int, event)
2162         __string(device, event->device->name)
2163         __array(__u8, addr, INET6_ADDRSTRLEN + 10)
2164     ),
2165 
2166     TP_fast_assign(
2167         __entry->event = event->event;
2168         __assign_str(device, event->device->name);
2169         snprintf(__entry->addr, sizeof(__entry->addr) - 1,
2170              "%pISpc", sap);
2171     ),
2172 
2173     TP_printk("addr=%s dev=%s event=%s (%u)",
2174         __entry->addr, __get_str(device),
2175         rdma_show_ib_event(__entry->event), __entry->event
2176     )
2177 );
2178 
2179 DECLARE_EVENT_CLASS(svcrdma_sendqueue_event,
2180     TP_PROTO(
2181         const struct svcxprt_rdma *rdma
2182     ),
2183 
2184     TP_ARGS(rdma),
2185 
2186     TP_STRUCT__entry(
2187         __field(int, avail)
2188         __field(int, depth)
2189         __string(addr, rdma->sc_xprt.xpt_remotebuf)
2190     ),
2191 
2192     TP_fast_assign(
2193         __entry->avail = atomic_read(&rdma->sc_sq_avail);
2194         __entry->depth = rdma->sc_sq_depth;
2195         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
2196     ),
2197 
2198     TP_printk("addr=%s sc_sq_avail=%d/%d",
2199         __get_str(addr), __entry->avail, __entry->depth
2200     )
2201 );
2202 
2203 #define DEFINE_SQ_EVENT(name)                       \
2204         DEFINE_EVENT(svcrdma_sendqueue_event, svcrdma_sq_##name,\
2205                 TP_PROTO(               \
2206                     const struct svcxprt_rdma *rdma \
2207                 ),                  \
2208                 TP_ARGS(rdma))
2209 
2210 DEFINE_SQ_EVENT(full);
2211 DEFINE_SQ_EVENT(retry);
2212 
2213 TRACE_EVENT(svcrdma_sq_post_err,
2214     TP_PROTO(
2215         const struct svcxprt_rdma *rdma,
2216         int status
2217     ),
2218 
2219     TP_ARGS(rdma, status),
2220 
2221     TP_STRUCT__entry(
2222         __field(int, avail)
2223         __field(int, depth)
2224         __field(int, status)
2225         __string(addr, rdma->sc_xprt.xpt_remotebuf)
2226     ),
2227 
2228     TP_fast_assign(
2229         __entry->avail = atomic_read(&rdma->sc_sq_avail);
2230         __entry->depth = rdma->sc_sq_depth;
2231         __entry->status = status;
2232         __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
2233     ),
2234 
2235     TP_printk("addr=%s sc_sq_avail=%d/%d status=%d",
2236         __get_str(addr), __entry->avail, __entry->depth,
2237         __entry->status
2238     )
2239 );
2240 
2241 #endif /* _TRACE_RPCRDMA_H */
2242 
2243 #include <trace/define_trace.h>