cdp_txrx_host_stats.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. /*
  2. * Copyright (c) 2016-2021 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_host_stats.h
  20. * @brief Define the host data path stats API functions
  21. * called by the host control SW and the OS interface module
  22. */
  23. #ifndef _CDP_TXRX_HOST_STATS_H_
  24. #define _CDP_TXRX_HOST_STATS_H_
  25. #include "cdp_txrx_handle.h"
  26. #include <cdp_txrx_cmn.h>
  27. #include <wmi_unified_api.h>
  28. /**
  29. * cdp_host_stats_get: cdp call to get host stats
  30. * @soc: SOC handle
  31. * @vdev_id: vdev id of vdev
  32. * @req: Requirement type
  33. *
  34. * return: 0 for Success, Failure returns error message
  35. */
  36. static inline int cdp_host_stats_get(ol_txrx_soc_handle soc,
  37. uint8_t vdev_id,
  38. struct ol_txrx_stats_req *req)
  39. {
  40. if (!soc || !soc->ops) {
  41. dp_cdp_debug("Invalid Instance");
  42. QDF_BUG(0);
  43. return 0;
  44. }
  45. if (!soc->ops->host_stats_ops ||
  46. !soc->ops->host_stats_ops->txrx_host_stats_get)
  47. return 0;
  48. return soc->ops->host_stats_ops->txrx_host_stats_get(soc, vdev_id, req);
  49. }
  50. /**
  51. * cdp_host_stats_get_ratekbps: cdp call to get rate in kbps
  52. * @soc: SOC handle
  53. * @preamb: Preamble
  54. * @mcs: Modulation and Coding scheme index
  55. * @htflag: Flag to identify HT or VHT
  56. * @gintval: Gaurd Interval value
  57. *
  58. * return: 0 for Failure, Returns rate on Success
  59. */
  60. static inline int cdp_host_stats_get_ratekbps(ol_txrx_soc_handle soc,
  61. int preamb, int mcs,
  62. int htflag, int gintval)
  63. {
  64. if (!soc || !soc->ops) {
  65. dp_cdp_debug("Invalid Instance");
  66. QDF_BUG(0);
  67. return 0;
  68. }
  69. if (!soc->ops->host_stats_ops ||
  70. !soc->ops->host_stats_ops->txrx_get_ratekbps)
  71. return 0;
  72. return soc->ops->host_stats_ops->txrx_get_ratekbps(preamb,
  73. mcs, htflag,
  74. gintval);
  75. }
  76. /**
  77. * cdp_host_stats_clr: cdp call to clear host stats
  78. * @soc: soc handle
  79. * @vdev_id: vdev handle id
  80. *
  81. * return: QDF_STATUS
  82. */
  83. static inline QDF_STATUS
  84. cdp_host_stats_clr(ol_txrx_soc_handle soc, uint8_t vdev_id)
  85. {
  86. if (!soc || !soc->ops) {
  87. dp_cdp_debug("Invalid Instance");
  88. QDF_BUG(0);
  89. return QDF_STATUS_E_FAILURE;
  90. }
  91. if (!soc->ops->host_stats_ops ||
  92. !soc->ops->host_stats_ops->txrx_host_stats_clr)
  93. return QDF_STATUS_E_FAILURE;
  94. return soc->ops->host_stats_ops->txrx_host_stats_clr(soc, vdev_id);
  95. }
  96. static inline QDF_STATUS
  97. cdp_host_ce_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  98. {
  99. if (!soc || !soc->ops) {
  100. dp_cdp_debug("Invalid Instance");
  101. QDF_BUG(0);
  102. return QDF_STATUS_E_FAILURE;
  103. }
  104. if (!soc->ops->host_stats_ops ||
  105. !soc->ops->host_stats_ops->txrx_host_ce_stats)
  106. return QDF_STATUS_E_FAILURE;
  107. return soc->ops->host_stats_ops->txrx_host_ce_stats(soc, vdev_id);
  108. }
  109. static inline int cdp_stats_publish
  110. (ol_txrx_soc_handle soc, uint8_t pdev_id,
  111. struct cdp_stats_extd *buf)
  112. {
  113. if (!soc || !soc->ops) {
  114. dp_cdp_debug("Invalid Instance");
  115. QDF_BUG(0);
  116. return 0;
  117. }
  118. if (!soc->ops->host_stats_ops ||
  119. !soc->ops->host_stats_ops->txrx_stats_publish)
  120. return 0;
  121. return soc->ops->host_stats_ops->txrx_stats_publish(soc, pdev_id, buf);
  122. }
  123. /**
  124. * @brief Enable enhanced stats functionality.
  125. *
  126. * @param soc - the soc object
  127. * @param pdev_id - id of the physical device object
  128. * @return - QDF_STATUS
  129. */
  130. static inline QDF_STATUS
  131. cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  132. {
  133. if (!soc || !soc->ops) {
  134. dp_cdp_debug("Invalid Instance");
  135. QDF_BUG(0);
  136. return QDF_STATUS_E_FAILURE;
  137. }
  138. if (!soc->ops->host_stats_ops ||
  139. !soc->ops->host_stats_ops->txrx_enable_enhanced_stats)
  140. return QDF_STATUS_E_FAILURE;
  141. return soc->ops->host_stats_ops->txrx_enable_enhanced_stats
  142. (soc, pdev_id);
  143. }
  144. /**
  145. * @brief Disable enhanced stats functionality.
  146. *
  147. * @param soc - the soc object
  148. * @param pdev_id - id of the physical device object
  149. * @return - QDF_STATUS
  150. */
  151. static inline QDF_STATUS
  152. cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  153. {
  154. if (!soc || !soc->ops) {
  155. dp_cdp_debug("Invalid Instance");
  156. QDF_BUG(0);
  157. return QDF_STATUS_E_FAILURE;
  158. }
  159. if (!soc->ops->host_stats_ops ||
  160. !soc->ops->host_stats_ops->txrx_disable_enhanced_stats)
  161. return QDF_STATUS_E_FAILURE;
  162. return soc->ops->host_stats_ops->txrx_disable_enhanced_stats
  163. (soc, pdev_id);
  164. }
  165. static inline QDF_STATUS
  166. cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  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->host_stats_ops ||
  174. !soc->ops->host_stats_ops->tx_print_tso_stats)
  175. return QDF_STATUS_E_FAILURE;
  176. return soc->ops->host_stats_ops->tx_print_tso_stats(soc, vdev_id);
  177. }
  178. static inline QDF_STATUS
  179. cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  180. {
  181. if (!soc || !soc->ops) {
  182. dp_cdp_debug("Invalid Instance");
  183. QDF_BUG(0);
  184. return QDF_STATUS_E_FAILURE;
  185. }
  186. if (!soc->ops->host_stats_ops ||
  187. !soc->ops->host_stats_ops->tx_rst_tso_stats)
  188. return QDF_STATUS_E_FAILURE;
  189. return soc->ops->host_stats_ops->tx_rst_tso_stats(soc, vdev_id);
  190. }
  191. static inline QDF_STATUS
  192. cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  193. {
  194. if (!soc || !soc->ops) {
  195. dp_cdp_debug("Invalid Instance");
  196. QDF_BUG(0);
  197. return QDF_STATUS_E_FAILURE;
  198. }
  199. if (!soc->ops->host_stats_ops ||
  200. !soc->ops->host_stats_ops->tx_print_sg_stats)
  201. return QDF_STATUS_E_FAILURE;
  202. return soc->ops->host_stats_ops->tx_print_sg_stats(soc, vdev_id);
  203. }
  204. static inline QDF_STATUS
  205. cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  206. {
  207. if (!soc || !soc->ops) {
  208. dp_cdp_debug("Invalid Instance");
  209. QDF_BUG(0);
  210. return QDF_STATUS_E_FAILURE;
  211. }
  212. if (!soc->ops->host_stats_ops ||
  213. !soc->ops->host_stats_ops->tx_rst_sg_stats)
  214. return QDF_STATUS_E_FAILURE;
  215. return soc->ops->host_stats_ops->tx_rst_sg_stats(soc, vdev_id);
  216. }
  217. static inline QDF_STATUS
  218. cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  219. {
  220. if (!soc || !soc->ops) {
  221. dp_cdp_debug("Invalid Instance");
  222. QDF_BUG(0);
  223. return QDF_STATUS_E_FAILURE;
  224. }
  225. if (!soc->ops->host_stats_ops ||
  226. !soc->ops->host_stats_ops->print_rx_cksum_stats)
  227. return QDF_STATUS_E_FAILURE;
  228. return soc->ops->host_stats_ops->print_rx_cksum_stats(soc, vdev_id);
  229. }
  230. static inline QDF_STATUS
  231. cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  232. {
  233. if (!soc || !soc->ops) {
  234. dp_cdp_debug("Invalid Instance");
  235. QDF_BUG(0);
  236. return QDF_STATUS_E_FAILURE;
  237. }
  238. if (!soc->ops->host_stats_ops ||
  239. !soc->ops->host_stats_ops->rst_rx_cksum_stats)
  240. return QDF_STATUS_E_FAILURE;
  241. return soc->ops->host_stats_ops->rst_rx_cksum_stats(soc, vdev_id);
  242. }
  243. static inline QDF_STATUS
  244. cdp_host_me_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  245. {
  246. if (!soc || !soc->ops) {
  247. dp_cdp_debug("Invalid Instance");
  248. QDF_BUG(0);
  249. return QDF_STATUS_E_FAILURE;
  250. }
  251. if (!soc->ops->host_stats_ops ||
  252. !soc->ops->host_stats_ops->txrx_host_me_stats)
  253. return QDF_STATUS_E_FAILURE;
  254. return soc->ops->host_stats_ops->txrx_host_me_stats(soc, vdev_id);
  255. }
  256. /**
  257. * cdp_per_peer_stats(): function to print per peer REO Queue stats
  258. * @soc: soc handle
  259. * @pdev: physical device
  260. * @addr: peer address
  261. *
  262. * return: status
  263. */
  264. static inline QDF_STATUS cdp_per_peer_stats(ol_txrx_soc_handle soc,
  265. uint8_t *addr)
  266. {
  267. if (!soc || !soc->ops) {
  268. dp_cdp_debug("Invalid Instance");
  269. QDF_BUG(0);
  270. return QDF_STATUS_E_FAILURE;
  271. }
  272. if (!soc->ops->host_stats_ops ||
  273. !soc->ops->host_stats_ops->txrx_per_peer_stats)
  274. return QDF_STATUS_E_FAILURE;
  275. return soc->ops->host_stats_ops->txrx_per_peer_stats(soc, addr);
  276. }
  277. static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc,
  278. uint8_t vdev_id,
  279. struct ol_txrx_stats_req *req)
  280. {
  281. if (!soc || !soc->ops) {
  282. dp_cdp_debug("Invalid Instance");
  283. QDF_BUG(0);
  284. return 0;
  285. }
  286. if (!soc->ops->host_stats_ops ||
  287. !soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats)
  288. return 0;
  289. return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats
  290. (soc, vdev_id, req);
  291. }
  292. static inline QDF_STATUS cdp_update_peer_stats(ol_txrx_soc_handle soc,
  293. uint8_t vdev_id, uint8_t *mac,
  294. void *stats,
  295. uint32_t last_tx_rate_mcs,
  296. uint32_t stats_id)
  297. {
  298. if (!soc || !soc->ops) {
  299. dp_cdp_debug("Invalid Instance");
  300. QDF_BUG(0);
  301. return QDF_STATUS_E_FAILURE;
  302. }
  303. if (!soc->ops->host_stats_ops ||
  304. !soc->ops->host_stats_ops->txrx_update_peer_stats)
  305. return QDF_STATUS_E_FAILURE;
  306. return soc->ops->host_stats_ops->txrx_update_peer_stats
  307. (soc, vdev_id, mac, stats, last_tx_rate_mcs, stats_id);
  308. }
  309. static inline QDF_STATUS cdp_get_dp_fw_peer_stats(ol_txrx_soc_handle soc,
  310. uint8_t pdev_id,
  311. uint8_t *mac, uint32_t caps,
  312. uint32_t copy_stats)
  313. {
  314. if (!soc || !soc->ops) {
  315. dp_cdp_debug("Invalid Instance");
  316. QDF_BUG(0);
  317. return QDF_STATUS_E_FAILURE;
  318. }
  319. if (!soc->ops->host_stats_ops ||
  320. !soc->ops->host_stats_ops->get_fw_peer_stats)
  321. return QDF_STATUS_E_FAILURE;
  322. return soc->ops->host_stats_ops->get_fw_peer_stats
  323. (soc, pdev_id, mac, caps, copy_stats);
  324. }
  325. static inline QDF_STATUS cdp_get_dp_htt_stats(ol_txrx_soc_handle soc,
  326. uint8_t pdev_id,
  327. void *data, uint32_t data_len)
  328. {
  329. if (!soc || !soc->ops) {
  330. dp_cdp_debug("Invalid Instance");
  331. QDF_BUG(0);
  332. return QDF_STATUS_E_FAILURE;
  333. }
  334. if (!soc->ops->host_stats_ops ||
  335. !soc->ops->host_stats_ops->get_htt_stats)
  336. return QDF_STATUS_E_FAILURE;
  337. return soc->ops->host_stats_ops->get_htt_stats(soc, pdev_id, data,
  338. data_len);
  339. }
  340. /**
  341. * @brief Update pdev host stats received from firmware
  342. * (wmi_host_pdev_stats and wmi_host_pdev_ext_stats) into dp
  343. *
  344. * @param soc - soc handle
  345. * @param pdev_id - id of the physical device object
  346. * @param data - pdev stats
  347. * @return - QDF_STATUS
  348. */
  349. static inline QDF_STATUS
  350. cdp_update_pdev_host_stats(ol_txrx_soc_handle soc,
  351. uint8_t pdev_id,
  352. void *data,
  353. uint16_t stats_id)
  354. {
  355. if (!soc || !soc->ops) {
  356. dp_cdp_debug("Invalid Instance");
  357. QDF_BUG(0);
  358. return QDF_STATUS_E_FAILURE;
  359. }
  360. if (!soc->ops->host_stats_ops ||
  361. !soc->ops->host_stats_ops->txrx_update_pdev_stats)
  362. return QDF_STATUS_E_FAILURE;
  363. return soc->ops->host_stats_ops->txrx_update_pdev_stats(soc, pdev_id,
  364. data,
  365. stats_id);
  366. }
  367. /**
  368. * @brief Update vdev host stats
  369. *
  370. * @soc: soc handle
  371. * @vdev_id: id of the virtual device object
  372. * @data: pdev stats
  373. * @stats_id: type of stats
  374. *
  375. * Return: QDF_STATUS
  376. */
  377. static inline QDF_STATUS
  378. cdp_update_vdev_host_stats(ol_txrx_soc_handle soc,
  379. uint8_t vdev_id,
  380. void *data,
  381. uint16_t stats_id)
  382. {
  383. if (!soc || !soc->ops) {
  384. dp_cdp_debug("Invalid Instance");
  385. QDF_BUG(0);
  386. return QDF_STATUS_E_FAILURE;
  387. }
  388. if (!soc->ops->host_stats_ops ||
  389. !soc->ops->host_stats_ops->txrx_update_vdev_stats)
  390. return QDF_STATUS_E_FAILURE;
  391. return soc->ops->host_stats_ops->txrx_update_vdev_stats(soc, vdev_id,
  392. data,
  393. stats_id);
  394. }
  395. /**
  396. * @brief Call to get specified peer stats
  397. *
  398. * @param soc - soc handle
  399. * @param vdev_id - vdev_id of vdev object
  400. * @param peer_mac - mac address of the peer
  401. * @param type - enum of required stats
  402. * @param buf - buffer to hold the value
  403. * @return - QDF_STATUS
  404. */
  405. static inline QDF_STATUS
  406. cdp_txrx_get_peer_stats_param(ol_txrx_soc_handle soc, uint8_t vdev_id,
  407. uint8_t *peer_mac,
  408. enum cdp_peer_stats_type type,
  409. cdp_peer_stats_param_t *buf)
  410. {
  411. if (!soc || !soc->ops) {
  412. dp_cdp_debug("Invalid Instance");
  413. QDF_BUG(0);
  414. return QDF_STATUS_E_FAILURE;
  415. }
  416. if (!soc->ops->host_stats_ops ||
  417. !soc->ops->host_stats_ops->txrx_get_peer_stats_param)
  418. return QDF_STATUS_E_FAILURE;
  419. return soc->ops->host_stats_ops->txrx_get_peer_stats_param(soc,
  420. vdev_id,
  421. peer_mac,
  422. type,
  423. buf);
  424. }
  425. /**
  426. * @brief Call to get peer stats
  427. *
  428. * @param soc - soc handle
  429. * @param vdev_id - vdev_id of vdev object
  430. * @param peer_mac - mac address of the peer
  431. * @return - struct cdp_peer_stats
  432. */
  433. static inline QDF_STATUS
  434. cdp_host_get_peer_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  435. uint8_t *peer_mac,
  436. struct cdp_peer_stats *peer_stats)
  437. {
  438. if (!soc || !soc->ops) {
  439. dp_cdp_debug("Invalid Instance");
  440. QDF_BUG(0);
  441. return QDF_STATUS_E_FAILURE;
  442. }
  443. if (!soc->ops->host_stats_ops ||
  444. !soc->ops->host_stats_ops->txrx_get_peer_stats)
  445. return QDF_STATUS_E_FAILURE;
  446. return soc->ops->host_stats_ops->txrx_get_peer_stats(soc, vdev_id,
  447. peer_mac,
  448. peer_stats);
  449. }
  450. /**
  451. * @brief Call to reset ald stats
  452. *
  453. * @param soc - soc handle
  454. * @param vdev_id - vdev_id of vdev object
  455. * @param peer_mac - mac address of the peer
  456. * @return - void
  457. */
  458. static inline QDF_STATUS
  459. cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  460. uint8_t *peer_mac)
  461. {
  462. if (!soc || !soc->ops) {
  463. dp_cdp_debug("Invalid Instance");
  464. QDF_BUG(0);
  465. return QDF_STATUS_E_FAILURE;
  466. }
  467. if (!soc->ops->host_stats_ops ||
  468. !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats)
  469. return QDF_STATUS_E_FAILURE;
  470. return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(soc,
  471. vdev_id,
  472. peer_mac);
  473. }
  474. /**
  475. * @brief Call to reset peer stats
  476. *
  477. * @param soc - soc handle
  478. * @param vdev_id - vdev_id of vdev object
  479. * @param peer_mac - mac address of the peer
  480. * @return - QDF_STATUS
  481. */
  482. static inline QDF_STATUS
  483. cdp_host_reset_peer_stats(ol_txrx_soc_handle soc,
  484. uint8_t vdev_id, uint8_t *peer_mac)
  485. {
  486. if (!soc || !soc->ops) {
  487. dp_cdp_debug("Invalid Instance");
  488. QDF_BUG(0);
  489. return QDF_STATUS_E_FAILURE;
  490. }
  491. if (!soc->ops->host_stats_ops ||
  492. !soc->ops->host_stats_ops->txrx_reset_peer_stats)
  493. return QDF_STATUS_E_FAILURE;
  494. return soc->ops->host_stats_ops->txrx_reset_peer_stats(soc,
  495. vdev_id,
  496. peer_mac);
  497. }
  498. /**
  499. * @brief Call to get vdev stats
  500. *
  501. * @param soc - dp soc object
  502. * @param vdev_id - id of dp vdev object
  503. * @param buf - buffer
  504. * @return - int
  505. */
  506. static inline int
  507. cdp_host_get_vdev_stats(ol_txrx_soc_handle soc,
  508. uint8_t vdev_id,
  509. struct cdp_vdev_stats *buf,
  510. bool is_aggregate)
  511. {
  512. if (!soc || !soc->ops) {
  513. dp_cdp_debug("Invalid Instance");
  514. QDF_BUG(0);
  515. return 0;
  516. }
  517. if (!soc->ops->host_stats_ops ||
  518. !soc->ops->host_stats_ops->txrx_get_vdev_stats)
  519. return 0;
  520. return soc->ops->host_stats_ops->txrx_get_vdev_stats(soc, vdev_id,
  521. buf,
  522. is_aggregate);
  523. }
  524. /**
  525. * @brief Call to update vdev stats received from firmware
  526. * (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp
  527. *
  528. * @param data - stats data to be updated
  529. * @param size - size of stats data
  530. * @param stats_id - stats id
  531. * @return - int
  532. */
  533. static inline int
  534. cdp_update_host_vdev_stats(ol_txrx_soc_handle soc,
  535. void *data,
  536. uint32_t size,
  537. uint32_t stats_id)
  538. {
  539. if (!soc || !soc->ops) {
  540. dp_cdp_debug("Invalid Instance");
  541. QDF_BUG(0);
  542. return 0;
  543. }
  544. if (!soc->ops->host_stats_ops ||
  545. !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats)
  546. return 0;
  547. return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats
  548. (soc,
  549. data,
  550. size,
  551. stats_id);
  552. }
  553. /**
  554. * @brief Call to get vdev extd stats
  555. *
  556. * @param soc - soc handle
  557. * @param vdev_id - id of dp vdev object
  558. * @param buf - buffer
  559. * @return - int
  560. */
  561. static inline int
  562. cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc,
  563. uint8_t vdev_id,
  564. wmi_host_vdev_extd_stats *buf)
  565. {
  566. if (!soc || !soc->ops) {
  567. dp_cdp_debug("Invalid Instance");
  568. QDF_BUG(0);
  569. return 0;
  570. }
  571. if (!soc->ops->host_stats_ops ||
  572. !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats)
  573. return 0;
  574. return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(soc, vdev_id,
  575. buf);
  576. }
  577. /**
  578. * @brief Call to get cdp_pdev_stats
  579. *
  580. * @param soc - soc handle
  581. * @param pdev_id - id of dp pdev object
  582. * @param buf - buffer to hold cdp_pdev_stats
  583. * @return - success/failure
  584. */
  585. static inline int
  586. cdp_host_get_pdev_stats(ol_txrx_soc_handle soc,
  587. uint8_t pdev_id, struct cdp_pdev_stats *buf)
  588. {
  589. if (!soc || !soc->ops) {
  590. dp_cdp_debug("Invalid Instance");
  591. QDF_BUG(0);
  592. return 0;
  593. }
  594. if (!soc->ops->host_stats_ops ||
  595. !soc->ops->host_stats_ops->txrx_get_pdev_stats)
  596. return 0;
  597. return soc->ops->host_stats_ops->txrx_get_pdev_stats(soc, pdev_id, buf);
  598. }
  599. /**
  600. * @brief Call to get radio stats
  601. *
  602. * @param soc - soc handle
  603. * @param pdev_id - id of dp pdev object
  604. * @param scn_stats_user - stats buffer
  605. * @return - int
  606. */
  607. static inline int
  608. cdp_host_get_radio_stats(ol_txrx_soc_handle soc,
  609. uint8_t pdev_id,
  610. void *buf)
  611. {
  612. if (!soc || !soc->ops) {
  613. dp_cdp_debug("Invalid Instance");
  614. QDF_BUG(0);
  615. return 0;
  616. }
  617. if (!soc->ops->host_stats_ops ||
  618. !soc->ops->host_stats_ops->txrx_get_radio_stats)
  619. return 0;
  620. return soc->ops->host_stats_ops->txrx_get_radio_stats(soc, pdev_id,
  621. buf);
  622. }
  623. #endif /* _CDP_TXRX_HOST_STATS_H_ */