cdp_txrx_mon.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 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. * @file cdp_txrx_mon.h
  21. * @brief Define the monitor mode API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_MON_H_
  25. #define _CDP_TXRX_MON_H_
  26. #include "cdp_txrx_handle.h"
  27. #include <cdp_txrx_cmn.h>
  28. static inline QDF_STATUS cdp_reset_monitor_mode(ol_txrx_soc_handle soc,
  29. uint8_t pdev_id,
  30. u_int8_t smart_monitor)
  31. {
  32. if (!soc || !soc->ops) {
  33. dp_cdp_debug("Invalid Instance");
  34. QDF_BUG(0);
  35. return 0;
  36. }
  37. if (!soc->ops->mon_ops ||
  38. !soc->ops->mon_ops->txrx_reset_monitor_mode)
  39. return 0;
  40. return soc->ops->mon_ops->txrx_reset_monitor_mode(soc, pdev_id,
  41. smart_monitor);
  42. }
  43. /**
  44. * cdp_deliver_tx_mgmt() - Deliver mgmt frame for tx capture
  45. * @soc: Datapath SOC handle
  46. * @pdev_id: id of datapath PDEV handle
  47. * @nbuf: Management frame buffer
  48. */
  49. static inline QDF_STATUS
  50. cdp_deliver_tx_mgmt(ol_txrx_soc_handle soc, uint8_t pdev_id,
  51. qdf_nbuf_t nbuf)
  52. {
  53. if (!soc || !soc->ops) {
  54. dp_cdp_debug("Invalid Instance");
  55. QDF_BUG(0);
  56. return QDF_STATUS_E_FAILURE;
  57. }
  58. if (!soc->ops->mon_ops ||
  59. !soc->ops->mon_ops->txrx_deliver_tx_mgmt)
  60. return QDF_STATUS_E_FAILURE;
  61. return soc->ops->mon_ops->txrx_deliver_tx_mgmt(soc, pdev_id, nbuf);
  62. }
  63. #ifdef QCA_SUPPORT_LITE_MONITOR
  64. /*
  65. * cdp_set_lite_mon_config() - Set lite monitor config/filter
  66. *
  67. *@soc: dp soc handle
  68. *@config: lite monitor config
  69. *@pdev_id: pdev id
  70. *
  71. * This API is used to enable/disable lite monitor feature
  72. *
  73. * Return: QDF_STATUS_SUCCESS if value set successfully
  74. * QDF_STATUS_E_INVAL false if error
  75. */
  76. static inline QDF_STATUS
  77. cdp_set_lite_mon_config(ol_txrx_soc_handle soc,
  78. struct cdp_lite_mon_filter_config *config,
  79. uint8_t pdev_id)
  80. {
  81. if (!soc || !soc->ops) {
  82. dp_cdp_debug("Invalid Instance");
  83. return QDF_STATUS_E_INVAL;
  84. }
  85. if (!soc->ops->mon_ops ||
  86. !soc->ops->mon_ops->txrx_set_lite_mon_config)
  87. return QDF_STATUS_E_INVAL;
  88. return soc->ops->mon_ops->txrx_set_lite_mon_config(soc, config,
  89. pdev_id);
  90. }
  91. /*
  92. * cdp_get_lite_mon_config() - Get lite monitor config
  93. *
  94. *@soc: dp soc handle
  95. *@config: lite monitor config
  96. *@pdev_id: pdev id
  97. *
  98. * This API is used to get lite monitor feature config
  99. *
  100. * Return: QDF_STATUS_SUCCESS if get is successfully
  101. * QDF_STATUS_E_INVAL false if error
  102. */
  103. static inline QDF_STATUS
  104. cdp_get_lite_mon_config(ol_txrx_soc_handle soc,
  105. struct cdp_lite_mon_filter_config *config,
  106. uint8_t pdev_id)
  107. {
  108. if (!soc || !soc->ops) {
  109. dp_cdp_debug("Invalid Instance");
  110. return QDF_STATUS_E_INVAL;
  111. }
  112. if (!soc->ops->mon_ops ||
  113. !soc->ops->mon_ops->txrx_get_lite_mon_config)
  114. return QDF_STATUS_E_INVAL;
  115. return soc->ops->mon_ops->txrx_get_lite_mon_config(soc, config,
  116. pdev_id);
  117. }
  118. /*
  119. * cdp_set_lite_mon_peer_config() - Set lite monitor peer config
  120. *
  121. *@soc: dp soc handle
  122. *@config: lite monitor peer config
  123. *@pdev_id: pdev id
  124. *
  125. * This API is used to add/del lite monitor peers
  126. *
  127. * Return: QDF_STATUS_SUCCESS if value set successfully
  128. * QDF_STATUS_E_INVAL false if error
  129. */
  130. static inline QDF_STATUS
  131. cdp_set_lite_mon_peer_config(ol_txrx_soc_handle soc,
  132. struct cdp_lite_mon_peer_config *config,
  133. uint8_t pdev_id)
  134. {
  135. if (!soc || !soc->ops) {
  136. dp_cdp_debug("Invalid Instance");
  137. return QDF_STATUS_E_INVAL;
  138. }
  139. if (!soc->ops->mon_ops ||
  140. !soc->ops->mon_ops->txrx_set_lite_mon_peer_config)
  141. return QDF_STATUS_E_INVAL;
  142. return soc->ops->mon_ops->txrx_set_lite_mon_peer_config(soc, config,
  143. pdev_id);
  144. }
  145. /*
  146. * cdp_get_lite_mon_peer_config() - Get lite monitor peer list
  147. *
  148. *@soc: dp soc handle
  149. *@info: lite monitor peer info
  150. *@pdev_id: pdev id
  151. *
  152. * This API is used to get lite monitor peers
  153. *
  154. * Return: QDF_STATUS_SUCCESS if value set successfully
  155. * QDF_STATUS_E_INVAL false if error
  156. */
  157. static inline QDF_STATUS
  158. cdp_get_lite_mon_peer_config(ol_txrx_soc_handle soc,
  159. struct cdp_lite_mon_peer_info *info,
  160. uint8_t pdev_id)
  161. {
  162. if (!soc || !soc->ops) {
  163. dp_cdp_debug("Invalid Instance");
  164. return QDF_STATUS_E_INVAL;
  165. }
  166. if (!soc->ops->mon_ops ||
  167. !soc->ops->mon_ops->txrx_get_lite_mon_peer_config)
  168. return QDF_STATUS_E_INVAL;
  169. return soc->ops->mon_ops->txrx_get_lite_mon_peer_config(soc, info,
  170. pdev_id);
  171. }
  172. /*
  173. * cdp_is_lite_mon_enabled() - Get lite monitor enable status
  174. *
  175. *@soc: dp soc handle
  176. *@pdev_id: pdev id
  177. *@dir: direction tx/rx
  178. *
  179. * This API is used to get lite monitor enable status
  180. *
  181. * Return: 0 if disabled
  182. * 1 if enabled
  183. */
  184. static inline int
  185. cdp_is_lite_mon_enabled(ol_txrx_soc_handle soc,
  186. uint8_t pdev_id, uint8_t dir)
  187. {
  188. if (!soc || !soc->ops) {
  189. dp_cdp_debug("Invalid Instance");
  190. return 0;
  191. }
  192. if (!soc->ops->mon_ops ||
  193. !soc->ops->mon_ops->txrx_is_lite_mon_enabled)
  194. return 0;
  195. return soc->ops->mon_ops->txrx_is_lite_mon_enabled(soc, pdev_id, dir);
  196. }
  197. #endif
  198. #endif