Commit 15cdc644 authored by Tom Tucker's avatar Tom Tucker Committed by Trond Myklebust

rpcrdma: Fix SQ size calculation when memreg is FRMR

This patch updates the computation to include the worst case situation
where three FRMR are required to map a single RPC REQ.
Signed-off-by: default avatarTom Tucker <tom@ogc.us>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 7a8b80eb
...@@ -249,6 +249,8 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target, ...@@ -249,6 +249,8 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
req->rl_nchunks = nchunks; req->rl_nchunks = nchunks;
BUG_ON(nchunks == 0); BUG_ON(nchunks == 0);
BUG_ON((r_xprt->rx_ia.ri_memreg_strategy == RPCRDMA_FRMR)
&& (nchunks > 3));
/* /*
* finish off header. If write, marshal discrim and nchunks. * finish off header. If write, marshal discrim and nchunks.
......
...@@ -650,10 +650,22 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, ...@@ -650,10 +650,22 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia,
ep->rep_attr.cap.max_send_wr = cdata->max_requests; ep->rep_attr.cap.max_send_wr = cdata->max_requests;
switch (ia->ri_memreg_strategy) { switch (ia->ri_memreg_strategy) {
case RPCRDMA_FRMR: case RPCRDMA_FRMR:
/* Add room for frmr register and invalidate WRs */ /* Add room for frmr register and invalidate WRs.
ep->rep_attr.cap.max_send_wr *= 3; * 1. FRMR reg WR for head
if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) * 2. FRMR invalidate WR for head
return -EINVAL; * 3. FRMR reg WR for pagelist
* 4. FRMR invalidate WR for pagelist
* 5. FRMR reg WR for tail
* 6. FRMR invalidate WR for tail
* 7. The RDMA_SEND WR
*/
ep->rep_attr.cap.max_send_wr *= 7;
if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) {
cdata->max_requests = devattr.max_qp_wr / 7;
if (!cdata->max_requests)
return -EINVAL;
ep->rep_attr.cap.max_send_wr = cdata->max_requests * 7;
}
break; break;
case RPCRDMA_MEMWINDOWS_ASYNC: case RPCRDMA_MEMWINDOWS_ASYNC:
case RPCRDMA_MEMWINDOWS: case RPCRDMA_MEMWINDOWS:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment