xref: /wlan-dirver/qca-wifi-host-cmn/utils/host_diag_log/inc/host_diag_core_log.h (revision dd4dc88b837a295134aa9869114a2efee0f4894b)
1 /*
2  * Copyright (c) 2014-2017, 2019 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(__HOST_DIAG_CORE_LOG_H)
20 #define __HOST_DIAG_CORE_LOG_H
21 
22 /**=========================================================================
23 
24    \file  host_diag_core_log.h
25 
26    \brief WLAN UTIL host DIAG logs
27 
28    Definitions for WLAN UTIL host diag events
29 
30    ========================================================================*/
31 
32 /* $Header$ */
33 
34 /*--------------------------------------------------------------------------
35    Include Files
36    ------------------------------------------------------------------------*/
37 #include "qdf_types.h"
38 #include "i_host_diag_core_log.h"
39 
40 /*--------------------------------------------------------------------------
41    Preprocessor definitions and constants
42    ------------------------------------------------------------------------*/
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46 
47 /*--------------------------------------------------------------------------
48    Preprocessor definitions and constants
49    ------------------------------------------------------------------------*/
50 #define HOST_LOG_MAX_NUM_SSID                                (21)
51 #define HOST_LOG_MAX_NUM_BSSID                               (21)
52 #define HOST_LOG_MAX_SSID_SIZE                               (32)
53 #define HOST_LOG_MAX_BSSID_SIZE                              (6)
54 #define HOST_LOG_MAX_NUM_CHANNEL                             (64)
55 #define HOST_LOG_MAX_NUM_HO_CANDIDATE_APS                    (20)
56 #define HOST_LOG_MAX_WOW_PTRN_SIZE                           (128)
57 #define HOST_LOG_MAX_WOW_PTRN_MASK_SIZE                      (16)
58 #define VOS_LOG_PKT_LOG_SIZE                                 (2048)
59 #define HOST_LOG_PKT_LOG_THRESHOLD                           40960
60 #define HOST_LOG_MAX_COLD_BOOT_CAL_DATA_SIZE                 (2048)
61 
62 /* Version to be updated whenever format of vos_log_pktlog_info changes */
63 #define VERSION_LOG_WLAN_PKT_LOG_INFO_C                     1
64 /* Version to be updated whenever format of host_log_cold_boot_cal_data_type
65  * changes
66  */
67 #define VERSION_LOG_WLAN_COLD_BOOT_CAL_DATA_C               1
68 
69 /*---------------------------------------------------------------------------
70    This packet contains the scan results of the recent scan operation
71    LOG_WLAN_SCAN_C                                 0x1496
72    ---------------------------------------------------------------------------*/
73 typedef struct {
74 	log_hdr_type hdr;
75 	uint8_t eventId;
76 	uint8_t numSsid;
77 	uint8_t ssid[HOST_LOG_MAX_NUM_SSID][HOST_LOG_MAX_SSID_SIZE];
78 	uint8_t bssid[HOST_LOG_MAX_NUM_BSSID][HOST_LOG_MAX_BSSID_SIZE];
79 	uint8_t totalSsid;
80 	uint8_t minChnTime;
81 	uint8_t maxChnTime;
82 	uint16_t timeBetweenBgScan;
83 	uint8_t BSSMode;
84 	uint8_t numChannel;
85 	uint8_t channels[HOST_LOG_MAX_NUM_CHANNEL];
86 	uint16_t status;
87 } host_log_scan_pkt_type;
88 
89 /*---------------------------------------------------------------------------
90    This packet contains the information related to IBSS connection setup
91    LOG_WLAN_IBSS_C                                 0x1497
92    ---------------------------------------------------------------------------*/
93 typedef struct {
94 	log_hdr_type hdr;
95 	uint8_t eventId;
96 	uint8_t channelSetting;
97 	struct qdf_mac_addr bssid;
98 	struct qdf_mac_addr peer_macaddr;
99 	uint8_t ssid[HOST_LOG_MAX_SSID_SIZE];
100 	uint8_t operatingChannel;
101 	uint8_t beaconInterval;
102 	uint8_t status;
103 } host_log_ibss_pkt_type;
104 
105 /*---------------------------------------------------------------------------
106    This packet contains the information related to 802.11D
107    LOG_WLAN_80211D_C                               0x1498
108    ---------------------------------------------------------------------------*/
109 typedef struct {
110 	log_hdr_type hdr;
111 	uint8_t eventId;
112 	uint8_t numChannel;
113 	uint8_t Channels[HOST_LOG_MAX_NUM_CHANNEL];
114 	uint8_t TxPwr[HOST_LOG_MAX_NUM_CHANNEL];
115 	uint8_t countryCode[3];
116 	uint8_t supportMultipleDomain;
117 } host_log_802_11d_pkt_type;
118 
119 /*---------------------------------------------------------------------------
120    This is a log packet which contains below handoff information:
121    - Current AP + RSSI (if already associated)
122    - Candidate AP + RSSI (before association and when the list is updated)
123    - For each BSSID in candidate list, provide RSSI, QoS and security compatibility
124    LOG_WLAN_HANDOFF_C                              0x1499
125    ---------------------------------------------------------------------------*/
126 typedef struct {
127 	uint8_t ssid[9];
128 	uint8_t bssid[HOST_LOG_MAX_BSSID_SIZE];
129 	uint8_t channel_id;
130 	uint32_t qos_score;
131 	uint32_t sec_score;
132 	uint32_t rssi_score;
133 	uint32_t overall_score;
134 	uint32_t tx_per;                /* represented as a %      */
135 	uint32_t rx_per;                /* represented as a %      */
136 
137 } host_log_ho_ap_info;
138 
139 typedef struct {
140 	log_hdr_type hdr;
141 	uint32_t num_aps;
142 	host_log_ho_ap_info current_ap_info;
143 	host_log_ho_ap_info
144 		candidate_ap_info[HOST_LOG_MAX_NUM_HO_CANDIDATE_APS];
145 } host_log_ho_pkt_type;
146 
147 /*---------------------------------------------------------------------------
148    This packet contains the information related to the EDCA parameters
149    advertised by the AP
150    LOG_WLAN_QOS_EDCA_C                             0x149A
151    ---------------------------------------------------------------------------*/
152 typedef struct {
153 	log_hdr_type hdr;
154 	uint8_t aci_be;
155 	uint8_t cw_be;
156 	uint16_t txoplimit_be;
157 	uint8_t aci_bk;
158 	uint8_t cw_bk;
159 	uint16_t txoplimit_bk;
160 	uint8_t aci_vi;
161 	uint8_t cw_vi;
162 	uint16_t txoplimit_vi;
163 	uint8_t aci_vo;
164 	uint8_t cw_vo;
165 	uint16_t txoplimit_vo;
166 } host_log_qos_edca_pkt_type;
167 
168 /*---------------------------------------------------------------------------
169    This packet contains the total number of beacon received value
170    LOG_WLAN_BEACON_UPDATE_C                        0x149B
171    ---------------------------------------------------------------------------*/
172 typedef struct {
173 	log_hdr_type hdr;
174 	uint32_t bcn_rx_cnt;
175 } host_log_beacon_update_pkt_type;
176 
177 /*---------------------------------------------------------------------------
178    This packet contains the information related to a WoW patern value when set
179    LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C               0x149C
180    ---------------------------------------------------------------------------*/
181 typedef struct {
182 	log_hdr_type hdr;
183 	uint8_t pattern_id;
184 	uint8_t pattern_byte_offset;
185 	uint8_t pattern_size;
186 	uint8_t pattern[HOST_LOG_MAX_WOW_PTRN_SIZE];
187 	uint8_t pattern_mask_size;
188 	uint8_t pattern_mask[HOST_LOG_MAX_WOW_PTRN_MASK_SIZE];
189 } host_log_powersave_wow_add_ptrn_pkt_type;
190 
191 /*---------------------------------------------------------------------------
192    This packet contains the Tspec info negotiated with the AP for the
193    specific AC
194    LOG_WLAN_QOS_TSPEC_C                            0x14A2
195    ---------------------------------------------------------------------------*/
196 typedef struct {
197 	log_hdr_type hdr;
198 	uint8_t tsinfo[3];
199 	uint16_t nominal_msdu_size;
200 	uint16_t maximum_msdu_size;
201 	uint32_t min_service_interval;
202 	uint32_t max_service_interval;
203 	uint32_t inactivity_interval;
204 	uint32_t suspension_interval;
205 	uint32_t svc_start_time;
206 	uint32_t min_data_rate;
207 	uint32_t mean_data_rate;
208 	uint32_t peak_data_rate;
209 	uint32_t max_burst_size;
210 	uint32_t delay_bound;
211 	uint32_t min_phy_rate;
212 	uint16_t surplus_bw_allowance;
213 	uint16_t medium_time;
214 } host_log_qos_tspec_pkt_type;
215 
216 /*---------------------------------------------------------------------------
217    This packet contains data information when stall detected
218    LOG_TRSP_DATA_STALL_C                           0x1801
219    ---------------------------------------------------------------------------*/
220 
221 typedef struct {
222 	char channelName[4];
223 	uint32_t numDesc;
224 	uint32_t numFreeDesc;
225 	uint32_t numRsvdDesc;
226 	uint32_t headDescOrder;
227 	uint32_t tailDescOrder;
228 	uint32_t ctrlRegVal;
229 	uint32_t statRegVal;
230 	uint32_t numValDesc;
231 	uint32_t numInvalDesc;
232 } host_log_data_stall_channel_type;
233 
234 typedef struct {
235 	log_hdr_type hdr;
236 	uint32_t PowerState;
237 	uint32_t numFreeBd;
238 	host_log_data_stall_channel_type dxeChannelInfo[4];
239 } host_log_data_stall_type;
240 
241 /*---------------------------------------------------------------------------
242    This packet contains the rssi value from BSS descriptor
243    LOG_WLAN_RSSI_UPDATE_C                          0x1354
244    ---------------------------------------------------------------------------*/
245 typedef struct {
246 	log_hdr_type hdr;
247 	int8_t rssi;
248 } host_log_rssi_pkt_type;
249 
250 /**
251  * struct host_log_pktlog_info - Packet log info
252  * @log_hdr: Log header
253  * @buf_len: Length of the buffer that follows
254  * @buf:     Buffer containing the packet log info
255  *
256  * Structure containing the packet log information
257  * LOG_WLAN_PKT_LOG_INFO_C          0x18E0
258  */
259 struct host_log_pktlog_info {
260 	log_hdr_type log_hdr;
261 	uint32_t version;
262 	uint32_t seq_no;
263 	uint32_t buf_len;
264 	uint8_t buf[];
265 };
266 
267 /**
268  * struct host_log_cold_boot_cal_data_type - Cold boot cal log info
269  * @hdr: Log header
270  * @version: version
271  * @flags: Flag to indicate if more data follows
272  * @cb_cal_data_len: Length of the cal data
273  * @cb_cal_data: Cold boot cal data
274  *
275  * Structure containing the cold boot calibration data
276  * log information
277  * LOG_WLAN_COLD_BOOT_CAL_DATA_C          0x1A18
278  */
279 struct host_log_cold_boot_cal_data_type {
280 	log_hdr_type hdr;
281 	uint32_t version;
282 	uint32_t flags;
283 	uint32_t cb_cal_data_len;
284 	uint8_t cb_cal_data[HOST_LOG_MAX_COLD_BOOT_CAL_DATA_SIZE];
285 };
286 
287 /*-------------------------------------------------------------------------
288    Function declarations and documenation
289    ------------------------------------------------------------------------*/
290 
291 #ifdef __cplusplus
292 }
293 #endif /* __cplusplus */
294 #endif /* __HOST_DIAG_CORE_LOG_H */
295