1 /* 2 * Copyright (c) 2014-2019, 2021 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 135 #endif /* FEATURE_WLAN_DIAG_SUPPORT */ 136 137 #ifdef FEATURE_WLAN_DIAG_SUPPORT 138 /** 139 * host_log_wlan_auth_info() - This function is used to send 140 * algo num, seq num and status code for auth request 141 * @auth_algo_num: Gives information about algo num used in auth request 142 * @auth_tx_seq_num: seq num of auth request 143 * @auth_status_code: status code of auth request 144 * 145 * This function is used to send send algo num, seq num and status code 146 * for auth request 147 * 148 * Return: None 149 * 150 */ 151 void 152 host_log_wlan_auth_info(uint16_t auth_algo_num, uint16_t auth_tx_seq_num, 153 uint16_t auth_status_code); 154 155 #else 156 static inline void 157 host_log_wlan_auth_info(uint16_t auth_algo_num, uint16_t auth_tx_seq_num, 158 uint16_t auth_status_code) 159 { 160 } 161 162 #endif /* FEATURE_WLAN_DIAG_SUPPORT */ 163 164 #ifdef FEATURE_WLAN_DIAG_SUPPORT 165 void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause); 166 167 /** 168 * host_log_acs_req_event() - ACS request event indication 169 * @intf: network interface name for WLAN 170 * @hw_mode: hw mode configured by hostapd 171 * @bw: channel bandwidth (MHz) 172 * @ht: a flag indicating whether HT phy mode is enabled 173 * @vht: a flag indicating whether VHT phy mode is enabled 174 * @chan_start: starting channel number for ACS scan 175 * @chan_end: ending channel number for ACS scan 176 * 177 * Indicates the diag event for ACS request with payload related 178 * to parameters populated by hostapd 179 * 180 * Return: None 181 */ 182 void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode, 183 uint16_t bw, uint8_t ht, uint8_t vht, 184 uint16_t chan_start, uint16_t chan_end); 185 186 /** 187 * host_log_acs_scan_start() - ACS scan start event indication 188 * @scan_id: scan request ID 189 * @vdev_id: vdev/session ID 190 * 191 * Indicates the diag event for ACS scan start request 192 * 193 * Return: None 194 */ 195 void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id); 196 197 /** 198 * host_log_acs_scan_done() - ACS scan done event indication 199 * @status: indicating whether ACS scan is successful 200 * @vdev_id: vdev/session ID 201 * @scan_id: scan request ID 202 * 203 * Indicates the diag event for ACS scan done 204 * 205 * Return: None 206 */ 207 void host_log_acs_scan_done(const uint8_t *status, uint8_t vdev_id, 208 uint32_t scan_id); 209 210 /** 211 * host_log_acs_chan_spect_weight() - ACS channel spectral weight indication 212 * weight event indication 213 * @chan: channel number 214 * @weight: channel weight 215 * @rssi: RSSI value obtained after scanning 216 * @bss_count: number of BSS detected on this channel 217 * 218 * Indicates a diag event for ACS channel weight evaluation result 219 * 220 * Return: None 221 */ 222 void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight, 223 int32_t rssi, uint16_t bss_count); 224 225 /** 226 * host_log_acs_best_chan() - ACS best channel event indication 227 * @chan: channel number 228 * @weight: channel weight 229 * 230 * Indicates the best channel has been selected after ACS 231 * 232 * Return: None 233 */ 234 void host_log_acs_best_chan(uint16_t chan, uint16_t weight); 235 236 /** 237 * host_log_device_status() - device status indication 238 * @status_code: status code from enum wlan_bringup_status 239 * 240 * Indicates device status 241 * 242 * Return: None 243 */ 244 void host_log_device_status(uint16_t status_code); 245 246 #else 247 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause) 248 { 249 return; 250 } 251 252 static inline void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode, 253 uint16_t bw, uint8_t ht, uint8_t vht, 254 uint16_t chan_start, 255 uint16_t chan_end) 256 { 257 } 258 259 static inline void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id) 260 { 261 } 262 263 static inline void host_log_acs_scan_done(const uint8_t *status, 264 uint8_t vdev_id, uint32_t scan_id) 265 { 266 } 267 268 static inline void host_log_acs_chan_spect_weight(uint16_t chan, 269 uint16_t weight, int32_t rssi, 270 uint16_t bss_count) 271 { 272 } 273 274 static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight) 275 { 276 } 277 278 static inline void host_log_device_status(uint16_t status_code) 279 { 280 } 281 #endif /* FEATURE_WLAN_DIAG_SUPPORT */ 282 #ifdef __cplusplus 283 } 284 #endif /* __cplusplus */ 285 #endif /* __I_HOST_DIAG_CORE_EVENT_H */ 286