cdp_txrx_host_stats.h 31 KB

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