bc_xprt.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /******************************************************************************
  2. (c) 2008 NetApp. All Rights Reserved.
  3. NetApp provides this source code under the GPL v2 License.
  4. The GPL v2 license is available at
  5. http://opensource.org/licenses/gpl-license.php.
  6. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  7. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  8. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  9. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  10. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  11. EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  12. PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  13. PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  14. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  15. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  16. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17. ******************************************************************************/
  18. /*
  19. * Functions to create and manage the backchannel
  20. */
  21. #ifndef _LINUX_SUNRPC_BC_XPRT_H
  22. #define _LINUX_SUNRPC_BC_XPRT_H
  23. #include <linux/sunrpc/svcsock.h>
  24. #include <linux/sunrpc/xprt.h>
  25. #include <linux/sunrpc/sched.h>
  26. #ifdef CONFIG_SUNRPC_BACKCHANNEL
  27. struct rpc_rqst *xprt_lookup_bc_request(struct rpc_xprt *xprt, __be32 xid);
  28. void xprt_complete_bc_request(struct rpc_rqst *req, uint32_t copied);
  29. void xprt_free_bc_request(struct rpc_rqst *req);
  30. int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
  31. void xprt_destroy_backchannel(struct rpc_xprt *, unsigned int max_reqs);
  32. /* Socket backchannel transport methods */
  33. int xprt_setup_bc(struct rpc_xprt *xprt, unsigned int min_reqs);
  34. void xprt_destroy_bc(struct rpc_xprt *xprt, unsigned int max_reqs);
  35. void xprt_free_bc_rqst(struct rpc_rqst *req);
  36. /*
  37. * Determine if a shared backchannel is in use
  38. */
  39. static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
  40. {
  41. if (rqstp->rq_server->sv_bc_xprt)
  42. return 1;
  43. return 0;
  44. }
  45. #else /* CONFIG_SUNRPC_BACKCHANNEL */
  46. static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
  47. unsigned int min_reqs)
  48. {
  49. return 0;
  50. }
  51. static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
  52. {
  53. return 0;
  54. }
  55. static inline void xprt_free_bc_request(struct rpc_rqst *req)
  56. {
  57. }
  58. #endif /* CONFIG_SUNRPC_BACKCHANNEL */
  59. #endif /* _LINUX_SUNRPC_BC_XPRT_H */