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 
68     EVENT_MAX_ID = 0x0FFF
69 } event_id_enum_type;
70 
71 typedef enum {
72     LOG_DROP_ID = 0,
73     LOG_WLAN_EXTSCAN_CAPABILITIES = 0x18F1,
74     LOG_WLAN_EXTSCAN_FEATURE_STARTED = 0x18F2,
75 } log_id_enum_type;
76 
77 typedef enum
78 {
79     WLAN_PE_DIAG_SCAN_REQ_EVENT = 0,
80     WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT,
81     WLAN_PE_DIAG_SCAN_RSP_EVENT,
82     WLAN_PE_DIAG_JOIN_REQ_EVENT,
83     WLAN_PE_DIAG_JOIN_RSP_EVENT,
84     WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT,
85     WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT,
86     WLAN_PE_DIAG_REASSOC_REQ_EVENT,
87     WLAN_PE_DIAG_REASSOC_RSP_EVENT,
88     WLAN_PE_DIAG_AUTH_REQ_EVENT,
89     WLAN_PE_DIAG_AUTH_RSP_EVENT = 10,
90     WLAN_PE_DIAG_DISASSOC_REQ_EVENT,
91     WLAN_PE_DIAG_DISASSOC_RSP_EVENT,
92     WLAN_PE_DIAG_DISASSOC_IND_EVENT,
93     WLAN_PE_DIAG_DISASSOC_CNF_EVENT,
94     WLAN_PE_DIAG_DEAUTH_REQ_EVENT,
95     WLAN_PE_DIAG_DEAUTH_RSP_EVENT,
96     WLAN_PE_DIAG_DEAUTH_IND_EVENT,
97     WLAN_PE_DIAG_START_BSS_REQ_EVENT,
98     WLAN_PE_DIAG_START_BSS_RSP_EVENT,
99     WLAN_PE_DIAG_AUTH_IND_EVENT = 20,
100     WLAN_PE_DIAG_ASSOC_IND_EVENT,
101     WLAN_PE_DIAG_ASSOC_CNF_EVENT,
102     WLAN_PE_DIAG_REASSOC_IND_EVENT,
103     WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT,
104     WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT,
105     WLAN_PE_DIAG_STOP_BSS_REQ_EVENT,
106     WLAN_PE_DIAG_STOP_BSS_RSP_EVENT,
107     WLAN_PE_DIAG_DEAUTH_CNF_EVENT,
108     WLAN_PE_DIAG_ADDTS_REQ_EVENT,
109     WLAN_PE_DIAG_ADDTS_RSP_EVENT = 30,
110     WLAN_PE_DIAG_DELTS_REQ_EVENT,
111     WLAN_PE_DIAG_DELTS_RSP_EVENT,
112     WLAN_PE_DIAG_DELTS_IND_EVENT,
113     WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT,
114     WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT,
115     WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT,
116     WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT,
117     WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT,
118     WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT,
119     WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT = 40,
120     WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT,
121     WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT,
122     WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT,
123     WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT,
124     WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT,
125     WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT,
126     WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT,
127     WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT,
128     WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT,
129     WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT = 50,
130     WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT,
131     WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT,
132     WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT,
133     WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT,
134     WLAN_PE_DIAG_HAL_DELBA_IND_EVENT,
135     WLAN_PE_DIAG_HB_FAILURE_TIMEOUT,
136     WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT,
137     WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
138     WLAN_PE_DIAG_PREAUTH_DONE,
139     WLAN_PE_DIAG_REASSOCIATING = 60,
140     WLAN_PE_DIAG_CONNECTED,
141     WLAN_PE_DIAG_ASSOC_REQ_EVENT,
142     WLAN_PE_DIAG_AUTH_COMP_EVENT,
143     WLAN_PE_DIAG_ASSOC_COMP_EVENT,
144     WLAN_PE_DIAG_AUTH_START_EVENT,
145     WLAN_PE_DIAG_ASSOC_START_EVENT,
146     WLAN_PE_DIAG_REASSOC_START_EVENT,
147     WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
148     WLAN_PE_DIAG_ROAM_AUTH_COMP_EVENT,
149     WLAN_PE_DIAG_ROAM_ASSOC_START_EVENT = 70,
150     WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT,
151     WLAN_PE_DIAG_SCAN_COMP_EVENT,
152     WLAN_PE_DIAG_SCAN_RES_FOUND_EVENT,
153     WLAN_PE_DIAG_ASSOC_TIMEOUT,
154     WLAN_PE_DIAG_AUTH_TIMEOUT,
155 } wlan_host_diag_event_type;
156 
157 typedef struct wlan_pe_event {
158     char bssid[6];
159     u16 event_type;
160     u16 sme_state;
161     u16 mlm_state;
162     u16 status;
163     u16 reason_code;
164 } __attribute__((packed)) wlan_pe_event_t;
165 
166 typedef enum {
167     WLAN_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED = 0,
168     WLAN_DRIVER_EAPOL_FRAME_RECEIVED,
169 } wlan_eapol_event_type;
170 
171 #define EAPOL_MASK 0x8013
172 #define EAPOL_M1_MASK 0x8000
173 #define EAPOL_M2_MASK 0x0001
174 #define EAPOL_M3_MASK 0x8013
175 #define EAPOL_M4_MASK 0x0003
176 
177 typedef struct wlan_eapol_event {
178     u8 event_sub_type;
179     u8 eapol_packet_type;
180     u16 eapol_key_info;
181     u16 eapol_rate;
182     u8 dest_addr[6];
183     u8 src_addr[6];
184 } __attribute__((packed)) wlan_eapol_event_t;
185 
186 /*EVENT_WLAN_EXTSCAN_FEATURE_STARTED */
187 typedef struct wlan_ext_bucket {
188     u8 bucket_id;
189     u8 base_period_multiplier;
190     u16 min_dwell_time_active;
191     u16 max_dwell_time_active;
192     u16 min_dwell_time_passive;
193     u16 max_dwell_time_passive;
194     u8 num_channels;
195     u8 channel_offset;
196     u8 forwarding_flags;
197     u8 channel_band;
198     u32 notify_extscan_events;
199 } __attribute__((packed)) wlan_ext_bucket_t;
200 
201 typedef struct {
202     u32 base_period;
203     u32 max_iterations;
204     u32 forwarding_flags;
205     u32 configuration_flags;
206     u32 notify_extscan_events;
207     u32 scan_priority;
208     u32 max_bssids_per_scan_cycle;
209     u32 min_rssi;
210     u32 max_table_usage;
211     u32 min_dwell_time_active;
212     u32 max_dwell_time_active;
213     u32 min_dwell_time_passive;
214     u32 max_dwell_time_passive;
215     u32 min_rest_time;
216     u32 max_rest_time;
217     u32 n_probes;
218     u32 repeat_probe_time;
219     u32 probe_spacing_time;
220     u32 idle_time;
221     u32 max_scan_time;
222     u32 probe_delay;
223     u32 scan_ctrl_flags;
224     u32 burst_duration;
225     u32 num_buckets;
226     wlan_ext_bucket bucket_list[8];
227 } __attribute__((packed)) wlan_ext_scan_feature_started_payload_type;
228 /*End EVENT_WLAN_EXTSCAN_FEATURE_STARTED*/
229 
230 /*EVENT_WLAN_EXTSCAN_FEATURE_CHANNEL_CONFIG*/
231 typedef struct {
232     u8 bucket_id;
233     u16 scan_channels[40];
234 } __attribute__((packed)) wlan_ext_bucket_channels;
235 
236 typedef struct {
237     wlan_ext_bucket_channels bucket_list[3];
238 } __attribute__((packed)) wlan_ext_bucket_channel_config_payload_type;
239 
240 /*End EVENT_WLAN_EXTSCAN_FEATURE_CHANNEL_CONFIG*/
241 
242 /*EVENT_WLAN_EXTSCAN_CYCLE_STARTED*/
243 typedef struct {
244     u32 scan_id;
245     u32 timer_tick;
246     u32 scheduled_bucket_mask;
247     u32 scan_cycle_count;
248 } __attribute__((packed)) wlan_ext_scan_cycle_started_payload_type;
249 /*End EVENT_WLAN_EXTSCAN_CYCLE_STARTED*/
250 
251 /*EVENT_WLAN_EXTSCAN_CYCLE_COMPLETED*/
252 typedef struct {
253     u32 scan_id;
254     u32 timer_tick;
255     u32 scheduled_bucket_mask;
256     u32 scan_cycle_count;
257 } __attribute__((packed)) wlan_ext_scan_cycle_completed_payload_type;
258 /*End EVENT_WLAN_EXTSCAN_CYCLE_COMPLETED*/
259 
260 /*EVENT_WLAN_EXTSCAN_BUCKET_STARTED*/
261 typedef struct {
262     u8 bucket_id;
263 } __attribute__((packed)) wlan_ext_scan_bucket_started_payload_type;
264 /*End EVENT_WLAN_EXTSCAN_BUCKET_STARTED*/
265 
266 /*EVENT_WLAN_EXTSCAN_BUCKET_COMPLETED*/
267 typedef struct {
268     u8 bucket_id;
269 } __attribute__((packed))  wlan_ext_scan_bucket_completed_payload_type;
270 /*End EVENT_WLAN_EXTSCAN_BUCKET_COMPLETED*/
271 
272 /*EVENT_WLAN_ROAM_SCAN_STARTED*/
273 typedef struct {
274     u32 scan_id;
275     u32 roam_scan_flags;
276     u32 cur_rssi;
277     u16 scan_params[18];
278     u16 scan_channels[40]; // first 40 channels only
279 } __attribute__((packed)) wlan_roam_scan_started_payload_type;
280 /*End EVENT_WLAN_ROAM_SCAN_STARTED*/
281 
282 /*EVENT_WLAN_ROAM_SCAN_COMPLETE*/
283 typedef struct {
284     u32 scan_id;
285     u32 reason;
286     u32 completion_flags;
287     u32 num_candidate;
288     u32 flags;
289 } __attribute__((packed)) wlan_roam_scan_complete_payload_type;
290 /*End EVENT_WLAN_ROAM_SCAN_COMPLETE*/
291 
292 /*EVENT_WLAN_ROAM_CANDIDATE_FOUND*/
293 typedef struct {
294     u8 channel;
295     u8 rssi;
296     u8 bssid[6];
297     u8 ssid[33];
298     u8 auth_mode;
299     u8 ucast_cipher;
300     u8 mcast_cipher;
301 } __attribute__((packed)) wlan_roam_candidate_found_payload_type;
302 /*End EVENT_WLAN_ROAM_CANDIDATE_FOUND*/
303 
304 /*EVENT_WLAN_ROAM_SCAN_CONFIG*/
305 typedef struct {
306     u32 flags;
307     u32 roam_scan_config[8];
308 } __attribute__((packed)) wlan_roam_scan_config_payload_type;
309 /*End EVENT_WLAN_ROAM_SCAN_CONFIG*/
310 
311 /* EVENT_WLAN_BT_COEX_BT_SCO_START */
312 typedef struct {
313     u8 link_id;
314     u8 link_state;
315     u8 link_role;
316     u8 link_type;
317     u16 Tsco;
318     u8 Rsco;
319 } __attribute__((packed)) wlan_bt_coex_bt_sco_start_payload_type;
320 /* End EVENT_WLAN_BT_COEX_BT_SCO_START */
321 
322 /* EVENT_WLAN_BT_COEX_BT_SCO_STOP */
323 typedef struct {
324     u8 link_id;
325     u8 link_state;
326     u8 link_role;
327     u8 link_type;
328     u16 Tsco;
329     u8 Rsco;
330 } __attribute__((packed)) wlan_bt_coex_bt_sco_stop_payload_type;
331 /* End EVENT_WLAN_BT_COEX_BT_SCO_STOP */
332 
333 /* EVENT_WLAN_BT_COEX_BT_SCAN_START */
334 typedef struct {
335     u8 scan_type;
336     u8 scan_bitmap;
337 } __attribute__((packed)) wlan_bt_coex_bt_scan_start_payload_type;
338 
339 /* End EVENT_WLAN_BT_COEX_BT_SCAN_START */
340 
341 /* EVENT_WLAN_BT_COEX_BT_SCAN_STOP */
342 typedef struct {
343     u8 scan_type;
344     u8 scan_bitmap;
345 } __attribute__((packed)) wlan_bt_coex_bt_scan_stop_payload_type;
346 /* End EVENT_WLAN_BT_COEX_BT_SCAN_STOP */
347 
348 /* EVENT_WIFI_BT_COEX_BT_HID_START */
349 typedef struct {
350     u8 link_id;
351     u8 link_state;
352     u8 link_role;
353     u8 Tsniff;
354     u8 attempts;
355 } __attribute__((packed)) wlan_bt_coex_bt_hid_start_payload_type;
356 /* End EVENT_WIFI_BT_COEX_BT_HID_START */
357 
358 /* EVENT_WIFI_BT_COEX_BT_HID_STOP */
359 typedef struct {
360     u8 link_id;
361     u8 link_state;
362     u8 link_role;
363     u8 Tsniff;
364     u8 attempts;
365 } __attribute__((packed)) wlan_bt_coex_bt_hid_stop_payload_type;
366 /* End EVENT_WIFI_BT_COEX_BT_HID_STOP */
367 
368 /* EVENT_WLAN_EXTSCAN_FEATURE_STOP */
369 typedef struct {
370     u32 request_id;
371 } __attribute__((packed)) wlan_ext_scan_feature_stop_payload_type;
372 /* End EVENT_WLAN_EXTSCAN_FEATURE_STOP */
373 
374 /* EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE */
375 typedef struct {
376     u32 request_id;
377     u32 table_type;
378     u32 entries_in_use;
379     u32 maximum_entries;
380     u32 scan_count_after_getResults;
381     u8 threshold_num_scans;
382 } __attribute__((packed)) wlan_ext_scan_results_available_payload_type;
383 /* End EVENT_WLAN_EXTSCAN_RESULTS_AVAILABLE */
384 
385 /* Log LOG_WLAN_EXTSCAN_CAPABILITIES */
386 typedef struct {
387     u32 header;
388     u32 request_id;
389     u32 requestor_id;
390     u32 vdev_id;
391     u32 num_extscan_cache_tables;
392     u32 num_wlan_change_monitor_tables;
393     u32 num_hotlist_monitor_tables;
394     u32 rtt_one_sided_supported;
395     u32 rtt_11v_supported;
396     u32 rtt_ftm_supported;
397     u32 num_extscan_cache_capabilities;
398     u32 num_extscan_wlan_change_capabilities;
399     u32 num_extscan_hotlist_capabilities;
400     u32 num_roam_ssid_whitelist;
401     u32 num_roam_bssid_blacklist;
402     u32 num_roam_bssid_preferred_list;
403     u32 num_extscan_hotlist_ssid;
404     u32 num_epno_networks;
405 } __attribute__((packed)) wlan_extscan_capabilities_event_fixed_param;
406 
407 typedef struct {
408     u32 header;
409     u32 table_id;
410     u32 scan_cache_entry_size;
411     u32 max_scan_cache_entries;
412     u32 max_buckets;
413     u32 max_bssid_per_scan;
414     u32 max_table_usage_threshold;
415 } __attribute__((packed)) wlan_extscan_cache_capabilities;
416 
417 typedef struct {
418     u32 tlv_header;
419     u32 table_id;
420     u32 wlan_hotlist_entry_size;
421     u32 max_hotlist_entries;
422 } __attribute__((packed)) wlan_extscan_hotlist_monitor_capabilities;
423 
424 typedef struct {
425     u32 request_id;
426     wlan_extscan_capabilities_event_fixed_param extscan_capabilities;
427     wlan_extscan_cache_capabilities extscan_cache_capabilities;
428     wlan_extscan_hotlist_monitor_capabilities extscan_hotlist_monitor_capabilities;
429 } __attribute__((packed)) wlan_ext_scan_capabilities_payload_type;
430 /* End LOG_WLAN_EXTSCAN_CAPABILITIES */
431 
432 /* EVENT_WLAN_BEACON_RECEIVED */
433 typedef struct {
434     u8 bssid[6];
435     u32 beacon_rssi;
436 } __attribute__((packed)) wlan_beacon_received_payload_type;
437 /* End EVENT_WLAN_BEACON_RECEIVED */
438 
439 typedef struct {
440     u8 ucBaPeerMac[6];
441     u8 ucBaTid;
442     u8 ucBaBufferSize;
443     u16 ucBaSSN;
444     u8 fInitiator;
445 } __attribute__((packed)) wlan_add_block_ack_success_payload_type;
446 
447 /* EVENT_WLAN_ADD_BLOCK_ACK_FAILED */
448 typedef struct {
449     u8 ucBaPeerMac[6];
450     u8 ucBaTid;
451     u8 ucReasonCode;
452     u8 fInitiator;
453 } __attribute__((packed)) wlan_add_block_ack_failed_payload_type;
454 
455 typedef enum
456 {
457     WIFI_EVENT_MEMORY_FAILURE,
458 } resource_failure_type;
459 
460 typedef struct wlan_low_resource_failure_event
461 {
462     resource_failure_type event_sub_type;
463 } __attribute__((packed)) wlan_low_resource_failure_event_t;
464 
465 #endif /* WIFILOGGER_EVENT_DEFS_H */
466