mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
svcrdma: Use svc_rdma_refresh_recvs() in wc_receive
Replace svc_rdma_post_recv() with the new batch receive mechanism. For the moment it is posting just a single Receive WR at a time, so no change in behavior is expected. Since svc_rdma_wc_receive() was the last call site for svc_rdma_post_recv(), it is removed. Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
@@ -305,35 +305,6 @@ err_free:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
|
|
||||||
struct svc_rdma_recv_ctxt *ctxt)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
trace_svcrdma_post_recv(ctxt);
|
|
||||||
ret = ib_post_recv(rdma->sc_qp, &ctxt->rc_recv_wr, NULL);
|
|
||||||
if (ret)
|
|
||||||
goto err_post;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
err_post:
|
|
||||||
trace_svcrdma_rq_post_err(rdma, ret);
|
|
||||||
svc_rdma_recv_ctxt_put(rdma, ctxt);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int svc_rdma_post_recv(struct svcxprt_rdma *rdma)
|
|
||||||
{
|
|
||||||
struct svc_rdma_recv_ctxt *ctxt;
|
|
||||||
|
|
||||||
if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags))
|
|
||||||
return 0;
|
|
||||||
ctxt = svc_rdma_recv_ctxt_get(rdma);
|
|
||||||
if (!ctxt)
|
|
||||||
return -ENOMEM;
|
|
||||||
return __svc_rdma_post_recv(rdma, ctxt);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* svc_rdma_post_recvs - Post initial set of Recv WRs
|
* svc_rdma_post_recvs - Post initial set of Recv WRs
|
||||||
* @rdma: fresh svcxprt_rdma
|
* @rdma: fresh svcxprt_rdma
|
||||||
@@ -364,8 +335,17 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
|
|||||||
if (wc->status != IB_WC_SUCCESS)
|
if (wc->status != IB_WC_SUCCESS)
|
||||||
goto flushed;
|
goto flushed;
|
||||||
|
|
||||||
if (svc_rdma_post_recv(rdma))
|
/* If receive posting fails, the connection is about to be
|
||||||
goto post_err;
|
* lost anyway. The server will not be able to send a reply
|
||||||
|
* for this RPC, and the client will retransmit this RPC
|
||||||
|
* anyway when it reconnects.
|
||||||
|
*
|
||||||
|
* Therefore we drop the Receive, even if status was SUCCESS
|
||||||
|
* to reduce the likelihood of replayed requests once the
|
||||||
|
* client reconnects.
|
||||||
|
*/
|
||||||
|
if (!svc_rdma_refresh_recvs(rdma, 1, false))
|
||||||
|
goto flushed;
|
||||||
|
|
||||||
/* All wc fields are now known to be valid */
|
/* All wc fields are now known to be valid */
|
||||||
ctxt->rc_byte_len = wc->byte_len;
|
ctxt->rc_byte_len = wc->byte_len;
|
||||||
@@ -380,7 +360,6 @@ static void svc_rdma_wc_receive(struct ib_cq *cq, struct ib_wc *wc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
flushed:
|
flushed:
|
||||||
post_err:
|
|
||||||
svc_rdma_recv_ctxt_put(rdma, ctxt);
|
svc_rdma_recv_ctxt_put(rdma, ctxt);
|
||||||
set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
|
set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
|
||||||
svc_xprt_enqueue(&rdma->sc_xprt);
|
svc_xprt_enqueue(&rdma->sc_xprt);
|
||||||
|
Reference in New Issue
Block a user