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