xref: /wlan-driver/qcacld-3.0/os_if/cp_stats/inc/wlan_cfg80211_mc_cp_stats.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
3  *
4  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
5  *
6  * Permission to use, copy, modify, and/or distribute this software for
7  * any purpose with or without fee is hereby granted, provided that the
8  * above copyright notice and this permission notice appear in all
9  * copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
12  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
13  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
14  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
15  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
16  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
17  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18  * PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 /**
22  * DOC: wlan_cfg80211_mc_cp_stats.h
23  *
24  * This Header file provide declaration for cfg80211 command handler API
25  * registered cp stats and specific with ic
26  */
27 
28 #ifndef __WLAN_CFG80211_MC_CP_STATS_H__
29 #define __WLAN_CFG80211_MC_CP_STATS_H__
30 
31 #ifdef QCA_SUPPORT_CP_STATS
32 
33 /* forward declaration */
34 struct wiphy;
35 struct wlan_objmgr_psoc;
36 
37 /**
38  * wlan_cfg80211_mc_cp_stats_get_wakelock_stats() - API to request wake lock
39  * stats. Stats are returned to user space via vendor event
40  * @psoc:    Pointer to psoc
41  * @wiphy:   wiphy pointer
42  *
43  * Return: 0 on success, negative value on failure
44  */
45 int wlan_cfg80211_mc_cp_stats_get_wakelock_stats(struct wlan_objmgr_psoc *psoc,
46 						 struct wiphy *wiphy);
47 
48 /**
49  * wlan_cfg80211_mc_cp_stats_get_tx_power() - API to fetch tx power
50  * @vdev:    Pointer to vdev
51  * @dbm:     Pointer to TX power in dbm
52  *
53  * Return: 0 on success, negative value on failure
54  */
55 int wlan_cfg80211_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
56 					   int *dbm);
57 #ifdef WLAN_FEATURE_MIB_STATS
58 /**
59  * wlan_cfg80211_mc_cp_stats_get_mib_stats() - API to get mib stats
60  * statistics from firmware
61  * @vdev:    Pointer to vdev
62  * @errno:   error type in case of failure
63  *
64  * Callers of this API must call wlan_cfg80211_mc_cp_stats_free_stats_event
65  * API.
66  * Return: stats buffer on success, Null on failure
67  */
68 struct stats_event *
69 wlan_cfg80211_mc_cp_stats_get_mib_stats(struct wlan_objmgr_vdev *vdev,
70 					int *errno);
71 #endif
72 
73 /**
74  * wlan_cfg80211_mc_cp_stats_get_station_stats() - API to get station
75  * statistics to firmware
76  * @vdev:    Pointer to vdev
77  * @errno:   error type in case of failure
78  *
79  * Call of this API must call wlan_cfg80211_mc_cp_stats_free_stats_event
80  * API when done with information provided by info.
81  * Return: stats buffer on success, Null on failure
82  */
83 struct stats_event *
84 wlan_cfg80211_mc_cp_stats_get_station_stats(struct wlan_objmgr_vdev *vdev,
85 					    int *errno);
86 
87 /**
88  * wlan_cfg80211_mc_cp_stats_free_stats_event() - API to release station
89  * statistics buffer
90  * @info:    pointer to object populated with station stats
91  *
92  * Return: None
93  */
94 void wlan_cfg80211_mc_cp_stats_free_stats_event(struct stats_event *info);
95 
96 /**
97  * wlan_cfg80211_mc_cp_stats_get_peer_rssi() - API to fetch peer rssi
98  * @vdev:    Pointer to vdev
99  * @macaddress: mac address
100  * @errno:   error type in case of failure
101  *
102  * Call of this API must call wlan_cfg80211_mc_cp_stats_free_stats_event
103  * API when done with information provided by rssi_info.
104  * Return: stats buffer on success, Null on failure
105  */
106 struct stats_event *
107 wlan_cfg80211_mc_cp_stats_get_peer_rssi(struct wlan_objmgr_vdev *vdev,
108 					uint8_t *macaddress, int *errno);
109 
110 /**
111  * wlan_cfg80211_mc_cp_stats_get_peer_stats() - API to get peer
112  * statistics from firmware
113  * @vdev:    Pointer to vdev
114  * @mac_addr: mac address
115  * @errno:   error type in case of failure
116  *
117  * Call of this API must call wlan_cfg80211_mc_cp_stats_free_stats_event
118  * API when done with information provided by info.
119  * Return: stats buffer on success, Null on failure
120  */
121 struct stats_event *
122 wlan_cfg80211_mc_cp_stats_get_peer_stats(struct wlan_objmgr_vdev *vdev,
123 					 const uint8_t *mac_addr,
124 					 int *errno);
125 #else
wlan_cfg80211_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev * vdev,int * dbm)126 static inline int wlan_cfg80211_mc_cp_stats_get_tx_power(
127 				struct wlan_objmgr_vdev *vdev,
128 				int *dbm)
129 {
130 	return 0;
131 }
132 
wlan_cfg80211_mc_cp_stats_get_wakelock_stats(struct wlan_objmgr_psoc * psoc,struct wiphy * wiphy)133 static inline int wlan_cfg80211_mc_cp_stats_get_wakelock_stats(
134 				struct wlan_objmgr_psoc *psoc,
135 				struct wiphy *wiphy)
136 {
137 	return 0;
138 }
139 
140 static inline struct stats_event *
wlan_cfg80211_mc_cp_stats_get_peer_rssi(struct wlan_objmgr_vdev * vdev,uint8_t * macaddress,int * errno)141 wlan_cfg80211_mc_cp_stats_get_peer_rssi(struct wlan_objmgr_vdev *vdev,
142 					uint8_t *macaddress, int *errno)
143 {
144 	return NULL;
145 }
146 
wlan_cfg80211_mc_cp_stats_free_stats_event(struct stats_event * info)147 static inline void wlan_cfg80211_mc_cp_stats_free_stats_event(
148 			struct stats_event *info)
149 {}
150 
151 static inline struct stats_event *
wlan_cfg80211_mc_cp_stats_get_station_stats(struct wlan_objmgr_vdev * vdev,int * errno)152 wlan_cfg80211_mc_cp_stats_get_station_stats(struct wlan_objmgr_vdev *vdev,
153 					    int *errno)
154 {
155 	return NULL;
156 }
157 
158 static inline struct stats_event *
wlan_cfg80211_mc_cp_stats_get_peer_stats(struct wlan_objmgr_vdev * vdev,const uint8_t * mac_addr,int * errno)159 wlan_cfg80211_mc_cp_stats_get_peer_stats(struct wlan_objmgr_vdev *vdev,
160 					 const uint8_t *mac_addr,
161 					 int *errno)
162 {
163 	return NULL;
164 }
165 #endif /* QCA_SUPPORT_CP_STATS */
166 #endif /* __WLAN_CFG80211_MC_CP_STATS_H__ */
167