Skip to content

Commit 17f70f8

Browse files
committed
svcrdma: Record send_ctxt completion ID in trace_svcrdma_post_send()
First, refactor: Dereference the svc_rdma_send_ctxt inside svc_rdma_send() instead of at every call site. Then, it can be passed into trace_svcrdma_post_send() to get the proper completion ID. Signed-off-by: Chuck Lever <[email protected]>
1 parent 3ac56c2 commit 17f70f8

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

include/linux/sunrpc/svc_rdma.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ extern struct svc_rdma_send_ctxt *
196196
svc_rdma_send_ctxt_get(struct svcxprt_rdma *rdma);
197197
extern void svc_rdma_send_ctxt_put(struct svcxprt_rdma *rdma,
198198
struct svc_rdma_send_ctxt *ctxt);
199-
extern int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr);
199+
extern int svc_rdma_send(struct svcxprt_rdma *rdma,
200+
struct svc_rdma_send_ctxt *ctxt);
200201
extern int svc_rdma_map_reply_msg(struct svcxprt_rdma *rdma,
201202
struct svc_rdma_send_ctxt *sctxt,
202203
const struct svc_rdma_recv_ctxt *rctxt,

include/trace/events/rpcrdma.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,27 +1839,31 @@ DECLARE_EVENT_CLASS(svcrdma_sendcomp_event,
18391839

18401840
TRACE_EVENT(svcrdma_post_send,
18411841
TP_PROTO(
1842-
const struct ib_send_wr *wr
1842+
const struct svc_rdma_send_ctxt *ctxt
18431843
),
18441844

1845-
TP_ARGS(wr),
1845+
TP_ARGS(ctxt),
18461846

18471847
TP_STRUCT__entry(
1848-
__field(const void *, cqe)
1848+
__field(u32, cq_id)
1849+
__field(int, completion_id)
18491850
__field(unsigned int, num_sge)
18501851
__field(u32, inv_rkey)
18511852
),
18521853

18531854
TP_fast_assign(
1854-
__entry->cqe = wr->wr_cqe;
1855+
const struct ib_send_wr *wr = &ctxt->sc_send_wr;
1856+
1857+
__entry->cq_id = ctxt->sc_cid.ci_queue_id;
1858+
__entry->completion_id = ctxt->sc_cid.ci_completion_id;
18551859
__entry->num_sge = wr->num_sge;
18561860
__entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ?
18571861
wr->ex.invalidate_rkey : 0;
18581862
),
18591863

1860-
TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x",
1861-
__entry->cqe, __entry->num_sge,
1862-
__entry->inv_rkey
1864+
TP_printk("cq_id=%u cid=%d num_sge=%u inv_rkey=0x%08x",
1865+
__entry->cq_id, __entry->completion_id,
1866+
__entry->num_sge, __entry->inv_rkey
18631867
)
18641868
);
18651869

net/sunrpc/xprtrdma/svc_rdma_backchannel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static int svc_rdma_bc_sendto(struct svcxprt_rdma *rdma,
8787
*/
8888
get_page(virt_to_page(rqst->rq_buffer));
8989
ctxt->sc_send_wr.opcode = IB_WR_SEND;
90-
return svc_rdma_send(rdma, &ctxt->sc_send_wr);
90+
return svc_rdma_send(rdma, ctxt);
9191
}
9292

9393
/* Server-side transport endpoint wants a whole page for its send

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,14 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc)
298298
/**
299299
* svc_rdma_send - Post a single Send WR
300300
* @rdma: transport on which to post the WR
301-
* @wr: prepared Send WR to post
301+
* @ctxt: send ctxt with a Send WR ready to post
302302
*
303303
* Returns zero the Send WR was posted successfully. Otherwise, a
304304
* negative errno is returned.
305305
*/
306-
int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr)
306+
int svc_rdma_send(struct svcxprt_rdma *rdma, struct svc_rdma_send_ctxt *ctxt)
307307
{
308+
struct ib_send_wr *wr = &ctxt->sc_send_wr;
308309
int ret;
309310

310311
might_sleep();
@@ -330,7 +331,7 @@ int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr)
330331
}
331332

332333
svc_xprt_get(&rdma->sc_xprt);
333-
trace_svcrdma_post_send(wr);
334+
trace_svcrdma_post_send(ctxt);
334335
ret = ib_post_send(rdma->sc_qp, wr, NULL);
335336
if (ret)
336337
break;
@@ -805,7 +806,7 @@ static int svc_rdma_send_reply_msg(struct svcxprt_rdma *rdma,
805806
} else {
806807
sctxt->sc_send_wr.opcode = IB_WR_SEND;
807808
}
808-
return svc_rdma_send(rdma, &sctxt->sc_send_wr);
809+
return svc_rdma_send(rdma, sctxt);
809810
}
810811

811812
/**
@@ -869,7 +870,7 @@ void svc_rdma_send_error_msg(struct svcxprt_rdma *rdma,
869870
sctxt->sc_send_wr.num_sge = 1;
870871
sctxt->sc_send_wr.opcode = IB_WR_SEND;
871872
sctxt->sc_sges[0].length = sctxt->sc_hdrbuf.len;
872-
if (svc_rdma_send(rdma, &sctxt->sc_send_wr))
873+
if (svc_rdma_send(rdma, sctxt))
873874
goto put_ctxt;
874875
return;
875876

0 commit comments

Comments
 (0)