1 /* 2 * Copyright (c) 2012-2021 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 /** 21 * DOC: wlan_cp_stats_mc_defs.h 22 * 23 * This file provide definition for structure/enums/defines related to control 24 * path stats component 25 */ 26 27 #ifndef __WLAN_CP_STATS_MC_DEFS_H__ 28 #define __WLAN_CP_STATS_MC_DEFS_H__ 29 30 #include "wlan_cmn.h" 31 #include "qdf_event.h" 32 /* For WMI_MAX_CHAINS */ 33 #include "wmi_unified.h" 34 #include "wlan_mlo_mgr_cmn.h" 35 36 #ifdef QCA_SUPPORT_MC_CP_STATS 37 #include "wlan_cp_stats_public_structs.h" 38 #endif 39 40 #ifdef WLAN_SUPPORT_TWT 41 42 #include <wmi_unified_twt_param.h> 43 /* Max TWT sessions per peer (supported by fw) */ 44 #define TWT_PEER_MAX_SESSIONS 1 45 46 #endif /* WLAN_SUPPORT_TWT */ 47 48 #define MAX_NUM_CHAINS 2 49 50 #define MAX_MIB_STATS 1 51 52 #define IS_MSB_SET(__num) ((__num) & BIT(31)) 53 #define IS_LSB_SET(__num) ((__num) & BIT(0)) 54 55 #define VDEV_ALL 0xFF 56 57 /** 58 * enum stats_req_type - enum indicating bit position of various stats type in 59 * request map 60 * @TYPE_CONNECTION_TX_POWER: tx power was requested 61 * @TYPE_STATION_STATS: station stats was requested 62 * @TYPE_PEER_STATS: peer stats was requested 63 * @TYPE_MIB_STATS: MIB stats was requested 64 * @TYPE_PEER_STATS_INFO_EXT: peer stats info ext was requested 65 * @TYPE_CONGESTION_STATS: congestion stats was requested 66 * @TYPE_BIG_DATA_STATS: big data stats was requested 67 * @TYPE_MAX: maximum value 68 */ 69 enum stats_req_type { 70 TYPE_CONNECTION_TX_POWER = 0, 71 TYPE_STATION_STATS, 72 TYPE_PEER_STATS, 73 TYPE_MIB_STATS, 74 TYPE_PEER_STATS_INFO_EXT, 75 TYPE_CONGESTION_STATS, 76 TYPE_BIG_DATA_STATS, 77 TYPE_MAX, 78 }; 79 80 /** 81 * enum tx_rate_info - tx rate flags 82 * @TX_RATE_LEGACY: Legacy rates 83 * @TX_RATE_HT20: HT20 rates 84 * @TX_RATE_HT40: HT40 rates 85 * @TX_RATE_SGI: Rate with Short guard interval 86 * @TX_RATE_LGI: Rate with Long guard interval 87 * @TX_RATE_VHT20: VHT 20 rates 88 * @TX_RATE_VHT40: VHT 40 rates 89 * @TX_RATE_VHT80: VHT 80 rates 90 * @TX_RATE_HE20: HE 20 rates 91 * @TX_RATE_HE40: HE 40 rates 92 * @TX_RATE_HE80: HE 80 rates 93 * @TX_RATE_HE160: HE 160 rates 94 * @TX_RATE_VHT160: VHT 160 rates 95 * @TX_RATE_EHT20: EHT 20 rates 96 * @TX_RATE_EHT40: EHT 40 rates 97 * @TX_RATE_EHT80: EHT 80 rates 98 * @TX_RATE_EHT160: EHT 160 rates 99 * @TX_RATE_EHT320: EHT 320 rates 100 */ 101 enum tx_rate_info { 102 TX_RATE_LEGACY = 0x1, 103 TX_RATE_HT20 = 0x2, 104 TX_RATE_HT40 = 0x4, 105 TX_RATE_SGI = 0x8, 106 TX_RATE_LGI = 0x10, 107 TX_RATE_VHT20 = 0x20, 108 TX_RATE_VHT40 = 0x40, 109 TX_RATE_VHT80 = 0x80, 110 TX_RATE_HE20 = 0x100, 111 TX_RATE_HE40 = 0x200, 112 TX_RATE_HE80 = 0x400, 113 TX_RATE_HE160 = 0x800, 114 TX_RATE_VHT160 = 0x1000, 115 TX_RATE_EHT20 = 0x2000, 116 TX_RATE_EHT40 = 0x4000, 117 TX_RATE_EHT80 = 0x8000, 118 TX_RATE_EHT160 = 0x10000, 119 TX_RATE_EHT320 = 0x20000, 120 }; 121 122 /** 123 * enum txrate_gi - Guard Intervals 124 * @TXRATE_GI_0_8_US: guard interval 0.8 us 125 * @TXRATE_GI_0_4_US: guard interval 0.4 us for legacy 126 * @TXRATE_GI_1_6_US: guard interval 1.6 us 127 * @TXRATE_GI_3_2_US: guard interval 3.2 us 128 */ 129 enum txrate_gi { 130 TXRATE_GI_0_8_US = 0, 131 TXRATE_GI_0_4_US, 132 TXRATE_GI_1_6_US, 133 TXRATE_GI_3_2_US, 134 }; 135 136 /** 137 * struct wake_lock_stats - wake lock stats structure 138 * @ucast_wake_up_count: Unicast wakeup count 139 * @bcast_wake_up_count: Broadcast wakeup count 140 * @ipv4_mcast_wake_up_count: ipv4 multicast wakeup count 141 * @ipv6_mcast_wake_up_count: ipv6 multicast wakeup count 142 * @ipv6_mcast_ra_stats: ipv6 multicast ra stats 143 * @ipv6_mcast_ns_stats: ipv6 multicast ns stats 144 * @ipv6_mcast_na_stats: ipv6 multicast na stats 145 * @icmpv4_count: ipv4 icmp packet count 146 * @icmpv6_count: ipv6 icmp packet count 147 * @rssi_breach_wake_up_count: rssi breach wakeup count 148 * @low_rssi_wake_up_count: low rssi wakeup count 149 * @gscan_wake_up_count: gscan wakeup count 150 * @pno_complete_wake_up_count: pno complete wakeup count 151 * @pno_match_wake_up_count: pno match wakeup count 152 * @oem_response_wake_up_count: oem response wakeup count 153 * @uc_drop_wake_up_count: local data uc drop wakeup count 154 * @fatal_event_wake_up_count: fatal event wakeup count 155 * @pwr_save_fail_detected: pwr save fail detected wakeup count 156 * @scan_11d: 11d scan wakeup count 157 * @mgmt_assoc: association request management frame 158 * @mgmt_disassoc: disassociation management frame 159 * @mgmt_assoc_resp: association response management frame 160 * @mgmt_reassoc: reassociate request management frame 161 * @mgmt_reassoc_resp: reassociate response management frame 162 * @mgmt_auth: authentication management frame 163 * @mgmt_deauth: deauthentication management frame 164 * @mgmt_action: action management frame 165 */ 166 struct wake_lock_stats { 167 uint32_t ucast_wake_up_count; 168 uint32_t bcast_wake_up_count; 169 uint32_t ipv4_mcast_wake_up_count; 170 uint32_t ipv6_mcast_wake_up_count; 171 uint32_t ipv6_mcast_ra_stats; 172 uint32_t ipv6_mcast_ns_stats; 173 uint32_t ipv6_mcast_na_stats; 174 uint32_t icmpv4_count; 175 uint32_t icmpv6_count; 176 uint32_t rssi_breach_wake_up_count; 177 uint32_t low_rssi_wake_up_count; 178 uint32_t gscan_wake_up_count; 179 uint32_t pno_complete_wake_up_count; 180 uint32_t pno_match_wake_up_count; 181 uint32_t oem_response_wake_up_count; 182 uint32_t uc_drop_wake_up_count; 183 uint32_t fatal_event_wake_up_count; 184 uint32_t pwr_save_fail_detected; 185 uint32_t scan_11d; 186 uint32_t mgmt_assoc; 187 uint32_t mgmt_disassoc; 188 uint32_t mgmt_assoc_resp; 189 uint32_t mgmt_reassoc; 190 uint32_t mgmt_reassoc_resp; 191 uint32_t mgmt_auth; 192 uint32_t mgmt_deauth; 193 uint32_t mgmt_action; 194 }; 195 196 struct stats_event; 197 198 /** 199 * struct big_data_stats_event - big data stats event param 200 * @vdev_id: vdev id 201 * @tsf_out_of_sync: tsf out of sync 202 * @ani_level: ani level 203 * @last_data_tx_pwr: tx pwr last data frm 204 * @target_power_dsss: tx power dsss 205 * @target_power_ofdm: target power ofdm 206 * @last_tx_data_rix: rx lateset data frame 207 * @last_tx_data_rate_kbps: tx latest data frame 208 */ 209 struct big_data_stats_event { 210 uint32_t vdev_id; 211 uint32_t tsf_out_of_sync; 212 int32_t ani_level; 213 uint32_t last_data_tx_pwr; 214 uint32_t target_power_dsss; 215 uint32_t target_power_ofdm; 216 uint32_t last_tx_data_rix; 217 uint32_t last_tx_data_rate_kbps; 218 }; 219 220 /** 221 * struct medium_assess_data - medium assess data from firmware 222 * @part1_valid: the flag for part1 data, include cycle_count, 223 * rx_clear_count and tx_frame_count 224 * @cycle_count: accumulative cycle count (total time) 225 * @rx_clear_count: accumulative rx clear count (busy time) 226 * @tx_frame_count: accumulative tx frame count (total time) 227 * @part2_valid: the flag for part2 data, include my_rx_count 228 * @my_rx_count: my RX count 229 */ 230 struct medium_assess_data { 231 bool part1_valid; 232 uint32_t cycle_count; 233 uint32_t rx_clear_count; 234 uint32_t tx_frame_count; 235 bool part2_valid; 236 uint32_t my_rx_count; 237 }; 238 239 /** 240 * struct request_info: details of each request 241 * @cookie: identifier for os_if request 242 * @u: unified data type for callback to process tx power/peer rssi/ 243 * station stats/mib stats/peer stats request when response comes and 244 * congestion notification callback. 245 * @vdev_id: vdev_id of request 246 * @pdev_id: pdev_id of request 247 * @peer_mac_addr: peer mac address 248 * @ml_vdev_info: mlo_stats_vdev_params structure 249 * @ml_peer_mac_addr: Array of ml peer mac addresses 250 */ 251 struct request_info { 252 void *cookie; 253 union { 254 void (*get_tx_power_cb)(int tx_power, void *cookie); 255 void (*get_peer_rssi_cb)(struct stats_event *ev, void *cookie); 256 void (*get_station_stats_cb)(struct stats_event *ev, 257 void *cookie); 258 void (*get_mib_stats_cb)(struct stats_event *ev, 259 void *cookie); 260 void (*get_peer_stats_cb)(struct stats_event *ev, 261 void *cookie); 262 void (*congestion_notif_cb)(uint8_t vdev_id, 263 struct medium_assess_data *data, 264 bool last); 265 #ifdef WLAN_FEATURE_BIG_DATA_STATS 266 void (*get_big_data_stats_cb)(struct big_data_stats_event *ev, 267 void *cookie); 268 #endif 269 } u; 270 uint32_t vdev_id; 271 uint32_t pdev_id; 272 uint8_t peer_mac_addr[QDF_MAC_ADDR_SIZE]; 273 #ifdef WLAN_FEATURE_11BE_MLO 274 struct mlo_stats_vdev_params ml_vdev_info; 275 uint8_t ml_peer_mac_addr[WLAN_UMAC_MLO_MAX_VDEVS][QDF_MAC_ADDR_SIZE]; 276 #endif 277 }; 278 279 /** 280 * struct pending_stats_requests: details of pending requests 281 * @type_map: map indicating type of outstanding requests 282 * @req: array of info for outstanding request of each type 283 */ 284 struct pending_stats_requests { 285 uint32_t type_map; 286 struct request_info req[TYPE_MAX]; 287 }; 288 289 /** 290 * struct cca_stats - cca stats 291 * @congestion: the congestion percentage = (busy_time/total_time)*100 292 * for the interval from when the vdev was started to the current time 293 * (or the time at which the vdev was stopped). 294 */ 295 struct cca_stats { 296 uint32_t congestion; 297 }; 298 299 /** 300 * struct psoc_mc_cp_stats: psoc specific stats 301 * @is_cp_stats_suspended: is cp stats suspended or not 302 * @pending: details of pending requests 303 * @wow_unspecified_wake_up_count: number of non-wow related wake ups 304 * @wow_stats: wake_lock stats for vdev 305 * @big_data_fw_support_enable: big data feature supported by fw or not 306 */ 307 struct psoc_mc_cp_stats { 308 bool is_cp_stats_suspended; 309 struct pending_stats_requests pending; 310 uint32_t wow_unspecified_wake_up_count; 311 struct wake_lock_stats wow_stats; 312 #ifdef WLAN_FEATURE_BIG_DATA_STATS 313 bool big_data_fw_support_enable; 314 #endif 315 }; 316 317 /** 318 * struct pdev_mc_cp_extd_stats - pdev extd stats 319 * @pdev_id: pdev id 320 * @my_rx_count: What portion of time, as measured by the MAC HW clock was 321 * occupied, by receiving PPDUs addressed to one of the vdevs 322 * within this pdev. 323 * @rx_matched_11ax_msdu_cnt: number of Rx 11ax MSDUs with matching BSS color 324 * counter updated at EOP (end of packet) 325 * @rx_other_11ax_msdu_cnt: number of Rx 11ax MSDUs with other BSS color counter 326 * updated at EOP (end of packet) 327 */ 328 struct pdev_mc_cp_extd_stats { 329 uint32_t pdev_id; 330 uint32_t my_rx_count; 331 uint32_t rx_matched_11ax_msdu_cnt; 332 uint32_t rx_other_11ax_msdu_cnt; 333 }; 334 335 /* Max supported bandwidth is 320Mhz, so max 16 subbands for 20Mhz */ 336 #define MAX_WIDE_BAND_SCAN_CHAN 16 337 338 /** 339 * struct wide_band_scan_chan_info - wide band scan channel info 340 * @vdev_id: vdev id 341 * @num_chan: number of channels (for each subbands fo 20Mhz) 342 * @is_wide_band_scan: wide band scan or not 343 * @cca_busy_subband_info: CCA busy for each possible 20Mhz subbands 344 * of the wideband scan channel 345 */ 346 struct wide_band_scan_chan_info { 347 uint32_t vdev_id; 348 uint8_t num_chan; 349 bool is_wide_band_scan; 350 uint32_t cca_busy_subband_info[MAX_WIDE_BAND_SCAN_CHAN]; 351 }; 352 353 /** 354 * struct channel_status 355 * @channel_freq: Channel freq 356 * @noise_floor: Noise Floor value 357 * @rx_clear_count: rx clear count 358 * @cycle_count: cycle count 359 * @chan_tx_pwr_range: channel tx power per range in 0.5dBm steps 360 * @chan_tx_pwr_throughput: channel tx power per throughput 361 * @rx_frame_count: rx frame count (cumulative) 362 * @bss_rx_cycle_count: BSS rx cycle count 363 * @rx_11b_mode_data_duration: b-mode data rx time (units are microseconds) 364 * @tx_frame_count: BSS tx cycle count 365 * @mac_clk_mhz: sample frequency 366 * @channel_id: channel index 367 * @cmd_flags: indicate which stat event is this status coming from 368 * @subband_info: wide band scan channel info 369 */ 370 struct channel_status { 371 uint32_t channel_freq; 372 uint32_t noise_floor; 373 uint32_t rx_clear_count; 374 uint32_t cycle_count; 375 uint32_t chan_tx_pwr_range; 376 uint32_t chan_tx_pwr_throughput; 377 uint32_t rx_frame_count; 378 uint32_t bss_rx_cycle_count; 379 uint32_t rx_11b_mode_data_duration; 380 uint32_t tx_frame_count; 381 uint32_t mac_clk_mhz; 382 uint32_t channel_id; 383 uint32_t cmd_flags; 384 struct wide_band_scan_chan_info subband_info; 385 }; 386 387 /** 388 * struct per_channel_stats 389 * @total_channel: total number of be scanned channel 390 * @channel_status_list: channel status info store in this array 391 */ 392 struct per_channel_stats { 393 uint8_t total_channel; 394 struct channel_status 395 channel_status_list[NUM_CHANNELS]; 396 }; 397 398 /** 399 * struct pdev_mc_cp_stats: pdev specific stats 400 * @max_pwr: max tx power for pdev 401 * @pdev_id: pdev id 402 * @rx_clear_count: accumulative rx clear count (busy time) of pdev 403 * @cycle_count: accumulative cycle count (total time) of pdev 404 * @tx_frame_count: accumulative tx frame count (total time) of pdev 405 * @chan_stats: per channel info stats 406 */ 407 struct pdev_mc_cp_stats { 408 int32_t max_pwr; 409 uint32_t pdev_id; 410 uint32_t rx_clear_count; 411 uint32_t cycle_count; 412 uint32_t tx_frame_count; 413 struct per_channel_stats chan_stats; 414 }; 415 416 /** 417 * struct summary_stats - summary stats 418 * @snr: snr of vdev 419 * @rssi: rssi of vdev 420 * @retry_cnt: retry count 421 * @multiple_retry_cnt: multiple_retry_cnt 422 * @tx_frm_cnt: num of tx frames 423 * @rx_frm_cnt: num of rx frames 424 * @frm_dup_cnt: duplicate frame count 425 * @fail_cnt: fail count 426 * @rts_fail_cnt: rts fail count 427 * @ack_fail_cnt: ack fail count 428 * @rts_succ_cnt: rts success count 429 * @rx_discard_cnt: rx frames discarded 430 * @rx_error_cnt: rx frames with error 431 */ 432 struct summary_stats { 433 uint32_t snr; 434 int8_t rssi; 435 uint32_t retry_cnt[4]; 436 uint32_t multiple_retry_cnt[4]; 437 uint32_t tx_frm_cnt[4]; 438 uint32_t rx_frm_cnt; 439 uint32_t frm_dup_cnt; 440 uint32_t fail_cnt[4]; 441 uint32_t rts_fail_cnt; 442 uint32_t ack_fail_cnt; 443 uint32_t rts_succ_cnt; 444 uint32_t rx_discard_cnt; 445 uint32_t rx_error_cnt; 446 }; 447 448 /** 449 * struct pmf_bcn_protect_stats - pmf bcn protect stats param 450 * @pmf_bcn_stats_valid: bcn protect stats received from fw are valid or not 451 * @igtk_mic_fail_cnt: MIC failure count of management packets using IGTK 452 * @igtk_replay_cnt: Replay detection count of management packets using IGTK 453 * @bcn_mic_fail_cnt: MIC failure count of beacon packets using BIGTK 454 * @bcn_replay_cnt: Replay detection count of beacon packets using BIGTK 455 */ 456 struct pmf_bcn_protect_stats { 457 bool pmf_bcn_stats_valid; 458 uint32_t igtk_mic_fail_cnt; 459 uint32_t igtk_replay_cnt; 460 uint32_t bcn_mic_fail_cnt; 461 uint32_t bcn_replay_cnt; 462 }; 463 464 /** 465 * struct vdev_summary_extd_stats - vdev summary extended stats 466 * @vdev_id: vdev_id of the event 467 * @is_mlo_vdev_active: is the mlo vdev currently active 468 * @vdev_tx_power: vdev tx power 469 */ 470 struct vdev_summary_extd_stats { 471 uint8_t vdev_id; 472 bool is_mlo_vdev_active; 473 uint32_t vdev_tx_power; 474 }; 475 476 /** 477 * struct vdev_mc_cp_stats - vdev specific stats 478 * @cca: cca stats 479 * @tx_rate_flags: tx rate flags (enum tx_rate_info) 480 * @chain_rssi: chain rssi 481 * @vdev_summary_stats: vdev's summary stats 482 * @pmf_bcn_stats: pmf beacon protect stats 483 * @vdev_extd_stats: vdev summary extended stats 484 */ 485 struct vdev_mc_cp_stats { 486 struct cca_stats cca; 487 uint32_t tx_rate_flags; 488 int8_t chain_rssi[MAX_NUM_CHAINS]; 489 struct summary_stats vdev_summary_stats; 490 struct pmf_bcn_protect_stats pmf_bcn_stats; 491 struct vdev_summary_extd_stats vdev_extd_stats; 492 }; 493 494 /** 495 * struct peer_extd_stats - Peer extension statistics 496 * @peer_macaddr: peer MAC address 497 * @rx_duration: lower 32 bits of rx duration in microseconds 498 * @peer_tx_bytes: Total TX bytes (including dot11 header) sent to peer 499 * @peer_rx_bytes: Total RX bytes (including dot11 header) received from peer 500 * @last_tx_rate_code: last TX ratecode 501 * @last_tx_power: TX power used by peer - units are 0.5 dBm 502 * @rx_mc_bc_cnt: Total number of received multicast & broadcast data frames 503 * corresponding to this peer, 1 in the MSB of rx_mc_bc_cnt represents a 504 * valid data 505 */ 506 struct peer_extd_stats { 507 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 508 uint32_t rx_duration; 509 uint32_t peer_tx_bytes; 510 uint32_t peer_rx_bytes; 511 uint32_t last_tx_rate_code; 512 int32_t last_tx_power; 513 uint32_t rx_mc_bc_cnt; 514 }; 515 516 /** 517 * struct peer_mc_cp_stats - peer specific stats 518 * @tx_rate: tx rate 519 * @rx_rate: rx rate 520 * @peer_rssi: rssi 521 * @peer_macaddr: mac address 522 * @extd_stats: Pointer to peer extended stats 523 * @adv_stats: Pointer to peer adv (extd2) stats 524 * @twt_param: Pointer to peer twt session parameters 525 */ 526 struct peer_mc_cp_stats { 527 uint32_t tx_rate; 528 uint32_t rx_rate; 529 int8_t peer_rssi; 530 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 531 struct peer_extd_stats *extd_stats; 532 struct peer_adv_mc_cp_stats *adv_stats; 533 #ifdef WLAN_SUPPORT_TWT 534 struct wmi_host_twt_session_stats_info twt_param[TWT_PEER_MAX_SESSIONS]; 535 #endif 536 }; 537 538 /** 539 * struct peer_adv_mc_cp_stats - peer specific adv stats 540 * @peer_macaddr: mac address 541 * @fcs_count: fcs count 542 * @rx_bytes: rx bytes 543 * @rx_count: rx count 544 */ 545 struct peer_adv_mc_cp_stats { 546 uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE]; 547 uint32_t fcs_count; 548 uint32_t rx_count; 549 uint64_t rx_bytes; 550 }; 551 552 #ifdef WLAN_FEATURE_MIB_STATS 553 /** 554 * struct dot11_counters - mib group containing attributes that are MAC counters 555 * @tx_frags: successfully transmitted fragments 556 * @group_tx_frames: transmitted group addressed frames 557 * @failed_cnt: MSDUs not transmitted successfully 558 * @rx_frags: fragments successfully received 559 * @group_rx_frames: group addressed frames received 560 * @fcs_error_cnt: FCS errors detected 561 * @tx_frames: frames successfully transmitted 562 */ 563 struct dot11_counters { 564 uint32_t tx_frags; 565 uint32_t group_tx_frames; 566 uint32_t failed_cnt; 567 uint32_t rx_frags; 568 uint32_t group_rx_frames; 569 uint32_t fcs_error_cnt; 570 uint32_t tx_frames; 571 }; 572 573 /** 574 * struct dot11_mac_statistics - mib stats information on the operation of MAC 575 * @retry_cnt: retries done by mac for successful transmission 576 * @multi_retry_cnt: multiple retries done before successful transmission 577 * @frame_dup_cnt: duplicate no of frames 578 * @rts_success_cnt: number of CTS received (in response to RTS) 579 * @rts_fail_cnt: number of CTS not received (in response to RTS) 580 * @tx_ack_fail_cnt: number of ACK not received 581 */ 582 struct dot11_mac_statistics { 583 uint32_t retry_cnt; 584 uint32_t multi_retry_cnt; 585 uint32_t frame_dup_cnt; 586 uint32_t rts_success_cnt; 587 uint32_t rts_fail_cnt; 588 uint32_t tx_ack_fail_cnt; 589 }; 590 591 /** 592 * struct dot11_qos_counters - qos mac counters 593 * @qos_tx_frag_cnt: transmitted QoS fragments 594 * @qos_failed_cnt: failed Qos fragments 595 * @qos_retry_cnt: Qos frames transmitted after retransmissions 596 * @qos_multi_retry_cnt: Qos frames transmitted after more than 597 * one retransmissions 598 * @qos_frame_dup_cnt: duplicate frames 599 * @qos_rts_success_cnt: number of CTS received (in response to RTS) 600 * @qos_rts_fail_cnt: number of CTS not received (in response to RTS) 601 * @tx_qos_ack_fail_cnt_up: number of ACK not received 602 * (in response to Qos frame) 603 * @qos_rx_frag_cnt: number of received MPDU of type Data 604 * @qos_tx_frame_cnt: number of transmitted MPDU of type Data 605 * @qos_discarded_frame_cnt: total Discarded MSDUs 606 * @qos_mpdu_rx_cnt: total received MPDU 607 * @qos_retries_rx_cnt: received MPDU with retry bit equal to 1 608 */ 609 struct dot11_qos_counters { 610 uint32_t qos_tx_frag_cnt; 611 uint32_t qos_failed_cnt; 612 uint32_t qos_retry_cnt; 613 uint32_t qos_multi_retry_cnt; 614 uint32_t qos_frame_dup_cnt; 615 uint32_t qos_rts_success_cnt; 616 uint32_t qos_rts_fail_cnt; 617 uint32_t tx_qos_ack_fail_cnt_up; 618 uint32_t qos_rx_frag_cnt; 619 uint32_t qos_tx_frame_cnt; 620 uint32_t qos_discarded_frame_cnt; 621 uint32_t qos_mpdu_rx_cnt; 622 uint32_t qos_retries_rx_cnt; 623 }; 624 625 /** 626 * struct dot11_rsna_stats - mib rsn stats 627 * @rm_ccmp_replays: received robust management CCMP MPDUs discarded 628 * by the replay mechanism 629 * @tkip_icv_err: TKIP ICV errors encountered 630 * @tkip_replays: TKIP replay errors detected 631 * @ccmp_decrypt_err: MPDUs discarded by the CCMP decryption algorithm 632 * @ccmp_replays: received CCMP MPDUs discarded by the replay mechanism 633 * @cmac_icv_err: MPDUs discarded by the CMAC integrity check algorithm 634 * @cmac_replays: MPDUs discarded by the CMAC replay errors 635 */ 636 struct dot11_rsna_stats { 637 uint32_t rm_ccmp_replays; 638 uint32_t tkip_icv_err; 639 uint32_t tkip_replays; 640 uint32_t ccmp_decrypt_err; 641 uint32_t ccmp_replays; 642 uint32_t cmac_icv_err; 643 uint32_t cmac_replays; 644 }; 645 646 /** 647 * struct dot11_counters_group3 - dot11 group3 stats 648 * @tx_ampdu_cnt: transmitted AMPDUs 649 * @tx_mpdus_in_ampdu_cnt: number of MPDUs in the A-MPDU in transmitted AMPDUs 650 * @tx_octets_in_ampdu_cnt: octets in the transmitted A-MPDUs 651 * @ampdu_rx_cnt: received A-MPDU 652 * @mpdu_in_rx_ampdu_cnt: MPDUs received in the A-MPDU 653 * @rx_octets_in_ampdu_cnt: octets in the received A-MPDU 654 * @rx_ampdu_deli_crc_err_cnt: number of MPDUs delimiter with CRC error 655 */ 656 struct dot11_counters_group3 { 657 uint32_t tx_ampdu_cnt; 658 uint32_t tx_mpdus_in_ampdu_cnt; 659 uint64_t tx_octets_in_ampdu_cnt; 660 uint32_t ampdu_rx_cnt; 661 uint32_t mpdu_in_rx_ampdu_cnt; 662 uint64_t rx_octets_in_ampdu_cnt; 663 uint32_t rx_ampdu_deli_crc_err_cnt; 664 }; 665 666 /** 667 * struct mib_stats_metrics - mib stats counters 668 * @mib_counters: dot11Counters group 669 * @mib_mac_statistics: dot11MACStatistics group 670 * @mib_qos_counters: dot11QoSCounters group 671 * @mib_rsna_stats: dot11RSNAStats group 672 * @mib_counters_group3: dot11CountersGroup3 group 673 */ 674 struct mib_stats_metrics { 675 struct dot11_counters mib_counters; 676 struct dot11_mac_statistics mib_mac_statistics; 677 struct dot11_qos_counters mib_qos_counters; 678 struct dot11_rsna_stats mib_rsna_stats; 679 struct dot11_counters_group3 mib_counters_group3; 680 }; 681 #endif 682 683 /** 684 * struct congestion_stats_event: congestion stats event param 685 * @vdev_id: vdev_id of the event 686 * @congestion: the congestion percentage 687 */ 688 struct congestion_stats_event { 689 uint8_t vdev_id; 690 uint32_t congestion; 691 }; 692 693 /** 694 * struct summary_stats_event - summary_stats event param 695 * @vdev_id: vdev_id of the event 696 * @stats: summary stats 697 */ 698 struct summary_stats_event { 699 uint8_t vdev_id; 700 struct summary_stats stats; 701 }; 702 703 /** 704 * struct chain_rssi_event - chain_rssi event param 705 * @vdev_id: vdev_id of the event 706 * @chain_rssi: chain_rssi 707 */ 708 struct chain_rssi_event { 709 uint8_t vdev_id; 710 int8_t chain_rssi[MAX_NUM_CHAINS]; 711 }; 712 713 /** 714 * struct peer_stats_info_ext_event - peer extended stats info 715 * @peer_macaddr: MAC address 716 * @tx_packets: packets transmitted to this station 717 * @tx_bytes: bytes transmitted to this station 718 * @rx_packets: packets received from this station 719 * @rx_bytes: bytes received from this station 720 * @tx_retries: cumulative retry counts 721 * @tx_failed: the number of failed frames 722 * @tx_succeed: the number of succeed frames 723 * @rssi: the signal strength 724 * @tx_rate: last used tx bitrate (kbps) 725 * @tx_rate_code: last tx rate code (last_tx_rate_code of wmi_peer_stats_info) 726 * @rx_rate: last used rx bitrate (kbps) 727 * @rx_rate_code: last rx rate code (last_rx_rate_code of wmi_peer_stats_info) 728 * @peer_rssi_per_chain: the average value of RSSI (dbm) per chain 729 * @num_tx_rate_counts: Num tx rate count for current peer 730 * @num_rx_rate_counts: Num rx rate count for current peer 731 * @tx_pkt_per_mcs: Number of tx packets for each MCS 732 * @rx_pkt_per_mcs: Number of rx packets for each MCS 733 */ 734 struct peer_stats_info_ext_event { 735 struct qdf_mac_addr peer_macaddr; 736 uint32_t tx_packets; 737 uint64_t tx_bytes; 738 uint32_t rx_packets; 739 uint64_t rx_bytes; 740 uint32_t tx_retries; 741 uint32_t tx_failed; 742 uint32_t tx_succeed; 743 int32_t rssi; 744 uint32_t tx_rate; 745 uint32_t tx_rate_code; 746 uint32_t rx_rate; 747 uint32_t rx_rate_code; 748 int32_t peer_rssi_per_chain[WMI_MAX_CHAINS]; 749 uint32_t num_tx_rate_counts; 750 uint32_t num_rx_rate_counts; 751 uint32_t *tx_pkt_per_mcs; 752 uint32_t *rx_pkt_per_mcs; 753 }; 754 755 /** 756 * struct stats_event - parameters populated by stats event 757 * @num_pdev_stats: num pdev stats 758 * @pdev_stats: if populated array indicating pdev stats (index = pdev_id) 759 * @num_pdev_extd_stats: num pdev extended stats 760 * @pdev_extd_stats: if populated array indicating pdev extended stats 761 * (index = pdev_id) 762 * @num_peer_stats: num peer stats 763 * @peer_stats: if populated array indicating peer stats 764 * @peer_adv_stats: if populated, indicates peer adv (extd2) stats 765 * @num_peer_adv_stats: number of peer adv (extd2) stats 766 * @num_peer_extd_stats: Num peer extended stats 767 * @peer_extended_stats: Peer extended stats 768 * @cca_stats: if populated indicates congestion stats 769 * @num_summary_stats: number of summary stats 770 * @vdev_summary_stats: if populated indicates array of summary stats per vdev 771 * @num_mib_stats: number of mib stats 772 * @mib_stats: if populated indicates array of mib stats per vdev 773 * @num_chain_rssi_stats: number of chain rssi stats 774 * @vdev_chain_rssi: if populated indicates array of chain rssi per vdev 775 * @tx_rate: tx rate (kbps) 776 * @rx_rate: rx rate (kbps) 777 * @tx_rate_flags: tx rate flags, (enum tx_rate_info) 778 * @last_event: The LSB indicates if the event is the last event or not and the 779 * MSB indicates if this feature is supported by FW or not. 780 * @mac_seq_num: sequence number of event when fw update to host 781 * @num_peer_stats_info_ext: number of peer extended stats info 782 * @peer_stats_info_ext: peer extended stats info 783 * @bcn_protect_stats: pmf bcn protect stats 784 * @num_vdev_extd_stats: number of vdev extended stats 785 * @vdev_extd_stats: if populated indicates array of ext summary stats per vdev 786 */ 787 struct stats_event { 788 uint32_t num_pdev_stats; 789 struct pdev_mc_cp_stats *pdev_stats; 790 uint32_t num_pdev_extd_stats; 791 struct pdev_mc_cp_extd_stats *pdev_extd_stats; 792 uint32_t num_peer_stats; 793 struct peer_mc_cp_stats *peer_stats; 794 uint32_t num_peer_adv_stats; 795 struct peer_adv_mc_cp_stats *peer_adv_stats; 796 uint32_t num_peer_extd_stats; 797 struct peer_extd_stats *peer_extended_stats; 798 struct congestion_stats_event *cca_stats; 799 uint32_t num_summary_stats; 800 struct summary_stats_event *vdev_summary_stats; 801 #ifdef WLAN_FEATURE_MIB_STATS 802 uint32_t num_mib_stats; 803 struct mib_stats_metrics *mib_stats; 804 #endif 805 uint32_t num_chain_rssi_stats; 806 struct chain_rssi_event *vdev_chain_rssi; 807 uint32_t tx_rate; 808 uint32_t rx_rate; 809 enum tx_rate_info tx_rate_flags; 810 uint32_t last_event; 811 uint8_t mac_seq_num; 812 uint32_t num_peer_stats_info_ext; 813 struct peer_stats_info_ext_event *peer_stats_info_ext; 814 struct pmf_bcn_protect_stats bcn_protect_stats; 815 uint32_t num_vdev_extd_stats; 816 struct vdev_summary_extd_stats *vdev_extd_stats; 817 }; 818 819 /** 820 * struct peer_stats_request_params - peer stats request parameter 821 * @request_type: request type, one peer or all peers of the vdev 822 * @vdev_id: vdev id 823 * @peer_mac_addr: peer mac address, omitted if request type is all peers 824 * @reset_after_request: whether reset stats after request 825 */ 826 struct peer_stats_request_params { 827 uint32_t request_type; 828 uint32_t vdev_id; 829 uint8_t peer_mac_addr[QDF_MAC_ADDR_SIZE]; 830 uint32_t reset_after_request; 831 }; 832 833 /** 834 * struct wmi_host_peer_stats_info - WMI peer stats info 835 * @peer_macaddr: peer mac address 836 * @tx_bytes: tx_bytes 837 * @tx_packets: tx packets 838 * @rx_bytes: rx_bytes 839 * @rx_packets: rx packets 840 * @tx_retries: tx retries of MPDU 841 * @tx_failed: tx failed MPDU 842 * @last_tx_rate_code: rate code of the last tx 843 * @last_rx_rate_code: rate code of the last rx 844 * @last_tx_bitrate_kbps: bitrate in bps of the last tx 845 * @last_rx_bitrate_kbps: bitrate in bps of the last rx 846 * @peer_rssi: peer rssi 847 * @tx_succeed: tx succeed MPDU 848 * @peer_rssi_per_chain: peer rssi per chain 849 * @num_tx_rate_counts: Num tx rate count for current peer 850 * @num_rx_rate_counts: Num rx rate count for current peer 851 * @tx_pkt_per_mcs: Number of tx rate counts for each MCS 852 * @rx_pkt_per_mcs: Number of rx rate counts for each MCS 853 */ 854 typedef struct { 855 struct qdf_mac_addr peer_macaddr; 856 uint64_t tx_bytes; 857 uint32_t tx_packets; 858 uint64_t rx_bytes; 859 uint32_t rx_packets; 860 uint32_t tx_retries; 861 uint32_t tx_failed; 862 uint32_t last_tx_rate_code; 863 uint32_t last_rx_rate_code; 864 uint32_t last_tx_bitrate_kbps; 865 uint32_t last_rx_bitrate_kbps; 866 int32_t peer_rssi; 867 uint32_t tx_succeed; 868 int32_t peer_rssi_per_chain[WMI_MAX_CHAINS]; 869 uint32_t num_tx_rate_counts; 870 uint32_t num_rx_rate_counts; 871 uint32_t *tx_pkt_per_mcs; 872 uint32_t *rx_pkt_per_mcs; 873 } wmi_host_peer_stats_info; 874 875 #endif /* __WLAN_CP_STATS_MC_DEFS_H__ */ 876