cdp_txrx_host_stats.h 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390
  1. /*
  2. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2023 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. * DOC: cdp_txrx_host_stats.h
  21. * 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: Guard 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. * cdp_enable_enhanced_stats() - Enable enhanced stats functionality.
  126. * @soc: the soc object
  127. * @pdev_id: id of the physical device object
  128. *
  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->mon_ops ||
  140. !soc->ops->mon_ops->txrx_enable_enhanced_stats)
  141. return QDF_STATUS_E_FAILURE;
  142. return soc->ops->mon_ops->txrx_enable_enhanced_stats
  143. (soc, pdev_id);
  144. }
  145. /**
  146. * cdp_disable_enhanced_stats() - Disable enhanced stats functionality.
  147. * @soc: the soc object
  148. * @pdev_id: id of the physical device object
  149. *
  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->mon_ops ||
  161. !soc->ops->mon_ops->txrx_disable_enhanced_stats)
  162. return QDF_STATUS_E_FAILURE;
  163. return soc->ops->mon_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. * @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. * cdp_update_pdev_host_stats() - Update pdev host stats received from firmware
  342. * (wmi_host_pdev_stats and wmi_host_pdev_ext_stats) into dp
  343. * @soc: soc handle
  344. * @pdev_id: id of the physical device object
  345. * @data: pdev stats
  346. * @stats_id: statistics to be updated
  347. *
  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. * cdp_update_vdev_host_stats() - Update vdev host stats
  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. * cdp_txrx_get_peer_stats_param() - Call to get specified peer stats
  397. * @soc: soc handle
  398. * @vdev_id: vdev_id of vdev object
  399. * @peer_mac: mac address of the peer
  400. * @type: enum of required stats
  401. * @buf: buffer to hold the value
  402. *
  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. * cdp_host_get_soc_stats() - Call to get soc stats
  427. * @soc: soc handle
  428. * @soc_stats: buffer for cdp soc stats
  429. *
  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. * cdp_host_get_peer_stats() - Call to get peer stats
  447. * @soc: soc handle
  448. * @vdev_id: vdev_id of vdev object
  449. * @peer_mac: mac address of the peer
  450. * @peer_stats: destination buffer
  451. *
  452. * Return: QDF_STATUS
  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. * cdp_host_get_peer_stats_based_on_peer_type() - Fetch peer stats based on the
  473. * peer type
  474. * @soc: soc handle
  475. * @vdev_id: vdev_id of vdev object
  476. * @peer_mac: mac address of the peer
  477. * @peer_stats: destination buffer
  478. * @peer_type: type of peer
  479. *
  480. * Return: QDF_STATUS
  481. */
  482. static inline QDF_STATUS
  483. cdp_host_get_peer_stats_based_on_peer_type(ol_txrx_soc_handle soc, uint8_t vdev_id,
  484. uint8_t *peer_mac,
  485. struct cdp_peer_stats *peer_stats,
  486. enum cdp_peer_type peer_type)
  487. {
  488. if (!soc || !soc->ops) {
  489. dp_cdp_debug("Invalid Instance");
  490. QDF_BUG(0);
  491. return QDF_STATUS_E_FAILURE;
  492. }
  493. if (!soc->ops->host_stats_ops ||
  494. !soc->ops->host_stats_ops->txrx_get_peer_stats_based_on_peer_type)
  495. return QDF_STATUS_E_FAILURE;
  496. return soc->ops->host_stats_ops->txrx_get_peer_stats_based_on_peer_type(
  497. soc, vdev_id,
  498. peer_mac,
  499. peer_stats,
  500. peer_type);
  501. }
  502. /**
  503. * cdp_host_get_per_link_peer_stats() - Call to get peer stats
  504. * @soc: soc handle
  505. * @vdev_id: vdev_id of vdev object
  506. * @peer_mac: mac address of the peer
  507. * @peer_stats: destination buffer
  508. * @peer_type: Peer type
  509. * @num_link: Number of ML links
  510. *
  511. * NOTE: For peer_type = CDP_MLD_PEER_TYPE peer_stats should point to
  512. * buffer of size = (sizeof(*peer_stats) * num_link)
  513. *
  514. * Return: QDF_STATUS
  515. */
  516. static inline QDF_STATUS
  517. cdp_host_get_per_link_peer_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  518. uint8_t *peer_mac,
  519. struct cdp_peer_stats *peer_stats,
  520. enum cdp_peer_type peer_type,
  521. uint8_t num_link)
  522. {
  523. if (!soc || !soc->ops) {
  524. dp_cdp_debug("Invalid Instance");
  525. QDF_BUG(0);
  526. return QDF_STATUS_E_FAILURE;
  527. }
  528. if (!soc->ops->host_stats_ops ||
  529. !soc->ops->host_stats_ops->txrx_get_per_link_stats)
  530. return QDF_STATUS_E_FAILURE;
  531. return soc->ops->host_stats_ops->txrx_get_per_link_stats(soc, vdev_id,
  532. peer_mac,
  533. peer_stats,
  534. peer_type,
  535. num_link);
  536. }
  537. /**
  538. * cdp_host_reset_peer_ald_stats() - Call to reset ald stats
  539. * @soc: soc handle
  540. * @vdev_id: vdev_id of vdev object
  541. * @peer_mac: mac address of the peer
  542. *
  543. * Return: QDF_STATUS
  544. */
  545. static inline QDF_STATUS
  546. cdp_host_reset_peer_ald_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  547. uint8_t *peer_mac)
  548. {
  549. if (!soc || !soc->ops) {
  550. dp_cdp_debug("Invalid Instance");
  551. QDF_BUG(0);
  552. return QDF_STATUS_E_FAILURE;
  553. }
  554. if (!soc->ops->host_stats_ops ||
  555. !soc->ops->host_stats_ops->txrx_reset_peer_ald_stats)
  556. return QDF_STATUS_E_FAILURE;
  557. return soc->ops->host_stats_ops->txrx_reset_peer_ald_stats(soc,
  558. vdev_id,
  559. peer_mac);
  560. }
  561. /**
  562. * cdp_host_reset_peer_stats() - Call to reset peer stats
  563. * @soc: soc handle
  564. * @vdev_id: vdev_id of vdev object
  565. * @peer_mac: mac address of the peer
  566. *
  567. * Return: QDF_STATUS
  568. */
  569. static inline QDF_STATUS
  570. cdp_host_reset_peer_stats(ol_txrx_soc_handle soc,
  571. uint8_t vdev_id, uint8_t *peer_mac)
  572. {
  573. if (!soc || !soc->ops) {
  574. dp_cdp_debug("Invalid Instance");
  575. QDF_BUG(0);
  576. return QDF_STATUS_E_FAILURE;
  577. }
  578. if (!soc->ops->host_stats_ops ||
  579. !soc->ops->host_stats_ops->txrx_reset_peer_stats)
  580. return QDF_STATUS_E_FAILURE;
  581. return soc->ops->host_stats_ops->txrx_reset_peer_stats(soc,
  582. vdev_id,
  583. peer_mac);
  584. }
  585. /**
  586. * cdp_host_get_vdev_stats() - Call to get vdev stats
  587. * @soc: dp soc object
  588. * @vdev_id: id of dp vdev object
  589. * @buf: buffer
  590. * @is_aggregate:
  591. *
  592. * Return: int
  593. */
  594. static inline int
  595. cdp_host_get_vdev_stats(ol_txrx_soc_handle soc,
  596. uint8_t vdev_id,
  597. struct cdp_vdev_stats *buf,
  598. bool is_aggregate)
  599. {
  600. if (!soc || !soc->ops) {
  601. dp_cdp_debug("Invalid Instance");
  602. QDF_BUG(0);
  603. return 0;
  604. }
  605. if (!soc->ops->host_stats_ops ||
  606. !soc->ops->host_stats_ops->txrx_get_vdev_stats)
  607. return 0;
  608. return soc->ops->host_stats_ops->txrx_get_vdev_stats(soc, vdev_id,
  609. buf,
  610. is_aggregate);
  611. }
  612. /**
  613. * cdp_update_host_vdev_stats() - Call to update vdev stats received from
  614. * firmware (wmi_host_vdev_stats and wmi_host_vdev_extd_stats) into dp
  615. * @soc: soc handle
  616. * @data: stats data to be updated
  617. * @size: size of stats data
  618. * @stats_id: stats id
  619. *
  620. * Return: int
  621. */
  622. static inline int
  623. cdp_update_host_vdev_stats(ol_txrx_soc_handle soc,
  624. void *data,
  625. uint32_t size,
  626. uint32_t stats_id)
  627. {
  628. if (!soc || !soc->ops) {
  629. dp_cdp_debug("Invalid Instance");
  630. QDF_BUG(0);
  631. return 0;
  632. }
  633. if (!soc->ops->host_stats_ops ||
  634. !soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats)
  635. return 0;
  636. return soc->ops->host_stats_ops->txrx_process_wmi_host_vdev_stats
  637. (soc,
  638. data,
  639. size,
  640. stats_id);
  641. }
  642. /**
  643. * cdp_get_vdev_extd_stats() - Call to get vdev extd stats
  644. * @soc: soc handle
  645. * @vdev_id: id of dp vdev object
  646. * @buf: buffer
  647. *
  648. * Return: int
  649. */
  650. static inline int
  651. cdp_get_vdev_extd_stats(ol_txrx_soc_handle soc,
  652. uint8_t vdev_id,
  653. wmi_host_vdev_extd_stats *buf)
  654. {
  655. if (!soc || !soc->ops) {
  656. dp_cdp_debug("Invalid Instance");
  657. QDF_BUG(0);
  658. return 0;
  659. }
  660. if (!soc->ops->host_stats_ops ||
  661. !soc->ops->host_stats_ops->txrx_get_vdev_extd_stats)
  662. return 0;
  663. return soc->ops->host_stats_ops->txrx_get_vdev_extd_stats(soc, vdev_id,
  664. buf);
  665. }
  666. /**
  667. * cdp_host_get_pdev_stats() - Call to get cdp_pdev_stats
  668. * @soc: soc handle
  669. * @pdev_id: id of dp pdev object
  670. * @buf: buffer to hold cdp_pdev_stats
  671. *
  672. * Return: success/failure
  673. */
  674. static inline int
  675. cdp_host_get_pdev_stats(ol_txrx_soc_handle soc,
  676. uint8_t pdev_id, struct cdp_pdev_stats *buf)
  677. {
  678. if (!soc || !soc->ops) {
  679. dp_cdp_debug("Invalid Instance");
  680. QDF_BUG(0);
  681. return 0;
  682. }
  683. if (!soc->ops->host_stats_ops ||
  684. !soc->ops->host_stats_ops->txrx_get_pdev_stats)
  685. return 0;
  686. return soc->ops->host_stats_ops->txrx_get_pdev_stats(soc, pdev_id, buf);
  687. }
  688. /**
  689. * cdp_host_get_radio_stats() - Call to get radio stats
  690. * @soc: soc handle
  691. * @pdev_id: id of dp pdev object
  692. * @buf: stats buffer
  693. *
  694. * Return: int
  695. */
  696. static inline int
  697. cdp_host_get_radio_stats(ol_txrx_soc_handle soc,
  698. uint8_t pdev_id,
  699. void *buf)
  700. {
  701. if (!soc || !soc->ops) {
  702. dp_cdp_debug("Invalid Instance");
  703. QDF_BUG(0);
  704. return 0;
  705. }
  706. if (!soc->ops->host_stats_ops ||
  707. !soc->ops->host_stats_ops->txrx_get_radio_stats)
  708. return 0;
  709. return soc->ops->host_stats_ops->txrx_get_radio_stats(soc, pdev_id,
  710. buf);
  711. }
  712. #ifdef QCA_SUPPORT_SCAN_SPCL_VAP_STATS
  713. static inline int
  714. cdp_get_scan_spcl_vap_stats(ol_txrx_soc_handle soc,
  715. uint8_t vdev_id,
  716. struct cdp_scan_spcl_vap_stats *stats)
  717. {
  718. if (!soc || !soc->ops) {
  719. dp_cdp_debug("Invalid Instance");
  720. QDF_BUG(0);
  721. return QDF_STATUS_E_FAILURE;
  722. }
  723. if (!soc->ops->host_stats_ops ||
  724. !soc->ops->host_stats_ops->txrx_get_scan_spcl_vap_stats)
  725. return QDF_STATUS_E_FAILURE;
  726. return soc->ops->host_stats_ops->txrx_get_scan_spcl_vap_stats(soc,
  727. vdev_id,
  728. stats);
  729. }
  730. #endif
  731. /**
  732. * cdp_get_peer_delay_stats() - Call to get per peer delay stats
  733. * @soc: soc handle
  734. * @vdev_id: id of dp_vdev handle
  735. * @peer_mac: peer mac address
  736. * @delay_stats: user allocated buffer for peer delay stats
  737. *
  738. * Return: status Success/Failure
  739. */
  740. static inline QDF_STATUS
  741. cdp_get_peer_delay_stats(ol_txrx_soc_handle soc,
  742. uint8_t vdev_id,
  743. uint8_t *peer_mac,
  744. struct cdp_delay_tid_stats *delay_stats)
  745. {
  746. if (!soc || !soc->ops) {
  747. dp_cdp_debug("Invalid Instance");
  748. QDF_BUG(0);
  749. return QDF_STATUS_E_FAILURE;
  750. }
  751. if (!soc->ops->host_stats_ops ||
  752. !soc->ops->host_stats_ops->txrx_get_peer_delay_stats)
  753. return QDF_STATUS_E_FAILURE;
  754. return soc->ops->host_stats_ops->txrx_get_peer_delay_stats(soc,
  755. vdev_id,
  756. peer_mac,
  757. delay_stats);
  758. }
  759. /**
  760. * cdp_get_peer_jitter_stats() - Call to get per peer jitter stats
  761. * @soc: soc handle
  762. * @pdev_id: id of dp_pdev handle
  763. * @vdev_id: id of dp_vdev handle
  764. * @peer_mac: peer mac address
  765. * @tid_stats: user allocated buffer for tid_stats
  766. *
  767. * Return: status Success/Failure
  768. */
  769. static inline QDF_STATUS
  770. cdp_get_peer_jitter_stats(ol_txrx_soc_handle soc,
  771. uint8_t pdev_id,
  772. uint8_t vdev_id,
  773. uint8_t *peer_mac,
  774. struct cdp_peer_tid_stats *tid_stats)
  775. {
  776. if (!soc || !soc->ops) {
  777. dp_cdp_debug("Invalid Instance");
  778. QDF_BUG(0);
  779. return QDF_STATUS_E_FAILURE;
  780. }
  781. if (!soc->ops->host_stats_ops ||
  782. !soc->ops->host_stats_ops->txrx_get_peer_jitter_stats)
  783. return QDF_STATUS_E_FAILURE;
  784. return soc->ops->host_stats_ops->txrx_get_peer_jitter_stats(soc,
  785. pdev_id,
  786. vdev_id,
  787. peer_mac,
  788. tid_stats);
  789. }
  790. /**
  791. * cdp_mon_pdev_get_rx_stats() - Call to get monitor pdev rx stats
  792. * @soc: soc handle
  793. * @pdev_id: id of dp_pdev handle
  794. * @stats: user allocated buffer for dp pdev mon stats
  795. *
  796. * Return: status Success/Failure
  797. */
  798. static inline QDF_STATUS
  799. cdp_mon_pdev_get_rx_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  800. struct cdp_pdev_mon_stats *stats)
  801. {
  802. if (!soc || !soc->ops) {
  803. dp_cdp_debug("Invalid Instance");
  804. QDF_BUG(0);
  805. return QDF_STATUS_E_FAILURE;
  806. }
  807. if (!soc->ops->mon_ops ||
  808. !soc->ops->mon_ops->get_mon_pdev_rx_stats)
  809. return QDF_STATUS_E_FAILURE;
  810. return soc->ops->mon_ops->get_mon_pdev_rx_stats(soc, pdev_id, stats);
  811. }
  812. #ifdef WLAN_TX_PKT_CAPTURE_ENH
  813. /**
  814. * cdp_get_peer_tx_capture_stats() - Call to get peer tx capture stats
  815. * @soc: soc handle
  816. * @vdev_id: id of dp_vdev handle
  817. * @peer_mac: peer mac address
  818. * @stats: pointer to peer tx capture stats
  819. *
  820. * Return: status Success/Failure
  821. */
  822. static inline QDF_STATUS
  823. cdp_get_peer_tx_capture_stats(ol_txrx_soc_handle soc,
  824. uint8_t vdev_id,
  825. uint8_t *peer_mac,
  826. struct cdp_peer_tx_capture_stats *stats)
  827. {
  828. if (!soc || !soc->ops) {
  829. dp_cdp_debug("Invalid Instance");
  830. QDF_BUG(0);
  831. return QDF_STATUS_E_FAILURE;
  832. }
  833. if (!soc->ops->host_stats_ops ||
  834. !soc->ops->host_stats_ops->get_peer_tx_capture_stats)
  835. return QDF_STATUS_E_FAILURE;
  836. return soc->ops->host_stats_ops->get_peer_tx_capture_stats(soc, vdev_id,
  837. peer_mac,
  838. stats);
  839. }
  840. /**
  841. * cdp_get_pdev_tx_capture_stats() - Call to get pdev tx capture stats
  842. * @soc: soc handle
  843. * @pdev_id: id of dp_pdev handle
  844. * @stats: pointer to pdev tx capture stats
  845. *
  846. * Return: status Success/Failure
  847. */
  848. static inline QDF_STATUS
  849. cdp_get_pdev_tx_capture_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  850. struct cdp_pdev_tx_capture_stats *stats)
  851. {
  852. if (!soc || !soc->ops) {
  853. dp_cdp_debug("Invalid Instance");
  854. QDF_BUG(0);
  855. return QDF_STATUS_E_FAILURE;
  856. }
  857. if (!soc->ops->host_stats_ops ||
  858. !soc->ops->host_stats_ops->get_pdev_tx_capture_stats)
  859. return QDF_STATUS_E_FAILURE;
  860. return soc->ops->host_stats_ops->get_pdev_tx_capture_stats(soc, pdev_id,
  861. stats);
  862. }
  863. #endif /* WLAN_TX_PKT_CAPTURE_ENH */
  864. #ifdef HW_TX_DELAY_STATS_ENABLE
  865. /**
  866. * cdp_enable_disable_vdev_tx_delay_stats() - Start/Stop tx delay stats capture
  867. * @soc: soc handle
  868. * @vdev_id: vdev id
  869. * @value: value to be set
  870. *
  871. * Return: None
  872. */
  873. static inline void
  874. cdp_enable_disable_vdev_tx_delay_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
  875. uint8_t value)
  876. {
  877. if (!soc || !soc->ops) {
  878. dp_cdp_debug("Invalid Instance");
  879. return;
  880. }
  881. if (!soc->ops->host_stats_ops ||
  882. !soc->ops->host_stats_ops->enable_disable_vdev_tx_delay_stats)
  883. return;
  884. soc->ops->host_stats_ops->enable_disable_vdev_tx_delay_stats(soc,
  885. vdev_id,
  886. value);
  887. }
  888. /**
  889. * cdp_vdev_is_tx_delay_stats_enabled() - Check if the Tx delay stats
  890. * is enabled or not for the given vdev_id
  891. * @soc: soc handle
  892. * @vdev_id: vdev_id
  893. *
  894. * Return: 1 if enabled, 0 if disabled
  895. */
  896. static inline uint8_t
  897. cdp_vdev_is_tx_delay_stats_enabled(ol_txrx_soc_handle soc, uint8_t vdev_id)
  898. {
  899. if (!soc || !soc->ops || !soc->ops->host_stats_ops) {
  900. dp_cdp_debug("Invalid Instance:");
  901. return 0;
  902. }
  903. if (soc->ops->host_stats_ops->is_tx_delay_stats_enabled)
  904. return soc->ops->host_stats_ops->is_tx_delay_stats_enabled(soc,
  905. vdev_id);
  906. return 0;
  907. }
  908. #endif
  909. /**
  910. * cdp_get_pdev_tid_stats() - Get pdev tid stats
  911. * @soc: soc handle
  912. * @pdev_id: Pdev id
  913. * @tid_stats: Pointer to cdp_tid_stats_intf
  914. *
  915. * Return: status Success/Failure
  916. */
  917. static inline QDF_STATUS
  918. cdp_get_pdev_tid_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
  919. struct cdp_tid_stats_intf *tid_stats)
  920. {
  921. if (!soc || !soc->ops || !soc->ops->host_stats_ops) {
  922. dp_cdp_debug("Invalid Instance:");
  923. return QDF_STATUS_E_FAILURE;
  924. }
  925. if (!soc->ops->host_stats_ops->txrx_get_pdev_tid_stats)
  926. return QDF_STATUS_E_FAILURE;
  927. return soc->ops->host_stats_ops->txrx_get_pdev_tid_stats(soc, pdev_id,
  928. tid_stats);
  929. }
  930. #ifdef WLAN_CONFIG_TELEMETRY_AGENT
  931. /**
  932. * cdp_get_pdev_telemetry_stats() - function to get pdev telemetry stats
  933. * @soc: soc handle
  934. * @pdev_id: pdev id
  935. * @stats: pointer to pdev telemetry stats
  936. *
  937. * Return: status
  938. */
  939. static inline QDF_STATUS cdp_get_pdev_telemetry_stats(
  940. ol_txrx_soc_handle soc,
  941. uint8_t pdev_id,
  942. struct cdp_pdev_telemetry_stats *stats)
  943. {
  944. if (!soc || !soc->ops) {
  945. dp_cdp_debug("Invalid Instance");
  946. QDF_BUG(0);
  947. return QDF_STATUS_E_FAILURE;
  948. }
  949. if (!soc->ops->host_stats_ops ||
  950. !soc->ops->host_stats_ops->txrx_pdev_telemetry_stats)
  951. return QDF_STATUS_E_FAILURE;
  952. return soc->ops->host_stats_ops->txrx_pdev_telemetry_stats(
  953. soc, pdev_id, stats);
  954. }
  955. /**
  956. * cdp_get_peer_telemetry_stats() - function to get peer telemetry stats
  957. * @soc: soc handle
  958. * @addr: peer address
  959. * @stats: pointer to peer telemetry stats
  960. *
  961. * Return: status
  962. */
  963. static inline QDF_STATUS cdp_get_peer_telemetry_stats(
  964. ol_txrx_soc_handle soc,
  965. uint8_t *addr,
  966. struct cdp_peer_telemetry_stats *stats)
  967. {
  968. if (!soc || !soc->ops) {
  969. dp_cdp_debug("Invalid Instance");
  970. QDF_BUG(0);
  971. return QDF_STATUS_E_FAILURE;
  972. }
  973. if (!soc->ops->host_stats_ops ||
  974. !soc->ops->host_stats_ops->txrx_peer_telemetry_stats)
  975. return QDF_STATUS_E_FAILURE;
  976. return soc->ops->host_stats_ops->txrx_peer_telemetry_stats(
  977. soc, addr, stats);
  978. }
  979. /**
  980. * cdp_get_pdev_deter_stats(): function to get pdev deterministic stats
  981. * @soc: soc handle
  982. * @pdev_id: pdev id
  983. * @stats: pointer to pdev deterministic stats
  984. *
  985. * return: status
  986. */
  987. static inline QDF_STATUS cdp_get_pdev_deter_stats(
  988. ol_txrx_soc_handle soc,
  989. uint8_t pdev_id,
  990. struct cdp_pdev_deter_stats *stats)
  991. {
  992. if (!soc || !soc->ops) {
  993. dp_cdp_debug("Invalid Instance");
  994. QDF_BUG(0);
  995. return QDF_STATUS_E_FAILURE;
  996. }
  997. if (!soc->ops->host_stats_ops ||
  998. !soc->ops->host_stats_ops->txrx_pdev_deter_stats)
  999. return QDF_STATUS_E_FAILURE;
  1000. return soc->ops->host_stats_ops->txrx_pdev_deter_stats(
  1001. soc, pdev_id, stats);
  1002. }
  1003. /**
  1004. * cdp_get_peer_deter_stats(): function to get peer deterministic stats
  1005. * @soc: soc handle
  1006. * @vdev_id: id of vdev handle
  1007. * @addr: peer address
  1008. * @stats: pointer to peer telemetry stats
  1009. *
  1010. * return: status
  1011. */
  1012. static inline QDF_STATUS cdp_get_peer_deter_stats(
  1013. ol_txrx_soc_handle soc,
  1014. uint8_t vdev_id,
  1015. uint8_t *addr,
  1016. struct cdp_peer_deter_stats *stats)
  1017. {
  1018. if (!soc || !soc->ops) {
  1019. dp_cdp_debug("Invalid Instance");
  1020. QDF_BUG(0);
  1021. return QDF_STATUS_E_FAILURE;
  1022. }
  1023. if (!soc->ops->host_stats_ops ||
  1024. !soc->ops->host_stats_ops->txrx_peer_deter_stats)
  1025. return QDF_STATUS_E_FAILURE;
  1026. return soc->ops->host_stats_ops->txrx_peer_deter_stats(
  1027. soc, vdev_id, addr, stats);
  1028. }
  1029. /**
  1030. * cdp_update_pdev_chan_util_stats(): function to update pdev channel util stats
  1031. * @soc: soc handle
  1032. * @pdev_id: pdev id
  1033. * @ch_util: pointer to pdev ch util stats
  1034. *
  1035. * return: status
  1036. */
  1037. static inline QDF_STATUS cdp_update_pdev_chan_util_stats(
  1038. ol_txrx_soc_handle soc,
  1039. uint8_t pdev_id,
  1040. struct cdp_pdev_chan_util_stats *ch_util)
  1041. {
  1042. if (!soc || !soc->ops) {
  1043. dp_cdp_debug("Invalid Instance");
  1044. QDF_BUG(0);
  1045. return QDF_STATUS_E_FAILURE;
  1046. }
  1047. if (!soc->ops->host_stats_ops ||
  1048. !soc->ops->host_stats_ops->txrx_update_pdev_chan_util_stats)
  1049. return QDF_STATUS_E_FAILURE;
  1050. return soc->ops->host_stats_ops->txrx_update_pdev_chan_util_stats(
  1051. soc, pdev_id, ch_util);
  1052. }
  1053. #endif
  1054. /**
  1055. * cdp_get_peer_extd_rate_link_stats() - cdp function to get peer
  1056. * extended rate and link stats
  1057. * @soc: soc handle
  1058. * @mac_addr: mac address
  1059. *
  1060. * Return: status
  1061. */
  1062. static inline QDF_STATUS cdp_get_peer_extd_rate_link_stats(
  1063. ol_txrx_soc_handle soc,
  1064. uint8_t *mac_addr)
  1065. {
  1066. if (!soc || !soc->ops) {
  1067. dp_cdp_debug("Invalid Instance");
  1068. QDF_BUG(0);
  1069. return QDF_STATUS_E_FAILURE;
  1070. }
  1071. if (!soc->ops->host_stats_ops ||
  1072. !soc->ops->host_stats_ops->txrx_get_peer_extd_rate_link_stats)
  1073. return QDF_STATUS_E_FAILURE;
  1074. return soc->ops->host_stats_ops->txrx_get_peer_extd_rate_link_stats(
  1075. soc, mac_addr);
  1076. }
  1077. /**
  1078. * cdp_get_pdev_obss_pd_stats() - function to get pdev obss stats
  1079. * @soc: soc handle
  1080. * @pdev_id: pdev id
  1081. * @stats: pointer to pdev obss stats
  1082. * @req: Pointer to CDP TxRx stats
  1083. *
  1084. * Return: status
  1085. */
  1086. static inline QDF_STATUS cdp_get_pdev_obss_pd_stats(
  1087. ol_txrx_soc_handle soc,
  1088. uint8_t pdev_id,
  1089. struct cdp_pdev_obss_pd_stats_tlv *stats,
  1090. struct cdp_txrx_stats_req *req)
  1091. {
  1092. if (!soc || !soc->ops) {
  1093. dp_cdp_debug("Invalid Instance");
  1094. QDF_BUG(0);
  1095. return QDF_STATUS_E_FAILURE;
  1096. }
  1097. if (!soc->ops->host_stats_ops ||
  1098. !soc->ops->host_stats_ops->get_pdev_obss_stats)
  1099. return QDF_STATUS_E_FAILURE;
  1100. return soc->ops->host_stats_ops->get_pdev_obss_stats(
  1101. soc, pdev_id, stats, req);
  1102. }
  1103. /**
  1104. * cdp_clear_pdev_obss_pd_stats() - function to clear pdev obss stats
  1105. * @soc: soc handle
  1106. * @pdev_id: pdev id
  1107. * @req: Pointer to CDP TxRx stats request. mac_id will be pre-filled
  1108. * and should not be overwritten
  1109. *
  1110. * Return: status
  1111. */
  1112. static inline QDF_STATUS cdp_clear_pdev_obss_pd_stats(
  1113. ol_txrx_soc_handle soc,
  1114. uint8_t pdev_id, struct cdp_txrx_stats_req *req)
  1115. {
  1116. if (!soc || !soc->ops) {
  1117. dp_cdp_debug("Invalid Instance");
  1118. QDF_BUG(0);
  1119. return QDF_STATUS_E_FAILURE;
  1120. }
  1121. if (!soc->ops->host_stats_ops ||
  1122. !soc->ops->host_stats_ops->clear_pdev_obss_pd_stats)
  1123. return QDF_STATUS_E_FAILURE;
  1124. return soc->ops->host_stats_ops->clear_pdev_obss_pd_stats(
  1125. soc, pdev_id, req);
  1126. }
  1127. /*
  1128. * cdp_host_get_interface_stats - Get vdev stats for ath interface
  1129. * @soc: soc handle
  1130. * @vdev_id: vdev_id
  1131. * @buf: buffer to hold vdev_stats
  1132. *
  1133. * return: QDF_STATUS
  1134. */
  1135. static inline QDF_STATUS
  1136. cdp_host_get_interface_stats(ol_txrx_soc_handle soc,
  1137. uint8_t vdev_id,
  1138. struct cdp_vdev_stats *buf)
  1139. {
  1140. if (!soc || !soc->ops) {
  1141. QDF_BUG(0);
  1142. return QDF_STATUS_E_FAILURE;
  1143. }
  1144. if (!soc->ops->host_stats_ops ||
  1145. !soc->ops->host_stats_ops->txrx_get_interface_stats)
  1146. return QDF_STATUS_E_FAILURE;
  1147. return soc->ops->host_stats_ops->txrx_get_interface_stats(soc,
  1148. vdev_id,
  1149. buf,
  1150. true);
  1151. }
  1152. #ifdef WLAN_FEATURE_TX_LATENCY_STATS
  1153. /**
  1154. * cdp_host_tx_latency_stats_config() - config transmit latency statistics for
  1155. * specified vdev
  1156. * @soc: Handle to struct dp_soc
  1157. * @vdev_id: vdev id
  1158. * @config: configuration for transmit latency statistics
  1159. *
  1160. * Return: QDF_STATUS
  1161. */
  1162. static inline QDF_STATUS
  1163. cdp_host_tx_latency_stats_config(ol_txrx_soc_handle soc,
  1164. uint8_t vdev_id,
  1165. struct cdp_tx_latency_config *config)
  1166. {
  1167. if (!soc || !soc->ops) {
  1168. QDF_BUG(0);
  1169. return QDF_STATUS_E_FAILURE;
  1170. }
  1171. if (!soc->ops->host_stats_ops ||
  1172. !soc->ops->host_stats_ops->tx_latency_stats_config)
  1173. return QDF_STATUS_E_FAILURE;
  1174. return soc->ops->host_stats_ops->tx_latency_stats_config(soc,
  1175. vdev_id,
  1176. config);
  1177. }
  1178. /**
  1179. * cdp_host_tx_latency_stats_fetch() - fetch transmit latency statistics for
  1180. * specified link mac address
  1181. * @soc: Handle to struct dp_soc
  1182. * @vdev_id: vdev id
  1183. * @mac: link mac address of remote peer
  1184. * @latency: buffer to hold per-link transmit latency statistics
  1185. *
  1186. * Return: QDF_STATUS
  1187. */
  1188. static inline QDF_STATUS
  1189. cdp_host_tx_latency_stats_fetch(ol_txrx_soc_handle soc,
  1190. uint8_t vdev_id, uint8_t *mac,
  1191. struct cdp_tx_latency *latency)
  1192. {
  1193. if (!soc || !soc->ops) {
  1194. QDF_BUG(0);
  1195. return QDF_STATUS_E_FAILURE;
  1196. }
  1197. if (!soc->ops->host_stats_ops ||
  1198. !soc->ops->host_stats_ops->tx_latency_stats_fetch)
  1199. return QDF_STATUS_E_FAILURE;
  1200. return soc->ops->host_stats_ops->tx_latency_stats_fetch(soc,
  1201. vdev_id,
  1202. mac,
  1203. latency);
  1204. }
  1205. /**
  1206. * cdp_host_tx_latency_stats_register_cb() - register transmit latency
  1207. * statistics callback
  1208. * @soc: Handle to struct dp_soc
  1209. * @cb: callback function for transmit latency statistics
  1210. *
  1211. * Return: QDF_STATUS
  1212. */
  1213. static inline QDF_STATUS
  1214. cdp_host_tx_latency_stats_register_cb(ol_txrx_soc_handle soc,
  1215. cdp_tx_latency_cb cb)
  1216. {
  1217. if (!soc || !soc->ops) {
  1218. QDF_BUG(0);
  1219. return QDF_STATUS_E_FAILURE;
  1220. }
  1221. if (!soc->ops->host_stats_ops ||
  1222. !soc->ops->host_stats_ops->tx_latency_stats_register_cb)
  1223. return QDF_STATUS_E_FAILURE;
  1224. return soc->ops->host_stats_ops->tx_latency_stats_register_cb(soc, cb);
  1225. }
  1226. #endif
  1227. #endif /* _CDP_TXRX_HOST_STATS_H_ */