GNU Linux-libre 6.9.2-gnu
[releases.git] / include / linux / sunrpc / bc_xprt.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
3
4 (c) 2008 NetApp.  All Rights Reserved.
5
6
7 ******************************************************************************/
8
9 /*
10  * Functions to create and manage the backchannel
11  */
12
13 #ifndef _LINUX_SUNRPC_BC_XPRT_H
14 #define _LINUX_SUNRPC_BC_XPRT_H
15
16 #include <linux/sunrpc/svcsock.h>
17 #include <linux/sunrpc/xprt.h>
18 #include <linux/sunrpc/sched.h>
19
20 #ifdef CONFIG_SUNRPC_BACKCHANNEL
21 struct rpc_rqst *xprt_lookup_bc_request(struct rpc_xprt *xprt, __be32 xid);
22 void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied);
23 void xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task,
24                 const struct rpc_timeout *to);
25 void xprt_free_bc_request(struct rpc_rqst *req);
26 int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
27 void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
28
29 /* Socket backchannel transport methods */
30 int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
31 void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
32 void xprt_free_bc_rqst(struct rpc_rqst *req);
33 unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt);
34
35 /*
36  * Determine if a shared backchannel is in use
37  */
38 static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
39 {
40         return rqstp->rq_server->sv_bc_enabled;
41 }
42
43 static inline void set_bc_enabled(struct svc_serv *serv)
44 {
45         serv->sv_bc_enabled = true;
46 }
47 #else /* CONFIG_SUNRPC_BACKCHANNEL */
48 static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
49                                          unsigned int min_reqs)
50 {
51         return 0;
52 }
53
54 static inline void xprt_destroy_backchannel(struct rpc_xprt *xprt,
55                                             unsigned int max_reqs)
56 {
57 }
58
59 static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
60 {
61         return false;
62 }
63
64 static inline void set_bc_enabled(struct svc_serv *serv)
65 {
66 }
67
68 static inline void xprt_free_bc_request(struct rpc_rqst *req)
69 {
70 }
71 #endif /* CONFIG_SUNRPC_BACKCHANNEL */
72 #endif /* _LINUX_SUNRPC_BC_XPRT_H */