Skip to content

Commit 45f1358

Browse files
chuckleverJ. Bruce Fields
authored andcommitted
svcrdma: Split svcrmda_wc_{read,write} tracepoints
There are currently three separate purposes being served by single tracepoints. Split them up, as was done with wc_send. Signed-off-by: Chuck Lever <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent eef2d8d commit 45f1358

File tree

2 files changed

+62
-6
lines changed

2 files changed

+62
-6
lines changed

include/trace/events/rpcrdma.h

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2099,8 +2099,42 @@ DEFINE_POST_CHUNK_EVENT(read);
20992099
DEFINE_POST_CHUNK_EVENT(write);
21002100
DEFINE_POST_CHUNK_EVENT(reply);
21012101

2102-
DEFINE_COMPLETION_EVENT(svcrdma_wc_read);
2103-
DEFINE_COMPLETION_EVENT(svcrdma_wc_write);
2102+
TRACE_EVENT(svcrdma_wc_read,
2103+
TP_PROTO(
2104+
const struct ib_wc *wc,
2105+
const struct rpc_rdma_cid *cid,
2106+
unsigned int totalbytes,
2107+
const ktime_t posttime
2108+
),
2109+
2110+
TP_ARGS(wc, cid, totalbytes, posttime),
2111+
2112+
TP_STRUCT__entry(
2113+
__field(u32, cq_id)
2114+
__field(int, completion_id)
2115+
__field(s64, read_latency)
2116+
__field(unsigned int, totalbytes)
2117+
),
2118+
2119+
TP_fast_assign(
2120+
__entry->cq_id = cid->ci_queue_id;
2121+
__entry->completion_id = cid->ci_completion_id;
2122+
__entry->totalbytes = totalbytes;
2123+
__entry->read_latency = ktime_us_delta(ktime_get(), posttime);
2124+
),
2125+
2126+
TP_printk("cq.id=%u cid=%d totalbytes=%u latency-us=%lld",
2127+
__entry->cq_id, __entry->completion_id,
2128+
__entry->totalbytes, __entry->read_latency
2129+
)
2130+
);
2131+
2132+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_flush);
2133+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_read_err);
2134+
2135+
DEFINE_SEND_COMPLETION_EVENT(svcrdma_wc_write);
2136+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_flush);
2137+
DEFINE_SEND_FLUSH_EVENT(svcrdma_wc_write_err);
21042138

21052139
TRACE_EVENT(svcrdma_qp_error,
21062140
TP_PROTO(

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct svc_rdma_chunk_ctxt {
155155
struct ib_cqe cc_cqe;
156156
struct svcxprt_rdma *cc_rdma;
157157
struct list_head cc_rwctxts;
158+
ktime_t cc_posttime;
158159
int cc_sqecount;
159160
enum ib_wc_status cc_status;
160161
struct completion cc_done;
@@ -267,7 +268,16 @@ static void svc_rdma_write_done(struct ib_cq *cq, struct ib_wc *wc)
267268
struct svc_rdma_write_info *info =
268269
container_of(cc, struct svc_rdma_write_info, wi_cc);
269270

270-
trace_svcrdma_wc_write(wc, &cc->cc_cid);
271+
switch (wc->status) {
272+
case IB_WC_SUCCESS:
273+
trace_svcrdma_wc_write(wc, &cc->cc_cid);
274+
break;
275+
case IB_WC_WR_FLUSH_ERR:
276+
trace_svcrdma_wc_write_flush(wc, &cc->cc_cid);
277+
break;
278+
default:
279+
trace_svcrdma_wc_write_err(wc, &cc->cc_cid);
280+
}
271281

272282
svc_rdma_wake_send_waiters(rdma, cc->cc_sqecount);
273283

@@ -320,11 +330,22 @@ static void svc_rdma_wc_read_done(struct ib_cq *cq, struct ib_wc *wc)
320330
struct ib_cqe *cqe = wc->wr_cqe;
321331
struct svc_rdma_chunk_ctxt *cc =
322332
container_of(cqe, struct svc_rdma_chunk_ctxt, cc_cqe);
323-
struct svcxprt_rdma *rdma = cc->cc_rdma;
333+
struct svc_rdma_read_info *info;
324334

325-
trace_svcrdma_wc_read(wc, &cc->cc_cid);
335+
switch (wc->status) {
336+
case IB_WC_SUCCESS:
337+
info = container_of(cc, struct svc_rdma_read_info, ri_cc);
338+
trace_svcrdma_wc_read(wc, &cc->cc_cid, info->ri_totalbytes,
339+
cc->cc_posttime);
340+
break;
341+
case IB_WC_WR_FLUSH_ERR:
342+
trace_svcrdma_wc_read_flush(wc, &cc->cc_cid);
343+
break;
344+
default:
345+
trace_svcrdma_wc_read_err(wc, &cc->cc_cid);
346+
}
326347

327-
svc_rdma_wake_send_waiters(rdma, cc->cc_sqecount);
348+
svc_rdma_wake_send_waiters(cc->cc_rdma, cc->cc_sqecount);
328349
cc->cc_status = wc->status;
329350
complete(&cc->cc_done);
330351
return;
@@ -363,6 +384,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
363384
do {
364385
if (atomic_sub_return(cc->cc_sqecount,
365386
&rdma->sc_sq_avail) > 0) {
387+
cc->cc_posttime = ktime_get();
366388
ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr);
367389
if (ret)
368390
break;

0 commit comments

Comments
 (0)