xref: /wlan-driver/qcacld-3.0/core/hdd/src/wlan_hdd_stats.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2021-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: wlan_hdd_stats.h
22*5113495bSYour Name  *
23*5113495bSYour Name  * WLAN Host Device Driver statistics related implementation
24*5113495bSYour Name  *
25*5113495bSYour Name  */
26*5113495bSYour Name 
27*5113495bSYour Name #if !defined(WLAN_HDD_STATS_H)
28*5113495bSYour Name #define WLAN_HDD_STATS_H
29*5113495bSYour Name 
30*5113495bSYour Name #include "wlan_hdd_main.h"
31*5113495bSYour Name #ifdef WLAN_FEATURE_11BE_MLO
32*5113495bSYour Name #include "wlan_mlo_mgr_cmn.h"
33*5113495bSYour Name #endif
34*5113495bSYour Name #include <wlan_cp_stats_chipset_stats.h>
35*5113495bSYour Name 
36*5113495bSYour Name #define INVALID_MCS_IDX 255
37*5113495bSYour Name 
38*5113495bSYour Name #define DATA_RATE_11AC_MCS_MASK    0x03
39*5113495bSYour Name 
40*5113495bSYour Name #ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
41*5113495bSYour Name /* LL stats get request time out value */
42*5113495bSYour Name #define WLAN_WAIT_TIME_LL_STATS 3300
43*5113495bSYour Name #else
44*5113495bSYour Name #define WLAN_WAIT_TIME_LL_STATS 800
45*5113495bSYour Name #endif
46*5113495bSYour Name 
47*5113495bSYour Name #define WLAN_HDD_TGT_NOISE_FLOOR_DBM     (-128)
48*5113495bSYour Name 
49*5113495bSYour Name #ifdef WLAN_FEATURE_LINK_LAYER_STATS
50*5113495bSYour Name extern const struct nla_policy qca_wlan_vendor_ll_ext_policy[
51*5113495bSYour Name 			QCA_WLAN_VENDOR_ATTR_LL_STATS_EXT_MAX + 1];
52*5113495bSYour Name 
53*5113495bSYour Name /* QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR */
54*5113495bSYour Name extern const struct nla_policy qca_wlan_vendor_ll_clr_policy[
55*5113495bSYour Name 			QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX + 1];
56*5113495bSYour Name 
57*5113495bSYour Name /* QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET */
58*5113495bSYour Name extern const struct nla_policy qca_wlan_vendor_ll_set_policy[
59*5113495bSYour Name 			QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX + 1];
60*5113495bSYour Name 
61*5113495bSYour Name /* QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET */
62*5113495bSYour Name extern const struct nla_policy qca_wlan_vendor_ll_get_policy[
63*5113495bSYour Name 			QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX + 1];
64*5113495bSYour Name 
65*5113495bSYour Name #define FEATURE_LL_STATS_VENDOR_COMMANDS                                \
66*5113495bSYour Name {                                                                       \
67*5113495bSYour Name 	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
68*5113495bSYour Name 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_CLR,          \
69*5113495bSYour Name 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
70*5113495bSYour Name 		WIPHY_VENDOR_CMD_NEED_NETDEV |                          \
71*5113495bSYour Name 		WIPHY_VENDOR_CMD_NEED_RUNNING,                          \
72*5113495bSYour Name 	.doit = wlan_hdd_cfg80211_ll_stats_clear,                       \
73*5113495bSYour Name 	vendor_command_policy(qca_wlan_vendor_ll_clr_policy,            \
74*5113495bSYour Name 			      QCA_WLAN_VENDOR_ATTR_LL_STATS_CLR_MAX)    \
75*5113495bSYour Name },                                                                      \
76*5113495bSYour Name 									\
77*5113495bSYour Name {                                                                       \
78*5113495bSYour Name 	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
79*5113495bSYour Name 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_SET,          \
80*5113495bSYour Name 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
81*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_NETDEV |                         \
82*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_RUNNING,                         \
83*5113495bSYour Name 	.doit = wlan_hdd_cfg80211_ll_stats_set,                         \
84*5113495bSYour Name 	vendor_command_policy(qca_wlan_vendor_ll_set_policy,            \
85*5113495bSYour Name 			      QCA_WLAN_VENDOR_ATTR_LL_STATS_SET_MAX)    \
86*5113495bSYour Name },                                                                      \
87*5113495bSYour Name                                                                         \
88*5113495bSYour Name {                                                                       \
89*5113495bSYour Name 	.info.vendor_id = QCA_NL80211_VENDOR_ID,                        \
90*5113495bSYour Name 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LL_STATS_GET,          \
91*5113495bSYour Name 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |                           \
92*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_NETDEV |                         \
93*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_RUNNING,                         \
94*5113495bSYour Name 	.doit = wlan_hdd_cfg80211_ll_stats_get,                         \
95*5113495bSYour Name 	vendor_command_policy(qca_wlan_vendor_ll_get_policy,            \
96*5113495bSYour Name 			      QCA_WLAN_VENDOR_ATTR_LL_STATS_GET_MAX)    \
97*5113495bSYour Name },
98*5113495bSYour Name #else
99*5113495bSYour Name #define FEATURE_LL_STATS_VENDOR_COMMANDS
100*5113495bSYour Name #endif
101*5113495bSYour Name 
102*5113495bSYour Name /**
103*5113495bSYour Name  * struct index_vht_data_rate_type - vht data rate type
104*5113495bSYour Name  * @beacon_rate_index: Beacon rate index
105*5113495bSYour Name  * @supported_VHT80_rate: VHT80 rate
106*5113495bSYour Name  * @supported_VHT40_rate: VHT40 rate
107*5113495bSYour Name  * @supported_VHT20_rate: VHT20 rate
108*5113495bSYour Name  */
109*5113495bSYour Name struct index_vht_data_rate_type {
110*5113495bSYour Name 	uint8_t beacon_rate_index;
111*5113495bSYour Name 	uint16_t supported_VHT80_rate[2];
112*5113495bSYour Name 	uint16_t supported_VHT40_rate[2];
113*5113495bSYour Name 	uint16_t supported_VHT20_rate[2];
114*5113495bSYour Name };
115*5113495bSYour Name 
116*5113495bSYour Name /**
117*5113495bSYour Name  * enum data_rate_11ac_max_mcs - possible VHT max MCS values
118*5113495bSYour Name  * @DATA_RATE_11AC_MAX_MCS_7: MCS7 rate
119*5113495bSYour Name  * @DATA_RATE_11AC_MAX_MCS_8: MCS8 rate
120*5113495bSYour Name  * @DATA_RATE_11AC_MAX_MCS_9: MCS9 rate
121*5113495bSYour Name  * @DATA_RATE_11AC_MAX_MCS_NA: Not applicable
122*5113495bSYour Name  */
123*5113495bSYour Name enum data_rate_11ac_max_mcs {
124*5113495bSYour Name 	DATA_RATE_11AC_MAX_MCS_7,
125*5113495bSYour Name 	DATA_RATE_11AC_MAX_MCS_8,
126*5113495bSYour Name 	DATA_RATE_11AC_MAX_MCS_9,
127*5113495bSYour Name 	DATA_RATE_11AC_MAX_MCS_NA
128*5113495bSYour Name };
129*5113495bSYour Name 
130*5113495bSYour Name /**
131*5113495bSYour Name  * struct index_data_rate_type - non vht data rate type
132*5113495bSYour Name  * @beacon_rate_index: Beacon rate index
133*5113495bSYour Name  * @supported_rate: Supported rate table
134*5113495bSYour Name  */
135*5113495bSYour Name struct index_data_rate_type {
136*5113495bSYour Name 	uint8_t beacon_rate_index;
137*5113495bSYour Name 	uint16_t supported_rate[4];
138*5113495bSYour Name };
139*5113495bSYour Name 
140*5113495bSYour Name #ifdef WLAN_FEATURE_LINK_LAYER_STATS
141*5113495bSYour Name 
142*5113495bSYour Name /**
143*5113495bSYour Name  * wlan_hdd_cfg80211_ll_stats_set() - set link layer stats
144*5113495bSYour Name  * @wiphy: Pointer to wiphy
145*5113495bSYour Name  * @wdev: Pointer to wdev
146*5113495bSYour Name  * @data: Pointer to data
147*5113495bSYour Name  * @data_len: Data length
148*5113495bSYour Name  *
149*5113495bSYour Name  * Return: int
150*5113495bSYour Name  */
151*5113495bSYour Name int wlan_hdd_cfg80211_ll_stats_set(struct wiphy *wiphy,
152*5113495bSYour Name 				   struct wireless_dev *wdev,
153*5113495bSYour Name 				   const void *data,
154*5113495bSYour Name 				   int data_len);
155*5113495bSYour Name 
156*5113495bSYour Name /**
157*5113495bSYour Name  * wlan_hdd_cfg80211_ll_stats_get() - get link layer stats
158*5113495bSYour Name  * @wiphy: Pointer to wiphy
159*5113495bSYour Name  * @wdev: Pointer to wdev
160*5113495bSYour Name  * @data: Pointer to data
161*5113495bSYour Name  * @data_len: Data length
162*5113495bSYour Name  *
163*5113495bSYour Name  * Return: int
164*5113495bSYour Name  */
165*5113495bSYour Name int wlan_hdd_cfg80211_ll_stats_get(struct wiphy *wiphy,
166*5113495bSYour Name 				   struct wireless_dev *wdev,
167*5113495bSYour Name 				   const void *data,
168*5113495bSYour Name 				   int data_len);
169*5113495bSYour Name 
170*5113495bSYour Name 
171*5113495bSYour Name /**
172*5113495bSYour Name  * wlan_hdd_cfg80211_ll_stats_clear() - clear link layer stats
173*5113495bSYour Name  * @wiphy: Pointer to wiphy
174*5113495bSYour Name  * @wdev: Pointer to wdev
175*5113495bSYour Name  * @data: Pointer to data
176*5113495bSYour Name  * @data_len: Data length
177*5113495bSYour Name  *
178*5113495bSYour Name  * Return: int
179*5113495bSYour Name  */
180*5113495bSYour Name int wlan_hdd_cfg80211_ll_stats_clear(struct wiphy *wiphy,
181*5113495bSYour Name 				     struct wireless_dev *wdev,
182*5113495bSYour Name 				     const void *data,
183*5113495bSYour Name 				     int data_len);
184*5113495bSYour Name 
185*5113495bSYour Name void wlan_hdd_clear_link_layer_stats(struct hdd_adapter *adapter);
186*5113495bSYour Name 
hdd_link_layer_stats_supported(void)187*5113495bSYour Name static inline bool hdd_link_layer_stats_supported(void)
188*5113495bSYour Name {
189*5113495bSYour Name 	return true;
190*5113495bSYour Name }
191*5113495bSYour Name 
192*5113495bSYour Name /**
193*5113495bSYour Name  * wlan_hdd_cfg80211_ll_stats_ext_set_param() - config monitor parameters
194*5113495bSYour Name  * @wiphy: wiphy handle
195*5113495bSYour Name  * @wdev: wdev handle
196*5113495bSYour Name  * @data: user layer input
197*5113495bSYour Name  * @data_len: length of user layer input
198*5113495bSYour Name  *
199*5113495bSYour Name  * return: 0 success, einval failure
200*5113495bSYour Name  */
201*5113495bSYour Name int wlan_hdd_cfg80211_ll_stats_ext_set_param(struct wiphy *wiphy,
202*5113495bSYour Name 					     struct wireless_dev *wdev,
203*5113495bSYour Name 					     const void *data,
204*5113495bSYour Name 					     int data_len);
205*5113495bSYour Name /**
206*5113495bSYour Name  * hdd_get_interface_info() - get interface info
207*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
208*5113495bSYour Name  * @info: Pointer to interface info
209*5113495bSYour Name  *
210*5113495bSYour Name  * Return: bool
211*5113495bSYour Name  */
212*5113495bSYour Name bool hdd_get_interface_info(struct wlan_hdd_link_info *link_info,
213*5113495bSYour Name 			    struct wifi_interface_info *info);
214*5113495bSYour Name 
215*5113495bSYour Name /**
216*5113495bSYour Name  * wlan_hdd_ll_stats_get() - Get Link Layer statistics from FW
217*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
218*5113495bSYour Name  * @req_id: request id
219*5113495bSYour Name  * @req_mask: bitmask used by FW for the request
220*5113495bSYour Name  *
221*5113495bSYour Name  * Return: 0 on success and error code otherwise
222*5113495bSYour Name  */
223*5113495bSYour Name int wlan_hdd_ll_stats_get(struct wlan_hdd_link_info *link_info,
224*5113495bSYour Name 			  uint32_t req_id, uint32_t req_mask);
225*5113495bSYour Name 
226*5113495bSYour Name /**
227*5113495bSYour Name  * wlan_hdd_cfg80211_link_layer_stats_callback() - This function is called
228*5113495bSYour Name  * @hdd_handle: Handle to HDD context
229*5113495bSYour Name  * @indication_type: Indication type
230*5113495bSYour Name  * @results: Pointer to results
231*5113495bSYour Name  * @cookie: Callback context
232*5113495bSYour Name  *
233*5113495bSYour Name  * After receiving Link Layer indications from FW.This callback converts the
234*5113495bSYour Name  * firmware data to the NL data and send the same to the kernel/upper layers.
235*5113495bSYour Name  *
236*5113495bSYour Name  * Return: None
237*5113495bSYour Name  */
238*5113495bSYour Name void wlan_hdd_cfg80211_link_layer_stats_callback(hdd_handle_t hdd_handle,
239*5113495bSYour Name 						 int indication_type,
240*5113495bSYour Name 						 tSirLLStatsResults *results,
241*5113495bSYour Name 						 void *cookie);
242*5113495bSYour Name 
243*5113495bSYour Name /**
244*5113495bSYour Name  * wlan_hdd_cfg80211_link_layer_stats_ext_callback() - Callback for LL ext
245*5113495bSYour Name  * @ctx: HDD context
246*5113495bSYour Name  * @rsp: msg from FW
247*5113495bSYour Name  *
248*5113495bSYour Name  * This function is an extension of
249*5113495bSYour Name  * wlan_hdd_cfg80211_link_layer_stats_callback. It converts
250*5113495bSYour Name  * monitoring parameters offloaded to NL data and send the same to the
251*5113495bSYour Name  * kernel/upper layers.
252*5113495bSYour Name  *
253*5113495bSYour Name  * Return: None.
254*5113495bSYour Name  */
255*5113495bSYour Name void wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,
256*5113495bSYour Name 						     tSirLLStatsResults *rsp);
257*5113495bSYour Name 
258*5113495bSYour Name /**
259*5113495bSYour Name  * hdd_lost_link_info_cb() - callback function to get lost link information
260*5113495bSYour Name  * @hdd_handle: Opaque handle for the HDD context
261*5113495bSYour Name  * @lost_link_info: lost link information
262*5113495bSYour Name  *
263*5113495bSYour Name  * Return: none
264*5113495bSYour Name  */
265*5113495bSYour Name void hdd_lost_link_info_cb(hdd_handle_t hdd_handle,
266*5113495bSYour Name 			   struct sir_lost_link_info *lost_link_info);
267*5113495bSYour Name 
268*5113495bSYour Name #else /* WLAN_FEATURE_LINK_LAYER_STATS */
269*5113495bSYour Name 
hdd_link_layer_stats_supported(void)270*5113495bSYour Name static inline bool hdd_link_layer_stats_supported(void)
271*5113495bSYour Name {
272*5113495bSYour Name 	return false;
273*5113495bSYour Name }
274*5113495bSYour Name 
275*5113495bSYour Name static inline int
wlan_hdd_cfg80211_ll_stats_ext_set_param(struct wiphy * wiphy,struct wireless_dev * wdev,const void * data,int data_len)276*5113495bSYour Name wlan_hdd_cfg80211_ll_stats_ext_set_param(struct wiphy *wiphy,
277*5113495bSYour Name 					 struct wireless_dev *wdev,
278*5113495bSYour Name 					 const void *data,
279*5113495bSYour Name 					 int data_len)
280*5113495bSYour Name {
281*5113495bSYour Name 	return -EINVAL;
282*5113495bSYour Name }
283*5113495bSYour Name 
284*5113495bSYour Name static inline int
wlan_hdd_ll_stats_get(struct wlan_hdd_link_info * link_info,uint32_t req_id,uint32_t req_mask)285*5113495bSYour Name wlan_hdd_ll_stats_get(struct wlan_hdd_link_info *link_info,
286*5113495bSYour Name 		      uint32_t req_id, uint32_t req_mask)
287*5113495bSYour Name {
288*5113495bSYour Name 	return -EINVAL;
289*5113495bSYour Name }
290*5113495bSYour Name 
291*5113495bSYour Name static inline void
wlan_hdd_clear_link_layer_stats(struct hdd_adapter * adapter)292*5113495bSYour Name wlan_hdd_clear_link_layer_stats(struct hdd_adapter *adapter)
293*5113495bSYour Name {
294*5113495bSYour Name }
295*5113495bSYour Name 
296*5113495bSYour Name static inline void
wlan_hdd_cfg80211_link_layer_stats_callback(hdd_handle_t hdd_handle,int indication_type,tSirLLStatsResults * results,void * cookie)297*5113495bSYour Name wlan_hdd_cfg80211_link_layer_stats_callback(hdd_handle_t hdd_handle,
298*5113495bSYour Name 					    int indication_type,
299*5113495bSYour Name 					    tSirLLStatsResults *results,
300*5113495bSYour Name 					    void *cookie)
301*5113495bSYour Name {
302*5113495bSYour Name }
303*5113495bSYour Name 
304*5113495bSYour Name static inline void
wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,tSirLLStatsResults * rsp)305*5113495bSYour Name wlan_hdd_cfg80211_link_layer_stats_ext_callback(hdd_handle_t ctx,
306*5113495bSYour Name 						tSirLLStatsResults *rsp)
307*5113495bSYour Name {
308*5113495bSYour Name }
309*5113495bSYour Name 
310*5113495bSYour Name static inline void
hdd_lost_link_info_cb(hdd_handle_t hdd_handle,struct sir_lost_link_info * lost_link_info)311*5113495bSYour Name hdd_lost_link_info_cb(hdd_handle_t hdd_handle,
312*5113495bSYour Name 		      struct sir_lost_link_info *lost_link_info)
313*5113495bSYour Name {
314*5113495bSYour Name }
315*5113495bSYour Name 
316*5113495bSYour Name #endif /* End of WLAN_FEATURE_LINK_LAYER_STATS */
317*5113495bSYour Name 
318*5113495bSYour Name #ifdef WLAN_FEATURE_STATS_EXT
319*5113495bSYour Name /**
320*5113495bSYour Name  * wlan_hdd_cfg80211_stats_ext_request() - ext stats request
321*5113495bSYour Name  * @wiphy: Pointer to wiphy
322*5113495bSYour Name  * @wdev: Pointer to wdev
323*5113495bSYour Name  * @data: Pointer to data
324*5113495bSYour Name  * @data_len: Data length
325*5113495bSYour Name  *
326*5113495bSYour Name  * Return: int
327*5113495bSYour Name  */
328*5113495bSYour Name int wlan_hdd_cfg80211_stats_ext_request(struct wiphy *wiphy,
329*5113495bSYour Name 					struct wireless_dev *wdev,
330*5113495bSYour Name 					const void *data,
331*5113495bSYour Name 					int data_len);
332*5113495bSYour Name 
333*5113495bSYour Name #endif /* End of WLAN_FEATURE_STATS_EXT */
334*5113495bSYour Name 
335*5113495bSYour Name /**
336*5113495bSYour Name  * wlan_hdd_cfg80211_connected_chan_stats_req() - get currently connected
337*5113495bSYour Name  * channel statistics from driver/firmware
338*5113495bSYour Name  * @wiphy: Pointer to wiphy
339*5113495bSYour Name  * @wdev: Pointer to wdev
340*5113495bSYour Name  * @data: Pointer to data
341*5113495bSYour Name  * @data_len: Data length
342*5113495bSYour Name  *
343*5113495bSYour Name  * Return: int
344*5113495bSYour Name  */
345*5113495bSYour Name int wlan_hdd_cfg80211_connected_chan_stats_req(struct wiphy *wiphy,
346*5113495bSYour Name 					       struct wireless_dev *wdev,
347*5113495bSYour Name 					       const void *data,
348*5113495bSYour Name 					       int data_len);
349*5113495bSYour Name 
350*5113495bSYour Name /**
351*5113495bSYour Name  * wlan_hdd_cfg80211_get_station() - get station statistics
352*5113495bSYour Name  * @wiphy: Pointer to wiphy
353*5113495bSYour Name  * @dev: Pointer to network device
354*5113495bSYour Name  * @mac: Pointer to mac
355*5113495bSYour Name  * @sinfo: Pointer to station info
356*5113495bSYour Name  *
357*5113495bSYour Name  * Return: 0 for success, non-zero for failure
358*5113495bSYour Name  */
359*5113495bSYour Name #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0))
360*5113495bSYour Name int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
361*5113495bSYour Name 				  struct net_device *dev, const uint8_t *mac,
362*5113495bSYour Name 				  struct station_info *sinfo);
363*5113495bSYour Name #else
364*5113495bSYour Name int wlan_hdd_cfg80211_get_station(struct wiphy *wiphy,
365*5113495bSYour Name 				  struct net_device *dev, uint8_t *mac,
366*5113495bSYour Name 				  struct station_info *sinfo);
367*5113495bSYour Name #endif
368*5113495bSYour Name 
369*5113495bSYour Name /**
370*5113495bSYour Name  * wlan_hdd_cfg80211_dump_station() - dump station statistics
371*5113495bSYour Name  * @wiphy: Pointer to wiphy
372*5113495bSYour Name  * @dev: Pointer to network device
373*5113495bSYour Name  * @idx: variable to determine whether to get stats or not
374*5113495bSYour Name  * @mac: Pointer to mac
375*5113495bSYour Name  * @sinfo: Pointer to station info
376*5113495bSYour Name  *
377*5113495bSYour Name  * Return: 0 for success, non-zero for failure
378*5113495bSYour Name  */
379*5113495bSYour Name int wlan_hdd_cfg80211_dump_station(struct wiphy *wiphy,
380*5113495bSYour Name 				struct net_device *dev,
381*5113495bSYour Name 				int idx, u8 *mac,
382*5113495bSYour Name 				struct station_info *sinfo);
383*5113495bSYour Name 
384*5113495bSYour Name struct net_device_stats *hdd_get_stats(struct net_device *dev);
385*5113495bSYour Name 
386*5113495bSYour Name int wlan_hdd_cfg80211_dump_survey(struct wiphy *wiphy,
387*5113495bSYour Name 				  struct net_device *dev,
388*5113495bSYour Name 				  int idx, struct survey_info *survey);
389*5113495bSYour Name 
390*5113495bSYour Name void hdd_display_hif_stats(void);
391*5113495bSYour Name void hdd_clear_hif_stats(void);
392*5113495bSYour Name 
393*5113495bSYour Name /**
394*5113495bSYour Name  * wlan_hdd_cfg80211_stats_ext_callback() - ext stats callback
395*5113495bSYour Name  * @hdd_handle: Opaque handle to HDD context
396*5113495bSYour Name  * @data: ext stats payload
397*5113495bSYour Name  *
398*5113495bSYour Name  * Return: nothing
399*5113495bSYour Name  */
400*5113495bSYour Name void wlan_hdd_cfg80211_stats_ext_callback(hdd_handle_t hdd_handle,
401*5113495bSYour Name 					  struct stats_ext_event *data);
402*5113495bSYour Name 
403*5113495bSYour Name /**
404*5113495bSYour Name  * wlan_hdd_cfg80211_stats_ext2_callback() - stats_ext2_callback
405*5113495bSYour Name  * @hdd_handle: opaque handle to the hdd context
406*5113495bSYour Name  * @pmsg: sir_sme_rx_aggr_hole_ind
407*5113495bSYour Name  *
408*5113495bSYour Name  * Return: void
409*5113495bSYour Name  */
410*5113495bSYour Name void
411*5113495bSYour Name wlan_hdd_cfg80211_stats_ext2_callback(hdd_handle_t hdd_handle,
412*5113495bSYour Name 				      struct sir_sme_rx_aggr_hole_ind *pmsg);
413*5113495bSYour Name 
414*5113495bSYour Name #ifdef WLAN_FEATURE_ROAM_OFFLOAD
415*5113495bSYour Name /**
416*5113495bSYour Name  * wlan_hdd_cfg80211_roam_events_callback() - roam_events_callback
417*5113495bSYour Name  * @roam_stats: roam events stats
418*5113495bSYour Name  * @idx: TLV index in roam stats event
419*5113495bSYour Name  *
420*5113495bSYour Name  * Return: void
421*5113495bSYour Name  */
422*5113495bSYour Name void
423*5113495bSYour Name wlan_hdd_cfg80211_roam_events_callback(struct roam_stats_event *roam_stats,
424*5113495bSYour Name 				       uint8_t idx);
425*5113495bSYour Name #endif /* End of WLAN_FEATURE_ROAM_OFFLOAD */
426*5113495bSYour Name 
427*5113495bSYour Name /**
428*5113495bSYour Name  * wlan_hdd_get_rcpi() - Wrapper to get current RCPI
429*5113495bSYour Name  * @adapter: adapter upon which the measurement is requested
430*5113495bSYour Name  * @mac: peer addr for which measurement is requested
431*5113495bSYour Name  * @rcpi_value: pointer to where the RCPI should be returned
432*5113495bSYour Name  * @measurement_type: type of rcpi measurement
433*5113495bSYour Name  *
434*5113495bSYour Name  * This is a wrapper function for getting RCPI, invoke this function only
435*5113495bSYour Name  * when rcpi support is enabled in firmware
436*5113495bSYour Name  *
437*5113495bSYour Name  * Return: 0 for success, non-zero for failure
438*5113495bSYour Name  */
439*5113495bSYour Name int wlan_hdd_get_rcpi(struct hdd_adapter *adapter, uint8_t *mac,
440*5113495bSYour Name 		      int32_t *rcpi_value,
441*5113495bSYour Name 		      enum rcpi_measurement_type measurement_type);
442*5113495bSYour Name 
443*5113495bSYour Name #ifdef WLAN_FEATURE_MIB_STATS
444*5113495bSYour Name /**
445*5113495bSYour Name  * wlan_hdd_get_mib_stats() - Get the mib statistics
446*5113495bSYour Name  * @adapter: adapter upon which the measurement is requested
447*5113495bSYour Name  *
448*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
449*5113495bSYour Name  */
450*5113495bSYour Name QDF_STATUS wlan_hdd_get_mib_stats(struct hdd_adapter *adapter);
451*5113495bSYour Name #endif
452*5113495bSYour Name 
453*5113495bSYour Name /**
454*5113495bSYour Name  * wlan_hdd_get_rssi() - Get the current RSSI
455*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
456*5113495bSYour Name  * @rssi_value: pointer to where the RSSI should be returned
457*5113495bSYour Name  *
458*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
459*5113495bSYour Name  */
460*5113495bSYour Name QDF_STATUS wlan_hdd_get_rssi(struct wlan_hdd_link_info *link_info,
461*5113495bSYour Name 			     int8_t *rssi_value);
462*5113495bSYour Name 
463*5113495bSYour Name /**
464*5113495bSYour Name  * wlan_hdd_get_snr() - Get the current SNR
465*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
466*5113495bSYour Name  * @snr: pointer to where the SNR should be returned
467*5113495bSYour Name  *
468*5113495bSYour Name  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
469*5113495bSYour Name  */
470*5113495bSYour Name QDF_STATUS wlan_hdd_get_snr(struct wlan_hdd_link_info *link_info, int8_t *snr);
471*5113495bSYour Name 
472*5113495bSYour Name /**
473*5113495bSYour Name  * wlan_hdd_get_linkspeed_for_peermac() - Get link speed for a peer
474*5113495bSYour Name  * @link_info: Link info pointer in adapter
475*5113495bSYour Name  * @mac_address: MAC address of the peer
476*5113495bSYour Name  * @linkspeed: pointer to memory where returned link speed is to be placed
477*5113495bSYour Name  *
478*5113495bSYour Name  * This function will send a query to SME for the linkspeed of the
479*5113495bSYour Name  * given peer, and then wait for the callback to be invoked.
480*5113495bSYour Name  *
481*5113495bSYour Name  * Return: 0 if linkspeed data is available, negative errno otherwise
482*5113495bSYour Name  */
483*5113495bSYour Name int wlan_hdd_get_linkspeed_for_peermac(struct wlan_hdd_link_info *link_info,
484*5113495bSYour Name 				       struct qdf_mac_addr *mac_address,
485*5113495bSYour Name 				       uint32_t *linkspeed);
486*5113495bSYour Name 
487*5113495bSYour Name /**
488*5113495bSYour Name  * wlan_hdd_get_link_speed() - get link speed
489*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
490*5113495bSYour Name  * @link_speed:   pointer to link speed
491*5113495bSYour Name  *
492*5113495bSYour Name  * This function fetches per bssid link speed.
493*5113495bSYour Name  *
494*5113495bSYour Name  * Return: if associated, link speed shall be returned.
495*5113495bSYour Name  *         if not associated, link speed of 0 is returned.
496*5113495bSYour Name  *         On error, error number will be returned.
497*5113495bSYour Name  */
498*5113495bSYour Name int wlan_hdd_get_link_speed(struct wlan_hdd_link_info *link_info,
499*5113495bSYour Name 			    uint32_t *link_speed);
500*5113495bSYour Name 
501*5113495bSYour Name /**
502*5113495bSYour Name  * wlan_hdd_get_sap_go_peer_linkspeed() - Get SAP/GO peer link speed
503*5113495bSYour Name  * @link_info:   Link info pointer in HDD adapter
504*5113495bSYour Name  * @link_speed:  Pointer to link speed
505*5113495bSYour Name  * @command:     Driver command string
506*5113495bSYour Name  * @command_len: Driver command string length
507*5113495bSYour Name  *
508*5113495bSYour Name  * Return: 0 if linkspeed data is available, negative errno otherwise
509*5113495bSYour Name  */
510*5113495bSYour Name int wlan_hdd_get_sap_go_peer_linkspeed(struct wlan_hdd_link_info *link_info,
511*5113495bSYour Name 				       uint32_t *link_speed,
512*5113495bSYour Name 				       uint8_t *command,
513*5113495bSYour Name 				       uint8_t command_len);
514*5113495bSYour Name #ifdef FEATURE_RX_LINKSPEED_ROAM_TRIGGER
515*5113495bSYour Name /**
516*5113495bSYour Name  * wlan_hdd_get_peer_rx_rate_stats() - STA gets rx rate stats
517*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
518*5113495bSYour Name  *
519*5113495bSYour Name  * STA gets rx rate stats through using the existed API
520*5113495bSYour Name  * cdp_host_get_peer_stats. The reason that we make this
521*5113495bSYour Name  * function is to avoid being disrupted by the flag
522*5113495bSYour Name  * "get_station_fw_request_needed"
523*5113495bSYour Name  *
524*5113495bSYour Name  * Return: void
525*5113495bSYour Name  */
526*5113495bSYour Name void wlan_hdd_get_peer_rx_rate_stats(struct wlan_hdd_link_info *link_info);
527*5113495bSYour Name #else
528*5113495bSYour Name static inline void
wlan_hdd_get_peer_rx_rate_stats(struct wlan_hdd_link_info * link_info)529*5113495bSYour Name wlan_hdd_get_peer_rx_rate_stats(struct wlan_hdd_link_info *link_info)
530*5113495bSYour Name {
531*5113495bSYour Name }
532*5113495bSYour Name #endif
533*5113495bSYour Name 
534*5113495bSYour Name /**
535*5113495bSYour Name  * wlan_hdd_get_station_stats() - Get station statistics
536*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter.
537*5113495bSYour Name  *
538*5113495bSYour Name  * Return: status of operation
539*5113495bSYour Name  */
540*5113495bSYour Name int wlan_hdd_get_station_stats(struct wlan_hdd_link_info *link_info);
541*5113495bSYour Name 
542*5113495bSYour Name int wlan_hdd_qmi_get_sync_resume(void);
543*5113495bSYour Name int wlan_hdd_qmi_put_suspend(void);
544*5113495bSYour Name 
545*5113495bSYour Name #ifdef WLAN_FEATURE_BIG_DATA_STATS
546*5113495bSYour Name /**
547*5113495bSYour Name  * wlan_hdd_get_big_data_station_stats() - Get big data station statistics
548*5113495bSYour Name  * @link_info: Link info pointer in HDD adapter
549*5113495bSYour Name  *
550*5113495bSYour Name  * Return: status of operation
551*5113495bSYour Name  */
552*5113495bSYour Name int wlan_hdd_get_big_data_station_stats(struct wlan_hdd_link_info *link_info);
553*5113495bSYour Name 
554*5113495bSYour Name /**
555*5113495bSYour Name  * wlan_cfg80211_mc_cp_get_big_data_stats() - API to get big data
556*5113495bSYour Name  * statistics from firmware
557*5113495bSYour Name  * @vdev:    Pointer to vdev
558*5113495bSYour Name  * @errno:   error type in case of failure
559*5113495bSYour Name  *
560*5113495bSYour Name  * Return: big data stats buffer on success, Null on failure
561*5113495bSYour Name  */
562*5113495bSYour Name struct big_data_stats_event *
563*5113495bSYour Name wlan_cfg80211_mc_cp_get_big_data_stats(struct wlan_objmgr_vdev *vdev,
564*5113495bSYour Name 				       int *errno);
565*5113495bSYour Name 
566*5113495bSYour Name /**
567*5113495bSYour Name  * wlan_cfg80211_mc_cp_stats_free_big_data_stats_event() - API to release big
568*5113495bSYour Name  * data statistics buffer
569*5113495bSYour Name  * @info:    pointer to object to populate with big data stats
570*5113495bSYour Name  *
571*5113495bSYour Name  * Return: None
572*5113495bSYour Name  */
573*5113495bSYour Name void wlan_cfg80211_mc_cp_stats_free_big_data_stats_event(
574*5113495bSYour Name 					struct big_data_stats_event *info);
575*5113495bSYour Name #else
576*5113495bSYour Name static inline int
wlan_hdd_get_big_data_station_stats(struct wlan_hdd_link_info * link_info)577*5113495bSYour Name wlan_hdd_get_big_data_station_stats(struct wlan_hdd_link_info *link_info)
578*5113495bSYour Name {
579*5113495bSYour Name 	return 0;
580*5113495bSYour Name }
581*5113495bSYour Name 
582*5113495bSYour Name static inline struct big_data_stats_event *
wlan_cfg80211_mc_cp_get_big_data_stats(struct wlan_objmgr_vdev * vdev,int * errno)583*5113495bSYour Name wlan_cfg80211_mc_cp_get_big_data_stats(struct wlan_objmgr_vdev *vdev,
584*5113495bSYour Name 				       int *errno)
585*5113495bSYour Name {
586*5113495bSYour Name 	return 0;
587*5113495bSYour Name }
588*5113495bSYour Name 
589*5113495bSYour Name static inline
wlan_cfg80211_mc_cp_stats_free_big_data_stats_event(struct big_data_stats_event * info)590*5113495bSYour Name void wlan_cfg80211_mc_cp_stats_free_big_data_stats_event(
591*5113495bSYour Name 					struct big_data_stats_event *info)
592*5113495bSYour Name {
593*5113495bSYour Name }
594*5113495bSYour Name #endif
595*5113495bSYour Name 
596*5113495bSYour Name /**
597*5113495bSYour Name  * wlan_hdd_get_temperature() - get current device temperature
598*5113495bSYour Name  * @adapter: device upon which the request was made
599*5113495bSYour Name  * @temperature: pointer to where the temperature is to be returned
600*5113495bSYour Name  *
601*5113495bSYour Name  * Return: 0 if a temperature value (either current or cached) was
602*5113495bSYour Name  * returned, otherwise a negative errno is returned.
603*5113495bSYour Name  *
604*5113495bSYour Name  */
605*5113495bSYour Name int wlan_hdd_get_temperature(struct hdd_adapter *adapter, int *temperature);
606*5113495bSYour Name 
607*5113495bSYour Name /**
608*5113495bSYour Name  * hdd_get_max_tx_bitrate() - Get the max tx bitrate of the AP
609*5113495bSYour Name  * @link_info: pointer to link_info struct in adapter
610*5113495bSYour Name  *
611*5113495bSYour Name  * This function gets the MAX supported rate by AP and cache
612*5113495bSYour Name  * it into connection info structure
613*5113495bSYour Name  *
614*5113495bSYour Name  * Return: None
615*5113495bSYour Name  */
616*5113495bSYour Name void hdd_get_max_tx_bitrate(struct wlan_hdd_link_info *link_info);
617*5113495bSYour Name 
618*5113495bSYour Name #ifdef TX_MULTIQ_PER_AC
619*5113495bSYour Name /**
620*5113495bSYour Name  * wlan_hdd_display_tx_multiq_stats() - display Tx multi queue stats
621*5113495bSYour Name  * @context: hdd context
622*5113495bSYour Name  * @netdev: netdev
623*5113495bSYour Name  *
624*5113495bSYour Name  * Return: none
625*5113495bSYour Name  */
626*5113495bSYour Name void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,
627*5113495bSYour Name 				      qdf_netdev_t netdev);
628*5113495bSYour Name #else
629*5113495bSYour Name static inline
wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,qdf_netdev_t netdev)630*5113495bSYour Name void wlan_hdd_display_tx_multiq_stats(hdd_cb_handle context,
631*5113495bSYour Name 				      qdf_netdev_t netdev)
632*5113495bSYour Name {
633*5113495bSYour Name }
634*5113495bSYour Name #endif
635*5113495bSYour Name 
636*5113495bSYour Name /**
637*5113495bSYour Name  * hdd_report_max_rate() - Fill the max rate stats in the station info structure
638*5113495bSYour Name  * to be sent to the userspace.
639*5113495bSYour Name  * @link_info: pointer to link_info struct in adapter
640*5113495bSYour Name  * @mac_handle: The mac handle
641*5113495bSYour Name  * @rate: The station_info tx/rx rate to be filled
642*5113495bSYour Name  * @signal: signal from station_info
643*5113495bSYour Name  * @rate_flags: TX/RX rate flags computed from tx/rx rate
644*5113495bSYour Name  * @mcs_index: The TX/RX mcs index computed from tx/rx rate
645*5113495bSYour Name  * @fw_rate: The tx/rx rate from fw stats
646*5113495bSYour Name  * @nss: The TX/RX NSS from fw stats
647*5113495bSYour Name  *
648*5113495bSYour Name  * Return: True if fill is successful
649*5113495bSYour Name  */
650*5113495bSYour Name bool hdd_report_max_rate(struct wlan_hdd_link_info *link_info,
651*5113495bSYour Name 			 mac_handle_t mac_handle,
652*5113495bSYour Name 			 struct rate_info *rate,
653*5113495bSYour Name 			 int8_t signal,
654*5113495bSYour Name 			 enum tx_rate_info rate_flags,
655*5113495bSYour Name 			 uint8_t mcs_index,
656*5113495bSYour Name 			 uint16_t fw_rate, uint8_t nss);
657*5113495bSYour Name 
658*5113495bSYour Name /**
659*5113495bSYour Name  * hdd_check_and_update_nss() - Check and update NSS as per DBS capability
660*5113495bSYour Name  * @hdd_ctx: HDD Context pointer
661*5113495bSYour Name  * @tx_nss: pointer to variable storing the tx_nss
662*5113495bSYour Name  * @rx_nss: pointer to variable storing the rx_nss
663*5113495bSYour Name  *
664*5113495bSYour Name  * The parameters include the NSS obtained from the FW or static NSS. This NSS
665*5113495bSYour Name  * could be invalid in the case the current HW mode is DBS where the connection
666*5113495bSYour Name  * are 1x1. Rectify these NSS values as per the current HW mode.
667*5113495bSYour Name  *
668*5113495bSYour Name  * Return: none
669*5113495bSYour Name  */
670*5113495bSYour Name void hdd_check_and_update_nss(struct hdd_context *hdd_ctx,
671*5113495bSYour Name 			      uint8_t *tx_nss, uint8_t *rx_nss);
672*5113495bSYour Name #ifdef QCA_SUPPORT_CP_STATS
673*5113495bSYour Name /**
674*5113495bSYour Name  * wlan_hdd_register_cp_stats_cb() - Register hdd stats specific
675*5113495bSYour Name  * callbacks to the cp stats component
676*5113495bSYour Name  * @hdd_ctx: hdd context
677*5113495bSYour Name  *
678*5113495bSYour Name  * Return: none
679*5113495bSYour Name  */
680*5113495bSYour Name 
681*5113495bSYour Name void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx);
682*5113495bSYour Name #else
wlan_hdd_register_cp_stats_cb(struct hdd_context * hdd_ctx)683*5113495bSYour Name static inline void wlan_hdd_register_cp_stats_cb(struct hdd_context *hdd_ctx) {}
684*5113495bSYour Name #endif
685*5113495bSYour Name 
686*5113495bSYour Name #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_ROAM_INFO_STATS)
687*5113495bSYour Name #define FEATURE_ROAM_STATS_COMMANDS	\
688*5113495bSYour Name 	{	\
689*5113495bSYour Name 	.info.vendor_id = QCA_NL80211_VENDOR_ID,	\
690*5113495bSYour Name 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAM_STATS,	\
691*5113495bSYour Name 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |	\
692*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_NETDEV |	\
693*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_RUNNING,	\
694*5113495bSYour Name 	.doit = wlan_hdd_cfg80211_get_roam_stats,	\
695*5113495bSYour Name 	vendor_command_policy(VENDOR_CMD_RAW_DATA, 0)	\
696*5113495bSYour Name 	},	\
697*5113495bSYour Name 
698*5113495bSYour Name #define FEATURE_ROAM_STATS_EVENTS	\
699*5113495bSYour Name 	[QCA_NL80211_VENDOR_SUBCMD_ROAM_STATS_INDEX] = {	\
700*5113495bSYour Name 		.vendor_id = QCA_NL80211_VENDOR_ID,	\
701*5113495bSYour Name 		.subcmd = QCA_NL80211_VENDOR_SUBCMD_ROAM_STATS,	\
702*5113495bSYour Name 	},	\
703*5113495bSYour Name 
704*5113495bSYour Name /**
705*5113495bSYour Name  * wlan_hdd_cfg80211_get_roam_stats() - get roam statstics information
706*5113495bSYour Name  * @wiphy: wiphy pointer
707*5113495bSYour Name  * @wdev: pointer to struct wireless_dev
708*5113495bSYour Name  * @data: pointer to incoming NL vendor data
709*5113495bSYour Name  * @data_len: length of @data
710*5113495bSYour Name  *
711*5113495bSYour Name  * Return: 0 on success; error number otherwise.
712*5113495bSYour Name  */
713*5113495bSYour Name int wlan_hdd_cfg80211_get_roam_stats(struct wiphy *wiphy,
714*5113495bSYour Name 				     struct wireless_dev *wdev,
715*5113495bSYour Name 				     const void *data,
716*5113495bSYour Name 				     int data_len);
717*5113495bSYour Name #else
718*5113495bSYour Name #define FEATURE_ROAM_STATS_COMMANDS
719*5113495bSYour Name #define FEATURE_ROAM_STATS_EVENTS
720*5113495bSYour Name #endif
721*5113495bSYour Name 
722*5113495bSYour Name #ifdef WLAN_FEATURE_TX_LATENCY_STATS
723*5113495bSYour Name /**
724*5113495bSYour Name  * hdd_tx_latency_register_cb() - register callback function for transmit
725*5113495bSYour Name  * latency stats
726*5113495bSYour Name  * @soc: pointer to soc context
727*5113495bSYour Name  *
728*5113495bSYour Name  * Return: QDF_STATUS
729*5113495bSYour Name  */
730*5113495bSYour Name QDF_STATUS hdd_tx_latency_register_cb(void *soc);
731*5113495bSYour Name 
732*5113495bSYour Name /**
733*5113495bSYour Name  * hdd_tx_latency_restore_config() - restore tx latency stats config for a link
734*5113495bSYour Name  * @link_info: link specific information
735*5113495bSYour Name  *
736*5113495bSYour Name  * Return: QDF_STATUS
737*5113495bSYour Name  */
738*5113495bSYour Name QDF_STATUS
739*5113495bSYour Name hdd_tx_latency_restore_config(struct wlan_hdd_link_info *link_info);
740*5113495bSYour Name 
741*5113495bSYour Name /**
742*5113495bSYour Name  * wlan_hdd_cfg80211_tx_latency - configure/retrieve per-link transmit latency
743*5113495bSYour Name  * statistics
744*5113495bSYour Name  * @wiphy: wiphy handle
745*5113495bSYour Name  * @wdev: wdev handle
746*5113495bSYour Name  * @data: user layer input
747*5113495bSYour Name  * @data_len: length of user layer input
748*5113495bSYour Name  *
749*5113495bSYour Name  * return: 0 success, einval failure
750*5113495bSYour Name  */
751*5113495bSYour Name int wlan_hdd_cfg80211_tx_latency(struct wiphy *wiphy,
752*5113495bSYour Name 				 struct wireless_dev *wdev,
753*5113495bSYour Name 				 const void *data, int data_len);
754*5113495bSYour Name 
755*5113495bSYour Name /**
756*5113495bSYour Name  * hdd_tx_latency_record_ingress_ts() - Record driver ingress timestamp in CB
757*5113495bSYour Name  * @adapter: pointer to hdd vdev/net_device context
758*5113495bSYour Name  * @skb: sk buff
759*5113495bSYour Name  *
760*5113495bSYour Name  * Return: None
761*5113495bSYour Name  */
762*5113495bSYour Name static inline void
hdd_tx_latency_record_ingress_ts(struct hdd_adapter * adapter,struct sk_buff * skb)763*5113495bSYour Name hdd_tx_latency_record_ingress_ts(struct hdd_adapter *adapter,
764*5113495bSYour Name 				 struct sk_buff *skb)
765*5113495bSYour Name {
766*5113495bSYour Name 	if (adapter->tx_latency_cfg.enable)
767*5113495bSYour Name 		qdf_nbuf_set_tx_ts(skb);
768*5113495bSYour Name }
769*5113495bSYour Name 
770*5113495bSYour Name extern const struct nla_policy
771*5113495bSYour Name 	tx_latency_policy[QCA_WLAN_VENDOR_ATTR_TX_LATENCY_MAX + 1];
772*5113495bSYour Name 
773*5113495bSYour Name #define FEATURE_TX_LATENCY_STATS_COMMANDS	\
774*5113495bSYour Name 	{	\
775*5113495bSYour Name 	.info.vendor_id = QCA_NL80211_VENDOR_ID,	\
776*5113495bSYour Name 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_TX_LATENCY,	\
777*5113495bSYour Name 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |	\
778*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_NETDEV |	\
779*5113495bSYour Name 		 WIPHY_VENDOR_CMD_NEED_RUNNING,	\
780*5113495bSYour Name 	.doit = wlan_hdd_cfg80211_tx_latency,	\
781*5113495bSYour Name 	vendor_command_policy(tx_latency_policy,	\
782*5113495bSYour Name 			      QCA_WLAN_VENDOR_ATTR_TX_LATENCY_MAX)	\
783*5113495bSYour Name 	},	\
784*5113495bSYour Name 
785*5113495bSYour Name #define FEATURE_TX_LATENCY_STATS_EVENTS	\
786*5113495bSYour Name 	[QCA_NL80211_VENDOR_SUBCMD_TX_LATENCY_INDEX] = {	\
787*5113495bSYour Name 		.vendor_id = QCA_NL80211_VENDOR_ID,	\
788*5113495bSYour Name 		.subcmd = QCA_NL80211_VENDOR_SUBCMD_TX_LATENCY,	\
789*5113495bSYour Name 	},	\
790*5113495bSYour Name 
791*5113495bSYour Name #else
hdd_tx_latency_register_cb(void * soc)792*5113495bSYour Name static inline QDF_STATUS hdd_tx_latency_register_cb(void *soc)
793*5113495bSYour Name {
794*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
795*5113495bSYour Name }
796*5113495bSYour Name 
797*5113495bSYour Name static inline QDF_STATUS
hdd_tx_latency_restore_config(struct wlan_hdd_link_info * link_info)798*5113495bSYour Name hdd_tx_latency_restore_config(struct wlan_hdd_link_info *link_info)
799*5113495bSYour Name {
800*5113495bSYour Name 	return QDF_STATUS_SUCCESS;
801*5113495bSYour Name }
802*5113495bSYour Name 
803*5113495bSYour Name static inline void
hdd_tx_latency_record_ingress_ts(struct hdd_adapter * adapter,struct sk_buff * skb)804*5113495bSYour Name hdd_tx_latency_record_ingress_ts(struct hdd_adapter *adapter,
805*5113495bSYour Name 				 struct sk_buff *skb)
806*5113495bSYour Name {
807*5113495bSYour Name }
808*5113495bSYour Name 
809*5113495bSYour Name #define FEATURE_TX_LATENCY_STATS_COMMANDS
810*5113495bSYour Name #define FEATURE_TX_LATENCY_STATS_EVENTS
811*5113495bSYour Name #endif
812*5113495bSYour Name 
813*5113495bSYour Name #ifdef WLAN_CHIPSET_STATS
814*5113495bSYour Name /**
815*5113495bSYour Name  * hdd_cstats_send_data_to_userspace() - Send chipsset stats to userspace
816*5113495bSYour Name  *
817*5113495bSYour Name  * @buff: Buffer to be sent
818*5113495bSYour Name  * @len: length of the buffer
819*5113495bSYour Name  * @type: Chipset stats type
820*5113495bSYour Name  *
821*5113495bSYour Name  * Return: 0 on success -ve value on error
822*5113495bSYour Name  */
823*5113495bSYour Name int hdd_cstats_send_data_to_userspace(char *buff, unsigned int len,
824*5113495bSYour Name 				      enum cstats_types type);
825*5113495bSYour Name 
826*5113495bSYour Name /**
827*5113495bSYour Name  * hdd_register_cstats_ops() - Register chipset stats ops
828*5113495bSYour Name  *
829*5113495bSYour Name  * Return: void
830*5113495bSYour Name  */
831*5113495bSYour Name void hdd_register_cstats_ops(void);
832*5113495bSYour Name 
833*5113495bSYour Name /**
834*5113495bSYour Name  * hdd_cstats_log_ndi_delete_req_evt() - Chipset stats for ndi delete
835*5113495bSYour Name  *
836*5113495bSYour Name  * @vdev: pointer to vdev object
837*5113495bSYour Name  * @transaction_id: transaction ID
838*5113495bSYour Name  *
839*5113495bSYour Name  * Return : void
840*5113495bSYour Name  */
841*5113495bSYour Name void hdd_cstats_log_ndi_delete_req_evt(struct wlan_objmgr_vdev *vdev,
842*5113495bSYour Name 				       uint16_t transaction_id);
843*5113495bSYour Name 
844*5113495bSYour Name /**
845*5113495bSYour Name  * hdd_cstats_log_ndi_create_resp_evt() - Chipset stats for ndi create
846*5113495bSYour Name  * response
847*5113495bSYour Name  * @li: pointer link_info object
848*5113495bSYour Name  * @ndi_rsp: pointer to nan_datapath_inf_create_rsp object
849*5113495bSYour Name  *
850*5113495bSYour Name  * Return : void
851*5113495bSYour Name  */
852*5113495bSYour Name void
853*5113495bSYour Name hdd_cstats_log_ndi_create_resp_evt(struct wlan_hdd_link_info *li,
854*5113495bSYour Name 				   struct nan_datapath_inf_create_rsp *ndi_rsp);
855*5113495bSYour Name 
856*5113495bSYour Name /**
857*5113495bSYour Name  * hdd_cstats_log_ndi_create_req_evt() - Chipset stats for ndi create
858*5113495bSYour Name  * request
859*5113495bSYour Name  *
860*5113495bSYour Name  * @vdev: pointer vdve object
861*5113495bSYour Name  * @transaction_id : Transaction ID
862*5113495bSYour Name  *
863*5113495bSYour Name  * Return : void
864*5113495bSYour Name  */
865*5113495bSYour Name void hdd_cstats_log_ndi_create_req_evt(struct wlan_objmgr_vdev *vdev,
866*5113495bSYour Name 				       uint16_t transaction_id);
867*5113495bSYour Name #else
hdd_register_cstats_ops(void)868*5113495bSYour Name static inline void hdd_register_cstats_ops(void)
869*5113495bSYour Name {
870*5113495bSYour Name }
871*5113495bSYour Name 
872*5113495bSYour Name static inline int
hdd_cstats_send_data_to_userspace(char * buff,unsigned int len,enum cstats_types type)873*5113495bSYour Name hdd_cstats_send_data_to_userspace(char *buff, unsigned int len,
874*5113495bSYour Name 				  enum cstats_types type)
875*5113495bSYour Name {
876*5113495bSYour Name 	return 0;
877*5113495bSYour Name }
878*5113495bSYour Name 
879*5113495bSYour Name static inline void
hdd_cstats_log_ndi_delete_req_evt(struct wlan_objmgr_vdev * vdev,uint16_t transaction_id)880*5113495bSYour Name hdd_cstats_log_ndi_delete_req_evt(struct wlan_objmgr_vdev *vdev,
881*5113495bSYour Name 				  uint16_t transaction_id)
882*5113495bSYour Name {
883*5113495bSYour Name }
884*5113495bSYour Name 
885*5113495bSYour Name static inline void
hdd_cstats_log_ndi_create_resp_evt(struct wlan_hdd_link_info * li,struct nan_datapath_inf_create_rsp * ndi_rsp)886*5113495bSYour Name hdd_cstats_log_ndi_create_resp_evt(struct wlan_hdd_link_info *li,
887*5113495bSYour Name 				   struct nan_datapath_inf_create_rsp *ndi_rsp)
888*5113495bSYour Name {
889*5113495bSYour Name }
890*5113495bSYour Name 
891*5113495bSYour Name static inline void
hdd_cstats_log_ndi_create_req_evt(struct wlan_objmgr_vdev * vdev,uint16_t transaction_id)892*5113495bSYour Name hdd_cstats_log_ndi_create_req_evt(struct wlan_objmgr_vdev *vdev,
893*5113495bSYour Name 				  uint16_t transaction_id)
894*5113495bSYour Name {
895*5113495bSYour Name }
896*5113495bSYour Name #endif /* WLAN_CHIPSET_STATS */
897*5113495bSYour Name #endif /* end #if !defined(WLAN_HDD_STATS_H) */
898