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