aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/xprt.h3
-rw-r--r--net/sunrpc/xprtsock.c24
2 files changed, 16 insertions, 11 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 18bf72c06488..21beb56fb84c 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -137,9 +137,6 @@ struct rpc_xprt {
137 unsigned long cong; /* current congestion */ 137 unsigned long cong; /* current congestion */
138 unsigned long cwnd; /* congestion window */ 138 unsigned long cwnd; /* congestion window */
139 139
140 size_t rcvsize, /* transport rcv buffer size */
141 sndsize; /* transport send buffer size */
142
143 size_t max_payload; /* largest RPC payload size, 140 size_t max_payload; /* largest RPC payload size,
144 in bytes */ 141 in bytes */
145 unsigned int tsh_size; /* size of transport specific 142 unsigned int tsh_size; /* size of transport specific
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 4797a4608c07..b804381d5bee 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -151,6 +151,12 @@ struct sock_xprt {
151 */ 151 */
152 struct work_struct connect_worker; 152 struct work_struct connect_worker;
153 unsigned short port; 153 unsigned short port;
154
155 /*
156 * UDP socket buffer size parameters
157 */
158 size_t rcvsize,
159 sndsize;
154}; 160};
155 161
156/* 162/*
@@ -996,13 +1002,13 @@ static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt)
996 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); 1002 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
997 struct sock *sk = transport->inet; 1003 struct sock *sk = transport->inet;
998 1004
999 if (xprt->rcvsize) { 1005 if (transport->rcvsize) {
1000 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 1006 sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
1001 sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; 1007 sk->sk_rcvbuf = transport->rcvsize * xprt->max_reqs * 2;
1002 } 1008 }
1003 if (xprt->sndsize) { 1009 if (transport->sndsize) {
1004 sk->sk_userlocks |= SOCK_SNDBUF_LOCK; 1010 sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
1005 sk->sk_sndbuf = xprt->sndsize * xprt->max_reqs * 2; 1011 sk->sk_sndbuf = transport->sndsize * xprt->max_reqs * 2;
1006 sk->sk_write_space(sk); 1012 sk->sk_write_space(sk);
1007 } 1013 }
1008} 1014}
@@ -1017,12 +1023,14 @@ static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt)
1017 */ 1023 */
1018static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize) 1024static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize)
1019{ 1025{
1020 xprt->sndsize = 0; 1026 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt);
1027
1028 transport->sndsize = 0;
1021 if (sndsize) 1029 if (sndsize)
1022 xprt->sndsize = sndsize + 1024; 1030 transport->sndsize = sndsize + 1024;
1023 xprt->rcvsize = 0; 1031 transport->rcvsize = 0;
1024 if (rcvsize) 1032 if (rcvsize)
1025 xprt->rcvsize = rcvsize + 1024; 1033 transport->rcvsize = rcvsize + 1024;
1026 1034
1027 xs_udp_do_set_buffer_size(xprt); 1035 xs_udp_do_set_buffer_size(xprt);
1028} 1036}