1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2018, 2020-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name *
5*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name * above copyright notice and this permission notice appear in all
8*5113495bSYour Name * copies.
9*5113495bSYour Name *
10*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name */
19*5113495bSYour Name
20*5113495bSYour Name /**
21*5113495bSYour Name * DOC: target_if_cp_stats.h
22*5113495bSYour Name *
23*5113495bSYour Name * This header file provide declarations required for Rx and Tx events from
24*5113495bSYour Name * firmware
25*5113495bSYour Name */
26*5113495bSYour Name
27*5113495bSYour Name #ifndef __TARGET_IF_CP_STATS_H__
28*5113495bSYour Name #define __TARGET_IF_CP_STATS_H__
29*5113495bSYour Name
30*5113495bSYour Name #include <target_if.h>
31*5113495bSYour Name #include <wlan_lmac_if_def.h>
32*5113495bSYour Name #include <wlan_cp_stats_utils_api.h>
33*5113495bSYour Name
34*5113495bSYour Name #ifdef QCA_SUPPORT_CP_STATS
35*5113495bSYour Name
36*5113495bSYour Name /**
37*5113495bSYour Name * target_if_cp_stats_get_rx_ops() - get rx ops
38*5113495bSYour Name * @psoc: pointer to psoc object
39*5113495bSYour Name *
40*5113495bSYour Name * Return: pointer to rx ops
41*5113495bSYour Name */
42*5113495bSYour Name static inline struct wlan_lmac_if_cp_stats_rx_ops *
target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc * psoc)43*5113495bSYour Name target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc *psoc)
44*5113495bSYour Name {
45*5113495bSYour Name struct wlan_lmac_if_rx_ops *rx_ops;
46*5113495bSYour Name
47*5113495bSYour Name rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
48*5113495bSYour Name if (!rx_ops) {
49*5113495bSYour Name cp_stats_err("rx_ops is NULL");
50*5113495bSYour Name return NULL;
51*5113495bSYour Name }
52*5113495bSYour Name
53*5113495bSYour Name return &rx_ops->cp_stats_rx_ops;
54*5113495bSYour Name }
55*5113495bSYour Name
56*5113495bSYour Name /**
57*5113495bSYour Name * target_if_cp_stats_get_tx_ops() - get tx ops
58*5113495bSYour Name * @psoc: pointer to psoc object
59*5113495bSYour Name *
60*5113495bSYour Name * Return: pointer to tx ops
61*5113495bSYour Name */
62*5113495bSYour Name static inline struct wlan_lmac_if_cp_stats_tx_ops *
target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc * psoc)63*5113495bSYour Name target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc *psoc)
64*5113495bSYour Name {
65*5113495bSYour Name struct wlan_lmac_if_tx_ops *tx_ops;
66*5113495bSYour Name
67*5113495bSYour Name tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
68*5113495bSYour Name if (!tx_ops) {
69*5113495bSYour Name cp_stats_err("tx_ops is NULL");
70*5113495bSYour Name return NULL;
71*5113495bSYour Name }
72*5113495bSYour Name
73*5113495bSYour Name return &tx_ops->cp_stats_tx_ops;
74*5113495bSYour Name }
75*5113495bSYour Name
76*5113495bSYour Name /**
77*5113495bSYour Name * target_if_cp_stats_register_tx_ops() - define cp_stats lmac tx ops functions
78*5113495bSYour Name * @tx_ops: pointer to lmac tx ops
79*5113495bSYour Name *
80*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
81*5113495bSYour Name */
82*5113495bSYour Name QDF_STATUS
83*5113495bSYour Name target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops);
84*5113495bSYour Name
85*5113495bSYour Name #ifdef WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS
86*5113495bSYour Name /**
87*5113495bSYour Name * target_if_cp_stats_register_legacy_event_handler() - Register handler
88*5113495bSYour Name * specific to legacy components
89*5113495bSYour Name * @psoc: pointer to psoc object
90*5113495bSYour Name *
91*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
92*5113495bSYour Name * failure
93*5113495bSYour Name */
94*5113495bSYour Name QDF_STATUS
95*5113495bSYour Name target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc);
96*5113495bSYour Name
97*5113495bSYour Name /**
98*5113495bSYour Name * target_if_cp_stats_unregister_legacy_event_handler() - Unregister handler
99*5113495bSYour Name * specific to legacy components
100*5113495bSYour Name * @psoc: pointer to psoc object
101*5113495bSYour Name *
102*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
103*5113495bSYour Name * failure
104*5113495bSYour Name */
105*5113495bSYour Name QDF_STATUS
106*5113495bSYour Name target_if_cp_stats_unregister_legacy_event_handler(
107*5113495bSYour Name struct wlan_objmgr_psoc *psoc);
108*5113495bSYour Name #else
109*5113495bSYour Name
110*5113495bSYour Name static inline QDF_STATUS
target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc * psoc)111*5113495bSYour Name target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc)
112*5113495bSYour Name {
113*5113495bSYour Name return QDF_STATUS_SUCCESS;
114*5113495bSYour Name }
115*5113495bSYour Name
116*5113495bSYour Name static inline QDF_STATUS
target_if_cp_stats_unregister_legacy_event_handler(struct wlan_objmgr_psoc * psoc)117*5113495bSYour Name target_if_cp_stats_unregister_legacy_event_handler(
118*5113495bSYour Name struct wlan_objmgr_psoc *psoc)
119*5113495bSYour Name {
120*5113495bSYour Name return QDF_STATUS_SUCCESS;
121*5113495bSYour Name }
122*5113495bSYour Name #endif /* WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS */
123*5113495bSYour Name
124*5113495bSYour Name #ifdef WLAN_CHIPSET_STATS
125*5113495bSYour Name
126*5113495bSYour Name /**
127*5113495bSYour Name * target_if_cp_stats_is_service_cstats_enabled() - Interface to check and
128*5113495bSYour Name * return whether FW support Chipset Stats logging or not
129*5113495bSYour Name * @psoc: pointer to psoc object
130*5113495bSYour Name * @is_fw_support_cstats: True if feature is supported by FW else False
131*5113495bSYour Name *
132*5113495bSYour Name * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on
133*5113495bSYour Name * failure
134*5113495bSYour Name */
135*5113495bSYour Name QDF_STATUS
136*5113495bSYour Name target_if_cp_stats_is_service_cstats_enabled(struct wlan_objmgr_psoc *psoc,
137*5113495bSYour Name bool *is_fw_support_cstats);
138*5113495bSYour Name #else
139*5113495bSYour Name static inline QDF_STATUS
target_if_cp_stats_is_service_cstats_enabled(struct wlan_objmgr_psoc * psoc,bool * is_fw_support_cstats)140*5113495bSYour Name target_if_cp_stats_is_service_cstats_enabled(struct wlan_objmgr_psoc *psoc,
141*5113495bSYour Name bool *is_fw_support_cstats)
142*5113495bSYour Name {
143*5113495bSYour Name return QDF_STATUS_E_NOSUPPORT;
144*5113495bSYour Name }
145*5113495bSYour Name #endif
146*5113495bSYour Name
147*5113495bSYour Name #else
148*5113495bSYour Name static inline QDF_STATUS
target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops * tx_ops)149*5113495bSYour Name target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
150*5113495bSYour Name {
151*5113495bSYour Name return QDF_STATUS_SUCCESS;
152*5113495bSYour Name }
153*5113495bSYour Name #endif /* QCA_SUPPORT_CP_STATS */
154*5113495bSYour Name
155*5113495bSYour Name #endif /* __TARGET_IF_CP_STATS_H__ */
156