qdf_lro.h 3.1 KB

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