xref: /wlan-dirver/qca-wifi-host-cmn/target_if/cp_stats/inc/target_if_cp_stats.h (revision a86b23ee68a2491aede2e03991f3fb37046f4e41)
1 /*
2  * Copyright (c) 2018, 2020 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  * DOC: target_if_cp_stats.h
21  *
22  * This header file provide declarations required for Rx and Tx events from
23  * firmware
24  */
25 
26 #ifndef __TARGET_IF_CP_STATS_H__
27 #define __TARGET_IF_CP_STATS_H__
28 
29 #include <target_if.h>
30 #include <wlan_lmac_if_def.h>
31 #include <wlan_cp_stats_utils_api.h>
32 
33 #ifdef QCA_SUPPORT_CP_STATS
34 
35 /**
36  * target_if_cp_stats_get_rx_ops() - get rx ops
37  * @tx_ops: pointer to lmac tx ops
38  *
39  * Return: pointer to rx ops
40  */
41 static inline struct wlan_lmac_if_cp_stats_rx_ops *
42 target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc *psoc)
43 {
44 	struct wlan_lmac_if_rx_ops *rx_ops;
45 
46 	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
47 	if (!rx_ops) {
48 		cp_stats_err("rx_ops is NULL");
49 		return NULL;
50 	}
51 
52 	return &rx_ops->cp_stats_rx_ops;
53 }
54 
55 /**
56  * target_if_cp_stats_get_tx_ops() - get tx ops
57  * @tx_ops: pointer to lmac tx ops
58  *
59  * Return: pointer to tx ops
60  */
61 static inline struct wlan_lmac_if_cp_stats_tx_ops *
62 target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc *psoc)
63 {
64 	struct wlan_lmac_if_tx_ops *tx_ops;
65 
66 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
67 	if (!tx_ops) {
68 		cp_stats_err("tx_ops is NULL");
69 		return NULL;
70 	}
71 
72 	return &tx_ops->cp_stats_tx_ops;
73 }
74 
75 /**
76  * target_if_cp_stats_register_tx_ops() - define cp_stats lmac tx ops functions
77  * @tx_ops: pointer to lmac tx ops
78  *
79  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
80  */
81 QDF_STATUS
82 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
83 #else
84 static inline QDF_STATUS
85 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
86 {
87 	return QDF_STATUS_SUCCESS;
88 }
89 #endif /* QCA_SUPPORT_CP_STATS */
90 
91 #endif /* __TARGET_IF_CP_STATS_H__ */
92