Skip to content

Commit 3ac56c2

Browse files
committed
svcrdma: Introduce Send completion IDs
Set up a completion ID in each svc_rdma_send_ctxt. The ID is used to match an incoming Send completion to a transport and to a previous ib_post_send(). Signed-off-by: Chuck Lever <[email protected]>
1 parent 007140e commit 3ac56c2

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

include/linux/sunrpc/svc_rdma.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ struct svc_rdma_recv_ctxt {
151151

152152
struct svc_rdma_send_ctxt {
153153
struct list_head sc_list;
154+
struct rpc_rdma_cid sc_cid;
155+
154156
struct ib_send_wr sc_send_wr;
155157
struct ib_cqe sc_cqe;
156158
struct xdr_buf sc_hdrbuf;

include/trace/events/rpcrdma.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1863,7 +1863,7 @@ TRACE_EVENT(svcrdma_post_send,
18631863
)
18641864
);
18651865

1866-
DEFINE_SENDCOMP_EVENT(send);
1866+
DEFINE_COMPLETION_EVENT(svcrdma_wc_send);
18671867

18681868
TRACE_EVENT(svcrdma_post_recv,
18691869
TP_PROTO(

net/sunrpc/xprtrdma/svc_rdma_sendto.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ svc_rdma_next_send_ctxt(struct list_head *list)
122122
sc_list);
123123
}
124124

125+
static void svc_rdma_send_cid_init(struct svcxprt_rdma *rdma,
126+
struct rpc_rdma_cid *cid)
127+
{
128+
cid->ci_queue_id = rdma->sc_sq_cq->res.id;
129+
cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids);
130+
}
131+
125132
static struct svc_rdma_send_ctxt *
126133
svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
127134
{
@@ -144,6 +151,8 @@ svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
144151
if (ib_dma_mapping_error(rdma->sc_pd->device, addr))
145152
goto fail2;
146153

154+
svc_rdma_send_cid_init(rdma, &ctxt->sc_cid);
155+
147156
ctxt->sc_send_wr.next = NULL;
148157
ctxt->sc_send_wr.wr_cqe = &ctxt->sc_cqe;
149158
ctxt->sc_send_wr.sg_list = ctxt->sc_sges;
@@ -268,14 +277,14 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc)
268277
{
269278
struct svcxprt_rdma *rdma = cq->cq_context;
270279
struct ib_cqe *cqe = wc->wr_cqe;
271-
struct svc_rdma_send_ctxt *ctxt;
280+
struct svc_rdma_send_ctxt *ctxt =
281+
container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe);
272282

273-
trace_svcrdma_wc_send(wc);
283+
trace_svcrdma_wc_send(wc, &ctxt->sc_cid);
274284

275285
atomic_inc(&rdma->sc_sq_avail);
276286
wake_up(&rdma->sc_send_wait);
277287

278-
ctxt = container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe);
279288
svc_rdma_send_ctxt_put(rdma, ctxt);
280289

281290
if (unlikely(wc->status != IB_WC_SUCCESS)) {

0 commit comments

Comments
 (0)