1 /* Copyright (c) 2015, The Linux Foundation. All rights reserved.
2  *
3  * Redistribution and use in source and binary forms, with or without
4  * modification, are permitted provided that the following conditions are
5  * met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above
9  *       copyright notice, this list of conditions and the following
10  *       disclaimer in the documentation and/or other materials provided
11  *       with the distribution.
12  *     * Neither the name of The Linux Foundation nor the names of its
13  *       contributors may be used to endorse or promote products derived
14  *       from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef WIFILOGGER_EVENT_DEFS_H
30 #define WIFILOGGER_EVENT_DEFS_H
31 
32 typedef enum {
33     EVENT_DROP_ID = 0,
34 
35     EVENT_WLAN_PE = 0x67A, /* 16 byte payload */
36 
37     /* Events between 0x67b to 0x67f are not used */
38 
39     EVENT_WLAN_ADD_BLOCK_ACK_SUCCESS = 0x67B,        /* 11 byte payload */
40     EVENT_WLAN_ADD_BLOCK_ACK_FAILED = 0x67C,         /* 9 byte payload */
41 
42     EVENT_WLAN_EXTSCAN_FEATURE_STARTED =   0xA8E, /* 240 byte payload */
43     EVENT_WLAN_EXTSCAN_FEATURE_CHANNEL_CONFIG = 0xA8F, /* 243 byte payload */
44     EVENT_WLAN_EXTSCAN_CYCLE_STARTED = 0xA90, /* 12 byte payload */
45     EVENT_WLAN_EXTSCAN_CYCLE_COMPLETED = 0xA91, /* 12 byte payload */
46     EVENT_WLAN_EXTSCAN_BUCKET_STARTED = 0xA92, /* 1 byte payload */
47     EVENT_WLAN_EXTSCAN_BUCKET_COMPLETED = 0xA93, /* 4 byte payload */
48     EVENT_WLAN_ROAM_SCAN_STARTED = 0xA94, /* 128 byte payload */
49 
50 
51     EVENT_WLAN_ROAM_SCAN_COMPLETE = 0xA95,
52     EVENT_WLAN_ROAM_CANDIDATE_FOUND = 0xA96,
53     EVENT_WLAN_ROAM_SCAN_CONFIG = 0xA97,
54     EVENT_WLAN_BT_COEX_BT_SCO_START = 0xA98,
55     EVENT_WLAN_BT_COEX_BT_SCO_STOP = 0xA99,
56     EVENT_WLAN_BT_COEX_BT_SCAN_START = 0xA9A,
57     EVENT_WLAN_BT_COEX_BT_SCAN_STOP = 0xA9B,
58     EVENT_WLAN_BT_COEX_BT_HID_START = 0xA9C,
59     EVENT_WLAN_BT_COEX_BT_HID_STOP = 0xA9D,
60     EVENT_WLAN_WAKE_LOCK = 0xAA2, /* 96 bytes payload */
61     EVENT_WLAN_EAPOL = 0xA8D, /* 96 bytes payload */
62     EVENT_WLAN_EXTSCAN_FEATURE_STOP = 0xAA3,
63     EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE = 0xAA4,
64     EVENT_WLAN_BEACON_EVENT = 0xAA6,
65     EVENT_WLAN_LOG_COMPLETE = 0xAA7,
66     EVENT_WLAN_LOW_RESOURCE_FAILURE = 0xABB,
67     EVENT_WLAN_STA_DATA_STALL = 0xB3A,
68 
69     EVENT_MAX_ID = 0x0FFF
70 } event_id_enum_type;
71 
72 typedef enum {
73     LOG_DROP_ID = 0,
74     LOG_WLAN_EXTSCAN_CAPABILITIES = 0x18F1,
75     LOG_WLAN_EXTSCAN_FEATURE_STARTED = 0x18F2,
76 } log_id_enum_type;
77 
78 typedef enum
79 {
80     WLAN_PE_DIAG_SCAN_REQ_EVENT = 0,
81     WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
82     WLAN_PE_DIAG_SCAN_RSP_EVENT,
83     WLAN_PE_DIAG_JOIN_REQ_EVENT,
84     WLAN_PE_DIAG_JOIN_RSP_EVENT,
85     WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT,
86     WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT,
87     WLAN_PE_DIAG_REASSOC_REQ_EVENT,
88     WLAN_PE_DIAG_REASSOC_RSP_EVENT,
89     WLAN_PE_DIAG_AUTH_REQ_EVENT,
90     WLAN_PE_DIAG_AUTH_RSP_EVENT = 10,
91     WLAN_PE_DIAG_DISASSOC_REQ_EVENT,
92     WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
93     WLAN_PE_DIAG_DISASSOC_IND_EVENT,
94     WLAN_PE_DIAG_DISASSOC_CNF_EVENT,
95     WLAN_PE_DIAG_DEAUTH_REQ_EVENT,
96     WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
97     WLAN_PE_DIAG_DEAUTH_IND_EVENT,
98     WLAN_PE_DIAG_START_BSS_REQ_EVENT,
99     WLAN_PE_DIAG_START_BSS_RSP_EVENT,
100     WLAN_PE_DIAG_AUTH_IND_EVENT = 20,
101     WLAN_PE_DIAG_ASSOC_IND_EVENT,
102     WLAN_PE_DIAG_ASSOC_CNF_EVENT,
103     WLAN_PE_DIAG_REASSOC_IND_EVENT,
104     WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT,
105     WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT,
106     WLAN_PE_DIAG_STOP_BSS_REQ_EVENT,
107     WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
108     WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
109     WLAN_PE_DIAG_ADDTS_REQ_EVENT,
110     WLAN_PE_DIAG_ADDTS_RSP_EVENT = 30,
111     WLAN_PE_DIAG_DELTS_REQ_EVENT,
112     WLAN_PE_DIAG_DELTS_RSP_EVENT,
113     WLAN_PE_DIAG_DELTS_IND_EVENT,
114     WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT,
115     WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT,
116     WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT,
117     WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT,
118     WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT,
119     WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT,
120     WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT = 40,
121     WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT,
122     WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT,
123     WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT,
124     WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT,
125     WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT,
126     WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT,
127     WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT,
128     WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT,
129     WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT,
130     WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT = 50,
131     WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT,
132     WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT,
133     WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT,
134     WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT,
135     WLAN_PE_DIAG_HAL_DELBA_IND_EVENT,
136     WLAN_PE_DIAG_HB_FAILURE_TIMEOUT,
137     WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT,
138     WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
139     WLAN_PE_DIAG_PREAUTH_DONE,
140     WLAN_PE_DIAG_REASSOCIATING = 60,
141     WLAN_PE_DIAG_CONNECTED,
142     WLAN_PE_DIAG_ASSOC_REQ_EVENT,
143     WLAN_PE_DIAG_AUTH_COMP_EVENT,
144     WLAN_PE_DIAG_ASSOC_COMP_EVENT,
145     WLAN_PE_DIAG_AUTH_START_EVENT,
146     WLAN_PE_DIAG_ASSOC_START_EVENT,
147     WLAN_PE_DIAG_REASSOC_START_EVENT,
148     WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
149     WLAN_PE_DIAG_ROAM_AUTH_COMP_EVENT,
150     WLAN_PE_DIAG_ROAM_ASSOC_START_EVENT = 70,
151     WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT,
152     WLAN_PE_DIAG_SCAN_COMP_EVENT,
153     WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT,
154     WLAN_PE_DIAG_ASSOC_TIMEOUT,
155     WLAN_PE_DIAG_AUTH_TIMEOUT,
156 } wlan_host_diag_event_type;
157 
158 typedef struct wlan_pe_event {
159     char bssid[6];
160     u16 event_type;
161     u16 sme_state;
162     u16 mlm_state;
163     u16 status;
164     u16 reason_code;
165 } __attribute__((packed)) wlan_pe_event_t;
166 
167 typedef enum {
168     WLAN_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED = 0,
169     WLAN_DRIVER_EAPOL_FRAME_RECEIVED,
170 } wlan_eapol_event_type;
171 
172 #define EAPOL_MASK 0x8013
173 #define EAPOL_M1_MASK 0x8000
174 #define EAPOL_M2_MASK 0x0001
175 #define EAPOL_M3_MASK 0x8013
176 #define EAPOL_M4_MASK 0x0003
177 
178 typedef struct wlan_eapol_event {
179     u8 event_sub_type;
180     u8 eapol_packet_type;
181     u16 eapol_key_info;
182     u16 eapol_rate;
183     u8 dest_addr[6];
184     u8 src_addr[6];
185 } __attribute__((packed)) wlan_eapol_event_t;
186 
187 /*EVENT_WLAN_EXTSCAN_FEATURE_STARTED */
188 typedef struct wlan_ext_bucket {
189     u8 bucket_id;
190     u8 base_period_multiplier;
191     u16 min_dwell_time_active;
192     u16 max_dwell_time_active;
193     u16 min_dwell_time_passive;
194     u16 max_dwell_time_passive;
195     u8 num_channels;
196     u8 channel_offset;
197     u8 forwarding_flags;
198     u8 channel_band;
199     u32 notify_extscan_events;
200 } __attribute__((packed)) wlan_ext_bucket_t;
201 
202 typedef struct {
203     u32 base_period;
204     u32 max_iterations;
205     u32 forwarding_flags;
206     u32 configuration_flags;
207     u32 notify_extscan_events;
208     u32 scan_priority;
209     u32 max_bssids_per_scan_cycle;
210     u32 min_rssi;
211     u32 max_table_usage;
212     u32 min_dwell_time_active;
213     u32 max_dwell_time_active;
214     u32 min_dwell_time_passive;
215     u32 max_dwell_time_passive;
216     u32 min_rest_time;
217     u32 max_rest_time;
218     u32 n_probes;
219     u32 repeat_probe_time;
220     u32 probe_spacing_time;
221     u32 idle_time;
222     u32 max_scan_time;
223     u32 probe_delay;
224     u32 scan_ctrl_flags;
225     u32 burst_duration;
226     u32 num_buckets;
227     wlan_ext_bucket bucket_list[8];
228 } __attribute__((packed)) wlan_ext_scan_feature_started_payload_type;
229 /*End EVENT_WLAN_EXTSCAN_FEATURE_STARTED*/
230 
231 /*EVENT_WLAN_EXTSCAN_FEATURE_CHANNEL_CONFIG*/
232 typedef struct {
233     u8 bucket_id;
234     u16 scan_channels[40];
235 } __attribute__((packed)) wlan_ext_bucket_channels;
236 
237 typedef struct {
238     wlan_ext_bucket_channels bucket_list[3];
239 } __attribute__((packed)) wlan_ext_bucket_channel_config_payload_type;
240 
241 /*End EVENT_WLAN_EXTSCAN_FEATURE_CHANNEL_CONFIG*/
242 
243 /*EVENT_WLAN_EXTSCAN_CYCLE_STARTED*/
244 typedef struct {
245     u32 scan_id;
246     u32 timer_tick;
247     u32 scheduled_bucket_mask;
248     u32 scan_cycle_count;
249 } __attribute__((packed)) wlan_ext_scan_cycle_started_payload_type;
250 /*End EVENT_WLAN_EXTSCAN_CYCLE_STARTED*/
251 
252 /*EVENT_WLAN_EXTSCAN_CYCLE_COMPLETED*/
253 typedef struct {
254     u32 scan_id;
255     u32 timer_tick;
256     u32 scheduled_bucket_mask;
257     u32 scan_cycle_count;
258 } __attribute__((packed)) wlan_ext_scan_cycle_completed_payload_type;
259 /*End EVENT_WLAN_EXTSCAN_CYCLE_COMPLETED*/
260 
261 /*EVENT_WLAN_EXTSCAN_BUCKET_STARTED*/
262 typedef struct {
263     u8 bucket_id;
264 } __attribute__((packed)) wlan_ext_scan_bucket_started_payload_type;
265 /*End EVENT_WLAN_EXTSCAN_BUCKET_STARTED*/
266 
267 /*EVENT_WLAN_EXTSCAN_BUCKET_COMPLETED*/
268 typedef struct {
269     u8 bucket_id;
270 } __attribute__((packed))  wlan_ext_scan_bucket_completed_payload_type;
271 /*End EVENT_WLAN_EXTSCAN_BUCKET_COMPLETED*/
272 
273 /*EVENT_WLAN_ROAM_SCAN_STARTED*/
274 typedef struct {
275     u32 scan_id;
276     u32 roam_scan_flags;
277     u32 cur_rssi;
278     u16 scan_params[18];
279     u16 scan_channels[40]; // first 40 channels only
280 } __attribute__((packed)) wlan_roam_scan_started_payload_type;
281 /*End EVENT_WLAN_ROAM_SCAN_STARTED*/
282 
283 /*EVENT_WLAN_ROAM_SCAN_COMPLETE*/
284 typedef struct {
285     u32 scan_id;
286     u32 reason;
287     u32 completion_flags;
288     u32 num_candidate;
289     u32 flags;
290 } __attribute__((packed)) wlan_roam_scan_complete_payload_type;
291 /*End EVENT_WLAN_ROAM_SCAN_COMPLETE*/
292 
293 /*EVENT_WLAN_ROAM_CANDIDATE_FOUND*/
294 typedef struct {
295     u8 channel;
296     u8 rssi;
297     u8 bssid[6];
298     u8 ssid[33];
299     u8 auth_mode;
300     u8 ucast_cipher;
301     u8 mcast_cipher;
302 } __attribute__((packed)) wlan_roam_candidate_found_payload_type;
303 /*End EVENT_WLAN_ROAM_CANDIDATE_FOUND*/
304 
305 /*EVENT_WLAN_ROAM_SCAN_CONFIG*/
306 typedef struct {
307     u32 flags;
308     u32 roam_scan_config[8];
309 } __attribute__((packed)) wlan_roam_scan_config_payload_type;
310 /*End EVENT_WLAN_ROAM_SCAN_CONFIG*/
311 
312 /* EVENT_WLAN_BT_COEX_BT_SCO_START */
313 typedef struct {
314     u8 link_id;
315     u8 link_state;
316     u8 link_role;
317     u8 link_type;
318     u16 Tsco;
319     u8 Rsco;
320 } __attribute__((packed)) wlan_bt_coex_bt_sco_start_payload_type;
321 /* End EVENT_WLAN_BT_COEX_BT_SCO_START */
322 
323 /* EVENT_WLAN_BT_COEX_BT_SCO_STOP */
324 typedef struct {
325     u8 link_id;
326     u8 link_state;
327     u8 link_role;
328     u8 link_type;
329     u16 Tsco;
330     u8 Rsco;
331 } __attribute__((packed)) wlan_bt_coex_bt_sco_stop_payload_type;
332 /* End EVENT_WLAN_BT_COEX_BT_SCO_STOP */
333 
334 /* EVENT_WLAN_BT_COEX_BT_SCAN_START */
335 typedef struct {
336     u8 scan_type;
337     u8 scan_bitmap;
338 } __attribute__((packed)) wlan_bt_coex_bt_scan_start_payload_type;
339 
340 /* End EVENT_WLAN_BT_COEX_BT_SCAN_START */
341 
342 /* EVENT_WLAN_BT_COEX_BT_SCAN_STOP */
343 typedef struct {
344     u8 scan_type;
345     u8 scan_bitmap;
346 } __attribute__((packed)) wlan_bt_coex_bt_scan_stop_payload_type;
347 /* End EVENT_WLAN_BT_COEX_BT_SCAN_STOP */
348 
349 /* EVENT_WIFI_BT_COEX_BT_HID_START */
350 typedef struct {
351     u8 link_id;
352     u8 link_state;
353     u8 link_role;
354     u8 Tsniff;
355     u8 attempts;
356 } __attribute__((packed)) wlan_bt_coex_bt_hid_start_payload_type;
357 /* End EVENT_WIFI_BT_COEX_BT_HID_START */
358 
359 /* EVENT_WIFI_BT_COEX_BT_HID_STOP */
360 typedef struct {
361     u8 link_id;
362     u8 link_state;
363     u8 link_role;
364     u8 Tsniff;
365     u8 attempts;
366 } __attribute__((packed)) wlan_bt_coex_bt_hid_stop_payload_type;
367 /* End EVENT_WIFI_BT_COEX_BT_HID_STOP */
368 
369 /* EVENT_WLAN_EXTSCAN_FEATURE_STOP */
370 typedef struct {
371     u32 request_id;
372 } __attribute__((packed)) wlan_ext_scan_feature_stop_payload_type;
373 /* End EVENT_WLAN_EXTSCAN_FEATURE_STOP */
374 
375 /* EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE */
376 typedef struct {
377     u32 request_id;
378     u32 table_type;
379     u32 entries_in_use;
380     u32 maximum_entries;
381     u32 scan_count_after_getResults;
382     u8 threshold_num_scans;
383 } __attribute__((packed)) wlan_ext_scan_results_available_payload_type;
384 /* End EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE */
385 
386 /* Log LOG_WLAN_EXTSCAN_CAPABILITIES */
387 typedef struct {
388     u32 header;
389     u32 request_id;
390     u32 requestor_id;
391     u32 vdev_id;
392     u32 num_extscan_cache_tables;
393     u32 num_wlan_change_monitor_tables;
394     u32 num_hotlist_monitor_tables;
395     u32 rtt_one_sided_supported;
396     u32 rtt_11v_supported;
397     u32 rtt_ftm_supported;
398     u32 num_extscan_cache_capabilities;
399     u32 num_extscan_wlan_change_capabilities;
400     u32 num_extscan_hotlist_capabilities;
401     u32 num_roam_ssid_whitelist;
402     u32 num_roam_bssid_blacklist;
403     u32 num_roam_bssid_preferred_list;
404     u32 num_extscan_hotlist_ssid;
405     u32 num_epno_networks;
406 } __attribute__((packed)) wlan_extscan_capabilities_event_fixed_param;
407 
408 typedef struct {
409     u32 header;
410     u32 table_id;
411     u32 scan_cache_entry_size;
412     u32 max_scan_cache_entries;
413     u32 max_buckets;
414     u32 max_bssid_per_scan;
415     u32 max_table_usage_threshold;
416 } __attribute__((packed)) wlan_extscan_cache_capabilities;
417 
418 typedef struct {
419     u32 tlv_header;
420     u32 table_id;
421     u32 wlan_hotlist_entry_size;
422     u32 max_hotlist_entries;
423 } __attribute__((packed)) wlan_extscan_hotlist_monitor_capabilities;
424 
425 typedef struct {
426     u32 request_id;
427     wlan_extscan_capabilities_event_fixed_param extscan_capabilities;
428     wlan_extscan_cache_capabilities extscan_cache_capabilities;
429     wlan_extscan_hotlist_monitor_capabilities extscan_hotlist_monitor_capabilities;
430 } __attribute__((packed)) wlan_ext_scan_capabilities_payload_type;
431 /* End LOG_WLAN_EXTSCAN_CAPABILITIES */
432 
433 /* EVENT_WLAN_BEACON_RECEIVED */
434 typedef struct {
435     u8 bssid[6];
436     u32 beacon_rssi;
437 } __attribute__((packed)) wlan_beacon_received_payload_type;
438 /* End EVENT_WLAN_BEACON_RECEIVED */
439 
440 typedef struct {
441     u8 ucBaPeerMac[6];
442     u8 ucBaTid;
443     u8 ucBaBufferSize;
444     u16 ucBaSSN;
445     u8 fInitiator;
446 } __attribute__((packed)) wlan_add_block_ack_success_payload_type;
447 
448 /* EVENT_WLAN_ADD_BLOCK_ACK_FAILED */
449 typedef struct {
450     u8 ucBaPeerMac[6];
451     u8 ucBaTid;
452     u8 ucReasonCode;
453     u8 fInitiator;
454 } __attribute__((packed)) wlan_add_block_ack_failed_payload_type;
455 
456 typedef enum
457 {
458     WIFI_EVENT_MEMORY_FAILURE,
459 } resource_failure_type;
460 
461 typedef struct wlan_low_resource_failure_event
462 {
463     resource_failure_type event_sub_type;
464 } __attribute__((packed)) wlan_low_resource_failure_event_t;
465 
466 #endif /* WIFILOGGER_EVENT_DEFS_H */
467