Skip to content

Commit

Permalink
rpcrdma: Merge svcrdma and xprtrdma modules into one
Browse files Browse the repository at this point in the history
Bi-directional RPC support means code in svcrdma.ko invokes a bit of
code in xprtrdma.ko, and vice versa. To avoid loader/linker loops,
merge the server and client side modules together into a single
module.

When backchannel capabilities are added, the combined module will
register all needed transport capabilities so that Upper Layer
consumers automatically have everything needed to create a
bi-directional transport connection.

Module aliases are added for backwards compatibility with user
space, which still may expect svcrdma.ko or xprtrdma.ko to be
present.

This commit reverts commit 2e8c12e ("xprtrdma: add separate
Kconfig options for NFSoRDMA client and server support") and
provides a single CONFIG option for enabling the new module.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Jun 4, 2015
1 parent 0380a3f commit ffe1f0d
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 48 deletions.
28 changes: 8 additions & 20 deletions net/sunrpc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,28 +48,16 @@ config SUNRPC_DEBUG

If unsure, say Y.

config SUNRPC_XPRT_RDMA_CLIENT
tristate "RPC over RDMA Client Support"
config SUNRPC_XPRT_RDMA
tristate "RPC-over-RDMA transport"
depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
default SUNRPC && INFINIBAND
help
This option allows the NFS client to support an RDMA-enabled
transport.
This option allows the NFS client and server to use RDMA
transports (InfiniBand, iWARP, or RoCE).

To compile RPC client RDMA transport support as a module,
choose M here: the module will be called xprtrdma.
To compile this support as a module, choose M. The module
will be called rpcrdma.ko.

If unsure, say N.

config SUNRPC_XPRT_RDMA_SERVER
tristate "RPC over RDMA Server Support"
depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS
default SUNRPC && INFINIBAND
help
This option allows the NFS server to support an RDMA-enabled
transport.

To compile RPC server RDMA transport support as a module,
choose M here: the module will be called svcrdma.

If unsure, say N.
If unsure, or you know there is no RDMA capability on your
hardware platform, say N.
3 changes: 1 addition & 2 deletions net/sunrpc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

obj-$(CONFIG_SUNRPC) += sunrpc.o
obj-$(CONFIG_SUNRPC_GSS) += auth_gss/

obj-y += xprtrdma/
obj-$(CONFIG_SUNRPC_XPRT_RDMA) += xprtrdma/

sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
auth.o auth_null.o auth_unix.o auth_generic.o \
Expand Down
14 changes: 6 additions & 8 deletions net/sunrpc/xprtrdma/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
obj-$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) += xprtrdma.o
obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o

xprtrdma-y := transport.o rpc_rdma.o verbs.o \
fmr_ops.o frwr_ops.o physical_ops.o

obj-$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) += svcrdma.o

svcrdma-y := svc_rdma.o svc_rdma_transport.o \
svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o
rpcrdma-y := transport.o rpc_rdma.o verbs.o \
fmr_ops.o frwr_ops.o physical_ops.o \
svc_rdma.o svc_rdma_transport.o \
svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o \
module.o
46 changes: 46 additions & 0 deletions net/sunrpc/xprtrdma/module.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2015 Oracle. All rights reserved.
*/

/* rpcrdma.ko module initialization
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/sunrpc/svc_rdma.h>
#include "xprt_rdma.h"

#if IS_ENABLED(CONFIG_SUNRPC_DEBUG)
# define RPCDBG_FACILITY RPCDBG_TRANS
#endif

MODULE_AUTHOR("Open Grid Computing and Network Appliance, Inc.");
MODULE_DESCRIPTION("RPC/RDMA Transport");
MODULE_LICENSE("Dual BSD/GPL");
MODULE_ALIAS("svcrdma");
MODULE_ALIAS("xprtrdma");

static void __exit rpc_rdma_cleanup(void)
{
xprt_rdma_cleanup();
svc_rdma_cleanup();
}

static int __init rpc_rdma_init(void)
{
int rc;

rc = svc_rdma_init();
if (rc)
goto out;

rc = xprt_rdma_init();
if (rc)
svc_rdma_cleanup();

out:
return rc;
}

module_init(rpc_rdma_init);
module_exit(rpc_rdma_cleanup);
8 changes: 1 addition & 7 deletions net/sunrpc/xprtrdma/svc_rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
*
* Author: Tom Tucker <tom@opengridcomputing.com>
*/
#include <linux/module.h>
#include <linux/init.h>

#include <linux/slab.h>
#include <linux/fs.h>
#include <linux/sysctl.h>
Expand Down Expand Up @@ -295,8 +294,3 @@ int svc_rdma_init(void)
destroy_workqueue(svc_rdma_wq);
return -ENOMEM;
}
MODULE_AUTHOR("Tom Tucker <tom@opengridcomputing.com>");
MODULE_DESCRIPTION("SVC RDMA Transport");
MODULE_LICENSE("Dual BSD/GPL");
module_init(svc_rdma_init);
module_exit(svc_rdma_cleanup);
13 changes: 2 additions & 11 deletions net/sunrpc/xprtrdma/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
*/

#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/seq_file.h>
#include <linux/sunrpc/addr.h>
Expand All @@ -59,11 +58,6 @@
# define RPCDBG_FACILITY RPCDBG_TRANS
#endif

MODULE_LICENSE("Dual BSD/GPL");

MODULE_DESCRIPTION("RPC/RDMA Transport for Linux kernel NFS");
MODULE_AUTHOR("Network Appliance, Inc.");

/*
* tunables
*/
Expand Down Expand Up @@ -711,7 +705,7 @@ static struct xprt_class xprt_rdma = {
.setup = xprt_setup_rdma,
};

static void __exit xprt_rdma_cleanup(void)
void xprt_rdma_cleanup(void)
{
int rc;

Expand All @@ -728,7 +722,7 @@ static void __exit xprt_rdma_cleanup(void)
__func__, rc);
}

static int __init xprt_rdma_init(void)
int xprt_rdma_init(void)
{
int rc;

Expand All @@ -753,6 +747,3 @@ static int __init xprt_rdma_init(void)
#endif
return 0;
}

module_init(xprt_rdma_init);
module_exit(xprt_rdma_cleanup);
5 changes: 5 additions & 0 deletions net/sunrpc/xprtrdma/xprt_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *);
*/
int rpcrdma_marshal_req(struct rpc_rqst *);

/* RPC/RDMA module init - xprtrdma/transport.c
*/
int xprt_rdma_init(void);
void xprt_rdma_cleanup(void);

/* Temporary NFS request map cache. Created in svc_rdma.c */
extern struct kmem_cache *svc_rdma_map_cachep;
/* WR context cache. Created in svc_rdma.c */
Expand Down

0 comments on commit ffe1f0d

Please sign in to comment.