1 /* 2 * Copyright (c) 2014-2017, 2019-2020 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 uint32_t op_freq; 104 } host_log_ibss_pkt_type; 105 106 /*--------------------------------------------------------------------------- 107 This packet contains the information related to 802.11D 108 LOG_WLAN_80211D_C 0x1498 109 ---------------------------------------------------------------------------*/ 110 typedef struct { 111 log_hdr_type hdr; 112 uint8_t eventId; 113 uint8_t numChannel; 114 uint8_t Channels[HOST_LOG_MAX_NUM_CHANNEL]; 115 uint8_t TxPwr[HOST_LOG_MAX_NUM_CHANNEL]; 116 uint8_t countryCode[3]; 117 uint8_t supportMultipleDomain; 118 } host_log_802_11d_pkt_type; 119 120 /*--------------------------------------------------------------------------- 121 This is a log packet which contains below handoff information: 122 - Current AP + RSSI (if already associated) 123 - Candidate AP + RSSI (before association and when the list is updated) 124 - For each BSSID in candidate list, provide RSSI, QoS and security compatibility 125 LOG_WLAN_HANDOFF_C 0x1499 126 ---------------------------------------------------------------------------*/ 127 typedef struct { 128 uint8_t ssid[9]; 129 uint8_t bssid[HOST_LOG_MAX_BSSID_SIZE]; 130 uint8_t channel_id; 131 uint32_t qos_score; 132 uint32_t sec_score; 133 uint32_t rssi_score; 134 uint32_t overall_score; 135 uint32_t tx_per; /* represented as a % */ 136 uint32_t rx_per; /* represented as a % */ 137 138 } host_log_ho_ap_info; 139 140 typedef struct { 141 log_hdr_type hdr; 142 uint32_t num_aps; 143 host_log_ho_ap_info current_ap_info; 144 host_log_ho_ap_info 145 candidate_ap_info[HOST_LOG_MAX_NUM_HO_CANDIDATE_APS]; 146 } host_log_ho_pkt_type; 147 148 /*--------------------------------------------------------------------------- 149 This packet contains the information related to the EDCA parameters 150 advertised by the AP 151 LOG_WLAN_QOS_EDCA_C 0x149A 152 ---------------------------------------------------------------------------*/ 153 typedef struct { 154 log_hdr_type hdr; 155 uint8_t aci_be; 156 uint8_t cw_be; 157 uint16_t txoplimit_be; 158 uint8_t aci_bk; 159 uint8_t cw_bk; 160 uint16_t txoplimit_bk; 161 uint8_t aci_vi; 162 uint8_t cw_vi; 163 uint16_t txoplimit_vi; 164 uint8_t aci_vo; 165 uint8_t cw_vo; 166 uint16_t txoplimit_vo; 167 } host_log_qos_edca_pkt_type; 168 169 /*--------------------------------------------------------------------------- 170 This packet contains the total number of beacon received value 171 LOG_WLAN_BEACON_UPDATE_C 0x149B 172 ---------------------------------------------------------------------------*/ 173 typedef struct { 174 log_hdr_type hdr; 175 uint32_t bcn_rx_cnt; 176 } host_log_beacon_update_pkt_type; 177 178 /*--------------------------------------------------------------------------- 179 This packet contains the information related to a WoW patern value when set 180 LOG_WLAN_POWERSAVE_WOW_ADD_PTRN_C 0x149C 181 ---------------------------------------------------------------------------*/ 182 typedef struct { 183 log_hdr_type hdr; 184 uint8_t pattern_id; 185 uint8_t pattern_byte_offset; 186 uint8_t pattern_size; 187 uint8_t pattern[HOST_LOG_MAX_WOW_PTRN_SIZE]; 188 uint8_t pattern_mask_size; 189 uint8_t pattern_mask[HOST_LOG_MAX_WOW_PTRN_MASK_SIZE]; 190 } host_log_powersave_wow_add_ptrn_pkt_type; 191 192 /*--------------------------------------------------------------------------- 193 This packet contains the Tspec info negotiated with the AP for the 194 specific AC 195 LOG_WLAN_QOS_TSPEC_C 0x14A2 196 ---------------------------------------------------------------------------*/ 197 typedef struct { 198 log_hdr_type hdr; 199 uint8_t tsinfo[3]; 200 uint16_t nominal_msdu_size; 201 uint16_t maximum_msdu_size; 202 uint32_t min_service_interval; 203 uint32_t max_service_interval; 204 uint32_t inactivity_interval; 205 uint32_t suspension_interval; 206 uint32_t svc_start_time; 207 uint32_t min_data_rate; 208 uint32_t mean_data_rate; 209 uint32_t peak_data_rate; 210 uint32_t max_burst_size; 211 uint32_t delay_bound; 212 uint32_t min_phy_rate; 213 uint16_t surplus_bw_allowance; 214 uint16_t medium_time; 215 } host_log_qos_tspec_pkt_type; 216 217 /*--------------------------------------------------------------------------- 218 This packet contains data information when stall detected 219 LOG_TRSP_DATA_STALL_C 0x1801 220 ---------------------------------------------------------------------------*/ 221 222 typedef struct { 223 char channelName[4]; 224 uint32_t numDesc; 225 uint32_t numFreeDesc; 226 uint32_t numRsvdDesc; 227 uint32_t headDescOrder; 228 uint32_t tailDescOrder; 229 uint32_t ctrlRegVal; 230 uint32_t statRegVal; 231 uint32_t numValDesc; 232 uint32_t numInvalDesc; 233 } host_log_data_stall_channel_type; 234 235 typedef struct { 236 log_hdr_type hdr; 237 uint32_t PowerState; 238 uint32_t numFreeBd; 239 host_log_data_stall_channel_type dxeChannelInfo[4]; 240 } host_log_data_stall_type; 241 242 /*--------------------------------------------------------------------------- 243 This packet contains the rssi value from BSS descriptor 244 LOG_WLAN_RSSI_UPDATE_C 0x1354 245 ---------------------------------------------------------------------------*/ 246 typedef struct { 247 log_hdr_type hdr; 248 int8_t rssi; 249 } host_log_rssi_pkt_type; 250 251 /** 252 * struct host_log_pktlog_info - Packet log info 253 * @log_hdr: Log header 254 * @buf_len: Length of the buffer that follows 255 * @buf: Buffer containing the packet log info 256 * 257 * Structure containing the packet log information 258 * LOG_WLAN_PKT_LOG_INFO_C 0x18E0 259 */ 260 struct host_log_pktlog_info { 261 log_hdr_type log_hdr; 262 uint32_t version; 263 uint32_t seq_no; 264 uint32_t buf_len; 265 uint8_t buf[]; 266 }; 267 268 /** 269 * struct host_log_cold_boot_cal_data_type - Cold boot cal log info 270 * @hdr: Log header 271 * @version: version 272 * @flags: Flag to indicate if more data follows 273 * @cb_cal_data_len: Length of the cal data 274 * @cb_cal_data: Cold boot cal data 275 * 276 * Structure containing the cold boot calibration data 277 * log information 278 * LOG_WLAN_COLD_BOOT_CAL_DATA_C 0x1A18 279 */ 280 struct host_log_cold_boot_cal_data_type { 281 log_hdr_type hdr; 282 uint32_t version; 283 uint32_t flags; 284 uint32_t cb_cal_data_len; 285 uint8_t cb_cal_data[HOST_LOG_MAX_COLD_BOOT_CAL_DATA_SIZE]; 286 }; 287 288 #define WLAN_MAX_ROAM_CANDIDATE_AP 9 289 #define WLAN_MAX_ROAM_SCAN_CHAN 38 290 #define WLAN_MAX_SSID_SIZE 32 291 292 /** 293 * host_log_wlan_mgmt_tx_rx_info: To capture TX/RX mgmt frames' payload 294 * @hdr: Log header 295 * @version: Version number of the payload 296 * @vdev_id: Vdev id 297 * @is_tx: 1 - TX frame, 0 - RX frame 298 * @mgmt_type: type of frames, value: enum wifi_frm_type 299 * @mgmt_subtype: subtype of mgmt frame, value: enum mgmt_frm_subtype 300 * @mgmt_frame_seq_num: Frame sequence number in 802.11 header 301 * @operating_freq: operating frequency of AP 302 * @ssid_len: length of SSID, max 32 bytes long as per standard 303 * @ssid: SSID of connected AP 304 * @self_mac_addr: mac address of self interface 305 * @bssid: BSSID for which frame is received 306 * @mac_failure_reason: Internal driver failure reason 307 * @mgmt_status_code: 802.11 management frame response status code from 308 * section 9.4.1.9 IEEE 802.11 - 2016 309 * @auth_algo: Authentication algorithm number 310 * @auth_transaction_num: Authentication transaction sequence number 311 * @is_retry: Is retry frame 312 * @rssi: RSSI for the received frame 313 * @origin: 1- Sent by host. 2- sent by firmware 314 */ 315 struct host_log_wlan_mgmt_tx_rx_info { 316 log_hdr_type hdr; 317 uint8_t version; 318 uint8_t vdev_id; 319 bool is_tx; 320 uint8_t mgmt_type; 321 uint8_t mgmt_subtype; 322 uint16_t mgmt_frame_seq_num; 323 uint8_t operating_freq; 324 uint8_t ssid_len; 325 char ssid[WLAN_MAX_SSID_SIZE]; 326 uint8_t self_mac_addr[QDF_MAC_ADDR_SIZE]; 327 uint8_t bssid[QDF_MAC_ADDR_SIZE]; 328 uint16_t mac_failure_reason; 329 uint16_t mgmt_status_code; 330 uint8_t auth_algo; 331 uint8_t auth_transaction_num; 332 uint8_t is_retry; 333 uint32_t rssi; 334 uint8_t origin; 335 } qdf_packed; 336 337 /** 338 * struct wlan_roam_btm_trigger_data - BTM roam trigger related information 339 * @btm_request_mode: BTM request mode - solicited/unsolicited 340 * @disassoc_timer: Number of TBTT before AP disassociates the STA in ms 341 * @validity_interval: Preferred candidate list validity interval in ms 342 * @candidate_list_count: Number of candidates in BTM request. 343 * @btm_resp_status: Status code of the BTM response. 344 */ 345 struct wlan_roam_btm_trigger_data { 346 uint8_t btm_request_mode; 347 uint32_t disassoc_timer; 348 uint32_t validity_interval; 349 uint16_t candidate_list_count; 350 uint16_t btm_resp_status; 351 } qdf_packed; 352 353 /** 354 * struct wlan_roam_cu_trigger_data - BSS Load roam trigger parameters 355 * @cu_load: Connected AP CU load percentage 356 */ 357 struct wlan_roam_cu_trigger_data { 358 uint16_t cu_load; 359 } qdf_packed; 360 361 /** 362 * Struct wlan_roam_rssi_trigger_data - RSSI roam trigger related 363 * parameters 364 * @threshold: RSSI threshold value in dBm for LOW rssi roam trigger 365 */ 366 struct wlan_roam_rssi_trigger_data { 367 uint32_t threshold; 368 } qdf_packed; 369 370 /** 371 * struct wlan_roam_deauth_trigger_data - Deauth roaming trigger related 372 * parameters 373 * @type: 1- Deauthentication 2- Disassociation 374 * @reason: Status code of the Deauth/Disassoc received 375 */ 376 struct wlan_roam_deauth_trigger_data { 377 uint8_t type; 378 uint32_t reason; 379 } qdf_packed; 380 381 /** 382 * struct host_log_wlan_roam_trigger_info - Roam trigger 383 * related info 384 * @hdr: Log header 385 * @version: Version number of the payload 386 * @vdev_id: Vdev id 387 * @trigger_reason: Roaming trigger reason 388 * @trigger_sub_reason: Roaming trigger sub reason 389 * @current_rssi: Current connected AP RSSI 390 * @timestamp: Host driver timestamp in msecs 391 * @btm_trig_data: BTM trigger related data 392 * @cu_load_data: CU load trigger related data 393 * @rssi_trig_data: RSSI roam trigger related data 394 * @deauth_trig_data: Deauth Roam trigger related data 395 */ 396 struct host_log_wlan_roam_trigger_info { 397 log_hdr_type hdr; 398 uint8_t version; 399 uint8_t vdev_id; 400 uint32_t trigger_reason; 401 uint32_t trigger_sub_reason; 402 uint32_t current_rssi; 403 uint32_t timestamp; 404 union { 405 struct wlan_roam_btm_trigger_data btm_trig_data; 406 struct wlan_roam_cu_trigger_data cu_load_data; 407 struct wlan_roam_rssi_trigger_data rssi_trig_data; 408 struct wlan_roam_deauth_trigger_data deauth_trig_data; 409 }; 410 } qdf_packed; 411 412 /** 413 * struct host_log_wlan_roam_candidate_info - Roam scan candidate APs related 414 * info 415 * @version: Payload structure version 416 * @timestamp: Host timestamp in millisecs 417 * @type: 0 - Candidate AP; 1 - Current connected AP. 418 * @bssid: AP bssid. 419 * @freq: Channel frquency 420 * @cu_load: Channel utilization load of the AP. 421 * @cu_score: Channel Utilization score. 422 * @rssi: Candidate AP rssi 423 * @rssi_score: AP RSSI score 424 * @total_score: Total score of the candidate AP. 425 * @etp: Estimated throughput value of the AP in Mbps 426 */ 427 struct host_log_wlan_roam_candidate_info { 428 uint8_t version; 429 uint32_t timestamp; 430 uint8_t type; 431 uint8_t bssid[QDF_MAC_ADDR_SIZE]; 432 uint16_t freq; 433 uint32_t cu_load; 434 uint32_t cu_score; 435 uint32_t rssi; 436 uint32_t rssi_score; 437 uint32_t total_score; 438 uint32_t etp; 439 } qdf_packed; 440 441 /** 442 * struct host_log_wlan_roam_scan_data - Roam scan event details 443 * @hdr: Log header 444 * @version: Version number of the diag log payload 445 * @vdev_id: Vdev ID 446 * @type: 0 - Partial roam scan; 1 - Full roam scan 447 * @num_ap: Number of candidate APs. 448 * @num_chan: Number of channels. 449 * @timestamp: Time of day in milliseconds at which scan was triggered 450 * @trigger_reason: Roam scan trigger reason 451 * @next_rssi_threshold: Next roam can trigger rssi threshold 452 * @chan_freq: List of frequencies scanned as part of roam scan 453 * @ap: List of candidate AP info 454 */ 455 struct host_log_wlan_roam_scan_data { 456 log_hdr_type hdr; 457 uint8_t version; 458 uint8_t vdev_id; 459 uint16_t type; 460 uint8_t num_ap; 461 uint8_t num_chan; 462 uint32_t timestamp; 463 uint32_t trigger_reason; 464 uint32_t next_rssi_threshold; 465 uint16_t chan_freq[WLAN_MAX_ROAM_SCAN_CHAN]; 466 struct host_log_wlan_roam_candidate_info ap[WLAN_MAX_ROAM_CANDIDATE_AP]; 467 } qdf_packed; 468 469 /** 470 * struct host_log_wlan_roam_result_info - Roam result related info. 471 * @hdr: Log header 472 * @version: Payload strcuture version 473 * @vdev_id: Vdev Id 474 * @status: 0 - Roaming is success ; 1 - Roaming failed 475 * @timestamp: Host timestamp in millisecs 476 * @fail_reason: One of WMI_ROAM_FAIL_REASON_ID 477 */ 478 struct host_log_wlan_roam_result_info { 479 log_hdr_type hdr; 480 uint8_t version; 481 uint8_t vdev_id; 482 bool status; 483 uint32_t timestamp; 484 uint32_t fail_reason; 485 } qdf_packed; 486 487 /** 488 * struct wlan_rrm_beacon_report - RRM beacon report related 489 * parameters 490 * @req_bssid: beacon report requestor BSSID 491 * @req_ssid: Requested SSID for beacon report 492 * @is_wildcard_bssid: Is the BSSID FF:FF:FF:FF:FF:FF 493 * @req_reg_class: Regulatory class mentioned in the request 494 * @req_measurement_mode: Measurement mode. Active/Passive/Beacon report Table 495 * @req_measurement_duration: Measurement duration requested. 496 * @num_reports_in_frame: Number of BSS scanned 497 * @is_last_frame_in_req: True if this frame is the last frame sent for the 498 * request 499 */ 500 struct wlan_rrm_beacon_report { 501 uint8_t req_bssid[QDF_MAC_ADDR_SIZE]; 502 uint8_t req_ssid[WLAN_MAX_SSID_SIZE]; 503 bool is_wildcard_bssid; 504 uint8_t req_reg_class; 505 uint16_t req_measurement_mode; 506 uint16_t req_measurement_duration; 507 uint8_t num_reports_in_frame; 508 bool is_last_frame_in_req; 509 } qdf_packed; 510 511 /** 512 * struct host_log_wlan_rrm_tx_rx_info - RRM frame related details 513 * @hdr: Log header 514 * @version: Version of the payload struture 515 * @vdev_id: Vdev id 516 * @orgin: Sent by host or firmware 517 * @is_tx: Is Tx frame or RX frame 518 * @roam_result: Roaming result 519 * @timestamp: Time of the day in milliseconds 520 * @mgmt_frame_seq_num: Frame sequence number 521 * @received_chan_freq: Frame received channel frequency 522 * @action_category: Action frame category 523 * @rrm_action_code: Radio measurement/Noise measurement 524 * @radio_measurement_type: Neighbor report/Beacon report 525 * @bssid: BSSID field in frame 526 * @req_num_freq: Number of frequencies provided in request 527 * @req_freq: Frequencies requested 528 * @fail_reason_code: response TX failure status code 529 * @rssi: Rx frame rssi 530 * @bcn_rpt: Beacon report related parameters 531 */ 532 struct host_log_wlan_rrm_tx_rx_info { 533 log_hdr_type hdr; 534 uint8_t version; 535 uint8_t vdev_id; 536 uint8_t origin; 537 bool is_tx; 538 bool roam_result; 539 uint32_t timestamp; 540 uint16_t mgmt_frame_seq_num; 541 uint16_t received_chan_freq; 542 uint8_t action_category; 543 uint8_t rrm_action_code; 544 uint8_t radio_measurement_type; 545 uint8_t bssid[QDF_MAC_ADDR_SIZE]; 546 uint8_t req_num_freq; 547 uint16_t req_freq[WLAN_MAX_ROAM_SCAN_CHAN]; 548 uint8_t fail_reason_code; 549 uint32_t rssi; 550 struct wlan_rrm_beacon_report bcn_rpt; 551 } qdf_packed; 552 553 /** 554 * struct host_event_proto_pkt_info - DP protocol pkt info 555 * @hdr: Log header 556 * @version: version 557 * @type: data pkt type 558 * @subtype: data pkt subtype 559 * @dir: tx or rx 560 * @sa: source MAC address 561 * @da: destination MAC address 562 * @msdu_id: MSDU id 563 * @status: status 564 * 565 * Structure containing the protocol data pkt info 566 * 567 * LOG_WLAN_DP_PROTO_PKT_INFO_C 0x1A1E 568 */ 569 struct host_event_proto_pkt_info { 570 log_hdr_type hdr; 571 uint32_t version; 572 uint8_t type; 573 uint8_t subtype; 574 uint8_t dir; 575 uint8_t sa[QDF_MAC_ADDR_SIZE]; 576 uint8_t da[QDF_MAC_ADDR_SIZE]; 577 uint16_t msdu_id; 578 uint8_t status; 579 }; 580 581 /*------------------------------------------------------------------------- 582 Function declarations and documenation 583 ------------------------------------------------------------------------*/ 584 585 #ifdef __cplusplus 586 } 587 #endif /* __cplusplus */ 588 #endif /* __HOST_DIAG_CORE_LOG_H */ 589