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