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