aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2005-08-25 19:25:49 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-09-23 12:38:35 -0400
commit43118c29dea2b23798bd42a147015cceee7fa885 (patch)
tree4951a6777a3dc167d46c1373c02d21912b250e96 /net/sunrpc
parent808012fbb23a52ec59352445d2076d175ad4ab26 (diff)
[PATCH] RPC: get rid of xprt->stream
Now we can fix up the last few places that use the "xprt->stream" variable, and get rid of it from the rpc_xprt structure. Test-plan: Destructive testing (unplugging the network temporarily). Connectathon with UDP and TCP. Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/xprt.c3
-rw-r--r--net/sunrpc/xprtsock.c28
2 files changed, 19 insertions, 12 deletions
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 31ef7dc7eed6..43fef7626442 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -630,8 +630,7 @@ void xprt_transmit(struct rpc_task *task)
630 case -ENOTCONN: 630 case -ENOTCONN:
631 return; 631 return;
632 default: 632 default:
633 if (xprt->stream) 633 break;
634 xprt_disconnect(xprt);
635 } 634 }
636 xprt_release_write(xprt, task); 635 xprt_release_write(xprt, task);
637 return; 636 return;
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index aaf053b1a0c4..5bb6fed3df34 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -356,6 +356,7 @@ static int xs_tcp_send_request(struct rpc_task *task)
356 default: 356 default:
357 dprintk("RPC: sendmsg returned unrecognized error %d\n", 357 dprintk("RPC: sendmsg returned unrecognized error %d\n",
358 -status); 358 -status);
359 xprt_disconnect(xprt);
359 break; 360 break;
360 } 361 }
361 362
@@ -826,19 +827,17 @@ static void xs_tcp_write_space(struct sock *sk)
826} 827}
827 828
828/** 829/**
829 * xs_set_buffer_size - set send and receive limits 830 * xs_udp_set_buffer_size - set send and receive limits
830 * @xprt: generic transport 831 * @xprt: generic transport
831 * 832 *
832 * Set socket send and receive limits based on the 833 * Set socket send and receive limits based on the
833 * sndsize and rcvsize fields in the generic transport 834 * sndsize and rcvsize fields in the generic transport
834 * structure. This applies only to UDP sockets. 835 * structure.
835 */ 836 */
836static void xs_set_buffer_size(struct rpc_xprt *xprt) 837static void xs_udp_set_buffer_size(struct rpc_xprt *xprt)
837{ 838{
838 struct sock *sk = xprt->inet; 839 struct sock *sk = xprt->inet;
839 840
840 if (xprt->stream)
841 return;
842 if (xprt->rcvsize) { 841 if (xprt->rcvsize) {
843 sk->sk_userlocks |= SOCK_RCVBUF_LOCK; 842 sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
844 sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2; 843 sk->sk_rcvbuf = xprt->rcvsize * xprt->max_reqs * 2;
@@ -850,6 +849,17 @@ static void xs_set_buffer_size(struct rpc_xprt *xprt)
850 } 849 }
851} 850}
852 851
852/**
853 * xs_tcp_set_buffer_size - set send and receive limits
854 * @xprt: generic transport
855 *
856 * Nothing to do for TCP.
857 */
858static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt)
859{
860 return;
861}
862
853static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock) 863static int xs_bindresvport(struct rpc_xprt *xprt, struct socket *sock)
854{ 864{
855 struct sockaddr_in myaddr = { 865 struct sockaddr_in myaddr = {
@@ -928,7 +938,7 @@ static void xs_udp_connect_worker(void *args)
928 938
929 write_unlock_bh(&sk->sk_callback_lock); 939 write_unlock_bh(&sk->sk_callback_lock);
930 } 940 }
931 xs_set_buffer_size(xprt); 941 xs_udp_set_buffer_size(xprt);
932 status = 0; 942 status = 0;
933out: 943out:
934 xprt_wake_pending_tasks(xprt, status); 944 xprt_wake_pending_tasks(xprt, status);
@@ -1034,7 +1044,7 @@ static void xs_connect(struct rpc_task *task)
1034} 1044}
1035 1045
1036static struct rpc_xprt_ops xs_udp_ops = { 1046static struct rpc_xprt_ops xs_udp_ops = {
1037 .set_buffer_size = xs_set_buffer_size, 1047 .set_buffer_size = xs_udp_set_buffer_size,
1038 .connect = xs_connect, 1048 .connect = xs_connect,
1039 .send_request = xs_udp_send_request, 1049 .send_request = xs_udp_send_request,
1040 .close = xs_close, 1050 .close = xs_close,
@@ -1042,7 +1052,7 @@ static struct rpc_xprt_ops xs_udp_ops = {
1042}; 1052};
1043 1053
1044static struct rpc_xprt_ops xs_tcp_ops = { 1054static struct rpc_xprt_ops xs_tcp_ops = {
1045 .set_buffer_size = xs_set_buffer_size, 1055 .set_buffer_size = xs_tcp_set_buffer_size,
1046 .connect = xs_connect, 1056 .connect = xs_connect,
1047 .send_request = xs_tcp_send_request, 1057 .send_request = xs_tcp_send_request,
1048 .close = xs_close, 1058 .close = xs_close,
@@ -1074,7 +1084,6 @@ int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1074 xprt->prot = IPPROTO_UDP; 1084 xprt->prot = IPPROTO_UDP;
1075 xprt->port = XS_MAX_RESVPORT; 1085 xprt->port = XS_MAX_RESVPORT;
1076 xprt->tsh_size = 0; 1086 xprt->tsh_size = 0;
1077 xprt->stream = 0;
1078 xprt->nocong = 0; 1087 xprt->nocong = 0;
1079 xprt->cwnd = RPC_INITCWND; 1088 xprt->cwnd = RPC_INITCWND;
1080 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; 1089 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;
@@ -1115,7 +1124,6 @@ int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to)
1115 xprt->prot = IPPROTO_TCP; 1124 xprt->prot = IPPROTO_TCP;
1116 xprt->port = XS_MAX_RESVPORT; 1125 xprt->port = XS_MAX_RESVPORT;
1117 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32); 1126 xprt->tsh_size = sizeof(rpc_fraghdr) / sizeof(u32);
1118 xprt->stream = 1;
1119 xprt->nocong = 1; 1127 xprt->nocong = 1;
1120 xprt->cwnd = RPC_MAXCWND(xprt); 1128 xprt->cwnd = RPC_MAXCWND(xprt);
1121 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0; 1129 xprt->resvport = capable(CAP_NET_BIND_SERVICE) ? 1 : 0;