cdp_txrx_mon.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. /*
  2. * Copyright (c) 2016-2019 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. * @file cdp_txrx_mon.h
  20. * @brief Define the monitor mode API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_MON_H_
  24. #define _CDP_TXRX_MON_H_
  25. #include "cdp_txrx_handle.h"
  26. static inline void cdp_monitor_set_filter_ucast_data
  27. (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
  28. {
  29. if (!soc || !soc->ops) {
  30. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  31. "%s: Invalid Instance", __func__);
  32. QDF_BUG(0);
  33. return;
  34. }
  35. if (!soc->ops->mon_ops ||
  36. !soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data)
  37. return;
  38. soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data
  39. (pdev, val);
  40. }
  41. static inline void cdp_monitor_set_filter_mcast_data
  42. (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
  43. {
  44. if (!soc || !soc->ops) {
  45. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  46. "%s: Invalid Instance", __func__);
  47. QDF_BUG(0);
  48. return;
  49. }
  50. if (!soc->ops->mon_ops ||
  51. !soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data)
  52. return;
  53. soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data
  54. (pdev, val);
  55. }
  56. static inline void cdp_monitor_set_filter_non_data
  57. (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val)
  58. {
  59. if (!soc || !soc->ops) {
  60. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  61. "%s: Invalid Instance", __func__);
  62. QDF_BUG(0);
  63. return;
  64. }
  65. if (!soc->ops->mon_ops ||
  66. !soc->ops->mon_ops->txrx_monitor_set_filter_non_data)
  67. return;
  68. soc->ops->mon_ops->txrx_monitor_set_filter_non_data
  69. (pdev, val);
  70. }
  71. static inline bool cdp_monitor_get_filter_ucast_data
  72. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
  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->mon_ops ||
  81. !soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data)
  82. return 0;
  83. return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data
  84. (vdev_txrx_handle);
  85. }
  86. static inline bool cdp_monitor_get_filter_mcast_data
  87. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
  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 0;
  94. }
  95. if (!soc->ops->mon_ops ||
  96. !soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data)
  97. return 0;
  98. return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data
  99. (vdev_txrx_handle);
  100. }
  101. static inline bool cdp_monitor_get_filter_non_data
  102. (ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle)
  103. {
  104. if (!soc || !soc->ops) {
  105. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  106. "%s: Invalid Instance", __func__);
  107. QDF_BUG(0);
  108. return 0;
  109. }
  110. if (!soc->ops->mon_ops ||
  111. !soc->ops->mon_ops->txrx_monitor_get_filter_non_data)
  112. return 0;
  113. return soc->ops->mon_ops->txrx_monitor_get_filter_non_data
  114. (vdev_txrx_handle);
  115. }
  116. static inline QDF_STATUS cdp_reset_monitor_mode
  117. (ol_txrx_soc_handle soc, struct cdp_pdev *pdev)
  118. {
  119. if (!soc || !soc->ops) {
  120. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  121. "%s: Invalid Instance", __func__);
  122. QDF_BUG(0);
  123. return 0;
  124. }
  125. if (!soc->ops->mon_ops ||
  126. !soc->ops->mon_ops->txrx_reset_monitor_mode)
  127. return 0;
  128. return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev);
  129. }
  130. static inline void cdp_record_monitor_chan_num
  131. (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, int chan_num)
  132. {
  133. if (!soc || !soc->ops) {
  134. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  135. "%s: Invalid Instance", __func__);
  136. QDF_BUG(0);
  137. return;
  138. }
  139. if (!soc->ops->mon_ops ||
  140. !soc->ops->mon_ops->txrx_monitor_record_channel)
  141. return;
  142. soc->ops->mon_ops->txrx_monitor_record_channel(pdev, chan_num);
  143. }
  144. /**
  145. * cdp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
  146. * @soc: Datapath SOC handle
  147. * @pdev: Datapath PDEV handle
  148. * @nbuf: Management frame buffer
  149. */
  150. static inline void
  151. cdp_deliver_tx_mgmt(ol_txrx_soc_handle soc, struct cdp_pdev *pdev,
  152. qdf_nbuf_t nbuf)
  153. {
  154. if (!soc || !soc->ops) {
  155. QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
  156. "%s: Invalid Instance", __func__);
  157. QDF_BUG(0);
  158. return;
  159. }
  160. if (!soc->ops->mon_ops ||
  161. !soc->ops->mon_ops->txrx_deliver_tx_mgmt)
  162. return;
  163. soc->ops->mon_ops->txrx_deliver_tx_mgmt(pdev, nbuf);
  164. }
  165. #endif