xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2017,2019,2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 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 /**
21  * DOC: cdp_txrx_stats.h
22  * Define the host data path statistics API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_STATS_H_
26 #define _CDP_TXRX_STATS_H_
27 #include <cdp_txrx_ops.h>
28 #include <cdp_txrx_cmn.h>
29 
30 static inline QDF_STATUS
cdp_clear_stats(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t bitmap)31 cdp_clear_stats(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t bitmap)
32 {
33 
34 	if (!soc || !soc->ops) {
35 		dp_cdp_debug("Invalid Instance");
36 		QDF_BUG(0);
37 		return QDF_STATUS_E_INVAL;
38 	}
39 
40 	if (!soc->ops->mob_stats_ops ||
41 	    !soc->ops->mob_stats_ops->clear_stats)
42 		return QDF_STATUS_E_INVAL;
43 
44 	return soc->ops->mob_stats_ops->clear_stats(soc, pdev_id, bitmap);
45 }
46 
47 static inline int
cdp_stats(ol_txrx_soc_handle soc,uint8_t vdev_id,char * buffer,unsigned int buf_len)48 cdp_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, char *buffer,
49 		unsigned int buf_len)
50 {
51 	if (!soc || !soc->ops) {
52 		dp_cdp_debug("Invalid Instance");
53 		QDF_BUG(0);
54 		return 0;
55 	}
56 
57 	if (!soc->ops->mob_stats_ops ||
58 	    !soc->ops->mob_stats_ops->stats)
59 		return 0;
60 
61 	return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len);
62 }
63 
64 #endif /* _CDP_TXRX_STATS_H_ */
65