qdf_lro.h 3.3 KB

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