xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats_struct.h (revision 45c28558a520fd0e975b20c0ad534a0aa7f08021)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 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  * @file cdp_txrx_stats_struct.h
22  * @brief Define the host data path stats API functions
23  * called by the host control SW and the OS interface module
24  */
25 #ifndef _CDP_TXRX_STATS_STRUCT_H_
26 #define _CDP_TXRX_STATS_STRUCT_H_
27 
28 #include <qdf_types.h>
29 #include <cdp_txrx_hist_struct.h>
30 
31 #define TXRX_STATS_LEVEL_OFF   0
32 #define TXRX_STATS_LEVEL_BASIC 1
33 #define TXRX_STATS_LEVEL_FULL  2
34 
35 #define BSS_CHAN_INFO_READ                        1
36 #define BSS_CHAN_INFO_READ_AND_CLEAR              2
37 
38 #define TX_FRAME_TYPE_DATA 0
39 #define TX_FRAME_TYPE_MGMT 1
40 #define TX_FRAME_TYPE_BEACON 2
41 
42 #ifndef TXRX_STATS_LEVEL
43 #define TXRX_STATS_LEVEL TXRX_STATS_LEVEL_BASIC
44 #endif
45 
46 /* 1 additional MCS is for invalid values */
47 #ifdef WLAN_FEATURE_11BE
48 #define MAX_MCS (16 + 1)
49 #define MAX_MCS_11BE 16
50 #define MAX_PUNCTURED_MODE 5
51 #else
52 #define MAX_MCS (14 + 1)
53 #endif
54 
55 #define MCS_INVALID_ARRAY_INDEX MAX_MCS
56 #define MAX_MCS_11A 8
57 #define MAX_MCS_11B 7
58 #define MAX_MCS_11N 8
59 #define MAX_MCS_11AC 12
60 #define MAX_MCS_11AX 14
61 /* 1 additional GI is for invalid values */
62 #define MAX_GI (4 + 1)
63 #define SS_COUNT 8
64 #define MAX_BW 8
65 #define MAX_RECEPTION_TYPES 4
66 
67 #define CDP_MAX_RX_DEST_RINGS 8
68 #define CDP_MAX_TX_DATA_RINGS 5
69 #define CDP_MAX_WIFI_INT_ERROR_REASONS 5
70 /**
71  * This header file is being accessed in userspace applications.
72  * NR_CPUS is a linux kernel macro and cannot be accessible by user space apps.
73  * Defining maximum possible cpu count locally.
74  */
75 #define CDP_NR_CPUS 8
76 
77 #define MAX_TRANSMIT_TYPES	9
78 
79 #define MAX_USER_POS		8
80 #define MAX_MU_GROUP_ID		64
81 
82 #ifdef WLAN_FEATURE_11BE
83 #define MAX_RU_LOCATIONS	16
84 #else
85 #define MAX_RU_LOCATIONS	6
86 #endif
87 #define RU_26			1
88 #define RU_52			2
89 #define RU_106			4
90 #define RU_242			9
91 #define RU_484			18
92 #define RU_996			37
93 #ifdef WLAN_FEATURE_11BE
94 #define RU_2X996		74
95 #define RU_3X996		111
96 #define RU_4X996		148
97 #define RU_52_26		RU_52 + RU_26
98 #define RU_106_26		RU_106 + RU_26
99 #define RU_484_242		RU_484 + RU_242
100 #define RU_996_484		RU_996 + RU_484
101 #define RU_996_484_242		RU_996 + RU_484_242
102 #define RU_2X996_484		RU_2X996 + RU_484
103 #define RU_3X996_484		RU_3X996 + RU_484
104 #endif
105 
106 
107 /* WME stream classes */
108 #define WME_AC_BE    0    /* best effort */
109 #define WME_AC_BK    1    /* background */
110 #define WME_AC_VI    2    /* video */
111 #define WME_AC_VO    3    /* voice */
112 #define WME_AC_MAX   4    /* MAX AC Value */
113 
114 #define CDP_MAX_RX_RINGS 8  /* max rx rings */
115 #define CDP_MAX_TX_COMP_RINGS 5 /* max tx/completion rings */
116 #define CDP_MAX_RX_WBM_RINGS 1 /* max rx wbm rings */
117 
118 #define CDP_MAX_TX_TQM_STATUS 9  /* max tx tqm completion status */
119 #define CDP_MAX_TX_HTT_STATUS 7  /* max tx htt completion status */
120 
121 #define CDP_DMA_CODE_MAX 14 /* max rxdma error */
122 #define CDP_REO_CODE_MAX 15 /* max reo error */
123 
124 #define CDP_MAX_LMACS 2 /* max lmacs */
125 
126 /*
127  * Max of TxRx context
128  */
129 #define CDP_MAX_TXRX_CTX CDP_MAX_RX_RINGS
130 
131 /* TID level VoW stats macros
132  * to add and get stats
133  */
134 #define PFLOW_TXRX_TIDQ_STATS_ADD(_peer, _tid, _var, _val) \
135 	(((_peer)->tidq_stats[_tid]).stats[_var]) += _val
136 #define PFLOW_TXRX_TIDQ_STATS_GET(_peer, _tid, _var, _val) \
137 	((_peer)->tidq_stats[_tid].stats[_var])
138 /*
139  * Video only stats
140  */
141 #define PFLOW_CTRL_PDEV_VIDEO_STATS_SET(_pdev, _var, _val) \
142 	(((_pdev)->vow.vistats[_var]).value) = _val
143 #define PFLOW_CTRL_PDEV_VIDEO_STATS_GET(_pdev, _var) \
144 	((_pdev)->vow.vistats[_var].value)
145 #define PFLOW_CTRL_PDEV_VIDEO_STATS_ADD(_pdev, _var, _val) \
146 	(((_pdev)->vow.vistats[_var]).value) += _val
147 /*
148  * video delay stats
149  */
150 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_SET(_pdev, _var, _val) \
151 	(((_pdev)->vow.delaystats[_var]).value) = _val
152 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_GET(_pdev, _var) \
153 	((_pdev)->vow.delaystats[_var].value)
154 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_ADD(_pdev, _var, _val) \
155 	(((_pdev)->vow.delaystats[_var]).value) += _val
156 /*
157  * Number of TLVs sent by FW. Needs to reflect
158  * HTT_PPDU_STATS_MAX_TAG declared in FW
159  */
160 #define CDP_PPDU_STATS_MAX_TAG 14
161 #define CDP_MAX_DATA_TIDS 9
162 #define CDP_MAX_VOW_TID 4
163 
164 #define CDP_MAX_TIDS 17
165 
166 #define CDP_MAX_PKT_PER_WIN 1000
167 #define CDP_MAX_WIN_MOV_AVG 10
168 
169 #define CDP_WDI_NUM_EVENTS WDI_NUM_EVENTS
170 
171 #define CDP_FCTL_RETRY 0x0800
172 #define CDP_FC_IS_RETRY_SET(_fc) \
173 	((_fc) & qdf_cpu_to_le16(CDP_FCTL_RETRY))
174 
175 #define CDP_INVALID_SNR 255
176 
177 #define CDP_SNR_MULTIPLIER BIT(8)
178 #define CDP_SNR_MUL(x, mul) ((x) * (mul))
179 #define CDP_SNR_RND(x, mul) ((((x) % (mul)) >= ((mul) / 2)) ?\
180 	((x) + ((mul) - 1)) / (mul) : (x) / (mul))
181 
182 #define CDP_SNR_OUT(x) (CDP_SNR_RND((x), CDP_SNR_MULTIPLIER))
183 #define CDP_SNR_IN(x)  (CDP_SNR_MUL((x), CDP_SNR_MULTIPLIER))
184 #define CDP_SNR_AVG(x, y) ((((x) << 2) + (y) - (x)) >> 2)
185 
186 #define CDP_SNR_UPDATE_AVG(x, y) x = CDP_SNR_AVG((x), CDP_SNR_IN((y)))
187 
188 /*Max SU EVM count */
189 #define DP_RX_MAX_SU_EVM_COUNT 32
190 
191 #define WDI_EVENT_BASE 0x100
192 
193 #define CDP_TXRX_RATECODE_MCS_MASK 0xF
194 #define CDP_TXRX_RATECODE_NSS_MASK 0x3
195 #define CDP_TXRX_RATECODE_NSS_LSB 4
196 #define CDP_TXRX_RATECODE_PREM_MASK 0x3
197 #define CDP_TXRX_RATECODE_PREM_LSB 6
198 
199 /* Below BW_GAIN should be added to the SNR value of every ppdu based on the
200  * bandwidth. This table is obtained from HALPHY.
201  * BW         BW_Gain
202  * 20          0
203  * 40          3dBm
204  * 80          6dBm
205  * 160/80P80   9dBm
206  * 320         12dBm
207  */
208 
209 #define PKT_BW_GAIN_20MHZ 0
210 #define PKT_BW_GAIN_40MHZ 3
211 #define PKT_BW_GAIN_80MHZ 6
212 #define PKT_BW_GAIN_160MHZ 9
213 #ifdef WLAN_FEATURE_11BE
214 #define PKT_BW_GAIN_320MHZ 12
215 #endif
216 
217 /**
218  * This enum is a direct replica of hal_rxdma_error_code enum.
219  * New element addition to the enum need to make a entry in this enum too.
220  * enum cdp_wifi_error_code - Code describing the type of WIFI error detected
221  *
222  * @CDP_WIFI_ERR_OVERFLOW: MPDU frame is not complete due to overflow
223  * @CDP_WIFI_ERR_MPDU_LENGTH: MPDU frame is not complete due to receiving
224  * incomplete MPDU from the PHY
225  * @CDP_WIFI_ERR_FCS: FCS check on the MPDU frame failed
226  * @CDP_WIFI_ERR_DECRYPT: Decryption error
227  * @CDP_WIFI_ERR_TKIP_MIC: TKIP MIC error
228  * @CDP_WIFI_ERR_UNENCRYPTED: Received a frame that was expected to be
229  * encrypted but wasn’t
230  * @CDP_WIFI_ERR_MSDU_LEN: MSDU related length error
231  * @CDP_WIFI_ERR_MSDU_LIMIT: Number of MSDUs in the MPDUs exceeded the max
232  * allowed
233  * @CDP_WIFI_ERR_WIFI_PARSE: Wifi parsing error
234  * @CDP_WIFI_ERR_AMSDU_PARSE: Amsdu parsing error
235  * @CDP_WIFI_ERR_SA_TIMEOUT: Source Address search timeout
236  * @CDP_WIFI_ERR_DA_TIMEOUT: Destination Address search timeout
237  * @CDP_WIFI_ERR_FLOW_TIMEOUT: Flow Search Timeout
238  * @CDP_WIFI_ERR_FLUSH_REQUEST: Flush request error
239  * @CDP_WIFI_ERR_AMSDU_FRAGMENT: Reported A-MSDU present along with a fragmented
240  * MPDU
241  * @CDP_WIFI_ERR_MULTICAST_ECHO: Reported a multicast echo error
242  * @CDP_WIFI_ERR_DUMMY: Dummy errors
243  */
244 enum cdp_wifi_error_code {
245 	CDP_WIFI_ERR_OVERFLOW = 0,
246 	CDP_WIFI_ERR_MPDU_LENGTH,
247 	CDP_WIFI_ERR_FCS,
248 	CDP_WIFI_ERR_DECRYPT,
249 	CDP_WIFI_ERR_TKIP_MIC,
250 	CDP_WIFI_ERR_UNENCRYPTED,
251 	CDP_WIFI_ERR_MSDU_LEN,
252 	CDP_WIFI_ERR_MSDU_LIMIT,
253 	CDP_WIFI_ERR_WIFI_PARSE,
254 	CDP_WIFI_ERR_AMSDU_PARSE,
255 	CDP_WIFI_ERR_SA_TIMEOUT,
256 	CDP_WIFI_ERR_DA_TIMEOUT,
257 	CDP_WIFI_ERR_FLOW_TIMEOUT,
258 	CDP_WIFI_ERR_FLUSH_REQUEST,
259 	CDP_WIFI_ERR_AMSDU_FRAGMENT,
260 	CDP_WIFI_ERR_MULTICAST_ECHO,
261 	CDP_WIFI_ERR_DUMMY = 31,
262 	CDP_WIFI_ERR_MAX
263 };
264 
265 /**
266  * This enum is a direct replica of hal_reo_error_code enum.
267  * New element addition to the enum need to make a entry in this enum too.
268  * enum cdp_phy_rx_error_code - Error code describing the type of error detected
269  *
270  * @CDP_RX_ERR_QUEUE_ADDR_0: Rx queue descriptor is set to 0
271  * @CDP_RX_ERR_QUEUE_INVALID: Rx queue descriptor valid bit is NOT set
272  * @CDP_RX_ERR_AMPDU_IN_NON_BA: AMPDU frame received without BA session having
273  * been setup
274  * @CDP_RX_ERR_NON_BA_DUPLICATE: Non-BA session, SN equal to SSN retry bit set
275  * duplicate frame
276  * @CDP_RX_ERR_BA_DUPLICATE: BA session, duplicate frame
277  * @CDP_RX_ERR_REGULAR_FRAME_2K_JUMP: A normal management/data frame received
278  * with 2K jump in SN
279  * @CDP_RX_ERR_BAR_FRAME_2K_JUMP: A bar received with 2K jump in SSN
280  * @CDP_RX_ERR_REGULAR_FRAME_OOR: A normal management/data frame received with
281  * SN falling within the OOR window
282  * @CDP_RX_ERR_BAR_FRAME_OOR: A bar received with SSN falling within the OOR
283  * window
284  * @CDP_RX_ERR_BAR_FRAME_NO_BA_SESSION: A bar received without a BA session
285  * @CDP_RX_ERR_BAR_FRAME_SN_EQUALS_SSN: A bar received with SSN equal to SN
286  * @CDP_RX_ERR_PN_CHECK_FAILED: PN Check Failed packet
287  * @CDP_RX_ERR_2K_ERROR_HANDLING_FLAG_SET: Frame is forwarded as a result of
288  * the Seq_2k_error_detected_flag been set in the REO Queue descriptor
289  * @CDP_RX_ERR_PN_ERROR_HANDLING_FLAG_SET: Frame is forwarded as a result of
290  * the pn_error_detected_flag been set in the REO Queue descriptor
291  * @CDP_RX_ERR_QUEUE_BLOCKED_SET: Frame is forwarded as a result of the queue
292  * descriptor(address) being blocked as SW/FW seems to be currently in the
293  * process of making updates to this descriptor
294  */
295 enum cdp_phy_rx_error_code {
296 	CDP_RX_ERR_QUEUE_ADDR_0 = 0,
297 	CDP_RX_ERR_QUEUE_INVALID,
298 	CDP_RX_ERR_AMPDU_IN_NON_BA,
299 	CDP_RX_ERR_NON_BA_DUPLICATE,
300 	CDP_RX_ERR_BA_DUPLICATE,
301 	CDP_RX_ERR_REGULAR_FRAME_2K_JUMP,
302 	CDP_RX_ERR_BAR_FRAME_2K_JUMP,
303 	CDP_RX_ERR_REGULAR_FRAME_OOR,
304 	CDP_RX_ERR_BAR_FRAME_OOR,
305 	CDP_RX_ERR_BAR_FRAME_NO_BA_SESSION,
306 	CDP_RX_ERR_BAR_FRAME_SN_EQUALS_SSN,
307 	CDP_RX_ERR_PN_CHECK_FAILED,
308 	CDP_RX_ERR_2K_ERROR_HANDLING_FLAG_SET,
309 	CDP_RX_ERR_PN_ERROR_HANDLING_FLAG_SET,
310 	CDP_RX_ERR_QUEUE_BLOCKED_SET,
311 	CDP_RX_ERR_MAX
312 };
313 
314 /*
315  * cdp_tx_transmit_type: Transmit type index
316  * SU: SU Transmit type index
317  * MU_MIMO: MU_MIMO Transmit type index
318  * MU_OFDMA: MU_OFDMA Transmit type index
319  * MU_MIMO_OFDMA: MU MIMO OFDMA Transmit type index
320  */
321 enum cdp_tx_transmit_type {
322 	SU = 0,
323 	MU_MIMO,
324 	MU_OFDMA,
325 	MU_MIMO_OFDMA,
326 };
327 
328 /*
329  * cdp_ru_index: Different RU index
330  *
331  * RU_26_INDEX : 26-tone Resource Unit index
332  * RU_52_INDEX : 52-tone Resource Unit index
333  * RU_52_26_INDEX : 52_26-tone Resource Unit index
334  * RU_106_INDEX: 106-tone Resource Unit index
335  * RU_106_26_INDEX: 106_26-tone Resource Unit index
336  * RU_242_INDEX: 242-tone Resource Unit index
337  * RU_484_INDEX: 484-tone Resource Unit index
338  * RU_484_242_INDEX: 484_242-tone Resource Unit index
339  * RU_996_INDEX: 996-tone Resource Unit index
340  * RU_996_484_INDEX: 996_484-tone Resource Unit index
341  * RU_996_484_242_INDEX: 996_484_242-tone Resource Unit index
342  * RU_2X996_INDEX: 2X996-tone Resource Unit index
343  * RU_2X996_484_INDEX: 2X996_484-tone Resource Unit index
344  * RU_3X996_INDEX: 3X996-tone Resource Unit index
345  * RU_3X996_484_INDEX: 3X996_484-tone Resource Unit index
346  * RU_4X996_INDEX: 4X996-tone Resource Unit index
347  */
348 
349 #ifdef WLAN_FEATURE_11BE
350 enum cdp_ru_index {
351 	RU_26_INDEX = 0,
352 	RU_52_INDEX,
353 	RU_52_26_INDEX,
354 	RU_106_INDEX,
355 	RU_106_26_INDEX,
356 	RU_242_INDEX,
357 	RU_484_INDEX,
358 	RU_484_242_INDEX,
359 	RU_996_INDEX,
360 	RU_996_484_INDEX,
361 	RU_996_484_242_INDEX,
362 	RU_2X996_INDEX,
363 	RU_2X996_484_INDEX,
364 	RU_3X996_INDEX,
365 	RU_3X996_484_INDEX,
366 	RU_4X996_INDEX,
367 	RU_INDEX_MAX,
368 };
369 #else
370 enum cdp_ru_index {
371 	RU_26_INDEX = 0,
372 	RU_52_INDEX,
373 	RU_106_INDEX,
374 	RU_242_INDEX,
375 	RU_484_INDEX,
376 	RU_996_INDEX,
377 	RU_INDEX_MAX,
378 };
379 #endif
380 
381 struct cdp_ru_debug {
382 	char *ru_type;
383 };
384 
385 #ifdef WLAN_FEATURE_11BE
386 static const struct cdp_ru_debug cdp_ru_string[RU_INDEX_MAX] = {
387 	{ "RU_26" },
388 	{ "RU_52" },
389 	{ "RU_52_26" },
390 	{ "RU_106" },
391 	{ "RU_106_26" },
392 	{ "RU_242" },
393 	{ "RU_484" },
394 	{ "RU_484_242" },
395 	{ "RU_996" },
396 	{ "RU_996_484" },
397 	{ "RU_996_484_242" },
398 	{ "RU_2x996" },
399 	{ "RU_2x996_484" },
400 	{ "RU_3x996" },
401 	{ "RU_3x996_484" },
402 	{ "RU_4x996" },
403 };
404 #else
405 static const struct cdp_ru_debug cdp_ru_string[RU_INDEX_MAX] = {
406 	{ "RU_26" },
407 	{ "RU_52" },
408 	{ "RU_106" },
409 	{ "RU_242" },
410 	{ "RU_484" },
411 	{ "RU_996" }
412 };
413 #endif
414 
415 #ifdef FEATURE_TSO_STATS
416 /* Number of TSO Packet Statistics captured */
417 #define CDP_MAX_TSO_PACKETS 5
418 /* Information for Number of Segments for a TSO Packet captured */
419 #define CDP_MAX_TSO_SEGMENTS 2
420 /* Information for Number of Fragments for a TSO Segment captured */
421 #define CDP_MAX_TSO_FRAGMENTS 6
422 #endif /* FEATURE_TSO_STATS */
423 
424 /* Different Packet Types */
425 enum cdp_packet_type {
426 	DOT11_A = 0,
427 	DOT11_B = 1,
428 	DOT11_N = 2,
429 	DOT11_AC = 3,
430 	DOT11_AX = 4,
431 #ifdef WLAN_FEATURE_11BE
432 	DOT11_BE = 5,
433 #endif
434 	DOT11_MAX,
435 };
436 
437 #define MCS_VALID 1
438 #define MCS_INVALID 0
439 
440 #ifdef WLAN_FEATURE_11BE
441 #define CDP_IS_PKT_TYPE_SUPPORT_NSS(_pkt_type) \
442 		(DOT11_N == (_pkt_type) || DOT11_AC == (_pkt_type) || \
443 		 DOT11_AX == (_pkt_type) || DOT11_BE == (_pkt_type))
444 #else
445 #define CDP_IS_PKT_TYPE_SUPPORT_NSS(_pkt_type) \
446 		(DOT11_N == (_pkt_type) || DOT11_AC == (_pkt_type) || \
447 		 DOT11_AX == (_pkt_type))
448 #endif /* WLAN_FEATURE_11BE */
449 
450 #define CDP_MAX_MCS_STRING_LEN 34
451 /*
452  * struct cdp_rate_debug
453  *
454  * @mcs_type: print string for a given mcs
455  * @valid: valid mcs rate?
456  */
457 struct cdp_rate_debug {
458 	char mcs_type[CDP_MAX_MCS_STRING_LEN];
459 	uint8_t valid;
460 };
461 
462 #ifdef WLAN_FEATURE_11BE
463 static const struct cdp_rate_debug cdp_rate_string[DOT11_MAX][MAX_MCS] = {
464 	{
465 		{"OFDM 48 Mbps", MCS_VALID},
466 		{"OFDM 24 Mbps", MCS_VALID},
467 		{"OFDM 12 Mbps", MCS_VALID},
468 		{"OFDM 6 Mbps ", MCS_VALID},
469 		{"OFDM 54 Mbps", MCS_VALID},
470 		{"OFDM 36 Mbps", MCS_VALID},
471 		{"OFDM 18 Mbps", MCS_VALID},
472 		{"OFDM 9 Mbps ", MCS_VALID},
473 		{"INVALID ", MCS_INVALID},
474 		{"INVALID ", MCS_INVALID},
475 		{"INVALID ", MCS_INVALID},
476 		{"INVALID ", MCS_INVALID},
477 		{"INVALID ", MCS_INVALID},
478 		{"INVALID ", MCS_INVALID},
479 		{"INVALID ", MCS_INVALID},
480 		{"INVALID ", MCS_INVALID},
481 		{"INVALID ", MCS_INVALID},
482 	},
483 	{
484 		{"CCK 11 Mbps Long  ", MCS_VALID},
485 		{"CCK 5.5 Mbps Long ", MCS_VALID},
486 		{"CCK 2 Mbps Long   ", MCS_VALID},
487 		{"CCK 1 Mbps Long   ", MCS_VALID},
488 		{"CCK 11 Mbps Short ", MCS_VALID},
489 		{"CCK 5.5 Mbps Short", MCS_VALID},
490 		{"CCK 2 Mbps Short  ", MCS_VALID},
491 		{"INVALID ", MCS_INVALID},
492 		{"INVALID ", MCS_INVALID},
493 		{"INVALID ", MCS_INVALID},
494 		{"INVALID ", MCS_INVALID},
495 		{"INVALID ", MCS_INVALID},
496 		{"INVALID ", MCS_INVALID},
497 		{"INVALID ", MCS_INVALID},
498 		{"INVALID ", MCS_INVALID},
499 		{"INVALID ", MCS_INVALID},
500 		{"INVALID ", MCS_INVALID},
501 	},
502 	{
503 		{"HT MCS 0 (BPSK 1/2)  ", MCS_VALID},
504 		{"HT MCS 1 (QPSK 1/2)  ", MCS_VALID},
505 		{"HT MCS 2 (QPSK 3/4)  ", MCS_VALID},
506 		{"HT MCS 3 (16-QAM 1/2)", MCS_VALID},
507 		{"HT MCS 4 (16-QAM 3/4)", MCS_VALID},
508 		{"HT MCS 5 (64-QAM 2/3)", MCS_VALID},
509 		{"HT MCS 6 (64-QAM 3/4)", MCS_VALID},
510 		{"HT MCS 7 (64-QAM 5/6)", MCS_VALID},
511 		{"INVALID ", MCS_INVALID},
512 		{"INVALID ", MCS_INVALID},
513 		{"INVALID ", MCS_INVALID},
514 		{"INVALID ", MCS_INVALID},
515 		{"INVALID ", MCS_INVALID},
516 		{"INVALID ", MCS_INVALID},
517 		{"INVALID ", MCS_INVALID},
518 		{"INVALID ", MCS_INVALID},
519 		{"INVALID ", MCS_INVALID},
520 	},
521 	{
522 		{"VHT MCS 0 (BPSK 1/2)     ", MCS_VALID},
523 		{"VHT MCS 1 (QPSK 1/2)     ", MCS_VALID},
524 		{"VHT MCS 2 (QPSK 3/4)     ", MCS_VALID},
525 		{"VHT MCS 3 (16-QAM 1/2)   ", MCS_VALID},
526 		{"VHT MCS 4 (16-QAM 3/4)   ", MCS_VALID},
527 		{"VHT MCS 5 (64-QAM 2/3)   ", MCS_VALID},
528 		{"VHT MCS 6 (64-QAM 3/4)   ", MCS_VALID},
529 		{"VHT MCS 7 (64-QAM 5/6)   ", MCS_VALID},
530 		{"VHT MCS 8 (256-QAM 3/4)  ", MCS_VALID},
531 		{"VHT MCS 9 (256-QAM 5/6)  ", MCS_VALID},
532 		{"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID},
533 		{"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID},
534 		{"INVALID ", MCS_INVALID},
535 		{"INVALID ", MCS_INVALID},
536 		{"INVALID ", MCS_INVALID},
537 		{"INVALID ", MCS_INVALID},
538 	},
539 	{
540 		{"HE MCS 0 (BPSK 1/2)     ", MCS_VALID},
541 		{"HE MCS 1 (QPSK 1/2)     ", MCS_VALID},
542 		{"HE MCS 2 (QPSK 3/4)     ", MCS_VALID},
543 		{"HE MCS 3 (16-QAM 1/2)   ", MCS_VALID},
544 		{"HE MCS 4 (16-QAM 3/4)   ", MCS_VALID},
545 		{"HE MCS 5 (64-QAM 2/3)   ", MCS_VALID},
546 		{"HE MCS 6 (64-QAM 3/4)   ", MCS_VALID},
547 		{"HE MCS 7 (64-QAM 5/6)   ", MCS_VALID},
548 		{"HE MCS 8 (256-QAM 3/4)  ", MCS_VALID},
549 		{"HE MCS 9 (256-QAM 5/6)  ", MCS_VALID},
550 		{"HE MCS 10 (1024-QAM 3/4)", MCS_VALID},
551 		{"HE MCS 11 (1024-QAM 5/6)", MCS_VALID},
552 		{"HE MCS 12 (4096-QAM 3/4)", MCS_VALID},
553 		{"HE MCS 13 (4096-QAM 5/6)", MCS_VALID},
554 		{"INVALID ", MCS_INVALID},
555 		{"INVALID ", MCS_INVALID},
556 		{"INVALID ", MCS_INVALID},
557 	},
558 	{
559 		{"EHT MCS 0 (BPSK 1/2)     ", MCS_VALID},
560 		{"EHT MCS 1 (QPSK 1/2)     ", MCS_VALID},
561 		{"EHT MCS 2 (QPSK 3/4)     ", MCS_VALID},
562 		{"EHT MCS 3 (16-QAM 1/2)   ", MCS_VALID},
563 		{"EHT MCS 4 (16-QAM 3/4)   ", MCS_VALID},
564 		{"EHT MCS 5 (64-QAM 2/3)   ", MCS_VALID},
565 		{"EHT MCS 6 (64-QAM 3/4)   ", MCS_VALID},
566 		{"EHT MCS 7 (64-QAM 5/6)   ", MCS_VALID},
567 		{"EHT MCS 8 (256-QAM 3/4)  ", MCS_VALID},
568 		{"EHT MCS 9 (256-QAM 5/6)  ", MCS_VALID},
569 		{"EHT MCS 10 (1024-QAM 3/4)", MCS_VALID},
570 		{"EHT MCS 11 (1024-QAM 5/6)", MCS_VALID},
571 		{"EHT MCS 12 (4096-QAM 3/4)", MCS_VALID},
572 		{"EHT MCS 13 (4096-QAM 5/6)", MCS_VALID},
573 		{"EHT MCS 14 (BPSK-DCM 1/2)", MCS_VALID},
574 		{"EHT MCS 15 (BPSK-DCM 1/2)", MCS_VALID},
575 		{"INVALID ", MCS_INVALID},
576 	}
577 };
578 #else
579 static const struct cdp_rate_debug cdp_rate_string[DOT11_MAX][MAX_MCS] = {
580 	{
581 		{"OFDM 48 Mbps", MCS_VALID},
582 		{"OFDM 24 Mbps", MCS_VALID},
583 		{"OFDM 12 Mbps", MCS_VALID},
584 		{"OFDM 6 Mbps ", MCS_VALID},
585 		{"OFDM 54 Mbps", MCS_VALID},
586 		{"OFDM 36 Mbps", MCS_VALID},
587 		{"OFDM 18 Mbps", MCS_VALID},
588 		{"OFDM 9 Mbps ", MCS_VALID},
589 		{"INVALID ", MCS_INVALID},
590 		{"INVALID ", MCS_INVALID},
591 		{"INVALID ", MCS_INVALID},
592 		{"INVALID ", MCS_INVALID},
593 		{"INVALID ", MCS_INVALID},
594 	},
595 	{
596 		{"CCK 11 Mbps Long  ", MCS_VALID},
597 		{"CCK 5.5 Mbps Long ", MCS_VALID},
598 		{"CCK 2 Mbps Long   ", MCS_VALID},
599 		{"CCK 1 Mbps Long   ", MCS_VALID},
600 		{"CCK 11 Mbps Short ", MCS_VALID},
601 		{"CCK 5.5 Mbps Short", MCS_VALID},
602 		{"CCK 2 Mbps Short  ", MCS_VALID},
603 		{"INVALID ", MCS_INVALID},
604 		{"INVALID ", MCS_INVALID},
605 		{"INVALID ", MCS_INVALID},
606 		{"INVALID ", MCS_INVALID},
607 		{"INVALID ", MCS_INVALID},
608 		{"INVALID ", MCS_INVALID},
609 	},
610 	{
611 		{"HT MCS 0 (BPSK 1/2)  ", MCS_VALID},
612 		{"HT MCS 1 (QPSK 1/2)  ", MCS_VALID},
613 		{"HT MCS 2 (QPSK 3/4)  ", MCS_VALID},
614 		{"HT MCS 3 (16-QAM 1/2)", MCS_VALID},
615 		{"HT MCS 4 (16-QAM 3/4)", MCS_VALID},
616 		{"HT MCS 5 (64-QAM 2/3)", MCS_VALID},
617 		{"HT MCS 6 (64-QAM 3/4)", MCS_VALID},
618 		{"HT MCS 7 (64-QAM 5/6)", MCS_VALID},
619 		{"INVALID ", MCS_INVALID},
620 		{"INVALID ", MCS_INVALID},
621 		{"INVALID ", MCS_INVALID},
622 		{"INVALID ", MCS_INVALID},
623 		{"INVALID ", MCS_INVALID},
624 	},
625 	{
626 		{"VHT MCS 0 (BPSK 1/2)     ", MCS_VALID},
627 		{"VHT MCS 1 (QPSK 1/2)     ", MCS_VALID},
628 		{"VHT MCS 2 (QPSK 3/4)     ", MCS_VALID},
629 		{"VHT MCS 3 (16-QAM 1/2)   ", MCS_VALID},
630 		{"VHT MCS 4 (16-QAM 3/4)   ", MCS_VALID},
631 		{"VHT MCS 5 (64-QAM 2/3)   ", MCS_VALID},
632 		{"VHT MCS 6 (64-QAM 3/4)   ", MCS_VALID},
633 		{"VHT MCS 7 (64-QAM 5/6)   ", MCS_VALID},
634 		{"VHT MCS 8 (256-QAM 3/4)  ", MCS_VALID},
635 		{"VHT MCS 9 (256-QAM 5/6)  ", MCS_VALID},
636 		{"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID},
637 		{"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID},
638 		{"INVALID ", MCS_INVALID},
639 	},
640 	{
641 		{"HE MCS 0 (BPSK 1/2)     ", MCS_VALID},
642 		{"HE MCS 1 (QPSK 1/2)     ", MCS_VALID},
643 		{"HE MCS 2 (QPSK 3/4)     ", MCS_VALID},
644 		{"HE MCS 3 (16-QAM 1/2)   ", MCS_VALID},
645 		{"HE MCS 4 (16-QAM 3/4)   ", MCS_VALID},
646 		{"HE MCS 5 (64-QAM 2/3)   ", MCS_VALID},
647 		{"HE MCS 6 (64-QAM 3/4)   ", MCS_VALID},
648 		{"HE MCS 7 (64-QAM 5/6)   ", MCS_VALID},
649 		{"HE MCS 8 (256-QAM 3/4)  ", MCS_VALID},
650 		{"HE MCS 9 (256-QAM 5/6)  ", MCS_VALID},
651 		{"HE MCS 10 (1024-QAM 3/4)", MCS_VALID},
652 		{"HE MCS 11 (1024-QAM 5/6)", MCS_VALID},
653 		{"HE MCS 12 (4096-QAM 3/4)", MCS_VALID},
654 		{"HE MCS 13 (4096-QAM 5/6)", MCS_VALID},
655 		{"INVALID ", MCS_INVALID},
656 	}
657 };
658 #endif
659 
660 /*
661  * cdp_mu_packet_type: MU type index
662  * TXRX_TYPE_MU_MIMO: MU MIMO type index
663  * TXRX_TYPE_MU_OFDMA: MU OFDMA type index
664  * TXRX_TYPE_MU_MAX: MU MAX type index
665  */
666 enum cdp_mu_packet_type {
667 	TXRX_TYPE_MU_MIMO = 0,
668 	TXRX_TYPE_MU_OFDMA = 1,
669 	TXRX_TYPE_MU_MAX = 2,
670 };
671 
672 /*
673  * peer_stats_type: peer stats type
674  * PEER_TX_STATS: stats type for tx
675  * PEER_RX_STATS: stats type for rx
676  */
677 enum peer_stats_type {
678 	PEER_TX_STATS,
679 	PEER_RX_STATS,
680 };
681 
682 enum WDI_EVENT {
683 	WDI_EVENT_TX_STATUS = WDI_EVENT_BASE,
684 	WDI_EVENT_OFFLOAD_ALL,
685 	WDI_EVENT_RX_DESC_REMOTE,
686 	WDI_EVENT_RX_PEER_INVALID,
687 	WDI_EVENT_DBG_PRINT, /* NEED to integrate pktlog changes*/
688 	WDI_EVENT_RX_CBF_REMOTE,
689 	WDI_EVENT_RATE_FIND,
690 	WDI_EVENT_RATE_UPDATE,
691 	WDI_EVENT_SW_EVENT,
692 	WDI_EVENT_RX_DESC,
693 	WDI_EVENT_LITE_T2H,
694 	WDI_EVENT_LITE_RX,
695 	WDI_EVENT_RX_PPDU_DESC,
696 	WDI_EVENT_TX_PPDU_DESC,
697 	WDI_EVENT_TX_MSDU_DESC,
698 	WDI_EVENT_TX_DATA,
699 	WDI_EVENT_RX_DATA,
700 	WDI_EVENT_TX_MGMT_CTRL,
701 	WDI_EVENT_TX_PKT_CAPTURE,
702 	WDI_EVENT_HTT_STATS,
703 	WDI_EVENT_TX_BEACON,
704 	WDI_EVENT_PEER_STATS,
705 	WDI_EVENT_TX_SOJOURN_STAT,
706 	WDI_EVENT_UPDATE_DP_STATS,
707 	WDI_EVENT_RX_MGMT_CTRL,
708 	WDI_EVENT_PEER_CREATE,
709 	WDI_EVENT_PEER_DESTROY,
710 	WDI_EVENT_PEER_FLUSH_RATE_STATS,
711 	WDI_EVENT_FLUSH_RATE_STATS_REQ,
712 	WDI_EVENT_RX_MPDU,
713 	WDI_EVENT_HMWDS_AST_ADD_STATUS,
714 	WDI_EVENT_PEER_QOS_STATS,
715 	WDI_EVENT_PKT_CAPTURE_TX_DATA,
716 	WDI_EVENT_PKT_CAPTURE_RX_DATA,
717 	WDI_EVENT_PKT_CAPTURE_RX_DATA_NO_PEER,
718 	WDI_EVENT_PKT_CAPTURE_OFFLOAD_TX_DATA,
719 	WDI_EVENT_RX_CBF,
720 	WDI_EVENT_PKT_CAPTURE_PPDU_STATS,
721 	WDI_EVENT_HOST_SW_EVENT,
722 	WDI_EVENT_HYBRID_TX,
723 #ifdef WLAN_FEATURE_11BE_MLO
724 	WDI_EVENT_MLO_TSTMP,
725 #endif
726 #ifdef QCA_UNDECODED_METADATA_SUPPORT
727 	WDI_EVENT_RX_PPDU_DESC_UNDECODED_METADATA,
728 #endif
729 	WDI_EVENT_LITE_MON_RX,
730 	WDI_EVENT_LITE_MON_TX,
731 	/* End of new event items */
732 	WDI_EVENT_LAST
733 };
734 
735 #define WDI_NUM_EVENTS WDI_EVENT_LAST - WDI_EVENT_BASE
736 
737 struct cdp_stats_extd {
738 };
739 
740 /* TID level Tx/Rx stats
741  *
742  */
743 enum cdp_txrx_tidq_stats {
744 	/* Tx Counters */
745 	TX_MSDU_TOTAL_LINUX_SUBSYSTEM,
746 	TX_MSDU_TOTAL_FROM_OSIF,
747 	TX_MSDU_TX_COMP_PKT_CNT,
748 	/* Rx Counters */
749 	RX_MSDU_TOTAL_FROM_FW,
750 	RX_MSDU_MCAST_FROM_FW,
751 	RX_TID_MISMATCH_FROM_FW,
752 	RX_MSDU_MISC_PKTS,
753 	RX_MSDU_IS_ARP,
754 	RX_MSDU_IS_EAP,
755 	RX_MSDU_IS_DHCP,
756 	RX_AGGREGATE_10,
757 	RX_AGGREGATE_20,
758 	RX_AGGREGATE_30,
759 	RX_AGGREGATE_40,
760 	RX_AGGREGATE_50,
761 	RX_AGGREGATE_60,
762 	RX_AGGREGATE_MORE,
763 	RX_AMSDU_1,
764 	RX_AMSDU_2,
765 	RX_AMSDU_3,
766 	RX_AMSDU_4,
767 	RX_AMSDU_MORE,
768 	RX_MSDU_CHAINED_FROM_FW,
769 	RX_MSDU_REORDER_FAILED_FROM_FW,
770 	RX_MSDU_REORDER_FLUSHED_FROM_FW,
771 	RX_MSDU_DISCARD_FROM_FW,
772 	RX_MSDU_DUPLICATE_FROM_FW,
773 	RX_MSDU_DELIVERED_TO_STACK,
774 	TIDQ_STATS_MAX,
775 };
776 
777 struct cdp_tidq_stats {
778 	uint32_t stats[TIDQ_STATS_MAX];
779 };
780 
781 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
782 /**
783  * struct cdp_rx_ppdu_cfr_info - struct for storing ppdu info extracted from HW
784  * TLVs, this will be used for CFR correlation
785  *
786  * @bb_captured_channel : Set by RXPCU when MACRX_FREEZE_CAPTURE_CHANNEL TLV is
787  * sent to PHY, SW checks it to correlate current PPDU TLVs with uploaded
788  * channel information.
789  *
790  * @bb_captured_timeout : Set by RxPCU to indicate channel capture condition is
791  * met, but MACRX_FREEZE_CAPTURE_CHANNEL is not sent to PHY due to AST delay,
792  * which means the rx_frame_falling edge to FREEZE TLV ready time exceeds
793  * the threshold time defined by RXPCU register FREEZE_TLV_DELAY_CNT_THRESH.
794  * Bb_captured_reason is still valid in this case.
795  *
796  * @bb_captured_reason : Copy capture_reason of MACRX_FREEZE_CAPTURE_CHANNEL
797  * TLV to here for FW usage. Valid when bb_captured_channel or
798  * bb_captured_timeout is set.
799  * <enum 0 freeze_reason_TM>
800  * <enum 1 freeze_reason_FTM>
801  * <enum 2 freeze_reason_ACK_resp_to_TM_FTM>
802  * <enum 3 freeze_reason_TA_RA_TYPE_FILTER>
803  * <enum 4 freeze_reason_NDPA_NDP>
804  * <enum 5 freeze_reason_ALL_PACKET>
805  * <legal 0-5>
806  *
807  * @rx_location_info_valid: Indicates whether CFR DMA address in the PPDU TLV
808  * is valid
809  * <enum 0 rx_location_info_is_not_valid>
810  * <enum 1 rx_location_info_is_valid>
811  * <legal all>
812  *
813  * @chan_capture_status : capture status reported by ucode
814  * a. CAPTURE_IDLE: FW has disabled "REPETITIVE_CHE_CAPTURE_CTRL"
815  * b. CAPTURE_BUSY: previous PPDU’s channel capture upload DMA ongoing. (Note
816  * that this upload is triggered after receiving freeze_channel_capture TLV
817  * after last PPDU is rx)
818  * c. CAPTURE_ACTIVE: channel capture is enabled and no previous channel
819  * capture ongoing
820  * d. CAPTURE_NO_BUFFER: next buffer in IPC ring not available
821  *
822  * @rtt_che_buffer_pointer_high8 : The high 8 bits of the 40 bits pointer to
823  * external RTT channel information buffer
824  *
825  * @rtt_che_buffer_pointer_low32 : The low 32 bits of the 40 bits pointer to
826  * external RTT channel information buffer
827  *
828  * @rtt_cfo_measurement : raw cfo data extracted from hardware, which is 14 bit
829  * signed number. The first bit used for sign representation and 13 bits for
830  * fractional part.
831  *
832  * @agc_gain_info0: Chain 0 & chain 1 agc gain information reported by PHY
833  *
834  * @agc_gain_info1: Chain 2 & chain 3 agc gain information reported by PHY
835  *
836  * @agc_gain_info2: Chain 4 & chain 5 agc gain information reported by PHY
837  *
838  * @agc_gain_info3: Chain 6 & chain 7 agc gain information reported by PHY
839  *
840  * @rx_start_ts: Rx packet timestamp, the time the first L-STF ADC sample
841  * arrived at Rx antenna.
842  *
843  * @mcs_rate: Indicates the mcs/rate in which packet is received.
844  * If HT,
845  *    0-7: MCS0-MCS7
846  * If VHT,
847  *    0-9: MCS0 to MCS9
848  * If HE,
849  *    0-11: MCS0 to MCS11,
850  *    12-13: 4096QAM,
851  *    14-15: reserved
852  * If Legacy,
853  *    0: 48 Mbps
854  *    1: 24 Mbps
855  *    2: 12 Mbps
856  *    3: 6 Mbps
857  *    4: 54 Mbps
858  *    5: 36 Mbps
859  *    6: 18 Mbps
860  *    7: 9 Mbps
861  *
862  * @gi_type: Indicates the guard interval.
863  *    0: 0.8 us
864  *    1: 0.4 us
865  *    2: 1.6 us
866  *    3: 3.2 us
867  */
868 struct cdp_rx_ppdu_cfr_info {
869 	bool bb_captured_channel;
870 	bool bb_captured_timeout;
871 	uint8_t bb_captured_reason;
872 	bool rx_location_info_valid;
873 	uint8_t chan_capture_status;
874 	uint8_t rtt_che_buffer_pointer_high8;
875 	uint32_t rtt_che_buffer_pointer_low32;
876 	int16_t rtt_cfo_measurement;
877 	uint32_t agc_gain_info0;
878 	uint32_t agc_gain_info1;
879 	uint32_t agc_gain_info2;
880 	uint32_t agc_gain_info3;
881 	uint32_t rx_start_ts;
882 	uint32_t mcs_rate;
883 	uint32_t gi_type;
884 };
885 #endif
886 /*
887  * struct cdp_rx_su_evm_info: Rx evm info
888  * @number_of_symbols: number of symbols
889  * @nss_count: number of spatial streams
890  * @pilot_count: number of pilot count
891  */
892 struct cdp_rx_su_evm_info {
893 	uint16_t number_of_symbols;
894 	uint8_t  nss_count;
895 	uint8_t  pilot_count;
896 	uint32_t pilot_evm[DP_RX_MAX_SU_EVM_COUNT];
897 };
898 
899 /*
900  * cdp_delay_stats_mode: Different types of delay statistics
901  *
902  * @CDP_DELAY_STATS_SW_ENQ: Stack to hw enqueue delay
903  * @CDP_DELAY_STATS_TX_INTERFRAME: Interframe delay at radio entry point
904  * @CDP_DELAY_STATS_FW_HW_TRANSMIT: Hw enqueue to tx completion delay
905  * @CDP_DELAY_STATS_REAP_STACK: Delay in ring reap to indicating network stack
906  * @CDP_DELAY_STATS_RX_INTERFRAME: Rx inteframe delay
907  * @CDP_DELAY_STATS_MODE_MAX: Maximum delay mode
908  */
909 enum cdp_delay_stats_mode {
910 	CDP_DELAY_STATS_SW_ENQ,
911 	CDP_DELAY_STATS_TX_INTERFRAME,
912 	CDP_DELAY_STATS_FW_HW_TRANSMIT,
913 	CDP_DELAY_STATS_REAP_STACK,
914 	CDP_DELAY_STATS_RX_INTERFRAME,
915 	CDP_DELAY_STATS_MODE_MAX,
916 };
917 
918 /*
919  * cdp_delay_bucket_index
920  *	Index to be used for all delay stats
921  */
922 enum cdp_delay_bucket_index {
923 	CDP_DELAY_BUCKET_0,
924 	CDP_DELAY_BUCKET_1,
925 	CDP_DELAY_BUCKET_2,
926 	CDP_DELAY_BUCKET_3,
927 	CDP_DELAY_BUCKET_4,
928 	CDP_DELAY_BUCKET_5,
929 	CDP_DELAY_BUCKET_6,
930 	CDP_DELAY_BUCKET_7,
931 	CDP_DELAY_BUCKET_8,
932 	CDP_DELAY_BUCKET_9,
933 	CDP_DELAY_BUCKET_10,
934 	CDP_DELAY_BUCKET_11,
935 	CDP_DELAY_BUCKET_12,
936 	CDP_DELAY_BUCKET_MAX,
937 };
938 
939 /*
940  * struct cdp_tx_host_drop - packet drop due to following reasons.
941  */
942 enum cdp_tx_sw_drop {
943 	TX_DESC_ERR,
944 	TX_HAL_RING_ACCESS_ERR,
945 	TX_DMA_MAP_ERR,
946 	TX_HW_ENQUEUE,
947 	TX_SW_ENQUEUE,
948 	TX_MAX_DROP,
949 };
950 
951 /*
952  * struct cdp_rx_host_drop - packet drop due to following reasons.
953  */
954 enum cdp_rx_sw_drop {
955 	INTRABSS_DROP,
956 	MSDU_DONE_FAILURE,
957 	INVALID_PEER_VDEV,
958 	POLICY_CHECK_DROP,
959 	MEC_DROP,
960 	NAWDS_MCAST_DROP,
961 	MESH_FILTER_DROP,
962 	ENQUEUE_DROP,
963 	RX_MAX_DROP,
964 };
965 
966 /*
967  * struct cdp_delay_stats
968  * @delay_bucket: division of buckets as per latency
969  * @min_delay: minimum delay
970  * @max_delay: maximum delay
971  * @avg_delay: average delay
972  */
973 struct cdp_delay_stats {
974 	uint64_t delay_bucket[CDP_DELAY_BUCKET_MAX];
975 	uint32_t min_delay;
976 	uint32_t max_delay;
977 	uint32_t avg_delay;
978 };
979 
980 /*
981  * struct cdp_tid_tx_stats
982  * @swq_delay: delay between wifi driver entry point and enqueue to HW in tx
983  * @hwtx_delay: delay between wifi driver exit (enqueue to HW) and tx completion
984  * @intfrm_delay: interframe delay
985  * @success_cnt: total successful transmit count
986  * @comp_fail_cnt: firmware drop found in tx completion path
987  * @swdrop_cnt: software drop in tx path
988  * @tqm_status_cnt: TQM completion status count
989  * @htt_status_cnt: HTT completion status count
990  */
991 struct cdp_tid_tx_stats {
992 	struct cdp_delay_stats swq_delay;
993 	struct cdp_delay_stats hwtx_delay;
994 	struct cdp_delay_stats intfrm_delay;
995 	uint64_t success_cnt;
996 	uint64_t comp_fail_cnt;
997 	uint64_t swdrop_cnt[TX_MAX_DROP];
998 	uint64_t tqm_status_cnt[CDP_MAX_TX_TQM_STATUS];
999 	uint64_t htt_status_cnt[CDP_MAX_TX_HTT_STATUS];
1000 };
1001 
1002 /*
1003  * cdp_reo_error_stats
1004  * @err_src_reo_code_inv: Wireless Buffer Manager source receive reorder ring reason unknown
1005  * @err_reo_codes: Receive reorder error codes
1006  */
1007 struct cdp_reo_error_stats {
1008 	uint64_t err_src_reo_code_inv;
1009 	uint64_t err_reo_codes[CDP_REO_CODE_MAX];
1010 };
1011 
1012 /*
1013  * cdp_rxdma_error_stats
1014  * @err_src_rxdma_code_inv: DMA reason unknown count
1015  * @err_reo_codes: Receive reorder error codes count
1016  */
1017 struct cdp_rxdma_error_stats {
1018 	uint64_t err_src_rxdma_code_inv;
1019 	uint64_t err_dma_codes[CDP_DMA_CODE_MAX];
1020 };
1021 
1022 /*
1023  * struct cdp_tid_tx_stats
1024  * @to_stack_delay: Time taken between ring reap to indication to network stack
1025  * @intfrm_delay: Interframe rx delay
1026  * @delivered_cnt: Total packets indicated to stack
1027  * @intrabss_cnt: Rx total intraBSS frames
1028  * @msdu_cnt: number of msdu received from HW
1029  * @mcast_msdu_cnt: Num Mcast Msdus received from HW in Rx
1030  * @bcast_msdu_cnt: Num Bcast Msdus received from HW in Rx
1031  * @fail_cnt: Rx deliver drop counters
1032  * @reo_err: V3 reo error statistics
1033  * @rxdma_err: V3 rxdma error statistics
1034  */
1035 struct cdp_tid_rx_stats {
1036 	struct cdp_delay_stats to_stack_delay;
1037 	struct cdp_delay_stats intfrm_delay;
1038 	uint64_t delivered_to_stack;
1039 	uint64_t intrabss_cnt;
1040 	uint64_t msdu_cnt;
1041 	uint64_t mcast_msdu_cnt;
1042 	uint64_t bcast_msdu_cnt;
1043 	uint64_t fail_cnt[RX_MAX_DROP];
1044 	struct cdp_reo_error_stats reo_err;
1045 	struct cdp_rxdma_error_stats rxdma_err;
1046 };
1047 
1048 /*
1049  * struct cdp_tid_stats
1050  * @ingress_stack: Total packets received from linux stack
1051  * @osif_drop: drops in osif layer
1052  * @tid_tx_stats: transmit counters per tid
1053  * @tid_rx_stats: receive counters per tid
1054  */
1055 struct cdp_tid_stats {
1056 	uint64_t ingress_stack;
1057 	uint64_t osif_drop;
1058 	struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS]
1059 					    [CDP_MAX_DATA_TIDS];
1060 	struct cdp_tid_rx_stats tid_rx_stats[CDP_MAX_RX_RINGS]
1061 					    [CDP_MAX_DATA_TIDS];
1062 	struct cdp_tid_rx_stats tid_rx_wbm_stats[CDP_MAX_RX_WBM_RINGS]
1063 						[CDP_MAX_DATA_TIDS];
1064 };
1065 
1066 /*
1067  * struct cdp_tid_stats_intf
1068  * @ingress_stack: Total packets received from linux stack
1069  * @osif_drop: drops in osif layer
1070  * @tx_total: total of per ring transmit counters per tid
1071  * @rx_total: total of per ring receive counters per tid
1072  */
1073 struct cdp_tid_stats_intf {
1074 	uint64_t ingress_stack;
1075 	uint64_t osif_drop;
1076 	struct cdp_tid_tx_stats tx_total[CDP_MAX_DATA_TIDS];
1077 	struct cdp_tid_rx_stats rx_total[CDP_MAX_DATA_TIDS];
1078 };
1079 
1080 /*
1081  * struct cdp_delay_tx_stats: Tx delay stats
1082  * @tx_swq_delay: software enqueue delay
1083  * @hwtx_delay: HW enqueue to completion delay
1084  * @nwdelay_avg: Network delay average
1085  * @swdelay_avg: Wifi SW Delay Average
1086  * @hwdelay_avg: Wifi HW delay Average
1087  * @sw_delay_win_total: total NW delay for each window
1088  * @hw_delay_win_total: total Wifi SW delay for each window
1089  * @nw_delay_win_total: total Wifi HW delay for each window
1090  *
1091  * @cur_win_num_pkts: number of packets processed in current window
1092  * @cur_win_index: current windows index
1093  */
1094 struct cdp_delay_tx_stats {
1095 	struct cdp_hist_stats    tx_swq_delay;
1096 	struct cdp_hist_stats    hwtx_delay;
1097 
1098 #ifdef CONFIG_SAWF
1099 	uint32_t nwdelay_avg;
1100 	uint32_t swdelay_avg;
1101 	uint32_t hwdelay_avg;
1102 
1103 	uint64_t nw_delay_win_avg[CDP_MAX_WIN_MOV_AVG];
1104 	uint64_t sw_delay_win_avg[CDP_MAX_WIN_MOV_AVG];
1105 	uint64_t hw_delay_win_avg[CDP_MAX_WIN_MOV_AVG];
1106 
1107 	uint32_t cur_win_num_pkts;
1108 	uint32_t curr_win_idx;
1109 #endif
1110 };
1111 
1112 /*
1113  * struct cdp_delay_rx_stats: Rx delay stats
1114  * @to_stack_delay: To stack delay
1115  */
1116 struct cdp_delay_rx_stats {
1117 	struct cdp_hist_stats    to_stack_delay;
1118 };
1119 
1120 /*
1121  * struct cdp_delay_tid_stats: Delay tid stats
1122  * @tx_delay: Tx delay related stats
1123  * @rx_delay: Rx delay related stats
1124  */
1125 struct cdp_delay_tid_stats {
1126 	struct cdp_delay_tx_stats  tx_delay;
1127 	struct cdp_delay_rx_stats  rx_delay;
1128 };
1129 
1130 /* struct cdp_pkt_info - packet info
1131  * @num: no of packets
1132  * @bytes: total no of bytes
1133  */
1134 struct cdp_pkt_info {
1135 	uint32_t num;
1136 	uint64_t bytes;
1137 };
1138 
1139 /* struct cdp_pkt_type - packet type
1140  * @mcs_count: Counter array for each MCS index
1141  */
1142 struct cdp_pkt_type {
1143 	uint32_t mcs_count[MAX_MCS];
1144 };
1145 
1146 /*
1147  * struct cdp_rx_mu - Rx MU Stats
1148  * @ppdu_nss[SS_COUNT]: Packet Count in spatial streams
1149  * @mpdu_cnt_fcs_ok: Rx success mpdu count
1150  * @mpdu_cnt_fcs_err: Rx fail mpdu count
1151  * @cdp_pkt_type: counter array for each MCS index
1152  */
1153 struct cdp_rx_mu {
1154 	uint32_t ppdu_nss[SS_COUNT];
1155 	uint32_t mpdu_cnt_fcs_ok;
1156 	uint32_t mpdu_cnt_fcs_err;
1157 	struct cdp_pkt_type ppdu;
1158 };
1159 
1160 /* struct cdp_tx_pkt_info - tx packet info
1161  * num_msdu - successful msdu
1162  * num_mpdu - successful mpdu from compltn common
1163  * mpdu_tried - mpdu tried
1164  *
1165  * tx packet info counter field for mpdu success/tried and msdu
1166  */
1167 struct cdp_tx_pkt_info {
1168 	uint32_t num_msdu;
1169 	uint32_t num_mpdu;
1170 	uint32_t mpdu_tried;
1171 };
1172 
1173 #ifdef FEATURE_TSO_STATS
1174 /**
1175  * struct cdp_tso_seg_histogram - Segment histogram for TCP Packets
1176  * @segs_1: packets with single segments
1177  * @segs_2_5: packets with 2-5 segments
1178  * @segs_6_10: packets with 6-10 segments
1179  * @segs_11_15: packets with 11-15 segments
1180  * @segs_16_20: packets with 16-20 segments
1181  * @segs_20_plus: packets with 20 plus segments
1182  */
1183 struct cdp_tso_seg_histogram {
1184 	uint64_t segs_1;
1185 	uint64_t segs_2_5;
1186 	uint64_t segs_6_10;
1187 	uint64_t segs_11_15;
1188 	uint64_t segs_16_20;
1189 	uint64_t segs_20_plus;
1190 };
1191 
1192 /**
1193  * struct cdp_tso_packet_info - Stats for TSO segments within a TSO packet
1194  * @tso_seg: TSO Segment information
1195  * @num_seg: Number of segments
1196  * @tso_packet_len: Size of the tso packet
1197  * @tso_seg_idx: segment number
1198  */
1199 struct cdp_tso_packet_info {
1200 	struct qdf_tso_seg_t tso_seg[CDP_MAX_TSO_SEGMENTS];
1201 	uint8_t num_seg;
1202 	size_t tso_packet_len;
1203 	uint32_t tso_seg_idx;
1204 };
1205 
1206 /**
1207  * struct cdp_tso_info - stats for tso packets
1208  * @tso_packet_info: TSO packet information
1209  */
1210 struct cdp_tso_info {
1211 	struct cdp_tso_packet_info tso_packet_info[CDP_MAX_TSO_PACKETS];
1212 };
1213 #endif /* FEATURE_TSO_STATS */
1214 
1215 /**
1216  * struct cdp_tso_stats -  TSO stats information
1217  * @num_tso_pkts: Total number of TSO Packets
1218  * @tso_comp: Total tso packet completions
1219  * @dropped_host: TSO packets dropped by host
1220  * @tso_no_mem_dropped: TSO packets dropped by host due to descriptor
1221 			unavailablity
1222  * @dropped_target: TSO packets_dropped by target
1223  * @tso_info: Per TSO packet counters
1224  * @seg_histogram: TSO histogram stats
1225  */
1226 struct cdp_tso_stats {
1227 	struct cdp_pkt_info num_tso_pkts;
1228 	uint32_t tso_comp;
1229 	struct cdp_pkt_info dropped_host;
1230 	struct cdp_pkt_info tso_no_mem_dropped;
1231 	uint32_t dropped_target;
1232 #ifdef FEATURE_TSO_STATS
1233 	struct cdp_tso_info tso_info;
1234 	struct cdp_tso_seg_histogram seg_histogram;
1235 #endif /* FEATURE_TSO_STATS */
1236 };
1237 
1238 #define CDP_PEER_STATS_START 0
1239 
1240 enum cdp_peer_stats_type {
1241 	cdp_peer_stats_min = CDP_PEER_STATS_START,
1242 	/* Peer per pkt stats */
1243 	cdp_peer_per_pkt_stats_min = cdp_peer_stats_min,
1244 	cdp_peer_tx_ucast = cdp_peer_per_pkt_stats_min,
1245 	cdp_peer_tx_mcast,
1246 	cdp_peer_tx_inactive_time,
1247 	cdp_peer_rx_ucast,
1248 	/* Add enum for peer per pkt stats before this */
1249 	cdp_peer_per_pkt_stats_max,
1250 
1251 	/* Peer extd stats */
1252 	cdp_peer_extd_stats_min,
1253 	cdp_peer_tx_rate = cdp_peer_extd_stats_min,
1254 	cdp_peer_tx_last_tx_rate,
1255 	cdp_peer_tx_ratecode,
1256 	cdp_peer_tx_flags,
1257 	cdp_peer_tx_power,
1258 	cdp_peer_rx_rate,
1259 	cdp_peer_rx_last_rx_rate,
1260 	cdp_peer_rx_ratecode,
1261 	cdp_peer_rx_flags,
1262 	cdp_peer_rx_avg_snr,
1263 	cdp_peer_rx_snr,
1264 	/* Add enum for peer extd stats before this */
1265 	cdp_peer_extd_stats_max,
1266 	cdp_peer_stats_max = cdp_peer_extd_stats_max,
1267 };
1268 
1269 /*
1270  * The max size of cdp_peer_stats_param_t is limited to 16 bytes.
1271  * If the buffer size is exceeding this size limit,
1272  * dp_txrx_get_peer_stats is to be used instead.
1273  */
1274 typedef union cdp_peer_stats_buf {
1275 	/* Tx types */
1276 	struct cdp_pkt_info tx_ucast;
1277 	struct cdp_pkt_info tx_mcast;
1278 	uint32_t tx_rate;
1279 	uint32_t last_tx_rate;
1280 	uint32_t tx_inactive_time;
1281 	uint32_t tx_flags;
1282 	uint32_t tx_power;
1283 	uint16_t tx_ratecode;
1284 
1285 	/* Rx types */
1286 	struct cdp_pkt_info rx_ucast;
1287 	uint32_t rx_rate;
1288 	uint32_t last_rx_rate;
1289 	uint32_t rx_ratecode;
1290 	uint32_t rx_flags;
1291 	uint32_t rx_avg_snr;
1292 	uint32_t rx_snr;
1293 } cdp_peer_stats_param_t; /* Max union size 16 bytes */
1294 
1295 /**
1296  * enum cdp_protocol_trace -  Protocols supported by per-peer protocol trace
1297  * @CDP_TRACE_ICMP: ICMP packets
1298  * @CDP_TRACE_EAP: EAPOL packets
1299  * @CDP_TRACE_ARP: ARP packets
1300  *
1301  * Enumeration of all protocols supported by per-peer protocol trace feature
1302  */
1303 enum cdp_protocol_trace {
1304 	CDP_TRACE_ICMP,
1305 	CDP_TRACE_EAP,
1306 	CDP_TRACE_ARP,
1307 	CDP_TRACE_MAX
1308 };
1309 
1310 /**
1311  * struct protocol_trace_count - type of count on per-peer protocol trace
1312  * @egress_cnt: how many packets go out of host driver
1313  * @ingress_cnt: how many packets come into the host driver
1314  *
1315  * Type of count on per-peer protocol trace
1316  */
1317 struct protocol_trace_count {
1318 	uint16_t egress_cnt;
1319 	uint16_t ingress_cnt;
1320 };
1321 /* struct cdp_tx_stats - tx stats
1322  * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received
1323  * @cdp_pkt_info ucast: Unicast Packet Count
1324  * @cdp_pkt_info mcast: Multicast Packet Count
1325  * @cdp_pkt_info bcast: Broadcast Packet Count
1326  * @cdp_pkt_info nawds_mcast: NAWDS  Multicast Packet Count
1327  * @cdp_pkt_info tx_success: Successful Tx Packets
1328  * @nawds_mcast_drop: NAWDS  Multicast Drop Count
1329  * @protocol_trace_cnt: per-peer protocol counter
1330  * @tx_failed: Total Tx failure
1331  * @ofdma: Total Packets as ofdma
1332  * @stbc: Packets in STBC
1333  * @ldpc: Packets in LDPC
1334  * @retries: Packet retries
1335  * @retries_mpdu: mpdu number of successfully transmitted after retries
1336  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
1337  * @amsdu_cnt: Number of MSDUs part of AMSDU
1338  * @tx_rate: Tx Rate
1339  * @last_tx_rate: Last tx rate for unicast packets
1340  * @last_tx_rate_mcs: Tx rate mcs for unicast packets
1341  * @mcast_last_tx_rate: Last tx rate for multicast packets
1342  * @mcast_last_tx_rate_mcs: Last tx rate mcs for multicast
1343  * @last_per: Tx Per
1344  * @rnd_avg_tx_rate: Rounded average tx rate
1345  * @avg_tx_rate: Average TX rate
1346  * @last_ack_rssi: RSSI of last acked packet
1347  * @tx_bytes_success_last: last Tx success bytes
1348  * @tx_data_success_last: last Tx success data
1349  * @tx_byte_rate: Bytes Trasmitted in last one sec
1350  * @tx_data_rate: Data Transmitted in last one sec
1351  * @sgi_count[MAX_GI]: SGI count
1352  * @pream_punct_cnt: Preamble Punctured count
1353  * @nss[SS_COUNT]: Packet count for different num_spatial_stream values
1354  * @bw[MAX_BW]: Packet Count for different bandwidths
1355  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
1356  * @excess_retries_per_ac[WME_AC_MAX]: Wireless Multimedia type Count
1357  * @dot11_tx_pkts: dot11 tx packets
1358  * @fw_rem: Discarded by firmware
1359  * @fw_rem_notx: firmware_discard_untransmitted
1360  * @fw_rem_tx: firmware_discard_transmitted
1361  * @age_out: aged out in mpdu/msdu queues
1362  * @fw_reason1: discarded by firmware reason 1
1363  * @fw_reason2: discarded by firmware reason 2
1364  * @fw_reason3: discarded by firmware reason 3
1365  * @fw_rem_queue_disable: dropped due to queue disable
1366  * @fw_rem_no_match: dropped due to fw no match command
1367  * @drop_threshold: dropped due to HW threshold
1368  * @drop_link_desc_na: dropped due resource not available in HW
1369  * @invalid_drop: Invalid msdu drop
1370  * @mcast_vdev_drop: MCAST drop configured for VDEV in HW
1371  * @invalid_rr: Invalid TQM release reason
1372  * @mcs_count: MCS Count
1373  * @an_tx_cnt: ald tx count
1374  * @an_tx_rates_used: ald rx rate used
1375  * @an_tx_bytes: ald tx bytes
1376  * @ald_txcount: ald tx count
1377  * @ald_lastper: ald last PER
1378  * @ald_max4msframelen: ald max frame len
1379  * @an_tx_ratecount: ald tx ratecount
1380  * @ald_retries: ald retries
1381  * @ald_ac_nobufs: #buffer overflows per node per AC
1382  * @ald_ac_excretries: #pkts dropped after excessive retries per node per AC
1383  * @rssi_chain: rssi chain
1384  * @inactive_time: inactive time in secs
1385  * @tx_flags: tx flags
1386  * @tx_power: Tx power latest
1387  * @is_tx_no_ack: no ack received
1388  * @tx_ratecode: Tx rate code of last frame
1389  * @is_tx_nodefkey: tx failed 'cuz no defkey
1390  * @is_tx_noheadroom: tx failed 'cuz no space
1391  * @is_crypto_enmicfail:
1392  * @is_tx_nonode: tx failed for no node
1393  * @is_tx_unknownmgt: tx of unknown mgt frame
1394  * @is_tx_badcipher: tx failed 'cuz key type
1395  * @ampdu_cnt: completion of aggregation
1396  * @non_ampdu_cnt: tx completion not aggregated
1397  * @failed_retry_count: packets failed due to retry above 802.11 retry limit
1398  * @retry_count: packets successfully send after one or more retry
1399  * @multiple_retry_count: packets successfully sent after more than one retry
1400  * @tx_ppdus: ppdus in tx
1401  * @tx_mpdus_success: mpdus successful in tx
1402  * @tx_mpdus_tried: mpdus tried in tx
1403  * @transmit_type: pkt info for tx transmit type
1404  * @mu_group_id: mumimo mu group id
1405  * @ru_start: RU start index
1406  * @ru_tones: RU tones size
1407  * @ru_loc: pkt info for RU location 26/ 52/ 106/ 242/ 484 counter
1408  * @num_ppdu_cookie_valid : Number of comp received with valid ppdu cookie
1409  * @tx_success_twt: Successful Tx Packets in TWT session
1410  * @nss_info: NSS 1,2, ...8
1411  * @mcs_info: MCS index
1412  * @bw_info: Bandwidth
1413  *       <enum 0 bw_20_MHz>
1414  *       <enum 1 bw_40_MHz>
1415  *       <enum 2 bw_80_MHz>
1416  *       <enum 3 bw_160_MHz>
1417  * @gi_info: <enum 0     0_8_us_sgi > Legacy normal GI
1418  *       <enum 1     0_4_us_sgi > Legacy short GI
1419  *       <enum 2     1_6_us_sgi > HE related GI
1420  *       <enum 3     3_2_us_sgi > HE
1421  * @preamble_info: preamble
1422  * @last_tx_ts: last timestamp in jiffies when tx comp occurred
1423  * @su_be_ppdu_cnt: SU Tx packet count
1424  * @mu_be_ppdu_cnt: MU Tx packet count
1425  * @punc_bw[MAX_PUNCTURED_MODE]: MSDU count for punctured BW
1426  * @release_src_not_tqm: Counter to keep track of release source is not TQM
1427  *			 in TX completion status processing
1428  * @per: Packet error ratio
1429  */
1430 struct cdp_tx_stats {
1431 	struct cdp_pkt_info comp_pkt;
1432 	struct cdp_pkt_info ucast;
1433 	struct cdp_pkt_info mcast;
1434 	struct cdp_pkt_info bcast;
1435 	struct cdp_pkt_info nawds_mcast;
1436 #ifdef VDEV_PEER_PROTOCOL_COUNT
1437 	struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
1438 #endif
1439 	struct cdp_pkt_info tx_success;
1440 	uint32_t nawds_mcast_drop;
1441 	uint32_t tx_failed;
1442 	uint32_t ofdma;
1443 	uint32_t stbc;
1444 	uint32_t ldpc;
1445 	uint32_t retries;
1446 	uint32_t retries_mpdu;
1447 	uint32_t non_amsdu_cnt;
1448 	uint32_t amsdu_cnt;
1449 	uint32_t tx_rate;
1450 	uint32_t last_tx_rate;
1451 	uint32_t last_tx_rate_mcs;
1452 	uint32_t mcast_last_tx_rate;
1453 	uint32_t mcast_last_tx_rate_mcs;
1454 	uint32_t last_per;
1455 	uint64_t rnd_avg_tx_rate;
1456 	uint64_t avg_tx_rate;
1457 	uint32_t last_ack_rssi;
1458 	uint32_t tx_bytes_success_last;
1459 	uint32_t tx_data_success_last;
1460 	uint32_t tx_byte_rate;
1461 	uint32_t tx_data_rate;
1462 	uint32_t tx_data_ucast_last;
1463 	uint32_t tx_data_ucast_rate;
1464 	struct cdp_pkt_type pkt_type[DOT11_MAX];
1465 	uint32_t sgi_count[MAX_GI];
1466 	uint32_t pream_punct_cnt;
1467 
1468 	uint32_t nss[SS_COUNT];
1469 
1470 	uint32_t bw[MAX_BW];
1471 
1472 	uint32_t wme_ac_type[WME_AC_MAX];
1473 
1474 	uint32_t excess_retries_per_ac[WME_AC_MAX];
1475 	struct cdp_pkt_info dot11_tx_pkts;
1476 
1477 	struct {
1478 		struct cdp_pkt_info fw_rem;
1479 		uint32_t fw_rem_notx;
1480 		uint32_t fw_rem_tx;
1481 		uint32_t age_out;
1482 		uint32_t fw_reason1;
1483 		uint32_t fw_reason2;
1484 		uint32_t fw_reason3;
1485 		uint32_t fw_rem_queue_disable;
1486 		uint32_t fw_rem_no_match;
1487 		uint32_t drop_threshold;
1488 		uint32_t drop_link_desc_na;
1489 		uint32_t invalid_drop;
1490 		uint32_t mcast_vdev_drop;
1491 		uint32_t invalid_rr;
1492 	} dropped;
1493 
1494 
1495 	uint32_t fw_tx_cnt;
1496 	uint32_t fw_tx_bytes;
1497 	uint32_t fw_txcount;
1498 	uint32_t fw_max4msframelen;
1499 	uint32_t fw_ratecount;
1500 
1501 	uint32_t ac_nobufs[WME_AC_MAX];
1502 	uint32_t rssi_chain[WME_AC_MAX];
1503 	uint32_t inactive_time;
1504 
1505 	uint32_t tx_flags;
1506 	uint32_t tx_power;
1507 
1508 	/* MSDUs which the target sent but couldn't get an ack for */
1509 	struct cdp_pkt_info is_tx_no_ack;
1510 	uint16_t tx_ratecode;
1511 
1512 	/*add for peer and updated from ppdu*/
1513 	uint32_t ampdu_cnt;
1514 	uint32_t non_ampdu_cnt;
1515 	uint32_t failed_retry_count;
1516 	uint32_t retry_count;
1517 	uint32_t multiple_retry_count;
1518 	uint32_t last_tx_rate_used;
1519 	uint32_t tx_ppdus;
1520 	uint32_t tx_mpdus_success;
1521 	uint32_t tx_mpdus_tried;
1522 
1523 	struct cdp_tx_pkt_info transmit_type[MAX_TRANSMIT_TYPES];
1524 	uint32_t mu_group_id[MAX_MU_GROUP_ID];
1525 	uint32_t ru_start;
1526 	uint32_t ru_tones;
1527 	struct cdp_tx_pkt_info ru_loc[MAX_RU_LOCATIONS];
1528 
1529 	uint32_t num_ppdu_cookie_valid;
1530 	uint32_t no_ack_count[QDF_PROTO_SUBTYPE_MAX];
1531 	struct cdp_pkt_info tx_success_twt;
1532 
1533 	uint32_t nss_info:4,
1534 		 mcs_info:4,
1535 		 bw_info:4,
1536 		 gi_info:4,
1537 		 preamble_info:4;
1538 	/* mpdu retry count in case of successful transmission */
1539 	uint32_t mpdu_success_with_retries;
1540 	unsigned long last_tx_ts;
1541 #ifdef WLAN_FEATURE_11BE
1542 	struct cdp_pkt_type su_be_ppdu_cnt;
1543 	struct cdp_pkt_type mu_be_ppdu_cnt[TXRX_TYPE_MU_MAX];
1544 	uint32_t punc_bw[MAX_PUNCTURED_MODE];
1545 #endif
1546 	uint32_t release_src_not_tqm;
1547 	uint32_t per;
1548 };
1549 
1550 /* struct cdp_rx_stats - rx Level Stats
1551  * @to_stack: Total packets sent up the stack
1552  * @rcvd_reo[CDP_MAX_RX_RINGS]:  Packets received on the reo ring
1553  * @rx_lmac[CDP_MAX_LMACS]: Packets received on which lmac
1554  * @unicast: Total unicast packets
1555  * @multicast: Total multicast packets
1556  * @bcast:  Broadcast Packet Count
1557  * @raw: Raw Pakets received
1558  * @nawds_mcast_drop: Total multicast packets
1559  * @mec_drop: Total MEC packets dropped
1560  * @last_rx_ts: last timestamp in jiffies when RX happened
1561  * @pkts: Intra BSS packets received
1562  * @fail: Intra BSS packets failed
1563  * @mdns_no_fwd: Intra BSS MDNS packets not forwarded
1564  * @protocol_trace_cnt: per-peer protocol counters
1565  * @mic_err: Rx MIC errors CCMP
1566  * @decrypt_err: Rx Decryption Errors CRC
1567  * @fcserr: rx MIC check failed (CCMP)
1568  * @pn_err: pn check failed
1569  * @oor_err: Rx OOR errors
1570  * @jump_2k_err: 2k jump errors
1571  * @rxdma_wifi_parse_err: rxdma wifi parse errors
1572  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
1573  * @reception_type[MAX_RECEPTION_TYPES]: Reception type os packets
1574  * @mcs_count[MAX_MCS]: mcs count
1575  * @sgi_count[MAX_GI]: sgi count
1576  * @nss[SS_COUNT]: packet count in spatiel Streams
1577  * @ppdu_nss[SS_COUNT]: PPDU packet count in spatial streams
1578  * @mpdu_cnt_fcs_ok: SU Rx success mpdu count
1579  * @mpdu_cnt_fcs_err: SU Rx fail mpdu count
1580  * @su_ax_ppdu_cnt: SU Rx packet count
1581  * @ppdu_cnt[MAX_RECEPTION_TYPES]: PPDU packet count in reception type
1582  * @rx_mu[TXRX_TYPE_MU_MAX]: Rx MU stats
1583  * @bw[MAX_BW]:  Packet Count in different bandwidths
1584  * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation
1585  * @ampdu_cnt: Number of MSDUs part of AMSPU
1586  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
1587  * @amsdu_cnt: Number of MSDUs part of AMSDU
1588  * @bar_recv_cnt: Number of bar received
1589  * @avg_snr: Average snr
1590  * @rx_rate: Rx rate
1591  * @last_rx_rate: Previous rx rate
1592  * @rnd_avg_rx_rate: Rounded average rx rate
1593  * @avg_rx_rate:  Average Rx rate
1594  * @dot11_rx_pkts: dot11 rx packets
1595  * @rx_bytes_last: last Rx success bytes
1596  * @rx_data_last: last rx success data
1597  * @rx_byte_rate: bytes received in last one sec
1598  * @rx_data_rate: data received in last one sec
1599  * @rx_retries: retries of packet in rx
1600  * @rx_mpdus: mpdu in rx
1601  * @rx_ppdus: ppdu in rx
1602  * @is_rx_tooshort: tooshort
1603  * @is_rx_decap: rx decap
1604  * @rx_ccmpmic: rx MIC check failed (CCMP)
1605  * @rx_tkipmic: rx MIC check failed (TKIP)
1606  * @rx_tkipicv: rx ICV check failed (TKIP)
1607  * @rx_wpimic: rx MIC check failed (WPI)
1608  * @rx_wepfail: rx wep processing failed
1609  * @rx_aggr: aggregation on rx
1610  * @rx_discard: packets discard in rx
1611  * @rx_ratecode: Rx rate code of last frame
1612  * @rx_flags: rx flags
1613  * @rx_snr_measured_time: Time at which snr is measured
1614  * @snr: SNR of received signal
1615  * @last_snr: Previous snr
1616  * @multipass_rx_pkt_drop: Dropped multipass rx pkt
1617  * @peer_unauth_rx_pkt_drop: Unauth rx packet drops
1618  * @policy_check_drop: policy check drops
1619  * @rx_mpdu_cnt: rx mpdu count per MCS rate
1620  * @nss_info: NSS 1,2, ...8
1621  * @mcs_info: MCS index
1622  * @bw_info: Bandwidth
1623  *       <enum 0 bw_20_MHz>
1624  *       <enum 1 bw_40_MHz>
1625  *       <enum 2 bw_80_MHz>
1626  *       <enum 3 bw_160_MHz>
1627  * @gi_info: <enum 0     0_8_us_sgi > Legacy normal GI
1628  *       <enum 1     0_4_us_sgi > Legacy short GI
1629  *       <enum 2     1_6_us_sgi > HE related GI
1630  *       <enum 3     3_2_us_sgi > HE
1631  * @preamble_info: preamble
1632  * @to_stack_twt: Total packets sent up the stack in TWT session
1633  * @mpdu_retry_cnt: retries of mpdu in rx
1634  * @su_be_ppdu_cnt: SU Rx packet count for BE
1635  * @mu_be_ppdu_cnt: MU rx packet count for BE
1636  * @punc_bw[MAX_PUNCTURED_MODE]: MSDU count for punctured BW
1637  */
1638 struct cdp_rx_stats {
1639 	struct cdp_pkt_info to_stack;
1640 	struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
1641 	struct cdp_pkt_info rx_lmac[CDP_MAX_LMACS];
1642 	struct cdp_pkt_info unicast;
1643 	struct cdp_pkt_info multicast;
1644 	struct cdp_pkt_info bcast;
1645 	struct cdp_pkt_info raw;
1646 	uint32_t nawds_mcast_drop;
1647 	struct cdp_pkt_info mec_drop;
1648 	unsigned long last_rx_ts;
1649 	struct {
1650 		struct cdp_pkt_info pkts;
1651 		struct cdp_pkt_info fail;
1652 		uint32_t mdns_no_fwd;
1653 	} intra_bss;
1654 #ifdef VDEV_PEER_PROTOCOL_COUNT
1655 	struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
1656 #endif
1657 
1658 	struct {
1659 		uint32_t mic_err;
1660 		uint32_t decrypt_err;
1661 		uint32_t fcserr;
1662 		uint32_t pn_err;
1663 		uint32_t oor_err;
1664 		uint32_t jump_2k_err;
1665 		uint32_t rxdma_wifi_parse_err;
1666 	} err;
1667 
1668 	uint32_t wme_ac_type[WME_AC_MAX];
1669 	uint32_t reception_type[MAX_RECEPTION_TYPES];
1670 	struct cdp_pkt_type pkt_type[DOT11_MAX];
1671 	uint32_t sgi_count[MAX_GI];
1672 	uint32_t nss[SS_COUNT];
1673 	uint32_t ppdu_nss[SS_COUNT];
1674 	uint32_t mpdu_cnt_fcs_ok;
1675 	uint32_t mpdu_cnt_fcs_err;
1676 	struct cdp_pkt_type su_ax_ppdu_cnt;
1677 	uint32_t ppdu_cnt[MAX_RECEPTION_TYPES];
1678 	struct cdp_rx_mu rx_mu[TXRX_TYPE_MU_MAX];
1679 	uint32_t bw[MAX_BW];
1680 	uint32_t non_ampdu_cnt;
1681 	uint32_t ampdu_cnt;
1682 	uint32_t non_amsdu_cnt;
1683 	uint32_t amsdu_cnt;
1684 	uint32_t bar_recv_cnt;
1685 	uint32_t avg_snr;
1686 	uint32_t rx_rate;
1687 	uint32_t last_rx_rate;
1688 	uint32_t rnd_avg_rx_rate;
1689 	uint32_t avg_rx_rate;
1690 	struct cdp_pkt_info  dot11_rx_pkts;
1691 
1692 	uint32_t rx_bytes_success_last;
1693 	uint32_t rx_data_success_last;
1694 	uint32_t rx_byte_rate;
1695 	uint32_t rx_data_rate;
1696 
1697 	uint32_t rx_retries;
1698 	uint32_t rx_mpdus;
1699 	uint32_t rx_ppdus;
1700 
1701 	/*add for peer updated for ppdu*/
1702 	uint32_t rx_aggr;
1703 	uint32_t rx_discard;
1704 	uint32_t rx_ratecode;
1705 	uint32_t rx_flags;
1706 	unsigned long rx_snr_measured_time;
1707 	uint8_t snr;
1708 	uint8_t last_snr;
1709 	uint32_t multipass_rx_pkt_drop;
1710 	uint32_t peer_unauth_rx_pkt_drop;
1711 	uint32_t policy_check_drop;
1712 	uint32_t rx_mpdu_cnt[MAX_MCS];
1713 	uint32_t nss_info:4,
1714 		 mcs_info:4,
1715 		 bw_info:4,
1716 		 gi_info:4,
1717 	         preamble_info:4;
1718 	struct cdp_pkt_info to_stack_twt;
1719 	uint32_t mpdu_retry_cnt;
1720 #ifdef WLAN_FEATURE_11BE
1721 	struct cdp_pkt_type su_be_ppdu_cnt;
1722 	struct cdp_pkt_type mu_be_ppdu_cnt[TXRX_TYPE_MU_MAX];
1723 	uint32_t punc_bw[MAX_PUNCTURED_MODE];
1724 #endif
1725 	uint32_t mcast_3addr_drop;
1726 };
1727 
1728 /* struct cdp_tx_ingress_stats - Tx ingress Stats
1729  * @rcvd: Total packets received for transmission
1730  * @processed: Tx packets processed
1731  * @inspect_pkts: Total packets passed to inspect handler
1732  * @nawds_mcast: NAWDS  Multicast Packet Count
1733  * @bcast: Number of broadcast packets
1734  * @raw_pkt: Total Raw packets
1735  * @dma_map_error: DMA map error
1736  * @num_frags_overflow_err: msdu's nbuf count exceeds num of segments
1737  * @num_seg: No of segments in TSO packets
1738  * @tso_pkt:total no of TSO packets
1739  * @non_tso_pkts: non - TSO packets
1740  * @dropped_host: TSO packets dropped by host
1741  * @dropped_target:TSO packets dropped by target
1742  * @sg_pkt: Total scatter gather packets
1743  * @non_sg_pkts: non SG packets
1744  * @dropped_host: SG packets dropped by host
1745  * @dropped_target: SG packets dropped by target
1746  * @dma_map_error: Dma map error
1747  * @mcast_pkt: total no of multicast conversion packets
1748  * @dropped_map_error: packets dropped due to map error
1749  * @dropped_self_mac: packets dropped due to self Mac address
1750  * @dropped_send_fail: Packets dropped due to send fail
1751  * @ucast: total unicast packets transmitted
1752  * @fail_seg_alloc: Segment allocation failure
1753  * @clone_fail: NBUF clone failure
1754  * @igmp_rcvd: igmp pkts received for conversion to ucast pkts
1755  * @igmp_ucast_converted: unicast pkts sent as part of VoW IGMP improvements
1756  * @dropped_pkt: Total scatter gather packets
1757  * @desc_na: Desc Not Available
1758  * @exc_desc_na: Exception desc Not Available
1759  * @ring_full: ring full
1760  * @enqueue_fail: hw enqueue fail
1761  * @dma_error: dma fail
1762  * @res_full: Resource Full: Congestion Control
1763  * @fail_per_pkt_vdev_id_check: Per pkt vdev id check
1764  * @drop_ingress: Packets dropped during Umac reset
1765  * @exception_fw: packets sent to fw
1766  * @completion_fw: packets completions received from fw
1767  * @cce_classified:Number of packets classified by CCE
1768  * @cce_classified_raw:Number of raw packets classified by CCE
1769  * @sniffer_rcvd: Number of packets received with ppdu cookie
1770  */
1771 struct cdp_tx_ingress_stats {
1772 	struct cdp_pkt_info rcvd;
1773 	uint64_t rcvd_in_fast_xmit_flow;
1774 	uint32_t rcvd_per_core[CDP_MAX_TX_DATA_RINGS];
1775 	struct cdp_pkt_info processed;
1776 	struct cdp_pkt_info reinject_pkts;
1777 	struct cdp_pkt_info inspect_pkts;
1778 	struct cdp_pkt_info nawds_mcast;
1779 	struct cdp_pkt_info bcast;
1780 
1781 	struct {
1782 		struct cdp_pkt_info raw_pkt;
1783 		uint32_t dma_map_error;
1784 		uint32_t invalid_raw_pkt_datatype;
1785 		uint32_t num_frags_overflow_err;
1786 	} raw;
1787 
1788 	/* Scatter Gather packet info */
1789 	struct {
1790 		struct cdp_pkt_info sg_pkt;
1791 		struct cdp_pkt_info non_sg_pkts;
1792 		struct cdp_pkt_info  dropped_host;
1793 		uint32_t dropped_target;
1794 		uint32_t dma_map_error;
1795 	} sg;
1796 
1797 	/* Multicast Enhancement packets info */
1798 	struct {
1799 		struct cdp_pkt_info mcast_pkt;
1800 		uint32_t dropped_map_error;
1801 		uint32_t dropped_self_mac;
1802 		uint32_t dropped_send_fail;
1803 		uint32_t ucast;
1804 		uint32_t fail_seg_alloc;
1805 		uint32_t clone_fail;
1806 	} mcast_en;
1807 
1808 	/* IGMP Multicast Enhancement packets info */
1809 	struct {
1810 		uint32_t igmp_rcvd;
1811 		uint32_t igmp_ucast_converted;
1812 	} igmp_mcast_en;
1813 
1814 	/* Packets dropped on the Tx side */
1815 	struct {
1816 		struct cdp_pkt_info dropped_pkt;
1817 		struct cdp_pkt_info  desc_na;
1818 		struct cdp_pkt_info  desc_na_exc_alloc_fail;
1819 		struct cdp_pkt_info  desc_na_exc_outstand;
1820 		struct cdp_pkt_info  exc_desc_na;
1821 		uint32_t ring_full;
1822 		uint32_t enqueue_fail;
1823 		uint32_t dma_error;
1824 		uint32_t res_full;
1825 		/* headroom insufficient */
1826 		uint32_t headroom_insufficient;
1827 		uint32_t fail_per_pkt_vdev_id_check;
1828 		uint32_t drop_ingress;
1829 		uint32_t invalid_peer_id_in_exc_path;
1830 	} dropped;
1831 
1832 	/* Mesh packets info */
1833 	struct {
1834 		uint32_t exception_fw;
1835 		uint32_t completion_fw;
1836 	} mesh;
1837 
1838 	uint32_t cce_classified;
1839 	uint32_t cce_classified_raw;
1840 	struct cdp_pkt_info sniffer_rcvd;
1841 	struct cdp_tso_stats tso_stats;
1842 };
1843 
1844 /* struct cdp_rx_ingress_stats - rx ingress stats
1845  * @reo_rcvd_pkt: packets received at REO block
1846  * @ null_q_desc_pkt: null queue desc pkt count
1847  * @ routed_eapol_pkt: routed eapol pkt count
1848  */
1849 struct cdp_rx_ingress_stats {
1850 	struct cdp_pkt_info reo_rcvd_pkt;
1851 	struct cdp_pkt_info null_q_desc_pkt;
1852 	struct cdp_pkt_info routed_eapol_pkt;
1853 };
1854 
1855 /* struct cdp_vdev_stats - vdev stats structure
1856  * @tx_i: ingress tx stats
1857  * @rx_i: ingress rx stats
1858  * @tx: cdp tx stats
1859  * @rx: cdp rx stats
1860  * @tso_stats: tso stats
1861  * @tid_tx_stats: tid tx stats
1862  */
1863 struct cdp_vdev_stats {
1864 	struct cdp_tx_ingress_stats tx_i;
1865 	struct cdp_rx_ingress_stats rx_i;
1866 	struct cdp_tx_stats tx;
1867 	struct cdp_rx_stats rx;
1868 	struct cdp_tso_stats tso_stats;
1869 #ifdef HW_TX_DELAY_STATS_ENABLE
1870 	struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS]
1871 					    [CDP_MAX_DATA_TIDS];
1872 #endif
1873 };
1874 
1875 /* struct cdp_calibr_stats - Calibrated stats
1876  * @last_per: Tx last packet error rate
1877  * @tx_bytes_success_last: last Tx success bytes
1878  * @tx_data_success_last: last Tx success data
1879  * @tx_byte_rate: Bytes Trasmitted in last one sec
1880  * @tx_data_rate: Data Transmitted in last one sec
1881  * @tx_data_ucast_last: last unicast Tx bytes
1882  * @tx_data_ucast_rate: last unicast Tx data
1883  * @inactive_time: inactive time in secs
1884  * @rx_bytes_success_last: last Rx success bytes
1885  * @rx_data_success_last: last Rx success data
1886  * @rx_byte_rate: Bytes received in last one sec
1887  * @rx_data_rate: Data received in last one sec
1888  */
1889 struct cdp_calibr_stats {
1890 	struct {
1891 		uint32_t last_per;
1892 		uint32_t tx_bytes_success_last;
1893 		uint32_t tx_data_success_last;
1894 		uint32_t tx_byte_rate;
1895 		uint32_t tx_data_rate;
1896 		uint32_t tx_data_ucast_last;
1897 		uint32_t tx_data_ucast_rate;
1898 		uint32_t inactive_time;
1899 	} tx;
1900 
1901 	struct {
1902 		uint32_t rx_bytes_success_last;
1903 		uint32_t rx_data_success_last;
1904 		uint32_t rx_byte_rate;
1905 		uint32_t rx_data_rate;
1906 	} rx;
1907 };
1908 
1909 /* struct cdp_calibr_stats_intf: Calibrated stats interface
1910  * @to_stack: Total packets sent up the stack
1911  * @tx_success: Successful Tx Packets
1912  * @tx_ucast: Tx Unicast Packet Count
1913  */
1914 struct cdp_calibr_stats_intf {
1915 	struct cdp_pkt_info to_stack;
1916 	struct cdp_pkt_info tx_success;
1917 	struct cdp_pkt_info tx_ucast;
1918 };
1919 
1920 /* struct cdp_peer_stats - peer stats structure
1921  * @tx: cdp tx stats
1922  * @rx: cdp rx stats
1923  */
1924 struct cdp_peer_stats {
1925 	/* CDP Tx Stats */
1926 	struct cdp_tx_stats tx;
1927 	/* CDP Rx Stats */
1928 	struct cdp_rx_stats rx;
1929 };
1930 
1931 /* struct cdp_peer_tid_stats - Per peer and per TID stats
1932  * @tx_avg_jitter: tx average jitter
1933  * @tx_avg_delay: tx average delay
1934  * @tx_avg_err: tx average error
1935  * @tx_total_success: tx total success
1936  * @tx_drop: tx drop
1937  */
1938 struct cdp_peer_tid_stats {
1939 #ifdef WLAN_PEER_JITTER
1940 	uint32_t tx_avg_jitter;
1941 	uint32_t tx_avg_delay;
1942 	uint64_t tx_avg_err;
1943 	uint64_t tx_total_success;
1944 	uint64_t tx_drop;
1945 #endif
1946 };
1947 
1948 /* struct cdp_interface_peer_stats - interface structure for txrx peer stats
1949  * @peer_mac: peer mac address
1950  * @vdev_id : vdev_id for the peer
1951  * @rssi_changed: denotes rssi is changed
1952  * @last_peer_tx_rate: peer tx rate for last transmission
1953  * @peer_tx_rate: tx rate for current transmission
1954  * @peer_rssi: current rssi value of peer
1955  * @tx_packet_count: tx packet count
1956  * @rx_packet_count: rx packet count
1957  * @tx_byte_count: tx byte count
1958  * @rx_byte_count: rx byte count
1959  * @per: per error rate
1960  * @ack_rssi: RSSI of the last ack received
1961  * @free_buff: free tx descriptor count
1962  * @rx_avg_snr: Avg Rx SNR
1963  */
1964 struct cdp_interface_peer_stats {
1965 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
1966 	uint8_t  vdev_id;
1967 	uint8_t  rssi_changed;
1968 	uint32_t last_peer_tx_rate;
1969 	uint32_t peer_tx_rate;
1970 	uint32_t peer_rssi;
1971 	uint32_t tx_packet_count;
1972 	uint32_t rx_packet_count;
1973 	uint32_t tx_byte_count;
1974 	uint32_t rx_byte_count;
1975 	uint32_t per;
1976 	uint32_t ack_rssi;
1977 	uint32_t free_buff;
1978 	uint32_t rx_avg_snr;
1979 };
1980 
1981 /* struct cdp_interface_peer_qos_stats - interface structure for peer qos stats
1982  * @peer_mac: peer mac address
1983  * @frame_control: frame control field
1984  * @qos_control: qos control field
1985  * @frame_control_info_valid: frame_control valid
1986  * @qos_control_info_valid: qos_control valid
1987  * @vdev_id : vdev_id for the peer
1988  */
1989 struct cdp_interface_peer_qos_stats {
1990 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
1991 	uint16_t frame_control;
1992 	uint16_t qos_control;
1993 	uint8_t  frame_control_info_valid;
1994 	uint8_t  qos_control_info_valid;
1995 	uint8_t  vdev_id;
1996 };
1997 
1998 /* Tx completions per interrupt */
1999 struct cdp_hist_tx_comp {
2000 	uint32_t pkts_1;
2001 	uint32_t pkts_2_20;
2002 	uint32_t pkts_21_40;
2003 	uint32_t pkts_41_60;
2004 	uint32_t pkts_61_80;
2005 	uint32_t pkts_81_100;
2006 	uint32_t pkts_101_200;
2007 	uint32_t pkts_201_plus;
2008 };
2009 
2010 /* Rx ring descriptors reaped per interrupt */
2011 struct cdp_hist_rx_ind {
2012 	uint32_t pkts_1;
2013 	uint32_t pkts_2_20;
2014 	uint32_t pkts_21_40;
2015 	uint32_t pkts_41_60;
2016 	uint32_t pkts_61_80;
2017 	uint32_t pkts_81_100;
2018 	uint32_t pkts_101_200;
2019 	uint32_t pkts_201_plus;
2020 };
2021 
2022 struct cdp_htt_tlv_hdr {
2023 	/* BIT [11 :  0]   :- tag
2024 	 * BIT [23 : 12]   :- length
2025 	 * BIT [31 : 24]   :- reserved
2026 	 */
2027 	uint32_t tag__length;
2028 };
2029 
2030 #define HTT_STATS_SUBTYPE_MAX     16
2031 
2032 struct cdp_htt_rx_pdev_fw_stats_tlv {
2033     struct cdp_htt_tlv_hdr tlv_hdr;
2034 
2035     /* BIT [ 7 :  0]   :- mac_id
2036      * BIT [31 :  8]   :- reserved
2037      */
2038     uint32_t mac_id__word;
2039     /* Num PPDU status processed from HW */
2040     uint32_t ppdu_recvd;
2041     /* Num MPDU across PPDUs with FCS ok */
2042     uint32_t mpdu_cnt_fcs_ok;
2043     /* Num MPDU across PPDUs with FCS err */
2044     uint32_t mpdu_cnt_fcs_err;
2045     /* Num MSDU across PPDUs */
2046     uint32_t tcp_msdu_cnt;
2047     /* Num MSDU across PPDUs */
2048     uint32_t tcp_ack_msdu_cnt;
2049     /* Num MSDU across PPDUs */
2050     uint32_t udp_msdu_cnt;
2051     /* Num MSDU across PPDUs */
2052     uint32_t other_msdu_cnt;
2053     /* Num MPDU on FW ring indicated */
2054     uint32_t fw_ring_mpdu_ind;
2055     /* Num MGMT MPDU given to protocol */
2056     uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX];
2057     /* Num ctrl MPDU given to protocol */
2058     uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX];
2059     /* Num mcast data packet received */
2060     uint32_t fw_ring_mcast_data_msdu;
2061     /* Num broadcast data packet received */
2062     uint32_t fw_ring_bcast_data_msdu;
2063     /* Num unicat data packet received */
2064     uint32_t fw_ring_ucast_data_msdu;
2065     /* Num null data packet received  */
2066     uint32_t fw_ring_null_data_msdu;
2067     /* Num MPDU on FW ring dropped */
2068     uint32_t fw_ring_mpdu_drop;
2069 
2070     /* Num buf indication to offload */
2071     uint32_t ofld_local_data_ind_cnt;
2072     /* Num buf recycle from offload */
2073     uint32_t ofld_local_data_buf_recycle_cnt;
2074     /* Num buf indication to data_rx */
2075     uint32_t drx_local_data_ind_cnt;
2076     /* Num buf recycle from data_rx */
2077     uint32_t drx_local_data_buf_recycle_cnt;
2078     /* Num buf indication to protocol */
2079     uint32_t local_nondata_ind_cnt;
2080     /* Num buf recycle from protocol */
2081     uint32_t local_nondata_buf_recycle_cnt;
2082 
2083     /* Num buf fed */
2084     uint32_t fw_status_buf_ring_refill_cnt;
2085     /* Num ring empty encountered */
2086     uint32_t fw_status_buf_ring_empty_cnt;
2087     /* Num buf fed  */
2088     uint32_t fw_pkt_buf_ring_refill_cnt;
2089     /* Num ring empty encountered */
2090     uint32_t fw_pkt_buf_ring_empty_cnt;
2091     /* Num buf fed  */
2092     uint32_t fw_link_buf_ring_refill_cnt;
2093     /* Num ring empty encountered  */
2094     uint32_t fw_link_buf_ring_empty_cnt;
2095 
2096     /* Num buf fed */
2097     uint32_t host_pkt_buf_ring_refill_cnt;
2098     /* Num ring empty encountered */
2099     uint32_t host_pkt_buf_ring_empty_cnt;
2100     /* Num buf fed */
2101     uint32_t mon_pkt_buf_ring_refill_cnt;
2102     /* Num ring empty encountered */
2103     uint32_t mon_pkt_buf_ring_empty_cnt;
2104     /* Num buf fed */
2105     uint32_t mon_status_buf_ring_refill_cnt;
2106     /* Num ring empty encountered */
2107     uint32_t mon_status_buf_ring_empty_cnt;
2108     /* Num buf fed */
2109     uint32_t mon_desc_buf_ring_refill_cnt;
2110     /* Num ring empty encountered */
2111     uint32_t mon_desc_buf_ring_empty_cnt;
2112     /* Num buf fed */
2113     uint32_t mon_dest_ring_update_cnt;
2114     /* Num ring full encountered */
2115     uint32_t mon_dest_ring_full_cnt;
2116 
2117     /* Num rx suspend is attempted */
2118     uint32_t rx_suspend_cnt;
2119     /* Num rx suspend failed */
2120     uint32_t rx_suspend_fail_cnt;
2121     /* Num rx resume attempted */
2122     uint32_t rx_resume_cnt;
2123     /* Num rx resume failed */
2124     uint32_t rx_resume_fail_cnt;
2125     /* Num rx ring switch */
2126     uint32_t rx_ring_switch_cnt;
2127     /* Num rx ring restore */
2128     uint32_t rx_ring_restore_cnt;
2129     /* Num rx flush issued */
2130     uint32_t rx_flush_cnt;
2131 };
2132 
2133 /* == TX PDEV STATS == */
2134 struct cdp_htt_tx_pdev_stats_cmn_tlv {
2135     struct cdp_htt_tlv_hdr tlv_hdr;
2136 
2137     /* BIT [ 7 :  0]   :- mac_id
2138      * BIT [31 :  8]   :- reserved
2139      */
2140     uint32_t mac_id__word;
2141     /* Num queued to HW */
2142     uint32_t hw_queued;
2143     /* Num PPDU reaped from HW */
2144     uint32_t hw_reaped;
2145     /* Num underruns */
2146     uint32_t underrun;
2147     /* Num HW Paused counter. */
2148     uint32_t hw_paused;
2149     /* Num HW flush counter. */
2150     uint32_t hw_flush;
2151     /* Num HW filtered counter. */
2152     uint32_t hw_filt;
2153     /* Num PPDUs cleaned up in TX abort */
2154     uint32_t tx_abort;
2155     /* Num MPDUs requed by SW */
2156     uint32_t mpdu_requed;
2157     /* excessive retries */
2158     uint32_t tx_xretry;
2159     /* Last used data hw rate code */
2160     uint32_t data_rc;
2161     /* frames dropped due to excessive sw retries */
2162     uint32_t mpdu_dropped_xretry;
2163     /* illegal rate phy errors  */
2164     uint32_t illgl_rate_phy_err;
2165     /* wal pdev continuous xretry */
2166     uint32_t cont_xretry;
2167     /* wal pdev continuous xretry */
2168     uint32_t tx_timeout;
2169     /* wal pdev resets  */
2170     uint32_t pdev_resets;
2171     /* PhY/BB underrun */
2172     uint32_t phy_underrun;
2173     /* MPDU is more than txop limit */
2174     uint32_t txop_ovf;
2175     /* Number of Sequences posted */
2176     uint32_t seq_posted;
2177     /* Number of Sequences failed queueing */
2178     uint32_t seq_failed_queueing;
2179     /* Number of Sequences completed */
2180     uint32_t seq_completed;
2181     /* Number of Sequences restarted */
2182     uint32_t seq_restarted;
2183     /* Number of MU Sequences posted */
2184     uint32_t mu_seq_posted;
2185     /* Number of time HW ring is paused between seq switch within ISR */
2186     uint32_t seq_switch_hw_paused;
2187     /* Number of times seq continuation in DSR */
2188     uint32_t next_seq_posted_dsr;
2189     /* Number of times seq continuation in ISR */
2190     uint32_t seq_posted_isr;
2191     /* Number of seq_ctrl cached. */
2192     uint32_t seq_ctrl_cached;
2193     /* Number of MPDUs successfully transmitted */
2194     uint32_t mpdu_count_tqm;
2195     /* Number of MSDUs successfully transmitted */
2196     uint32_t msdu_count_tqm;
2197     /* Number of MPDUs dropped */
2198     uint32_t mpdu_removed_tqm;
2199     /* Number of MSDUs dropped */
2200     uint32_t msdu_removed_tqm;
2201     /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
2202     uint32_t mpdus_sw_flush;
2203     /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
2204     uint32_t mpdus_hw_filter;
2205     /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
2206     uint32_t mpdus_truncated;
2207     /* Num MPDUs that was tried but didn't receive ACK or BA */
2208     uint32_t mpdus_ack_failed;
2209     /* Num MPDUs that was dropped due to expiry (MSDU TTL). */
2210     uint32_t mpdus_expired;
2211     /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */
2212     uint32_t mpdus_seq_hw_retry;
2213     /* Num of TQM acked cmds processed */
2214     uint32_t ack_tlv_proc;
2215     /* coex_abort_mpdu_cnt valid. */
2216     uint32_t coex_abort_mpdu_cnt_valid;
2217     /* coex_abort_mpdu_cnt from TX FES stats. */
2218     uint32_t coex_abort_mpdu_cnt;
2219     /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */
2220     uint32_t num_total_ppdus_tried_ota;
2221     /* Number of data PPDUs tried over the air (OTA) */
2222     uint32_t num_data_ppdus_tried_ota;
2223     /* Num Local control/mgmt frames (MSDUs) queued */
2224     uint32_t local_ctrl_mgmt_enqued;
2225     /* local_ctrl_mgmt_freed:
2226      * Num Local control/mgmt frames (MSDUs) done
2227      * It includes all local ctrl/mgmt completions
2228      * (acked, no ack, flush, TTL, etc)
2229      */
2230     uint32_t local_ctrl_mgmt_freed;
2231     /* Num Local data frames (MSDUs) queued */
2232     uint32_t local_data_enqued;
2233     /* local_data_freed:
2234      * Num Local data frames (MSDUs) done
2235      * It includes all local data completions
2236      * (acked, no ack, flush, TTL, etc)
2237      */
2238     uint32_t local_data_freed;
2239 
2240 	/* Num MPDUs tried by SW */
2241 	uint32_t mpdu_tried;
2242 	/* Num of waiting seq posted in isr completion handler */
2243 	uint32_t isr_wait_seq_posted;
2244 	uint32_t tx_active_dur_us_low;
2245 	uint32_t tx_active_dur_us_high;
2246 };
2247 
2248 #define DP_NUM_AC_WMM 4
2249 
2250 struct cdp_pdev_obss_pd_stats_tlv {
2251 	struct cdp_htt_tlv_hdr tlv_hdr;
2252 
2253 	uint32_t num_obss_tx_ppdu_success;
2254 	uint32_t num_obss_tx_ppdu_failure;
2255 	/** num_sr_tx_transmissions:
2256 	 * Counter of TX done by aborting other BSS RX with spatial reuse
2257 	 * (for cases where rx RSSI from other BSS is below the packet-detection
2258 	 * threshold for doing spatial reuse)
2259 	 */
2260 	uint32_t num_sr_tx_transmissions;
2261 	/**
2262 	 * Count the number of times the RSSI from an other-BSS signal
2263 	 * is below the spatial reuse power threshold, thus providing an
2264 	 * opportunity for spatial reuse since OBSS interference will be
2265 	 * inconsequential.
2266 	 */
2267 	uint32_t num_spatial_reuse_opportunities;
2268 	/**
2269 	 * Count of number of times OBSS frames were aborted and non-SRG
2270 	 * opportunities were created. Non-SRG opportunities are created when
2271 	 * incoming OBSS RSSI is lesser than the global configured non-SRG RSSI
2272 	 * threshold and non-SRG OBSS color / non-SRG OBSS BSSID registers
2273 	 * allow non-SRG TX.
2274 	 */
2275 	uint32_t num_non_srg_opportunities;
2276 	/**
2277 	 * Count of number of times TX PPDU were transmitted using non-SRG
2278 	 * opportunities created. Incoming OBSS frame RSSI is compared with per
2279 	 * PPDU non-SRG RSSI threshold configured in each PPDU. If incoming OBSS
2280 	 * RSSI < non-SRG RSSI threshold configured in each PPDU, then non-SRG
2281 	 * tranmission happens.
2282 	 */
2283 	uint32_t num_non_srg_ppdu_tried;
2284 	/**
2285 	 * Count of number of times non-SRG based TX transmissions were
2286 	 * successful
2287 	 */
2288 	uint32_t num_non_srg_ppdu_success;
2289 	/**
2290 	 * Count of number of times OBSS frames were aborted and SRG
2291 	 * opportunities were created. Srg opportunities are created when
2292 	 * incoming OBSS RSSI is less than the global configured SRG RSSI
2293 	 * threshold and SRC OBSS color / SRG OBSS BSSID / SRG partial bssid /
2294 	 * SRG BSS color bitmap registers allow SRG TX.
2295 	 */
2296 	uint32_t num_srg_opportunities;
2297 	/**
2298 	 * Count of number of times TX PPDU were transmitted using SRG
2299 	 * opportunities created.
2300 	 * Incoming OBSS frame RSSI is compared with per PPDU SRG RSSI
2301 	 * threshold configured in each PPDU.
2302 	 * If incoming OBSS RSSI < SRG RSSI threshold configured in each PPDU,
2303 	 * then SRG tranmission happens.
2304 	 */
2305 	uint32_t num_srg_ppdu_tried;
2306 	/**
2307 	 * Count of number of times SRG based TX transmissions were successful
2308 	 */
2309 	uint32_t num_srg_ppdu_success;
2310 	/**
2311 	 * Count of number of times PSR opportunities were created by aborting
2312 	 * OBSS UL OFDMA HE-TB PPDU frame. HE-TB ppdu frames are aborted if the
2313 	 * spatial reuse info in the OBSS trigger common field is set to allow
2314 	 * PSR based spatial reuse.
2315 	 */
2316 	uint32_t num_psr_opportunities;
2317 	/**
2318 	 * Count of number of times TX PPDU were transmitted using PSR
2319 	 * opportunities created.
2320 	 */
2321 	uint32_t num_psr_ppdu_tried;
2322 	/**
2323 	 * Count of number of times PSR based TX transmissions were successful.
2324 	 */
2325 	uint32_t num_psr_ppdu_success;
2326 	/**
2327 	 * Count of number of times TX PPDU per access category were transmitted
2328 	 * using non-SRG opportunities created.
2329 	 */
2330 	uint32_t num_non_srg_ppdu_tried_per_ac[DP_NUM_AC_WMM];
2331 	/**
2332 	 * Count of number of times non-SRG based TX transmissions per access
2333 	 * category were successful
2334 	 */
2335 	uint32_t num_non_srg_ppdu_success_per_ac[DP_NUM_AC_WMM];
2336 	/**
2337 	 * Count of number of times TX PPDU per access category were transmitted
2338 	 * using SRG opportunities created.
2339 	 */
2340 	uint32_t num_srg_ppdu_tried_per_ac[DP_NUM_AC_WMM];
2341 	/**
2342 	 * Count of number of times SRG based TX transmissions per access
2343 	 * category were successful
2344 	 */
2345 	uint32_t num_srg_ppdu_success_per_ac[DP_NUM_AC_WMM];
2346 	/**
2347 	 * Count of number of times ppdu was flushed due to ongoing OBSS
2348 	 * frame duration value lesser than minimum required frame duration.
2349 	 */
2350 	uint32_t num_obss_min_duration_check_flush_cnt;
2351 	/**
2352 	 * Count of number of times ppdu was flushed due to ppdu duration
2353 	 * exceeding aborted OBSS frame duration
2354 	 */
2355 	uint32_t num_sr_ppdu_abort_flush_cnt;
2356 };
2357 
2358 struct cdp_htt_tx_pdev_stats_urrn_tlv_v {
2359     struct cdp_htt_tlv_hdr tlv_hdr;
2360     uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */
2361 };
2362 
2363 /* NOTE: Variable length TLV, use length spec to infer array size */
2364 struct cdp_htt_tx_pdev_stats_flush_tlv_v {
2365     struct cdp_htt_tlv_hdr tlv_hdr;
2366     uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
2367 };
2368 
2369 /* NOTE: Variable length TLV, use length spec to infer array size */
2370 struct cdp_htt_tx_pdev_stats_sifs_tlv_v {
2371     struct cdp_htt_tlv_hdr tlv_hdr;
2372     uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
2373 };
2374 
2375 /* NOTE: Variable length TLV, use length spec to infer array size */
2376 struct cdp_htt_tx_pdev_stats_phy_err_tlv_v {
2377     struct cdp_htt_tlv_hdr tlv_hdr;
2378     uint32_t  phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
2379 };
2380 
2381 /* == RX PDEV/SOC STATS == */
2382 /* HTT_STATS_RX_SOC_FW_STATS_TAG */
2383 struct cdp_htt_rx_soc_fw_stats_tlv {
2384     struct cdp_htt_tlv_hdr tlv_hdr;
2385     /* Num Packets received on REO FW ring */
2386     uint32_t fw_reo_ring_data_msdu;
2387     /* Num bc/mc packets indicated from fw to host */
2388     uint32_t fw_to_host_data_msdu_bcmc;
2389     /* Num unicast packets indicated from fw to host */
2390     uint32_t fw_to_host_data_msdu_uc;
2391     /* Num remote buf recycle from offload  */
2392     uint32_t ofld_remote_data_buf_recycle_cnt;
2393     /* Num remote free buf given to offload */
2394     uint32_t ofld_remote_free_buf_indication_cnt;
2395 };
2396 
2397 struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
2398     struct cdp_htt_tlv_hdr tlv_hdr;
2399     /* Num total buf refilled from refill ring */
2400     uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
2401 };
2402 
2403 struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
2404     struct cdp_htt_tlv_hdr tlv_hdr;
2405     /* Num error MPDU for each RxDMA error type  */
2406     uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
2407 };
2408 
2409 struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v {
2410     struct cdp_htt_tlv_hdr tlv_hdr;
2411     /* Num MPDU dropped  */
2412     uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
2413 };
2414 
2415 #define HTT_STATS_PHY_ERR_MAX 43
2416 
2417 struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv {
2418     struct cdp_htt_tlv_hdr tlv_hdr;
2419 
2420     /* BIT [ 7 :  0]   :- mac_id
2421      * BIT [31 :  8]   :- reserved
2422      */
2423     uint32_t mac_id__word;
2424     /* Num of phy err */
2425     uint32_t total_phy_err_cnt;
2426     /* Counts of different types of phy errs
2427      * The mapping of PHY error types to phy_err array elements is HW dependent.
2428      * The only currently-supported mapping is shown below:
2429      *
2430      * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV
2431      * 1 phyrx_err_synth_off
2432      * 2 phyrx_err_ofdma_timing
2433      * 3 phyrx_err_ofdma_signal_parity
2434      * 4 phyrx_err_ofdma_rate_illegal
2435      * 5 phyrx_err_ofdma_length_illegal
2436      * 6 phyrx_err_ofdma_restart
2437      * 7 phyrx_err_ofdma_service
2438      * 8 phyrx_err_ppdu_ofdma_power_drop
2439      * 9 phyrx_err_cck_blokker
2440      * 10 phyrx_err_cck_timing
2441      * 11 phyrx_err_cck_header_crc
2442      * 12 phyrx_err_cck_rate_illegal
2443      * 13 phyrx_err_cck_length_illegal
2444      * 14 phyrx_err_cck_restart
2445      * 15 phyrx_err_cck_service
2446      * 16 phyrx_err_cck_power_drop
2447      * 17 phyrx_err_ht_crc_err
2448      * 18 phyrx_err_ht_length_illegal
2449      * 19 phyrx_err_ht_rate_illegal
2450      * 20 phyrx_err_ht_zlf
2451      * 21 phyrx_err_false_radar_ext
2452      * 22 phyrx_err_green_field
2453      * 23 phyrx_err_bw_gt_dyn_bw
2454      * 24 phyrx_err_leg_ht_mismatch
2455      * 25 phyrx_err_vht_crc_error
2456      * 26 phyrx_err_vht_siga_unsupported
2457      * 27 phyrx_err_vht_lsig_len_invalid
2458      * 28 phyrx_err_vht_ndp_or_zlf
2459      * 29 phyrx_err_vht_nsym_lt_zero
2460      * 30 phyrx_err_vht_rx_extra_symbol_mismatch
2461      * 31 phyrx_err_vht_rx_skip_group_id0
2462      * 32 phyrx_err_vht_rx_skip_group_id1to62
2463      * 33 phyrx_err_vht_rx_skip_group_id63
2464      * 34 phyrx_err_ofdm_ldpc_decoder_disabled
2465      * 35 phyrx_err_defer_nap
2466      * 36 phyrx_err_fdomain_timeout
2467      * 37 phyrx_err_lsig_rel_check
2468      * 38 phyrx_err_bt_collision
2469      * 39 phyrx_err_unsupported_mu_feedback
2470      * 40 phyrx_err_ppdu_tx_interrupt_rx
2471      * 41 phyrx_err_unsupported_cbf
2472      * 42 phyrx_err_other
2473      */
2474     uint32_t phy_err[HTT_STATS_PHY_ERR_MAX];
2475 };
2476 
2477 struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v {
2478     struct cdp_htt_tlv_hdr tlv_hdr;
2479     /* Num ring empty encountered */
2480     uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
2481 };
2482 
2483 struct cdp_htt_tx_pdev_stats {
2484     struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv;
2485     struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv;
2486     struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv;
2487     struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv;
2488     struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv;
2489 	struct cdp_pdev_obss_pd_stats_tlv obss_pd_stats_tlv;
2490 };
2491 
2492 struct cdp_htt_rx_soc_stats_t {
2493     struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv;
2494     struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv;
2495     struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv;
2496 };
2497 
2498 struct cdp_htt_rx_pdev_stats {
2499     struct cdp_htt_rx_soc_stats_t soc_stats;
2500     struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv;
2501     struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv;
2502     struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop;
2503     struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv;
2504 };
2505 
2506 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
2507 /* Since protocol type enumeration value is passed as CCE metadata
2508  * to firmware, add a constant offset before passing it to firmware
2509  */
2510 #define RX_PROTOCOL_TAG_START_OFFSET  128
2511 /* This should align with packet type enumerations in ieee80211_ioctl.h
2512  * and wmi_unified_param.h files
2513  */
2514 #define RX_PROTOCOL_TAG_MAX   24
2515 /* Macro that should be used to dump the statistics counter for all
2516  * protocol types
2517  */
2518 #define RX_PROTOCOL_TAG_ALL 0xff
2519 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
2520 
2521 #ifdef WLAN_FEATURE_11BE
2522 #define OFDMA_NUM_RU_SIZE 16
2523 #else
2524 #define OFDMA_NUM_RU_SIZE 7
2525 #endif
2526 
2527 #define OFDMA_NUM_USERS	37
2528 
2529 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
2530 /*
2531  * mac_freeze_capture_reason - capture reason counters
2532  * @FREEZE_REASON_TM: When m_directed_ftm is enabled, this CFR data is
2533  * captured for a Timing Measurement (TM) frame.
2534  * @FREEZE_REASON_FTM: When m_directed_ftm is enabled, this CFR data is
2535  * captured for a Fine Timing Measurement (FTM) frame.
2536  * @FREEZE_REASON_ACK_RESP_TO_TM_FTM: When m_all_ftm_ack is enabled, this CFR
2537  * data is captured for an ACK received for the FTM/TM frame sent to a station.
2538  * @FREEZE_REASON_TA_RA_TYPE_FILTER: When m_ta_ra_filter is enabled, this CFR
2539  * data is captured for a PPDU received,since the CFR TA_RA filter is met.
2540  * @FREEZE_REASON_NDPA_NDP: When m_ndpa_ndp_directed(or)m_ndpa_ndp_all is
2541  * enabled, this CFR data is captured for an NDP frame received.
2542  * @FREEZE_REASON_ALL_PACKET: When m_all_packet is enabled, this CFR data is
2543  * captured for an incoming PPDU.
2544  */
2545 enum mac_freeze_capture_reason {
2546 	FREEZE_REASON_TM = 0,
2547 	FREEZE_REASON_FTM,
2548 	FREEZE_REASON_ACK_RESP_TO_TM_FTM,
2549 	FREEZE_REASON_TA_RA_TYPE_FILTER,
2550 	FREEZE_REASON_NDPA_NDP,
2551 	FREEZE_REASON_ALL_PACKET,
2552 	FREEZE_REASON_MAX,
2553 };
2554 
2555 /*
2556  * chan_capture_status: capture status counters
2557  * @CAPTURE_IDLE: CFR data is not captured, since VCSR setting for CFR/RCC is
2558  * not enabled.
2559  * @CAPTURE_BUSY: CFR data is not available, since previous channel
2560  * upload is in progress
2561  * @CAPTURE_ACTIVE: CFR data is captured in HW registers
2562  * @CAPTURE_NO_BUFFER: CFR data is not captured, since no buffer is available
2563  * in IPC ring to DMA CFR data
2564  */
2565 enum chan_capture_status {
2566 	CAPTURE_IDLE = 0,
2567 	CAPTURE_BUSY,
2568 	CAPTURE_ACTIVE,
2569 	CAPTURE_NO_BUFFER,
2570 	CAPTURE_MAX,
2571 };
2572 
2573 /* struct cdp_cfr_rcc_stats - CFR RCC debug statistics
2574  * @bb_captured_channel_cnt: No. of PPDUs for which MAC sent Freeze TLV to PHY
2575  * @bb_captured_timeout_cnt: No. of PPDUs for which CFR filter criteria matched
2576  * but MAC did not send Freeze TLV to PHY as time exceeded freeze tlv delay
2577  * count threshold
2578  * @rx_loc_info_valid_cnt: No. of PPDUs for which PHY could find a valid buffer
2579  * in ucode IPC ring
2580  * @chan_capture_status[]: capture status counters
2581  *	[0] - No. of PPDUs with capture status CAPTURE_IDLE
2582  *	[1] - No. of PPDUs with capture status CAPTURE_BUSY
2583  *	[2] - No. of PPDUs with capture status CAPTURE_ACTIVE
2584  *	[3] - No. of PPDUs with capture status CAPTURE_NO_BUFFER
2585  * @reason_cnt[]: capture reason counters
2586  *	[0] - No. PPDUs filtered due to freeze_reason_TM
2587  *	[1] - No. PPDUs filtered due to freeze_reason_FTM
2588  *	[2] - No. PPDUs filtered due to freeze_reason_ACK_resp_to_TM_FTM
2589  *	[3] - No. PPDUs filtered due to freeze_reason_TA_RA_TYPE_FILTER
2590  *	[4] - No. PPDUs filtered due to freeze_reason_NDPA_NDP
2591  *	[5] - No. PPDUs filtered due to freeze_reason_ALL_PACKET
2592  */
2593 struct cdp_cfr_rcc_stats {
2594 	uint64_t bb_captured_channel_cnt;
2595 	uint64_t bb_captured_timeout_cnt;
2596 	uint64_t rx_loc_info_valid_cnt;
2597 	uint64_t chan_capture_status[CAPTURE_MAX];
2598 	uint64_t reason_cnt[FREEZE_REASON_MAX];
2599 };
2600 #else
2601 struct cdp_cfr_rcc_stats {
2602 };
2603 #endif
2604 
2605 /* struct cdp_per_cpu_packets - Per cpu packets
2606  * @num_cpus: Number of cpus
2607  * @pkts: packet count per core
2608  */
2609 struct cdp_per_cpu_packets {
2610 	uint8_t num_cpus;
2611 	uint64_t pkts[CDP_NR_CPUS][CDP_MAX_RX_DEST_RINGS];
2612 };
2613 
2614 /* struct cdp_soc_stats - soc stats
2615  * @tx.egress: Total packets transmitted
2616  * @tx.tx_invalid_peer: packets dropped on tx because of no peer
2617  * @tx.tx_hw_enq: Enqueues per tx hw ring
2618  * @tx.tx_hw_ring_full: descriptors in each tx hw ring
2619  * @tx.desc_in_use: Descriptors in use at soc
2620  * @tx.dropped_fw_removed: HW_release_reason == FW removed
2621  * @tx.invalid_release_source: tx completion release_src != HW or FW
2622  * @tx.wifi_internal_error: tx completion wifi_internal_error
2623  * @tx.non_wifi_internal_err: tx completion non_wifi_internal_error
2624  * @tx.tx_comp_loop_pkt_limit_hit: TX Comp loop packet limit hit
2625  * @tx.hp_oos2: Head pointer Out of sync at the end of dp_tx_comp_handler
2626  * @tx.tx_comp_exception: tx desc freed as part of vdev detach
2627  * @rx.ingress: Total rx packets count
2628  * @rx.err_ring_pkts: Total Packets in Rx Error ring
2629  * @rx.rx_frags: No of Fragments
2630  * @rx.rx_hw_reinject: No of reinjected packets
2631  * @rx.bar_frame: Number of bar frames received
2632  * @rx.rx_frag_err_len_error: Fragments dropped due to len errors in skb
2633  * @rx.rx_frag_err_no_peer: Fragments dropped due to no peer found
2634  * @rx.rx_frag_wait: No of incomplete fragments in waitlist
2635  * @rx.rx_frag_err: Fragments dropped due to errors
2636  * @rx.rx_frag_oor: Fragments received OOR causing sequence num mismatch
2637  * @rx.reap_loop_pkt_limit_hit: Reap loop packet limit hit
2638  * @rx.hp_oos2: Head pointer Out of sync at the end of dp_rx_process
2639  * @rx.near_full: Rx ring near full
2640  * @rx.msdu_scatter_wait_break: Break ring reaping as not all scattered msdu
2641  * received
2642  * @rx.rx_sw_route_drop: Number of frames routed from rx sw ring
2643  * @rx.rx_hw_route_drop: Number of frames routed from rx hw ring
2644  * @rx.rx_packets: packet count per core
2645  * @rx.err.rx_rejected: RX msdu rejected count on delivery to vdev stack_fn
2646  * @rx.err.raw_frm_drop: RX raw frame dropped count
2647  * @rx.err.phy_ring_access_fail: phy ring access Fail error count
2648  * @rx.err.phy_ring_access_full_fail: phy ring access full Fail error count
2649  * @rx.err.phy_rx_error: phy rx order ERR Count
2650  * @rx.err.phy_rx_dest_dup: phy rx order DEST Duplicate count
2651  * @rx.err.phy_wifi_rel_dup: phy wifi RELEASE Duplicate count
2652  * @rx.err.phy_rx_sw_err_dup: phy rx sw error Duplicate count
2653  * @rx.err.invalid_rbm: Invalid RBM error count
2654  * @rx.err.invalid_vdev: Invalid VDEV Error count
2655  * @rx.err.invalid_pdev: Invalid PDEV error count
2656  * @rx.err.pkt_delivered_no_peer: Pkts delivered to stack that no related peer
2657  * @rx.err.defrag_peer_uninit: Defrag peer uninit error count
2658  * @rx.err.invalid_sa_da_idx: Invalid sa_idx or da_idx
2659  * @rx.err.msdu_done_fail: MSDU DONE failures
2660  * @ex.err.rx_invalid_peer: Invalid PEER Error count
2661  * @rx.err.rx_invalid_peer_id: Invalid PEER ID count
2662  * @rx.err.rx_invalid_pkt_len: Invalid packet length count
2663  * @rx.err.rx_sw_error: RX sw error count
2664  * @rx.err.rx_desc_invalid_magic: RX DEST Desc Invalid Magic count
2665  * @rx.err.rx_hw_error: rx hw Error count
2666  * @rx.err.rx_hw_cmd_send_fail: Rx hw cmd send fail/requeue count
2667  * @rx.err.rx_hw_cmd_send_drain: Rx hw cmd send drain count
2668  * @rx.err.scatter_msdu: RX msdu drop count due to scatter
2669  * @rx.err.invalid_cookie: RX msdu drop count due to invalid cookie
2670  * @rx.err.stale_cookie: Count of stale cookie read in RX path
2671  * @rx.err.rx_2k_jump_delba_sent: Delba sent count due to RX 2k jump
2672  * @rx.err.rx_2k_jump_to_stack: RX 2k jump msdu indicated to stack count
2673  * @rx.err.rx_2k_jump_drop: RX 2k jump msdu dropped count
2674  * @rx.err.rx_hw_err_oor_drop: Rx HW OOR msdu drop count
2675  * @rx.err.rx_hw_err_oor_to_stack: Rx HW OOR msdu indicated to stack count
2676  * @rx.err.rx_hw_err_oor_sg_count: Rx HW OOR scattered msdu count
2677  * @rx.err.msdu_count_mismatch: Incorrect msdu count in MPDU desc info
2678  * @rx.err.invalid_link_cookie: Stale link desc cookie count
2679  * @rx.err.nbuf_sanity_fail: Nbuf sanity failure
2680  * @rx.err.dup_refill_link_desc: Duplicate link desc refilled
2681  * @rx.err.msdu_continuation_err: Incorrect msdu continuation bit in MSDU desc
2682  * @rx.err.ssn_update_count: Count of start sequence (ssn) updates
2683  * @rx.err.bar_handle_fail_count: Count of bar handling fail
2684  * @rx.err.intrabss_eapol_drop: EAPOL drop count in intrabss scenario
2685  * @rx.err.pn_in_dest_check_fail: PN check failed for 2K-jump or OOR error
2686  * @rx.err.msdu_len_err: MSDU len err count
2687  * @rx.err.rx_flush_count: Rx flush count
2688  * @ast.added: ast entry added count
2689  * @ast.deleted: ast entry deleted count
2690  * @ast.aged_out: ast entry aged out count
2691  * @ast.map_err: ast entry mapping error count
2692  * @ast.ast_mismatch: ast entry mismatch count
2693  * @mec.added: Mec added count
2694  * @mec.deleted: Mec deleted count
2695  */
2696 struct cdp_soc_stats {
2697 	struct {
2698 		struct cdp_pkt_info egress;
2699 		struct cdp_pkt_info tx_invalid_peer;
2700 		uint32_t tx_hw_enq[CDP_MAX_TX_DATA_RINGS];
2701 		uint32_t tx_hw_ring_full[CDP_MAX_TX_DATA_RINGS];
2702 		uint32_t desc_in_use;
2703 		uint32_t dropped_fw_removed;
2704 		uint32_t invalid_release_source;
2705 		uint32_t wifi_internal_error[CDP_MAX_WIFI_INT_ERROR_REASONS];
2706 		uint32_t non_wifi_internal_err;
2707 		uint32_t tx_comp_loop_pkt_limit_hit;
2708 		uint32_t hp_oos2;
2709 		uint32_t tx_comp_exception;
2710 	} tx;
2711 
2712 	struct {
2713 		struct cdp_pkt_info ingress;
2714 		uint32_t err_ring_pkts;
2715 		uint32_t rx_frags;
2716 		uint32_t rx_hw_reinject;
2717 		uint32_t bar_frame;
2718 		uint32_t rx_frag_err_len_error;
2719 		uint32_t rx_frag_err_no_peer;
2720 		uint32_t rx_frag_wait;
2721 		uint32_t rx_frag_err;
2722 		uint32_t rx_frag_oor;
2723 		uint32_t reap_loop_pkt_limit_hit;
2724 		uint32_t hp_oos2;
2725 		uint32_t near_full;
2726 		uint32_t msdu_scatter_wait_break;
2727 		uint32_t rx_sw_route_drop;
2728 		uint32_t rx_hw_route_drop;
2729 		struct cdp_per_cpu_packets rx_packets;
2730 
2731 		struct {
2732 			uint32_t rx_rejected;
2733 			uint32_t rx_raw_frm_drop;
2734 			uint32_t phy_ring_access_fail;
2735 			uint32_t phy_ring_access_full_fail;
2736 			uint32_t phy_rx_hw_error[CDP_MAX_RX_DEST_RINGS];
2737 			uint32_t phy_rx_hw_dest_dup;
2738 			uint32_t phy_wifi_rel_dup;
2739 			uint32_t phy_rx_sw_err_dup;
2740 			uint32_t invalid_rbm;
2741 			uint32_t invalid_vdev;
2742 			uint32_t invalid_pdev;
2743 			uint32_t pkt_delivered_no_peer;
2744 			uint32_t defrag_peer_uninit;
2745 			uint32_t invalid_sa_da_idx;
2746 			uint32_t msdu_done_fail;
2747 			struct cdp_pkt_info rx_invalid_peer;
2748 			struct cdp_pkt_info rx_invalid_peer_id;
2749 			struct cdp_pkt_info rx_invalid_pkt_len;
2750 			uint32_t rx_sw_error[CDP_WIFI_ERR_MAX];
2751 			uint32_t rx_desc_invalid_magic;
2752 			uint32_t rx_hw_error[CDP_RX_ERR_MAX];
2753 			uint32_t rx_hw_cmd_send_fail;
2754 			uint32_t rx_hw_cmd_send_drain;
2755 			uint32_t scatter_msdu;
2756 			uint32_t invalid_cookie;
2757 			uint32_t stale_cookie;
2758 			uint32_t rx_2k_jump_delba_sent;
2759 			uint32_t rx_2k_jump_to_stack;
2760 			uint32_t rx_2k_jump_drop;
2761 			uint32_t rx_hw_err_msdu_buf_rcved;
2762 			uint32_t rx_hw_err_msdu_buf_invalid_cookie;
2763 			uint32_t rx_hw_err_oor_drop;
2764 			uint32_t rx_hw_err_raw_mpdu_drop;
2765 			uint32_t rx_hw_err_oor_to_stack;
2766 			uint32_t rx_hw_err_oor_sg_count;
2767 			uint32_t msdu_count_mismatch;
2768 			uint32_t invalid_link_cookie;
2769 			uint32_t nbuf_sanity_fail;
2770 			uint32_t dup_refill_link_desc;
2771 			uint32_t msdu_continuation_err;
2772 			uint32_t ssn_update_count;
2773 			uint32_t bar_handle_fail_count;
2774 			uint32_t intrabss_eapol_drop;
2775 			uint32_t pn_in_dest_check_fail;
2776 			uint32_t msdu_len_err;
2777 			uint32_t rx_flush_count;
2778 		} err;
2779 	} rx;
2780 
2781 	struct {
2782 		uint32_t added;
2783 		uint32_t deleted;
2784 		uint32_t aged_out;
2785 		uint32_t map_err;
2786 		uint32_t ast_mismatch;
2787 	} ast;
2788 
2789 	struct {
2790 		uint32_t added;
2791 		uint32_t deleted;
2792 	} mec;
2793 };
2794 
2795 #ifdef WLAN_TELEMETRY_STATS_SUPPORT
2796 /**
2797  * struct cdp_pdev_telemetry_stats- Structure to hold pdev telemetry stats
2798  * @tx_mpdu_failed: Tx mpdu failed
2799  * @tx_mpdu_total: Total tx mpdus
2800  * @link_airtime: pdev airtime usage per ac per sec
2801  */
2802 struct cdp_pdev_telemetry_stats {
2803 	uint32_t tx_mpdu_failed;
2804 	uint32_t tx_mpdu_total;
2805 	uint32_t link_airtime[WME_AC_MAX];
2806 };
2807 
2808 /**
2809  * struct cdp_peer_telemetry_stats- Structure to hold peer telemetry stats
2810  * @tx_mpdu_retried: Tx mpdus retried
2811  * @tx_mpdu_total: Total tx mpdus
2812  * @rx_mpdu_retried: Rx mpdus retried
2813  * @rx_mpdu_total: Total rx mpdus
2814  * @airtime_consumption: airtime consumption of that peer
2815  * @snr: peer average snr
2816  */
2817 struct cdp_peer_telemetry_stats {
2818 	uint32_t tx_mpdu_retried;
2819 	uint32_t tx_mpdu_total;
2820 	uint32_t rx_mpdu_retried;
2821 	uint32_t rx_mpdu_total;
2822 	uint8_t airtime_consumption[WME_AC_MAX];
2823 	uint8_t snr;
2824 };
2825 #endif
2826 
2827 /* struct cdp_pdev_stats - pdev stats
2828  * @msdu_not_done: packets dropped because msdu done bit not set
2829  * @mec:Multicast Echo check
2830  * @mesh_filter: Mesh Filtered packets
2831  * @mon_rx_drop: packets dropped on monitor vap
2832  * @wifi_parse: rxdma errors due to wifi parse error
2833  * @mon_radiotap_update_err: not enough space to update radiotap
2834  * @pkts: total packets replenished
2835  * @rxdma_err: rxdma errors for replenished
2836  * @nbuf_alloc_fail: nbuf alloc failed
2837  * @frag_alloc_fail: frag alloc failed
2838  * @map_err: Mapping failure
2839  * @x86_fail: x86 failures
2840  * @low_thresh_intrs: low threshold interrupts
2841  * @free_list: RX descriptors moving back to free list
2842  * @rx_raw_pkts: Rx Raw Packets
2843  * @mesh_mem_alloc: Mesh Rx Stats Alloc fail
2844  * @tso_desc_cnt: TSO descriptors
2845  * @sg_desc_cnt: SG Descriptors
2846  * @vlan_tag_stp_cnt: Vlan tagged Stp packets in wifi parse error
2847  * @desc_alloc_fail: desc alloc failed errors
2848  * @ip_csum_err: ip checksum errors
2849  * @tcp_udp_csum_err: tcp/udp checksum errors
2850  * @buf_freelist: buffers added back in freelist
2851  * @tx_i: Tx Ingress stats
2852  * @rx_i: Rx Ingress stats
2853  * @tx:CDP Tx Stats
2854  * @rx: CDP Rx Stats
2855  * @tx_comp_histogram: Number of Tx completions per interrupt
2856  * @rx_ind_histogram:  Number of Rx ring descriptors reaped per interrupt
2857  * @ppdu_stats_counter: ppdu stats counter
2858  * @cdp_delayed_ba_not_recev: counter for delayed ba not received
2859  * @htt_tx_pdev_stats: htt pdev stats for tx
2860  * @htt_rx_pdev_stats: htt pdev stats for rx
2861  * @data_rx_ru_size: UL ofdma data ru size counter array
2862  * @nondata_rx_ru_size: UL ofdma non data ru size counter array
2863  * @data_rx_ppdu: data rx ppdu counter
2864  * @data_user: data user counter array
2865  * @tx_ppdu_proc: stats counter for tx ppdu processed
2866  * @ack_ba_comes_twice: stats counter for ack_ba_comes twice
2867  * @ppdu_drop: stats counter for ppdu_desc drop once threshold reached
2868  * @ppdu_wrap_drop: stats counter for ppdu desc drop on wrap around
2869  * @peer_unauth_rx_pkt_drop: stats counter for drops due to unauthorized peer
2870  * @telemetry_stats: pdev telemetry stats
2871  */
2872 struct cdp_pdev_stats {
2873 	struct {
2874 		uint32_t msdu_not_done;
2875 		uint32_t mec;
2876 		uint32_t mesh_filter;
2877 		uint32_t wifi_parse;
2878 		/* Monitor mode related */
2879 		uint32_t mon_rx_drop;
2880 		uint32_t mon_radiotap_update_err;
2881 	} dropped;
2882 
2883 	struct {
2884 		struct cdp_pkt_info pkts;
2885 		uint32_t rxdma_err;
2886 		uint32_t nbuf_alloc_fail;
2887 		uint32_t frag_alloc_fail;
2888 		uint32_t map_err;
2889 		uint32_t x86_fail;
2890 		uint32_t low_thresh_intrs;
2891 		int32_t free_list;
2892 	} replenish;
2893 
2894 	uint32_t rx_raw_pkts;
2895 	uint32_t mesh_mem_alloc;
2896 	uint32_t tso_desc_cnt;
2897 	uint32_t sg_desc_cnt;
2898 	uint32_t vlan_tag_stp_cnt;
2899 
2900 	/* Rx errors */
2901 	struct {
2902 		uint32_t desc_alloc_fail;
2903 		uint32_t desc_lt_alloc_fail;
2904 		uint32_t ip_csum_err;
2905 		uint32_t tcp_udp_csum_err;
2906 		uint32_t rxdma_error;
2907 		uint32_t reo_error;
2908 	} err;
2909 
2910 	uint32_t buf_freelist;
2911 	struct cdp_tx_ingress_stats tx_i;
2912 	struct cdp_rx_ingress_stats rx_i;
2913 	struct cdp_tx_stats tx;
2914 	struct cdp_rx_stats rx;
2915 	struct cdp_hist_tx_comp tx_comp_histogram;
2916 	struct cdp_hist_rx_ind rx_ind_histogram;
2917 	uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG];
2918 	uint32_t cdp_delayed_ba_not_recev;
2919 
2920 	struct cdp_htt_tx_pdev_stats  htt_tx_pdev_stats;
2921 	struct cdp_htt_rx_pdev_stats  htt_rx_pdev_stats;
2922 
2923 	/* Received wdi messages from fw */
2924 	uint32_t wdi_event[CDP_WDI_NUM_EVENTS];
2925 	struct cdp_tid_stats tid_stats;
2926 
2927 	/* numbers of data/nondata per RU sizes */
2928 	struct {
2929 		uint32_t data_rx_ru_size[OFDMA_NUM_RU_SIZE];
2930 		uint32_t nondata_rx_ru_size[OFDMA_NUM_RU_SIZE];
2931 		uint32_t data_rx_ppdu;
2932 		uint32_t data_users[OFDMA_NUM_USERS];
2933 	} ul_ofdma;
2934 
2935 	struct cdp_tso_stats tso_stats;
2936 	struct cdp_cfr_rcc_stats rcc;
2937 
2938 	uint64_t tx_ppdu_proc;
2939 	uint64_t ack_ba_comes_twice;
2940 	uint64_t ppdu_drop;
2941 	uint64_t ppdu_wrap_drop;
2942 
2943 	struct {
2944 		uint64_t num_bufs_consumed;
2945 		uint64_t num_pool_bufs_replenish;
2946 		uint64_t num_bufs_alloc_success;
2947 	} rx_buffer_pool;
2948 
2949 	struct {
2950 		uint64_t num_bufs_refilled;
2951 		uint64_t num_bufs_allocated;
2952 	} rx_refill_buff_pool;
2953 
2954 	uint32_t peer_unauth_rx_pkt_drop;
2955 #ifdef WLAN_TELEMETRY_STATS_SUPPORT
2956 	struct cdp_pdev_telemetry_stats telemetry_stats;
2957 #endif
2958 };
2959 
2960 /* struct cdp_peer_hmwds_ast_add_status - hmwds peer ast add status
2961  * @vdev_id: vdev id
2962  * @status: ast add status
2963  * @peer_mac: peer mac address
2964  * @ast_mac: ast node mac address
2965  */
2966 struct cdp_peer_hmwds_ast_add_status {
2967 	uint32_t vdev_id;
2968 	uint32_t status;
2969 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
2970 	uint8_t  ast_mac[QDF_MAC_ADDR_SIZE];
2971 };
2972 
2973 /*
2974  * Enumeration of cdp soc parameters
2975  * @DP_SOC_PARAM_EAPOL_OVER_CONTROL_PORT: For sending EAPOL's over control port
2976  * @DP_SOC_PARAM_MULTI_PEER_GRP_CMD_SUPPORT: For sending bulk AST delete
2977  * @DP_SOC_PARAM_RSSI_DBM_CONV_SUPPORT: To set the rssi dbm support bit
2978  * @DP_SOC_PARAM_UMAC_HW_RESET_SUPPORT: Whether target supports UMAC HW reset
2979  */
2980 enum cdp_soc_param_t {
2981 	DP_SOC_PARAM_MSDU_EXCEPTION_DESC,
2982 	DP_SOC_PARAM_CMEM_FSE_SUPPORT,
2983 	DP_SOC_PARAM_MAX_AST_AGEOUT,
2984 	DP_SOC_PARAM_EAPOL_OVER_CONTROL_PORT,
2985 	DP_SOC_PARAM_MULTI_PEER_GRP_CMD_SUPPORT,
2986 	DP_SOC_PARAM_RSSI_DBM_CONV_SUPPORT,
2987 	DP_SOC_PARAM_UMAC_HW_RESET_SUPPORT,
2988 	DP_SOC_PARAM_MAX,
2989 };
2990 
2991 #ifdef QCA_ENH_V3_STATS_SUPPORT
2992 /*
2993  * Enumeration of PDEV Configuration parameter
2994  */
2995 enum _dp_param_t {
2996 	DP_PARAM_MSDU_TTL,
2997 	DP_PARAM_TOTAL_Q_SIZE_RANGE0,
2998 	DP_PARAM_TOTAL_Q_SIZE_RANGE1,
2999 	DP_PARAM_TOTAL_Q_SIZE_RANGE2,
3000 	DP_PARAM_TOTAL_Q_SIZE_RANGE3,
3001 	DP_PARAM_VIDEO_DELAY_STATS_FC,
3002 	DP_PARAM_QFLUSHINTERVAL,
3003 	DP_PARAM_TOTAL_Q_SIZE,
3004 	DP_PARAM_MIN_THRESHOLD,
3005 	DP_PARAM_MAX_Q_LIMIT,
3006 	DP_PARAM_MIN_Q_LIMIT,
3007 	DP_PARAM_CONG_CTRL_TIMER_INTV,
3008 	DP_PARAM_STATS_TIMER_INTV,
3009 	DP_PARAM_ROTTING_TIMER_INTV,
3010 	DP_PARAM_LATENCY_PROFILE,
3011 	DP_PARAM_HOSTQ_DUMP,
3012 	DP_PARAM_TIDQ_MAP,
3013 	DP_PARAM_VIDEO_STATS_FC,
3014 	DP_PARAM_STATS_FC,
3015 
3016 	DP_PARAM_MAX,
3017 };
3018 #endif
3019 /* Bitmasks for stats that can block */
3020 #define EXT_TXRX_FW_STATS		0x0001
3021 
3022 #define CDP_TX_CAP_HTT_MAX_FTYPE 19
3023 #define CDP_FC0_TYPE_SHIFT 2
3024 #define CDP_FC0_SUBTYPE_SHIFT 4
3025 #define CDP_FC0_TYPE_DATA 0x08
3026 #define CDP_FC0_SUBTYPE_MASK 0xf0
3027 
3028 #define CDP_TXCAP_MAX_TYPE \
3029 	((CDP_FC0_TYPE_DATA >> CDP_FC0_TYPE_SHIFT) + 1)
3030 #define CDP_TXCAP_MAX_SUBTYPE \
3031 	((CDP_FC0_SUBTYPE_MASK >> CDP_FC0_SUBTYPE_SHIFT) + 1)
3032 
3033 enum CDP_PEER_MSDU_DESC {
3034 	PEER_MSDU_SUCC,
3035 	PEER_MSDU_ENQ,
3036 	PEER_MSDU_DEQ,
3037 	PEER_MSDU_FLUSH,
3038 	PEER_MSDU_DROP,
3039 	PEER_MSDU_XRETRY,
3040 	PEER_MSDU_DESC_MAX,
3041 };
3042 
3043 enum CDP_PEER_MPDU_DESC {
3044 	PEER_MPDU_TRI,
3045 	PEER_MPDU_SUCC,
3046 	PEER_MPDU_RESTITCH,
3047 	PEER_MPDU_ARR,
3048 	PEER_MPDU_CLONE,
3049 	PEER_MPDU_TO_STACK,
3050 	PEER_MPDU_DESC_MAX,
3051 };
3052 
3053 /**
3054  * struct cdp_tid_q_len - Structure to hold consolidated queue length
3055  * @defer_msdu_len: Deferred MSDU queue length
3056  * @tasklet_msdu_len: MSDU complete queue length
3057  * @pending_q_len: MSDU pending queue length
3058  */
3059 struct cdp_tid_q_len {
3060 	uint64_t defer_msdu_len;
3061 	uint64_t tasklet_msdu_len;
3062 	uint64_t pending_q_len;
3063 };
3064 
3065 /**
3066  * struct cdp_peer_tx_capture_stats - Structure to hold peer tx capture stats
3067  * @len_stats: Per TID deferred, pending and completed msdu queue length
3068  * @mpdu: Mpdu success and restich count
3069  * @msdu: Msdu success and restich count
3070  */
3071 struct cdp_peer_tx_capture_stats {
3072 	struct cdp_tid_q_len len_stats[CDP_MAX_TIDS];
3073 #ifdef WLAN_TX_PKT_CAPTURE_ENH_DEBUG
3074 	uint32_t mpdu[PEER_MPDU_DESC_MAX];
3075 	uint32_t msdu[PEER_MSDU_DESC_MAX];
3076 #endif
3077 };
3078 
3079 /**
3080  * struct cdp_pdev_tx_capture_stats - Structure to hold pdev tx capture stats
3081  * @peer_mismatch: Peer mismatched
3082  * @last_rcv_ppdu: Last received PPDU stats in ms
3083  * @ppdu_stats_queue_depth: PPDU stats queue depth
3084  * @ppdu_stats_defer_queue_depth: PPDU stats deferred queue depth
3085  * @ppdu_dropped: PPDU dropped count
3086  * @pend_ppdu_dropped: Pending PPDU dropped count
3087  * @ppdu_flush_count: PPDU flush count
3088  * @msdu_threshold_drop: MSDU threshold drop count
3089  * @ctl_mgmt_q_len: Control management queue length
3090  * @retries_ctl_mgmt_q_len: Control management retries queue length
3091  * @htt_frame_type: HTT frame type
3092  * @len_stats: Consolidated msdu, ppdu and pending queue length
3093  */
3094 struct cdp_pdev_tx_capture_stats {
3095 	uint64_t peer_mismatch;
3096 	uint32_t last_rcv_ppdu;
3097 	uint32_t ppdu_stats_queue_depth;
3098 	uint32_t ppdu_stats_defer_queue_depth;
3099 	uint32_t ppdu_dropped;
3100 	uint32_t pend_ppdu_dropped;
3101 	uint32_t ppdu_flush_count;
3102 	uint32_t msdu_threshold_drop;
3103 	unsigned int ctl_mgmt_q_len[CDP_TXCAP_MAX_TYPE][CDP_TXCAP_MAX_SUBTYPE];
3104 	unsigned int retries_ctl_mgmt_q_len[CDP_TXCAP_MAX_TYPE]
3105 					   [CDP_TXCAP_MAX_SUBTYPE];
3106 	uint32_t htt_frame_type[CDP_TX_CAP_HTT_MAX_FTYPE];
3107 	struct cdp_tid_q_len len_stats;
3108 };
3109 #endif
3110