cdp_txrx_sawf.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  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. #include <cdp_txrx_cmn_struct.h>
  21. #include <cdp_txrx_cmn.h>
  22. static inline QDF_STATUS
  23. cdp_sawf_peer_svcid_map(ol_txrx_soc_handle soc,
  24. uint8_t *mac, uint8_t svc_id)
  25. {
  26. if (!soc || !soc->ops) {
  27. dp_cdp_debug("Invalid Instance");
  28. QDF_BUG(0);
  29. return QDF_STATUS_E_FAILURE;
  30. }
  31. if (!soc->ops->sawf_ops ||
  32. !soc->ops->sawf_ops->sawf_def_queues_map_req) {
  33. return QDF_STATUS_E_FAILURE;
  34. }
  35. return soc->ops->sawf_ops->sawf_def_queues_map_req(soc, mac, svc_id);
  36. }
  37. static inline QDF_STATUS
  38. cdp_sawf_peer_unmap(ol_txrx_soc_handle soc,
  39. uint8_t *mac, uint8_t svc_id)
  40. {
  41. if (!soc || !soc->ops) {
  42. dp_cdp_debug("Invalid Instance");
  43. QDF_BUG(0);
  44. return QDF_STATUS_E_FAILURE;
  45. }
  46. if (!soc->ops->sawf_ops ||
  47. !soc->ops->sawf_ops->sawf_def_queues_unmap_req) {
  48. return QDF_STATUS_E_FAILURE;
  49. }
  50. return soc->ops->sawf_ops->sawf_def_queues_unmap_req(soc, mac, svc_id);
  51. }
  52. static inline QDF_STATUS
  53. cdp_sawf_peer_get_map_conf(ol_txrx_soc_handle soc,
  54. uint8_t *mac)
  55. {
  56. if (!soc || !soc->ops) {
  57. dp_cdp_debug("Invalid Instance");
  58. QDF_BUG(0);
  59. return QDF_STATUS_E_FAILURE;
  60. }
  61. if (!soc->ops->sawf_ops ||
  62. !soc->ops->sawf_ops->sawf_def_queues_get_map_report) {
  63. return QDF_STATUS_E_FAILURE;
  64. }
  65. return soc->ops->sawf_ops->sawf_def_queues_get_map_report(soc, mac);
  66. }
  67. #ifdef CONFIG_SAWF
  68. /**
  69. * cdp_get_peer_sawf_delay_stats() - Call to get SAWF delay stats
  70. * @soc: soc handle
  71. * @svc_class_id: service class ID
  72. * @mac: peer mac addrees
  73. * @data: opaque pointer
  74. *
  75. * return: status Success/Failure
  76. */
  77. static inline QDF_STATUS
  78. cdp_get_peer_sawf_delay_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  79. uint8_t *mac, void *data)
  80. {
  81. if (!soc || !soc->ops) {
  82. dp_cdp_debug("Invalid Instance");
  83. QDF_BUG(0);
  84. return QDF_STATUS_E_FAILURE;
  85. }
  86. if (!soc->ops->sawf_ops ||
  87. !soc->ops->sawf_ops->txrx_get_peer_sawf_delay_stats)
  88. return QDF_STATUS_E_FAILURE;
  89. return soc->ops->sawf_ops->txrx_get_peer_sawf_delay_stats(soc, svc_id,
  90. mac, data);
  91. }
  92. /**
  93. * cdp_get_peer_sawf_tx_stats() - Call to get SAWF Tx stats
  94. * @soc: soc handle
  95. * @svc_class_id: service class ID
  96. * @mac: peer mac addrees
  97. * @data: opaque pointer
  98. *
  99. * return: status Success/Failure
  100. */
  101. static inline QDF_STATUS
  102. cdp_get_peer_sawf_tx_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  103. uint8_t *mac, void *data)
  104. {
  105. if (!soc || !soc->ops) {
  106. dp_cdp_debug("Invalid Instance");
  107. QDF_BUG(0);
  108. return QDF_STATUS_E_FAILURE;
  109. }
  110. if (!soc->ops->sawf_ops ||
  111. !soc->ops->sawf_ops->txrx_get_peer_sawf_tx_stats)
  112. return QDF_STATUS_E_FAILURE;
  113. return soc->ops->sawf_ops->txrx_get_peer_sawf_tx_stats(soc, svc_id,
  114. mac, data);
  115. }
  116. /**
  117. * cdp_sawf_mpdu_stats_req() - Call to subscribe to MPDU stats TLV
  118. * @soc: soc handle
  119. * @enable: 1: enable 0: disable
  120. *
  121. * return: status Success/Failure
  122. */
  123. static inline QDF_STATUS
  124. cdp_sawf_mpdu_stats_req(ol_txrx_soc_handle soc, uint8_t enable)
  125. {
  126. if (!soc || !soc->ops) {
  127. dp_cdp_debug("Invalid Instance");
  128. QDF_BUG(0);
  129. return QDF_STATUS_E_FAILURE;
  130. }
  131. if (!soc->ops->sawf_ops ||
  132. !soc->ops->sawf_ops->sawf_mpdu_stats_req)
  133. return QDF_STATUS_E_FAILURE;
  134. return soc->ops->sawf_ops->sawf_mpdu_stats_req(soc, enable);
  135. }
  136. /**
  137. * cdp_sawf_mpdu_details_stats_req - Call to subscribe to MPDU details stats TLV
  138. * @soc: soc handle
  139. * @enable: 1: enable 0: disable
  140. *
  141. * return: status Success/Failure
  142. */
  143. static inline QDF_STATUS
  144. cdp_sawf_mpdu_details_stats_req(ol_txrx_soc_handle soc, uint8_t enable)
  145. {
  146. if (!soc || !soc->ops) {
  147. dp_cdp_debug("Invalid Instance");
  148. QDF_BUG(0);
  149. return QDF_STATUS_E_FAILURE;
  150. }
  151. if (!soc->ops->sawf_ops ||
  152. !soc->ops->sawf_ops->sawf_mpdu_details_stats_req)
  153. return QDF_STATUS_E_FAILURE;
  154. return soc->ops->sawf_ops->sawf_mpdu_details_stats_req(soc, enable);
  155. }
  156. /**
  157. * cdp_sawf_set_mov_avg_params - Set moving average pararms
  158. * @num_pkt: No of packets per window to calucalte moving average
  159. * @num_win: No of windows to calucalte moving average
  160. *
  161. * Return: QDF_STATUS
  162. */
  163. static inline QDF_STATUS
  164. cdp_sawf_set_mov_avg_params(ol_txrx_soc_handle soc,
  165. uint32_t num_pkt,
  166. uint32_t num_win)
  167. {
  168. if (!soc || !soc->ops) {
  169. dp_cdp_debug("Invalid Instance");
  170. QDF_BUG(0);
  171. return QDF_STATUS_E_FAILURE;
  172. }
  173. if (!soc->ops->sawf_ops ||
  174. !soc->ops->sawf_ops->txrx_sawf_set_mov_avg_params)
  175. return QDF_STATUS_E_FAILURE;
  176. return soc->ops->sawf_ops->txrx_sawf_set_mov_avg_params(num_pkt,
  177. num_win);
  178. }
  179. /**
  180. * cdp_sawf_set_sla_params - Set SLA pararms
  181. * @num_pkt: No of packets to detect SLA breach
  182. * @time_secs: Time ins secs to detect breach
  183. *
  184. * Return: QDF_STATUS
  185. */
  186. static inline QDF_STATUS
  187. cdp_sawf_set_sla_params(ol_txrx_soc_handle soc,
  188. uint32_t num_pkt,
  189. uint32_t time_secs)
  190. {
  191. if (!soc || !soc->ops) {
  192. dp_cdp_debug("Invalid Instance");
  193. QDF_BUG(0);
  194. return QDF_STATUS_E_FAILURE;
  195. }
  196. if (!soc->ops->sawf_ops ||
  197. !soc->ops->sawf_ops->txrx_sawf_set_sla_params)
  198. return QDF_STATUS_E_FAILURE;
  199. return soc->ops->sawf_ops->txrx_sawf_set_sla_params(num_pkt,
  200. time_secs);
  201. }
  202. /**
  203. * cdp_sawf_init_telemetry_param - Initialize telemetry pararms
  204. *
  205. * Return: none
  206. */
  207. static inline QDF_STATUS
  208. cdp_sawf_init_telemtery_params(ol_txrx_soc_handle soc)
  209. {
  210. if (!soc || !soc->ops) {
  211. dp_cdp_debug("Invalid Instance");
  212. QDF_BUG(0);
  213. return QDF_STATUS_E_FAILURE;
  214. }
  215. if (!soc->ops->sawf_ops ||
  216. !soc->ops->sawf_ops->txrx_sawf_init_telemtery_params)
  217. return QDF_STATUS_E_FAILURE;
  218. return soc->ops->sawf_ops->txrx_sawf_init_telemtery_params();
  219. }
  220. static inline QDF_STATUS
  221. cdp_get_throughput_stats(ol_txrx_soc_handle soc, void *arg,
  222. uint64_t *in_bytes, uint64_t *in_cnt,
  223. uint64_t *tx_bytes, uint64_t *tx_cnt,
  224. uint8_t tid, uint8_t msduq)
  225. {
  226. if (!soc || !soc->ops) {
  227. dp_cdp_debug("Invalid Instance");
  228. QDF_BUG(0);
  229. return QDF_STATUS_E_FAILURE;
  230. }
  231. if (!soc->ops->sawf_ops ||
  232. !soc->ops->sawf_ops->telemetry_get_throughput_stats)
  233. return QDF_STATUS_E_FAILURE;
  234. return soc->ops->sawf_ops->telemetry_get_throughput_stats(
  235. arg, in_bytes, in_cnt, tx_bytes,
  236. tx_cnt, tid, msduq);
  237. }
  238. static inline QDF_STATUS
  239. cdp_get_mpdu_stats(ol_txrx_soc_handle soc, void *arg,
  240. uint64_t *svc_int_pass, uint64_t *svc_int_fail,
  241. uint64_t *burst_pass, uint64_t *burst_fail,
  242. uint8_t tid, uint8_t msduq)
  243. {
  244. if (!soc || !soc->ops) {
  245. dp_cdp_debug("Invalid Instance");
  246. QDF_BUG(0);
  247. return QDF_STATUS_E_FAILURE;
  248. }
  249. if (!soc->ops->sawf_ops ||
  250. !soc->ops->sawf_ops->telemetry_get_mpdu_stats)
  251. return QDF_STATUS_E_FAILURE;
  252. return soc->ops->sawf_ops->telemetry_get_mpdu_stats(
  253. arg, svc_int_pass, svc_int_fail, burst_pass,
  254. burst_fail, tid, msduq);
  255. }
  256. static inline QDF_STATUS
  257. cdp_get_drop_stats(ol_txrx_soc_handle soc, void *arg,
  258. uint64_t *pass, uint64_t *drop,
  259. uint64_t *drop_ttl,
  260. uint8_t tid, uint8_t msduq)
  261. {
  262. if (!soc || !soc->ops) {
  263. dp_cdp_debug("Invalid Instance");
  264. QDF_BUG(0);
  265. return QDF_STATUS_E_FAILURE;
  266. }
  267. if (!soc->ops->sawf_ops ||
  268. !soc->ops->sawf_ops->telemetry_get_drop_stats)
  269. return QDF_STATUS_E_FAILURE;
  270. return soc->ops->sawf_ops->telemetry_get_drop_stats(
  271. arg, pass, drop, drop_ttl, tid, msduq);
  272. }
  273. #else
  274. static inline QDF_STATUS
  275. cdp_get_peer_sawf_delay_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  276. uint8_t *mac, void *data)
  277. {
  278. return QDF_STATUS_E_FAILURE;
  279. }
  280. static inline QDF_STATUS
  281. cdp_get_peer_sawf_tx_stats(ol_txrx_soc_handle soc, uint32_t svc_id,
  282. uint8_t *mac, void *data)
  283. {
  284. return QDF_STATUS_E_FAILURE;
  285. }
  286. #endif
  287. #endif /* _CDP_TXRX_SAWF_H_ */