aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2005-08-25 16:25:56 -0700
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-09-23 12:38:55 -0400
commit470056c288334eb0b37be26c9ff8aee37ed1cc7a (patch)
tree8c76a17c31c5dadbd4438a11d64364cdbe164c40
parent03bf4b707eee06706c9db343dd5c905b7ee47ed2 (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>
-rw-r--r--include/linux/sunrpc/xprt.h4
-rw-r--r--net/sunrpc/clnt.c10
-rw-r--r--net/sunrpc/xprtsock.c30
3 files changed, 19 insertions, 25 deletions
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index 2543adf1855..99cad3ead81 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -100,7 +100,7 @@ struct rpc_rqst {
#define rq_slen rq_snd_buf.len
struct rpc_xprt_ops {
- void (*set_buffer_size)(struct rpc_xprt *xprt);
+ void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize);
int (*reserve_xprt)(struct rpc_task *task);
void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task);
void (*connect)(struct rpc_task *task);
@@ -124,7 +124,7 @@ struct rpc_xprt {
unsigned long cong; /* current congestion */
unsigned long cwnd; /* congestion window */
- unsigned int rcvsize, /* transport rcv buffer size */
+ size_t rcvsize, /* transport rcv buffer size */
sndsize; /* transport send buffer size */
size_t max_payload; /* largest RPC payload size,
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 24b44e73f39..5a8f01d726e 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -517,14 +517,8 @@ void
rpc_setbufsize(struct rpc_clnt *clnt, unsigned int sndsize, unsigned int rcvsize)
{
struct rpc_xprt *xprt = clnt->cl_xprt;
-
- xprt->sndsize = 0;
- if (sndsize)
- xprt->sndsize = sndsize + RPC_SLACK_SPACE;
- xprt->rcvsize = 0;
- if (rcvsize)
- xprt->rcvsize = rcvsize + RPC_SLACK_SPACE;
- xprt->ops->set_buffer_size(xprt);
+ if (xprt->ops->set_buffer_size)
+ xprt->ops->set_buffer_size(xprt, sndsize, rcvsize);
}
/*
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 06c2d95484e..2e1529217e6 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -865,15 +865,7 @@ static void xs_tcp_write_space(struct sock *sk)
read_unlock(&sk->sk_callback_lock);
}
-/**
- * xs_udp_set_buffer_size - set send and receive limits
- * @xprt: generic transport
- *
- * Set socket send and receive limits based on the
- * sndsize and rcvsize fields in the generic transport
- * structure.
- */
-static void xs_udp_set_buffer_size(struct rpc_xprt *xprt)
+static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt)
{
struct sock *sk = xprt->inet;
@@ -889,14 +881,23 @@ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt)
}
/**
- * xs_tcp_set_buffer_size - set send and receive limits
+ * xs_udp_set_buffer_size - set send and receive limits
* @xprt: generic transport
+ * @sndsize: requested size of send buffer, in bytes
+ * @rcvsize: requested size of receive buffer, in bytes
*
- * Nothing to do for TCP.
+ * Set socket send and receive buffer size limits.
*/
-static void xs_tcp_set_buffer_size(struct rpc_xprt *xprt)
+static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize)
{
- return;
+ xprt->sndsize = 0;
+ if (sndsize)
+ xprt->sndsize = sndsize + 1024;
+ xprt->rcvsize = 0;
+ if (rcvsize)
+ xprt->rcvsize = rcvsize + 1024;
+
+ xs_udp_do_set_buffer_size(xprt);
}
/**
@@ -989,7 +990,7 @@ static void xs_udp_connect_worker(void *args)
write_unlock_bh(&sk->sk_callback_lock);
}
- xs_udp_set_buffer_size(xprt);
+ xs_udp_do_set_buffer_size(xprt);
status = 0;
out:
xprt_wake_pending_tasks(xprt, status);
@@ -1158,7 +1159,6 @@ static struct rpc_xprt_ops xs_udp_ops = {
};
static struct rpc_xprt_ops xs_tcp_ops = {
- .set_buffer_size = xs_tcp_set_buffer_size,
.reserve_xprt = xprt_reserve_xprt,
.release_xprt = xprt_release_xprt,
.connect = xs_connect,