diff options
author | Chuck Lever <cel@netapp.com> | 2005-08-25 19:25:56 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-09-23 12:38:55 -0400 |
commit | 470056c288334eb0b37be26c9ff8aee37ed1cc7a (patch) | |
tree | 8c76a17c31c5dadbd4438a11d64364cdbe164c40 /net | |
parent | 03bf4b707eee06706c9db343dd5c905b7ee47ed2 (diff) |
[PATCH] RPC: rationalize set_buffer_size
In fact, ->set_buffer_size should be completely functionless for non-UDP.
Test-plan:
Check socket buffer size on UDP sockets over time.
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/clnt.c | 10 | ||||
-rw-r--r-- | net/sunrpc/xprtsock.c | 30 |
2 files changed, 17 insertions, 23 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 24b44e73f391..5a8f01d726e9 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -517,14 +517,8 @@ void | |||
517 | rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) | 517 | rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize) |
518 | { | 518 | { |
519 | struct rpc_xprt *xprt = clnt->cl_xprt; | 519 | struct rpc_xprt *xprt = clnt->cl_xprt; |
520 | 520 | if (xprt->ops->set_buffer_size) | |
521 | xprt->sndsize = 0; | 521 | xprt->ops->set_buffer_size(xprt, sndsize, rcvsize); |
522 | if (sndsize) | ||
523 | xprt->sndsize = sndsize + RPC_SLACK_SPACE; | ||
524 | xprt->rcvsize = 0; | ||
525 | if (rcvsize) | ||
526 | xprt->rcvsize = rcvsize + RPC_SLACK_SPACE; | ||
527 | xprt->ops->set_buffer_size(xprt); | ||
528 | } | 522 | } |
529 | 523 | ||
530 | /* | 524 | /* |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index 06c2d95484e0..2e1529217e65 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -865,15 +865,7 @@ static void xs_tcp_write_space(struct sock *sk) | |||
865 | read_unlock(&sk->sk_callback_lock); | 865 | read_unlock(&sk->sk_callback_lock); |
866 | } | 866 | } |
867 | 867 | ||
868 | /** | 868 | static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt) |
869 | * xs_udp_set_buffer_size - set send and receive limits | ||
870 | * @xprt: generic transport | ||
871 | * | ||
872 | * Set socket send and receive limits based on the | ||
873 | * sndsize and rcvsize fields in the generic transport | ||
874 | * structure. | ||
875 | */ | ||
876 | static void xs_udp_set_buffer_size(struct rpc_xprt *xprt) | ||
877 | { | 869 | { |
878 | struct sock *sk = xprt->inet; | 870 | struct sock *sk = xprt->inet; |
879 | 871 | ||
@@ -889,14 +881,23 @@ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt) | |||
889 | } | 881 | } |
890 | 882 | ||
891 | /** | 883 | /** |
892 | * xs_tcp_set_buffer_size - set send and receive limits | 884 | * xs_udp_set_buffer_size - set send and receive limits |
893 | * @xprt: generic transport | 885 | * @xprt: generic transport |
886 | * @sndsize: requested size of send buffer, in bytes | ||
887 | * @rcvsize: requested size of receive buffer, in bytes | ||
894 | * | 888 | * |
895 | * Nothing to do for TCP. | 889 | * Set socket send and receive buffer size limits. |
896 | */ | 890 | */ |
897 | static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt) | 891 | static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize) |
898 | { | 892 | { |
899 | return; | 893 | xprt->sndsize = 0; |
894 | if (sndsize) | ||
895 | xprt->sndsize = sndsize + 1024; | ||
896 | xprt->rcvsize = 0; | ||
897 | if (rcvsize) | ||
898 | xprt->rcvsize = rcvsize + 1024; | ||
899 | |||
900 | xs_udp_do_set_buffer_size(xprt); | ||
900 | } | 901 | } |
901 | 902 | ||
902 | /** | 903 | /** |
@@ -989,7 +990,7 @@ static void xs_udp_connect_worker(void *args) | |||
989 | 990 | ||
990 | write_unlock_bh(&sk->sk_callback_lock); | 991 | write_unlock_bh(&sk->sk_callback_lock); |
991 | } | 992 | } |
992 | xs_udp_set_buffer_size(xprt); | 993 | xs_udp_do_set_buffer_size(xprt); |
993 | status = 0; | 994 | status = 0; |
994 | out: | 995 | out: |
995 | xprt_wake_pending_tasks(xprt, status); | 996 | xprt_wake_pending_tasks(xprt, status); |
@@ -1158,7 +1159,6 @@ static struct rpc_xprt_ops xs_udp_ops = { | |||
1158 | }; | 1159 | }; |
1159 | 1160 | ||
1160 | static struct rpc_xprt_ops xs_tcp_ops = { | 1161 | static struct rpc_xprt_ops xs_tcp_ops = { |
1161 | .set_buffer_size = xs_tcp_set_buffer_size, | ||
1162 | .reserve_xprt = xprt_reserve_xprt, | 1162 | .reserve_xprt = xprt_reserve_xprt, |
1163 | .release_xprt = xprt_release_xprt, | 1163 | .release_xprt = xprt_release_xprt, |
1164 | .connect = xs_connect, | 1164 | .connect = xs_connect, |