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