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