// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015-2018 Oracle. All rights reserved. * * Support for reverse-direction RPCs on RPC/RDMA (server-side).
*/
/* Send a reverse-direction RPC Call. * * Caller holds the connection's mutex and has already marshaled * the RPC/RDMA request. * * This is similar to svc_rdma_send_reply_msg, but takes a struct * rpc_rqst instead, does not support chunks, and avoids blocking * memory allocation. * * XXX: There is still an opportunity to block in svc_rdma_send() * if there are no SQ entries to post the Send. This may occur if * the adapter has a small maximum SQ depth.
*/ staticint svc_rdma_bc_sendto(struct svcxprt_rdma *rdma, struct rpc_rqst *rqst, struct svc_rdma_send_ctxt *sctxt)
{ struct svc_rdma_pcl empty_pcl; int ret;
pcl_init(&empty_pcl);
ret = svc_rdma_map_reply_msg(rdma, sctxt, &empty_pcl, &empty_pcl,
&rqst->rq_snd_buf); if (ret < 0) return -EIO;
/* Bump page refcnt so Send completion doesn't release * the rq_buffer before all retransmits are complete.
*/
get_page(virt_to_page(rqst->rq_buffer));
sctxt->sc_send_wr.opcode = IB_WR_SEND; return svc_rdma_post_send(rdma, sctxt);
}
/* Server-side transport endpoint wants a whole page for its send * buffer. The client RPC code constructs the RPC header in this * buffer before it invokes ->send_request.
*/ staticint
xprt_rdma_bc_allocate(struct rpc_task *task)
{ struct rpc_rqst *rqst = task->tk_rqstp;
size_t size = rqst->rq_callsize; struct page *page;
if (size > PAGE_SIZE) {
WARN_ONCE(1, "svcrdma: large bc buffer request (size %zu)\n",
size); return -EINVAL;
}
/** * xprt_rdma_bc_send_request - Send a reverse-direction Call * @rqst: rpc_rqst containing Call message to be sent * * Return values: * %0 if the message was sent successfully * %ENOTCONN if the message was not sent
*/ staticint xprt_rdma_bc_send_request(struct rpc_rqst *rqst)
{ struct svc_xprt *sxprt = rqst->rq_xprt->bc_xprt; struct svcxprt_rdma *rdma =
container_of(sxprt, struct svcxprt_rdma, sc_xprt); int ret;
if (test_bit(XPT_DEAD, &sxprt->xpt_flags)) return -ENOTCONN;
ret = rpcrdma_bc_send_request(rdma, rqst); if (ret == -ENOTCONN)
svc_xprt_close(sxprt); return ret;
}
/* It shouldn't matter if the number of backchannel session slots * doesn't match the number of RPC/RDMA credits. That just means * one or the other will have extra slots that aren't used.
*/ staticstruct rpc_xprt *
xprt_setup_rdma_bc(struct xprt_create *args)
{ struct rpc_xprt *xprt; struct rpcrdma_xprt *new_xprt;
if (args->addrlen > sizeof(xprt->addr)) return ERR_PTR(-EBADF);
xprt = xprt_alloc(args->net, sizeof(*new_xprt),
RPCRDMA_MAX_BC_REQUESTS,
RPCRDMA_MAX_BC_REQUESTS); if (!xprt) return ERR_PTR(-ENOMEM);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.