diff options
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/auth.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/msg_prot.h | 40 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 23 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 8 |
4 files changed, 63 insertions, 11 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 862c0d8c8381..534cdc7be58d 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -20,9 +20,6 @@ | |||
20 | /* size of the nodename buffer */ | 20 | /* size of the nodename buffer */ |
21 | #define UNX_MAXNODENAME 32 | 21 | #define UNX_MAXNODENAME 32 |
22 | 22 | ||
23 | /* Maximum size (in bytes) of an rpc credential or verifier */ | ||
24 | #define RPC_MAX_AUTH_SIZE (400) | ||
25 | |||
26 | /* Work around the lack of a VFS credential */ | 23 | /* Work around the lack of a VFS credential */ |
27 | struct auth_cred { | 24 | struct auth_cred { |
28 | uid_t uid; | 25 | uid_t uid; |
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index 8d10d148834e..1e65f2dd80e5 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
@@ -11,6 +11,9 @@ | |||
11 | 11 | ||
12 | #define RPC_VERSION 2 | 12 | #define RPC_VERSION 2 |
13 | 13 | ||
14 | /* size of an XDR encoding unit in bytes, i.e. 32bit */ | ||
15 | #define XDR_UNIT (4) | ||
16 | |||
14 | /* spec defines authentication flavor as an unsigned 32 bit integer */ | 17 | /* spec defines authentication flavor as an unsigned 32 bit integer */ |
15 | typedef u32 rpc_authflavor_t; | 18 | typedef u32 rpc_authflavor_t; |
16 | 19 | ||
@@ -34,6 +37,9 @@ enum rpc_auth_flavors { | |||
34 | RPC_AUTH_GSS_SPKMP = 390011, | 37 | RPC_AUTH_GSS_SPKMP = 390011, |
35 | }; | 38 | }; |
36 | 39 | ||
40 | /* Maximum size (in bytes) of an rpc credential or verifier */ | ||
41 | #define RPC_MAX_AUTH_SIZE (400) | ||
42 | |||
37 | enum rpc_msg_type { | 43 | enum rpc_msg_type { |
38 | RPC_CALL = 0, | 44 | RPC_CALL = 0, |
39 | RPC_REPLY = 1 | 45 | RPC_REPLY = 1 |
@@ -101,5 +107,39 @@ typedef __be32 rpc_fraghdr; | |||
101 | #define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) | 107 | #define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) |
102 | #define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1) | 108 | #define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1) |
103 | 109 | ||
110 | /* | ||
111 | * RPC call and reply header size as number of 32bit words (verifier | ||
112 | * size computed separately, see below) | ||
113 | */ | ||
114 | #define RPC_CALLHDRSIZE (6) | ||
115 | #define RPC_REPHDRSIZE (4) | ||
116 | |||
117 | |||
118 | /* | ||
119 | * Maximum RPC header size, including authentication, | ||
120 | * as number of 32bit words (see RFCs 1831, 1832). | ||
121 | * | ||
122 | * xid 1 xdr unit = 4 bytes | ||
123 | * mtype 1 | ||
124 | * rpc_version 1 | ||
125 | * program 1 | ||
126 | * prog_version 1 | ||
127 | * procedure 1 | ||
128 | * cred { | ||
129 | * flavor 1 | ||
130 | * length 1 | ||
131 | * body<RPC_MAX_AUTH_SIZE> 100 xdr units = 400 bytes | ||
132 | * } | ||
133 | * verf { | ||
134 | * flavor 1 | ||
135 | * length 1 | ||
136 | * body<RPC_MAX_AUTH_SIZE> 100 xdr units = 400 bytes | ||
137 | * } | ||
138 | * TOTAL 210 xdr units = 840 bytes | ||
139 | */ | ||
140 | #define RPC_MAX_HEADER_WITH_AUTH \ | ||
141 | (RPC_CALLHDRSIZE + 2*(2+RPC_MAX_AUTH_SIZE/4)) | ||
142 | |||
143 | |||
104 | #endif /* __KERNEL__ */ | 144 | #endif /* __KERNEL__ */ |
105 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ | 145 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index cb0ed9beb227..74e52c245da4 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/in.h> | 13 | #include <linux/in.h> |
14 | #include <linux/sunrpc/types.h> | 14 | #include <linux/sunrpc/types.h> |
15 | #include <linux/sunrpc/xdr.h> | 15 | #include <linux/sunrpc/xdr.h> |
16 | #include <linux/sunrpc/auth.h> | ||
16 | #include <linux/sunrpc/svcauth.h> | 17 | #include <linux/sunrpc/svcauth.h> |
17 | #include <linux/wait.h> | 18 | #include <linux/wait.h> |
18 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
@@ -95,8 +96,28 @@ static inline void svc_get(struct svc_serv *serv) | |||
95 | * Maximum payload size supported by a kernel RPC server. | 96 | * Maximum payload size supported by a kernel RPC server. |
96 | * This is use to determine the max number of pages nfsd is | 97 | * This is use to determine the max number of pages nfsd is |
97 | * willing to return in a single READ operation. | 98 | * willing to return in a single READ operation. |
99 | * | ||
100 | * These happen to all be powers of 2, which is not strictly | ||
101 | * necessary but helps enforce the real limitation, which is | ||
102 | * that they should be multiples of PAGE_CACHE_SIZE. | ||
103 | * | ||
104 | * For UDP transports, a block plus NFS,RPC, and UDP headers | ||
105 | * has to fit into the IP datagram limit of 64K. The largest | ||
106 | * feasible number for all known page sizes is probably 48K, | ||
107 | * but we choose 32K here. This is the same as the historical | ||
108 | * Linux limit; someone who cares more about NFS/UDP performance | ||
109 | * can test a larger number. | ||
110 | * | ||
111 | * For TCP transports we have more freedom. A size of 1MB is | ||
112 | * chosen to match the client limit. Other OSes are known to | ||
113 | * have larger limits, but those numbers are probably beyond | ||
114 | * the point of diminishing returns. | ||
98 | */ | 115 | */ |
99 | #define RPCSVC_MAXPAYLOAD (64*1024u) | 116 | #define RPCSVC_MAXPAYLOAD (1*1024*1024u) |
117 | #define RPCSVC_MAXPAYLOAD_TCP RPCSVC_MAXPAYLOAD | ||
118 | #define RPCSVC_MAXPAYLOAD_UDP (32*1024u) | ||
119 | |||
120 | extern u32 svc_max_payload(const struct svc_rqst *rqstp); | ||
100 | 121 | ||
101 | /* | 122 | /* |
102 | * RPC Requsts and replies are stored in one or more pages. | 123 | * RPC Requsts and replies are stored in one or more pages. |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 6cf626580752..60394fbc4c70 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kref.h> | 15 | #include <linux/kref.h> |
16 | #include <linux/sunrpc/sched.h> | 16 | #include <linux/sunrpc/sched.h> |
17 | #include <linux/sunrpc/xdr.h> | 17 | #include <linux/sunrpc/xdr.h> |
18 | #include <linux/sunrpc/msg_prot.h> | ||
18 | 19 | ||
19 | extern unsigned int xprt_udp_slot_table_entries; | 20 | extern unsigned int xprt_udp_slot_table_entries; |
20 | extern unsigned int xprt_tcp_slot_table_entries; | 21 | extern unsigned int xprt_tcp_slot_table_entries; |
@@ -24,13 +25,6 @@ extern unsigned int xprt_tcp_slot_table_entries; | |||
24 | #define RPC_MAX_SLOT_TABLE (128U) | 25 | #define RPC_MAX_SLOT_TABLE (128U) |
25 | 26 | ||
26 | /* | 27 | /* |
27 | * RPC call and reply header size as number of 32bit words (verifier | ||
28 | * size computed separately) | ||
29 | */ | ||
30 | #define RPC_CALLHDRSIZE 6 | ||
31 | #define RPC_REPHDRSIZE 4 | ||
32 | |||
33 | /* | ||
34 | * Parameters for choosing a free port | 28 | * Parameters for choosing a free port |
35 | */ | 29 | */ |
36 | extern unsigned int xprt_min_resvport; | 30 | extern unsigned int xprt_min_resvport; |