xref: /linux/include/linux/sunrpc/bc_xprt.h (revision 6c8c1406)
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 void xprt_free_bc_request(struct rpc_rqst *req);
25 int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
26 void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
27 
28 /* Socket backchannel transport methods */
29 int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
30 void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
31 void xprt_free_bc_rqst(struct rpc_rqst *req);
32 unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt);
33 
34 /*
35  * Determine if a shared backchannel is in use
36  */
37 static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
38 {
39 	return rqstp->rq_server->sv_bc_enabled;
40 }
41 
42 static inline void set_bc_enabled(struct svc_serv *serv)
43 {
44 	serv->sv_bc_enabled = true;
45 }
46 #else /* CONFIG_SUNRPC_BACKCHANNEL */
47 static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
48 					 unsigned int min_reqs)
49 {
50 	return 0;
51 }
52 
53 static inline void xprt_destroy_backchannel(struct rpc_xprt *xprt,
54 					    unsigned int max_reqs)
55 {
56 }
57 
58 static inline bool svc_is_backchannel(const struct svc_rqst *rqstp)
59 {
60 	return false;
61 }
62 
63 static inline void set_bc_enabled(struct svc_serv *serv)
64 {
65 }
66 
67 static inline void xprt_free_bc_request(struct rpc_rqst *req)
68 {
69 }
70 #endif /* CONFIG_SUNRPC_BACKCHANNEL */
71 #endif /* _LINUX_SUNRPC_BC_XPRT_H */
72