cdp_txrx_host_stats.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  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 soc stats
  427. *
  428. * @param soc - soc handle
  429. * @soc_stats - buffer for cdp soc stats
  430. * @return - QDF_STATUS
  431. */
  432. static inline QDF_STATUS
  433. cdp_host_get_soc_stats(ol_txrx_soc_handle soc, struct cdp_soc_stats *soc_stats)
  434. {
  435. if (!soc || !soc->ops) {
  436. dp_cdp_debug("Invalid Instance");
  437. QDF_BUG(0);
  438. return QDF_STATUS_E_FAILURE;
  439. }
  440. if (!soc->ops->host_stats_ops ||
  441. !soc->ops->host_stats_ops->txrx_get_soc_stats)
  442. return QDF_STATUS_E_FAILURE;
  443. return soc->ops->host_stats_ops->txrx_get_soc_stats(soc, soc_stats);
  444. }
  445. /**
  446. * @brief Call to get peer stats
  447. *
  448. * @param soc - soc handle
  449. * @param vdev_id - vdev_id of vdev object
  450. * @param peer_mac - mac address of the peer
  451. * @return - struct cdp_peer_stats
  452. */
  453. static inline QDF_STATUS
  454. cdp_host_get_peer_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  455. uint8_t *peer_mac,
  456. struct cdp_peer_stats *peer_stats)
  457. {
  458. if (!soc || !soc->ops) {
  459. dp_cdp_debug("Invalid Instance");
  460. QDF_BUG(0);
  461. return QDF_STATUS_E_FAILURE;
  462. }
  463. if (!soc->ops->host_stats_ops ||
  464. !soc->ops->host_stats_ops->txrx_get_peer_stats)
  465. return QDF_STATUS_E_FAILURE;
  466. return soc->ops->host_stats_ops->txrx_get_peer_stats(soc, vdev_id,
  467. peer_mac,
  468. peer_stats);
  469. }
  470. /**
  471. * @brief Call to reset ald stats
  472. *
  473. * @param soc - soc handle
  474. * @param vdev_id - vdev_id of vdev object
  475. * @param peer_mac - mac address of the peer
  476. * @return - void
  477. */
  478. static inline QDF_STATUS
  479. cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  480. uint8_t *peer_mac)
  481. {
  482. if (!soc || !soc->ops) {
  483. dp_cdp_debug("Invalid Instance");
  484. QDF_BUG(0);
  485. return QDF_STATUS_E_FAILURE;
  486. }
  487. if (!soc->ops->host_stats_ops ||
  488. !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats)
  489. return QDF_STATUS_E_FAILURE;
  490. return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(soc,
  491. vdev_id,
  492. peer_mac);
  493. }
  494. /**
  495. * @brief Call to reset peer stats
  496. *
  497. * @param soc - soc handle
  498. * @param vdev_id - vdev_id of vdev object
  499. * @param peer_mac - mac address of the peer
  500. * @return - QDF_STATUS
  501. */
  502. static inline QDF_STATUS
  503. cdp_host_reset_peer_stats(ol_txrx_soc_handle soc,
  504. uint8_t vdev_id, uint8_t *peer_mac)
  505. {
  506. if (!soc || !soc->ops) {
  507. dp_cdp_debug("Invalid Instance");
  508. QDF_BUG(0);
  509. return QDF_STATUS_E_FAILURE;
  510. }
  511. if (!soc->ops->host_stats_ops ||
  512. !soc->ops->host_stats_ops->txrx_reset_peer_stats)
  513. return QDF_STATUS_E_FAILURE;
  514. return soc->ops->host_stats_ops->txrx_reset_peer_stats(soc,
  515. vdev_id,
  516. peer_mac);
  517. }
  518. /**
  519. * @brief Call to get vdev stats
  520. *
  521. * @param soc - dp soc object
  522. * @param vdev_id - id of dp vdev object
  523. * @param buf - buffer
  524. * @return - int
  525. */
  526. static inline int
  527. cdp_host_get_vdev_stats(ol_txrx_soc_handle soc,
  528. uint8_t vdev_id,
  529. struct cdp_vdev_stats *buf,
  530. bool is_aggregate)
  531. {
  532. if (!soc || !soc->ops) {
  533. dp_cdp_debug("Invalid Instance");
  534. QDF_BUG(0);
  535. return 0;
  536. }
  537. if (!soc->ops->host_stats_ops ||
  538. !soc->ops->host_stats_ops->txrx_get_vdev_stats)
  539. return 0;
  540. return soc->ops->host_stats_ops->txrx_get_vdev_stats(soc, vdev_id,
  541. buf,
  542. is_aggregate);
  543. }
  544. /**
  545. * @brief Call to update vdev stats received from firmware
  546. * (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp
  547. *
  548. * @param data - stats data to be updated
  549. * @param size - size of stats data
  550. * @param stats_id - stats id
  551. * @return - int
  552. */
  553. static inline int
  554. cdp_update_host_vdev_stats(ol_txrx_soc_handle soc,
  555. void *data,
  556. uint32_t size,
  557. uint32_t stats_id)
  558. {
  559. if (!soc || !soc->ops) {
  560. dp_cdp_debug("Invalid Instance");
  561. QDF_BUG(0);
  562. return 0;
  563. }
  564. if (!soc->ops->host_stats_ops ||
  565. !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats)
  566. return 0;
  567. return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats
  568. (soc,
  569. data,
  570. size,
  571. stats_id);
  572. }
  573. /**
  574. * @brief Call to get vdev extd stats
  575. *
  576. * @param soc - soc handle
  577. * @param vdev_id - id of dp vdev object
  578. * @param buf - buffer
  579. * @return - int
  580. */
  581. static inline int
  582. cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc,
  583. uint8_t vdev_id,
  584. wmi_host_vdev_extd_stats *buf)
  585. {
  586. if (!soc || !soc->ops) {
  587. dp_cdp_debug("Invalid Instance");
  588. QDF_BUG(0);
  589. return 0;
  590. }
  591. if (!soc->ops->host_stats_ops ||
  592. !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats)
  593. return 0;
  594. return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(soc, vdev_id,
  595. buf);
  596. }
  597. /**
  598. * @brief Call to get cdp_pdev_stats
  599. *
  600. * @param soc - soc handle
  601. * @param pdev_id - id of dp pdev object
  602. * @param buf - buffer to hold cdp_pdev_stats
  603. * @return - success/failure
  604. */
  605. static inline int
  606. cdp_host_get_pdev_stats(ol_txrx_soc_handle soc,
  607. uint8_t pdev_id, struct cdp_pdev_stats *buf)
  608. {
  609. if (!soc || !soc->ops) {
  610. dp_cdp_debug("Invalid Instance");
  611. QDF_BUG(0);
  612. return 0;
  613. }
  614. if (!soc->ops->host_stats_ops ||
  615. !soc->ops->host_stats_ops->txrx_get_pdev_stats)
  616. return 0;
  617. return soc->ops->host_stats_ops->txrx_get_pdev_stats(soc, pdev_id, buf);
  618. }
  619. /**
  620. * @brief Call to get radio stats
  621. *
  622. * @param soc - soc handle
  623. * @param pdev_id - id of dp pdev object
  624. * @param scn_stats_user - stats buffer
  625. * @return - int
  626. */
  627. static inline int
  628. cdp_host_get_radio_stats(ol_txrx_soc_handle soc,
  629. uint8_t pdev_id,
  630. void *buf)
  631. {
  632. if (!soc || !soc->ops) {
  633. dp_cdp_debug("Invalid Instance");
  634. QDF_BUG(0);
  635. return 0;
  636. }
  637. if (!soc->ops->host_stats_ops ||
  638. !soc->ops->host_stats_ops->txrx_get_radio_stats)
  639. return 0;
  640. return soc->ops->host_stats_ops->txrx_get_radio_stats(soc, pdev_id,
  641. buf);
  642. }
  643. static inline int
  644. cdp_get_spcl_vap_stats(ol_txrx_soc_handle soc,
  645. uint8_t vdev_id,
  646. struct cdp_spcl_vap_stats *stats)
  647. {
  648. if (!soc || !soc->ops) {
  649. dp_cdp_debug("Invalid Instance");
  650. QDF_BUG(0);
  651. return QDF_STATUS_E_FAILURE;
  652. }
  653. if (!soc->ops->host_stats_ops ||
  654. !soc->ops->host_stats_ops->txrx_get_spcl_vap_stats)
  655. return QDF_STATUS_E_FAILURE;
  656. return soc->ops->host_stats_ops->txrx_get_spcl_vap_stats(soc, vdev_id,
  657. stats);
  658. }
  659. #endif /* _CDP_TXRX_HOST_STATS_H_ */