mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 08:44:14 +08:00
svcrdma: Add backward direction service for RPC/RDMA transport
On NFSv4.1 mount points, the Linux NFS client uses this transport endpoint to receive backward direction calls and route replies back to the NFSv4.1 server. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Acked-by: "J. Bruce Fields" <bfields@fieldses.org> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Tested-By: Devesh Sharma <devesh.sharma@avagotech.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
63cae47005
commit
9468431962
@ -228,9 +228,13 @@ extern void svc_rdma_put_frmr(struct svcxprt_rdma *,
|
|||||||
struct svc_rdma_fastreg_mr *);
|
struct svc_rdma_fastreg_mr *);
|
||||||
extern void svc_sq_reap(struct svcxprt_rdma *);
|
extern void svc_sq_reap(struct svcxprt_rdma *);
|
||||||
extern void svc_rq_reap(struct svcxprt_rdma *);
|
extern void svc_rq_reap(struct svcxprt_rdma *);
|
||||||
extern struct svc_xprt_class svc_rdma_class;
|
|
||||||
extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
|
extern void svc_rdma_prep_reply_hdr(struct svc_rqst *);
|
||||||
|
|
||||||
|
extern struct svc_xprt_class svc_rdma_class;
|
||||||
|
#ifdef CONFIG_SUNRPC_BACKCHANNEL
|
||||||
|
extern struct svc_xprt_class svc_rdma_bc_class;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* svc_rdma.c */
|
/* svc_rdma.c */
|
||||||
extern int svc_rdma_init(void);
|
extern int svc_rdma_init(void);
|
||||||
extern void svc_rdma_cleanup(void);
|
extern void svc_rdma_cleanup(void);
|
||||||
|
@ -158,6 +158,7 @@ enum xprt_transports {
|
|||||||
XPRT_TRANSPORT_TCP = IPPROTO_TCP,
|
XPRT_TRANSPORT_TCP = IPPROTO_TCP,
|
||||||
XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
|
XPRT_TRANSPORT_BC_TCP = IPPROTO_TCP | XPRT_TRANSPORT_BC,
|
||||||
XPRT_TRANSPORT_RDMA = 256,
|
XPRT_TRANSPORT_RDMA = 256,
|
||||||
|
XPRT_TRANSPORT_BC_RDMA = XPRT_TRANSPORT_RDMA | XPRT_TRANSPORT_BC,
|
||||||
XPRT_TRANSPORT_LOCAL = 257,
|
XPRT_TRANSPORT_LOCAL = 257,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -239,6 +239,9 @@ void svc_rdma_cleanup(void)
|
|||||||
unregister_sysctl_table(svcrdma_table_header);
|
unregister_sysctl_table(svcrdma_table_header);
|
||||||
svcrdma_table_header = NULL;
|
svcrdma_table_header = NULL;
|
||||||
}
|
}
|
||||||
|
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
|
||||||
|
svc_unreg_xprt_class(&svc_rdma_bc_class);
|
||||||
|
#endif
|
||||||
svc_unreg_xprt_class(&svc_rdma_class);
|
svc_unreg_xprt_class(&svc_rdma_class);
|
||||||
kmem_cache_destroy(svc_rdma_map_cachep);
|
kmem_cache_destroy(svc_rdma_map_cachep);
|
||||||
kmem_cache_destroy(svc_rdma_ctxt_cachep);
|
kmem_cache_destroy(svc_rdma_ctxt_cachep);
|
||||||
@ -286,6 +289,9 @@ int svc_rdma_init(void)
|
|||||||
|
|
||||||
/* Register RDMA with the SVC transport switch */
|
/* Register RDMA with the SVC transport switch */
|
||||||
svc_reg_xprt_class(&svc_rdma_class);
|
svc_reg_xprt_class(&svc_rdma_class);
|
||||||
|
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
|
||||||
|
svc_reg_xprt_class(&svc_rdma_bc_class);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
err1:
|
err1:
|
||||||
kmem_cache_destroy(svc_rdma_map_cachep);
|
kmem_cache_destroy(svc_rdma_map_cachep);
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
|
|
||||||
#define RPCDBG_FACILITY RPCDBG_SVCXPRT
|
#define RPCDBG_FACILITY RPCDBG_SVCXPRT
|
||||||
|
|
||||||
|
static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *, int);
|
||||||
static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
|
static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
|
||||||
struct net *net,
|
struct net *net,
|
||||||
struct sockaddr *sa, int salen,
|
struct sockaddr *sa, int salen,
|
||||||
@ -95,6 +96,63 @@ struct svc_xprt_class svc_rdma_class = {
|
|||||||
.xcl_ident = XPRT_TRANSPORT_RDMA,
|
.xcl_ident = XPRT_TRANSPORT_RDMA,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
|
||||||
|
static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *, struct net *,
|
||||||
|
struct sockaddr *, int, int);
|
||||||
|
static void svc_rdma_bc_detach(struct svc_xprt *);
|
||||||
|
static void svc_rdma_bc_free(struct svc_xprt *);
|
||||||
|
|
||||||
|
static struct svc_xprt_ops svc_rdma_bc_ops = {
|
||||||
|
.xpo_create = svc_rdma_bc_create,
|
||||||
|
.xpo_detach = svc_rdma_bc_detach,
|
||||||
|
.xpo_free = svc_rdma_bc_free,
|
||||||
|
.xpo_prep_reply_hdr = svc_rdma_prep_reply_hdr,
|
||||||
|
.xpo_secure_port = svc_rdma_secure_port,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct svc_xprt_class svc_rdma_bc_class = {
|
||||||
|
.xcl_name = "rdma-bc",
|
||||||
|
.xcl_owner = THIS_MODULE,
|
||||||
|
.xcl_ops = &svc_rdma_bc_ops,
|
||||||
|
.xcl_max_payload = (1024 - RPCRDMA_HDRLEN_MIN)
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *serv,
|
||||||
|
struct net *net,
|
||||||
|
struct sockaddr *sa, int salen,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
struct svcxprt_rdma *cma_xprt;
|
||||||
|
struct svc_xprt *xprt;
|
||||||
|
|
||||||
|
cma_xprt = rdma_create_xprt(serv, 0);
|
||||||
|
if (!cma_xprt)
|
||||||
|
return ERR_PTR(-ENOMEM);
|
||||||
|
xprt = &cma_xprt->sc_xprt;
|
||||||
|
|
||||||
|
svc_xprt_init(net, &svc_rdma_bc_class, xprt, serv);
|
||||||
|
serv->sv_bc_xprt = xprt;
|
||||||
|
|
||||||
|
dprintk("svcrdma: %s(%p)\n", __func__, xprt);
|
||||||
|
return xprt;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void svc_rdma_bc_detach(struct svc_xprt *xprt)
|
||||||
|
{
|
||||||
|
dprintk("svcrdma: %s(%p)\n", __func__, xprt);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void svc_rdma_bc_free(struct svc_xprt *xprt)
|
||||||
|
{
|
||||||
|
struct svcxprt_rdma *rdma =
|
||||||
|
container_of(xprt, struct svcxprt_rdma, sc_xprt);
|
||||||
|
|
||||||
|
dprintk("svcrdma: %s(%p)\n", __func__, xprt);
|
||||||
|
if (xprt)
|
||||||
|
kfree(rdma);
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_SUNRPC_BACKCHANNEL */
|
||||||
|
|
||||||
struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
|
struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt)
|
||||||
{
|
{
|
||||||
struct svc_rdma_op_ctxt *ctxt;
|
struct svc_rdma_op_ctxt *ctxt;
|
||||||
|
Loading…
Reference in New Issue
Block a user