Skip to content

Commit 2ae50ad

Browse files
chuckleveramschuma-ntap
authored andcommitted
xprtrdma: Close window between waking RPC senders and posting Receives
A recent clean up attempted to separate Receive handling and RPC Reply processing, in the name of clean layering. Unfortunately, we can't do this because the Receive Queue has to be refilled _after_ the most recent credit update from the responder is parsed from the transport header, but _before_ we wake up the next RPC sender. That is right in the middle of rpcrdma_reply_handler(). Usually this isn't a problem because current responder implementations don't vary their credit grant. The one exception is when a connection is established: the grant goes from one to a much larger number on the first Receive. The requester MUST post enough Receives right then so that any outstanding requests can be sent without risking RNR and connection loss. Fixes: 6ceea36 ("xprtrdma: Refactor Receive accounting") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
1 parent eea63ca commit 2ae50ad

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎net/sunrpc/xprtrdma/rpc_rdma.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,7 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)
13921392
credits = buf->rb_max_requests;
13931393
if (buf->rb_credits != credits)
13941394
rpcrdma_update_cwnd(r_xprt, credits);
1395+
rpcrdma_post_recvs(r_xprt, false);
13951396

13961397
req = rpcr_to_rdmar(rqst);
13971398
if (req->rl_reply) {

‎net/sunrpc/xprtrdma/verbs.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ rpcrdma_regbuf_alloc(size_t size, enum dma_data_direction direction,
8585
gfp_t flags);
8686
static void rpcrdma_regbuf_dma_unmap(struct rpcrdma_regbuf *rb);
8787
static void rpcrdma_regbuf_free(struct rpcrdma_regbuf *rb);
88-
static void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);
8988

9089
/* Wait for outstanding transport work to finish. ib_drain_qp
9190
* handles the drains in the wrong order for us, so open code
@@ -171,7 +170,6 @@ rpcrdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
171170
rdmab_addr(rep->rr_rdmabuf),
172171
wc->byte_len, DMA_FROM_DEVICE);
173172

174-
rpcrdma_post_recvs(r_xprt, false);
175173
rpcrdma_reply_handler(rep);
176174
return;
177175

@@ -1477,8 +1475,13 @@ rpcrdma_ep_post(struct rpcrdma_ia *ia,
14771475
return 0;
14781476
}
14791477

1480-
static void
1481-
rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
1478+
/**
1479+
* rpcrdma_post_recvs - Refill the Receive Queue
1480+
* @r_xprt: controlling transport instance
1481+
* @temp: mark Receive buffers to be deleted after use
1482+
*
1483+
*/
1484+
void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
14821485
{
14831486
struct rpcrdma_buffer *buf = &r_xprt->rx_buf;
14841487
struct rpcrdma_ep *ep = &r_xprt->rx_ep;

‎net/sunrpc/xprtrdma/xprt_rdma.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,7 @@ void rpcrdma_ep_disconnect(struct rpcrdma_ep *, struct rpcrdma_ia *);
474474

475475
int rpcrdma_ep_post(struct rpcrdma_ia *, struct rpcrdma_ep *,
476476
struct rpcrdma_req *);
477+
void rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp);
477478

478479
/*
479480
* Buffer calls - xprtrdma/verbs.c

0 commit comments

Comments
 (0)