at master 2.3 kB view raw
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 21struct rpc_rqst *xprt_lookup_bc_request(struct rpc_xprt *xprt, __be32 xid); 22void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied); 23void xprt_init_bc_request(struct rpc_rqst *req, struct rpc_task *task, 24 const struct rpc_timeout *to); 25void xprt_free_bc_request(struct rpc_rqst *req); 26int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs); 27void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs); 28void xprt_enqueue_bc_request(struct rpc_rqst *req); 29 30/* Socket backchannel transport methods */ 31int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs); 32void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs); 33void xprt_free_bc_rqst(struct rpc_rqst *req); 34unsigned int xprt_bc_max_slots(struct rpc_xprt *xprt); 35void 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 */ 40static inline bool svc_is_backchannel(const struct svc_rqst *rqstp) 41{ 42 return rqstp->rq_server->sv_bc_enabled; 43} 44 45static inline void set_bc_enabled(struct svc_serv *serv) 46{ 47 serv->sv_bc_enabled = true; 48} 49#else /* CONFIG_SUNRPC_BACKCHANNEL */ 50static inline int xprt_setup_backchannel(struct rpc_xprt *xprt, 51 unsigned int min_reqs) 52{ 53 return 0; 54} 55 56static inline void xprt_destroy_backchannel(struct rpc_xprt *xprt, 57 unsigned int max_reqs) 58{ 59} 60 61static inline bool svc_is_backchannel(const struct svc_rqst *rqstp) 62{ 63 return false; 64} 65 66static inline void set_bc_enabled(struct svc_serv *serv) 67{ 68} 69 70static inline void xprt_free_bc_request(struct rpc_rqst *req) 71{ 72} 73 74static 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 */