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