i_qdf_nbuf_api_m.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * Copyright (c) 2014-2017,2019-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021 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: i_qdf_nbuf_api_m.h
  21. *
  22. * Platform specific qdf_nbuf_public network buffer API
  23. * This file defines the network buffer abstraction.
  24. * Included by qdf_nbuf.h and should not be included
  25. * directly from other files.
  26. */
  27. #ifndef _QDF_NBUF_M_H
  28. #define _QDF_NBUF_M_H
  29. static inline int qdf_nbuf_ipa_owned_get(qdf_nbuf_t buf)
  30. {
  31. return __qdf_nbuf_ipa_owned_get(buf);
  32. }
  33. static inline void qdf_nbuf_ipa_owned_set(qdf_nbuf_t buf)
  34. {
  35. __qdf_nbuf_ipa_owned_set(buf);
  36. }
  37. static inline void qdf_nbuf_ipa_owned_clear(qdf_nbuf_t buf)
  38. {
  39. __qdf_nbuf_ipa_owned_clear(buf);
  40. }
  41. static inline int qdf_nbuf_ipa_priv_get(qdf_nbuf_t buf)
  42. {
  43. return __qdf_nbuf_ipa_priv_get(buf);
  44. }
  45. static inline void qdf_nbuf_ipa_priv_set(qdf_nbuf_t buf, uint32_t priv)
  46. {
  47. QDF_BUG(!(priv & QDF_NBUF_IPA_CHECK_MASK));
  48. __qdf_nbuf_ipa_priv_set(buf, priv);
  49. }
  50. static inline void qdf_nbuf_tx_notify_comp_set(qdf_nbuf_t buf, uint8_t val)
  51. {
  52. QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf) = val;
  53. }
  54. static inline uint8_t qdf_nbuf_tx_notify_comp_get(qdf_nbuf_t buf)
  55. {
  56. return QDF_NBUF_CB_TX_EXTRA_FRAG_FLAGS_NOTIFY_COMP(buf);
  57. }
  58. /**
  59. * qdf_nbuf_set_rx_protocol_tag()
  60. * @buf: Network buffer
  61. * @val: Value to be set in the nbuf
  62. * Return: None
  63. */
  64. static inline void qdf_nbuf_set_rx_protocol_tag(qdf_nbuf_t buf, uint16_t val)
  65. {
  66. }
  67. /**
  68. * qdf_nbuf_get_rx_protocol_tag()
  69. * @buf: Network buffer
  70. * Return: Value of rx protocol tag, here 0
  71. */
  72. static inline uint16_t qdf_nbuf_get_rx_protocol_tag(qdf_nbuf_t buf)
  73. {
  74. return 0;
  75. }
  76. /**
  77. * qdf_nbuf_set_rx_flow_tag() - set given value in flow tag field
  78. * of buf(skb->cb)
  79. * @buf: Network buffer
  80. * @val: Rx Flow Tag to be set in the nbuf
  81. * Return: None
  82. */
  83. static inline void qdf_nbuf_set_rx_flow_tag(qdf_nbuf_t buf, uint16_t val)
  84. {
  85. }
  86. /**
  87. * qdf_nbuf_get_rx_flow_tag() - Get the value of flow_tag
  88. * field of buf(skb->cb)
  89. * @buf: Network buffer
  90. * Return: Value of rx flow tag, here 0
  91. */
  92. static inline uint16_t qdf_nbuf_get_rx_flow_tag(qdf_nbuf_t buf)
  93. {
  94. return 0;
  95. }
  96. /**
  97. * qdf_nbuf_set_exc_frame() - set exception frame flag
  98. * @buf: Network buffer whose cb is to set exception frame flag
  99. * @value: exception frame flag, value 0 or 1.
  100. *
  101. * Return: none
  102. */
  103. static inline void qdf_nbuf_set_exc_frame(qdf_nbuf_t buf, uint8_t value)
  104. {
  105. QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf) = value;
  106. }
  107. /**
  108. * qdf_nbuf_is_exc_frame() - check exception frame flag bit
  109. * @buf: Network buffer to get exception flag
  110. *
  111. * Return: 0 or 1
  112. */
  113. static inline uint8_t qdf_nbuf_is_exc_frame(qdf_nbuf_t buf)
  114. {
  115. return QDF_NBUF_CB_RX_PACKET_EXC_FRAME(buf);
  116. }
  117. /**
  118. * qdf_nbuf_set_rx_ipa_smmu_map() - set ipa smmu mapped flag
  119. * @buf: Network buffer
  120. * @value: 1 - ipa smmu mapped, 0 - ipa smmu unmapped
  121. *
  122. * Return: none
  123. */
  124. static inline void qdf_nbuf_set_rx_ipa_smmu_map(qdf_nbuf_t buf,
  125. uint8_t value)
  126. {
  127. QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf) = value;
  128. }
  129. /**
  130. * qdf_nbuf_is_rx_ipa_smmu_map() - check ipa smmu map flag
  131. * @buf: Network buffer
  132. *
  133. * Return 0 or 1
  134. */
  135. static inline uint8_t qdf_nbuf_is_rx_ipa_smmu_map(qdf_nbuf_t buf)
  136. {
  137. return QDF_NBUF_CB_RX_PACKET_IPA_SMMU_MAP(buf);
  138. }
  139. /**
  140. * qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt() - set reo destination indication
  141. or sw exception flag
  142. * @buf: Network buffer
  143. * @value: value to set
  144. *
  145. * Return: none
  146. */
  147. static inline void qdf_nbuf_set_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf,
  148. uint8_t value)
  149. {
  150. QDF_NBUF_CB_RX_PACKET_REO_DEST_IND_OR_SW_EXCPT(buf) = value;
  151. }
  152. /**
  153. * qdf_nbuf_get_rx_reo_dest_ind_or_sw_excpt() - get reo destination indication
  154. or sw exception flag
  155. * @buf: Network buffer
  156. *
  157. * Return reo destination indication value (0 ~ 31) or sw exception (0 ~ 1)
  158. */
  159. static inline uint8_t qdf_nbuf_get_rx_reo_dest_ind_or_sw_excpt(qdf_nbuf_t buf)
  160. {
  161. return QDF_NBUF_CB_RX_PACKET_REO_DEST_IND_OR_SW_EXCPT(buf);
  162. }
  163. /**
  164. * qdf_nbuf_get_tx_fctx() - get fctx of nbuf
  165. *
  166. * @buf: Network buffer
  167. * Return: fctx value
  168. */
  169. static inline void *qdf_nbuf_get_tx_fctx(qdf_nbuf_t buf)
  170. {
  171. return NULL;
  172. }
  173. /**
  174. * qdf_nbuf_set_tx_fctx_type() - set ftype and fctx
  175. *
  176. * @buf: Network buffer
  177. * @ctx: address to fctx
  178. * @type: ftype
  179. *
  180. * Return: void
  181. */
  182. static inline void
  183. qdf_nbuf_set_tx_fctx_type(qdf_nbuf_t buf, void *ctx, uint8_t type)
  184. {
  185. }
  186. #endif /* _QDF_NBUF_M_H */