svcrdma: Add class for RDMA backwards direction transport
To support the server-side of an NFSv4.1 backchannel on RDMA connections, add a transport class that enables backward direction messages on an existing forward channel connection. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: Bruce Fields <bfields@fieldses.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Doug Ledford

vecāks
03fe993153
revīzija
5d252f90a8
@@ -567,6 +567,38 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* By convention, backchannel calls arrive via rdma_msg type
|
||||
* messages, and never populate the chunk lists. This makes
|
||||
* the RPC/RDMA header small and fixed in size, so it is
|
||||
* straightforward to check the RPC header's direction field.
|
||||
*/
|
||||
static bool
|
||||
svc_rdma_is_backchannel_reply(struct svc_xprt *xprt, struct rpcrdma_msg *rmsgp)
|
||||
{
|
||||
__be32 *p = (__be32 *)rmsgp;
|
||||
|
||||
if (!xprt->xpt_bc_xprt)
|
||||
return false;
|
||||
|
||||
if (rmsgp->rm_type != rdma_msg)
|
||||
return false;
|
||||
if (rmsgp->rm_body.rm_chunks[0] != xdr_zero)
|
||||
return false;
|
||||
if (rmsgp->rm_body.rm_chunks[1] != xdr_zero)
|
||||
return false;
|
||||
if (rmsgp->rm_body.rm_chunks[2] != xdr_zero)
|
||||
return false;
|
||||
|
||||
/* sanity */
|
||||
if (p[7] != rmsgp->rm_xid)
|
||||
return false;
|
||||
/* call direction */
|
||||
if (p[8] == cpu_to_be32(RPC_CALL))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the rqstp thread context to point to the RQ buffer. If
|
||||
* necessary, pull additional data from the client with an RDMA_READ
|
||||
@@ -632,6 +664,15 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
|
||||
goto close_out;
|
||||
}
|
||||
|
||||
if (svc_rdma_is_backchannel_reply(xprt, rmsgp)) {
|
||||
ret = svc_rdma_handle_bc_reply(xprt->xpt_bc_xprt, rmsgp,
|
||||
&rqstp->rq_arg);
|
||||
svc_rdma_put_context(ctxt, 0);
|
||||
if (ret)
|
||||
goto repost;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Read read-list data. */
|
||||
ret = rdma_read_chunks(rdma_xprt, rmsgp, rqstp, ctxt);
|
||||
if (ret > 0) {
|
||||
@@ -668,4 +709,15 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
|
||||
set_bit(XPT_CLOSE, &xprt->xpt_flags);
|
||||
defer:
|
||||
return 0;
|
||||
|
||||
repost:
|
||||
ret = svc_rdma_post_recv(rdma_xprt, GFP_KERNEL);
|
||||
if (ret) {
|
||||
pr_err("svcrdma: could not post a receive buffer, err=%d.\n",
|
||||
ret);
|
||||
pr_err("svcrdma: closing transport %p.\n", rdma_xprt);
|
||||
set_bit(XPT_CLOSE, &rdma_xprt->sc_xprt.xpt_flags);
|
||||
ret = -ENOTCONN;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user