xprtrdma: Remove rpcrdma_rep::rr_len
authorChuck Lever <chuck.lever@oracle.com>
Thu, 3 Aug 2017 18:30:44 +0000 (14:30 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 8 Aug 2017 14:52:01 +0000 (10:52 -0400)
This field is no longer used outside the Receive completion handler.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/rpc_rdma.c
net/sunrpc/xprtrdma/verbs.c
net/sunrpc/xprtrdma/xprt_rdma.h

index e422c0f63a69b8171b4683b7614bc237013aa1ab..62198615649544baba3e6483a03258310708accc 100644 (file)
@@ -1178,7 +1178,7 @@ rpcrdma_reply_handler(struct work_struct *work)
 
        dprintk("RPC:       %s: incoming rep %p\n", __func__, rep);
 
-       if (rep->rr_len == RPCRDMA_BAD_LEN)
+       if (rep->rr_hdrbuf.head[0].iov_len == 0)
                goto out_badstatus;
 
        xdr_init_decode(xdr, &rep->rr_hdrbuf,
index 74dbba84ad386b5e6d9930760f21a1481f503523..5d36c066552df3ce3b69adae78e9686da70710cf 100644 (file)
@@ -143,9 +143,6 @@ rpcrdma_update_granted_credits(struct rpcrdma_rep *rep)
        struct rpcrdma_buffer *buffer = &rep->rr_rxprt->rx_buf;
        u32 credits;
 
-       if (rep->rr_len < RPCRDMA_HDRLEN_ERR)
-               return;
-
        credits = be32_to_cpu(rmsgp->rm_credit);
        if (credits == 0)
                credits = 1;    /* don't deadlock */
@@ -176,16 +173,16 @@ rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
        dprintk("RPC:       %s: rep %p opcode 'recv', length %u: success\n",
                __func__, rep, wc->byte_len);
 
-       rep->rr_len = wc->byte_len;
        rpcrdma_set_xdrlen(&rep->rr_hdrbuf, wc->byte_len);
        rep->rr_wc_flags = wc->wc_flags;
        rep->rr_inv_rkey = wc->ex.invalidate_rkey;
 
        ib_dma_sync_single_for_cpu(rdmab_device(rep->rr_rdmabuf),
                                   rdmab_addr(rep->rr_rdmabuf),
-                                  rep->rr_len, DMA_FROM_DEVICE);
+                                  wc->byte_len, DMA_FROM_DEVICE);
 
-       rpcrdma_update_granted_credits(rep);
+       if (wc->byte_len >= RPCRDMA_HDRLEN_ERR)
+               rpcrdma_update_granted_credits(rep);
 
 out_schedule:
        queue_work(rpcrdma_receive_wq, &rep->rr_work);
@@ -196,7 +193,7 @@ out_fail:
                pr_err("rpcrdma: Recv: %s (%u/0x%x)\n",
                       ib_wc_status_msg(wc->status),
                       wc->status, wc->vendor_err);
-       rep->rr_len = RPCRDMA_BAD_LEN;
+       rpcrdma_set_xdrlen(&rep->rr_hdrbuf, 0);
        goto out_schedule;
 }
 
index 13556ae11eec6055d359c4367fc76109c99a338f..d4a897af9d9bd01d5d65dfdc4717c3ecefd58f59 100644 (file)
@@ -218,7 +218,6 @@ enum {
 
 struct rpcrdma_rep {
        struct ib_cqe           rr_cqe;
-       unsigned int            rr_len;
        int                     rr_wc_flags;
        u32                     rr_inv_rkey;
        struct rpcrdma_xprt     *rr_rxprt;
@@ -230,8 +229,6 @@ struct rpcrdma_rep {
        struct rpcrdma_regbuf   *rr_rdmabuf;
 };
 
-#define RPCRDMA_BAD_LEN                (~0U)
-
 /*
  * struct rpcrdma_mw - external memory region metadata
  *