diff options
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/auth.h | 7 | ||||
-rw-r--r-- | include/linux/sunrpc/debug.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_api.h | 27 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_err.h | 10 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_krb5.h | 27 | ||||
-rw-r--r-- | include/linux/sunrpc/gss_spkm3.h | 4 | ||||
-rw-r--r-- | include/linux/sunrpc/msg_prot.h | 25 | ||||
-rw-r--r-- | include/linux/sunrpc/xdr.h | 6 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 227 |
9 files changed, 224 insertions, 112 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h index 04ebc24db348..b68c11a2d6dd 100644 --- a/include/linux/sunrpc/auth.h +++ b/include/linux/sunrpc/auth.h | |||
@@ -66,7 +66,12 @@ struct rpc_cred_cache { | |||
66 | 66 | ||
67 | struct rpc_auth { | 67 | struct rpc_auth { |
68 | unsigned int au_cslack; /* call cred size estimate */ | 68 | unsigned int au_cslack; /* call cred size estimate */ |
69 | unsigned int au_rslack; /* reply verf size guess */ | 69 | /* guess at number of u32's auth adds before |
70 | * reply data; normally the verifier size: */ | ||
71 | unsigned int au_rslack; | ||
72 | /* for gss, used to calculate au_rslack: */ | ||
73 | unsigned int au_verfsize; | ||
74 | |||
70 | unsigned int au_flags; /* various flags */ | 75 | unsigned int au_flags; /* various flags */ |
71 | struct rpc_authops * au_ops; /* operations */ | 76 | struct rpc_authops * au_ops; /* operations */ |
72 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may | 77 | rpc_authflavor_t au_flavor; /* pseudoflavor (note may |
diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h index eadb31e3c198..1a42d902bc11 100644 --- a/include/linux/sunrpc/debug.h +++ b/include/linux/sunrpc/debug.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define RPCDBG_AUTH 0x0010 | 32 | #define RPCDBG_AUTH 0x0010 |
33 | #define RPCDBG_PMAP 0x0020 | 33 | #define RPCDBG_PMAP 0x0020 |
34 | #define RPCDBG_SCHED 0x0040 | 34 | #define RPCDBG_SCHED 0x0040 |
35 | #define RPCDBG_TRANS 0x0080 | ||
35 | #define RPCDBG_SVCSOCK 0x0100 | 36 | #define RPCDBG_SVCSOCK 0x0100 |
36 | #define RPCDBG_SVCDSP 0x0200 | 37 | #define RPCDBG_SVCDSP 0x0200 |
37 | #define RPCDBG_MISC 0x0400 | 38 | #define RPCDBG_MISC 0x0400 |
@@ -94,6 +95,8 @@ enum { | |||
94 | CTL_NLMDEBUG, | 95 | CTL_NLMDEBUG, |
95 | CTL_SLOTTABLE_UDP, | 96 | CTL_SLOTTABLE_UDP, |
96 | CTL_SLOTTABLE_TCP, | 97 | CTL_SLOTTABLE_TCP, |
98 | CTL_MIN_RESVPORT, | ||
99 | CTL_MAX_RESVPORT, | ||
97 | }; | 100 | }; |
98 | 101 | ||
99 | #endif /* _LINUX_SUNRPC_DEBUG_H_ */ | 102 | #endif /* _LINUX_SUNRPC_DEBUG_H_ */ |
diff --git a/include/linux/sunrpc/gss_api.h b/include/linux/sunrpc/gss_api.h index 689262f63059..9b8bcf125c18 100644 --- a/include/linux/sunrpc/gss_api.h +++ b/include/linux/sunrpc/gss_api.h | |||
@@ -40,14 +40,21 @@ int gss_import_sec_context( | |||
40 | struct gss_ctx **ctx_id); | 40 | struct gss_ctx **ctx_id); |
41 | u32 gss_get_mic( | 41 | u32 gss_get_mic( |
42 | struct gss_ctx *ctx_id, | 42 | struct gss_ctx *ctx_id, |
43 | u32 qop, | ||
44 | struct xdr_buf *message, | 43 | struct xdr_buf *message, |
45 | struct xdr_netobj *mic_token); | 44 | struct xdr_netobj *mic_token); |
46 | u32 gss_verify_mic( | 45 | u32 gss_verify_mic( |
47 | struct gss_ctx *ctx_id, | 46 | struct gss_ctx *ctx_id, |
48 | struct xdr_buf *message, | 47 | struct xdr_buf *message, |
49 | struct xdr_netobj *mic_token, | 48 | struct xdr_netobj *mic_token); |
50 | u32 *qstate); | 49 | u32 gss_wrap( |
50 | struct gss_ctx *ctx_id, | ||
51 | int offset, | ||
52 | struct xdr_buf *outbuf, | ||
53 | struct page **inpages); | ||
54 | u32 gss_unwrap( | ||
55 | struct gss_ctx *ctx_id, | ||
56 | int offset, | ||
57 | struct xdr_buf *inbuf); | ||
51 | u32 gss_delete_sec_context( | 58 | u32 gss_delete_sec_context( |
52 | struct gss_ctx **ctx_id); | 59 | struct gss_ctx **ctx_id); |
53 | 60 | ||
@@ -56,7 +63,6 @@ char *gss_service_to_auth_domain_name(struct gss_api_mech *, u32 service); | |||
56 | 63 | ||
57 | struct pf_desc { | 64 | struct pf_desc { |
58 | u32 pseudoflavor; | 65 | u32 pseudoflavor; |
59 | u32 qop; | ||
60 | u32 service; | 66 | u32 service; |
61 | char *name; | 67 | char *name; |
62 | char *auth_domain_name; | 68 | char *auth_domain_name; |
@@ -85,14 +91,21 @@ struct gss_api_ops { | |||
85 | struct gss_ctx *ctx_id); | 91 | struct gss_ctx *ctx_id); |
86 | u32 (*gss_get_mic)( | 92 | u32 (*gss_get_mic)( |
87 | struct gss_ctx *ctx_id, | 93 | struct gss_ctx *ctx_id, |
88 | u32 qop, | ||
89 | struct xdr_buf *message, | 94 | struct xdr_buf *message, |
90 | struct xdr_netobj *mic_token); | 95 | struct xdr_netobj *mic_token); |
91 | u32 (*gss_verify_mic)( | 96 | u32 (*gss_verify_mic)( |
92 | struct gss_ctx *ctx_id, | 97 | struct gss_ctx *ctx_id, |
93 | struct xdr_buf *message, | 98 | struct xdr_buf *message, |
94 | struct xdr_netobj *mic_token, | 99 | struct xdr_netobj *mic_token); |
95 | u32 *qstate); | 100 | u32 (*gss_wrap)( |
101 | struct gss_ctx *ctx_id, | ||
102 | int offset, | ||
103 | struct xdr_buf *outbuf, | ||
104 | struct page **inpages); | ||
105 | u32 (*gss_unwrap)( | ||
106 | struct gss_ctx *ctx_id, | ||
107 | int offset, | ||
108 | struct xdr_buf *buf); | ||
96 | void (*gss_delete_sec_context)( | 109 | void (*gss_delete_sec_context)( |
97 | void *internal_ctx_id); | 110 | void *internal_ctx_id); |
98 | }; | 111 | }; |
diff --git a/include/linux/sunrpc/gss_err.h b/include/linux/sunrpc/gss_err.h index 92608a2e574c..a6807867bd21 100644 --- a/include/linux/sunrpc/gss_err.h +++ b/include/linux/sunrpc/gss_err.h | |||
@@ -66,16 +66,6 @@ typedef unsigned int OM_uint32; | |||
66 | 66 | ||
67 | 67 | ||
68 | /* | 68 | /* |
69 | * Define the default Quality of Protection for per-message services. Note | ||
70 | * that an implementation that offers multiple levels of QOP may either reserve | ||
71 | * a value (for example zero, as assumed here) to mean "default protection", or | ||
72 | * alternatively may simply equate GSS_C_QOP_DEFAULT to a specific explicit | ||
73 | * QOP value. However a value of 0 should always be interpreted by a GSSAPI | ||
74 | * implementation as a request for the default protection level. | ||
75 | */ | ||
76 | #define GSS_C_QOP_DEFAULT 0 | ||
77 | |||
78 | /* | ||
79 | * Expiration time of 2^32-1 seconds means infinite lifetime for a | 69 | * Expiration time of 2^32-1 seconds means infinite lifetime for a |
80 | * credential or security context | 70 | * credential or security context |
81 | */ | 71 | */ |
diff --git a/include/linux/sunrpc/gss_krb5.h b/include/linux/sunrpc/gss_krb5.h index ffe31d2eb9ec..2c3601d31045 100644 --- a/include/linux/sunrpc/gss_krb5.h +++ b/include/linux/sunrpc/gss_krb5.h | |||
@@ -116,18 +116,22 @@ enum seal_alg { | |||
116 | 116 | ||
117 | s32 | 117 | s32 |
118 | make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, | 118 | make_checksum(s32 cksumtype, char *header, int hdrlen, struct xdr_buf *body, |
119 | struct xdr_netobj *cksum); | 119 | int body_offset, struct xdr_netobj *cksum); |
120 | |||
121 | u32 gss_get_mic_kerberos(struct gss_ctx *, struct xdr_buf *, | ||
122 | struct xdr_netobj *); | ||
123 | |||
124 | u32 gss_verify_mic_kerberos(struct gss_ctx *, struct xdr_buf *, | ||
125 | struct xdr_netobj *); | ||
120 | 126 | ||
121 | u32 | 127 | u32 |
122 | krb5_make_token(struct krb5_ctx *context_handle, int qop_req, | 128 | gss_wrap_kerberos(struct gss_ctx *ctx_id, int offset, |
123 | struct xdr_buf *input_message_buffer, | 129 | struct xdr_buf *outbuf, struct page **pages); |
124 | struct xdr_netobj *output_message_buffer, int toktype); | ||
125 | 130 | ||
126 | u32 | 131 | u32 |
127 | krb5_read_token(struct krb5_ctx *context_handle, | 132 | gss_unwrap_kerberos(struct gss_ctx *ctx_id, int offset, |
128 | struct xdr_netobj *input_token_buffer, | 133 | struct xdr_buf *buf); |
129 | struct xdr_buf *message_buffer, | 134 | |
130 | int *qop_state, int toktype); | ||
131 | 135 | ||
132 | u32 | 136 | u32 |
133 | krb5_encrypt(struct crypto_tfm * key, | 137 | krb5_encrypt(struct crypto_tfm * key, |
@@ -137,6 +141,13 @@ u32 | |||
137 | krb5_decrypt(struct crypto_tfm * key, | 141 | krb5_decrypt(struct crypto_tfm * key, |
138 | void *iv, void *in, void *out, int length); | 142 | void *iv, void *in, void *out, int length); |
139 | 143 | ||
144 | int | ||
145 | gss_encrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *outbuf, int offset, | ||
146 | struct page **pages); | ||
147 | |||
148 | int | ||
149 | gss_decrypt_xdr_buf(struct crypto_tfm *tfm, struct xdr_buf *inbuf, int offset); | ||
150 | |||
140 | s32 | 151 | s32 |
141 | krb5_make_seq_num(struct crypto_tfm * key, | 152 | krb5_make_seq_num(struct crypto_tfm * key, |
142 | int direction, | 153 | int direction, |
diff --git a/include/linux/sunrpc/gss_spkm3.h b/include/linux/sunrpc/gss_spkm3.h index b5c9968c3c17..0beb2cf00a84 100644 --- a/include/linux/sunrpc/gss_spkm3.h +++ b/include/linux/sunrpc/gss_spkm3.h | |||
@@ -41,9 +41,9 @@ struct spkm3_ctx { | |||
41 | #define SPKM_WRAP_TOK 5 | 41 | #define SPKM_WRAP_TOK 5 |
42 | #define SPKM_DEL_TOK 6 | 42 | #define SPKM_DEL_TOK 6 |
43 | 43 | ||
44 | u32 spkm3_make_token(struct spkm3_ctx *ctx, int qop_req, struct xdr_buf * text, struct xdr_netobj * token, int toktype); | 44 | u32 spkm3_make_token(struct spkm3_ctx *ctx, struct xdr_buf * text, struct xdr_netobj * token, int toktype); |
45 | 45 | ||
46 | u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int *qop_state, int toktype); | 46 | u32 spkm3_read_token(struct spkm3_ctx *ctx, struct xdr_netobj *read_token, struct xdr_buf *message_buffer, int toktype); |
47 | 47 | ||
48 | #define CKSUMTYPE_RSA_MD5 0x0007 | 48 | #define CKSUMTYPE_RSA_MD5 0x0007 |
49 | 49 | ||
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/xdr.h b/include/linux/sunrpc/xdr.h index 23448d0fb5bc..5da968729cf8 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -161,14 +161,10 @@ typedef struct { | |||
161 | 161 | ||
162 | typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); | 162 | typedef size_t (*skb_read_actor_t)(skb_reader_t *desc, void *to, size_t len); |
163 | 163 | ||
164 | extern int csum_partial_copy_to_xdr(struct xdr_buf *, struct sk_buff *); | ||
164 | extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, | 165 | extern ssize_t xdr_partial_copy_from_skb(struct xdr_buf *, unsigned int, |
165 | skb_reader_t *, skb_read_actor_t); | 166 | skb_reader_t *, skb_read_actor_t); |
166 | 167 | ||
167 | struct socket; | ||
168 | struct sockaddr; | ||
169 | extern int xdr_sendpages(struct socket *, struct sockaddr *, int, | ||
170 | struct xdr_buf *, unsigned int, int); | ||
171 | |||
172 | extern int xdr_encode_word(struct xdr_buf *, int, u32); | 168 | extern int xdr_encode_word(struct xdr_buf *, int, u32); |
173 | extern int xdr_decode_word(struct xdr_buf *, int, u32 *); | 169 | extern int xdr_decode_word(struct xdr_buf *, int, u32 *); |
174 | 170 | ||
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index e618c1649814..3b8b6e823c70 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/sunrpc/clnt_xprt.h | 2 | * linux/include/linux/sunrpc/xprt.h |
3 | * | 3 | * |
4 | * Declarations for the RPC transport interface. | 4 | * Declarations for the RPC transport interface. |
5 | * | 5 | * |
@@ -15,20 +15,6 @@ | |||
15 | #include <linux/sunrpc/sched.h> | 15 | #include <linux/sunrpc/sched.h> |
16 | #include <linux/sunrpc/xdr.h> | 16 | #include <linux/sunrpc/xdr.h> |
17 | 17 | ||
18 | /* | ||
19 | * The transport code maintains an estimate on the maximum number of out- | ||
20 | * standing RPC requests, using a smoothed version of the congestion | ||
21 | * avoidance implemented in 44BSD. This is basically the Van Jacobson | ||
22 | * congestion algorithm: If a retransmit occurs, the congestion window is | ||
23 | * halved; otherwise, it is incremented by 1/cwnd when | ||
24 | * | ||
25 | * - a reply is received and | ||
26 | * - a full number of requests are outstanding and | ||
27 | * - the congestion window hasn't been updated recently. | ||
28 | * | ||
29 | * Upper procedures may check whether a request would block waiting for | ||
30 | * a free RPC slot by using the RPC_CONGESTED() macro. | ||
31 | */ | ||
32 | extern unsigned int xprt_udp_slot_table_entries; | 18 | extern unsigned int xprt_udp_slot_table_entries; |
33 | extern unsigned int xprt_tcp_slot_table_entries; | 19 | extern unsigned int xprt_tcp_slot_table_entries; |
34 | 20 | ||
@@ -36,34 +22,23 @@ extern unsigned int xprt_tcp_slot_table_entries; | |||
36 | #define RPC_DEF_SLOT_TABLE (16U) | 22 | #define RPC_DEF_SLOT_TABLE (16U) |
37 | #define RPC_MAX_SLOT_TABLE (128U) | 23 | #define RPC_MAX_SLOT_TABLE (128U) |
38 | 24 | ||
39 | #define RPC_CWNDSHIFT (8U) | ||
40 | #define RPC_CWNDSCALE (1U << RPC_CWNDSHIFT) | ||
41 | #define RPC_INITCWND RPC_CWNDSCALE | ||
42 | #define RPC_MAXCWND(xprt) ((xprt)->max_reqs << RPC_CWNDSHIFT) | ||
43 | #define RPCXPRT_CONGESTED(xprt) ((xprt)->cong >= (xprt)->cwnd) | ||
44 | |||
45 | /* Default timeout values */ | ||
46 | #define RPC_MAX_UDP_TIMEOUT (60*HZ) | ||
47 | #define RPC_MAX_TCP_TIMEOUT (600*HZ) | ||
48 | |||
49 | /* | 25 | /* |
50 | * Wait duration for an RPC TCP connection to be established. Solaris | 26 | * RPC call and reply header size as number of 32bit words (verifier |
51 | * NFS over TCP uses 60 seconds, for example, which is in line with how | 27 | * size computed separately) |
52 | * long a server takes to reboot. | ||
53 | */ | 28 | */ |
54 | #define RPC_CONNECT_TIMEOUT (60*HZ) | 29 | #define RPC_CALLHDRSIZE 6 |
30 | #define RPC_REPHDRSIZE 4 | ||
55 | 31 | ||
56 | /* | 32 | /* |
57 | * Delay an arbitrary number of seconds before attempting to reconnect | 33 | * Parameters for choosing a free port |
58 | * after an error. | ||
59 | */ | 34 | */ |
60 | #define RPC_REESTABLISH_TIMEOUT (15*HZ) | 35 | extern unsigned int xprt_min_resvport; |
36 | extern unsigned int xprt_max_resvport; | ||
61 | 37 | ||
62 | /* RPC call and reply header size as number of 32bit words (verifier | 38 | #define RPC_MIN_RESVPORT (1U) |
63 | * size computed separately) | 39 | #define RPC_MAX_RESVPORT (65535U) |
64 | */ | 40 | #define RPC_DEF_MIN_RESVPORT (650U) |
65 | #define RPC_CALLHDRSIZE 6 | 41 | #define RPC_DEF_MAX_RESVPORT (1023U) |
66 | #define RPC_REPHDRSIZE 4 | ||
67 | 42 | ||
68 | /* | 43 | /* |
69 | * This describes a timeout strategy | 44 | * This describes a timeout strategy |
@@ -76,6 +51,9 @@ struct rpc_timeout { | |||
76 | unsigned char to_exponential; | 51 | unsigned char to_exponential; |
77 | }; | 52 | }; |
78 | 53 | ||
54 | struct rpc_task; | ||
55 | struct rpc_xprt; | ||
56 | |||
79 | /* | 57 | /* |
80 | * This describes a complete RPC request | 58 | * This describes a complete RPC request |
81 | */ | 59 | */ |
@@ -95,7 +73,10 @@ struct rpc_rqst { | |||
95 | int rq_cong; /* has incremented xprt->cong */ | 73 | int rq_cong; /* has incremented xprt->cong */ |
96 | int rq_received; /* receive completed */ | 74 | int rq_received; /* receive completed */ |
97 | u32 rq_seqno; /* gss seq no. used on req. */ | 75 | u32 rq_seqno; /* gss seq no. used on req. */ |
98 | 76 | int rq_enc_pages_num; | |
77 | struct page **rq_enc_pages; /* scratch pages for use by | ||
78 | gss privacy code */ | ||
79 | void (*rq_release_snd_buf)(struct rpc_rqst *); /* release rq_enc_pages */ | ||
99 | struct list_head rq_list; | 80 | struct list_head rq_list; |
100 | 81 | ||
101 | struct xdr_buf rq_private_buf; /* The receive buffer | 82 | struct xdr_buf rq_private_buf; /* The receive buffer |
@@ -121,12 +102,21 @@ struct rpc_rqst { | |||
121 | #define rq_svec rq_snd_buf.head | 102 | #define rq_svec rq_snd_buf.head |
122 | #define rq_slen rq_snd_buf.len | 103 | #define rq_slen rq_snd_buf.len |
123 | 104 | ||
124 | #define XPRT_LAST_FRAG (1 << 0) | 105 | struct rpc_xprt_ops { |
125 | #define XPRT_COPY_RECM (1 << 1) | 106 | void (*set_buffer_size)(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize); |
126 | #define XPRT_COPY_XID (1 << 2) | 107 | int (*reserve_xprt)(struct rpc_task *task); |
127 | #define XPRT_COPY_DATA (1 << 3) | 108 | void (*release_xprt)(struct rpc_xprt *xprt, struct rpc_task *task); |
109 | void (*connect)(struct rpc_task *task); | ||
110 | int (*send_request)(struct rpc_task *task); | ||
111 | void (*set_retrans_timeout)(struct rpc_task *task); | ||
112 | void (*timer)(struct rpc_task *task); | ||
113 | void (*release_request)(struct rpc_task *task); | ||
114 | void (*close)(struct rpc_xprt *xprt); | ||
115 | void (*destroy)(struct rpc_xprt *xprt); | ||
116 | }; | ||
128 | 117 | ||
129 | struct rpc_xprt { | 118 | struct rpc_xprt { |
119 | struct rpc_xprt_ops * ops; /* transport methods */ | ||
130 | struct socket * sock; /* BSD socket layer */ | 120 | struct socket * sock; /* BSD socket layer */ |
131 | struct sock * inet; /* INET layer */ | 121 | struct sock * inet; /* INET layer */ |
132 | 122 | ||
@@ -137,11 +127,13 @@ struct rpc_xprt { | |||
137 | unsigned long cong; /* current congestion */ | 127 | unsigned long cong; /* current congestion */ |
138 | unsigned long cwnd; /* congestion window */ | 128 | unsigned long cwnd; /* congestion window */ |
139 | 129 | ||
140 | unsigned int rcvsize, /* socket receive buffer size */ | 130 | size_t rcvsize, /* transport rcv buffer size */ |
141 | sndsize; /* socket send buffer size */ | 131 | sndsize; /* transport send buffer size */ |
142 | 132 | ||
143 | size_t max_payload; /* largest RPC payload size, | 133 | size_t max_payload; /* largest RPC payload size, |
144 | in bytes */ | 134 | in bytes */ |
135 | unsigned int tsh_size; /* size of transport specific | ||
136 | header */ | ||
145 | 137 | ||
146 | struct rpc_wait_queue sending; /* requests waiting to send */ | 138 | struct rpc_wait_queue sending; /* requests waiting to send */ |
147 | struct rpc_wait_queue resend; /* requests waiting to resend */ | 139 | struct rpc_wait_queue resend; /* requests waiting to resend */ |
@@ -150,11 +142,9 @@ struct rpc_xprt { | |||
150 | struct list_head free; /* free slots */ | 142 | struct list_head free; /* free slots */ |
151 | struct rpc_rqst * slot; /* slot table storage */ | 143 | struct rpc_rqst * slot; /* slot table storage */ |
152 | unsigned int max_reqs; /* total slots */ | 144 | unsigned int max_reqs; /* total slots */ |
153 | unsigned long sockstate; /* Socket state */ | 145 | unsigned long state; /* transport state */ |
154 | unsigned char shutdown : 1, /* being shut down */ | 146 | unsigned char shutdown : 1, /* being shut down */ |
155 | nocong : 1, /* no congestion control */ | 147 | resvport : 1; /* use a reserved port */ |
156 | resvport : 1, /* use a reserved port */ | ||
157 | stream : 1; /* TCP */ | ||
158 | 148 | ||
159 | /* | 149 | /* |
160 | * XID | 150 | * XID |
@@ -171,22 +161,27 @@ struct rpc_xprt { | |||
171 | unsigned long tcp_copied, /* copied to request */ | 161 | unsigned long tcp_copied, /* copied to request */ |
172 | tcp_flags; | 162 | tcp_flags; |
173 | /* | 163 | /* |
174 | * Connection of sockets | 164 | * Connection of transports |
175 | */ | 165 | */ |
176 | struct work_struct sock_connect; | 166 | unsigned long connect_timeout, |
167 | bind_timeout, | ||
168 | reestablish_timeout; | ||
169 | struct work_struct connect_worker; | ||
177 | unsigned short port; | 170 | unsigned short port; |
171 | |||
178 | /* | 172 | /* |
179 | * Disconnection of idle sockets | 173 | * Disconnection of idle transports |
180 | */ | 174 | */ |
181 | struct work_struct task_cleanup; | 175 | struct work_struct task_cleanup; |
182 | struct timer_list timer; | 176 | struct timer_list timer; |
183 | unsigned long last_used; | 177 | unsigned long last_used, |
178 | idle_timeout; | ||
184 | 179 | ||
185 | /* | 180 | /* |
186 | * Send stuff | 181 | * Send stuff |
187 | */ | 182 | */ |
188 | spinlock_t sock_lock; /* lock socket info */ | 183 | spinlock_t transport_lock; /* lock transport info */ |
189 | spinlock_t xprt_lock; /* lock xprt info */ | 184 | spinlock_t reserve_lock; /* lock slot table */ |
190 | struct rpc_task * snd_task; /* Task blocked in send */ | 185 | struct rpc_task * snd_task; /* Task blocked in send */ |
191 | 186 | ||
192 | struct list_head recv; | 187 | struct list_head recv; |
@@ -195,37 +190,111 @@ struct rpc_xprt { | |||
195 | void (*old_data_ready)(struct sock *, int); | 190 | void (*old_data_ready)(struct sock *, int); |
196 | void (*old_state_change)(struct sock *); | 191 | void (*old_state_change)(struct sock *); |
197 | void (*old_write_space)(struct sock *); | 192 | void (*old_write_space)(struct sock *); |
198 | |||
199 | wait_queue_head_t cong_wait; | ||
200 | }; | 193 | }; |
201 | 194 | ||
195 | #define XPRT_LAST_FRAG (1 << 0) | ||
196 | #define XPRT_COPY_RECM (1 << 1) | ||
197 | #define XPRT_COPY_XID (1 << 2) | ||
198 | #define XPRT_COPY_DATA (1 << 3) | ||
199 | |||
202 | #ifdef __KERNEL__ | 200 | #ifdef __KERNEL__ |
203 | 201 | ||
204 | struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, | 202 | /* |
205 | struct rpc_timeout *toparms); | 203 | * Transport operations used by ULPs |
206 | int xprt_destroy(struct rpc_xprt *); | 204 | */ |
207 | void xprt_set_timeout(struct rpc_timeout *, unsigned int, | 205 | struct rpc_xprt * xprt_create_proto(int proto, struct sockaddr_in *addr, struct rpc_timeout *to); |
208 | unsigned long); | 206 | void xprt_set_timeout(struct rpc_timeout *to, unsigned int retr, unsigned long incr); |
209 | 207 | ||
210 | void xprt_reserve(struct rpc_task *); | 208 | /* |
211 | int xprt_prepare_transmit(struct rpc_task *); | 209 | * Generic internal transport functions |
212 | void xprt_transmit(struct rpc_task *); | 210 | */ |
213 | void xprt_receive(struct rpc_task *); | 211 | void xprt_connect(struct rpc_task *task); |
212 | void xprt_reserve(struct rpc_task *task); | ||
213 | int xprt_reserve_xprt(struct rpc_task *task); | ||
214 | int xprt_reserve_xprt_cong(struct rpc_task *task); | ||
215 | int xprt_prepare_transmit(struct rpc_task *task); | ||
216 | void xprt_transmit(struct rpc_task *task); | ||
217 | void xprt_abort_transmit(struct rpc_task *task); | ||
214 | int xprt_adjust_timeout(struct rpc_rqst *req); | 218 | int xprt_adjust_timeout(struct rpc_rqst *req); |
215 | void xprt_release(struct rpc_task *); | 219 | void xprt_release_xprt(struct rpc_xprt *xprt, struct rpc_task *task); |
216 | void xprt_connect(struct rpc_task *); | 220 | void xprt_release_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); |
217 | void xprt_sock_setbufsize(struct rpc_xprt *); | 221 | void xprt_release(struct rpc_task *task); |
218 | 222 | int xprt_destroy(struct rpc_xprt *xprt); | |
219 | #define XPRT_LOCKED 0 | 223 | |
220 | #define XPRT_CONNECT 1 | 224 | static inline u32 *xprt_skip_transport_header(struct rpc_xprt *xprt, u32 *p) |
221 | #define XPRT_CONNECTING 2 | 225 | { |
222 | 226 | return p + xprt->tsh_size; | |
223 | #define xprt_connected(xp) (test_bit(XPRT_CONNECT, &(xp)->sockstate)) | 227 | } |
224 | #define xprt_set_connected(xp) (set_bit(XPRT_CONNECT, &(xp)->sockstate)) | 228 | |
225 | #define xprt_test_and_set_connected(xp) (test_and_set_bit(XPRT_CONNECT, &(xp)->sockstate)) | 229 | /* |
226 | #define xprt_test_and_clear_connected(xp) \ | 230 | * Transport switch helper functions |
227 | (test_and_clear_bit(XPRT_CONNECT, &(xp)->sockstate)) | 231 | */ |
228 | #define xprt_clear_connected(xp) (clear_bit(XPRT_CONNECT, &(xp)->sockstate)) | 232 | void xprt_set_retrans_timeout_def(struct rpc_task *task); |
233 | void xprt_set_retrans_timeout_rtt(struct rpc_task *task); | ||
234 | void xprt_wake_pending_tasks(struct rpc_xprt *xprt, int status); | ||
235 | void xprt_wait_for_buffer_space(struct rpc_task *task); | ||
236 | void xprt_write_space(struct rpc_xprt *xprt); | ||
237 | void xprt_update_rtt(struct rpc_task *task); | ||
238 | void xprt_adjust_cwnd(struct rpc_task *task, int result); | ||
239 | struct rpc_rqst * xprt_lookup_rqst(struct rpc_xprt *xprt, u32 xid); | ||
240 | void xprt_complete_rqst(struct rpc_task *task, int copied); | ||
241 | void xprt_release_rqst_cong(struct rpc_task *task); | ||
242 | void xprt_disconnect(struct rpc_xprt *xprt); | ||
243 | |||
244 | /* | ||
245 | * Socket transport setup operations | ||
246 | */ | ||
247 | int xs_setup_udp(struct rpc_xprt *xprt, struct rpc_timeout *to); | ||
248 | int xs_setup_tcp(struct rpc_xprt *xprt, struct rpc_timeout *to); | ||
249 | |||
250 | /* | ||
251 | * Reserved bit positions in xprt->state | ||
252 | */ | ||
253 | #define XPRT_LOCKED (0) | ||
254 | #define XPRT_CONNECTED (1) | ||
255 | #define XPRT_CONNECTING (2) | ||
256 | |||
257 | static inline void xprt_set_connected(struct rpc_xprt *xprt) | ||
258 | { | ||
259 | set_bit(XPRT_CONNECTED, &xprt->state); | ||
260 | } | ||
261 | |||
262 | static inline void xprt_clear_connected(struct rpc_xprt *xprt) | ||
263 | { | ||
264 | clear_bit(XPRT_CONNECTED, &xprt->state); | ||
265 | } | ||
266 | |||
267 | static inline int xprt_connected(struct rpc_xprt *xprt) | ||
268 | { | ||
269 | return test_bit(XPRT_CONNECTED, &xprt->state); | ||
270 | } | ||
271 | |||
272 | static inline int xprt_test_and_set_connected(struct rpc_xprt *xprt) | ||
273 | { | ||
274 | return test_and_set_bit(XPRT_CONNECTED, &xprt->state); | ||
275 | } | ||
276 | |||
277 | static inline int xprt_test_and_clear_connected(struct rpc_xprt *xprt) | ||
278 | { | ||
279 | return test_and_clear_bit(XPRT_CONNECTED, &xprt->state); | ||
280 | } | ||
281 | |||
282 | static inline void xprt_clear_connecting(struct rpc_xprt *xprt) | ||
283 | { | ||
284 | smp_mb__before_clear_bit(); | ||
285 | clear_bit(XPRT_CONNECTING, &xprt->state); | ||
286 | smp_mb__after_clear_bit(); | ||
287 | } | ||
288 | |||
289 | static inline int xprt_connecting(struct rpc_xprt *xprt) | ||
290 | { | ||
291 | return test_bit(XPRT_CONNECTING, &xprt->state); | ||
292 | } | ||
293 | |||
294 | static inline int xprt_test_and_set_connecting(struct rpc_xprt *xprt) | ||
295 | { | ||
296 | return test_and_set_bit(XPRT_CONNECTING, &xprt->state); | ||
297 | } | ||
229 | 298 | ||
230 | #endif /* __KERNEL__*/ | 299 | #endif /* __KERNEL__*/ |
231 | 300 | ||