cdp_txrx_me.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /**
  27. * @file cdp_txrx_me.h
  28. * @brief Define the host data path mcast enhance API functions
  29. * called by the host control SW and the OS interface module
  30. */
  31. #ifndef _CDP_TXRX_ME_H_
  32. #define _CDP_TXRX_ME_H_
  33. #include <cdp_txrx_ops.h>
  34. /* TODO: adf need to be replaced with qdf */
  35. #include "cdp_txrx_handle.h"
  36. static inline u_int16_t
  37. cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc,
  38. struct cdp_pdev *pdev, u_int16_t buf_count)
  39. {
  40. if (!soc || !soc->ops) {
  41. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  42. "%s: Invalid Instance", __func__);
  43. QDF_BUG(0);
  44. return 0;
  45. }
  46. if (!soc->ops->me_ops ||
  47. !soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone)
  48. return 0;
  49. return soc->ops->me_ops->
  50. tx_desc_alloc_and_mark_for_mcast_clone
  51. (pdev, buf_count);
  52. }
  53. static inline u_int16_t
  54. cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc,
  55. struct cdp_pdev *pdev, u_int16_t buf_count)
  56. {
  57. if (!soc || !soc->ops) {
  58. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  59. "%s: Invalid Instance", __func__);
  60. QDF_BUG(0);
  61. return 0;
  62. }
  63. if (!soc->ops->me_ops ||
  64. !soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone)
  65. return 0;
  66. return soc->ops->me_ops->
  67. tx_desc_free_and_unmark_for_mcast_clone
  68. (pdev, buf_count);
  69. }
  70. static inline u_int16_t
  71. cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc,
  72. struct cdp_pdev *pdev)
  73. {
  74. if (!soc || !soc->ops) {
  75. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  76. "%s: Invalid Instance", __func__);
  77. QDF_BUG(0);
  78. return 0;
  79. }
  80. if (!soc->ops->me_ops ||
  81. !soc->ops->me_ops->tx_get_mcast_buf_allocated_marked)
  82. return 0;
  83. return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked
  84. (pdev);
  85. }
  86. static inline void
  87. cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  88. {
  89. if (!soc || !soc->ops) {
  90. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  91. "%s: Invalid Instance", __func__);
  92. QDF_BUG(0);
  93. return;
  94. }
  95. if (!soc->ops->me_ops ||
  96. !soc->ops->me_ops->tx_me_alloc_descriptor)
  97. return;
  98. soc->ops->me_ops->tx_me_alloc_descriptor(pdev);
  99. }
  100. static inline void
  101. cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  102. {
  103. if (!soc || !soc->ops) {
  104. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  105. "%s: Invalid Instance", __func__);
  106. QDF_BUG(0);
  107. return;
  108. }
  109. if (!soc->ops->me_ops ||
  110. !soc->ops->me_ops->tx_me_free_descriptor)
  111. return;
  112. soc->ops->me_ops->tx_me_free_descriptor(pdev);
  113. }
  114. static inline uint16_t
  115. cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
  116. qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt)
  117. {
  118. if (!soc || !soc->ops) {
  119. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  120. "%s: Invalid Instance", __func__);
  121. QDF_BUG(0);
  122. return 0;
  123. }
  124. if (!soc->ops->me_ops ||
  125. !soc->ops->me_ops->tx_me_convert_ucast)
  126. return 0;
  127. return soc->ops->me_ops->tx_me_convert_ucast
  128. (vdev, wbuf, newmac, newmaccnt);
  129. }
  130. /* Should be a function pointer in ol_txrx_osif_ops{} */
  131. /**
  132. * @brief notify mcast frame indication from FW.
  133. * @details
  134. * This notification will be used to convert
  135. * multicast frame to unicast.
  136. *
  137. * @param pdev - handle to the ctrl SW's physical device object
  138. * @param vdev_id - ID of the virtual device received the special data
  139. * @param msdu - the multicast msdu returned by FW for host inspect
  140. */
  141. static inline int cdp_mcast_notify(ol_txrx_soc_handle soc,
  142. struct cdp_pdev *pdev, u_int8_t vdev_id, qdf_nbuf_t msdu)
  143. {
  144. if (!soc || !soc->ops) {
  145. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  146. "%s: Invalid Instance", __func__);
  147. QDF_BUG(0);
  148. return 0;
  149. }
  150. if (!soc->ops->me_ops ||
  151. !soc->ops->me_ops->mcast_notify)
  152. return 0;
  153. return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu);
  154. }
  155. #endif