All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC,PATCH 5/14] knfsd: max_payload per transport
@ 2007-05-16 19:23 Greg Banks
  2007-05-17 10:34 ` Neil Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Banks @ 2007-05-16 19:23 UTC (permalink / raw)
  To: Tom Tucker; +Cc: Linux NFS Mailing List, Thomas Talpey, Peter Leckie


Make svc_max_payload() delegate to a new method in svc_sock_ops
instead of reaching into the socket (beause later the NFS/RDMA
transport will not even have a socket).

Signed-off-by: Greg Banks <gnb@melbourne.sgi.com>
Signed-off-by: Peter Leckie <pleckie@melbourne.sgi.com>
---

 include/linux/sunrpc/svcsock.h |    6 ++++++
 net/sunrpc/svc.c               |    5 ++---
 net/sunrpc/svcsock.c           |   16 ++++++++++++++--
 3 files changed, 22 insertions(+), 5 deletions(-)

Index: linux/include/linux/sunrpc/svcsock.h
===================================================================
--- linux.orig/include/linux/sunrpc/svcsock.h	2007-05-17 00:46:47.944827892 +1000
+++ linux/include/linux/sunrpc/svcsock.h	2007-05-17 01:28:41.131377156 +1000
@@ -37,6 +37,12 @@ struct svc_sock_ops {
 	 * Return 1 if sufficient space to write reply to network.
 	 */
 	int			(*sko_has_wspace)(struct svc_sock *);
+	/*
+	 * Return the largest payload (i.e. READ, WRITE or READDIR
+	 * data length not including NFS headers) supported by the
+	 * svc_sock.
+	 */
+	u32			(*sko_max_payload)(struct svc_sock *);
 };
 
 /*
Index: linux/net/sunrpc/svc.c
===================================================================
--- linux.orig/net/sunrpc/svc.c	2007-05-17 00:36:20.557193782 +1000
+++ linux/net/sunrpc/svc.c	2007-05-17 01:28:25.217367463 +1000
@@ -1020,10 +1020,9 @@ err_bad:
  */
 u32 svc_max_payload(const struct svc_rqst *rqstp)
 {
-	int max = RPCSVC_MAXPAYLOAD_TCP;
+	struct svc_sock *svsk = rqstp->rq_sock;
+	int max = svsk->sk_ops->sko_max_payload(svsk);
 
-	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;
Index: linux/net/sunrpc/svcsock.c
===================================================================
--- linux.orig/net/sunrpc/svcsock.c	2007-05-17 00:49:50.820303639 +1000
+++ linux/net/sunrpc/svcsock.c	2007-05-17 01:28:25.221366963 +1000
@@ -910,6 +910,11 @@ svc_udp_has_wspace(struct svc_sock *svsk
 	return svc_sock_has_write_space(svsk, sock_wspace(svsk->sk_sk));
 }
 
+static u32 svc_udp_max_payload(struct svc_sock *svsk)
+{
+	return RPCSVC_MAXPAYLOAD_UDP;
+}
+
 static const struct svc_sock_ops svc_udp_ops = {
 	.sko_name = "udp",
 	.sko_recvfrom = svc_udp_recvfrom,
@@ -917,7 +922,8 @@ static const struct svc_sock_ops svc_udp
 	.sko_detach = svc_tcpip_detach,
 	.sko_free = svc_tcpip_free,
 	.sko_prepare_reply = svc_tcpip_prepare_reply,
-	.sko_has_wspace = svc_udp_has_wspace
+	.sko_has_wspace = svc_udp_has_wspace,
+	.sko_max_payload = svc_udp_max_payload
 };
 
 static void
@@ -1378,6 +1384,11 @@ svc_tcp_has_wspace(struct svc_sock *svsk
 	return svc_sock_has_write_space(svsk, sk_stream_wspace(svsk->sk_sk));
 }
 
+static u32 svc_tcp_max_payload(struct svc_sock *svsk)
+{
+	return RPCSVC_MAXPAYLOAD_TCP;
+}
+
 static const struct svc_sock_ops svc_tcp_ops = {
 	.sko_name = "tcp",
 	.sko_recvfrom = svc_tcp_recvfrom,
@@ -1385,7 +1396,8 @@ static const struct svc_sock_ops svc_tcp
 	.sko_detach = svc_tcpip_detach,
 	.sko_free = svc_tcpip_free,
 	.sko_prepare_reply = svc_tcp_prepare_reply,
-	.sko_has_wspace = svc_tcp_has_wspace
+	.sko_has_wspace = svc_tcp_has_wspace,
+	.sko_max_payload = svc_tcp_max_payload
 };
 
 static void
-- 
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
Apparently, I'm Bedevere.  Which MPHG character are you?
I don't speak for SGI.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-22  7:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-16 19:23 [RFC,PATCH 5/14] knfsd: max_payload per transport Greg Banks
2007-05-17 10:34 ` Neil Brown
2007-05-17 15:23   ` Tom Tucker
2007-05-22  7:16     ` Greg Banks
2007-05-18  4:56   ` Greg Banks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.