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