bc_xprt.h 1.9 KB

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