svcrdma: Introduce Send completion IDs
authorChuck Lever <chuck.lever@oracle.com>
Thu, 30 Apr 2020 17:47:07 +0000 (13:47 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 13 Jul 2020 21:28:24 +0000 (17:28 -0400)
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 <chuck.lever@oracle.com>
include/linux/sunrpc/svc_rdma.h
include/trace/events/rpcrdma.h
net/sunrpc/xprtrdma/svc_rdma_sendto.c

index c3c1e46f510f68955f461bb5d23742cf3a44228c..c91e00bc937ef55e7ec34ef7c59b05473785bcf5 100644 (file)
@@ -151,6 +151,8 @@ struct svc_rdma_recv_ctxt {
 
 struct svc_rdma_send_ctxt {
        struct list_head        sc_list;
+       struct rpc_rdma_cid     sc_cid;
+
        struct ib_send_wr       sc_send_wr;
        struct ib_cqe           sc_cqe;
        struct xdr_buf          sc_hdrbuf;
index df49ae5d447bf23c5a160d485f0f5f3a41c374cf..782a4d826a4b6c0d8b3019bd7235aa4ab84800dc 100644 (file)
@@ -1863,7 +1863,7 @@ TRACE_EVENT(svcrdma_post_send,
        )
 );
 
-DEFINE_SENDCOMP_EVENT(send);
+DEFINE_COMPLETION_EVENT(svcrdma_wc_send);
 
 TRACE_EVENT(svcrdma_post_recv,
        TP_PROTO(
index 38d8f0ee35ecdd931849ec34b809dbd41f66fcdd..c720dcf56231d278b081c298f03574f05da93760 100644 (file)
@@ -122,6 +122,13 @@ svc_rdma_next_send_ctxt(struct list_head *list)
                                        sc_list);
 }
 
+static void svc_rdma_send_cid_init(struct svcxprt_rdma *rdma,
+                                  struct rpc_rdma_cid *cid)
+{
+       cid->ci_queue_id = rdma->sc_sq_cq->res.id;
+       cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids);
+}
+
 static struct svc_rdma_send_ctxt *
 svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
 {
@@ -144,6 +151,8 @@ svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma)
        if (ib_dma_mapping_error(rdma->sc_pd->device, addr))
                goto fail2;
 
+       svc_rdma_send_cid_init(rdma, &ctxt->sc_cid);
+
        ctxt->sc_send_wr.next = NULL;
        ctxt->sc_send_wr.wr_cqe = &ctxt->sc_cqe;
        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)
 {
        struct svcxprt_rdma *rdma = cq->cq_context;
        struct ib_cqe *cqe = wc->wr_cqe;
-       struct svc_rdma_send_ctxt *ctxt;
+       struct svc_rdma_send_ctxt *ctxt =
+               container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe);
 
-       trace_svcrdma_wc_send(wc);
+       trace_svcrdma_wc_send(wc, &ctxt->sc_cid);
 
        atomic_inc(&rdma->sc_sq_avail);
        wake_up(&rdma->sc_send_wait);
 
-       ctxt = container_of(cqe, struct svc_rdma_send_ctxt, sc_cqe);
        svc_rdma_send_ctxt_put(rdma, ctxt);
 
        if (unlikely(wc->status != IB_WC_SUCCESS)) {