diff options
| author | Chuck Lever <cel@netapp.com> | 2005-08-25 19:25:49 -0400 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-09-23 12:38:33 -0400 |
| commit | 808012fbb23a52ec59352445d2076d175ad4ab26 (patch) | |
| tree | 7175edb3917bc35f7f5484f567e91d7303a17663 /include/linux | |
| parent | 262965f53defd312a294b45366ea17907b6a616b (diff) | |
[PATCH] RPC: skip over transport-specific heads automatically
Add a generic mechanism for skipping over transport-specific headers
when constructing an RPC request. This removes another "xprt->stream"
dependency.
Test-plan:
Write-intensive workload on a single mount point (try both UDP and
TCP).
Signed-off-by: Chuck Lever <cel@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sunrpc/msg_prot.h | 25 | ||||
| -rw-r--r-- | include/linux/sunrpc/xprt.h | 7 |
2 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/sunrpc/msg_prot.h b/include/linux/sunrpc/msg_prot.h index 15f115332389..f43f237360ae 100644 --- a/include/linux/sunrpc/msg_prot.h +++ b/include/linux/sunrpc/msg_prot.h | |||
| @@ -76,5 +76,30 @@ enum rpc_auth_stat { | |||
| 76 | 76 | ||
| 77 | #define RPC_MAXNETNAMELEN 256 | 77 | #define RPC_MAXNETNAMELEN 256 |
| 78 | 78 | ||
| 79 | /* | ||
| 80 | * From RFC 1831: | ||
| 81 | * | ||
| 82 | * "A record is composed of one or more record fragments. A record | ||
| 83 | * fragment is a four-byte header followed by 0 to (2**31) - 1 bytes of | ||
| 84 | * fragment data. The bytes encode an unsigned binary number; as with | ||
| 85 | * XDR integers, the byte order is from highest to lowest. The number | ||
| 86 | * encodes two values -- a boolean which indicates whether the fragment | ||
| 87 | * is the last fragment of the record (bit value 1 implies the fragment | ||
| 88 | * is the last fragment) and a 31-bit unsigned binary value which is the | ||
| 89 | * length in bytes of the fragment's data. The boolean value is the | ||
| 90 | * highest-order bit of the header; the length is the 31 low-order bits. | ||
| 91 | * (Note that this record specification is NOT in XDR standard form!)" | ||
| 92 | * | ||
| 93 | * The Linux RPC client always sends its requests in a single record | ||
| 94 | * fragment, limiting the maximum payload size for stream transports to | ||
| 95 | * 2GB. | ||
| 96 | */ | ||
| 97 | |||
| 98 | typedef u32 rpc_fraghdr; | ||
| 99 | |||
| 100 | #define RPC_LAST_STREAM_FRAGMENT (1U << 31) | ||
| 101 | #define RPC_FRAGMENT_SIZE_MASK (~RPC_LAST_STREAM_FRAGMENT) | ||
| 102 | #define RPC_MAX_FRAGMENT_SIZE ((1U << 31) - 1) | ||
| 103 | |||
| 79 | #endif /* __KERNEL__ */ | 104 | #endif /* __KERNEL__ */ |
| 80 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ | 105 | #endif /* _LINUX_SUNRPC_MSGPROT_H_ */ |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index e73174c7e450..966c456a0f6d 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
| @@ -155,6 +155,8 @@ struct rpc_xprt { | |||
| 155 | 155 | ||
| 156 | size_t max_payload; /* largest RPC payload size, | 156 | size_t max_payload; /* largest RPC payload size, |
| 157 | in bytes */ | 157 | in bytes */ |
| 158 | unsigned int tsh_size; /* size of transport specific | ||
| 159 | header */ | ||
| 158 | 160 | ||
| 159 | struct rpc_wait_queue sending; /* requests waiting to send */ | 161 | struct rpc_wait_queue sending; /* requests waiting to send */ |
| 160 | struct rpc_wait_queue resend; /* requests waiting to resend */ | 162 | struct rpc_wait_queue resend; /* requests waiting to resend */ |
| @@ -236,6 +238,11 @@ int xprt_adjust_timeout(struct rpc_rqst *req); | |||
| 236 | void xprt_release(struct rpc_task *task); | 238 | void xprt_release(struct rpc_task *task); |
| 237 | int xprt_destroy(struct rpc_xprt *xprt); | 239 | int xprt_destroy(struct rpc_xprt *xprt); |
| 238 | 240 | ||
| 241 | static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) | ||
| 242 | { | ||
| 243 | return p + xprt->tsh_size; | ||
| 244 | } | ||
| 245 | |||
| 239 | /* | 246 | /* |
| 240 | * Transport switch helper functions | 247 | * Transport switch helper functions |
| 241 | */ | 248 | */ |
