// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2015-2020, Oracle and/or its affiliates. * * Support for reverse-direction RPCs on RPC/RDMA. */ #include <linux/sunrpc/xprt.h> #include <linux/sunrpc/svc.h> #include <linux/sunrpc/svc_xprt.h> #include <linux/sunrpc/svc_rdma.h> #include "xprt_rdma.h" #include <trace/events/rpcrdma.h> #undef RPCRDMA_BACKCHANNEL_DEBUG /** * xprt_rdma_bc_setup - Pre-allocate resources for handling backchannel requests * @xprt: transport associated with these backchannel resources * @reqs: number of concurrent incoming requests to expect * * Returns 0 on success; otherwise a negative errno */ int xprt_rdma_bc_setup(struct rpc_xprt *xprt, unsigned int reqs) { … } /** * xprt_rdma_bc_maxpayload - Return maximum backchannel message size * @xprt: transport * * Returns maximum size, in bytes, of a backchannel message */ size_t xprt_rdma_bc_maxpayload(struct rpc_xprt *xprt) { … } unsigned int xprt_rdma_bc_max_slots(struct rpc_xprt *xprt) { … } static int rpcrdma_bc_marshal_reply(struct rpc_rqst *rqst) { … } /** * xprt_rdma_bc_send_reply - marshal and send a backchannel reply * @rqst: RPC rqst with a backchannel RPC reply in rq_snd_buf * * Caller holds the transport's write lock. * * Returns: * %0 if the RPC message has been sent * %-ENOTCONN if the caller should reconnect and call again * %-EIO if a permanent error occurred and the request was not * sent. Do not try to send this message again. */ int xprt_rdma_bc_send_reply(struct rpc_rqst *rqst) { … } /** * xprt_rdma_bc_destroy - Release resources for handling backchannel requests * @xprt: transport associated with these backchannel resources * @reqs: number of incoming requests to destroy; ignored */ void xprt_rdma_bc_destroy(struct rpc_xprt *xprt, unsigned int reqs) { … } /** * xprt_rdma_bc_free_rqst - Release a backchannel rqst * @rqst: request to release */ void xprt_rdma_bc_free_rqst(struct rpc_rqst *rqst) { … } static struct rpc_rqst *rpcrdma_bc_rqst_get(struct rpcrdma_xprt *r_xprt) { … } /** * rpcrdma_bc_receive_call - Handle a reverse-direction Call * @r_xprt: transport receiving the call * @rep: receive buffer containing the call * * Operational assumptions: * o Backchannel credits are ignored, just as the NFS server * forechannel currently does * o The ULP manages a replay cache (eg, NFSv4.1 sessions). * No replay detection is done at the transport level */ void rpcrdma_bc_receive_call(struct rpcrdma_xprt *r_xprt, struct rpcrdma_rep *rep) { … }