cdp_txrx_host_stats.h 18 KB

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