cdp_txrx_host_stats.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * @file cdp_txrx_host_stats.h
  21. * @brief Define the host data path stats API functions
  22. * called by the host control SW and the OS interface module
  23. */
  24. #ifndef _CDP_TXRX_HOST_STATS_H_
  25. #define _CDP_TXRX_HOST_STATS_H_
  26. #include "cdp_txrx_handle.h"
  27. #include <cdp_txrx_cmn.h>
  28. #include <wmi_unified_api.h>
  29. /**
  30. * cdp_host_stats_get: cdp call to get host stats
  31. * @soc: SOC handle
  32. * @vdev_id: vdev id of vdev
  33. * @req: Requirement type
  34. *
  35. * return: 0 for Success, Failure returns error message
  36. */
  37. static inline int cdp_host_stats_get(ol_txrx_soc_handle soc,
  38. uint8_t vdev_id,
  39. struct ol_txrx_stats_req *req)
  40. {
  41. if (!soc || !soc->ops) {
  42. dp_cdp_debug("Invalid Instance");
  43. QDF_BUG(0);
  44. return 0;
  45. }
  46. if (!soc->ops->host_stats_ops ||
  47. !soc->ops->host_stats_ops->txrx_host_stats_get)
  48. return 0;
  49. return soc->ops->host_stats_ops->txrx_host_stats_get(soc, vdev_id, req);
  50. }
  51. /**
  52. * cdp_host_stats_get_ratekbps: cdp call to get rate in kbps
  53. * @soc: SOC handle
  54. * @preamb: Preamble
  55. * @mcs: Modulation and Coding scheme index
  56. * @htflag: Flag to identify HT or VHT
  57. * @gintval: Gaurd Interval value
  58. *
  59. * return: 0 for Failure, Returns rate on Success
  60. */
  61. static inline int cdp_host_stats_get_ratekbps(ol_txrx_soc_handle soc,
  62. int preamb, int mcs,
  63. int htflag, int gintval)
  64. {
  65. if (!soc || !soc->ops) {
  66. dp_cdp_debug("Invalid Instance");
  67. QDF_BUG(0);
  68. return 0;
  69. }
  70. if (!soc->ops->host_stats_ops ||
  71. !soc->ops->host_stats_ops->txrx_get_ratekbps)
  72. return 0;
  73. return soc->ops->host_stats_ops->txrx_get_ratekbps(preamb,
  74. mcs, htflag,
  75. gintval);
  76. }
  77. /**
  78. * cdp_host_stats_clr: cdp call to clear host stats
  79. * @soc: soc handle
  80. * @vdev_id: vdev handle id
  81. *
  82. * return: QDF_STATUS
  83. */
  84. static inline QDF_STATUS
  85. cdp_host_stats_clr(ol_txrx_soc_handle soc, uint8_t vdev_id)
  86. {
  87. if (!soc || !soc->ops) {
  88. dp_cdp_debug("Invalid Instance");
  89. QDF_BUG(0);
  90. return QDF_STATUS_E_FAILURE;
  91. }
  92. if (!soc->ops->host_stats_ops ||
  93. !soc->ops->host_stats_ops->txrx_host_stats_clr)
  94. return QDF_STATUS_E_FAILURE;
  95. return soc->ops->host_stats_ops->txrx_host_stats_clr(soc, vdev_id);
  96. }
  97. static inline QDF_STATUS
  98. cdp_host_ce_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  99. {
  100. if (!soc || !soc->ops) {
  101. dp_cdp_debug("Invalid Instance");
  102. QDF_BUG(0);
  103. return QDF_STATUS_E_FAILURE;
  104. }
  105. if (!soc->ops->host_stats_ops ||
  106. !soc->ops->host_stats_ops->txrx_host_ce_stats)
  107. return QDF_STATUS_E_FAILURE;
  108. return soc->ops->host_stats_ops->txrx_host_ce_stats(soc, vdev_id);
  109. }
  110. static inline int cdp_stats_publish
  111. (ol_txrx_soc_handle soc, uint8_t pdev_id,
  112. struct cdp_stats_extd *buf)
  113. {
  114. if (!soc || !soc->ops) {
  115. dp_cdp_debug("Invalid Instance");
  116. QDF_BUG(0);
  117. return 0;
  118. }
  119. if (!soc->ops->host_stats_ops ||
  120. !soc->ops->host_stats_ops->txrx_stats_publish)
  121. return 0;
  122. return soc->ops->host_stats_ops->txrx_stats_publish(soc, pdev_id, buf);
  123. }
  124. /**
  125. * @brief Enable enhanced stats functionality.
  126. *
  127. * @param soc - the soc object
  128. * @param pdev_id - id of the physical device object
  129. * @return - QDF_STATUS
  130. */
  131. static inline QDF_STATUS
  132. cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  133. {
  134. if (!soc || !soc->ops) {
  135. dp_cdp_debug("Invalid Instance");
  136. QDF_BUG(0);
  137. return QDF_STATUS_E_FAILURE;
  138. }
  139. if (!soc->ops->host_stats_ops ||
  140. !soc->ops->host_stats_ops->txrx_enable_enhanced_stats)
  141. return QDF_STATUS_E_FAILURE;
  142. return soc->ops->host_stats_ops->txrx_enable_enhanced_stats
  143. (soc, pdev_id);
  144. }
  145. /**
  146. * @brief Disable enhanced stats functionality.
  147. *
  148. * @param soc - the soc object
  149. * @param pdev_id - id of the physical device object
  150. * @return - QDF_STATUS
  151. */
  152. static inline QDF_STATUS
  153. cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, uint8_t pdev_id)
  154. {
  155. if (!soc || !soc->ops) {
  156. dp_cdp_debug("Invalid Instance");
  157. QDF_BUG(0);
  158. return QDF_STATUS_E_FAILURE;
  159. }
  160. if (!soc->ops->host_stats_ops ||
  161. !soc->ops->host_stats_ops->txrx_disable_enhanced_stats)
  162. return QDF_STATUS_E_FAILURE;
  163. return soc->ops->host_stats_ops->txrx_disable_enhanced_stats
  164. (soc, pdev_id);
  165. }
  166. static inline QDF_STATUS
  167. cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  168. {
  169. if (!soc || !soc->ops) {
  170. dp_cdp_debug("Invalid Instance");
  171. QDF_BUG(0);
  172. return QDF_STATUS_E_FAILURE;
  173. }
  174. if (!soc->ops->host_stats_ops ||
  175. !soc->ops->host_stats_ops->tx_print_tso_stats)
  176. return QDF_STATUS_E_FAILURE;
  177. return soc->ops->host_stats_ops->tx_print_tso_stats(soc, vdev_id);
  178. }
  179. static inline QDF_STATUS
  180. cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  181. {
  182. if (!soc || !soc->ops) {
  183. dp_cdp_debug("Invalid Instance");
  184. QDF_BUG(0);
  185. return QDF_STATUS_E_FAILURE;
  186. }
  187. if (!soc->ops->host_stats_ops ||
  188. !soc->ops->host_stats_ops->tx_rst_tso_stats)
  189. return QDF_STATUS_E_FAILURE;
  190. return soc->ops->host_stats_ops->tx_rst_tso_stats(soc, vdev_id);
  191. }
  192. static inline QDF_STATUS
  193. cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  194. {
  195. if (!soc || !soc->ops) {
  196. dp_cdp_debug("Invalid Instance");
  197. QDF_BUG(0);
  198. return QDF_STATUS_E_FAILURE;
  199. }
  200. if (!soc->ops->host_stats_ops ||
  201. !soc->ops->host_stats_ops->tx_print_sg_stats)
  202. return QDF_STATUS_E_FAILURE;
  203. return soc->ops->host_stats_ops->tx_print_sg_stats(soc, vdev_id);
  204. }
  205. static inline QDF_STATUS
  206. cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  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->host_stats_ops ||
  214. !soc->ops->host_stats_ops->tx_rst_sg_stats)
  215. return QDF_STATUS_E_FAILURE;
  216. return soc->ops->host_stats_ops->tx_rst_sg_stats(soc, vdev_id);
  217. }
  218. static inline QDF_STATUS
  219. cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  220. {
  221. if (!soc || !soc->ops) {
  222. dp_cdp_debug("Invalid Instance");
  223. QDF_BUG(0);
  224. return QDF_STATUS_E_FAILURE;
  225. }
  226. if (!soc->ops->host_stats_ops ||
  227. !soc->ops->host_stats_ops->print_rx_cksum_stats)
  228. return QDF_STATUS_E_FAILURE;
  229. return soc->ops->host_stats_ops->print_rx_cksum_stats(soc, vdev_id);
  230. }
  231. static inline QDF_STATUS
  232. cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  233. {
  234. if (!soc || !soc->ops) {
  235. dp_cdp_debug("Invalid Instance");
  236. QDF_BUG(0);
  237. return QDF_STATUS_E_FAILURE;
  238. }
  239. if (!soc->ops->host_stats_ops ||
  240. !soc->ops->host_stats_ops->rst_rx_cksum_stats)
  241. return QDF_STATUS_E_FAILURE;
  242. return soc->ops->host_stats_ops->rst_rx_cksum_stats(soc, vdev_id);
  243. }
  244. static inline QDF_STATUS
  245. cdp_host_me_stats(ol_txrx_soc_handle soc, uint8_t vdev_id)
  246. {
  247. if (!soc || !soc->ops) {
  248. dp_cdp_debug("Invalid Instance");
  249. QDF_BUG(0);
  250. return QDF_STATUS_E_FAILURE;
  251. }
  252. if (!soc->ops->host_stats_ops ||
  253. !soc->ops->host_stats_ops->txrx_host_me_stats)
  254. return QDF_STATUS_E_FAILURE;
  255. return soc->ops->host_stats_ops->txrx_host_me_stats(soc, vdev_id);
  256. }
  257. /**
  258. * cdp_per_peer_stats(): function to print per peer REO Queue stats
  259. * @soc: soc handle
  260. * @pdev: physical device
  261. * @addr: peer address
  262. *
  263. * return: status
  264. */
  265. static inline QDF_STATUS cdp_per_peer_stats(ol_txrx_soc_handle soc,
  266. uint8_t *addr)
  267. {
  268. if (!soc || !soc->ops) {
  269. dp_cdp_debug("Invalid Instance");
  270. QDF_BUG(0);
  271. return QDF_STATUS_E_FAILURE;
  272. }
  273. if (!soc->ops->host_stats_ops ||
  274. !soc->ops->host_stats_ops->txrx_per_peer_stats)
  275. return QDF_STATUS_E_FAILURE;
  276. return soc->ops->host_stats_ops->txrx_per_peer_stats(soc, addr);
  277. }
  278. static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc,
  279. uint8_t vdev_id,
  280. struct ol_txrx_stats_req *req)
  281. {
  282. if (!soc || !soc->ops) {
  283. dp_cdp_debug("Invalid Instance");
  284. QDF_BUG(0);
  285. return 0;
  286. }
  287. if (!soc->ops->host_stats_ops ||
  288. !soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats)
  289. return 0;
  290. return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats
  291. (soc, vdev_id, req);
  292. }
  293. static inline QDF_STATUS cdp_update_peer_stats(ol_txrx_soc_handle soc,
  294. uint8_t vdev_id, uint8_t *mac,
  295. void *stats,
  296. uint32_t last_tx_rate_mcs,
  297. uint32_t stats_id)
  298. {
  299. if (!soc || !soc->ops) {
  300. dp_cdp_debug("Invalid Instance");
  301. QDF_BUG(0);
  302. return QDF_STATUS_E_FAILURE;
  303. }
  304. if (!soc->ops->host_stats_ops ||
  305. !soc->ops->host_stats_ops->txrx_update_peer_stats)
  306. return QDF_STATUS_E_FAILURE;
  307. return soc->ops->host_stats_ops->txrx_update_peer_stats
  308. (soc, vdev_id, mac, stats, last_tx_rate_mcs, stats_id);
  309. }
  310. static inline QDF_STATUS cdp_get_dp_fw_peer_stats(ol_txrx_soc_handle soc,
  311. uint8_t pdev_id,
  312. uint8_t *mac, uint32_t caps,
  313. uint32_t copy_stats)
  314. {
  315. if (!soc || !soc->ops) {
  316. dp_cdp_debug("Invalid Instance");
  317. QDF_BUG(0);
  318. return QDF_STATUS_E_FAILURE;
  319. }
  320. if (!soc->ops->host_stats_ops ||
  321. !soc->ops->host_stats_ops->get_fw_peer_stats)
  322. return QDF_STATUS_E_FAILURE;
  323. return soc->ops->host_stats_ops->get_fw_peer_stats
  324. (soc, pdev_id, mac, caps, copy_stats);
  325. }
  326. static inline QDF_STATUS cdp_get_dp_htt_stats(ol_txrx_soc_handle soc,
  327. uint8_t pdev_id,
  328. void *data, uint32_t data_len)
  329. {
  330. if (!soc || !soc->ops) {
  331. dp_cdp_debug("Invalid Instance");
  332. QDF_BUG(0);
  333. return QDF_STATUS_E_FAILURE;
  334. }
  335. if (!soc->ops->host_stats_ops ||
  336. !soc->ops->host_stats_ops->get_htt_stats)
  337. return QDF_STATUS_E_FAILURE;
  338. return soc->ops->host_stats_ops->get_htt_stats(soc, pdev_id, data,
  339. data_len);
  340. }
  341. /**
  342. * @brief Update pdev host stats received from firmware
  343. * (wmi_host_pdev_stats and wmi_host_pdev_ext_stats) into dp
  344. *
  345. * @param soc - soc handle
  346. * @param pdev_id - id of the physical device object
  347. * @param data - pdev stats
  348. * @return - QDF_STATUS
  349. */
  350. static inline QDF_STATUS
  351. cdp_update_pdev_host_stats(ol_txrx_soc_handle soc,
  352. uint8_t pdev_id,
  353. void *data,
  354. uint16_t stats_id)
  355. {
  356. if (!soc || !soc->ops) {
  357. dp_cdp_debug("Invalid Instance");
  358. QDF_BUG(0);
  359. return QDF_STATUS_E_FAILURE;
  360. }
  361. if (!soc->ops->host_stats_ops ||
  362. !soc->ops->host_stats_ops->txrx_update_pdev_stats)
  363. return QDF_STATUS_E_FAILURE;
  364. return soc->ops->host_stats_ops->txrx_update_pdev_stats(soc, pdev_id,
  365. data,
  366. stats_id);
  367. }
  368. /**
  369. * @brief Update vdev host stats
  370. *
  371. * @soc: soc handle
  372. * @vdev_id: id of the virtual device object
  373. * @data: pdev stats
  374. * @stats_id: type of stats
  375. *
  376. * Return: QDF_STATUS
  377. */
  378. static inline QDF_STATUS
  379. cdp_update_vdev_host_stats(ol_txrx_soc_handle soc,
  380. uint8_t vdev_id,
  381. void *data,
  382. uint16_t stats_id)
  383. {
  384. if (!soc || !soc->ops) {
  385. dp_cdp_debug("Invalid Instance");
  386. QDF_BUG(0);
  387. return QDF_STATUS_E_FAILURE;
  388. }
  389. if (!soc->ops->host_stats_ops ||
  390. !soc->ops->host_stats_ops->txrx_update_vdev_stats)
  391. return QDF_STATUS_E_FAILURE;
  392. return soc->ops->host_stats_ops->txrx_update_vdev_stats(soc, vdev_id,
  393. data,
  394. stats_id);
  395. }
  396. /**
  397. * @brief Call to get specified peer stats
  398. *
  399. * @param soc - soc handle
  400. * @param vdev_id - vdev_id of vdev object
  401. * @param peer_mac - mac address of the peer
  402. * @param type - enum of required stats
  403. * @param buf - buffer to hold the value
  404. * @return - QDF_STATUS
  405. */
  406. static inline QDF_STATUS
  407. cdp_txrx_get_peer_stats_param(ol_txrx_soc_handle soc, uint8_t vdev_id,
  408. uint8_t *peer_mac,
  409. enum cdp_peer_stats_type type,
  410. cdp_peer_stats_param_t *buf)
  411. {
  412. if (!soc || !soc->ops) {
  413. dp_cdp_debug("Invalid Instance");
  414. QDF_BUG(0);
  415. return QDF_STATUS_E_FAILURE;
  416. }
  417. if (!soc->ops->host_stats_ops ||
  418. !soc->ops->host_stats_ops->txrx_get_peer_stats_param)
  419. return QDF_STATUS_E_FAILURE;
  420. return soc->ops->host_stats_ops->txrx_get_peer_stats_param(soc,
  421. vdev_id,
  422. peer_mac,
  423. type,
  424. buf);
  425. }
  426. /**
  427. * @brief Call to get soc stats
  428. *
  429. * @param soc - soc handle
  430. * @soc_stats - buffer for cdp soc stats
  431. * @return - QDF_STATUS
  432. */
  433. static inline QDF_STATUS
  434. cdp_host_get_soc_stats(ol_txrx_soc_handle soc, struct cdp_soc_stats *soc_stats)
  435. {
  436. if (!soc || !soc->ops) {
  437. dp_cdp_debug("Invalid Instance");
  438. QDF_BUG(0);
  439. return QDF_STATUS_E_FAILURE;
  440. }
  441. if (!soc->ops->host_stats_ops ||
  442. !soc->ops->host_stats_ops->txrx_get_soc_stats)
  443. return QDF_STATUS_E_FAILURE;
  444. return soc->ops->host_stats_ops->txrx_get_soc_stats(soc, soc_stats);
  445. }
  446. /**
  447. * @brief Call to get peer stats
  448. *
  449. * @param soc - soc handle
  450. * @param vdev_id - vdev_id of vdev object
  451. * @param peer_mac - mac address of the peer
  452. * @return - struct cdp_peer_stats
  453. */
  454. static inline QDF_STATUS
  455. cdp_host_get_peer_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  456. uint8_t *peer_mac,
  457. struct cdp_peer_stats *peer_stats)
  458. {
  459. if (!soc || !soc->ops) {
  460. dp_cdp_debug("Invalid Instance");
  461. QDF_BUG(0);
  462. return QDF_STATUS_E_FAILURE;
  463. }
  464. if (!soc->ops->host_stats_ops ||
  465. !soc->ops->host_stats_ops->txrx_get_peer_stats)
  466. return QDF_STATUS_E_FAILURE;
  467. return soc->ops->host_stats_ops->txrx_get_peer_stats(soc, vdev_id,
  468. peer_mac,
  469. peer_stats);
  470. }
  471. /**
  472. * @brief Call to reset ald stats
  473. *
  474. * @param soc - soc handle
  475. * @param vdev_id - vdev_id of vdev object
  476. * @param peer_mac - mac address of the peer
  477. * @return - void
  478. */
  479. static inline QDF_STATUS
  480. cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  481. uint8_t *peer_mac)
  482. {
  483. if (!soc || !soc->ops) {
  484. dp_cdp_debug("Invalid Instance");
  485. QDF_BUG(0);
  486. return QDF_STATUS_E_FAILURE;
  487. }
  488. if (!soc->ops->host_stats_ops ||
  489. !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats)
  490. return QDF_STATUS_E_FAILURE;
  491. return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(soc,
  492. vdev_id,
  493. peer_mac);
  494. }
  495. /**
  496. * @brief Call to reset peer stats
  497. *
  498. * @param soc - soc handle
  499. * @param vdev_id - vdev_id of vdev object
  500. * @param peer_mac - mac address of the peer
  501. * @return - QDF_STATUS
  502. */
  503. static inline QDF_STATUS
  504. cdp_host_reset_peer_stats(ol_txrx_soc_handle soc,
  505. uint8_t vdev_id, uint8_t *peer_mac)
  506. {
  507. if (!soc || !soc->ops) {
  508. dp_cdp_debug("Invalid Instance");
  509. QDF_BUG(0);
  510. return QDF_STATUS_E_FAILURE;
  511. }
  512. if (!soc->ops->host_stats_ops ||
  513. !soc->ops->host_stats_ops->txrx_reset_peer_stats)
  514. return QDF_STATUS_E_FAILURE;
  515. return soc->ops->host_stats_ops->txrx_reset_peer_stats(soc,
  516. vdev_id,
  517. peer_mac);
  518. }
  519. /**
  520. * @brief Call to get vdev stats
  521. *
  522. * @param soc - dp soc object
  523. * @param vdev_id - id of dp vdev object
  524. * @param buf - buffer
  525. * @return - int
  526. */
  527. static inline int
  528. cdp_host_get_vdev_stats(ol_txrx_soc_handle soc,
  529. uint8_t vdev_id,
  530. struct cdp_vdev_stats *buf,
  531. bool is_aggregate)
  532. {
  533. if (!soc || !soc->ops) {
  534. dp_cdp_debug("Invalid Instance");
  535. QDF_BUG(0);
  536. return 0;
  537. }
  538. if (!soc->ops->host_stats_ops ||
  539. !soc->ops->host_stats_ops->txrx_get_vdev_stats)
  540. return 0;
  541. return soc->ops->host_stats_ops->txrx_get_vdev_stats(soc, vdev_id,
  542. buf,
  543. is_aggregate);
  544. }
  545. /**
  546. * @brief Call to update vdev stats received from firmware
  547. * (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp
  548. *
  549. * @param data - stats data to be updated
  550. * @param size - size of stats data
  551. * @param stats_id - stats id
  552. * @return - int
  553. */
  554. static inline int
  555. cdp_update_host_vdev_stats(ol_txrx_soc_handle soc,
  556. void *data,
  557. uint32_t size,
  558. uint32_t stats_id)
  559. {
  560. if (!soc || !soc->ops) {
  561. dp_cdp_debug("Invalid Instance");
  562. QDF_BUG(0);
  563. return 0;
  564. }
  565. if (!soc->ops->host_stats_ops ||
  566. !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats)
  567. return 0;
  568. return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats
  569. (soc,
  570. data,
  571. size,
  572. stats_id);
  573. }
  574. /**
  575. * @brief Call to get vdev extd stats
  576. *
  577. * @param soc - soc handle
  578. * @param vdev_id - id of dp vdev object
  579. * @param buf - buffer
  580. * @return - int
  581. */
  582. static inline int
  583. cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc,
  584. uint8_t vdev_id,
  585. wmi_host_vdev_extd_stats *buf)
  586. {
  587. if (!soc || !soc->ops) {
  588. dp_cdp_debug("Invalid Instance");
  589. QDF_BUG(0);
  590. return 0;
  591. }
  592. if (!soc->ops->host_stats_ops ||
  593. !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats)
  594. return 0;
  595. return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(soc, vdev_id,
  596. buf);
  597. }
  598. /**
  599. * @brief Call to get cdp_pdev_stats
  600. *
  601. * @param soc - soc handle
  602. * @param pdev_id - id of dp pdev object
  603. * @param buf - buffer to hold cdp_pdev_stats
  604. * @return - success/failure
  605. */
  606. static inline int
  607. cdp_host_get_pdev_stats(ol_txrx_soc_handle soc,
  608. uint8_t pdev_id, struct cdp_pdev_stats *buf)
  609. {
  610. if (!soc || !soc->ops) {
  611. dp_cdp_debug("Invalid Instance");
  612. QDF_BUG(0);
  613. return 0;
  614. }
  615. if (!soc->ops->host_stats_ops ||
  616. !soc->ops->host_stats_ops->txrx_get_pdev_stats)
  617. return 0;
  618. return soc->ops->host_stats_ops->txrx_get_pdev_stats(soc, pdev_id, buf);
  619. }
  620. /**
  621. * @brief Call to get radio stats
  622. *
  623. * @param soc - soc handle
  624. * @param pdev_id - id of dp pdev object
  625. * @param scn_stats_user - stats buffer
  626. * @return - int
  627. */
  628. static inline int
  629. cdp_host_get_radio_stats(ol_txrx_soc_handle soc,
  630. uint8_t pdev_id,
  631. void *buf)
  632. {
  633. if (!soc || !soc->ops) {
  634. dp_cdp_debug("Invalid Instance");
  635. QDF_BUG(0);
  636. return 0;
  637. }
  638. if (!soc->ops->host_stats_ops ||
  639. !soc->ops->host_stats_ops->txrx_get_radio_stats)
  640. return 0;
  641. return soc->ops->host_stats_ops->txrx_get_radio_stats(soc, pdev_id,
  642. buf);
  643. }
  644. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  645. static inline int
  646. cdp_get_scan_spcl_vap_stats(ol_txrx_soc_handle soc,
  647. uint8_t vdev_id,
  648. struct cdp_scan_spcl_vap_stats *stats)
  649. {
  650. if (!soc || !soc->ops) {
  651. dp_cdp_debug("Invalid Instance");
  652. QDF_BUG(0);
  653. return QDF_STATUS_E_FAILURE;
  654. }
  655. if (!soc->ops->host_stats_ops ||
  656. !soc->ops->host_stats_ops->txrx_get_scan_spcl_vap_stats)
  657. return QDF_STATUS_E_FAILURE;
  658. return soc->ops->host_stats_ops->txrx_get_scan_spcl_vap_stats(soc,
  659. vdev_id,
  660. stats);
  661. }
  662. #endif
  663. /**
  664. * cdp_get_peer_delay_stats() - Call to get per peer delay stats
  665. * @soc: soc handle
  666. * @vdev_id: id of dp_vdev handle
  667. * @peer_mac: peer mac address
  668. * @delay_stats: user allocated buffer for peer delay stats
  669. *
  670. * return: status Success/Failure
  671. */
  672. static inline QDF_STATUS
  673. cdp_get_peer_delay_stats(ol_txrx_soc_handle soc,
  674. uint8_t vdev_id,
  675. uint8_t *peer_mac,
  676. struct cdp_delay_tid_stats *delay_stats)
  677. {
  678. if (!soc || !soc->ops) {
  679. dp_cdp_debug("Invalid Instance");
  680. QDF_BUG(0);
  681. return QDF_STATUS_E_FAILURE;
  682. }
  683. if (!soc->ops->host_stats_ops ||
  684. !soc->ops->host_stats_ops->txrx_get_peer_delay_stats)
  685. return QDF_STATUS_E_FAILURE;
  686. return soc->ops->host_stats_ops->txrx_get_peer_delay_stats(soc,
  687. vdev_id,
  688. peer_mac,
  689. delay_stats);
  690. }
  691. /**
  692. * cdp_get_peer_jitter_stats() - Call to get per peer jitter stats
  693. * @soc: soc handle
  694. * @pdev_id: id of dp_pdev handle
  695. * @vdev_id: id of dp_vdev handle
  696. * @peer_mac: peer mac address
  697. * @tid_stats: user allocated buffer for tid_stats
  698. *
  699. * return: status Success/Failure
  700. */
  701. static inline QDF_STATUS
  702. cdp_get_peer_jitter_stats(ol_txrx_soc_handle soc,
  703. uint8_t pdev_id,
  704. uint8_t vdev_id,
  705. uint8_t *peer_mac,
  706. struct cdp_peer_tid_stats *tid_stats)
  707. {
  708. if (!soc || !soc->ops) {
  709. dp_cdp_debug("Invalid Instance");
  710. QDF_BUG(0);
  711. return QDF_STATUS_E_FAILURE;
  712. }
  713. if (!soc->ops->host_stats_ops ||
  714. !soc->ops->host_stats_ops->txrx_get_peer_jitter_stats)
  715. return QDF_STATUS_E_FAILURE;
  716. return soc->ops->host_stats_ops->txrx_get_peer_jitter_stats(soc,
  717. pdev_id,
  718. vdev_id,
  719. peer_mac,
  720. tid_stats);
  721. }
  722. /**
  723. * cdp_mon_pdev_get_rx_stats() - Call to get monitor pdev rx stats
  724. * @soc: soc handle
  725. * @pdev_id: id of dp_pdev handle
  726. * @stats: user allocated buffer for dp pdev mon stats
  727. *
  728. * return: status Success/Failure
  729. */
  730. static inline QDF_STATUS
  731. cdp_mon_pdev_get_rx_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  732. struct cdp_pdev_mon_stats *stats)
  733. {
  734. if (!soc || !soc->ops) {
  735. dp_cdp_debug("Invalid Instance");
  736. QDF_BUG(0);
  737. return QDF_STATUS_E_FAILURE;
  738. }
  739. if (!soc->ops->mon_ops ||
  740. !soc->ops->mon_ops->get_mon_pdev_rx_stats)
  741. return QDF_STATUS_E_FAILURE;
  742. return soc->ops->mon_ops->get_mon_pdev_rx_stats(soc, pdev_id, stats);
  743. }
  744. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  745. /**
  746. * cdp_get_peer_tx_capture_stats() - Call to get peer tx capture stats
  747. * @soc: soc handle
  748. * @vdev_id: id of dp_vdev handle
  749. * @peer_mac: peer mac address
  750. * @stats: pointer to peer tx capture stats
  751. *
  752. * return: status Success/Failure
  753. */
  754. static inline QDF_STATUS
  755. cdp_get_peer_tx_capture_stats(ol_txrx_soc_handle soc,
  756. uint8_t vdev_id,
  757. uint8_t *peer_mac,
  758. struct cdp_peer_tx_capture_stats *stats)
  759. {
  760. if (!soc || !soc->ops) {
  761. dp_cdp_debug("Invalid Instance");
  762. QDF_BUG(0);
  763. return QDF_STATUS_E_FAILURE;
  764. }
  765. if (!soc->ops->host_stats_ops ||
  766. !soc->ops->host_stats_ops->get_peer_tx_capture_stats)
  767. return QDF_STATUS_E_FAILURE;
  768. return soc->ops->host_stats_ops->get_peer_tx_capture_stats(soc, vdev_id,
  769. peer_mac,
  770. stats);
  771. }
  772. /**
  773. * cdp_get_pdev_tx_capture_stats() - Call to get pdev tx capture stats
  774. * @soc: soc handle
  775. * @pdev_id: id of dp_pdev handle
  776. * @stats: pointer to pdev tx capture stats
  777. *
  778. * return: status Success/Failure
  779. */
  780. static inline QDF_STATUS
  781. cdp_get_pdev_tx_capture_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  782. struct cdp_pdev_tx_capture_stats *stats)
  783. {
  784. if (!soc || !soc->ops) {
  785. dp_cdp_debug("Invalid Instance");
  786. QDF_BUG(0);
  787. return QDF_STATUS_E_FAILURE;
  788. }
  789. if (!soc->ops->host_stats_ops ||
  790. !soc->ops->host_stats_ops->get_pdev_tx_capture_stats)
  791. return QDF_STATUS_E_FAILURE;
  792. return soc->ops->host_stats_ops->get_pdev_tx_capture_stats(soc, pdev_id,
  793. stats);
  794. }
  795. #endif /* WLAN_TX_PKT_CAPTURE_ENH */
  796. #endif /* _CDP_TXRX_HOST_STATS_H_ */