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