1 /*
2  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #if !defined(__HOST_DIAG_CORE_EVENT_H)
21 #define __HOST_DIAG_CORE_EVENT_H
22 
23 /**=========================================================================
24 
25    \file  host_diag_core_event.h
26 
27    \brief WLAN UTIL host DIAG Events
28 
29    Definitions for DIAG Events
30 
31    ========================================================================*/
32 
33 /* $Header$ */
34 
35 /*--------------------------------------------------------------------------
36    Include Files
37    ------------------------------------------------------------------------*/
38 #include "qdf_types.h"
39 #include "i_host_diag_core_event.h"
40 
41 /*--------------------------------------------------------------------------
42    Preprocessor definitions and constants
43    ------------------------------------------------------------------------*/
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47 
48 #define WAKE_LOCK_NAME_LEN 80
49 #define RSN_OUI_SIZE 4
50 
51 /**
52  * enum wifi_frm_type: type of frame
53  *
54  * @MGMT: Indicates management frames
55  * @CTRL: Indicates control frames
56  * @DATA: Inidcates data frames
57  */
58 enum wifi_frm_type {
59 	MGMT = 0x00,
60 	CTRL = 0x01,
61 	DATA = 0x02,
62 };
63 
64 /*
65  * enum mgmt_frm_subtype: sub types of mgmt frames
66  *
67  * @ASSOC_REQ:       association request frame
68  * @ASSOC_RESP:      association response frame
69  * @REASSOC_REQ:     reassociation request frame
70  * @REASSOC_RESP:    reassociation response frame
71  * @PROBE_REQ:       probe request frame
72  * @PROBE_RESP:      probe response frame
73  * @BEACON:          beacon frame
74  * @ATIM:            ATIM frame
75  * @DISASSOC:        disassociation frame
76  * @AUTH:            authentication frame
77  * @DEAUTH:          deauthentication frame
78  * @ACTION:          action frame
79  * @ACTION_NO_ACK:   action no ack frame
80  */
81 enum mgmt_frm_subtype {
82 	ASSOC_REQ = 0x00,
83 	ASSOC_RESP = 0x01,
84 	REASSOC_REQ = 0x02,
85 	REASSOC_RESP = 0x03,
86 	PROBE_REQ = 0x04,
87 	PROBE_RESP = 0x05,
88 	BEACON = 0x08,
89 	ATIM = 0x09,
90 	DISASSOC = 0x0a,
91 	AUTH = 0x0b,
92 	DEAUTH = 0x0c,
93 	ACTION = 0x0d,
94 	ACTION_NO_ACK = 0x0e,
95 };
96 
97 /**
98  * enum mgmt_auth_type: type of authentication
99  *
100  * @AUTH_OPEN: no security applied
101  * @AUTH_SHARED: WEP type of auth
102  * @AUTH_WPA_EAP: WPA1 EAP based auth
103  * @AUTH_WPA_PSK: WPA1 PSK based auth
104  * @AUTH_WPA2_EAP: WPA2 EAP based auth
105  * @AUTH_WPA2_PSK: WPA2 PSK based auth
106  * @AUTH_WAPI_CERT: WAPI CERT based auth
107  * @AUTH_WAPI_PSK: WAPI PSK based auth
108  * @AUTH_MAX: max enumeration
109  */
110 enum mgmt_auth_type {
111 	AUTH_OPEN = 0x00,
112 	AUTH_SHARED = 0x01,
113 	AUTH_WPA_EAP = 0x02,
114 	AUTH_WPA_PSK = 0x03,
115 	AUTH_WPA2_EAP = 0x04,
116 	AUTH_WPA2_PSK = 0x05,
117 	AUTH_WAPI_CERT = 0x06,
118 	AUTH_WAPI_PSK = 0x07,
119 	AUTH_MAX = 0xff,
120 };
121 
122 /**
123  * enum mgmt_encrypt_type: type of encryption
124  *
125  * @ENC_MODE_OPEN: no encryption applied
126  * @ENC_MODE_WEP40: WEP 40 bits encryption
127  * @ENC_MODE_WEP104: WEP 104 bits encryption
128  * @ENC_MODE_TKIP: TKIP based encryption
129  * @ENC_MODE_AES: AES based encryption
130  * @ENC_MODE_AES_GCMP: AES with GCMP encryption
131  * @ENC_MODE_AES_GCMP_256: AES with 256 bit GCMP encryption
132  * @ENC_MODE_SMS4: WAPI based SMS4 encryption
133  * @ENC_MODE_MAX: max enumeration
134  */
135 enum mgmt_encrypt_type {
136 	ENC_MODE_OPEN = 0x00,
137 	ENC_MODE_WEP40 = 0x01,
138 	ENC_MODE_WEP104 = 0x02,
139 	ENC_MODE_TKIP = 0x03,
140 	ENC_MODE_AES = 0x04,
141 	ENC_MODE_AES_GCMP = 0x05,
142 	ENC_MODE_AES_GCMP_256 = 0x06,
143 	ENC_MODE_SMS4 = 0x07,
144 	ENC_MODE_MAX = 0x0f,
145 };
146 
147 /**
148  * enum mgmt_ch_width: channel width of connection
149  *
150  * @BW_20MHZ: 20 MHz of channel bonding
151  * @BW_40MHZ: 40 MHz of channel bonding
152  * @BW_80MHZ: 80 MHz of channel bonding
153  * @BW_160MHZ: 160 MHz of channel bonding
154  * @BW_80P80MHZ: 80 + 80 MHz of channel bonding
155  * @BW_5MHZ: 5 MHz of channel bonding
156  * @BW_10MHZ: 10 MHz of channel bonding
157  * @BW_320MHZ: 320 MHz of channel bonding
158  * @BW_MAX: max enumeration
159  */
160 enum mgmt_ch_width {
161 	BW_20MHZ = 0x00,
162 	BW_40MHZ = 0x01,
163 	BW_80MHZ = 0x02,
164 	BW_160MHZ = 0x03,
165 	BW_80P80MHZ = 0x04,
166 	BW_5MHZ = 0x05,
167 	BW_10MHZ = 0x06,
168 	BW_320MHZ = 0x07,
169 	BW_MAX = 0xff,
170 };
171 
172 /**
173  * enum mgmt_dot11_mode: 80211 mode of operation
174  *
175  * @DOT11_MODE_ABG: 802.11-ABG mix mode
176  * @DOT11_MODE_11A: 802.11-A mode
177  * @DOT11_MODE_11B: 802.11-B mode
178  * @DOT11_MODE_11G: 802.11-G mode
179  * @DOT11_MODE_11N: 802.11-N mode
180  * @DOT11_MODE_11AC: 802.11-AC mode
181  * @DOT11_MODE_11G_ONLY: 802.11-G only mode
182  * @DOT11_MODE_11N_ONLY: 802.11-N only mode
183  * @DOT11_MODE_11AC_ONLY: 802.11-AC only mode
184  * @DOT11_MODE_AUTO: 802.11 auto mode
185  * @DOT11_MODE_11AX: 802.11-AX mode
186  * @DOT11_MODE_11AX_ONLY: 802.11-AX only mode
187  * @DOT11_MODE_11BE: 802.11-BE mode
188  * @DOT11_MODE_11BE_ONLY: 802.11-BE only mode
189  * @DOT11_MODE_MAX: max enumeration
190  */
191 enum mgmt_dot11_mode {
192 	DOT11_MODE_ABG = 0x00,
193 	DOT11_MODE_11A = 0x01,
194 	DOT11_MODE_11B = 0x02,
195 	DOT11_MODE_11G = 0x03,
196 	DOT11_MODE_11N = 0x04,
197 	DOT11_MODE_11AC = 0x05,
198 	DOT11_MODE_11G_ONLY = 0x06,
199 	DOT11_MODE_11N_ONLY = 0x07,
200 	DOT11_MODE_11AC_ONLY = 0x08,
201 	DOT11_MODE_AUTO = 0x09,
202 	DOT11_MODE_11AX = 0x0a,
203 	DOT11_MODE_11AX_ONLY = 0x0b,
204 	DOT11_MODE_11BE = 0x0c,
205 	DOT11_MODE_11BE_ONLY = 0x0d,
206 	DOT11_MODE_MAX = 0xff,
207 };
208 
209 /**
210  * enum mgmt_bss_type: persona type
211  *
212  * @STA_PERSONA: STA mode
213  * @SAP_PERSONA: SAP mode
214  * @P2P_CLIENT_PERSONA: P2P cli mode
215  * @P2P_GO_PERSONA: P2P go mode
216  * @FTM_PERSONA: FTM mode
217  * @IBSS_PERSONA: IBSS mode
218  * @MONITOR_PERSONA: monitor mode
219  * @P2P_DEVICE_PERSONA: P2P device mode
220  * @OCB_PERSONA: OCB mode
221  * @EPPING_PERSONA: epping mode
222  * @QVIT_PERSONA: QVIT mode
223  * @NDI_PERSONA: NDI mode
224  * @WDS_PERSONA: WDS mode
225  * @BTAMP_PERSONA: BT amp mode
226  * @AHDEMO_PERSONA: AH demo mode
227  * @MAX_PERSONA: max enumeration
228  */
229 enum mgmt_bss_type {
230 	STA_PERSONA = 0x00,
231 	SAP_PERSONA = 0x01,
232 	P2P_CLIENT_PERSONA = 0x02,
233 	P2P_GO_PERSONA = 0x03,
234 	FTM_PERSONA = 0x04,
235 	IBSS_PERSONA = 0x05,
236 	MONITOR_PERSONA = 0x06,
237 	P2P_DEVICE_PERSONA = 0x07,
238 	OCB_PERSONA = 0x08,
239 	EPPING_PERSONA = 0x09,
240 	QVIT_PERSONA = 0x0a,
241 	NDI_PERSONA = 0x0b,
242 	WDS_PERSONA = 0x0c,
243 	BTAMP_PERSONA = 0x0d,
244 	AHDEMO_PERSONA = 0x0e,
245 	MAX_PERSONA = 0xff,
246 };
247 
248 /**
249  * enum wlan_bringup_status: driver/device status
250  *
251  * @WLAN_STATUS_DISABLED: WLAN Disabled
252  * @WLAN_STATUS_ENABLED: WLAN Enabled
253  * @WLAN_STATUS_RESET_FAIL: Reset Fail
254  * @WLAN_STATUS_RESET_SUCCESS: Reset Success
255  * @WLAN_STATUS_DEVICE_REMOVED: Device Removed
256  * @WLAN_STATUS_DEVICE_INSERTED: Device Inserted
257  * @WLAN_STATUS_DRIVER_UNLOADED: Driver Unloaded
258  * @WLAN_STATUS_DRIVER_LOADED: Driver Loaded
259  * @WLAN_STATUS_BUS_EXCEPTION: bus/link exception
260  * @WLAN_STATUS_DEVICE_TEMPERATURE_HIGH: chip temperature high
261  * @WLAN_STATUS_MAX: max enumeration
262  */
263 enum wlan_bringup_status {
264 	WLAN_STATUS_DISABLED = 0,
265 	WLAN_STATUS_ENABLED = 1,
266 	WLAN_STATUS_RESET_FAIL = 2,
267 	WLAN_STATUS_RESET_SUCCESS = 3,
268 	WLAN_STATUS_DEVICE_REMOVED = 4,
269 	WLAN_STATUS_DEVICE_INSERTED = 5,
270 	WLAN_STATUS_DRIVER_UNLOADED = 6,
271 	WLAN_STATUS_DRIVER_LOADED = 7,
272 	WLAN_STATUS_BUS_EXCEPTION = 8,
273 	WLAN_STATUS_DEVICE_TEMPERATURE_HIGH = 9,
274 
275 	WLAN_STATUS_MAX = 0xffff,
276 };
277 
278 /*-------------------------------------------------------------------------
279    Event ID: EVENT_WLAN_SECURITY
280    ------------------------------------------------------------------------*/
281 typedef struct {
282 	uint8_t eventId;
283 	uint8_t authMode;
284 	uint8_t encryptionModeUnicast;
285 	uint8_t encryptionModeMulticast;
286 	uint8_t pmkIDMatch;
287 	uint8_t bssid[6];
288 	uint8_t keyId;
289 	uint8_t status;
290 } host_event_wlan_security_payload_type;
291 
292 /*-------------------------------------------------------------------------
293    Event ID: EVENT_WLAN_STATUS_V2
294    ------------------------------------------------------------------------*/
295 typedef struct {
296 	uint8_t eventId;
297 	uint8_t ssid[32];
298 	uint8_t bssType;
299 	uint8_t rssi;
300 	uint8_t channel;
301 	uint8_t qosCapability;
302 	uint8_t authType;
303 	uint8_t encryptionType;
304 	uint8_t reason;
305 	uint8_t reasonDisconnect;
306 } host_event_wlan_status_payload_type;
307 
308 /*-------------------------------------------------------------------------
309    Event ID: EVENT_WLAN_HANDOFF
310    ------------------------------------------------------------------------*/
311 typedef struct {
312 	uint8_t eventId;
313 	uint8_t currentApBssid[6];
314 	uint8_t currentApRssi;
315 	uint8_t candidateApBssid[6];
316 	uint8_t candidateApRssi;
317 } host_event_wlan_handoff_payload_type;
318 
319 /*-------------------------------------------------------------------------
320    Event ID: EVENT_WLAN_VCC
321    ------------------------------------------------------------------------*/
322 typedef struct {
323 	uint8_t eventId;
324 	uint8_t rssi;
325 	uint8_t txPer;
326 	uint8_t rxPer;
327 	int linkQuality;
328 } host_event_wlan_vcc_payload_type;
329 
330 /*-------------------------------------------------------------------------
331    Event ID: EVENT_WLAN_QOS
332    ------------------------------------------------------------------------*/
333 typedef struct {
334 	uint8_t eventId;
335 	uint8_t reasonCode;
336 } host_event_wlan_qos_payload_type;
337 
338 /**
339  * struct host_event_wlan_connection_stats - to capture connection details
340  * @rssi: RSSI signal strength of connected AP, units in dbM
341  * @ssid_len: length of SSID
342  * @ssid: SSID of AP where STA is connected
343  * @bssid: bssid of AP where STA is connected
344  * @operating_channel: channel on which AP is connected
345  * @qos_capability: QoS is enabled or no
346  * @chnl_bw: channel BW of connection, units in MHz
347  *		Range: enum mgmt_ch_width
348  * @dot11mode: 802.11 mode of current connection
349  *		Range: enum mgmt_dot11_mode
350  * @bss_type: type of the BSS whether AP/IBSS/P2PGO
351  *		Range: enum mgmt_bss_type bss_type
352  * @auth_type: type of authentication for connected AP
353  *		Range: enum mgmt_auth_type
354  * @encryption_type: type of encryption applied
355  *		Range: enum mgmt_encrypt_type
356  * @reserved1: reserved for future use
357  * @est_link_speed: link speed of connection, units in Mbps
358  * @result_code: result code of connection success or failure
359  * @reason_code: if failed then what is the reason
360  * @op_freq: channel frequency in MHz on which AP is connected
361  */
362 struct host_event_wlan_connection_stats {
363 	int8_t rssi;
364 	uint8_t ssid_len;
365 	char ssid[32];
366 	uint8_t bssid[6];
367 	uint8_t operating_channel;
368 	uint8_t qos_capability;
369 	uint8_t chnl_bw;
370 	uint8_t dot11mode;
371 	uint8_t bss_type;
372 	uint8_t auth_type;
373 	uint8_t encryption_type;
374 	uint8_t reserved1;
375 	uint32_t est_link_speed;
376 	uint16_t result_code;
377 	uint16_t reason_code;
378 	uint32_t op_freq;
379 } qdf_packed;
380 
381 /*-------------------------------------------------------------------------
382    Event ID: EVENT_WLAN_PE
383    ------------------------------------------------------------------------*/
384 typedef struct {
385 	char bssid[6];
386 	uint16_t event_type;
387 	uint16_t sme_state;
388 	uint16_t mlm_state;
389 	uint16_t status;
390 	uint16_t reason_code;
391 } host_event_wlan_pe_payload_type;
392 
393 /**
394  * struct host_event_wlan_mgmt_payload_type - To capture TX/RX mgmt frame
395  *                                            payload
396  * @mgmt_type: type of frames, value: enum wifi_frm_type
397  * @mgmt_subtype: subtype of mgmt frame, value: enum mgmt_frm_subtype
398  * @operating_channel: operating channel of AP
399  * @ssid_len: length of SSID, max 32 bytes long as per standard
400  * @ssid: SSID of connected AP
401  * @self_mac_addr: mac address of self interface
402  * @bssid: BSSID for which frame is received
403  * @result_code: result code TX/RX OTA delivery
404  * @reason_code: reason code given in TX/RX frame
405  */
406 struct host_event_wlan_mgmt_payload_type {
407 	uint8_t mgmt_type;
408 	uint8_t mgmt_subtype;
409 	uint8_t operating_channel;
410 	uint8_t ssid_len;
411 	char ssid[32];
412 	char self_mac_addr[6];
413 	char bssid[6];
414 	uint16_t result_code;
415 	uint16_t reason_code;
416 } qdf_packed;
417 
418 /*-------------------------------------------------------------------------
419    Event ID: EVENT_WLAN_ADD_BLOCK_ACK_SUCCESS
420    ------------------------------------------------------------------------*/
421 typedef struct {
422 	char ucBaPeerMac[6];
423 	uint8_t ucBaTid;
424 	uint8_t ucBaBufferSize;
425 	uint16_t usBaSSN;
426 	uint8_t fInitiator;
427 } host_event_wlan_add_block_ack_success_payload_type;
428 
429 /*-------------------------------------------------------------------------
430    Event ID: EVENT_WLAN_ADD_BLOCK_ACK_FAILED
431    ------------------------------------------------------------------------*/
432 typedef struct {
433 	char ucBaPeerMac[6];
434 	uint8_t ucBaTid;
435 	uint8_t ucReasonCode;
436 	uint8_t fInitiator;
437 } host_event_wlan_add_block_ack_failed_payload_type;
438 
439 /*-------------------------------------------------------------------------
440    Event ID: EVENT_WLAN_DELETE_BLOCK_ACK_SUCCESS
441    ------------------------------------------------------------------------*/
442 typedef struct {
443 	char ucBaPeerMac[6];
444 	uint8_t ucBaTid;
445 	uint8_t ucDeleteReasonCode;
446 } host_event_wlan_add_block_ack_deleted_payload_type;
447 
448 /*-------------------------------------------------------------------------
449    Event ID: EVENT_WLAN_DELETE_BLOCK_ACK_FAILED
450    ------------------------------------------------------------------------*/
451 typedef struct {
452 	char ucBaPeerMac[6];
453 	uint8_t ucBaTid;
454 	uint8_t ucDeleteReasonCode;
455 	uint8_t ucFailReasonCode;
456 } host_event_wlan_add_block_ack_delete_failed_payload_type;
457 
458 /*-------------------------------------------------------------------------
459    Event ID: EVENT_WLAN_BSS_PROTECTION
460    ------------------------------------------------------------------------*/
461 typedef struct {
462 	uint8_t event_type;
463 	uint8_t prot_type;
464 } host_event_wlan_bss_prot_payload_type;
465 
466 /*-------------------------------------------------------------------------
467    Event ID: EVENT_WLAN_BRINGUP_STATUS
468    ------------------------------------------------------------------------*/
469 /**
470  * struct host_event_wlan_bringup_status_payload_type - Structure holding the
471  * device/driver status info
472  *
473  * @wlan_status: status code as defined by enum wlan_bringup_status
474  * @driver_version: version of WLAN driver
475  *
476  * This structure will hold WLAN device basic status and driver version
477  */
478 typedef struct {
479 	uint16_t wlan_status;
480 	char driver_version[10];
481 } host_event_wlan_bringup_status_payload_type;
482 
483 /*-------------------------------------------------------------------------
484    Event ID: EVENT_WLAN_POWERSAVE_WOW
485    ------------------------------------------------------------------------*/
486 typedef struct {
487 	uint8_t event_subtype;
488 	uint8_t wow_type;
489 	uint8_t wow_magic_pattern[6];
490 	uint8_t wow_del_ptrn_id;
491 	uint8_t wow_wakeup_cause;
492 	uint8_t wow_wakeup_cause_pbm_ptrn_id;
493 } host_event_wlan_powersave_wow_payload_type;
494 
495 /*-------------------------------------------------------------------------
496   Event ID: EVENT_WLAN_POWERSAVE_WOW_STATS
497   ------------------------------------------------------------------------*/
498 /**
499  * struct host_event_wlan_powersave_wow_stats - Structure holding wow stats
500  *                                              information
501  * @wow_ucast_wake_up_count: wow unicast packet wakeup count
502  * @wow_bcast_wake_up_count: wow broadcast packet wakeup count
503  * @wow_ipv4_mcast_wake_up_count: wow ipv4 multicast packet wakeup count
504  * @wow_ipv6_mcast_wake_up_count: wow ipv6 multicast packet wakeup count
505  * @wow_ipv6_mcast_ra_stats: wow ipv6 multicast router advertisement
506  *                           packet wakeup count
507  * @wow_ipv6_mcast_ns_stats: wow ipv6 multicast Neighbor Solicitation
508  *                           packet wakeup count
509  * @wow_ipv6_mcast_na_stats: wow ipv6 multicast address space
510  *                           packet wakeup count
511  * @wow_pno_match_wake_up_count: wow preferred network offload match
512  *                           packet wakeup count
513  * @wow_pno_complete_wake_up_count: wow preferred network offload complete
514  *                                  packet wakeup count
515  * @wow_gscan_wake_up_count: wow external scan packet wakeup count
516  * @wow_low_rssi_wake_up_count: wow low rssi packet wakeup count
517  * @wow_rssi_breach_wake_up_count: wow rssi breach packet wakeup count
518  * @wow_icmpv4_count: wow icmpv4 packet count
519  * @wow_icmpv6_count: wow icmpv6 packet count
520  * @wow_oem_response_wake_up_count: wow  oem response packet wakeup count
521  * @Reserved_1: reserved for future use
522  * @Reserved_2: reserved for future use
523  * @Reserved_3: reserved for future use
524  * @Reserved_4: reserved for future use
525  *
526  * This structure contains the wow stats information related to diag event
527  */
528 struct host_event_wlan_powersave_wow_stats {
529 	uint32_t    wow_ucast_wake_up_count;
530 	uint32_t    wow_bcast_wake_up_count;
531 	uint32_t    wow_ipv4_mcast_wake_up_count;
532 	uint32_t    wow_ipv6_mcast_wake_up_count;
533 	uint32_t    wow_ipv6_mcast_ra_stats;
534 	uint32_t    wow_ipv6_mcast_ns_stats;
535 	uint32_t    wow_ipv6_mcast_na_stats;
536 	uint32_t    wow_pno_match_wake_up_count;
537 	uint32_t    wow_pno_complete_wake_up_count;
538 	uint32_t    wow_gscan_wake_up_count;
539 	uint32_t    wow_low_rssi_wake_up_count;
540 	uint32_t    wow_rssi_breach_wake_up_count;
541 	uint32_t    wow_icmpv4_count;
542 	uint32_t    wow_icmpv6_count;
543 	uint32_t    wow_oem_response_wake_up_count;
544 	uint32_t    Reserved_1;
545 	uint32_t    Reserved_2;
546 	uint32_t    Reserved_3;
547 	uint32_t    Reserved_4;
548 };
549 
550 /*-------------------------------------------------------------------------
551    Event ID: EVENT_WLAN_BTC
552    ------------------------------------------------------------------------*/
553 typedef struct {
554 	uint8_t eventId;
555 	uint8_t btAddr[6];
556 	uint16_t connHandle;
557 	uint8_t connStatus;
558 	uint8_t linkType;
559 	uint8_t scoInterval;
560 	uint8_t scoWindow;
561 	uint8_t retransWindow;
562 	uint8_t mode;
563 } host_event_wlan_btc_type;
564 
565 /*-------------------------------------------------------------------------
566   Event ID: EVENT_WLAN_EAPOL
567   ------------------------------------------------------------------------*/
568 /**
569  * struct host_event_wlan_eapol - Structure holding the eapol information
570  * @event_sub_type:	0-Transmitted, 1-Received
571  * @eapol_packet_type:	0 - EAP Start, 1 - EAPOL Start, 2 - EAPOL Logoff
572  *			3 - EAPOL Key, 4 - EAPOL Encapsulated Alert
573  * @eapol_key_info:	This field from the driver is in big endian format.
574  *			So, the masks .0x8013. can be used to extract the
575  *			message type. After masking, the values corresponding
576  *			to messages 1/2/3/4 are given below:
577  *			Msg. 1	0x8000
578  *			Msg. 2	0x0001
579  *			Msg. 3	0x8013
580  *			Msg. 4	0x0003
581  * @eapol_rate:		Rate at which the frame is received
582  * @dest_addr:		Destination address
583  * @src_addr:		Source address
584  *
585  * This structure contains the EAPOL information related to logging
586  */
587 struct host_event_wlan_eapol {
588 	uint8_t   event_sub_type;
589 	uint8_t   eapol_packet_type;
590 	uint16_t  eapol_key_info;
591 	uint16_t  eapol_rate;
592 	uint8_t   dest_addr[6];
593 	uint8_t   src_addr[6];
594 };
595 
596 /*-------------------------------------------------------------------------
597   Event ID: EVENT_WLAN_LOW_RESOURCE_FAILURE
598   ------------------------------------------------------------------------*/
599 /**
600  * struct host_event_wlan_low_resource_failure - Structure holding the
601  * low resource failure information
602  * @event_sub_type: Gives further information about reason for
603  * low resource condition
604  *
605  * This structure will hold the low resource failure information
606  */
607 struct host_event_wlan_low_resource_failure {
608 	uint8_t event_sub_type;
609 };
610 
611 /**
612  * enum resource_failure_type - Reason for low resource failure condition
613  * @WIFI_EVENT_MEMORY_FAILURE: Memory failure
614  *
615  * This enum has the reason codes why the low resource situation is observed
616  */
617 enum resource_failure_type {
618 	WIFI_EVENT_MEMORY_FAILURE,
619 };
620 
621 /*-------------------------------------------------------------------------
622   Event ID: EVENT_WLAN_RSN_INFO
623   -------------------------------------------------------------------------
624  */
625 /**
626  * struct event_wlan_csr_rsn_info - Structure holding the
627  * RSN information for assoc request
628  * @akm_suite: Gives information about akm suites used in assoc request
629  * @ucast_cipher: Unicast cipher used in assoc request
630  * @mcast_cipher: Multi cast cipher used in assoc request
631  * @group_mgmt: Requested group mgmt cipher suite
632  *
633  * This structure will hold the RSN information for assoc request
634  */
635 struct event_wlan_csr_rsn_info {
636 	uint8_t   akm_suite[RSN_OUI_SIZE];
637 	uint8_t   ucast_cipher[RSN_OUI_SIZE];
638 	uint8_t   mcast_cipher[RSN_OUI_SIZE];
639 	uint8_t   group_mgmt[RSN_OUI_SIZE];
640 };
641 
642 /*-------------------------------------------------------------------------
643   Event ID: EVENT_WLAN_AUTH_INFO
644   -------------------------------------------------------------------------
645  */
646 /**
647  * struct event_wlan_lim_auth_info - Structure holding the
648  * algo num, seq num and status code for auth request
649  * @auth_algo_num: Gives information about algo num used in auth request
650  * @auth_transaction_seq_num: seq num of auth request
651  * @auth_status_code: status code of auth request
652  *
653  * This structure will hold the algo num, seq num and status code
654  * for auth request
655  */
656 struct event_wlan_lim_auth_info {
657 	uint16_t   auth_algo_num;
658 	uint16_t   auth_transaction_seq_num;
659 	uint16_t   auth_status_code;
660 };
661 
662 /*-------------------------------------------------------------------------
663   Event ID: EVENT_WLAN_WAKE_LOCK
664   ------------------------------------------------------------------------*/
665 /**
666  * struct host_event_wlan_wake_lock - Structure holding the wakelock information
667  * @status: Whether the wakelock is taken/released
668  * @reason: Reason for taking this wakelock
669  * @timeout: Timeout value in case of timed wakelocks
670  * @name_len: Length of the name of the wakelock that will follow
671  * @name: Name of the wakelock
672  *
673  * This structure will hold the wakelock information
674  */
675 struct host_event_wlan_wake_lock {
676 	uint32_t status;
677 	uint32_t reason;
678 	uint32_t timeout;
679 	uint32_t name_len;
680 	char     name[WAKE_LOCK_NAME_LEN];
681 };
682 
683 /*-------------------------------------------------------------------------
684   Event ID: EVENT_WLAN_LOG_COMPLETE
685   ------------------------------------------------------------------------*/
686 /**
687  * struct host_event_wlan_log_complete - Holds log completion details
688  * @is_fatal: Indicates if the event is fatal or not
689  * @indicator: Source of the bug report - Framework/Host/Firmware
690  * @reason_code: Reason for triggering bug report
691  * @reserved: Reserved field
692  *
693  * This structure holds the log completion related information
694  */
695 struct host_event_wlan_log_complete {
696 	uint32_t is_fatal;
697 	uint32_t indicator;
698 	uint32_t reason_code;
699 	uint32_t reserved;
700 };
701 
702 /*-------------------------------------------------------------------------
703   Event ID: EVENT_WLAN_STA_KICKOUT
704   ------------------------------------------------------------------------*/
705 /**
706  * struct host_event_wlan_kickout - Holds diag event details
707  * @reasoncode: Indicates the reasoncode of event
708  * @peer_mac: Indicates the peer macaddr
709  * @vdev_id: Indicate unique id for identifying the VDEV
710  *
711  * This structure holds the diag event related information
712  */
713 
714 struct host_event_wlan_kickout {
715 	uint32_t reasoncode;
716 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
717 	uint8_t vdev_id;
718 };
719 
720 /*-------------------------------------------------------------------------
721   Event ID: EVENT_WLAN_SOFTAP_DATASTALL/EVENT_WLAN_STA_DATASTALL
722   ------------------------------------------------------------------------*/
723 /**
724  * struct host_event_wlan_datastall - Holds diag event details
725  * @reason: Indicates the reason of event
726  *
727  * This structure holds the host diag event related information
728  */
729 
730 struct host_event_wlan_datastall {
731 	uint32_t reason;
732 };
733 
734 /*-------------------------------------------------------------------------
735   Event ID: EVENT_WLAN_SSR_REINIT_SUBSYSTEM
736   ------------------------------------------------------------------------*/
737 /**
738  * struct host_event_wlan_ssr_reinit - Holds diag event details
739  * @status: Indicates the status of event
740  *
741  * This structure holds the host diag event related information
742  */
743 
744 struct host_event_wlan_ssr_reinit {
745 	uint32_t status;
746 };
747 
748 /*-------------------------------------------------------------------------
749   Event ID: EVENT_WLAN_SSR_SHUTDOWN_SUBSYSTEM
750   ------------------------------------------------------------------------*/
751 /**
752  * struct host_event_wlan_ssr_shutdown - Holds diag event details
753  * @status: Indicates the status of event
754  *
755  * This structure holds the host diag event related information
756  */
757 
758 struct host_event_wlan_ssr_shutdown {
759 	uint32_t status;
760 };
761 
762 
763 /*-------------------------------------------------------------------------
764    Function declarations and documentation
765    ------------------------------------------------------------------------*/
766 /**
767  * enum host_sta_kickout_events - Enum containing sta kickout subtype
768  * @HOST_STA_KICKOUT_REASON_BMISS: Indicate sta got disconnected reason
769  * beacon miss
770  * @HOST_STA_KICKOUT_REASON_XRETRY: Indicate sta got disconnected reason xretry
771  * @HOST_STA_KICKOUT_REASON_UNSPECIFIED: Indicate sta disconnection
772  * reason unspecified
773  * @HOST_STA_KICKOUT_REASON_KEEP_ALIVE: Indicate sta is disconnected
774  * because of keep alive
775  * @HOST_STA_KICKOUT_REASON_BTM: BTM request from AP with disassoc imminent
776  * reason
777  *
778  * This enum contains the event subtype
779  */
780 enum host_sta_kickout_events {
781 	HOST_STA_KICKOUT_REASON_BMISS,
782 	HOST_STA_KICKOUT_REASON_XRETRY,
783 	HOST_STA_KICKOUT_REASON_UNSPECIFIED,
784 	HOST_STA_KICKOUT_REASON_KEEP_ALIVE,
785 	HOST_STA_KICKOUT_REASON_BTM,
786 };
787 
788 /*-------------------------------------------------------------------------
789    Function declarations and documentation
790    ------------------------------------------------------------------------*/
791 /**
792  * enum host_datastall_events - Enum containing datastall subtype
793  * @DATA_STALL_NONE: Indicate no data stall
794  * @FW_VDEV_PAUSE: Indicate FW vdev Pause
795  * @HWSCHED_CMD_FILTER:Indicate HW sched command filter
796  * @HWSCHED_CMD_FLUSH: Indicate HW sched command flush
797  * @FW_RX_REFILL_FAILED:Indicate FW rx refill failed
798  * @FW_RX_FCS_LEN_ERROR:Indicate FW fcs len error
799  * @FW_WDOG_ERRORS:Indicate watchdog error
800  * @FW_BB_WDOG_ERROR:Indicate BB watchdog error
801  * @STA_TX_TIMEOUT: Indicate sta tx timeout
802  * @SOFTAP_TX_TIMEOUT:Indicate softap tx timeout
803  * @NUD_FAILURE: Indicare NUD Failure
804  *
805  * This enum contains the event subtype
806  */
807 enum host_datastall_events {
808 	DATA_STALL_NONE,
809 	FW_VDEV_PAUSE,
810 	HWSCHED_CMD_FILTER,
811 	HWSCHED_CMD_FLUSH,
812 	FW_RX_REFILL_FAILED,
813 	FW_RX_FCS_LEN_ERROR,
814 	FW_WDOG_ERRORS,
815 	FW_BB_WDOG_ERROR,
816 	STA_TX_TIMEOUT,
817 	SOFTAP_TX_TIMEOUT,
818 	NUD_FAILURE,
819 };
820 
821 /*-------------------------------------------------------------------------
822   Function declarations and documentation
823   ------------------------------------------------------------------------*/
824 /**
825  * enum host_ssr_events - Enum containing ssr subtype
826  * @SSR_SUB_SYSTEM_REINIT: Indicate ssr reinit state
827  * @SSR_SUB_SYSTEM_SHUTDOWN: Indicate ssr shutdown state
828  *
829  * This enum contains the event subtype
830  */
831 enum host_ssr_events {
832 	SSR_SUB_SYSTEM_REINIT,
833 	SSR_SUB_SYSTEM_SHUTDOWN,
834 };
835 
836 /**
837  * struct host_event_tdls_teardown - tdls teardown diag event
838  * @reason: reason for tear down
839  * @peer_mac: peer mac
840  *
841  * This structure contains tdls teardown diag event info
842  */
843 struct host_event_tdls_teardown {
844 	uint32_t reason;
845 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
846 };
847 
848 /**
849  * struct host_event_tdls_enable_link - tdls enable link event
850  * @peer_mac: peer mac
851  * @is_off_chan_supported: if off channel supported
852  * @is_off_chan_configured: if off channel configured
853  * @is_off_chan_established: if off channel established
854  *
855  * This structure contain tdls enable link diag event info
856  */
857 struct host_event_tdls_enable_link {
858 	uint8_t   peer_mac[QDF_MAC_ADDR_SIZE];
859 	uint8_t   is_off_chan_supported;
860 	uint8_t   is_off_chan_configured;
861 	uint8_t   is_off_chan_established;
862 };
863 
864 /**
865  * struct host_event_suspend - suspend/resume state
866  * @state: suspend/resume state
867  *
868  * This structure contains suspend resume diag event info
869  */
870 struct host_event_suspend {
871 	uint8_t state;
872 };
873 
874 /**
875  * struct host_event_offload_req - offload state
876  * @offload_type: offload type
877  * @state: enabled or disabled state
878  *
879  * This structure contains offload diag event info
880  */
881 struct host_event_offload_req {
882 	uint8_t offload_type;
883 	uint8_t state;
884 };
885 
886 /**
887  * struct host_event_tdls_scan_rejected - scan
888  * rejected due to tdls
889  * @status: rejected status
890  *
891  * This structure contains scan rejected due to
892  * tdls event info
893  */
894 struct host_event_tdls_scan_rejected {
895 	uint8_t status;
896 };
897 
898 /**
899  * struct host_event_tdls_tx_rx_mgmt - for TX RX management frame
900  * @event_id: event ID
901  * @tx_rx: tx or rx
902  * @type: type of frame
903  * @action_sub_type: action frame type
904  * @peer_mac: peer mac
905  *
906  * This structure contains tdls TX RX management frame info
907  */
908 struct host_event_tdls_tx_rx_mgmt {
909 	uint8_t event_id;
910 	uint8_t tx_rx;
911 	uint8_t type;
912 	uint8_t action_sub_type;
913 	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
914 };
915 
916 /*-------------------------------------------------------------------------
917    Function declarations and documentation
918    ------------------------------------------------------------------------*/
919 /**
920  * enum wifi_connectivity_events - Enum containing EAPOL sub type
921  * @WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED:	EAPOL transmitted
922  * @WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED:		EAPOL received
923  *
924  * This enum contains the EAPOL subtype
925  */
926 enum wifi_connectivity_events {
927 	WIFI_EVENT_DRIVER_EAPOL_FRAME_TRANSMIT_REQUESTED,
928 	WIFI_EVENT_DRIVER_EAPOL_FRAME_RECEIVED,
929 };
930 
931 /**
932  * enum wake_lock_reason - Reason for taking/releasing wakelock
933  * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT: Driver initialization
934  * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT: Driver re-initialization
935  * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_EXIT: Driver shutdown
936  * @WIFI_POWER_EVENT_WAKELOCK_SCAN: Scan request/response handling
937  * @WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN: Extended scan request/response handling
938  * @WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN: Driver resume
939  * @WIFI_POWER_EVENT_WAKELOCK_ROC: Remain on channel request/response handling
940  * @WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND: Auto suspend related handling
941  * @WIFI_POWER_EVENT_WAKELOCK_IPA: IPA related handling
942  * @WIFI_POWER_EVENT_WAKELOCK_ADD_STA: Addition of STA
943  * @WIFI_POWER_EVENT_WAKELOCK_HOLD_RX: Wakelocks taken for receive
944  * @WIFI_POWER_EVENT_WAKELOCK_SAP: SoftAP related wakelocks
945  * @WIFI_POWER_EVENT_WAKELOCK_WOW: WoW feature related
946  * @WIFI_POWER_EVENT_WAKELOCK_PNO: PNO feature related
947  * @WIFI_POWER_EVENT_WAKELOCK_DEL_STA: Deletion of a station
948  * @WIFI_POWER_EVENT_WAKELOCK_DFS: DFS related wakelocks
949  * @WIFI_POWER_EVENT_WAKELOCK_WMI_CMD_RSP: Firmware response
950  * @WIFI_POWER_EVENT_WAKELOCK_MISC: Miscellaneous wakelocks
951  * @WIFI_POWER_EVENT_WAKELOCK_DHCP: DHCP negotiation under way
952  * @WIFI_POWER_EVENT_WAKELOCK_CONNECT: connection in progress
953  * @WIFI_POWER_EVENT_WAKELOCK_DISCONNECT: disconnection in progress
954  * @WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER: iface change timer running
955  * @WIFI_POWER_EVENT_WAKELOCK_MONITOR_MODE: Montitor mode wakelock
956  * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_RESTART: Wakelock for Idle Restart
957  * @WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_SHUTDOWN: Wakelock for Idle Shutdown
958  * @WIFI_POWER_EVENT_WAKELOCK_TDLS: Wakelock for TDLS
959  * @WIFI_POWER_EVENT_WAKELOCK_CFR: Wakelock for CFR
960  * @WIFI_POWER_EVENT_WAKELOCK_SAP_D3_WOW: Wakelock for SAP D3 WOW max clients
961  * @WIFI_POWER_EVENT_WAKELOCK_GO_D3_WOW: Wakelock for GO D3 WOW max clients
962  * @WIFI_POWER_EVENT_WAKELOCK_RTPM_TPUT_POLICY: Wakelock for RTPM Tput policy
963  * @WIFI_POWER_EVENT_WAKELOCK_DYN_MAC_ADDR_UPDATE: Dynamic mac addr update
964  * @WIFI_POWER_EVENT_WAKELOCK_OPT_WIFI_DP: OPT_WIFI_DP feature enabled
965  *
966  * Indicates the reason for which the wakelock was taken/released
967  */
968 enum wake_lock_reason {
969 	WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT,
970 	WIFI_POWER_EVENT_WAKELOCK_DRIVER_REINIT,
971 	WIFI_POWER_EVENT_WAKELOCK_DRIVER_EXIT,
972 	WIFI_POWER_EVENT_WAKELOCK_SCAN,
973 	WIFI_POWER_EVENT_WAKELOCK_EXT_SCAN,
974 	WIFI_POWER_EVENT_WAKELOCK_RESUME_WLAN,
975 	WIFI_POWER_EVENT_WAKELOCK_ROC,
976 	WIFI_POWER_EVENT_WAKELOCK_AUTO_SUSPEND,
977 	WIFI_POWER_EVENT_WAKELOCK_IPA,
978 	WIFI_POWER_EVENT_WAKELOCK_ADD_STA,
979 	WIFI_POWER_EVENT_WAKELOCK_HOLD_RX,
980 	WIFI_POWER_EVENT_WAKELOCK_SAP,
981 	WIFI_POWER_EVENT_WAKELOCK_WOW,
982 	WIFI_POWER_EVENT_WAKELOCK_PNO,
983 	WIFI_POWER_EVENT_WAKELOCK_DEL_STA,
984 	WIFI_POWER_EVENT_WAKELOCK_DFS,
985 	WIFI_POWER_EVENT_WAKELOCK_WMI_CMD_RSP,
986 	WIFI_POWER_EVENT_WAKELOCK_MISC,
987 	WIFI_POWER_EVENT_WAKELOCK_DHCP,
988 	WIFI_POWER_EVENT_WAKELOCK_CONNECT,
989 	WIFI_POWER_EVENT_WAKELOCK_DISCONNECT,
990 	WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER,
991 	WIFI_POWER_EVENT_WAKELOCK_MONITOR_MODE,
992 	WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_RESTART,
993 	WIFI_POWER_EVENT_WAKELOCK_DRIVER_IDLE_SHUTDOWN,
994 	WIFI_POWER_EVENT_WAKELOCK_TDLS,
995 	WIFI_POWER_EVENT_WAKELOCK_CFR,
996 	WIFI_POWER_EVENT_WAKELOCK_SAP_D3_WOW,
997 	WIFI_POWER_EVENT_WAKELOCK_GO_D3_WOW,
998 	WIFI_POWER_EVENT_WAKELOCK_RTPM_TPUT_POLICY,
999 	WIFI_POWER_EVENT_WAKELOCK_DYN_MAC_ADDR_UPDATE,
1000 	WIFI_POWER_EVENT_WAKELOCK_OPT_WIFI_DP,
1001 };
1002 
1003 /* The length of interface name should >= IFNAMSIZ */
1004 #define HOST_EVENT_INTF_STR_LEN 16
1005 #define HOST_EVENT_HW_MODE_STR_LEN 12
1006 
1007 /**
1008  * struct host_event_wlan_acs_req - payload for ACS diag event
1009  * @intf: network interface name for WLAN
1010  * @hw_mode: hw mode configured by hostapd
1011  * @bw: channel bandwidth(MHz)
1012  * @ht: a flag indicating whether HT phy mode is enabled
1013  * @vht: a flag indicating whether VHT phy mode is enabled
1014  * @chan_start: starting channel number for ACS scan
1015  * @chan_end: ending channel number for ACS scan
1016  *
1017  * This structure includes all the payload related to ACS request parameters
1018  */
1019 struct host_event_wlan_acs_req {
1020 	uint8_t intf[HOST_EVENT_INTF_STR_LEN];
1021 	uint8_t hw_mode[HOST_EVENT_HW_MODE_STR_LEN];
1022 	uint16_t bw;
1023 	uint8_t ht;
1024 	uint8_t vht;
1025 	uint16_t chan_start;
1026 	uint16_t chan_end;
1027 };
1028 
1029 /**
1030  * struct host_event_wlan_acs_scan_start - payload for ACS scan request
1031  * @scan_id: scan request ID
1032  * @vdev_id: vdev/session ID
1033  *
1034  * This structure includes all the payload related to ACS scan request
1035  * parameters
1036  */
1037 struct host_event_wlan_acs_scan_start {
1038 	uint32_t scan_id;
1039 	uint8_t vdev_id;
1040 };
1041 
1042 #define HOST_EVENT_STATUS_STR_LEN 24
1043 
1044 /**
1045  * struct host_event_wlan_acs_scan_done - payload for ACS scan done event
1046  * @status: indicating whether ACS scan is successful
1047  * @vdev_id: vdev/session ID
1048  * @scan_id: scan request ID
1049  *
1050  * This structure includes all the payload related to ACS scan done event
1051  */
1052 struct host_event_wlan_acs_scan_done {
1053 	uint8_t status[HOST_EVENT_STATUS_STR_LEN];
1054 	uint32_t scan_id;
1055 	uint8_t vdev_id;
1056 };
1057 
1058 /**
1059  * struct host_event_wlan_acs_chan_spectral_weight - payload for spectral
1060  * weight event indication
1061  * @chan: channel number
1062  * @weight: channel weight
1063  * @rssi: RSSI value obtained after scanning
1064  * @bss_count: number of BSS detected on this channel
1065  *
1066  * This structure includes all the payload related to a channel's weight
1067  * evaluation result
1068  */
1069 struct host_event_wlan_acs_chan_spectral_weight {
1070 	uint16_t chan;
1071 	uint16_t weight;
1072 	int32_t rssi;
1073 	uint16_t bss_count;
1074 };
1075 
1076 /**
1077  * struct host_event_wlan_acs_best_chan - payload for ACS best channel event
1078  * @chan: channel number
1079  * @weight: channel weight
1080  *
1081  * This structure includes all the payload related to the best channel
1082  * selected after ACS procedure
1083  */
1084 struct host_event_wlan_acs_best_chan {
1085 	uint16_t chan;
1086 	uint16_t weight;
1087 };
1088 
1089 #ifdef __cplusplus
1090 }
1091 #endif /* __cplusplus */
1092 #endif /* __HOST_DIAG_CORE_EVENT_H */
1093