cdp_txrx_host_stats.h 34 KB

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