qdf_lro.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright (c) 2015-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: Large Receive Offload API
  20. * This file defines the Large receive offload API.
  21. */
  22. #ifndef _QDF_LRO_H
  23. #define _QDF_LRO_H
  24. #include <qdf_nbuf.h>
  25. #include <i_qdf_lro.h>
  26. /**
  27. * @qdf_nbuf_t - Platform indepedent LRO context abstraction
  28. */
  29. typedef __qdf_lro_ctx_t qdf_lro_ctx_t;
  30. /**
  31. * qdf_lro_info_s - LRO information
  32. * @iph: IP header
  33. * @tcph: TCP header
  34. */
  35. struct qdf_lro_info {
  36. uint8_t *iph;
  37. uint8_t *tcph;
  38. };
  39. #if defined(FEATURE_LRO)
  40. /**
  41. * qdf_lro_init() - LRO initialization function
  42. *
  43. * Return: LRO context
  44. */
  45. qdf_lro_ctx_t qdf_lro_init(void);
  46. /**
  47. * qdf_lro_deinit() - LRO deinitialization function
  48. * @lro_ctx: LRO context
  49. *
  50. * Return: nothing
  51. */
  52. void qdf_lro_deinit(qdf_lro_ctx_t lro_ctx);
  53. /**
  54. * qdf_lro_get_info() - Update the LRO information
  55. *
  56. * @lro_ctx: LRO context
  57. * @nbuf: network buffer
  58. * @info: LRO related information passed in by the caller
  59. * @plro_desc: lro information returned as output
  60. *
  61. * Look-up the LRO descriptor based on the LRO information and
  62. * the network buffer provided. Update the skb cb with the
  63. * descriptor found
  64. *
  65. * Return: true: LRO eligible false: LRO ineligible
  66. */
  67. bool qdf_lro_get_info(qdf_lro_ctx_t lro_ctx, qdf_nbuf_t nbuf,
  68. struct qdf_lro_info *info,
  69. void **plro_desc);
  70. /**
  71. * qdf_lro_flush_pkt() - function to flush the LRO flow
  72. * @info: LRO related information passed by the caller
  73. * @lro_ctx: LRO context
  74. *
  75. * Flush all the packets aggregated in the LRO manager for the
  76. * flow indicated by the TCP and IP header
  77. *
  78. * Return: none
  79. */
  80. void qdf_lro_flush_pkt(qdf_lro_ctx_t lro_ctx,
  81. struct qdf_lro_info *info);
  82. /**
  83. * qdf_lro_flush() - LRO flush API
  84. * @lro_ctx: LRO context
  85. *
  86. * Flush all the packets aggregated in the LRO manager for all
  87. * the flows
  88. *
  89. * Return: none
  90. */
  91. void qdf_lro_flush(qdf_lro_ctx_t lro_ctx);
  92. /**
  93. * qdf_lro_desc_free() - Free the LRO descriptor
  94. * @desc: LRO descriptor
  95. * @lro_ctx: LRO context
  96. *
  97. * Return the LRO descriptor to the free pool
  98. *
  99. * Return: none
  100. */
  101. void qdf_lro_desc_free(qdf_lro_ctx_t lro_ctx, void *desc);
  102. #else
  103. static inline qdf_lro_ctx_t qdf_lro_init(void)
  104. {
  105. return NULL;
  106. }
  107. static inline void qdf_lro_deinit(qdf_lro_ctx_t lro_ctx)
  108. {
  109. }
  110. static inline void qdf_lro_flush(qdf_lro_ctx_t lro_ctx)
  111. {
  112. }
  113. #endif /* FEATURE_LRO */
  114. #endif