wifi: update bcm driver to 101.10.240 to support android r [1/2]
[GitHub/LineageOS/G12/android_hardware_amlogic_kernel-modules_dhd-driver.git] / bcmdhd.101.10.240.x / include / event_trace.h
CommitLineData
1b4a7c03
LJ
1/*
2 * Trace log blocks sent over HBUS
3 *
4 * Copyright (C) 2020, Broadcom.
5 *
6 * Unless you and Broadcom execute a separate written software license
7 * agreement governing use of this software, this software is licensed to you
8 * under the terms of the GNU General Public License version 2 (the "GPL"),
9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10 * following added to such license:
11 *
12 * As a special exception, the copyright holders of this software give you
13 * permission to link this software with independent modules, and to copy and
14 * distribute the resulting executable under terms of your choice, provided that
15 * you also meet, for each linked independent module, the terms and conditions of
16 * the license of that module. An independent module is a module which is not
17 * derived from this software. The special exception does not apply to any
18 * modifications of the software.
19 *
20 *
21 * <<Broadcom-WL-IPTag/Dual:>>
22 */
23
24/**
25 * @file
26 * @brief
27 * Define the trace event ID and tag ID
28 */
29
30#ifndef _WL_DIAG_H
31#define _WL_DIAG_H
32
33#include <event_log.h>
34
35#define DIAG_MAJOR_VERSION 1 /* 4 bits */
36#define DIAG_MINOR_VERSION 0 /* 4 bits */
37#define DIAG_MICRO_VERSION 0 /* 4 bits */
38
39#define DIAG_VERSION \
40 ((DIAG_MICRO_VERSION&0xF) | (DIAG_MINOR_VERSION&0xF)<<4 | \
41 (DIAG_MAJOR_VERSION&0xF)<<8)
42 /* bit[11:8] major ver */
43 /* bit[7:4] minor ver */
44 /* bit[3:0] micro ver */
45
46/* event ID for trace purpose only, to avoid the conflict with future new
47* WLC_E_ , starting from 0x8000
48*/
49#define TRACE_FW_AUTH_STARTED 0x8000
50#define TRACE_FW_ASSOC_STARTED 0x8001
51#define TRACE_FW_RE_ASSOC_STARTED 0x8002
52#define TRACE_G_SCAN_STARTED 0x8003
53#define TRACE_ROAM_SCAN_STARTED 0x8004
54#define TRACE_ROAM_SCAN_COMPLETE 0x8005
55#define TRACE_FW_EAPOL_FRAME_TRANSMIT_START 0x8006
56#define TRACE_FW_EAPOL_FRAME_TRANSMIT_STOP 0x8007
57#define TRACE_BLOCK_ACK_NEGOTIATION_COMPLETE 0x8008 /* protocol status */
58#define TRACE_BT_COEX_BT_SCO_START 0x8009
59#define TRACE_BT_COEX_BT_SCO_STOP 0x800a
60#define TRACE_BT_COEX_BT_SCAN_START 0x800b
61#define TRACE_BT_COEX_BT_SCAN_STOP 0x800c
62#define TRACE_BT_COEX_BT_HID_START 0x800d
63#define TRACE_BT_COEX_BT_HID_STOP 0x800e
64#define TRACE_ROAM_AUTH_STARTED 0x800f
65/* Event ID for NAN, start from 0x9000 */
66#define TRACE_NAN_CLUSTER_STARTED 0x9000
67#define TRACE_NAN_CLUSTER_JOINED 0x9001
68#define TRACE_NAN_CLUSTER_MERGED 0x9002
69#define TRACE_NAN_ROLE_CHANGED 0x9003
70#define TRACE_NAN_SCAN_COMPLETE 0x9004
71#define TRACE_NAN_STATUS_CHNG 0x9005
72
73/* Parameters of wifi logger events are TLVs */
74/* Event parameters tags are defined as: */
75#define TRACE_TAG_VENDOR_SPECIFIC 0 /* take a byte stream as parameter */
76#define TRACE_TAG_BSSID 1 /* takes a 6 bytes MAC address as parameter */
77#define TRACE_TAG_ADDR 2 /* takes a 6 bytes MAC address as parameter */
78#define TRACE_TAG_SSID 3 /* takes a 32 bytes SSID address as parameter */
79#define TRACE_TAG_STATUS 4 /* takes an integer as parameter */
80#define TRACE_TAG_CHANNEL_SPEC 5 /* takes one or more wifi_channel_spec as */
81 /* parameter */
82#define TRACE_TAG_WAKE_LOCK_EVENT 6 /* takes a wake_lock_event struct as parameter */
83#define TRACE_TAG_ADDR1 7 /* takes a 6 bytes MAC address as parameter */
84#define TRACE_TAG_ADDR2 8 /* takes a 6 bytes MAC address as parameter */
85#define TRACE_TAG_ADDR3 9 /* takes a 6 bytes MAC address as parameter */
86#define TRACE_TAG_ADDR4 10 /* takes a 6 bytes MAC address as parameter */
87#define TRACE_TAG_TSF 11 /* take a 64 bits TSF value as parameter */
88#define TRACE_TAG_IE 12 /* take one or more specific 802.11 IEs */
89 /* parameter, IEs are in turn indicated in */
90 /* TLV format as per 802.11 spec */
91#define TRACE_TAG_INTERFACE 13 /* take interface name as parameter */
92#define TRACE_TAG_REASON_CODE 14 /* take a reason code as per 802.11 */
93 /* as parameter */
94#define TRACE_TAG_RATE_MBPS 15 /* take a wifi rate in 0.5 mbps */
95#define TRACE_TAG_REQUEST_ID 16 /* take an integer as parameter */
96#define TRACE_TAG_BUCKET_ID 17 /* take an integer as parameter */
97#define TRACE_TAG_GSCAN_PARAMS 18 /* takes a wifi_scan_cmd_params struct as parameter */
98#define TRACE_TAG_GSCAN_CAPABILITIES 19 /* takes a wifi_gscan_capabilities struct as parameter */
99#define TRACE_TAG_SCAN_ID 20 /* take an integer as parameter */
100#define TRACE_TAG_RSSI 21 /* take an integer as parameter */
101#define TRACE_TAG_CHANNEL 22 /* take an integer as parameter */
102#define TRACE_TAG_LINK_ID 23 /* take an integer as parameter */
103#define TRACE_TAG_LINK_ROLE 24 /* take an integer as parameter */
104#define TRACE_TAG_LINK_STATE 25 /* take an integer as parameter */
105#define TRACE_TAG_LINK_TYPE 26 /* take an integer as parameter */
106#define TRACE_TAG_TSCO 27 /* take an integer as parameter */
107#define TRACE_TAG_RSCO 28 /* take an integer as parameter */
108#define TRACE_TAG_EAPOL_MESSAGE_TYPE 29 /* take an integer as parameter */
109 /* M1-1, M2-2, M3-3, M4-4 */
110
111typedef union {
112 struct {
113 uint16 event: 16;
114 uint16 version: 16;
115 };
116 uint32 t;
117} wl_event_log_id_ver_t;
118
119#define ETHER_ADDR_PACK_LOW(addr) (((addr)->octet[3])<<24 | ((addr)->octet[2])<<16 | \
120 ((addr)->octet[1])<<8 | ((addr)->octet[0]))
121#define ETHER_ADDR_PACK_HI(addr) (((addr)->octet[5])<<8 | ((addr)->octet[4]))
122#define SSID_PACK(addr) (((uint8)(addr)[0])<<24 | ((uint8)(addr)[1])<<16 | \
123 ((uint8)(addr)[2])<<8 | ((uint8)(addr)[3]))
124
125/* for each event id with logging data, define its logging data structure */
126
127typedef union {
128 struct {
129 uint16 status: 16;
130 uint16 paraset: 16;
131 };
132 uint32 t;
133} wl_event_log_blk_ack_t;
134
135typedef union {
136 struct {
137 uint8 mode: 8;
138 uint8 count: 8;
139 uint16 ch: 16;
140 };
141 uint32 t;
142} wl_event_log_csa_t;
143
144typedef union {
145 struct {
146 uint8 status: 1;
147 uint16 notused: 15;
148 uint16 frag_tx_cnt: 16;
149 };
150 uint32 t;
151} wl_event_log_eapol_tx_t;
152
153typedef union {
154 struct {
155 uint16 tag;
156 uint16 length; /* length of value in bytes */
157 };
158 uint32 t;
159} wl_event_log_tlv_hdr_t;
160
161#ifdef WL_EVENT_LOG_COMPILE
162#define _WL_EVENT_LOG(tag, event, ...) \
163 do { \
164 event_log_top_t * event_log_top = event_log_get_top(); \
165 wl_event_log_id_ver_t entry = {{event, DIAG_VERSION}}; \
166 event_log_top->timestamp = OSL_SYSUPTIME(); \
167 EVENT_LOG(tag, "WL event", entry.t , ## __VA_ARGS__); \
168 } while (0)
169#define WL_EVENT_LOG(args) _WL_EVENT_LOG args
170#else
171#define WL_EVENT_LOG(args)
172#endif /* WL_EVENT_LOG_COMPILE */
173
174#ifdef NAN_EVENT_LOG_COMPILE
175#define _NAN_EVENT_LOG(tag, event, ...) \
176 do { \
177 event_log_top_t * event_log_top = event_log_get_top(); \
178 wl_event_log_id_ver_t hdr = {{event, DIAG_VERSION}}; \
179 event_log_top->timestamp = OSL_SYSUPTIME(); \
180 EVENT_LOG(tag, "NAN event", hdr.t , ## __VA_ARGS__); \
181 } while (0)
182#define NAN_EVENT_LOG(args) _NAN_EVENT_LOG args
183#else
184#define NAN_EVENT_LOG(args)
185#endif /* NAN_EVENT_LOG_COMPILE */
186
187#endif /* _WL_DIAG_H */