xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats.h (revision 11f5a63a6cbdda84849a730de22f0a71e635d58c)
1 /*
2  * Copyright (c) 2016-2017,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_stats.h
21  * @brief Define the host data path statistics API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_STATS_H_
25 #define _CDP_TXRX_STATS_H_
26 #include <cdp_txrx_ops.h>
27 
28 static inline QDF_STATUS
29 cdp_clear_stats(ol_txrx_soc_handle soc, uint8_t bitmap)
30 {
31 
32 	if (!soc || !soc->ops) {
33 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
34 				"%s: Invalid Instance", __func__);
35 		QDF_BUG(0);
36 		return QDF_STATUS_E_INVAL;
37 	}
38 
39 	if (!soc->ops->mob_stats_ops ||
40 	    !soc->ops->mob_stats_ops->clear_stats)
41 		return QDF_STATUS_E_INVAL;
42 
43 	return soc->ops->mob_stats_ops->clear_stats((struct cdp_soc *)soc,
44 						    bitmap);
45 }
46 
47 static inline int
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 		QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
53 				"%s: Invalid Instance", __func__);
54 		QDF_BUG(0);
55 		return 0;
56 	}
57 
58 	if (!soc->ops->mob_stats_ops ||
59 	    !soc->ops->mob_stats_ops->stats)
60 		return 0;
61 
62 	return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len);
63 }
64 
65 #endif /* _CDP_TXRX_STATS_H_ */
66