diff options
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/bc_xprt.h | 49 | ||||
-rw-r--r-- | include/linux/sunrpc/clnt.h | 1 | ||||
-rw-r--r-- | include/linux/sunrpc/sched.h | 3 | ||||
-rw-r--r-- | include/linux/sunrpc/svc.h | 11 | ||||
-rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 7 | ||||
-rw-r--r-- | include/linux/sunrpc/svcsock.h | 9 | ||||
-rw-r--r-- | include/linux/sunrpc/xprt.h | 38 |
7 files changed, 112 insertions, 6 deletions
diff --git a/include/linux/sunrpc/bc_xprt.h b/include/linux/sunrpc/bc_xprt.h new file mode 100644 index 000000000000..6508f0dc0eff --- /dev/null +++ b/include/linux/sunrpc/bc_xprt.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /****************************************************************************** | ||
2 | |||
3 | (c) 2008 NetApp. All Rights Reserved. | ||
4 | |||
5 | NetApp provides this source code under the GPL v2 License. | ||
6 | The GPL v2 license is available at | ||
7 | http://opensource.org/licenses/gpl-license.php. | ||
8 | |||
9 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
10 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
11 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
12 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | ||
13 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
14 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
15 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
16 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
17 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
18 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
19 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
20 | |||
21 | ******************************************************************************/ | ||
22 | |||
23 | /* | ||
24 | * Functions to create and manage the backchannel | ||
25 | */ | ||
26 | |||
27 | #ifndef _LINUX_SUNRPC_BC_XPRT_H | ||
28 | #define _LINUX_SUNRPC_BC_XPRT_H | ||
29 | |||
30 | #include <linux/sunrpc/svcsock.h> | ||
31 | #include <linux/sunrpc/xprt.h> | ||
32 | #include <linux/sunrpc/sched.h> | ||
33 | |||
34 | #ifdef CONFIG_NFS_V4_1 | ||
35 | struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt); | ||
36 | void xprt_free_bc_request(struct rpc_rqst *req); | ||
37 | int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); | ||
38 | void xprt_destroy_backchannel(struct rpc_xprt *, int max_reqs); | ||
39 | void bc_release_request(struct rpc_task *); | ||
40 | int bc_send(struct rpc_rqst *req); | ||
41 | #else /* CONFIG_NFS_V4_1 */ | ||
42 | static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, | ||
43 | unsigned int min_reqs) | ||
44 | { | ||
45 | return 0; | ||
46 | } | ||
47 | #endif /* CONFIG_NFS_V4_1 */ | ||
48 | #endif /* _LINUX_SUNRPC_BC_XPRT_H */ | ||
49 | |||
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index c39a21040dcb..37881f1a0bd7 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -143,6 +143,7 @@ int rpc_call_sync(struct rpc_clnt *clnt, | |||
143 | const struct rpc_message *msg, int flags); | 143 | const struct rpc_message *msg, int flags); |
144 | struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, | 144 | struct rpc_task *rpc_call_null(struct rpc_clnt *clnt, struct rpc_cred *cred, |
145 | int flags); | 145 | int flags); |
146 | void rpc_restart_call_prepare(struct rpc_task *); | ||
146 | void rpc_restart_call(struct rpc_task *); | 147 | void rpc_restart_call(struct rpc_task *); |
147 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); | 148 | void rpc_setbufsize(struct rpc_clnt *, unsigned int, unsigned int); |
148 | size_t rpc_max_payload(struct rpc_clnt *); | 149 | size_t rpc_max_payload(struct rpc_clnt *); |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 64981a2f1cae..401097781fc0 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -210,6 +210,8 @@ struct rpc_wait_queue { | |||
210 | */ | 210 | */ |
211 | struct rpc_task *rpc_new_task(const struct rpc_task_setup *); | 211 | struct rpc_task *rpc_new_task(const struct rpc_task_setup *); |
212 | struct rpc_task *rpc_run_task(const struct rpc_task_setup *); | 212 | struct rpc_task *rpc_run_task(const struct rpc_task_setup *); |
213 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, | ||
214 | const struct rpc_call_ops *ops); | ||
213 | void rpc_put_task(struct rpc_task *); | 215 | void rpc_put_task(struct rpc_task *); |
214 | void rpc_exit_task(struct rpc_task *); | 216 | void rpc_exit_task(struct rpc_task *); |
215 | void rpc_release_calldata(const struct rpc_call_ops *, void *); | 217 | void rpc_release_calldata(const struct rpc_call_ops *, void *); |
@@ -237,6 +239,7 @@ void rpc_show_tasks(void); | |||
237 | int rpc_init_mempool(void); | 239 | int rpc_init_mempool(void); |
238 | void rpc_destroy_mempool(void); | 240 | void rpc_destroy_mempool(void); |
239 | extern struct workqueue_struct *rpciod_workqueue; | 241 | extern struct workqueue_struct *rpciod_workqueue; |
242 | void rpc_prepare_task(struct rpc_task *task); | ||
240 | 243 | ||
241 | static inline void rpc_exit(struct rpc_task *task, int status) | 244 | static inline void rpc_exit(struct rpc_task *task, int status) |
242 | { | 245 | { |
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 2a30775959e9..ea8009695c69 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -96,6 +96,15 @@ struct svc_serv { | |||
96 | svc_thread_fn sv_function; /* main function for threads */ | 96 | svc_thread_fn sv_function; /* main function for threads */ |
97 | unsigned int sv_drc_max_pages; /* Total pages for DRC */ | 97 | unsigned int sv_drc_max_pages; /* Total pages for DRC */ |
98 | unsigned int sv_drc_pages_used;/* DRC pages used */ | 98 | unsigned int sv_drc_pages_used;/* DRC pages used */ |
99 | #if defined(CONFIG_NFS_V4_1) | ||
100 | struct list_head sv_cb_list; /* queue for callback requests | ||
101 | * that arrive over the same | ||
102 | * connection */ | ||
103 | spinlock_t sv_cb_lock; /* protects the svc_cb_list */ | ||
104 | wait_queue_head_t sv_cb_waitq; /* sleep here if there are no | ||
105 | * entries in the svc_cb_list */ | ||
106 | struct svc_xprt *bc_xprt; | ||
107 | #endif /* CONFIG_NFS_V4_1 */ | ||
99 | }; | 108 | }; |
100 | 109 | ||
101 | /* | 110 | /* |
@@ -411,6 +420,8 @@ int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int); | |||
411 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); | 420 | int svc_pool_stats_open(struct svc_serv *serv, struct file *file); |
412 | void svc_destroy(struct svc_serv *); | 421 | void svc_destroy(struct svc_serv *); |
413 | int svc_process(struct svc_rqst *); | 422 | int svc_process(struct svc_rqst *); |
423 | int bc_svc_process(struct svc_serv *, struct rpc_rqst *, | ||
424 | struct svc_rqst *); | ||
414 | int svc_register(const struct svc_serv *, const int, | 425 | int svc_register(const struct svc_serv *, const int, |
415 | const unsigned short, const unsigned short); | 426 | const unsigned short, const unsigned short); |
416 | 427 | ||
diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h index 0d9cb6ef28b0..2223ae0b5ed5 100644 --- a/include/linux/sunrpc/svc_xprt.h +++ b/include/linux/sunrpc/svc_xprt.h | |||
@@ -83,7 +83,7 @@ int svc_port_is_privileged(struct sockaddr *sin); | |||
83 | int svc_print_xprts(char *buf, int maxlen); | 83 | int svc_print_xprts(char *buf, int maxlen); |
84 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, | 84 | struct svc_xprt *svc_find_xprt(struct svc_serv *serv, const char *xcl_name, |
85 | const sa_family_t af, const unsigned short port); | 85 | const sa_family_t af, const unsigned short port); |
86 | int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen); | 86 | int svc_xprt_names(struct svc_serv *serv, char *buf, const int buflen); |
87 | 87 | ||
88 | static inline void svc_xprt_get(struct svc_xprt *xprt) | 88 | static inline void svc_xprt_get(struct svc_xprt *xprt) |
89 | { | 89 | { |
@@ -118,7 +118,7 @@ static inline unsigned short svc_addr_port(const struct sockaddr *sa) | |||
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | 120 | ||
121 | static inline size_t svc_addr_len(struct sockaddr *sa) | 121 | static inline size_t svc_addr_len(const struct sockaddr *sa) |
122 | { | 122 | { |
123 | switch (sa->sa_family) { | 123 | switch (sa->sa_family) { |
124 | case AF_INET: | 124 | case AF_INET: |
@@ -126,7 +126,8 @@ static inline size_t svc_addr_len(struct sockaddr *sa) | |||
126 | case AF_INET6: | 126 | case AF_INET6: |
127 | return sizeof(struct sockaddr_in6); | 127 | return sizeof(struct sockaddr_in6); |
128 | } | 128 | } |
129 | return -EAFNOSUPPORT; | 129 | |
130 | return 0; | ||
130 | } | 131 | } |
131 | 132 | ||
132 | static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt) | 133 | static inline unsigned short svc_xprt_local_port(const struct svc_xprt *xprt) |
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h index 483e10380aae..04dba23c59f2 100644 --- a/include/linux/sunrpc/svcsock.h +++ b/include/linux/sunrpc/svcsock.h | |||
@@ -38,10 +38,15 @@ int svc_recv(struct svc_rqst *, long); | |||
38 | int svc_send(struct svc_rqst *); | 38 | int svc_send(struct svc_rqst *); |
39 | void svc_drop(struct svc_rqst *); | 39 | void svc_drop(struct svc_rqst *); |
40 | void svc_sock_update_bufs(struct svc_serv *serv); | 40 | void svc_sock_update_bufs(struct svc_serv *serv); |
41 | int svc_sock_names(char *buf, struct svc_serv *serv, char *toclose); | 41 | int svc_sock_names(struct svc_serv *serv, char *buf, |
42 | int svc_addsock(struct svc_serv *serv, int fd, char *name_return); | 42 | const size_t buflen, |
43 | const char *toclose); | ||
44 | int svc_addsock(struct svc_serv *serv, const int fd, | ||
45 | char *name_return, const size_t len); | ||
43 | void svc_init_xprt_sock(void); | 46 | void svc_init_xprt_sock(void); |
44 | void svc_cleanup_xprt_sock(void); | 47 | void svc_cleanup_xprt_sock(void); |
48 | struct svc_xprt *svc_sock_create(struct svc_serv *serv, int prot); | ||
49 | void svc_sock_destroy(struct svc_xprt *); | ||
45 | 50 | ||
46 | /* | 51 | /* |
47 | * svc_makesock socket characteristics | 52 | * svc_makesock socket characteristics |
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index 08afe43118f4..1175d58efc2e 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h | |||
@@ -67,7 +67,8 @@ struct rpc_rqst { | |||
67 | struct rpc_task * rq_task; /* RPC task data */ | 67 | struct rpc_task * rq_task; /* RPC task data */ |
68 | __be32 rq_xid; /* request XID */ | 68 | __be32 rq_xid; /* request XID */ |
69 | int rq_cong; /* has incremented xprt->cong */ | 69 | int rq_cong; /* has incremented xprt->cong */ |
70 | int rq_received; /* receive completed */ | 70 | int rq_reply_bytes_recvd; /* number of reply */ |
71 | /* bytes received */ | ||
71 | u32 rq_seqno; /* gss seq no. used on req. */ | 72 | u32 rq_seqno; /* gss seq no. used on req. */ |
72 | int rq_enc_pages_num; | 73 | int rq_enc_pages_num; |
73 | struct page **rq_enc_pages; /* scratch pages for use by | 74 | struct page **rq_enc_pages; /* scratch pages for use by |
@@ -97,6 +98,12 @@ struct rpc_rqst { | |||
97 | 98 | ||
98 | unsigned long rq_xtime; /* when transmitted */ | 99 | unsigned long rq_xtime; /* when transmitted */ |
99 | int rq_ntrans; | 100 | int rq_ntrans; |
101 | |||
102 | #if defined(CONFIG_NFS_V4_1) | ||
103 | struct list_head rq_bc_list; /* Callback service list */ | ||
104 | unsigned long rq_bc_pa_state; /* Backchannel prealloc state */ | ||
105 | struct list_head rq_bc_pa_list; /* Backchannel prealloc list */ | ||
106 | #endif /* CONFIG_NFS_V4_1 */ | ||
100 | }; | 107 | }; |
101 | #define rq_svec rq_snd_buf.head | 108 | #define rq_svec rq_snd_buf.head |
102 | #define rq_slen rq_snd_buf.len | 109 | #define rq_slen rq_snd_buf.len |
@@ -174,6 +181,15 @@ struct rpc_xprt { | |||
174 | spinlock_t reserve_lock; /* lock slot table */ | 181 | spinlock_t reserve_lock; /* lock slot table */ |
175 | u32 xid; /* Next XID value to use */ | 182 | u32 xid; /* Next XID value to use */ |
176 | struct rpc_task * snd_task; /* Task blocked in send */ | 183 | struct rpc_task * snd_task; /* Task blocked in send */ |
184 | #if defined(CONFIG_NFS_V4_1) | ||
185 | struct svc_serv *bc_serv; /* The RPC service which will */ | ||
186 | /* process the callback */ | ||
187 | unsigned int bc_alloc_count; /* Total number of preallocs */ | ||
188 | spinlock_t bc_pa_lock; /* Protects the preallocated | ||
189 | * items */ | ||
190 | struct list_head bc_pa_list; /* List of preallocated | ||
191 | * backchannel rpc_rqst's */ | ||
192 | #endif /* CONFIG_NFS_V4_1 */ | ||
177 | struct list_head recv; | 193 | struct list_head recv; |
178 | 194 | ||
179 | struct { | 195 | struct { |
@@ -192,6 +208,26 @@ struct rpc_xprt { | |||
192 | const char *address_strings[RPC_DISPLAY_MAX]; | 208 | const char *address_strings[RPC_DISPLAY_MAX]; |
193 | }; | 209 | }; |
194 | 210 | ||
211 | #if defined(CONFIG_NFS_V4_1) | ||
212 | /* | ||
213 | * Backchannel flags | ||
214 | */ | ||
215 | #define RPC_BC_PA_IN_USE 0x0001 /* Preallocated backchannel */ | ||
216 | /* buffer in use */ | ||
217 | #endif /* CONFIG_NFS_V4_1 */ | ||
218 | |||
219 | #if defined(CONFIG_NFS_V4_1) | ||
220 | static inline int bc_prealloc(struct rpc_rqst *req) | ||
221 | { | ||
222 | return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state); | ||
223 | } | ||
224 | #else | ||
225 | static inline int bc_prealloc(struct rpc_rqst *req) | ||
226 | { | ||
227 | return 0; | ||
228 | } | ||
229 | #endif /* CONFIG_NFS_V4_1 */ | ||
230 | |||
195 | struct xprt_create { | 231 | struct xprt_create { |
196 | int ident; /* XPRT_TRANSPORT identifier */ | 232 | int ident; /* XPRT_TRANSPORT identifier */ |
197 | struct sockaddr * srcaddr; /* optional local address */ | 233 | struct sockaddr * srcaddr; /* optional local address */ |