xref: /wlan-dirver/qca-wifi-host-cmn/utils/host_diag_log/src/i_host_diag_core_event.h (revision 92d87f51612f6c3b2285266215edee8911647c2f)
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 void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause);
111 
112 /**
113  * host_log_acs_req_event() - ACS request event indication
114  * @intf: network interface name for WLAN
115  * @hw_mode: hw mode configured by hostapd
116  * @bw: channel bandwidth (MHz)
117  * @ht: a flag indicating whether HT phy mode is enabled
118  * @vht: a flag indicating whether VHT phy mode is enabled
119  * @chan_start: starting channel number for ACS scan
120  * @chan_end: ending channel number for ACS scan
121  *
122  * Indicates the diag event for ACS request with payload related
123  * to parameters populated by hostapd
124  *
125  * Return: None
126  */
127 void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode,
128 			    uint16_t bw, uint8_t ht, uint8_t vht,
129 			    uint16_t chan_start, uint16_t chan_end);
130 
131 /**
132  * host_log_acs_scan_start() - ACS scan start event indication
133  * @scan_id: scan request ID
134  * @vdev_id: vdev/session ID
135  *
136  * Indicates the diag event for ACS scan start request
137  *
138  * Return: None
139  */
140 void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id);
141 
142 /**
143  * host_log_acs_scan_done() - ACS scan done event indication
144  * @status: indicating whether ACS scan is successful
145  * @vdev_id: vdev/session ID
146  * @scan_id: scan request ID
147  *
148  * Indicates the diag event for ACS scan done
149  *
150  * Return: None
151  */
152 void host_log_acs_scan_done(const uint8_t *status, uint8_t vdev_id,
153 			    uint32_t scan_id);
154 
155 /**
156  * host_log_acs_chan_spect_weight() - ACS channel spectral weight indication
157  * weight event indication
158  * @chan: channel number
159  * @weight: channel weight
160  * @rssi: RSSI value obtained after scanning
161  * @bss_count: number of BSS detected on this channel
162  *
163  * Indicates a diag event for ACS channel weight evaluation result
164  *
165  * Return: None
166  */
167 void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight,
168 				    int32_t rssi, uint16_t bss_count);
169 
170 /**
171  * host_log_acs_best_chan() - ACS best channel event indication
172  * @chan: channel number
173  * @weight: channel weight
174  *
175  * Indicates the best channel has been selected after ACS
176  *
177  * Return: None
178  */
179 void host_log_acs_best_chan(uint16_t chan, uint16_t weight);
180 
181 #else
182 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
183 {
184 	return;
185 }
186 
187 static inline void host_log_acs_req_event(uint8_t *intf, uint8_t *hw_mode,
188 					  uint16_t bw, uint8_t ht, uint8_t vht,
189 					  uint16_t chan_start,
190 					  uint16_t chan_end)
191 {
192 }
193 
194 static inline void host_log_acs_scan_start(uint8_t *scan_type,
195 					   uint8_t *bss_type, uint32_t scan_id,
196 					   uint8_t vdev_id)
197 {
198 }
199 
200 static inline void host_log_acs_scan_done(const uint8_t *status,
201 					  uint8_t vdev_id, uint32_t scan_id)
202 {
203 }
204 
205 static inline void host_log_acs_chan_spect_weight(uint16_t chan,
206 						  uint16_t weight, int32_t rssi,
207 						  uint16_t bss_count)
208 {
209 }
210 
211 static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight)
212 {
213 }
214 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
215 #ifdef __cplusplus
216 }
217 #endif /* __cplusplus */
218 #endif /* __I_HOST_DIAG_CORE_EVENT_H */
219