cdp_txrx_sawf.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. 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. #ifndef _CDP_TXRX_SAWF_H_
  19. #define _CDP_TXRX_SAWF_H_
  20. static inline QDF_STATUS
  21. cdp_sawf_peer_svcid_map(ol_txrx_soc_handle soc,
  22. uint8_t *mac, uint8_t svc_id)
  23. {
  24. if (!soc || !soc->ops) {
  25. dp_cdp_debug("Invalid Instance");
  26. QDF_BUG(0);
  27. return QDF_STATUS_E_FAILURE;
  28. }
  29. if (!soc->ops->sawf_ops ||
  30. !soc->ops->sawf_ops->sawf_def_queues_map_req) {
  31. return QDF_STATUS_E_FAILURE;
  32. }
  33. return soc->ops->sawf_ops->sawf_def_queues_map_req(soc, mac, svc_id);
  34. }
  35. static inline QDF_STATUS
  36. cdp_sawf_peer_unmap(ol_txrx_soc_handle soc,
  37. uint8_t *mac, uint8_t svc_id)
  38. {
  39. if (!soc || !soc->ops) {
  40. dp_cdp_debug("Invalid Instance");
  41. QDF_BUG(0);
  42. return QDF_STATUS_E_FAILURE;
  43. }
  44. if (!soc->ops->sawf_ops ||
  45. !soc->ops->sawf_ops->sawf_def_queues_unmap_req) {
  46. return QDF_STATUS_E_FAILURE;
  47. }
  48. return soc->ops->sawf_ops->sawf_def_queues_unmap_req(soc, mac, svc_id);
  49. }
  50. static inline QDF_STATUS
  51. cdp_sawf_peer_get_map_conf(ol_txrx_soc_handle soc,
  52. uint8_t *mac)
  53. {
  54. if (!soc || !soc->ops) {
  55. dp_cdp_debug("Invalid Instance");
  56. QDF_BUG(0);
  57. return QDF_STATUS_E_FAILURE;
  58. }
  59. if (!soc->ops->sawf_ops ||
  60. !soc->ops->sawf_ops->sawf_def_queues_get_map_report) {
  61. return QDF_STATUS_E_FAILURE;
  62. }
  63. return soc->ops->sawf_ops->sawf_def_queues_get_map_report(soc, mac);
  64. }
  65. #ifdef CONFIG_SAWF
  66. /**
  67. * cdp_get_peer_sawf_delay_stats() - Call to get SAWF delay stats
  68. * @soc: soc handle
  69. * @svc_class_id: service class ID
  70. * @mac: peer mac addrees
  71. * @data: opaque pointer
  72. *
  73. * return: status Success/Failure
  74. */
  75. static inline QDF_STATUS
  76. cdp_get_peer_sawf_delay_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  77. uint8_t *mac, void *data)
  78. {
  79. if (!soc || !soc->ops) {
  80. dp_cdp_debug("Invalid Instance");
  81. QDF_BUG(0);
  82. return QDF_STATUS_E_FAILURE;
  83. }
  84. if (!soc->ops->sawf_ops ||
  85. !soc->ops->sawf_ops->txrx_get_peer_sawf_delay_stats)
  86. return QDF_STATUS_E_FAILURE;
  87. return soc->ops->sawf_ops->txrx_get_peer_sawf_delay_stats(soc, svc_id,
  88. mac, data);
  89. }
  90. /**
  91. * cdp_get_peer_sawf_tx_stats() - Call to get SAWF Tx stats
  92. * @soc: soc handle
  93. * @svc_class_id: service class ID
  94. * @mac: peer mac addrees
  95. * @data: opaque pointer
  96. *
  97. * return: status Success/Failure
  98. */
  99. static inline QDF_STATUS
  100. cdp_get_peer_sawf_tx_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  101. uint8_t *mac, void *data)
  102. {
  103. if (!soc || !soc->ops) {
  104. dp_cdp_debug("Invalid Instance");
  105. QDF_BUG(0);
  106. return QDF_STATUS_E_FAILURE;
  107. }
  108. if (!soc->ops->sawf_ops ||
  109. !soc->ops->sawf_ops->txrx_get_peer_sawf_tx_stats)
  110. return QDF_STATUS_E_FAILURE;
  111. return soc->ops->sawf_ops->txrx_get_peer_sawf_tx_stats(soc, svc_id,
  112. mac, data);
  113. }
  114. /**
  115. * cdp_sawf_mpdu_stats_req() - Call to subscribe to MPDU stats TLV
  116. * @soc: soc handle
  117. * @enable: 1: enable 0: disable
  118. *
  119. * return: status Success/Failure
  120. */
  121. static inline QDF_STATUS
  122. cdp_sawf_mpdu_stats_req(ol_txrx_soc_handle soc, uint8_t enable)
  123. {
  124. if (!soc || !soc->ops) {
  125. dp_cdp_debug("Invalid Instance");
  126. QDF_BUG(0);
  127. return QDF_STATUS_E_FAILURE;
  128. }
  129. if (!soc->ops->sawf_ops ||
  130. !soc->ops->sawf_ops->sawf_mpdu_stats_req)
  131. return QDF_STATUS_E_FAILURE;
  132. return soc->ops->sawf_ops->sawf_mpdu_stats_req(soc, enable);
  133. }
  134. /**
  135. * cdp_sawf_mpdu_details_stats_req - Call to subscribe to MPDU details stats TLV
  136. * @soc: soc handle
  137. * @enable: 1: enable 0: disable
  138. *
  139. * return: status Success/Failure
  140. */
  141. static inline QDF_STATUS
  142. cdp_sawf_mpdu_details_stats_req(ol_txrx_soc_handle soc, uint8_t enable)
  143. {
  144. if (!soc || !soc->ops) {
  145. dp_cdp_debug("Invalid Instance");
  146. QDF_BUG(0);
  147. return QDF_STATUS_E_FAILURE;
  148. }
  149. if (!soc->ops->sawf_ops ||
  150. !soc->ops->sawf_ops->sawf_mpdu_details_stats_req)
  151. return QDF_STATUS_E_FAILURE;
  152. return soc->ops->sawf_ops->sawf_mpdu_details_stats_req(soc, enable);
  153. }
  154. /**
  155. * cdp_sawf_set_mov_avg_params - Set moving average pararms
  156. * @num_pkt: No of packets per window to calucalte moving average
  157. * @num_win: No of windows to calucalte moving average
  158. *
  159. * Return: QDF_STATUS
  160. */
  161. static inline QDF_STATUS
  162. cdp_sawf_set_mov_avg_params(ol_txrx_soc_handle soc,
  163. uint32_t num_pkt,
  164. uint32_t num_win)
  165. {
  166. if (!soc || !soc->ops) {
  167. dp_cdp_debug("Invalid Instance");
  168. QDF_BUG(0);
  169. return QDF_STATUS_E_FAILURE;
  170. }
  171. if (!soc->ops->sawf_ops ||
  172. !soc->ops->sawf_ops->txrx_sawf_set_mov_avg_params)
  173. return QDF_STATUS_E_FAILURE;
  174. return soc->ops->sawf_ops->txrx_sawf_set_mov_avg_params(num_pkt,
  175. num_win);
  176. }
  177. /**
  178. * cdp_sawf_set_sla_params - Set SLA pararms
  179. * @num_pkt: No of packets to detect SLA breach
  180. * @time_secs: Time ins secs to detect breach
  181. *
  182. * Return: QDF_STATUS
  183. */
  184. static inline QDF_STATUS
  185. cdp_sawf_set_sla_params(ol_txrx_soc_handle soc,
  186. uint32_t num_pkt,
  187. uint32_t time_secs)
  188. {
  189. if (!soc || !soc->ops) {
  190. dp_cdp_debug("Invalid Instance");
  191. QDF_BUG(0);
  192. return QDF_STATUS_E_FAILURE;
  193. }
  194. if (!soc->ops->sawf_ops ||
  195. !soc->ops->sawf_ops->txrx_sawf_set_sla_params)
  196. return QDF_STATUS_E_FAILURE;
  197. return soc->ops->sawf_ops->txrx_sawf_set_sla_params(num_pkt,
  198. time_secs);
  199. }
  200. /**
  201. * cdp_sawf_init_telemetry_param - Initialize telemetry pararms
  202. *
  203. * Return: none
  204. */
  205. static inline QDF_STATUS
  206. cdp_sawf_init_telemtery_params(ol_txrx_soc_handle soc)
  207. {
  208. if (!soc || !soc->ops) {
  209. dp_cdp_debug("Invalid Instance");
  210. QDF_BUG(0);
  211. return QDF_STATUS_E_FAILURE;
  212. }
  213. if (!soc->ops->sawf_ops ||
  214. !soc->ops->sawf_ops->txrx_sawf_init_telemtery_params)
  215. return QDF_STATUS_E_FAILURE;
  216. return soc->ops->sawf_ops->txrx_sawf_init_telemtery_params();
  217. }
  218. #else
  219. static inline QDF_STATUS
  220. cdp_get_peer_sawf_delay_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  221. uint8_t *mac, void *data)
  222. {
  223. return QDF_STATUS_E_FAILURE;
  224. }
  225. static inline QDF_STATUS
  226. cdp_get_peer_sawf_tx_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  227. uint8_t *mac, void *data)
  228. {
  229. return QDF_STATUS_E_FAILURE;
  230. }
  231. #endif
  232. #endif /* _CDP_TXRX_SAWF_H_ */