diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2015-10-24 17:28:16 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2015-11-02 13:45:15 -0500 |
commit | 9468431962616c2449d47c482208a5967e011bf9 (patch) | |
tree | 8ec72d681d0575349426be5ca0c14cd52017c1f6 /net/sunrpc | |
parent | 63cae47005af51c937f4cdcc4835f29075add2ba (diff) |
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>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma.c | 6 | ||||
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma_transport.c | 58 |
2 files changed, 64 insertions, 0 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c index 2cd252f023a5..1b7051bdbdc8 100644 --- a/net/sunrpc/xprtrdma/svc_rdma.c +++ b/net/sunrpc/xprtrdma/svc_rdma.c | |||
@@ -239,6 +239,9 @@ void svc_rdma_cleanup(void) | |||
239 | unregister_sysctl_table(svcrdma_table_header); | 239 | unregister_sysctl_table(svcrdma_table_header); |
240 | svcrdma_table_header = NULL; | 240 | svcrdma_table_header = NULL; |
241 | } | 241 | } |
242 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) | ||
243 | svc_unreg_xprt_class(&svc_rdma_bc_class); | ||
244 | #endif | ||
242 | svc_unreg_xprt_class(&svc_rdma_class); | 245 | svc_unreg_xprt_class(&svc_rdma_class); |
243 | kmem_cache_destroy(svc_rdma_map_cachep); | 246 | kmem_cache_destroy(svc_rdma_map_cachep); |
244 | kmem_cache_destroy(svc_rdma_ctxt_cachep); | 247 | kmem_cache_destroy(svc_rdma_ctxt_cachep); |
@@ -286,6 +289,9 @@ int svc_rdma_init(void) | |||
286 | 289 | ||
287 | /* Register RDMA with the SVC transport switch */ | 290 | /* Register RDMA with the SVC transport switch */ |
288 | svc_reg_xprt_class(&svc_rdma_class); | 291 | svc_reg_xprt_class(&svc_rdma_class); |
292 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) | ||
293 | svc_reg_xprt_class(&svc_rdma_bc_class); | ||
294 | #endif | ||
289 | return 0; | 295 | return 0; |
290 | err1: | 296 | err1: |
291 | kmem_cache_destroy(svc_rdma_map_cachep); | 297 | kmem_cache_destroy(svc_rdma_map_cachep); |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index fcc3eb80c265..a133b1e5b5f6 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -56,6 +56,7 @@ | |||
56 | 56 | ||
57 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT | 57 | #define RPCDBG_FACILITY RPCDBG_SVCXPRT |
58 | 58 | ||
59 | static struct svcxprt_rdma *rdma_create_xprt(struct svc_serv *, int); | ||
59 | static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, | 60 | static struct svc_xprt *svc_rdma_create(struct svc_serv *serv, |
60 | struct net *net, | 61 | struct net *net, |
61 | struct sockaddr *sa, int salen, | 62 | struct sockaddr *sa, int salen, |
@@ -95,6 +96,63 @@ struct svc_xprt_class svc_rdma_class = { | |||
95 | .xcl_ident = XPRT_TRANSPORT_RDMA, | 96 | .xcl_ident = XPRT_TRANSPORT_RDMA, |
96 | }; | 97 | }; |
97 | 98 | ||
99 | #if defined(CONFIG_SUNRPC_BACKCHANNEL) | ||
100 | static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *, struct net *, | ||
101 | struct sockaddr *, int, int); | ||
102 | static void svc_rdma_bc_detach(struct svc_xprt *); | ||
103 | static void svc_rdma_bc_free(struct svc_xprt *); | ||
104 | |||
105 | static struct svc_xprt_ops svc_rdma_bc_ops = { | ||
106 | .xpo_create = svc_rdma_bc_create, | ||
107 | .xpo_detach = svc_rdma_bc_detach, | ||
108 | .xpo_free = svc_rdma_bc_free, | ||
109 | .xpo_prep_reply_hdr = svc_rdma_prep_reply_hdr, | ||
110 | .xpo_secure_port = svc_rdma_secure_port, | ||
111 | }; | ||
112 | |||
113 | struct svc_xprt_class svc_rdma_bc_class = { | ||
114 | .xcl_name = "rdma-bc", | ||
115 | .xcl_owner = THIS_MODULE, | ||
116 | .xcl_ops = &svc_rdma_bc_ops, | ||
117 | .xcl_max_payload = (1024 - RPCRDMA_HDRLEN_MIN) | ||
118 | }; | ||
119 | |||
120 | static struct svc_xprt *svc_rdma_bc_create(struct svc_serv *serv, | ||
121 | struct net *net, | ||
122 | struct sockaddr *sa, int salen, | ||
123 | int flags) | ||
124 | { | ||
125 | struct svcxprt_rdma *cma_xprt; | ||
126 | struct svc_xprt *xprt; | ||
127 | |||
128 | cma_xprt = rdma_create_xprt(serv, 0); | ||
129 | if (!cma_xprt) | ||
130 | return ERR_PTR(-ENOMEM); | ||
131 | xprt = &cma_xprt->sc_xprt; | ||
132 | |||
133 | svc_xprt_init(net, &svc_rdma_bc_class, xprt, serv); | ||
134 | serv->sv_bc_xprt = xprt; | ||
135 | |||
136 | dprintk("svcrdma: %s(%p)\n", __func__, xprt); | ||
137 | return xprt; | ||
138 | } | ||
139 | |||
140 | static void svc_rdma_bc_detach(struct svc_xprt *xprt) | ||
141 | { | ||
142 | dprintk("svcrdma: %s(%p)\n", __func__, xprt); | ||
143 | } | ||
144 | |||
145 | static void svc_rdma_bc_free(struct svc_xprt *xprt) | ||
146 | { | ||
147 | struct svcxprt_rdma *rdma = | ||
148 | container_of(xprt, struct svcxprt_rdma, sc_xprt); | ||
149 | |||
150 | dprintk("svcrdma: %s(%p)\n", __func__, xprt); | ||
151 | if (xprt) | ||
152 | kfree(rdma); | ||
153 | } | ||
154 | #endif /* CONFIG_SUNRPC_BACKCHANNEL */ | ||
155 | |||
98 | struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt) | 156 | struct svc_rdma_op_ctxt *svc_rdma_get_context(struct svcxprt_rdma *xprt) |
99 | { | 157 | { |
100 | struct svc_rdma_op_ctxt *ctxt; | 158 | struct svc_rdma_op_ctxt *ctxt; |