1 /* 2 * Copyright (c) 2016-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 /** 20 * @file cdp_txrx_stats_struct.h 21 * @brief Define the host data path stats API functions 22 * called by the host control SW and the OS interface module 23 */ 24 #ifndef _CDP_TXRX_STATS_STRUCT_H_ 25 #define _CDP_TXRX_STATS_STRUCT_H_ 26 27 #include <qdf_types.h> 28 #include <cdp_txrx_hist_struct.h> 29 30 #define TXRX_STATS_LEVEL_OFF 0 31 #define TXRX_STATS_LEVEL_BASIC 1 32 #define TXRX_STATS_LEVEL_FULL 2 33 34 #define BSS_CHAN_INFO_READ 1 35 #define BSS_CHAN_INFO_READ_AND_CLEAR 2 36 37 #define TX_FRAME_TYPE_DATA 0 38 #define TX_FRAME_TYPE_MGMT 1 39 #define TX_FRAME_TYPE_BEACON 2 40 41 #ifndef TXRX_STATS_LEVEL 42 #define TXRX_STATS_LEVEL TXRX_STATS_LEVEL_BASIC 43 #endif 44 45 /* 1 additional MCS is for invalid values */ 46 #define MAX_MCS (12 + 1) 47 #define MAX_MCS_11A 8 48 #define MAX_MCS_11B 7 49 #define MAX_MCS_11AC 12 50 /* 1 additional GI is for invalid values */ 51 #define MAX_GI (4 + 1) 52 #define SS_COUNT 8 53 #define MAX_BW 7 54 #define MAX_RECEPTION_TYPES 4 55 56 #define MAX_TRANSMIT_TYPES 9 57 58 #define MAX_USER_POS 8 59 #define MAX_MU_GROUP_ID 64 60 #define MAX_RU_LOCATIONS 6 61 #define RU_26 1 62 #define RU_52 2 63 #define RU_106 4 64 #define RU_242 9 65 #define RU_484 18 66 #define RU_996 37 67 68 /* WME stream classes */ 69 #define WME_AC_BE 0 /* best effort */ 70 #define WME_AC_BK 1 /* background */ 71 #define WME_AC_VI 2 /* video */ 72 #define WME_AC_VO 3 /* voice */ 73 #define WME_AC_MAX 4 /* MAX AC Value */ 74 75 #define CDP_MAX_RX_RINGS 4 /* max rx rings */ 76 #define CDP_MAX_TX_COMP_RINGS 3 /* max tx completion rings */ 77 #define CDP_MAX_TX_TQM_STATUS 9 /* max tx tqm completion status */ 78 #define CDP_MAX_TX_HTT_STATUS 7 /* max tx htt completion status */ 79 80 /* 81 * Max of TxRx context 82 */ 83 #define CDP_MAX_TXRX_CTX CDP_MAX_RX_RINGS 84 85 /* TID level VoW stats macros 86 * to add and get stats 87 */ 88 #define PFLOW_TXRX_TIDQ_STATS_ADD(_peer, _tid, _var, _val) \ 89 (((_peer)->tidq_stats[_tid]).stats[_var]) += _val 90 #define PFLOW_TXRX_TIDQ_STATS_GET(_peer, _tid, _var, _val) \ 91 ((_peer)->tidq_stats[_tid].stats[_var]) 92 /* 93 * Video only stats 94 */ 95 #define PFLOW_CTRL_PDEV_VIDEO_STATS_SET(_pdev, _var, _val) \ 96 (((_pdev)->vow.vistats[_var]).value) = _val 97 #define PFLOW_CTRL_PDEV_VIDEO_STATS_GET(_pdev, _var) \ 98 ((_pdev)->vow.vistats[_var].value) 99 #define PFLOW_CTRL_PDEV_VIDEO_STATS_ADD(_pdev, _var, _val) \ 100 (((_pdev)->vow.vistats[_var]).value) += _val 101 /* 102 * video delay stats 103 */ 104 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_SET(_pdev, _var, _val) \ 105 (((_pdev)->vow.delaystats[_var]).value) = _val 106 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_GET(_pdev, _var) \ 107 ((_pdev)->vow.delaystats[_var].value) 108 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_ADD(_pdev, _var, _val) \ 109 (((_pdev)->vow.delaystats[_var]).value) += _val 110 /* 111 * Number of TLVs sent by FW. Needs to reflect 112 * HTT_PPDU_STATS_MAX_TAG declared in FW 113 */ 114 #define CDP_PPDU_STATS_MAX_TAG 14 115 #define CDP_MAX_DATA_TIDS 9 116 117 #define CDP_WDI_NUM_EVENTS WDI_NUM_EVENTS 118 119 #define CDP_FCTL_RETRY 0x0800 120 #define CDP_FC_IS_RETRY_SET(_fc) \ 121 ((_fc) & qdf_cpu_to_le16(CDP_FCTL_RETRY)) 122 123 #define INVALID_RSSI 255 124 125 #define CDP_RSSI_MULTIPLIER BIT(8) 126 #define CDP_RSSI_MUL(x, mul) ((x) * (mul)) 127 #define CDP_RSSI_RND(x, mul) ((((x) % (mul)) >= ((mul) / 2)) ?\ 128 ((x) + ((mul) - 1)) / (mul) : (x) / (mul)) 129 130 #define CDP_RSSI_OUT(x) (CDP_RSSI_RND((x), CDP_RSSI_MULTIPLIER)) 131 #define CDP_RSSI_IN(x) (CDP_RSSI_MUL((x), CDP_RSSI_MULTIPLIER)) 132 #define CDP_RSSI_AVG(x, y) ((((x) << 2) + (y) - (x)) >> 2) 133 134 #define CDP_RSSI_UPDATE_AVG(x, y) x = CDP_RSSI_AVG((x), CDP_RSSI_IN((y))) 135 136 /*Max SU EVM count */ 137 #define DP_RX_MAX_SU_EVM_COUNT 32 138 139 #define WDI_EVENT_BASE 0x100 140 141 #define CDP_TXRX_RATECODE_MCS_MASK 0xF 142 #define CDP_TXRX_RATECODE_NSS_MASK 0x3 143 #define CDP_TXRX_RATECODE_NSS_LSB 4 144 #define CDP_TXRX_RATECODE_PREM_MASK 0x3 145 #define CDP_TXRX_RATECODE_PREM_LSB 6 146 147 /* Below BW_GAIN should be added to the SNR value of every ppdu based on the 148 * bandwidth. This table is obtained from HALPHY. 149 * BW BW_Gain 150 * 20 0 151 * 40 3dBm 152 * 80 6dBm 153 * 160/80P80 9dBm 154 */ 155 156 #define PKT_BW_GAIN_20MHZ 0 157 #define PKT_BW_GAIN_40MHZ 3 158 #define PKT_BW_GAIN_80MHZ 6 159 #define PKT_BW_GAIN_160MHZ 9 160 161 /* 162 * cdp_tx_transmit_type: Transmit type index 163 * SU: SU Transmit type index 164 * MU_MIMO: MU_MIMO Transmit type index 165 * MU_OFDMA: MU_OFDMA Transmit type index 166 * MU_MIMO_OFDMA: MU MIMO OFDMA Transmit type index 167 */ 168 enum cdp_tx_transmit_type { 169 SU = 0, 170 MU_MIMO, 171 MU_OFDMA, 172 MU_MIMO_OFDMA, 173 }; 174 175 /* 176 * cdp_ru_index: Different RU index 177 * 178 * RU_26_INDEX : 26-tone Resource Unit index 179 * RU_52_INDEX : 52-tone Resource Unit index 180 * RU_106_INDEX: 106-tone Resource Unit index 181 * RU_242_INDEX: 242-tone Resource Unit index 182 * RU_484_INDEX: 484-tone Resource Unit index 183 * RU_996_INDEX: 996-tone Resource Unit index 184 */ 185 enum cdp_ru_index { 186 RU_26_INDEX = 0, 187 RU_52_INDEX, 188 RU_106_INDEX, 189 RU_242_INDEX, 190 RU_484_INDEX, 191 RU_996_INDEX, 192 RU_INDEX_MAX, 193 }; 194 195 struct cdp_ru_debug { 196 char *ru_type; 197 }; 198 199 static const struct cdp_ru_debug cdp_ru_string[RU_INDEX_MAX] = { 200 { "RU_26" }, 201 { "RU_52" }, 202 { "RU_106" }, 203 { "RU_242" }, 204 { "RU_484" }, 205 { "RU_996" } 206 }; 207 208 #ifdef FEATURE_TSO_STATS 209 /* Number of TSO Packet Statistics captured */ 210 #define CDP_MAX_TSO_PACKETS 5 211 /* Information for Number of Segments for a TSO Packet captured */ 212 #define CDP_MAX_TSO_SEGMENTS 2 213 /* Information for Number of Fragments for a TSO Segment captured */ 214 #define CDP_MAX_TSO_FRAGMENTS 6 215 #endif /* FEATURE_TSO_STATS */ 216 217 /* Different Packet Types */ 218 enum cdp_packet_type { 219 DOT11_A = 0, 220 DOT11_B = 1, 221 DOT11_N = 2, 222 DOT11_AC = 3, 223 DOT11_AX = 4, 224 DOT11_MAX = 5, 225 }; 226 227 #define MCS_VALID 1 228 #define MCS_INVALID 0 229 230 #define CDP_MAX_MCS_STRING_LEN 34 231 /* 232 * struct cdp_rate_debug 233 * 234 * @mcs_type: print string for a given mcs 235 * @valid: valid mcs rate? 236 */ 237 struct cdp_rate_debug { 238 char mcs_type[CDP_MAX_MCS_STRING_LEN]; 239 uint8_t valid; 240 }; 241 242 static const struct cdp_rate_debug cdp_rate_string[DOT11_MAX][MAX_MCS] = { 243 { 244 {"OFDM 48 Mbps", MCS_VALID}, 245 {"OFDM 24 Mbps", MCS_VALID}, 246 {"OFDM 12 Mbps", MCS_VALID}, 247 {"OFDM 6 Mbps ", MCS_VALID}, 248 {"OFDM 54 Mbps", MCS_VALID}, 249 {"OFDM 36 Mbps", MCS_VALID}, 250 {"OFDM 18 Mbps", MCS_VALID}, 251 {"OFDM 9 Mbps ", MCS_VALID}, 252 {"INVALID ", MCS_INVALID}, 253 {"INVALID ", MCS_INVALID}, 254 {"INVALID ", MCS_INVALID}, 255 {"INVALID ", MCS_INVALID}, 256 {"INVALID ", MCS_INVALID}, 257 }, 258 { 259 {"CCK 11 Mbps Long ", MCS_VALID}, 260 {"CCK 5.5 Mbps Long ", MCS_VALID}, 261 {"CCK 2 Mbps Long ", MCS_VALID}, 262 {"CCK 1 Mbps Long ", MCS_VALID}, 263 {"CCK 11 Mbps Short ", MCS_VALID}, 264 {"CCK 5.5 Mbps Short", MCS_VALID}, 265 {"CCK 2 Mbps Short ", MCS_VALID}, 266 {"INVALID ", MCS_INVALID}, 267 {"INVALID ", MCS_INVALID}, 268 {"INVALID ", MCS_INVALID}, 269 {"INVALID ", MCS_INVALID}, 270 {"INVALID ", MCS_INVALID}, 271 {"INVALID ", MCS_INVALID}, 272 }, 273 { 274 {"HT MCS 0 (BPSK 1/2) ", MCS_VALID}, 275 {"HT MCS 1 (QPSK 1/2) ", MCS_VALID}, 276 {"HT MCS 2 (QPSK 3/4) ", MCS_VALID}, 277 {"HT MCS 3 (16-QAM 1/2)", MCS_VALID}, 278 {"HT MCS 4 (16-QAM 3/4)", MCS_VALID}, 279 {"HT MCS 5 (64-QAM 2/3)", MCS_VALID}, 280 {"HT MCS 6 (64-QAM 3/4)", MCS_VALID}, 281 {"HT MCS 7 (64-QAM 5/6)", MCS_VALID}, 282 {"INVALID ", MCS_INVALID}, 283 {"INVALID ", MCS_INVALID}, 284 {"INVALID ", MCS_INVALID}, 285 {"INVALID ", MCS_INVALID}, 286 {"INVALID ", MCS_INVALID}, 287 }, 288 { 289 {"VHT MCS 0 (BPSK 1/2) ", MCS_VALID}, 290 {"VHT MCS 1 (QPSK 1/2) ", MCS_VALID}, 291 {"VHT MCS 2 (QPSK 3/4) ", MCS_VALID}, 292 {"VHT MCS 3 (16-QAM 1/2) ", MCS_VALID}, 293 {"VHT MCS 4 (16-QAM 3/4) ", MCS_VALID}, 294 {"VHT MCS 5 (64-QAM 2/3) ", MCS_VALID}, 295 {"VHT MCS 6 (64-QAM 3/4) ", MCS_VALID}, 296 {"VHT MCS 7 (64-QAM 5/6) ", MCS_VALID}, 297 {"VHT MCS 8 (256-QAM 3/4) ", MCS_VALID}, 298 {"VHT MCS 9 (256-QAM 5/6) ", MCS_VALID}, 299 {"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID}, 300 {"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID}, 301 {"INVALID ", MCS_INVALID}, 302 }, 303 { 304 {"HE MCS 0 (BPSK 1/2) ", MCS_VALID}, 305 {"HE MCS 1 (QPSK 1/2) ", MCS_VALID}, 306 {"HE MCS 2 (QPSK 3/4) ", MCS_VALID}, 307 {"HE MCS 3 (16-QAM 1/2) ", MCS_VALID}, 308 {"HE MCS 4 (16-QAM 3/4) ", MCS_VALID}, 309 {"HE MCS 5 (64-QAM 2/3) ", MCS_VALID}, 310 {"HE MCS 6 (64-QAM 3/4) ", MCS_VALID}, 311 {"HE MCS 7 (64-QAM 5/6) ", MCS_VALID}, 312 {"HE MCS 8 (256-QAM 3/4) ", MCS_VALID}, 313 {"HE MCS 9 (256-QAM 5/6) ", MCS_VALID}, 314 {"HE MCS 10 (1024-QAM 3/4)", MCS_VALID}, 315 {"HE MCS 11 (1024-QAM 5/6)", MCS_VALID}, 316 {"INVALID ", MCS_INVALID}, 317 } 318 }; 319 320 /* 321 * cdp_mu_packet_type: MU Rx type index 322 * RX_TYPE_MU_MIMO: MU MIMO Rx type index 323 * RX_TYPE_MU_OFDMA: MU OFDMA Rx type index 324 * MU_MIMO_OFDMA: MU Rx MAX type index 325 */ 326 enum cdp_mu_packet_type { 327 RX_TYPE_MU_MIMO = 0, 328 RX_TYPE_MU_OFDMA = 1, 329 RX_TYPE_MU_MAX = 2, 330 }; 331 332 enum WDI_EVENT { 333 WDI_EVENT_TX_STATUS = WDI_EVENT_BASE, 334 WDI_EVENT_OFFLOAD_ALL, 335 WDI_EVENT_RX_DESC_REMOTE, 336 WDI_EVENT_RX_PEER_INVALID, 337 WDI_EVENT_DBG_PRINT, /* NEED to integrate pktlog changes*/ 338 WDI_EVENT_RX_CBF_REMOTE, 339 WDI_EVENT_RATE_FIND, 340 WDI_EVENT_RATE_UPDATE, 341 WDI_EVENT_SW_EVENT, 342 WDI_EVENT_RX_DESC, 343 WDI_EVENT_LITE_T2H, 344 WDI_EVENT_LITE_RX, 345 WDI_EVENT_RX_PPDU_DESC, 346 WDI_EVENT_TX_PPDU_DESC, 347 WDI_EVENT_TX_MSDU_DESC, 348 WDI_EVENT_TX_DATA, 349 WDI_EVENT_RX_DATA, 350 WDI_EVENT_TX_MGMT_CTRL, 351 WDI_EVENT_HTT_STATS, 352 WDI_EVENT_TX_BEACON, 353 WDI_EVENT_PEER_STATS, 354 WDI_EVENT_TX_SOJOURN_STAT, 355 WDI_EVENT_UPDATE_DP_STATS, 356 WDI_EVENT_RX_MGMT_CTRL, 357 WDI_EVENT_PEER_CREATE, 358 WDI_EVENT_PEER_DESTROY, 359 WDI_EVENT_PEER_FLUSH_RATE_STATS, 360 WDI_EVENT_FLUSH_RATE_STATS_REQ, 361 WDI_EVENT_RX_MPDU, 362 WDI_EVENT_HMWDS_AST_ADD_STATUS, 363 /* End of new event items */ 364 WDI_EVENT_LAST 365 }; 366 367 #define WDI_NUM_EVENTS WDI_EVENT_LAST - WDI_EVENT_BASE 368 369 struct cdp_stats_extd { 370 }; 371 372 /* TID level Tx/Rx stats 373 * 374 */ 375 enum cdp_txrx_tidq_stats { 376 /* Tx Counters */ 377 TX_MSDU_TOTAL_LINUX_SUBSYSTEM, 378 TX_MSDU_TOTAL_FROM_OSIF, 379 TX_MSDU_TX_COMP_PKT_CNT, 380 /* Rx Counters */ 381 RX_MSDU_TOTAL_FROM_FW, 382 RX_MSDU_MCAST_FROM_FW, 383 RX_TID_MISMATCH_FROM_FW, 384 RX_MSDU_MISC_PKTS, 385 RX_MSDU_IS_ARP, 386 RX_MSDU_IS_EAP, 387 RX_MSDU_IS_DHCP, 388 RX_AGGREGATE_10, 389 RX_AGGREGATE_20, 390 RX_AGGREGATE_30, 391 RX_AGGREGATE_40, 392 RX_AGGREGATE_50, 393 RX_AGGREGATE_60, 394 RX_AGGREGATE_MORE, 395 RX_AMSDU_1, 396 RX_AMSDU_2, 397 RX_AMSDU_3, 398 RX_AMSDU_4, 399 RX_AMSDU_MORE, 400 RX_MSDU_CHAINED_FROM_FW, 401 RX_MSDU_REORDER_FAILED_FROM_FW, 402 RX_MSDU_REORDER_FLUSHED_FROM_FW, 403 RX_MSDU_DISCARD_FROM_FW, 404 RX_MSDU_DUPLICATE_FROM_FW, 405 RX_MSDU_DELIVERED_TO_STACK, 406 TIDQ_STATS_MAX, 407 }; 408 409 struct cdp_tidq_stats { 410 uint32_t stats[TIDQ_STATS_MAX]; 411 }; 412 413 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 414 /** 415 * struct cdp_rx_ppdu_cfr_info - struct for storing ppdu info extracted from HW 416 * TLVs, this will be used for CFR correlation 417 * 418 * @bb_captured_channel : Set by RXPCU when MACRX_FREEZE_CAPTURE_CHANNEL TLV is 419 * sent to PHY, SW checks it to correlate current PPDU TLVs with uploaded 420 * channel information. 421 * 422 * @bb_captured_timeout : Set by RxPCU to indicate channel capture condition is 423 * met, but MACRX_FREEZE_CAPTURE_CHANNEL is not sent to PHY due to AST delay, 424 * which means the rx_frame_falling edge to FREEZE TLV ready time exceeds 425 * the threshold time defined by RXPCU register FREEZE_TLV_DELAY_CNT_THRESH. 426 * Bb_captured_reason is still valid in this case. 427 * 428 * @bb_captured_reason : Copy capture_reason of MACRX_FREEZE_CAPTURE_CHANNEL 429 * TLV to here for FW usage. Valid when bb_captured_channel or 430 * bb_captured_timeout is set. 431 * <enum 0 freeze_reason_TM> 432 * <enum 1 freeze_reason_FTM> 433 * <enum 2 freeze_reason_ACK_resp_to_TM_FTM> 434 * <enum 3 freeze_reason_TA_RA_TYPE_FILTER> 435 * <enum 4 freeze_reason_NDPA_NDP> 436 * <enum 5 freeze_reason_ALL_PACKET> 437 * <legal 0-5> 438 * 439 * @rx_location_info_valid: Indicates whether CFR DMA address in the PPDU TLV 440 * is valid 441 * <enum 0 rx_location_info_is_not_valid> 442 * <enum 1 rx_location_info_is_valid> 443 * <legal all> 444 * 445 * @chan_capture_status : capture status reported by ucode 446 * a. CAPTURE_IDLE: FW has disabled "REPETITIVE_CHE_CAPTURE_CTRL" 447 * b. CAPTURE_BUSY: previous PPDU’s channel capture upload DMA ongoing. (Note 448 * that this upload is triggered after receiving freeze_channel_capture TLV 449 * after last PPDU is rx) 450 * c. CAPTURE_ACTIVE: channel capture is enabled and no previous channel 451 * capture ongoing 452 * d. CAPTURE_NO_BUFFER: next buffer in IPC ring not available 453 * 454 * @rtt_che_buffer_pointer_high8 : The high 8 bits of the 40 bits pointer to 455 * external RTT channel information buffer 456 * 457 * @rtt_che_buffer_pointer_low32 : The low 32 bits of the 40 bits pointer to 458 * external RTT channel information buffer 459 * 460 */ 461 462 struct cdp_rx_ppdu_cfr_info { 463 bool bb_captured_channel; 464 bool bb_captured_timeout; 465 uint8_t bb_captured_reason; 466 bool rx_location_info_valid; 467 uint8_t chan_capture_status; 468 uint8_t rtt_che_buffer_pointer_high8; 469 uint32_t rtt_che_buffer_pointer_low32; 470 }; 471 #endif 472 /* 473 * struct cdp_rx_su_evm_info: Rx evm info 474 * @number_of_symbols: number of symbols 475 * @nss_count: number of spatial streams 476 * @pilot_count: number of pilot count 477 */ 478 struct cdp_rx_su_evm_info { 479 uint16_t number_of_symbols; 480 uint8_t nss_count; 481 uint8_t pilot_count; 482 uint32_t pilot_evm[DP_RX_MAX_SU_EVM_COUNT]; 483 }; 484 485 /* 486 * cdp_delay_stats_mode: Different types of delay statistics 487 * 488 * @CDP_DELAY_STATS_SW_ENQ: Stack to hw enqueue delay 489 * @CDP_DELAY_STATS_TX_INTERFRAME: Interframe delay at radio entry point 490 * @CDP_DELAY_STATS_FW_HW_TRANSMIT: Hw enqueue to tx completion delay 491 * @CDP_DELAY_STATS_REAP_STACK: Delay in ring reap to indicating network stack 492 * @CDP_DELAY_STATS_RX_INTERFRAME: Rx inteframe delay 493 * @CDP_DELAY_STATS_MODE_MAX: Maximum delay mode 494 */ 495 enum cdp_delay_stats_mode { 496 CDP_DELAY_STATS_SW_ENQ, 497 CDP_DELAY_STATS_TX_INTERFRAME, 498 CDP_DELAY_STATS_FW_HW_TRANSMIT, 499 CDP_DELAY_STATS_REAP_STACK, 500 CDP_DELAY_STATS_RX_INTERFRAME, 501 CDP_DELAY_STATS_MODE_MAX, 502 }; 503 504 /* 505 * cdp_delay_bucket_index 506 * Index to be used for all delay stats 507 */ 508 enum cdp_delay_bucket_index { 509 CDP_DELAY_BUCKET_0, 510 CDP_DELAY_BUCKET_1, 511 CDP_DELAY_BUCKET_2, 512 CDP_DELAY_BUCKET_3, 513 CDP_DELAY_BUCKET_4, 514 CDP_DELAY_BUCKET_5, 515 CDP_DELAY_BUCKET_6, 516 CDP_DELAY_BUCKET_7, 517 CDP_DELAY_BUCKET_8, 518 CDP_DELAY_BUCKET_9, 519 CDP_DELAY_BUCKET_10, 520 CDP_DELAY_BUCKET_11, 521 CDP_DELAY_BUCKET_12, 522 CDP_DELAY_BUCKET_MAX, 523 }; 524 525 /* 526 * struct cdp_tx_host_drop - packet drop due to following reasons. 527 */ 528 enum cdp_tx_sw_drop { 529 TX_DESC_ERR, 530 TX_HAL_RING_ACCESS_ERR, 531 TX_DMA_MAP_ERR, 532 TX_HW_ENQUEUE, 533 TX_SW_ENQUEUE, 534 TX_MAX_DROP, 535 }; 536 537 /* 538 * struct cdp_rx_host_drop - packet drop due to following reasons. 539 */ 540 enum cdp_rx_sw_drop { 541 INTRABSS_DROP, 542 MSDU_DONE_FAILURE, 543 INVALID_PEER_VDEV, 544 POLICY_CHECK_DROP, 545 MEC_DROP, 546 NAWDS_MCAST_DROP, 547 MESH_FILTER_DROP, 548 ENQUEUE_DROP, 549 RX_MAX_DROP, 550 }; 551 552 /* 553 * struct cdp_delay_stats 554 * @delay_bucket: division of buckets as per latency 555 * @min_delay: minimum delay 556 * @max_delay: maximum delay 557 * @avg_delay: average delay 558 */ 559 struct cdp_delay_stats { 560 uint64_t delay_bucket[CDP_DELAY_BUCKET_MAX]; 561 uint32_t min_delay; 562 uint32_t max_delay; 563 uint32_t avg_delay; 564 }; 565 566 /* 567 * struct cdp_tid_tx_stats 568 * @swq_delay: delay between wifi driver entry point and enqueue to HW in tx 569 * @hwtx_delay: delay between wifi driver exit (enqueue to HW) and tx completion 570 * @intfrm_delay: interframe delay 571 * @success_cnt: total successful transmit count 572 * @comp_fail_cnt: firmware drop found in tx completion path 573 * @swdrop_cnt: software drop in tx path 574 * @tqm_status_cnt: TQM completion status count 575 * @htt_status_cnt: HTT completion status count 576 */ 577 struct cdp_tid_tx_stats { 578 struct cdp_delay_stats swq_delay; 579 struct cdp_delay_stats hwtx_delay; 580 struct cdp_delay_stats intfrm_delay; 581 uint64_t success_cnt; 582 uint64_t comp_fail_cnt; 583 uint64_t swdrop_cnt[TX_MAX_DROP]; 584 uint64_t tqm_status_cnt[CDP_MAX_TX_TQM_STATUS]; 585 uint64_t htt_status_cnt[CDP_MAX_TX_HTT_STATUS]; 586 }; 587 588 /* 589 * struct cdp_tid_tx_stats 590 * @to_stack_delay: Time taken between ring reap to indication to network stack 591 * @intfrm_delay: Interframe rx delay 592 * @delivered_cnt: Total packets indicated to stack 593 * @intrabss_cnt: Rx total intraBSS frames 594 * @msdu_cnt: number of msdu received from HW 595 * @mcast_msdu_cnt: Num Mcast Msdus received from HW in Rx 596 * @bcast_msdu_cnt: Num Bcast Msdus received from HW in Rx 597 * @fail_cnt: Rx deliver drop counters 598 */ 599 struct cdp_tid_rx_stats { 600 struct cdp_delay_stats to_stack_delay; 601 struct cdp_delay_stats intfrm_delay; 602 uint64_t delivered_to_stack; 603 uint64_t intrabss_cnt; 604 uint64_t msdu_cnt; 605 uint64_t mcast_msdu_cnt; 606 uint64_t bcast_msdu_cnt; 607 uint64_t fail_cnt[RX_MAX_DROP]; 608 }; 609 610 /* 611 * struct cdp_tid_stats 612 * @ingress_stack: Total packets received from linux stack 613 * @osif_drop: drops in osif layer 614 * @tid_tx_stats: transmit counters per tid 615 * @tid_rx_stats: receive counters per tid 616 */ 617 struct cdp_tid_stats { 618 uint64_t ingress_stack; 619 uint64_t osif_drop; 620 struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS] 621 [CDP_MAX_DATA_TIDS]; 622 struct cdp_tid_rx_stats tid_rx_stats[CDP_MAX_RX_RINGS] 623 [CDP_MAX_DATA_TIDS]; 624 }; 625 626 /* 627 * struct cdp_delay_tx_stats: Tx delay stats 628 * @tx_swq_delay: software enqueue delay 629 * @hwtx_delay: HW enque to completion delay 630 */ 631 struct cdp_delay_tx_stats { 632 struct cdp_hist_stats tx_swq_delay; 633 struct cdp_hist_stats hwtx_delay; 634 }; 635 636 /* 637 * struct cdp_delay_rx_stats: Rx delay stats 638 * @to_stack_delay: To stack delay 639 */ 640 struct cdp_delay_rx_stats { 641 struct cdp_hist_stats to_stack_delay; 642 }; 643 644 /* 645 * struct cdp_delay_tid_stats: Delay tid stats 646 * @tx_delay: Tx delay related stats 647 * @rx_delay: Rx delay related stats 648 */ 649 struct cdp_delay_tid_stats { 650 struct cdp_delay_tx_stats tx_delay; 651 struct cdp_delay_rx_stats rx_delay; 652 }; 653 654 /* 655 * cdp_peer_ext_stats: Peer extended stats 656 * @delay_stats: Per TID delay stats 657 */ 658 struct cdp_peer_ext_stats { 659 struct cdp_delay_tid_stats delay_stats[CDP_MAX_DATA_TIDS] 660 [CDP_MAX_TXRX_CTX]; 661 662 /*Customer can add MSDU level Tx/Rx stats */ 663 }; 664 665 /* struct cdp_pkt_info - packet info 666 * @num: no of packets 667 * @bytes: total no of bytes 668 */ 669 struct cdp_pkt_info { 670 uint32_t num; 671 uint64_t bytes; 672 }; 673 674 /* struct cdp_pkt_type - packet type 675 * @mcs_count: Counter array for each MCS index 676 */ 677 struct cdp_pkt_type { 678 uint32_t mcs_count[MAX_MCS]; 679 }; 680 681 /* 682 * struct cdp_rx_mu - Rx MU Stats 683 * @ppdu_nss[SS_COUNT]: Packet Count in spatial streams 684 * @mpdu_cnt_fcs_ok: Rx success mpdu count 685 * @mpdu_cnt_fcs_err: Rx fail mpdu count 686 * @cdp_pkt_type: counter array for each MCS index 687 */ 688 struct cdp_rx_mu { 689 uint32_t ppdu_nss[SS_COUNT]; 690 uint32_t mpdu_cnt_fcs_ok; 691 uint32_t mpdu_cnt_fcs_err; 692 struct cdp_pkt_type ppdu; 693 }; 694 695 /* struct cdp_tx_pkt_info - tx packet info 696 * num_msdu - successful msdu 697 * num_mpdu - successful mpdu from compltn common 698 * mpdu_tried - mpdu tried 699 * 700 * tx packet info counter field for mpdu success/tried and msdu 701 */ 702 struct cdp_tx_pkt_info { 703 uint32_t num_msdu; 704 uint32_t num_mpdu; 705 uint32_t mpdu_tried; 706 }; 707 708 #ifdef FEATURE_TSO_STATS 709 /** 710 * struct cdp_tso_seg_histogram - Segment histogram for TCP Packets 711 * @segs_1: packets with single segments 712 * @segs_2_5: packets with 2-5 segments 713 * @segs_6_10: packets with 6-10 segments 714 * @segs_11_15: packets with 11-15 segments 715 * @segs_16_20: packets with 16-20 segments 716 * @segs_20_plus: packets with 20 plus segments 717 */ 718 struct cdp_tso_seg_histogram { 719 uint64_t segs_1; 720 uint64_t segs_2_5; 721 uint64_t segs_6_10; 722 uint64_t segs_11_15; 723 uint64_t segs_16_20; 724 uint64_t segs_20_plus; 725 }; 726 727 /** 728 * struct cdp_tso_packet_info - Stats for TSO segments within a TSO packet 729 * @tso_seg: TSO Segment information 730 * @num_seg: Number of segments 731 * @tso_packet_len: Size of the tso packet 732 * @tso_seg_idx: segment number 733 */ 734 struct cdp_tso_packet_info { 735 struct qdf_tso_seg_t tso_seg[CDP_MAX_TSO_SEGMENTS]; 736 uint8_t num_seg; 737 size_t tso_packet_len; 738 uint32_t tso_seg_idx; 739 }; 740 741 /** 742 * struct cdp_tso_info - stats for tso packets 743 * @tso_packet_info: TSO packet information 744 */ 745 struct cdp_tso_info { 746 struct cdp_tso_packet_info tso_packet_info[CDP_MAX_TSO_PACKETS]; 747 }; 748 #endif /* FEATURE_TSO_STATS */ 749 750 /** 751 * struct cdp_tso_stats - TSO stats information 752 * @num_tso_pkts: Total number of TSO Packets 753 * @tso_comp: Total tso packet completions 754 * @dropped_host: TSO packets dropped by host 755 * @tso_no_mem_dropped: TSO packets dropped by host due to descriptor 756 unavailablity 757 * @dropped_target: TSO packets_dropped by target 758 * @tso_info: Per TSO packet counters 759 * @seg_histogram: TSO histogram stats 760 */ 761 struct cdp_tso_stats { 762 struct cdp_pkt_info num_tso_pkts; 763 uint32_t tso_comp; 764 struct cdp_pkt_info dropped_host; 765 struct cdp_pkt_info tso_no_mem_dropped; 766 uint32_t dropped_target; 767 #ifdef FEATURE_TSO_STATS 768 struct cdp_tso_info tso_info; 769 struct cdp_tso_seg_histogram seg_histogram; 770 #endif /* FEATURE_TSO_STATS */ 771 }; 772 773 #define CDP_PEER_STATS_START 0 774 775 enum cdp_peer_stats_type { 776 cdp_peer_stats_min = CDP_PEER_STATS_START, 777 778 /* Tx types */ 779 cdp_peer_tx_ucast = cdp_peer_stats_min, 780 cdp_peer_tx_mcast, 781 cdp_peer_tx_rate, 782 cdp_peer_tx_last_tx_rate, 783 cdp_peer_tx_inactive_time, 784 cdp_peer_tx_ratecode, 785 cdp_peer_tx_flags, 786 cdp_peer_tx_power, 787 788 /* Rx types */ 789 cdp_peer_rx_rate, 790 cdp_peer_rx_last_rx_rate, 791 cdp_peer_rx_ratecode, 792 cdp_peer_rx_ucast, 793 cdp_peer_rx_flags, 794 cdp_peer_rx_avg_rssi, 795 cdp_peer_stats_max, 796 }; 797 798 /* 799 * The max size of cdp_peer_stats_param_t is limited to 16 bytes. 800 * If the buffer size is exceeding this size limit, 801 * dp_txrx_get_peer_stats is to be used instead. 802 */ 803 typedef union cdp_peer_stats_buf { 804 /* Tx types */ 805 struct cdp_pkt_info tx_ucast; 806 struct cdp_pkt_info tx_mcast; 807 uint32_t tx_rate; 808 uint32_t last_tx_rate; 809 uint32_t tx_inactive_time; 810 uint32_t tx_flags; 811 uint32_t tx_power; 812 uint16_t tx_ratecode; 813 814 /* Rx types */ 815 struct cdp_pkt_info rx_ucast; 816 uint32_t rx_rate; 817 uint32_t last_rx_rate; 818 uint32_t rx_ratecode; 819 uint32_t rx_flags; 820 uint32_t rx_avg_rssi; 821 } cdp_peer_stats_param_t; /* Max union size 16 bytes */ 822 823 /** 824 * enum cdp_protocol_trace - Protocols supported by per-peer protocol trace 825 * @CDP_TRACE_ICMP: ICMP packets 826 * @CDP_TRACE_EAP: EAPOL packets 827 * @CDP_TRACE_ARP: ARP packets 828 * 829 * Enumeration of all protocols supported by per-peer protocol trace feature 830 */ 831 enum cdp_protocol_trace { 832 CDP_TRACE_ICMP, 833 CDP_TRACE_EAP, 834 CDP_TRACE_ARP, 835 CDP_TRACE_MAX 836 }; 837 838 /** 839 * struct protocol_trace_count - type of count on per-peer protocol trace 840 * @egress_cnt: how many packets go out of host driver 841 * @ingress_cnt: how many packets come into the host driver 842 * 843 * Type of count on per-peer protocol trace 844 */ 845 struct protocol_trace_count { 846 uint16_t egress_cnt; 847 uint16_t ingress_cnt; 848 }; 849 /* struct cdp_tx_stats - tx stats 850 * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received 851 * @cdp_pkt_info ucast: Unicast Packet Count 852 * @cdp_pkt_info mcast: Multicast Packet Count 853 * @cdp_pkt_info bcast: Broadcast Packet Count 854 * @cdp_pkt_info nawds_mcast: NAWDS Multicast Packet Count 855 * @cdp_pkt_info tx_success: Successful Tx Packets 856 * @nawds_mcast_drop: NAWDS Multicast Drop Count 857 * @protocol_trace_cnt: per-peer protocol counter 858 * @tx_failed: Total Tx failure 859 * @ofdma: Total Packets as ofdma 860 * @stbc: Packets in STBC 861 * @ldpc: Packets in LDPC 862 * @retries: Packet retries 863 * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation 864 * @amsdu_cnt: Number of MSDUs part of AMSDU 865 * @tx_rate: Tx Rate 866 * @last_tx_rate: Last tx rate for unicast packets 867 * @last_tx_rate_mcs: Tx rate mcs for unicast packets 868 * @mcast_last_tx_rate: Last tx rate for multicast packets 869 * @mcast_last_tx_rate_mcs: Last tx rate mcs for multicast 870 * @last_per: Tx Per 871 * @rnd_avg_tx_rate: Rounded average tx rate 872 * @avg_tx_rate: Average TX rate 873 * @last_ack_rssi: RSSI of last acked packet 874 * @tx_bytes_success_last: last Tx success bytes 875 * @tx_data_success_last: last Tx success data 876 * @tx_byte_rate: Bytes Trasmitted in last one sec 877 * @tx_data_rate: Data Transmitted in last one sec 878 * @sgi_count[MAX_GI]: SGI count 879 * @nss[SS_COUNT]: Packet count for different num_spatial_stream values 880 * @bw[MAX_BW]: Packet Count for different bandwidths 881 * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count 882 * @excess_retries_per_ac[WME_AC_MAX]: Wireless Multimedia type Count 883 * @dot11_tx_pkts: dot11 tx packets 884 * @fw_rem: Discarded by firmware 885 * @fw_rem_notx: firmware_discard_untransmitted 886 * @fw_rem_tx: firmware_discard_transmitted 887 * @age_out: aged out in mpdu/msdu queues 888 * @fw_reason1: discarded by firmware reason 1 889 * @fw_reason2: discarded by firmware reason 2 890 * @fw_reason3: discarded by firmware reason 3 891 * @mcs_count: MCS Count 892 * @an_tx_cnt: ald tx count 893 * @an_tx_rates_used: ald rx rate used 894 * @an_tx_bytes: ald tx bytes 895 * @ald_txcount: ald tx count 896 * @ald_lastper: ald last PER 897 * @ald_max4msframelen: ald max frame len 898 * @an_tx_ratecount: ald tx ratecount 899 * @ald_retries: ald retries 900 * @ald_ac_nobufs: #buffer overflows per node per AC 901 * @ald_ac_excretries: #pkts dropped after excessive retries per node per AC 902 * @rssi_chain: rssi chain 903 * @inactive_time: inactive time in secs 904 * @tx_flags: tx flags 905 * @tx_power: Tx power latest 906 * @is_tx_no_ack: no ack received 907 * @tx_ratecode: Tx rate code of last frame 908 * @is_tx_nodefkey: tx failed 'cuz no defkey 909 * @is_tx_noheadroom: tx failed 'cuz no space 910 * @is_crypto_enmicfail: 911 * @is_tx_nonode: tx failed for no node 912 * @is_tx_unknownmgt: tx of unknown mgt frame 913 * @is_tx_badcipher: tx failed 'cuz key type 914 * @ampdu_cnt: completion of aggregation 915 * @non_ampdu_cnt: tx completion not aggregated 916 * @failed_retry_count: packets failed due to retry above 802.11 retry limit 917 * @retry_count: packets successfully send after one or more retry 918 * @multiple_retry_count: packets successfully sent after more than one retry 919 * @transmit_type: pkt info for tx transmit type 920 * @mu_group_id: mumimo mu group id 921 * @ru_start: RU start index 922 * @ru_tones: RU tones size 923 * @ru_loc: pkt info for RU location 26/ 52/ 106/ 242/ 484 counter 924 * @num_ppdu_cookie_valid : Number of comp received with valid ppdu cookie 925 * @tx_success_twt: Successful Tx Packets in TWT session 926 */ 927 struct cdp_tx_stats { 928 struct cdp_pkt_info comp_pkt; 929 struct cdp_pkt_info ucast; 930 struct cdp_pkt_info mcast; 931 struct cdp_pkt_info bcast; 932 struct cdp_pkt_info nawds_mcast; 933 #ifdef VDEV_PEER_PROTOCOL_COUNT 934 struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX]; 935 #endif 936 struct cdp_pkt_info tx_success; 937 uint32_t nawds_mcast_drop; 938 uint32_t tx_failed; 939 uint32_t ofdma; 940 uint32_t stbc; 941 uint32_t ldpc; 942 uint32_t retries; 943 uint32_t non_amsdu_cnt; 944 uint32_t amsdu_cnt; 945 uint32_t tx_rate; 946 uint32_t last_tx_rate; 947 uint32_t last_tx_rate_mcs; 948 uint32_t mcast_last_tx_rate; 949 uint32_t mcast_last_tx_rate_mcs; 950 uint32_t last_per; 951 uint64_t rnd_avg_tx_rate; 952 uint64_t avg_tx_rate; 953 uint32_t last_ack_rssi; 954 uint32_t tx_bytes_success_last; 955 uint32_t tx_data_success_last; 956 uint32_t tx_byte_rate; 957 uint32_t tx_data_rate; 958 uint32_t tx_data_ucast_last; 959 uint32_t tx_data_ucast_rate; 960 struct cdp_pkt_type pkt_type[DOT11_MAX]; 961 uint32_t sgi_count[MAX_GI]; 962 963 uint32_t nss[SS_COUNT]; 964 965 uint32_t bw[MAX_BW]; 966 967 uint32_t wme_ac_type[WME_AC_MAX]; 968 969 uint32_t excess_retries_per_ac[WME_AC_MAX]; 970 struct cdp_pkt_info dot11_tx_pkts; 971 972 struct { 973 struct cdp_pkt_info fw_rem; 974 uint32_t fw_rem_notx; 975 uint32_t fw_rem_tx; 976 uint32_t age_out; 977 uint32_t fw_reason1; 978 uint32_t fw_reason2; 979 uint32_t fw_reason3; 980 } dropped; 981 982 983 uint32_t fw_tx_cnt; 984 uint32_t fw_tx_bytes; 985 uint32_t fw_txcount; 986 uint32_t fw_max4msframelen; 987 uint32_t fw_ratecount; 988 989 uint32_t ac_nobufs[WME_AC_MAX]; 990 uint32_t rssi_chain[WME_AC_MAX]; 991 uint32_t inactive_time; 992 993 uint32_t tx_flags; 994 uint32_t tx_power; 995 996 /* MSDUs which the target sent but couldn't get an ack for */ 997 struct cdp_pkt_info is_tx_no_ack; 998 uint16_t tx_ratecode; 999 1000 /*add for peer and upadted from ppdu*/ 1001 uint32_t ampdu_cnt; 1002 uint32_t non_ampdu_cnt; 1003 uint32_t failed_retry_count; 1004 uint32_t retry_count; 1005 uint32_t multiple_retry_count; 1006 uint32_t last_tx_rate_used; 1007 1008 struct cdp_tx_pkt_info transmit_type[MAX_TRANSMIT_TYPES]; 1009 uint32_t mu_group_id[MAX_MU_GROUP_ID]; 1010 uint32_t ru_start; 1011 uint32_t ru_tones; 1012 struct cdp_tx_pkt_info ru_loc[MAX_RU_LOCATIONS]; 1013 1014 uint32_t num_ppdu_cookie_valid; 1015 uint32_t no_ack_count[QDF_PROTO_SUBTYPE_MAX]; 1016 struct cdp_pkt_info tx_success_twt; 1017 }; 1018 1019 /* struct cdp_rx_stats - rx Level Stats 1020 * @to_stack: Total packets sent up the stack 1021 * @rcvd_reo[CDP_MAX_RX_RINGS]: Packets received on the reo ring 1022 * @unicast: Total unicast packets 1023 * @multicast: Total multicast packets 1024 * @bcast: Broadcast Packet Count 1025 * @raw: Raw Pakets received 1026 * @nawds_mcast_drop: Total multicast packets 1027 * @mec_drop: Total MEC packets dropped 1028 * @pkts: Intra BSS packets received 1029 * @fail: Intra BSS packets failed 1030 * @mdns_no_fwd: Intra BSS MDNS packets not forwarded 1031 * @protocol_trace_cnt: per-peer protocol counters 1032 * @mic_err: Rx MIC errors CCMP 1033 * @decrypt_err: Rx Decryption Errors CRC 1034 * @fcserr: rx MIC check failed (CCMP) 1035 * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count 1036 * @reception_type[MAX_RECEPTION_TYPES]: Reception type os packets 1037 * @mcs_count[MAX_MCS]: mcs count 1038 * @sgi_count[MAX_GI]: sgi count 1039 * @nss[SS_COUNT]: packet count in spatiel Streams 1040 * @ppdu_nss[SS_COUNT]: PPDU packet count in spatial streams 1041 * @mpdu_cnt_fcs_ok: SU Rx success mpdu count 1042 * @mpdu_cnt_fcs_err: SU Rx fail mpdu count 1043 * @su_ax_ppdu_cnt: SU Rx packet count 1044 * @ppdu_cnt[MAX_RECEPTION_TYPES]: PPDU packet count in reception type 1045 * @rx_mu[RX_TYPE_MU_MAX]: Rx MU stats 1046 * @bw[MAX_BW]: Packet Count in different bandwidths 1047 * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation 1048 * @ampdu_cnt: Number of MSDUs part of AMSPU 1049 * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation 1050 * @amsdu_cnt: Number of MSDUs part of AMSDU 1051 * @bar_recv_cnt: Number of bar received 1052 * @avg_rssi: Average rssi 1053 * @rx_rate: Rx rate 1054 * @last_rx_rate: Previous rx rate 1055 * @rnd_avg_rx_rate: Rounded average rx rate 1056 * @avg_rx_rate: Average Rx rate 1057 * @dot11_rx_pkts: dot11 rx packets 1058 * @rx_bytes_last: last Rx success bytes 1059 * @rx_data_last: last rx success data 1060 * @rx_byte_rate: bytes received in last one sec 1061 * @rx_data_rate: data received in last one sec 1062 * @rx_retries: retries of packet in rx 1063 * @rx_mpdus: mpdu in rx 1064 * @rx_ppdus: ppdu in rx 1065 * @is_rx_tooshort: tooshort 1066 * @is_rx_decap: rx decap 1067 * @rx_ccmpmic: rx MIC check failed (CCMP) 1068 * @rx_tkipmic: rx MIC check failed (TKIP) 1069 * @rx_tkipicv: rx ICV check failed (TKIP) 1070 * @rx_wpimic: rx MIC check failed (WPI) 1071 * @rx_wepfail: rx wep processing failed 1072 * @rx_aggr: aggregation on rx 1073 * @rx_discard: packets discard in rx 1074 * @rx_ratecode: Rx rate code of last frame 1075 * @rx_flags: rx flags 1076 * @rx_rssi_measured_time: Time at which rssi is measured 1077 * @rssi: RSSI of received signal 1078 * @last_rssi: Previous rssi 1079 * @multipass_rx_pkt_drop: Dropped multipass rx pkt 1080 * @rx_mpdu_cnt: rx mpdu count per MCS rate 1081 * @to_stack_twt: Total packets sent up the stack in TWT session 1082 */ 1083 struct cdp_rx_stats { 1084 struct cdp_pkt_info to_stack; 1085 struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS]; 1086 struct cdp_pkt_info unicast; 1087 struct cdp_pkt_info multicast; 1088 struct cdp_pkt_info bcast; 1089 struct cdp_pkt_info raw; 1090 uint32_t nawds_mcast_drop; 1091 struct cdp_pkt_info mec_drop; 1092 struct { 1093 struct cdp_pkt_info pkts; 1094 struct cdp_pkt_info fail; 1095 uint32_t mdns_no_fwd; 1096 } intra_bss; 1097 #ifdef VDEV_PEER_PROTOCOL_COUNT 1098 struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX]; 1099 #endif 1100 1101 struct { 1102 uint32_t mic_err; 1103 uint32_t decrypt_err; 1104 uint32_t fcserr; 1105 } err; 1106 1107 uint32_t wme_ac_type[WME_AC_MAX]; 1108 uint32_t reception_type[MAX_RECEPTION_TYPES]; 1109 struct cdp_pkt_type pkt_type[DOT11_MAX]; 1110 uint32_t sgi_count[MAX_GI]; 1111 uint32_t nss[SS_COUNT]; 1112 uint32_t ppdu_nss[SS_COUNT]; 1113 uint32_t mpdu_cnt_fcs_ok; 1114 uint32_t mpdu_cnt_fcs_err; 1115 struct cdp_pkt_type su_ax_ppdu_cnt; 1116 uint32_t ppdu_cnt[MAX_RECEPTION_TYPES]; 1117 struct cdp_rx_mu rx_mu[RX_TYPE_MU_MAX]; 1118 uint32_t bw[MAX_BW]; 1119 uint32_t non_ampdu_cnt; 1120 uint32_t ampdu_cnt; 1121 uint32_t non_amsdu_cnt; 1122 uint32_t amsdu_cnt; 1123 uint32_t bar_recv_cnt; 1124 uint32_t avg_rssi; 1125 uint32_t rx_rate; 1126 uint32_t last_rx_rate; 1127 uint32_t rnd_avg_rx_rate; 1128 uint32_t avg_rx_rate; 1129 struct cdp_pkt_info dot11_rx_pkts; 1130 1131 uint32_t rx_bytes_success_last; 1132 uint32_t rx_data_success_last; 1133 uint32_t rx_byte_rate; 1134 uint32_t rx_data_rate; 1135 1136 uint32_t rx_retries; 1137 uint32_t rx_mpdus; 1138 uint32_t rx_ppdus; 1139 1140 /*add for peer updated for ppdu*/ 1141 uint32_t rx_aggr; 1142 uint32_t rx_discard; 1143 uint32_t rx_ratecode; 1144 uint32_t rx_flags; 1145 uint32_t rx_rssi_measured_time; 1146 uint8_t rssi; 1147 uint8_t last_rssi; 1148 uint32_t multipass_rx_pkt_drop; 1149 uint32_t rx_mpdu_cnt[MAX_MCS]; 1150 struct cdp_pkt_info to_stack_twt; 1151 }; 1152 1153 /* struct cdp_tx_ingress_stats - Tx ingress Stats 1154 * @rcvd: Total packets received for transmission 1155 * @processed: Tx packets processed 1156 * @inspect_pkts: Total packets passed to inspect handler 1157 * @nawds_mcast: NAWDS Multicast Packet Count 1158 * @bcast: Number of broadcast packets 1159 * @raw_pkt: Total Raw packets 1160 * @dma_map_error: DMA map error 1161 * @num_seg: No of segments in TSO packets 1162 * @tso_pkt:total no of TSO packets 1163 * @non_tso_pkts: non - TSO packets 1164 * @dropped_host: TSO packets dropped by host 1165 * @dropped_target:TSO packets dropped by target 1166 * @sg_pkt: Total scatter gather packets 1167 * @non_sg_pkts: non SG packets 1168 * @dropped_host: SG packets dropped by host 1169 * @dropped_target: SG packets dropped by target 1170 * @dma_map_error: Dma map error 1171 * @mcast_pkt: total no of multicast conversion packets 1172 * @dropped_map_error: packets dropped due to map error 1173 * @dropped_self_mac: packets dropped due to self Mac address 1174 * @dropped_send_fail: Packets dropped due to send fail 1175 * @ucast: total unicast packets transmitted 1176 * @fail_seg_alloc: Segment allocation failure 1177 * @clone_fail: NBUF clone failure 1178 * @dropped_pkt: Total scatter gather packets 1179 * @desc_na: Desc Not Available 1180 * @exc_desc_na: Exception desc Not Available 1181 * @ring_full: ring full 1182 * @enqueue_fail: hw enqueue fail 1183 * @dma_error: dma fail 1184 * @res_full: Resource Full: Congestion Control 1185 * @exception_fw: packets sent to fw 1186 * @completion_fw: packets completions received from fw 1187 * @cce_classified:Number of packets classified by CCE 1188 * @cce_classified_raw:Number of raw packets classified by CCE 1189 * @sniffer_rcvd: Number of packets received with ppdu cookie 1190 */ 1191 struct cdp_tx_ingress_stats { 1192 struct cdp_pkt_info rcvd; 1193 struct cdp_pkt_info processed; 1194 struct cdp_pkt_info reinject_pkts; 1195 struct cdp_pkt_info inspect_pkts; 1196 struct cdp_pkt_info nawds_mcast; 1197 struct cdp_pkt_info bcast; 1198 1199 struct { 1200 struct cdp_pkt_info raw_pkt; 1201 uint32_t dma_map_error; 1202 uint32_t invalid_raw_pkt_datatype; 1203 } raw; 1204 1205 /* Scatter Gather packet info */ 1206 struct { 1207 struct cdp_pkt_info sg_pkt; 1208 struct cdp_pkt_info non_sg_pkts; 1209 struct cdp_pkt_info dropped_host; 1210 uint32_t dropped_target; 1211 uint32_t dma_map_error; 1212 } sg; 1213 1214 /* Multicast Enhancement packets info */ 1215 struct { 1216 struct cdp_pkt_info mcast_pkt; 1217 uint32_t dropped_map_error; 1218 uint32_t dropped_self_mac; 1219 uint32_t dropped_send_fail; 1220 uint32_t ucast; 1221 uint32_t fail_seg_alloc; 1222 uint32_t clone_fail; 1223 } mcast_en; 1224 1225 /* Packets dropped on the Tx side */ 1226 struct { 1227 struct cdp_pkt_info dropped_pkt; 1228 struct cdp_pkt_info desc_na; 1229 struct cdp_pkt_info exc_desc_na; 1230 uint32_t ring_full; 1231 uint32_t enqueue_fail; 1232 uint32_t dma_error; 1233 uint32_t res_full; 1234 /* headroom insufficient */ 1235 uint32_t headroom_insufficient; 1236 } dropped; 1237 1238 /* Mesh packets info */ 1239 struct { 1240 uint32_t exception_fw; 1241 uint32_t completion_fw; 1242 } mesh; 1243 1244 uint32_t cce_classified; 1245 uint32_t cce_classified_raw; 1246 struct cdp_pkt_info sniffer_rcvd; 1247 struct cdp_tso_stats tso_stats; 1248 }; 1249 1250 /* struct cdp_vdev_stats - vdev stats structure 1251 * @tx_i: ingress tx stats 1252 * @tx: cdp tx stats 1253 * @rx: cdp rx stats 1254 * @tso_stats: tso stats 1255 */ 1256 struct cdp_vdev_stats { 1257 struct cdp_tx_ingress_stats tx_i; 1258 struct cdp_tx_stats tx; 1259 struct cdp_rx_stats rx; 1260 struct cdp_tso_stats tso_stats; 1261 }; 1262 1263 /* struct cdp_peer_stats - peer stats structure 1264 * @tx: cdp tx stats 1265 * @rx: cdp rx stats 1266 */ 1267 struct cdp_peer_stats { 1268 /* CDP Tx Stats */ 1269 struct cdp_tx_stats tx; 1270 /* CDP Rx Stats */ 1271 struct cdp_rx_stats rx; 1272 }; 1273 1274 /* struct cdp_peer_tid_stats - Per peer and per TID stats 1275 * @tx_avg_jitter: tx average jitter 1276 * @tx_avg_delay: tx average delay 1277 * @tx_avg_err: tx average error 1278 * @tx_total_success: tx total success 1279 * @tx_drop: tx drop 1280 */ 1281 struct cdp_peer_tid_stats { 1282 #ifdef WLAN_PEER_JITTER 1283 uint32_t tx_avg_jitter; 1284 uint32_t tx_avg_delay; 1285 uint64_t tx_avg_err; 1286 uint64_t tx_total_success; 1287 uint64_t tx_drop; 1288 #endif 1289 }; 1290 1291 /* struct cdp_interface_peer_stats - interface structure for txrx peer stats 1292 * @peer_mac: peer mac address 1293 * @vdev_id : vdev_id for the peer 1294 * @last_peer_tx_rate: peer tx rate for last transmission 1295 * @peer_tx_rate: tx rate for current transmission 1296 * @peer_rssi: current rssi value of peer 1297 * @tx_packet_count: tx packet count 1298 * @rx_packet_count: rx packet count 1299 * @tx_byte_count: tx byte count 1300 * @rx_byte_count: rx byte count 1301 * @per: per error rate 1302 * @ack_rssi: RSSI of the last ack received 1303 * @rssi_changed: denotes rssi is changed 1304 */ 1305 struct cdp_interface_peer_stats { 1306 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; 1307 uint8_t vdev_id; 1308 uint8_t rssi_changed; 1309 uint32_t last_peer_tx_rate; 1310 uint32_t peer_tx_rate; 1311 uint32_t peer_rssi; 1312 uint32_t tx_packet_count; 1313 uint32_t rx_packet_count; 1314 uint32_t tx_byte_count; 1315 uint32_t rx_byte_count; 1316 uint32_t per; 1317 uint32_t ack_rssi; 1318 }; 1319 1320 /* Tx completions per interrupt */ 1321 struct cdp_hist_tx_comp { 1322 uint32_t pkts_1; 1323 uint32_t pkts_2_20; 1324 uint32_t pkts_21_40; 1325 uint32_t pkts_41_60; 1326 uint32_t pkts_61_80; 1327 uint32_t pkts_81_100; 1328 uint32_t pkts_101_200; 1329 uint32_t pkts_201_plus; 1330 }; 1331 1332 /* Rx ring descriptors reaped per interrupt */ 1333 struct cdp_hist_rx_ind { 1334 uint32_t pkts_1; 1335 uint32_t pkts_2_20; 1336 uint32_t pkts_21_40; 1337 uint32_t pkts_41_60; 1338 uint32_t pkts_61_80; 1339 uint32_t pkts_81_100; 1340 uint32_t pkts_101_200; 1341 uint32_t pkts_201_plus; 1342 }; 1343 1344 struct cdp_htt_tlv_hdr { 1345 /* BIT [11 : 0] :- tag 1346 * BIT [23 : 12] :- length 1347 * BIT [31 : 24] :- reserved 1348 */ 1349 uint32_t tag__length; 1350 }; 1351 1352 #define HTT_STATS_SUBTYPE_MAX 16 1353 1354 struct cdp_htt_rx_pdev_fw_stats_tlv { 1355 struct cdp_htt_tlv_hdr tlv_hdr; 1356 1357 /* BIT [ 7 : 0] :- mac_id 1358 * BIT [31 : 8] :- reserved 1359 */ 1360 uint32_t mac_id__word; 1361 /* Num PPDU status processed from HW */ 1362 uint32_t ppdu_recvd; 1363 /* Num MPDU across PPDUs with FCS ok */ 1364 uint32_t mpdu_cnt_fcs_ok; 1365 /* Num MPDU across PPDUs with FCS err */ 1366 uint32_t mpdu_cnt_fcs_err; 1367 /* Num MSDU across PPDUs */ 1368 uint32_t tcp_msdu_cnt; 1369 /* Num MSDU across PPDUs */ 1370 uint32_t tcp_ack_msdu_cnt; 1371 /* Num MSDU across PPDUs */ 1372 uint32_t udp_msdu_cnt; 1373 /* Num MSDU across PPDUs */ 1374 uint32_t other_msdu_cnt; 1375 /* Num MPDU on FW ring indicated */ 1376 uint32_t fw_ring_mpdu_ind; 1377 /* Num MGMT MPDU given to protocol */ 1378 uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX]; 1379 /* Num ctrl MPDU given to protocol */ 1380 uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX]; 1381 /* Num mcast data packet received */ 1382 uint32_t fw_ring_mcast_data_msdu; 1383 /* Num broadcast data packet received */ 1384 uint32_t fw_ring_bcast_data_msdu; 1385 /* Num unicat data packet received */ 1386 uint32_t fw_ring_ucast_data_msdu; 1387 /* Num null data packet received */ 1388 uint32_t fw_ring_null_data_msdu; 1389 /* Num MPDU on FW ring dropped */ 1390 uint32_t fw_ring_mpdu_drop; 1391 1392 /* Num buf indication to offload */ 1393 uint32_t ofld_local_data_ind_cnt; 1394 /* Num buf recycle from offload */ 1395 uint32_t ofld_local_data_buf_recycle_cnt; 1396 /* Num buf indication to data_rx */ 1397 uint32_t drx_local_data_ind_cnt; 1398 /* Num buf recycle from data_rx */ 1399 uint32_t drx_local_data_buf_recycle_cnt; 1400 /* Num buf indication to protocol */ 1401 uint32_t local_nondata_ind_cnt; 1402 /* Num buf recycle from protocol */ 1403 uint32_t local_nondata_buf_recycle_cnt; 1404 1405 /* Num buf fed */ 1406 uint32_t fw_status_buf_ring_refill_cnt; 1407 /* Num ring empty encountered */ 1408 uint32_t fw_status_buf_ring_empty_cnt; 1409 /* Num buf fed */ 1410 uint32_t fw_pkt_buf_ring_refill_cnt; 1411 /* Num ring empty encountered */ 1412 uint32_t fw_pkt_buf_ring_empty_cnt; 1413 /* Num buf fed */ 1414 uint32_t fw_link_buf_ring_refill_cnt; 1415 /* Num ring empty encountered */ 1416 uint32_t fw_link_buf_ring_empty_cnt; 1417 1418 /* Num buf fed */ 1419 uint32_t host_pkt_buf_ring_refill_cnt; 1420 /* Num ring empty encountered */ 1421 uint32_t host_pkt_buf_ring_empty_cnt; 1422 /* Num buf fed */ 1423 uint32_t mon_pkt_buf_ring_refill_cnt; 1424 /* Num ring empty encountered */ 1425 uint32_t mon_pkt_buf_ring_empty_cnt; 1426 /* Num buf fed */ 1427 uint32_t mon_status_buf_ring_refill_cnt; 1428 /* Num ring empty encountered */ 1429 uint32_t mon_status_buf_ring_empty_cnt; 1430 /* Num buf fed */ 1431 uint32_t mon_desc_buf_ring_refill_cnt; 1432 /* Num ring empty encountered */ 1433 uint32_t mon_desc_buf_ring_empty_cnt; 1434 /* Num buf fed */ 1435 uint32_t mon_dest_ring_update_cnt; 1436 /* Num ring full encountered */ 1437 uint32_t mon_dest_ring_full_cnt; 1438 1439 /* Num rx suspend is attempted */ 1440 uint32_t rx_suspend_cnt; 1441 /* Num rx suspend failed */ 1442 uint32_t rx_suspend_fail_cnt; 1443 /* Num rx resume attempted */ 1444 uint32_t rx_resume_cnt; 1445 /* Num rx resume failed */ 1446 uint32_t rx_resume_fail_cnt; 1447 /* Num rx ring switch */ 1448 uint32_t rx_ring_switch_cnt; 1449 /* Num rx ring restore */ 1450 uint32_t rx_ring_restore_cnt; 1451 /* Num rx flush issued */ 1452 uint32_t rx_flush_cnt; 1453 }; 1454 1455 /* == TX PDEV STATS == */ 1456 struct cdp_htt_tx_pdev_stats_cmn_tlv { 1457 struct cdp_htt_tlv_hdr tlv_hdr; 1458 1459 /* BIT [ 7 : 0] :- mac_id 1460 * BIT [31 : 8] :- reserved 1461 */ 1462 uint32_t mac_id__word; 1463 /* Num queued to HW */ 1464 uint32_t hw_queued; 1465 /* Num PPDU reaped from HW */ 1466 uint32_t hw_reaped; 1467 /* Num underruns */ 1468 uint32_t underrun; 1469 /* Num HW Paused counter. */ 1470 uint32_t hw_paused; 1471 /* Num HW flush counter. */ 1472 uint32_t hw_flush; 1473 /* Num HW filtered counter. */ 1474 uint32_t hw_filt; 1475 /* Num PPDUs cleaned up in TX abort */ 1476 uint32_t tx_abort; 1477 /* Num MPDUs requed by SW */ 1478 uint32_t mpdu_requed; 1479 /* excessive retries */ 1480 uint32_t tx_xretry; 1481 /* Last used data hw rate code */ 1482 uint32_t data_rc; 1483 /* frames dropped due to excessive sw retries */ 1484 uint32_t mpdu_dropped_xretry; 1485 /* illegal rate phy errors */ 1486 uint32_t illgl_rate_phy_err; 1487 /* wal pdev continuous xretry */ 1488 uint32_t cont_xretry; 1489 /* wal pdev continuous xretry */ 1490 uint32_t tx_timeout; 1491 /* wal pdev resets */ 1492 uint32_t pdev_resets; 1493 /* PhY/BB underrun */ 1494 uint32_t phy_underrun; 1495 /* MPDU is more than txop limit */ 1496 uint32_t txop_ovf; 1497 /* Number of Sequences posted */ 1498 uint32_t seq_posted; 1499 /* Number of Sequences failed queueing */ 1500 uint32_t seq_failed_queueing; 1501 /* Number of Sequences completed */ 1502 uint32_t seq_completed; 1503 /* Number of Sequences restarted */ 1504 uint32_t seq_restarted; 1505 /* Number of MU Sequences posted */ 1506 uint32_t mu_seq_posted; 1507 /* Number of time HW ring is paused between seq switch within ISR */ 1508 uint32_t seq_switch_hw_paused; 1509 /* Number of times seq continuation in DSR */ 1510 uint32_t next_seq_posted_dsr; 1511 /* Number of times seq continuation in ISR */ 1512 uint32_t seq_posted_isr; 1513 /* Number of seq_ctrl cached. */ 1514 uint32_t seq_ctrl_cached; 1515 /* Number of MPDUs successfully transmitted */ 1516 uint32_t mpdu_count_tqm; 1517 /* Number of MSDUs successfully transmitted */ 1518 uint32_t msdu_count_tqm; 1519 /* Number of MPDUs dropped */ 1520 uint32_t mpdu_removed_tqm; 1521 /* Number of MSDUs dropped */ 1522 uint32_t msdu_removed_tqm; 1523 /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */ 1524 uint32_t mpdus_sw_flush; 1525 /* Num MPDUs filtered by HW, all filter condition (TTL expired) */ 1526 uint32_t mpdus_hw_filter; 1527 /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */ 1528 uint32_t mpdus_truncated; 1529 /* Num MPDUs that was tried but didn't receive ACK or BA */ 1530 uint32_t mpdus_ack_failed; 1531 /* Num MPDUs that was dropped due to expiry (MSDU TTL). */ 1532 uint32_t mpdus_expired; 1533 /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */ 1534 uint32_t mpdus_seq_hw_retry; 1535 /* Num of TQM acked cmds processed */ 1536 uint32_t ack_tlv_proc; 1537 /* coex_abort_mpdu_cnt valid. */ 1538 uint32_t coex_abort_mpdu_cnt_valid; 1539 /* coex_abort_mpdu_cnt from TX FES stats. */ 1540 uint32_t coex_abort_mpdu_cnt; 1541 /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */ 1542 uint32_t num_total_ppdus_tried_ota; 1543 /* Number of data PPDUs tried over the air (OTA) */ 1544 uint32_t num_data_ppdus_tried_ota; 1545 /* Num Local control/mgmt frames (MSDUs) queued */ 1546 uint32_t local_ctrl_mgmt_enqued; 1547 /* local_ctrl_mgmt_freed: 1548 * Num Local control/mgmt frames (MSDUs) done 1549 * It includes all local ctrl/mgmt completions 1550 * (acked, no ack, flush, TTL, etc) 1551 */ 1552 uint32_t local_ctrl_mgmt_freed; 1553 /* Num Local data frames (MSDUs) queued */ 1554 uint32_t local_data_enqued; 1555 /* local_data_freed: 1556 * Num Local data frames (MSDUs) done 1557 * It includes all local data completions 1558 * (acked, no ack, flush, TTL, etc) 1559 */ 1560 uint32_t local_data_freed; 1561 1562 /* Num MPDUs tried by SW */ 1563 uint32_t mpdu_tried; 1564 /* Num of waiting seq posted in isr completion handler */ 1565 uint32_t isr_wait_seq_posted; 1566 uint32_t tx_active_dur_us_low; 1567 uint32_t tx_active_dur_us_high; 1568 }; 1569 1570 struct cdp_htt_tx_pdev_stats_urrn_tlv_v { 1571 struct cdp_htt_tlv_hdr tlv_hdr; 1572 uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */ 1573 }; 1574 1575 /* NOTE: Variable length TLV, use length spec to infer array size */ 1576 struct cdp_htt_tx_pdev_stats_flush_tlv_v { 1577 struct cdp_htt_tlv_hdr tlv_hdr; 1578 uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */ 1579 }; 1580 1581 /* NOTE: Variable length TLV, use length spec to infer array size */ 1582 struct cdp_htt_tx_pdev_stats_sifs_tlv_v { 1583 struct cdp_htt_tlv_hdr tlv_hdr; 1584 uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */ 1585 }; 1586 1587 /* NOTE: Variable length TLV, use length spec to infer array size */ 1588 struct cdp_htt_tx_pdev_stats_phy_err_tlv_v { 1589 struct cdp_htt_tlv_hdr tlv_hdr; 1590 uint32_t phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */ 1591 }; 1592 1593 /* == RX PDEV/SOC STATS == */ 1594 /* HTT_STATS_RX_SOC_FW_STATS_TAG */ 1595 struct cdp_htt_rx_soc_fw_stats_tlv { 1596 struct cdp_htt_tlv_hdr tlv_hdr; 1597 /* Num Packets received on REO FW ring */ 1598 uint32_t fw_reo_ring_data_msdu; 1599 /* Num bc/mc packets indicated from fw to host */ 1600 uint32_t fw_to_host_data_msdu_bcmc; 1601 /* Num unicast packets indicated from fw to host */ 1602 uint32_t fw_to_host_data_msdu_uc; 1603 /* Num remote buf recycle from offload */ 1604 uint32_t ofld_remote_data_buf_recycle_cnt; 1605 /* Num remote free buf given to offload */ 1606 uint32_t ofld_remote_free_buf_indication_cnt; 1607 }; 1608 1609 struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v { 1610 struct cdp_htt_tlv_hdr tlv_hdr; 1611 /* Num total buf refilled from refill ring */ 1612 uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */ 1613 }; 1614 1615 struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v { 1616 struct cdp_htt_tlv_hdr tlv_hdr; 1617 /* Num error MPDU for each RxDMA error type */ 1618 uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */ 1619 }; 1620 1621 struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v { 1622 struct cdp_htt_tlv_hdr tlv_hdr; 1623 /* Num MPDU dropped */ 1624 uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */ 1625 }; 1626 1627 #define HTT_STATS_PHY_ERR_MAX 43 1628 1629 struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv { 1630 struct cdp_htt_tlv_hdr tlv_hdr; 1631 1632 /* BIT [ 7 : 0] :- mac_id 1633 * BIT [31 : 8] :- reserved 1634 */ 1635 uint32_t mac_id__word; 1636 /* Num of phy err */ 1637 uint32_t total_phy_err_cnt; 1638 /* Counts of different types of phy errs 1639 * The mapping of PHY error types to phy_err array elements is HW dependent. 1640 * The only currently-supported mapping is shown below: 1641 * 1642 * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV 1643 * 1 phyrx_err_synth_off 1644 * 2 phyrx_err_ofdma_timing 1645 * 3 phyrx_err_ofdma_signal_parity 1646 * 4 phyrx_err_ofdma_rate_illegal 1647 * 5 phyrx_err_ofdma_length_illegal 1648 * 6 phyrx_err_ofdma_restart 1649 * 7 phyrx_err_ofdma_service 1650 * 8 phyrx_err_ppdu_ofdma_power_drop 1651 * 9 phyrx_err_cck_blokker 1652 * 10 phyrx_err_cck_timing 1653 * 11 phyrx_err_cck_header_crc 1654 * 12 phyrx_err_cck_rate_illegal 1655 * 13 phyrx_err_cck_length_illegal 1656 * 14 phyrx_err_cck_restart 1657 * 15 phyrx_err_cck_service 1658 * 16 phyrx_err_cck_power_drop 1659 * 17 phyrx_err_ht_crc_err 1660 * 18 phyrx_err_ht_length_illegal 1661 * 19 phyrx_err_ht_rate_illegal 1662 * 20 phyrx_err_ht_zlf 1663 * 21 phyrx_err_false_radar_ext 1664 * 22 phyrx_err_green_field 1665 * 23 phyrx_err_bw_gt_dyn_bw 1666 * 24 phyrx_err_leg_ht_mismatch 1667 * 25 phyrx_err_vht_crc_error 1668 * 26 phyrx_err_vht_siga_unsupported 1669 * 27 phyrx_err_vht_lsig_len_invalid 1670 * 28 phyrx_err_vht_ndp_or_zlf 1671 * 29 phyrx_err_vht_nsym_lt_zero 1672 * 30 phyrx_err_vht_rx_extra_symbol_mismatch 1673 * 31 phyrx_err_vht_rx_skip_group_id0 1674 * 32 phyrx_err_vht_rx_skip_group_id1to62 1675 * 33 phyrx_err_vht_rx_skip_group_id63 1676 * 34 phyrx_err_ofdm_ldpc_decoder_disabled 1677 * 35 phyrx_err_defer_nap 1678 * 36 phyrx_err_fdomain_timeout 1679 * 37 phyrx_err_lsig_rel_check 1680 * 38 phyrx_err_bt_collision 1681 * 39 phyrx_err_unsupported_mu_feedback 1682 * 40 phyrx_err_ppdu_tx_interrupt_rx 1683 * 41 phyrx_err_unsupported_cbf 1684 * 42 phyrx_err_other 1685 */ 1686 uint32_t phy_err[HTT_STATS_PHY_ERR_MAX]; 1687 }; 1688 1689 struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v { 1690 struct cdp_htt_tlv_hdr tlv_hdr; 1691 /* Num ring empty encountered */ 1692 uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */ 1693 }; 1694 1695 struct cdp_htt_tx_pdev_stats { 1696 struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv; 1697 struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv; 1698 struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv; 1699 struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv; 1700 struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv; 1701 }; 1702 1703 struct cdp_htt_rx_soc_stats_t { 1704 struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv; 1705 struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv; 1706 struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv; 1707 }; 1708 1709 struct cdp_htt_rx_pdev_stats { 1710 struct cdp_htt_rx_soc_stats_t soc_stats; 1711 struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv; 1712 struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv; 1713 struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop; 1714 struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv; 1715 }; 1716 1717 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG 1718 /* Since protocol type enumeration value is passed as CCE metadata 1719 * to firmware, add a constant offset before passing it to firmware 1720 */ 1721 #define RX_PROTOCOL_TAG_START_OFFSET 128 1722 /* This should align with packet type enumerations in ieee80211_ioctl.h 1723 * and wmi_unified_param.h files 1724 */ 1725 #define RX_PROTOCOL_TAG_MAX 24 1726 /* Macro that should be used to dump the statistics counter for all 1727 * protocol types 1728 */ 1729 #define RX_PROTOCOL_TAG_ALL 0xff 1730 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ 1731 1732 #define OFDMA_NUM_RU_SIZE 7 1733 1734 #define OFDMA_NUM_USERS 37 1735 1736 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE) 1737 /* 1738 * mac_freeze_capture_reason - capture reason counters 1739 * @FREEZE_REASON_TM: When m_directed_ftm is enabled, this CFR data is 1740 * captured for a Timing Measurement (TM) frame. 1741 * @FREEZE_REASON_FTM: When m_directed_ftm is enabled, this CFR data is 1742 * captured for a Fine Timing Measurement (FTM) frame. 1743 * @FREEZE_REASON_ACK_RESP_TO_TM_FTM: When m_all_ftm_ack is enabled, this CFR 1744 * data is captured for an ACK received for the FTM/TM frame sent to a station. 1745 * @FREEZE_REASON_TA_RA_TYPE_FILTER: When m_ta_ra_filter is enabled, this CFR 1746 * data is captured for a PPDU received,since the CFR TA_RA filter is met. 1747 * @FREEZE_REASON_NDPA_NDP: When m_ndpa_ndp_directed(or)m_ndpa_ndp_all is 1748 * enabled, this CFR data is captured for an NDP frame received. 1749 * @FREEZE_REASON_ALL_PACKET: When m_all_packet is enabled, this CFR data is 1750 * captured for an incoming PPDU. 1751 */ 1752 enum mac_freeze_capture_reason { 1753 FREEZE_REASON_TM = 0, 1754 FREEZE_REASON_FTM, 1755 FREEZE_REASON_ACK_RESP_TO_TM_FTM, 1756 FREEZE_REASON_TA_RA_TYPE_FILTER, 1757 FREEZE_REASON_NDPA_NDP, 1758 FREEZE_REASON_ALL_PACKET, 1759 FREEZE_REASON_MAX, 1760 }; 1761 1762 /* 1763 * chan_capture_status: capture status counters 1764 * @CAPTURE_IDLE: CFR data is not captured, since VCSR setting for CFR/RCC is 1765 * not enabled. 1766 * @CAPTURE_BUSY: CFR data is not available, since previous channel 1767 * upload is in progress 1768 * @CAPTURE_ACTIVE: CFR data is captured in HW registers 1769 * @CAPTURE_NO_BUFFER: CFR data is not captured, since no buffer is available 1770 * in IPC ring to DMA CFR data 1771 */ 1772 enum chan_capture_status { 1773 CAPTURE_IDLE = 0, 1774 CAPTURE_BUSY, 1775 CAPTURE_ACTIVE, 1776 CAPTURE_NO_BUFFER, 1777 CAPTURE_MAX, 1778 }; 1779 1780 /* struct cdp_cfr_rcc_stats - CFR RCC debug statistics 1781 * @bb_captured_channel_cnt: No. of PPDUs for which MAC sent Freeze TLV to PHY 1782 * @bb_captured_timeout_cnt: No. of PPDUs for which CFR filter criteria matched 1783 * but MAC did not send Freeze TLV to PHY as time exceeded freeze tlv delay 1784 * count threshold 1785 * @rx_loc_info_valid_cnt: No. of PPDUs for which PHY could find a valid buffer 1786 * in ucode IPC ring 1787 * @chan_capture_status[]: capture status counters 1788 * [0] - No. of PPDUs with capture status CAPTURE_IDLE 1789 * [1] - No. of PPDUs with capture status CAPTURE_BUSY 1790 * [2] - No. of PPDUs with capture status CAPTURE_ACTIVE 1791 * [3] - No. of PPDUs with capture status CAPTURE_NO_BUFFER 1792 * @reason_cnt[]: capture reason counters 1793 * [0] - No. PPDUs filtered due to freeze_reason_TM 1794 * [1] - No. PPDUs filtered due to freeze_reason_FTM 1795 * [2] - No. PPDUs filtered due to freeze_reason_ACK_resp_to_TM_FTM 1796 * [3] - No. PPDUs filtered due to freeze_reason_TA_RA_TYPE_FILTER 1797 * [4] - No. PPDUs filtered due to freeze_reason_NDPA_NDP 1798 * [5] - No. PPDUs filtered due to freeze_reason_ALL_PACKET 1799 */ 1800 struct cdp_cfr_rcc_stats { 1801 uint64_t bb_captured_channel_cnt; 1802 uint64_t bb_captured_timeout_cnt; 1803 uint64_t rx_loc_info_valid_cnt; 1804 uint64_t chan_capture_status[CAPTURE_MAX]; 1805 uint64_t reason_cnt[FREEZE_REASON_MAX]; 1806 }; 1807 #else 1808 struct cdp_cfr_rcc_stats { 1809 }; 1810 #endif 1811 /* struct cdp_pdev_stats - pdev stats 1812 * @msdu_not_done: packets dropped because msdu done bit not set 1813 * @mec:Multicast Echo check 1814 * @mesh_filter: Mesh Filtered packets 1815 * @mon_rx_drop: packets dropped on monitor vap 1816 * @wifi_parse: rxdma errors due to wifi parse error 1817 * @mon_radiotap_update_err: not enough space to update radiotap 1818 * @pkts: total packets replenished 1819 * @rxdma_err: rxdma errors for replenished 1820 * @nbuf_alloc_fail: nbuf alloc failed 1821 * @frag_alloc_fail: frag alloc failed 1822 * @map_err: Mapping failure 1823 * @x86_fail: x86 failures 1824 * @low_thresh_intrs: low threshold interrupts 1825 * @rx_raw_pkts: Rx Raw Packets 1826 * @mesh_mem_alloc: Mesh Rx Stats Alloc fail 1827 * @tso_desc_cnt: TSO descriptors 1828 * @sg_desc_cnt: SG Descriptors 1829 * @vlan_tag_stp_cnt: Vlan tagged Stp packets in wifi parse error 1830 * @desc_alloc_fail: desc alloc failed errors 1831 * @ip_csum_err: ip checksum errors 1832 * @tcp_udp_csum_err: tcp/udp checksum errors 1833 * @buf_freelist: buffers added back in freelist 1834 * @tx_i: Tx Ingress stats 1835 * @tx:CDP Tx Stats 1836 * @rx: CDP Rx Stats 1837 * @tx_comp_histogram: Number of Tx completions per interrupt 1838 * @rx_ind_histogram: Number of Rx ring descriptors reaped per interrupt 1839 * @ppdu_stats_counter: ppdu stats counter 1840 * @cdp_delayed_ba_not_recev: counter for delayed ba not received 1841 * @htt_tx_pdev_stats: htt pdev stats for tx 1842 * @htt_rx_pdev_stats: htt pdev stats for rx 1843 * @data_rx_ru_size: UL ofdma data ru size counter array 1844 * @nondata_rx_ru_size: UL ofdma non data ru size counter array 1845 * @data_rx_ppdu: data rx ppdu counter 1846 * @data_user: data user counter array 1847 * @tx_ppdu_proc: stats counter for tx ppdu processed 1848 * @ack_ba_comes_twice: stats counter for ack_ba_comes twice 1849 * @ppdu_drop: stats counter for ppdu_desc drop once threshold reached 1850 * @ppdu_wrap_drop: stats counter for ppdu desc drop on wrap around 1851 */ 1852 struct cdp_pdev_stats { 1853 struct { 1854 uint32_t msdu_not_done; 1855 uint32_t mec; 1856 uint32_t mesh_filter; 1857 uint32_t wifi_parse; 1858 /* Monitor mode related */ 1859 uint32_t mon_rx_drop; 1860 uint32_t mon_radiotap_update_err; 1861 } dropped; 1862 1863 struct { 1864 struct cdp_pkt_info pkts; 1865 uint32_t rxdma_err; 1866 uint32_t nbuf_alloc_fail; 1867 uint32_t frag_alloc_fail; 1868 uint32_t map_err; 1869 uint32_t x86_fail; 1870 uint32_t low_thresh_intrs; 1871 } replenish; 1872 1873 uint32_t rx_raw_pkts; 1874 uint32_t mesh_mem_alloc; 1875 uint32_t tso_desc_cnt; 1876 uint32_t sg_desc_cnt; 1877 uint32_t vlan_tag_stp_cnt; 1878 1879 /* Rx errors */ 1880 struct { 1881 uint32_t desc_alloc_fail; 1882 uint32_t ip_csum_err; 1883 uint32_t tcp_udp_csum_err; 1884 uint32_t rxdma_error; 1885 uint32_t reo_error; 1886 } err; 1887 1888 uint32_t buf_freelist; 1889 struct cdp_tx_ingress_stats tx_i; 1890 struct cdp_tx_stats tx; 1891 struct cdp_rx_stats rx; 1892 struct cdp_hist_tx_comp tx_comp_histogram; 1893 struct cdp_hist_rx_ind rx_ind_histogram; 1894 uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG]; 1895 uint32_t cdp_delayed_ba_not_recev; 1896 1897 struct cdp_htt_tx_pdev_stats htt_tx_pdev_stats; 1898 struct cdp_htt_rx_pdev_stats htt_rx_pdev_stats; 1899 1900 /* Received wdi messages from fw */ 1901 uint32_t wdi_event[CDP_WDI_NUM_EVENTS]; 1902 struct cdp_tid_stats tid_stats; 1903 1904 /* numbers of data/nondata per RU sizes */ 1905 struct { 1906 uint32_t data_rx_ru_size[OFDMA_NUM_RU_SIZE]; 1907 uint32_t nondata_rx_ru_size[OFDMA_NUM_RU_SIZE]; 1908 uint32_t data_rx_ppdu; 1909 uint32_t data_users[OFDMA_NUM_USERS]; 1910 } ul_ofdma; 1911 1912 struct cdp_tso_stats tso_stats; 1913 struct cdp_cfr_rcc_stats rcc; 1914 1915 uint64_t tx_ppdu_proc; 1916 uint64_t ack_ba_comes_twice; 1917 uint64_t ppdu_drop; 1918 uint64_t ppdu_wrap_drop; 1919 1920 struct { 1921 uint64_t num_bufs_consumed; 1922 uint64_t num_pool_bufs_replenish; 1923 uint64_t num_bufs_alloc_success; 1924 } rx_buffer_pool; 1925 }; 1926 1927 /* struct cdp_peer_hmwds_ast_add_status - hmwds peer ast add status 1928 * @vdev_id: vdev id 1929 * @status: ast add status 1930 * @peer_mac: peer mac address 1931 * @ast_mac: ast node mac address 1932 */ 1933 struct cdp_peer_hmwds_ast_add_status { 1934 uint32_t vdev_id; 1935 uint32_t status; 1936 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; 1937 uint8_t ast_mac[QDF_MAC_ADDR_SIZE]; 1938 }; 1939 1940 enum cdp_soc_param_t { 1941 DP_SOC_PARAM_MSDU_EXCEPTION_DESC, 1942 DP_SOC_PARAM_MAX, 1943 }; 1944 1945 #ifdef QCA_ENH_V3_STATS_SUPPORT 1946 /* 1947 * Enumeration of PDEV Configuration parameter 1948 */ 1949 enum _dp_param_t { 1950 DP_PARAM_MSDU_TTL, 1951 DP_PARAM_TOTAL_Q_SIZE_RANGE0, 1952 DP_PARAM_TOTAL_Q_SIZE_RANGE1, 1953 DP_PARAM_TOTAL_Q_SIZE_RANGE2, 1954 DP_PARAM_TOTAL_Q_SIZE_RANGE3, 1955 DP_PARAM_VIDEO_DELAY_STATS_FC, 1956 DP_PARAM_QFLUSHINTERVAL, 1957 DP_PARAM_TOTAL_Q_SIZE, 1958 DP_PARAM_MIN_THRESHOLD, 1959 DP_PARAM_MAX_Q_LIMIT, 1960 DP_PARAM_MIN_Q_LIMIT, 1961 DP_PARAM_CONG_CTRL_TIMER_INTV, 1962 DP_PARAM_STATS_TIMER_INTV, 1963 DP_PARAM_ROTTING_TIMER_INTV, 1964 DP_PARAM_LATENCY_PROFILE, 1965 DP_PARAM_HOSTQ_DUMP, 1966 DP_PARAM_TIDQ_MAP, 1967 DP_PARAM_VIDEO_STATS_FC, 1968 DP_PARAM_STATS_FC, 1969 1970 DP_PARAM_MAX, 1971 }; 1972 #endif 1973 /* Bitmasks for stats that can block */ 1974 #define EXT_TXRX_FW_STATS 0x0001 1975 #endif 1976