xref: /wlan-dirver/qca-wifi-host-cmn/utils/host_diag_log/src/i_host_diag_core_event.h (revision dae10a5fbc53d54c53c4ba24fa018ad8b1e7c008)
1 /*
2  * Copyright (c) 2014-2018 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 #if !defined(__I_HOST_DIAG_CORE_EVENT_H)
20 #define __I_HOST_DIAG_CORE_EVENT_H
21 
22 /**=========================================================================
23 
24    \file  i_host_diag_core_event.h
25 
26    \brief Android specific definitions for WLAN UTIL DIAG events
27 
28    ========================================================================*/
29 
30 /* $Header$ */
31 
32 /*--------------------------------------------------------------------------
33    Include Files
34    ------------------------------------------------------------------------*/
35 #include <qdf_types.h>
36 #ifdef FEATURE_WLAN_DIAG_SUPPORT
37 #include <host_diag_event_defs.h>
38 #endif
39 
40 /*--------------------------------------------------------------------------
41    Preprocessor definitions and constants
42    ------------------------------------------------------------------------*/
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47 
48 #ifdef FEATURE_WLAN_DIAG_SUPPORT
49 
50 void host_diag_event_report_payload(uint16_t event_Id, uint16_t length,
51 				    void *pPayload);
52 /*---------------------------------------------------------------------------
53    Allocate an event payload holder
54    ---------------------------------------------------------------------------*/
55 #define WLAN_HOST_DIAG_EVENT_DEF(payload_name, payload_type) \
56 	payload_type(payload_name)
57 
58 /*---------------------------------------------------------------------------
59    Report the event
60    ---------------------------------------------------------------------------*/
61 #define WLAN_HOST_DIAG_EVENT_REPORT(payload_ptr, ev_id) \
62 	do {							\
63 		host_diag_event_report_payload(ev_id,		\
64 						sizeof(*(payload_ptr)),			\
65 						(void *)(payload_ptr));			\
66 	} while (0)
67 
68 #else                           /* FEATURE_WLAN_DIAG_SUPPORT */
69 
70 #define WLAN_HOST_DIAG_EVENT_DEF(payload_name, payload_type)
71 #define WLAN_HOST_DIAG_EVENT_REPORT(payload_ptr, ev_id)
72 
73 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
74 
75 /**
76  * enum auth_timeout_type - authentication timeout type
77  * @AUTH_FAILURE_TIMEOUT: auth failure timeout
78  * @AUTH_RESPONSE_TIMEOUT: auth response timeout
79  */
80 enum auth_timeout_type {
81 	AUTH_FAILURE_TIMEOUT,
82 	AUTH_RESPONSE_TIMEOUT,
83 };
84 
85 /*-------------------------------------------------------------------------
86    Function declarations and documenation
87    ------------------------------------------------------------------------*/
88 #ifdef FEATURE_WLAN_DIAG_SUPPORT
89 void host_diag_log_wlock(uint32_t reason, const char *wake_lock_name,
90 		uint32_t timeout, uint32_t status);
91 #else
92 static inline void host_diag_log_wlock(uint32_t reason,
93 		const char *wake_lock_name,
94 		uint32_t timeout, uint32_t status)
95 {
96 
97 }
98 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
99 
100 #ifdef FEATURE_WLAN_DIAG_SUPPORT
101 void host_log_low_resource_failure(uint8_t event_sub_type);
102 #else
103 static inline void host_log_low_resource_failure(uint8_t event_sub_type)
104 {
105 
106 }
107 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
108 
109 #ifdef FEATURE_WLAN_DIAG_SUPPORT
110 /**
111  * host_log_rsn_info() - This function is used to send
112  * requested rsn info in assoc request
113  * @ucast_cipher: Unicast ciphers used in assoc request
114  * @mcast_cipher: Group ciphers used in assoc request
115  * @akm_suite: Gives information about akm suites used in assoc request
116  * @group_mgmt: Requested group mgmt cipher suite
117  *
118  * This function is used to send RSN info used in assoc req to user space
119  *
120  * Return: None
121  *
122  */
123 void host_log_rsn_info(uint8_t *ucast_cipher, uint8_t *mcast_cipher,
124 		       uint8_t *auth_suite, uint8_t *gp_mgmt_cipher);
125 
126 #else
127 static inline void host_log_rsn_info(uint8_t *ucast_cipher,
128 				     uint8_t *mcast_cipher,
129 				     uint8_t *auth_suite,
130 				     uint8_t *gp_mgmt_cipher)
131 {
132 
133 }
134 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
135 
136 
137 #ifdef FEATURE_WLAN_DIAG_SUPPORT
138 void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause);
139 
140 /**
141  * host_log_acs_req_event() - ACS request event indication
142  * @intf: network interface name for WLAN
143  * @hw_mode: hw mode configured by hostapd
144  * @bw: channel bandwidth (MHz)
145  * @ht: a flag indicating whether HT phy mode is enabled
146  * @vht: a flag indicating whether VHT phy mode is enabled
147  * @chan_start: starting channel number for ACS scan
148  * @chan_end: ending channel number for ACS scan
149  *
150  * Indicates the diag event for ACS request with payload related
151  * to parameters populated by hostapd
152  *
153  * Return: None
154  */
155 void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode,
156 			    uint16_t bw, uint8_t ht, uint8_t vht,
157 			    uint16_t chan_start, uint16_t chan_end);
158 
159 /**
160  * host_log_acs_scan_start() - ACS scan start event indication
161  * @scan_id: scan request ID
162  * @vdev_id: vdev/session ID
163  *
164  * Indicates the diag event for ACS scan start request
165  *
166  * Return: None
167  */
168 void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id);
169 
170 /**
171  * host_log_acs_scan_done() - ACS scan done event indication
172  * @status: indicating whether ACS scan is successful
173  * @vdev_id: vdev/session ID
174  * @scan_id: scan request ID
175  *
176  * Indicates the diag event for ACS scan done
177  *
178  * Return: None
179  */
180 void host_log_acs_scan_done(const uint8_t *status, uint8_t vdev_id,
181 			    uint32_t scan_id);
182 
183 /**
184  * host_log_acs_chan_spect_weight() - ACS channel spectral weight indication
185  * weight event indication
186  * @chan: channel number
187  * @weight: channel weight
188  * @rssi: RSSI value obtained after scanning
189  * @bss_count: number of BSS detected on this channel
190  *
191  * Indicates a diag event for ACS channel weight evaluation result
192  *
193  * Return: None
194  */
195 void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight,
196 				    int32_t rssi, uint16_t bss_count);
197 
198 /**
199  * host_log_acs_best_chan() - ACS best channel event indication
200  * @chan: channel number
201  * @weight: channel weight
202  *
203  * Indicates the best channel has been selected after ACS
204  *
205  * Return: None
206  */
207 void host_log_acs_best_chan(uint16_t chan, uint16_t weight);
208 
209 #else
210 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
211 {
212 	return;
213 }
214 
215 static inline void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode,
216 					  uint16_t bw, uint8_t ht, uint8_t vht,
217 					  uint16_t chan_start,
218 					  uint16_t chan_end)
219 {
220 }
221 
222 static inline void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id)
223 {
224 }
225 
226 static inline void host_log_acs_scan_done(const uint8_t *status,
227 					  uint8_t vdev_id, uint32_t scan_id)
228 {
229 }
230 
231 static inline void host_log_acs_chan_spect_weight(uint16_t chan,
232 						  uint16_t weight, int32_t rssi,
233 						  uint16_t bss_count)
234 {
235 }
236 
237 static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight)
238 {
239 }
240 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
241 #ifdef __cplusplus
242 }
243 #endif /* __cplusplus */
244 #endif /* __I_HOST_DIAG_CORE_EVENT_H */
245