Commit be2acb10 authored by Chuck Lever's avatar Chuck Lever

rpcrdma: Introduce a simple cid tracepoint class

De-duplicate some code, making it easier to add new tracepoints that
report only a completion ID.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 907e34a7
...@@ -22,47 +22,37 @@ ...@@ -22,47 +22,37 @@
** Event classes ** Event classes
**/ **/
DECLARE_EVENT_CLASS(rpcrdma_completion_class, DECLARE_EVENT_CLASS(rpcrdma_simple_cid_class,
TP_PROTO( TP_PROTO(
const struct ib_wc *wc,
const struct rpc_rdma_cid *cid const struct rpc_rdma_cid *cid
), ),
TP_ARGS(wc, cid), TP_ARGS(cid),
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, cq_id) __field(u32, cq_id)
__field(int, completion_id) __field(int, completion_id)
__field(unsigned long, status)
__field(unsigned int, vendor_err)
), ),
TP_fast_assign( TP_fast_assign(
__entry->cq_id = cid->ci_queue_id; __entry->cq_id = cid->ci_queue_id;
__entry->completion_id = cid->ci_completion_id; __entry->completion_id = cid->ci_completion_id;
__entry->status = wc->status;
if (wc->status)
__entry->vendor_err = wc->vendor_err;
else
__entry->vendor_err = 0;
), ),
TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)", TP_printk("cq.id=%d cid=%d",
__entry->cq_id, __entry->completion_id, __entry->cq_id, __entry->completion_id
rdma_show_wc_status(__entry->status),
__entry->status, __entry->vendor_err
) )
); );
#define DEFINE_COMPLETION_EVENT(name) \ #define DEFINE_SIMPLE_CID_EVENT(name) \
DEFINE_EVENT(rpcrdma_completion_class, name, \ DEFINE_EVENT(rpcrdma_simple_cid_class, name, \
TP_PROTO( \ TP_PROTO( \
const struct ib_wc *wc, \
const struct rpc_rdma_cid *cid \ const struct rpc_rdma_cid *cid \
), \ ), \
TP_ARGS(wc, cid)) TP_ARGS(cid) \
)
DECLARE_EVENT_CLASS(rpcrdma_send_completion_class, DECLARE_EVENT_CLASS(rpcrdma_completion_class,
TP_PROTO( TP_PROTO(
const struct ib_wc *wc, const struct ib_wc *wc,
const struct rpc_rdma_cid *cid const struct rpc_rdma_cid *cid
...@@ -73,20 +63,29 @@ DECLARE_EVENT_CLASS(rpcrdma_send_completion_class, ...@@ -73,20 +63,29 @@ DECLARE_EVENT_CLASS(rpcrdma_send_completion_class,
TP_STRUCT__entry( TP_STRUCT__entry(
__field(u32, cq_id) __field(u32, cq_id)
__field(int, completion_id) __field(int, completion_id)
__field(unsigned long, status)
__field(unsigned int, vendor_err)
), ),
TP_fast_assign( TP_fast_assign(
__entry->cq_id = cid->ci_queue_id; __entry->cq_id = cid->ci_queue_id;
__entry->completion_id = cid->ci_completion_id; __entry->completion_id = cid->ci_completion_id;
__entry->status = wc->status;
if (wc->status)
__entry->vendor_err = wc->vendor_err;
else
__entry->vendor_err = 0;
), ),
TP_printk("cq.id=%u cid=%d", TP_printk("cq.id=%u cid=%d status=%s (%lu/0x%x)",
__entry->cq_id, __entry->completion_id __entry->cq_id, __entry->completion_id,
rdma_show_wc_status(__entry->status),
__entry->status, __entry->vendor_err
) )
); );
#define DEFINE_SEND_COMPLETION_EVENT(name) \ #define DEFINE_COMPLETION_EVENT(name) \
DEFINE_EVENT(rpcrdma_send_completion_class, name, \ DEFINE_EVENT(rpcrdma_completion_class, name, \
TP_PROTO( \ TP_PROTO( \
const struct ib_wc *wc, \ const struct ib_wc *wc, \
const struct rpc_rdma_cid *cid \ const struct rpc_rdma_cid *cid \
...@@ -978,27 +977,7 @@ TRACE_EVENT(xprtrdma_post_send_err, ...@@ -978,27 +977,7 @@ TRACE_EVENT(xprtrdma_post_send_err,
) )
); );
TRACE_EVENT(xprtrdma_post_recv, DEFINE_SIMPLE_CID_EVENT(xprtrdma_post_recv);
TP_PROTO(
const struct rpcrdma_rep *rep
),
TP_ARGS(rep),
TP_STRUCT__entry(
__field(u32, cq_id)
__field(int, completion_id)
),
TP_fast_assign(
__entry->cq_id = rep->rr_cid.ci_queue_id;
__entry->completion_id = rep->rr_cid.ci_completion_id;
),
TP_printk("cq.id=%d cid=%d",
__entry->cq_id, __entry->completion_id
)
);
TRACE_EVENT(xprtrdma_post_recvs, TRACE_EVENT(xprtrdma_post_recvs,
TP_PROTO( TP_PROTO(
...@@ -2020,31 +1999,11 @@ TRACE_EVENT(svcrdma_post_send, ...@@ -2020,31 +1999,11 @@ TRACE_EVENT(svcrdma_post_send,
) )
); );
DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_send); DEFINE_SIMPLE_CID_EVENT(svcrdma_wc_send);
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_flush);
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_send_err);
TRACE_EVENT(svcrdma_post_recv, DEFINE_SIMPLE_CID_EVENT(svcrdma_post_recv);
TP_PROTO(
const struct svc_rdma_recv_ctxt *ctxt
),
TP_ARGS(ctxt),
TP_STRUCT__entry(
__field(u32, cq_id)
__field(int, completion_id)
),
TP_fast_assign(
__entry->cq_id = ctxt->rc_cid.ci_queue_id;
__entry->completion_id = ctxt->rc_cid.ci_completion_id;
),
TP_printk("cq.id=%d cid=%d",
__entry->cq_id, __entry->completion_id
)
);
DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv); DEFINE_RECEIVE_SUCCESS_EVENT(svcrdma_wc_recv);
DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush); DEFINE_RECEIVE_FLUSH_EVENT(svcrdma_wc_recv_flush);
...@@ -2153,7 +2112,7 @@ TRACE_EVENT(svcrdma_wc_read, ...@@ -2153,7 +2112,7 @@ TRACE_EVENT(svcrdma_wc_read,
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush);
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err);
DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_write); DEFINE_SIMPLE_CID_EVENT(svcrdma_wc_write);
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush);
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err); DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err);
......
...@@ -264,7 +264,7 @@ static bool svc_rdma_refresh_recvs(struct svcxprt_rdma *rdma, ...@@ -264,7 +264,7 @@ static bool svc_rdma_refresh_recvs(struct svcxprt_rdma *rdma,
if (!ctxt) if (!ctxt)
break; break;
trace_svcrdma_post_recv(ctxt); trace_svcrdma_post_recv(&ctxt->rc_cid);
ctxt->rc_recv_wr.next = recv_chain; ctxt->rc_recv_wr.next = recv_chain;
recv_chain = &ctxt->rc_recv_wr; recv_chain = &ctxt->rc_recv_wr;
rdma->sc_pending_recvs++; rdma->sc_pending_recvs++;
......
...@@ -282,7 +282,7 @@ static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc) ...@@ -282,7 +282,7 @@ static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
switch (wc->status) { switch (wc->status) {
case IB_WC_SUCCESS: case IB_WC_SUCCESS:
trace_svcrdma_wc_write(wc, &cc->cc_cid); trace_svcrdma_wc_write(&cc->cc_cid);
break; break;
case IB_WC_WR_FLUSH_ERR: case IB_WC_WR_FLUSH_ERR:
trace_svcrdma_wc_write_flush(wc, &cc->cc_cid); trace_svcrdma_wc_write_flush(wc, &cc->cc_cid);
......
...@@ -305,7 +305,7 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc) ...@@ -305,7 +305,7 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc)
if (unlikely(wc->status != IB_WC_SUCCESS)) if (unlikely(wc->status != IB_WC_SUCCESS))
goto flushed; goto flushed;
trace_svcrdma_wc_send(wc, &ctxt->sc_cid); trace_svcrdma_wc_send(&ctxt->sc_cid);
svc_rdma_send_ctxt_put(rdma, ctxt); svc_rdma_send_ctxt_put(rdma, ctxt);
return; return;
......
...@@ -1364,7 +1364,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp) ...@@ -1364,7 +1364,7 @@ void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, int needed, bool temp)
} }
rep->rr_cid.ci_queue_id = ep->re_attr.recv_cq->res.id; rep->rr_cid.ci_queue_id = ep->re_attr.recv_cq->res.id;
trace_xprtrdma_post_recv(rep); trace_xprtrdma_post_recv(&rep->rr_cid);
rep->rr_recv_wr.next = wr; rep->rr_recv_wr.next = wr;
wr = &rep->rr_recv_wr; wr = &rep->rr_recv_wr;
--needed; --needed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment