aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/debug.h1
-rw-r--r--include/linux/sunrpc/svcsock.h4
-rw-r--r--net/sunrpc/sunrpc_syms.c4
-rw-r--r--net/sunrpc/svcsock.c32
4 files changed, 38 insertions, 3 deletions
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
index 092fcfa9ceb9..10709cbe96fd 100644
--- a/include/linux/sunrpc/debug.h
+++ b/include/linux/sunrpc/debug.h
@@ -20,7 +20,6 @@
20#define RPCDBG_BIND 0x0020 20#define RPCDBG_BIND 0x0020
21#define RPCDBG_SCHED 0x0040 21#define RPCDBG_SCHED 0x0040
22#define RPCDBG_TRANS 0x0080 22#define RPCDBG_TRANS 0x0080
23#define RPCDBG_SVCSOCK 0x0100
24#define RPCDBG_SVCXPRT 0x0100 23#define RPCDBG_SVCXPRT 0x0100
25#define RPCDBG_SVCDSP 0x0200 24#define RPCDBG_SVCDSP 0x0200
26#define RPCDBG_MISC 0x0400 25#define RPCDBG_MISC 0x0400
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index a53e0fa855d2..1878cbe1aa4f 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -10,11 +10,13 @@
10#define SUNRPC_SVCSOCK_H 10#define SUNRPC_SVCSOCK_H
11 11
12#include <linux/sunrpc/svc.h> 12#include <linux/sunrpc/svc.h>
13#include <linux/sunrpc/svc_xprt.h>
13 14
14/* 15/*
15 * RPC server socket. 16 * RPC server socket.
16 */ 17 */
17struct svc_sock { 18struct svc_sock {
19 struct svc_xprt sk_xprt;
18 struct list_head sk_ready; /* list of ready sockets */ 20 struct list_head sk_ready; /* list of ready sockets */
19 struct list_head sk_list; /* list of all sockets */ 21 struct list_head sk_list; /* list of all sockets */
20 struct socket * sk_sock; /* berkeley socket layer */ 22 struct socket * sk_sock; /* berkeley socket layer */
@@ -78,6 +80,8 @@ int svc_addsock(struct svc_serv *serv,
78 int fd, 80 int fd,
79 char *name_return, 81 char *name_return,
80 int *proto); 82 int *proto);
83void svc_init_xprt_sock(void);
84void svc_cleanup_xprt_sock(void);
81 85
82/* 86/*
83 * svc_makesock socket characteristics 87 * svc_makesock socket characteristics
diff --git a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
index ef7dc78e2c7b..11b309817b8f 100644
--- a/net/sunrpc/sunrpc_syms.c
+++ b/net/sunrpc/sunrpc_syms.c
@@ -85,7 +85,8 @@ init_sunrpc(void)
85#endif 85#endif
86 cache_register(&ip_map_cache); 86 cache_register(&ip_map_cache);
87 cache_register(&unix_gid_cache); 87 cache_register(&unix_gid_cache);
88 init_socket_xprt(); 88 svc_init_xprt_sock(); /* svc sock transport */
89 init_socket_xprt(); /* clnt sock transport */
89 rpcauth_init_module(); 90 rpcauth_init_module();
90out: 91out:
91 return err; 92 return err;
@@ -96,6 +97,7 @@ cleanup_sunrpc(void)
96{ 97{
97 rpcauth_remove_module(); 98 rpcauth_remove_module();
98 cleanup_socket_xprt(); 99 cleanup_socket_xprt();
100 svc_cleanup_xprt_sock();
99 unregister_rpc_pipefs(); 101 unregister_rpc_pipefs();
100 rpc_destroy_mempool(); 102 rpc_destroy_mempool();
101 cache_unregister(&ip_map_cache); 103 cache_unregister(&ip_map_cache);
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index c75bffeb89eb..54f1b3d993a6 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -75,7 +75,7 @@
75 * 75 *
76 */ 76 */
77 77
78#define RPCDBG_FACILITY RPCDBG_SVCSOCK 78#define RPCDBG_FACILITY RPCDBG_SVCXPRT
79 79
80 80
81static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *, 81static struct svc_sock *svc_setup_socket(struct svc_serv *, struct socket *,
@@ -900,12 +900,21 @@ svc_udp_sendto(struct svc_rqst *rqstp)
900 return error; 900 return error;
901} 901}
902 902
903static struct svc_xprt_ops svc_udp_ops = {
904};
905
906static struct svc_xprt_class svc_udp_class = {
907 .xcl_name = "udp",
908 .xcl_ops = &svc_udp_ops,
909};
910
903static void 911static void
904svc_udp_init(struct svc_sock *svsk) 912svc_udp_init(struct svc_sock *svsk)
905{ 913{
906 int one = 1; 914 int one = 1;
907 mm_segment_t oldfs; 915 mm_segment_t oldfs;
908 916
917 svc_xprt_init(&svc_udp_class, &svsk->sk_xprt);
909 svsk->sk_sk->sk_data_ready = svc_udp_data_ready; 918 svsk->sk_sk->sk_data_ready = svc_udp_data_ready;
910 svsk->sk_sk->sk_write_space = svc_write_space; 919 svsk->sk_sk->sk_write_space = svc_write_space;
911 svsk->sk_recvfrom = svc_udp_recvfrom; 920 svsk->sk_recvfrom = svc_udp_recvfrom;
@@ -1344,12 +1353,33 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
1344 return sent; 1353 return sent;
1345} 1354}
1346 1355
1356static struct svc_xprt_ops svc_tcp_ops = {
1357};
1358
1359static struct svc_xprt_class svc_tcp_class = {
1360 .xcl_name = "tcp",
1361 .xcl_ops = &svc_tcp_ops,
1362};
1363
1364void svc_init_xprt_sock(void)
1365{
1366 svc_reg_xprt_class(&svc_tcp_class);
1367 svc_reg_xprt_class(&svc_udp_class);
1368}
1369
1370void svc_cleanup_xprt_sock(void)
1371{
1372 svc_unreg_xprt_class(&svc_tcp_class);
1373 svc_unreg_xprt_class(&svc_udp_class);
1374}
1375
1347static void 1376static void
1348svc_tcp_init(struct svc_sock *svsk) 1377svc_tcp_init(struct svc_sock *svsk)
1349{ 1378{
1350 struct sock *sk = svsk->sk_sk; 1379 struct sock *sk = svsk->sk_sk;
1351 struct tcp_sock *tp = tcp_sk(sk); 1380 struct tcp_sock *tp = tcp_sk(sk);
1352 1381
1382 svc_xprt_init(&svc_tcp_class, &svsk->sk_xprt);
1353 svsk->sk_recvfrom = svc_tcp_recvfrom; 1383 svsk->sk_recvfrom = svc_tcp_recvfrom;
1354 svsk->sk_sendto = svc_tcp_sendto; 1384 svsk->sk_sendto = svc_tcp_sendto;
1355 1385