[PATCH 04/38] svc: Add a max payload value to the transport

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <bfields@...>
Cc: <neilb@...>, <linux-nfs@...>
Date: Tuesday, December 11, 2007 - 7:32 pm

The svc_max_payload function currently looks at the socket type
to determine the max payload. Add a max payload value to svc_xprt_class
so it can be returned directly. 

Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
---

 include/linux/sunrpc/svc_xprt.h |    1 +
 net/sunrpc/svc.c                |    4 +---
 net/sunrpc/svcsock.c            |    2 ++
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
index a8b1da8..b4ce054 100644
--- a/include/linux/sunrpc/svc_xprt.h
+++ b/include/linux/sunrpc/svc_xprt.h
@@ -17,6 +17,7 @@ struct svc_xprt_class {
 	struct module		*xcl_owner;
 	struct svc_xprt_ops	*xcl_ops;
 	struct list_head	xcl_list;
+	u32			xcl_max_payload;
 };
 
 struct svc_xprt {
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index a4a6bf7..ea3fa86 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1054,10 +1054,8 @@ err_bad:
  */
 u32 svc_max_payload(const struct svc_rqst *rqstp)
 {
-	int max = RPCSVC_MAXPAYLOAD_TCP;
+	u32 max = rqstp->rq_xprt->xpt_class->xcl_max_payload;
 
-	if (rqstp->rq_sock->sk_sock->type == SOCK_DGRAM)
-		max = RPCSVC_MAXPAYLOAD_UDP;
 	if (rqstp->rq_server->sv_max_payload < max)
 		max = rqstp->rq_server->sv_max_payload;
 	return max;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 4755467..ca9b8d8 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -906,6 +906,7 @@ static struct svc_xprt_ops svc_udp_ops = {
 static struct svc_xprt_class svc_udp_class = {
 	.xcl_name = "udp",
 	.xcl_ops = &svc_udp_ops,
+	.xcl_max_payload = RPCSVC_MAXPAYLOAD_UDP,
 };
 
 static void
@@ -1359,6 +1360,7 @@ static struct svc_xprt_ops svc_tcp_ops = {
 static struct svc_xprt_class svc_tcp_class = {
 	.xcl_name = "tcp",
 	.xcl_ops = &svc_tcp_ops,
+	.xcl_max_payload = RPCSVC_MAXPAYLOAD_TCP,
 };
 
 void svc_init_xprt_sock(void)
-
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/38] svc: SVC Transport Switch, Tom Tucker, (Tue Dec 11, 7:31 pm)
[PATCH 28/38] svc: Make svc_recv transport neutral, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 23/38] svc: Remove sk_lastrecv, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 14/38] svc: Change sk_inuse to a kref, Tom Tucker, (Tue Dec 11, 7:32 pm)
Re: [PATCH 14/38] svc: Change sk_inuse to a kref, J. Bruce Fields, (Fri Dec 14, 4:52 pm)
[PATCH 20/38] svc: Make svc_send transport neutral, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 17/38] svc: Make close transport independent, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 18/38] svc: Move sk_reserved to svc_xprt, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 11/38] svc: Add xpo_accept transport function, Tom Tucker, (Tue Dec 11, 7:32 pm)
Re: [PATCH 11/38] svc: Add xpo_accept transport function, J. Bruce Fields, (Fri Dec 14, 3:55 pm)
Re: [PATCH 11/38] svc: Add xpo_accept transport function, J. Bruce Fields, (Fri Dec 14, 3:01 pm)
[PATCH 08/38] svc: Add xpo_prep_reply_hdr, Tom Tucker, (Tue Dec 11, 7:32 pm)
[PATCH 04/38] svc: Add a max payload value to the transport, Tom Tucker, (Tue Dec 11, 7:32 pm)
Re: [PATCH 02/38] svc: Make svc_sock the tcp/udp transport, J. Bruce Fields, (Thu Dec 13, 3:01 pm)
[PATCH 01/38] svc: Add an svc transport class, Tom Tucker, (Tue Dec 11, 7:31 pm)
Re: [PATCH 01/38] svc: Add an svc transport class, J. Bruce Fields, (Thu Dec 13, 2:45 pm)