Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rpcrdma: Merge svcrdma and xprtrdma modules into one

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 2e8c12e1b765 ("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>

authored by

Chuck Lever and committed by
J. Bruce Fields
ffe1f0df 0380a3f3

+69 -48
+8 -20
net/sunrpc/Kconfig
··· 48 48 49 49 If unsure, say Y. 50 50 51 - config SUNRPC_XPRT_RDMA_CLIENT 52 - tristate "RPC over RDMA Client Support" 51 + config SUNRPC_XPRT_RDMA 52 + tristate "RPC-over-RDMA transport" 53 53 depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS 54 54 default SUNRPC && INFINIBAND 55 55 help 56 - This option allows the NFS client to support an RDMA-enabled 57 - transport. 56 + This option allows the NFS client and server to use RDMA 57 + transports (InfiniBand, iWARP, or RoCE). 58 58 59 - To compile RPC client RDMA transport support as a module, 60 - choose M here: the module will be called xprtrdma. 59 + To compile this support as a module, choose M. The module 60 + will be called rpcrdma.ko. 61 61 62 - If unsure, say N. 63 - 64 - config SUNRPC_XPRT_RDMA_SERVER 65 - tristate "RPC over RDMA Server Support" 66 - depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS 67 - default SUNRPC && INFINIBAND 68 - help 69 - This option allows the NFS server to support an RDMA-enabled 70 - transport. 71 - 72 - To compile RPC server RDMA transport support as a module, 73 - choose M here: the module will be called svcrdma. 74 - 75 - If unsure, say N. 62 + If unsure, or you know there is no RDMA capability on your 63 + hardware platform, say N.
+1 -2
net/sunrpc/Makefile
··· 5 5 6 6 obj-$(CONFIG_SUNRPC) += sunrpc.o 7 7 obj-$(CONFIG_SUNRPC_GSS) += auth_gss/ 8 - 9 - obj-y += xprtrdma/ 8 + obj-$(CONFIG_SUNRPC_XPRT_RDMA) += xprtrdma/ 10 9 11 10 sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \ 12 11 auth.o auth_null.o auth_unix.o auth_generic.o \
+6 -8
net/sunrpc/xprtrdma/Makefile
··· 1 - obj-$(CONFIG_SUNRPC_XPRT_RDMA_CLIENT) += xprtrdma.o 1 + obj-$(CONFIG_SUNRPC_XPRT_RDMA) += rpcrdma.o 2 2 3 - xprtrdma-y := transport.o rpc_rdma.o verbs.o \ 4 - fmr_ops.o frwr_ops.o physical_ops.o 5 - 6 - obj-$(CONFIG_SUNRPC_XPRT_RDMA_SERVER) += svcrdma.o 7 - 8 - svcrdma-y := svc_rdma.o svc_rdma_transport.o \ 9 - svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o 3 + rpcrdma-y := transport.o rpc_rdma.o verbs.o \ 4 + fmr_ops.o frwr_ops.o physical_ops.o \ 5 + svc_rdma.o svc_rdma_transport.o \ 6 + svc_rdma_marshal.o svc_rdma_sendto.o svc_rdma_recvfrom.o \ 7 + module.o
+46
net/sunrpc/xprtrdma/module.c
··· 1 + /* 2 + * Copyright (c) 2015 Oracle. All rights reserved. 3 + */ 4 + 5 + /* rpcrdma.ko module initialization 6 + */ 7 + 8 + #include <linux/module.h> 9 + #include <linux/init.h> 10 + #include <linux/sunrpc/svc_rdma.h> 11 + #include "xprt_rdma.h" 12 + 13 + #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 14 + # define RPCDBG_FACILITY RPCDBG_TRANS 15 + #endif 16 + 17 + MODULE_AUTHOR("Open Grid Computing and Network Appliance, Inc."); 18 + MODULE_DESCRIPTION("RPC/RDMA Transport"); 19 + MODULE_LICENSE("Dual BSD/GPL"); 20 + MODULE_ALIAS("svcrdma"); 21 + MODULE_ALIAS("xprtrdma"); 22 + 23 + static void __exit rpc_rdma_cleanup(void) 24 + { 25 + xprt_rdma_cleanup(); 26 + svc_rdma_cleanup(); 27 + } 28 + 29 + static int __init rpc_rdma_init(void) 30 + { 31 + int rc; 32 + 33 + rc = svc_rdma_init(); 34 + if (rc) 35 + goto out; 36 + 37 + rc = xprt_rdma_init(); 38 + if (rc) 39 + svc_rdma_cleanup(); 40 + 41 + out: 42 + return rc; 43 + } 44 + 45 + module_init(rpc_rdma_init); 46 + module_exit(rpc_rdma_cleanup);
+1 -7
net/sunrpc/xprtrdma/svc_rdma.c
··· 38 38 * 39 39 * Author: Tom Tucker <tom@opengridcomputing.com> 40 40 */ 41 - #include <linux/module.h> 42 - #include <linux/init.h> 41 + 43 42 #include <linux/slab.h> 44 43 #include <linux/fs.h> 45 44 #include <linux/sysctl.h> ··· 294 295 destroy_workqueue(svc_rdma_wq); 295 296 return -ENOMEM; 296 297 } 297 - MODULE_AUTHOR("Tom Tucker <tom@opengridcomputing.com>"); 298 - MODULE_DESCRIPTION("SVC RDMA Transport"); 299 - MODULE_LICENSE("Dual BSD/GPL"); 300 - module_init(svc_rdma_init); 301 - module_exit(svc_rdma_cleanup);
+2 -11
net/sunrpc/xprtrdma/transport.c
··· 48 48 */ 49 49 50 50 #include <linux/module.h> 51 - #include <linux/init.h> 52 51 #include <linux/slab.h> 53 52 #include <linux/seq_file.h> 54 53 #include <linux/sunrpc/addr.h> ··· 57 58 #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) 58 59 # define RPCDBG_FACILITY RPCDBG_TRANS 59 60 #endif 60 - 61 - MODULE_LICENSE("Dual BSD/GPL"); 62 - 63 - MODULE_DESCRIPTION("RPC/RDMA Transport for Linux kernel NFS"); 64 - MODULE_AUTHOR("Network Appliance, Inc."); 65 61 66 62 /* 67 63 * tunables ··· 705 711 .setup = xprt_setup_rdma, 706 712 }; 707 713 708 - static void __exit xprt_rdma_cleanup(void) 714 + void xprt_rdma_cleanup(void) 709 715 { 710 716 int rc; 711 717 ··· 722 728 __func__, rc); 723 729 } 724 730 725 - static int __init xprt_rdma_init(void) 731 + int xprt_rdma_init(void) 726 732 { 727 733 int rc; 728 734 ··· 747 753 #endif 748 754 return 0; 749 755 } 750 - 751 - module_init(xprt_rdma_init); 752 - module_exit(xprt_rdma_cleanup);
+5
net/sunrpc/xprtrdma/xprt_rdma.h
··· 480 480 */ 481 481 int rpcrdma_marshal_req(struct rpc_rqst *); 482 482 483 + /* RPC/RDMA module init - xprtrdma/transport.c 484 + */ 485 + int xprt_rdma_init(void); 486 + void xprt_rdma_cleanup(void); 487 + 483 488 /* Temporary NFS request map cache. Created in svc_rdma.c */ 484 489 extern struct kmem_cache *svc_rdma_map_cachep; 485 490 /* WR context cache. Created in svc_rdma.c */