xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats_struct.h (revision d63e03e207713f1d4d8a384c065ef4e076216f2e)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * @file cdp_txrx_stats_struct.h
21  * @brief Define the host data path stats API functions
22  * called by the host control SW and the OS interface module
23  */
24 #ifndef _CDP_TXRX_STATS_STRUCT_H_
25 #define _CDP_TXRX_STATS_STRUCT_H_
26 
27 #include <qdf_types.h>
28 #include <cdp_txrx_hist_struct.h>
29 
30 #define TXRX_STATS_LEVEL_OFF   0
31 #define TXRX_STATS_LEVEL_BASIC 1
32 #define TXRX_STATS_LEVEL_FULL  2
33 
34 #define BSS_CHAN_INFO_READ                        1
35 #define BSS_CHAN_INFO_READ_AND_CLEAR              2
36 
37 #define TX_FRAME_TYPE_DATA 0
38 #define TX_FRAME_TYPE_MGMT 1
39 #define TX_FRAME_TYPE_BEACON 2
40 
41 #ifndef TXRX_STATS_LEVEL
42 #define TXRX_STATS_LEVEL TXRX_STATS_LEVEL_BASIC
43 #endif
44 
45 /* 1 additional MCS is for invalid values */
46 #define MAX_MCS (14 + 1)
47 #define MAX_MCS_11A 8
48 #define MAX_MCS_11B 7
49 #define MAX_MCS_11AC 12
50 /* 1 additional GI is for invalid values */
51 #define MAX_GI (4 + 1)
52 #define SS_COUNT 8
53 #define MAX_BW 7
54 #define MAX_RECEPTION_TYPES 4
55 
56 #define MAX_TRANSMIT_TYPES	9
57 
58 #define MAX_USER_POS		8
59 #define MAX_MU_GROUP_ID		64
60 #define MAX_RU_LOCATIONS	6
61 #define RU_26			1
62 #define RU_52			2
63 #define RU_106			4
64 #define RU_242			9
65 #define RU_484			18
66 #define RU_996			37
67 
68 /* WME stream classes */
69 #define WME_AC_BE    0    /* best effort */
70 #define WME_AC_BK    1    /* background */
71 #define WME_AC_VI    2    /* video */
72 #define WME_AC_VO    3    /* voice */
73 #define WME_AC_MAX   4    /* MAX AC Value */
74 
75 #define CDP_MAX_RX_RINGS 8  /* max rx rings */
76 #define CDP_MAX_TX_COMP_RINGS 5 /* max tx/completion rings */
77 
78 #define CDP_MAX_TX_TQM_STATUS 9  /* max tx tqm completion status */
79 #define CDP_MAX_TX_HTT_STATUS 7  /* max tx htt completion status */
80 
81 #define CDP_DMA_CODE_MAX 14 /* max rxdma error */
82 #define CDP_REO_CODE_MAX 15 /* max reo error */
83 
84 /*
85  * Max of TxRx context
86  */
87 #define CDP_MAX_TXRX_CTX CDP_MAX_RX_RINGS
88 
89 /* TID level VoW stats macros
90  * to add and get stats
91  */
92 #define PFLOW_TXRX_TIDQ_STATS_ADD(_peer, _tid, _var, _val) \
93 	(((_peer)->tidq_stats[_tid]).stats[_var]) += _val
94 #define PFLOW_TXRX_TIDQ_STATS_GET(_peer, _tid, _var, _val) \
95 	((_peer)->tidq_stats[_tid].stats[_var])
96 /*
97  * Video only stats
98  */
99 #define PFLOW_CTRL_PDEV_VIDEO_STATS_SET(_pdev, _var, _val) \
100 	(((_pdev)->vow.vistats[_var]).value) = _val
101 #define PFLOW_CTRL_PDEV_VIDEO_STATS_GET(_pdev, _var) \
102 	((_pdev)->vow.vistats[_var].value)
103 #define PFLOW_CTRL_PDEV_VIDEO_STATS_ADD(_pdev, _var, _val) \
104 	(((_pdev)->vow.vistats[_var]).value) += _val
105 /*
106  * video delay stats
107  */
108 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_SET(_pdev, _var, _val) \
109 	(((_pdev)->vow.delaystats[_var]).value) = _val
110 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_GET(_pdev, _var) \
111 	((_pdev)->vow.delaystats[_var].value)
112 #define PFLOW_CTRL_PDEV_DELAY_VIDEO_STATS_ADD(_pdev, _var, _val) \
113 	(((_pdev)->vow.delaystats[_var]).value) += _val
114 /*
115  * Number of TLVs sent by FW. Needs to reflect
116  * HTT_PPDU_STATS_MAX_TAG declared in FW
117  */
118 #define CDP_PPDU_STATS_MAX_TAG 14
119 #define CDP_MAX_DATA_TIDS 9
120 #define CDP_MAX_VOW_TID 4
121 
122 #define CDP_WDI_NUM_EVENTS WDI_NUM_EVENTS
123 
124 #define CDP_FCTL_RETRY 0x0800
125 #define CDP_FC_IS_RETRY_SET(_fc) \
126 	((_fc) & qdf_cpu_to_le16(CDP_FCTL_RETRY))
127 
128 #define CDP_INVALID_SNR 255
129 
130 #define CDP_SNR_MULTIPLIER BIT(8)
131 #define CDP_SNR_MUL(x, mul) ((x) * (mul))
132 #define CDP_SNR_RND(x, mul) ((((x) % (mul)) >= ((mul) / 2)) ?\
133 	((x) + ((mul) - 1)) / (mul) : (x) / (mul))
134 
135 #define CDP_SNR_OUT(x) (CDP_SNR_RND((x), CDP_SNR_MULTIPLIER))
136 #define CDP_SNR_IN(x)  (CDP_SNR_MUL((x), CDP_SNR_MULTIPLIER))
137 #define CDP_SNR_AVG(x, y) ((((x) << 2) + (y) - (x)) >> 2)
138 
139 #define CDP_SNR_UPDATE_AVG(x, y) x = CDP_SNR_AVG((x), CDP_SNR_IN((y)))
140 
141 /*Max SU EVM count */
142 #define DP_RX_MAX_SU_EVM_COUNT 32
143 
144 #define WDI_EVENT_BASE 0x100
145 
146 #define CDP_TXRX_RATECODE_MCS_MASK 0xF
147 #define CDP_TXRX_RATECODE_NSS_MASK 0x3
148 #define CDP_TXRX_RATECODE_NSS_LSB 4
149 #define CDP_TXRX_RATECODE_PREM_MASK 0x3
150 #define CDP_TXRX_RATECODE_PREM_LSB 6
151 
152 /* Below BW_GAIN should be added to the SNR value of every ppdu based on the
153  * bandwidth. This table is obtained from HALPHY.
154  * BW         BW_Gain
155  * 20          0
156  * 40          3dBm
157  * 80          6dBm
158  * 160/80P80   9dBm
159  */
160 
161 #define PKT_BW_GAIN_20MHZ 0
162 #define PKT_BW_GAIN_40MHZ 3
163 #define PKT_BW_GAIN_80MHZ 6
164 #define PKT_BW_GAIN_160MHZ 9
165 
166 /*
167  * cdp_tx_transmit_type: Transmit type index
168  * SU: SU Transmit type index
169  * MU_MIMO: MU_MIMO Transmit type index
170  * MU_OFDMA: MU_OFDMA Transmit type index
171  * MU_MIMO_OFDMA: MU MIMO OFDMA Transmit type index
172  */
173 enum cdp_tx_transmit_type {
174 	SU = 0,
175 	MU_MIMO,
176 	MU_OFDMA,
177 	MU_MIMO_OFDMA,
178 };
179 
180 /*
181  * cdp_ru_index: Different RU index
182  *
183  * RU_26_INDEX : 26-tone Resource Unit index
184  * RU_52_INDEX : 52-tone Resource Unit index
185  * RU_106_INDEX: 106-tone Resource Unit index
186  * RU_242_INDEX: 242-tone Resource Unit index
187  * RU_484_INDEX: 484-tone Resource Unit index
188  * RU_996_INDEX: 996-tone Resource Unit index
189  */
190 enum cdp_ru_index {
191 	RU_26_INDEX = 0,
192 	RU_52_INDEX,
193 	RU_106_INDEX,
194 	RU_242_INDEX,
195 	RU_484_INDEX,
196 	RU_996_INDEX,
197 	RU_INDEX_MAX,
198 };
199 
200 struct cdp_ru_debug {
201 	char *ru_type;
202 };
203 
204 static const struct cdp_ru_debug cdp_ru_string[RU_INDEX_MAX] = {
205 	{ "RU_26" },
206 	{ "RU_52" },
207 	{ "RU_106" },
208 	{ "RU_242" },
209 	{ "RU_484" },
210 	{ "RU_996" }
211 };
212 
213 #ifdef FEATURE_TSO_STATS
214 /* Number of TSO Packet Statistics captured */
215 #define CDP_MAX_TSO_PACKETS 5
216 /* Information for Number of Segments for a TSO Packet captured */
217 #define CDP_MAX_TSO_SEGMENTS 2
218 /* Information for Number of Fragments for a TSO Segment captured */
219 #define CDP_MAX_TSO_FRAGMENTS 6
220 #endif /* FEATURE_TSO_STATS */
221 
222 /* Different Packet Types */
223 enum cdp_packet_type {
224 	DOT11_A = 0,
225 	DOT11_B = 1,
226 	DOT11_N = 2,
227 	DOT11_AC = 3,
228 	DOT11_AX = 4,
229 	DOT11_MAX = 5,
230 };
231 
232 #define MCS_VALID 1
233 #define MCS_INVALID 0
234 
235 #define CDP_MAX_MCS_STRING_LEN 34
236 /*
237  * struct cdp_rate_debug
238  *
239  * @mcs_type: print string for a given mcs
240  * @valid: valid mcs rate?
241  */
242 struct cdp_rate_debug {
243 	char mcs_type[CDP_MAX_MCS_STRING_LEN];
244 	uint8_t valid;
245 };
246 
247 static const struct cdp_rate_debug cdp_rate_string[DOT11_MAX][MAX_MCS] = {
248 	{
249 		{"OFDM 48 Mbps", MCS_VALID},
250 		{"OFDM 24 Mbps", MCS_VALID},
251 		{"OFDM 12 Mbps", MCS_VALID},
252 		{"OFDM 6 Mbps ", MCS_VALID},
253 		{"OFDM 54 Mbps", MCS_VALID},
254 		{"OFDM 36 Mbps", MCS_VALID},
255 		{"OFDM 18 Mbps", MCS_VALID},
256 		{"OFDM 9 Mbps ", MCS_VALID},
257 		{"INVALID ", MCS_INVALID},
258 		{"INVALID ", MCS_INVALID},
259 		{"INVALID ", MCS_INVALID},
260 		{"INVALID ", MCS_INVALID},
261 		{"INVALID ", MCS_INVALID},
262 	},
263 	{
264 		{"CCK 11 Mbps Long  ", MCS_VALID},
265 		{"CCK 5.5 Mbps Long ", MCS_VALID},
266 		{"CCK 2 Mbps Long   ", MCS_VALID},
267 		{"CCK 1 Mbps Long   ", MCS_VALID},
268 		{"CCK 11 Mbps Short ", MCS_VALID},
269 		{"CCK 5.5 Mbps Short", MCS_VALID},
270 		{"CCK 2 Mbps Short  ", MCS_VALID},
271 		{"INVALID ", MCS_INVALID},
272 		{"INVALID ", MCS_INVALID},
273 		{"INVALID ", MCS_INVALID},
274 		{"INVALID ", MCS_INVALID},
275 		{"INVALID ", MCS_INVALID},
276 		{"INVALID ", MCS_INVALID},
277 	},
278 	{
279 		{"HT MCS 0 (BPSK 1/2)  ", MCS_VALID},
280 		{"HT MCS 1 (QPSK 1/2)  ", MCS_VALID},
281 		{"HT MCS 2 (QPSK 3/4)  ", MCS_VALID},
282 		{"HT MCS 3 (16-QAM 1/2)", MCS_VALID},
283 		{"HT MCS 4 (16-QAM 3/4)", MCS_VALID},
284 		{"HT MCS 5 (64-QAM 2/3)", MCS_VALID},
285 		{"HT MCS 6 (64-QAM 3/4)", MCS_VALID},
286 		{"HT MCS 7 (64-QAM 5/6)", MCS_VALID},
287 		{"INVALID ", MCS_INVALID},
288 		{"INVALID ", MCS_INVALID},
289 		{"INVALID ", MCS_INVALID},
290 		{"INVALID ", MCS_INVALID},
291 		{"INVALID ", MCS_INVALID},
292 	},
293 	{
294 		{"VHT MCS 0 (BPSK 1/2)     ", MCS_VALID},
295 		{"VHT MCS 1 (QPSK 1/2)     ", MCS_VALID},
296 		{"VHT MCS 2 (QPSK 3/4)     ", MCS_VALID},
297 		{"VHT MCS 3 (16-QAM 1/2)   ", MCS_VALID},
298 		{"VHT MCS 4 (16-QAM 3/4)   ", MCS_VALID},
299 		{"VHT MCS 5 (64-QAM 2/3)   ", MCS_VALID},
300 		{"VHT MCS 6 (64-QAM 3/4)   ", MCS_VALID},
301 		{"VHT MCS 7 (64-QAM 5/6)   ", MCS_VALID},
302 		{"VHT MCS 8 (256-QAM 3/4)  ", MCS_VALID},
303 		{"VHT MCS 9 (256-QAM 5/6)  ", MCS_VALID},
304 		{"VHT MCS 10 (1024-QAM 3/4)", MCS_VALID},
305 		{"VHT MCS 11 (1024-QAM 5/6)", MCS_VALID},
306 		{"INVALID ", MCS_INVALID},
307 	},
308 	{
309 		{"HE MCS 0 (BPSK 1/2)     ", MCS_VALID},
310 		{"HE MCS 1 (QPSK 1/2)     ", MCS_VALID},
311 		{"HE MCS 2 (QPSK 3/4)     ", MCS_VALID},
312 		{"HE MCS 3 (16-QAM 1/2)   ", MCS_VALID},
313 		{"HE MCS 4 (16-QAM 3/4)   ", MCS_VALID},
314 		{"HE MCS 5 (64-QAM 2/3)   ", MCS_VALID},
315 		{"HE MCS 6 (64-QAM 3/4)   ", MCS_VALID},
316 		{"HE MCS 7 (64-QAM 5/6)   ", MCS_VALID},
317 		{"HE MCS 8 (256-QAM 3/4)  ", MCS_VALID},
318 		{"HE MCS 9 (256-QAM 5/6)  ", MCS_VALID},
319 		{"HE MCS 10 (1024-QAM 3/4)", MCS_VALID},
320 		{"HE MCS 11 (1024-QAM 5/6)", MCS_VALID},
321 		{"HE MCS 12 (4096-QAM 3/4)", MCS_VALID},
322 		{"HE MCS 13 (4096-QAM 5/6)", MCS_VALID},
323 		{"INVALID ", MCS_INVALID},
324 	}
325 };
326 
327 /*
328  * cdp_mu_packet_type: MU Rx type index
329  * RX_TYPE_MU_MIMO: MU MIMO Rx type index
330  * RX_TYPE_MU_OFDMA: MU OFDMA Rx type index
331  * MU_MIMO_OFDMA: MU Rx MAX type index
332  */
333 enum cdp_mu_packet_type {
334 	RX_TYPE_MU_MIMO = 0,
335 	RX_TYPE_MU_OFDMA = 1,
336 	RX_TYPE_MU_MAX = 2,
337 };
338 
339 enum WDI_EVENT {
340 	WDI_EVENT_TX_STATUS = WDI_EVENT_BASE,
341 	WDI_EVENT_OFFLOAD_ALL,
342 	WDI_EVENT_RX_DESC_REMOTE,
343 	WDI_EVENT_RX_PEER_INVALID,
344 	WDI_EVENT_DBG_PRINT, /* NEED to integrate pktlog changes*/
345 	WDI_EVENT_RX_CBF_REMOTE,
346 	WDI_EVENT_RATE_FIND,
347 	WDI_EVENT_RATE_UPDATE,
348 	WDI_EVENT_SW_EVENT,
349 	WDI_EVENT_RX_DESC,
350 	WDI_EVENT_LITE_T2H,
351 	WDI_EVENT_LITE_RX,
352 	WDI_EVENT_RX_PPDU_DESC,
353 	WDI_EVENT_TX_PPDU_DESC,
354 	WDI_EVENT_TX_MSDU_DESC,
355 	WDI_EVENT_TX_DATA,
356 	WDI_EVENT_RX_DATA,
357 	WDI_EVENT_TX_MGMT_CTRL,
358 	WDI_EVENT_TX_PKT_CAPTURE,
359 	WDI_EVENT_HTT_STATS,
360 	WDI_EVENT_TX_BEACON,
361 	WDI_EVENT_PEER_STATS,
362 	WDI_EVENT_TX_SOJOURN_STAT,
363 	WDI_EVENT_UPDATE_DP_STATS,
364 	WDI_EVENT_RX_MGMT_CTRL,
365 	WDI_EVENT_PEER_CREATE,
366 	WDI_EVENT_PEER_DESTROY,
367 	WDI_EVENT_PEER_FLUSH_RATE_STATS,
368 	WDI_EVENT_FLUSH_RATE_STATS_REQ,
369 	WDI_EVENT_RX_MPDU,
370 	WDI_EVENT_HMWDS_AST_ADD_STATUS,
371 	WDI_EVENT_PEER_QOS_STATS,
372 	WDI_EVENT_PKT_CAPTURE_TX_DATA,
373 	WDI_EVENT_PKT_CAPTURE_RX_DATA,
374 	WDI_EVENT_PKT_CAPTURE_RX_DATA_NO_PEER,
375 	WDI_EVENT_PKT_CAPTURE_OFFLOAD_TX_DATA,
376 	WDI_EVENT_RX_CBF,
377 	WDI_EVENT_PKT_CAPTURE_PPDU_STATS,
378 	/* End of new event items */
379 	WDI_EVENT_LAST
380 };
381 
382 #define WDI_NUM_EVENTS WDI_EVENT_LAST - WDI_EVENT_BASE
383 
384 struct cdp_stats_extd {
385 };
386 
387 /* TID level Tx/Rx stats
388  *
389  */
390 enum cdp_txrx_tidq_stats {
391 	/* Tx Counters */
392 	TX_MSDU_TOTAL_LINUX_SUBSYSTEM,
393 	TX_MSDU_TOTAL_FROM_OSIF,
394 	TX_MSDU_TX_COMP_PKT_CNT,
395 	/* Rx Counters */
396 	RX_MSDU_TOTAL_FROM_FW,
397 	RX_MSDU_MCAST_FROM_FW,
398 	RX_TID_MISMATCH_FROM_FW,
399 	RX_MSDU_MISC_PKTS,
400 	RX_MSDU_IS_ARP,
401 	RX_MSDU_IS_EAP,
402 	RX_MSDU_IS_DHCP,
403 	RX_AGGREGATE_10,
404 	RX_AGGREGATE_20,
405 	RX_AGGREGATE_30,
406 	RX_AGGREGATE_40,
407 	RX_AGGREGATE_50,
408 	RX_AGGREGATE_60,
409 	RX_AGGREGATE_MORE,
410 	RX_AMSDU_1,
411 	RX_AMSDU_2,
412 	RX_AMSDU_3,
413 	RX_AMSDU_4,
414 	RX_AMSDU_MORE,
415 	RX_MSDU_CHAINED_FROM_FW,
416 	RX_MSDU_REORDER_FAILED_FROM_FW,
417 	RX_MSDU_REORDER_FLUSHED_FROM_FW,
418 	RX_MSDU_DISCARD_FROM_FW,
419 	RX_MSDU_DUPLICATE_FROM_FW,
420 	RX_MSDU_DELIVERED_TO_STACK,
421 	TIDQ_STATS_MAX,
422 };
423 
424 struct cdp_tidq_stats {
425 	uint32_t stats[TIDQ_STATS_MAX];
426 };
427 
428 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
429 /**
430  * struct cdp_rx_ppdu_cfr_info - struct for storing ppdu info extracted from HW
431  * TLVs, this will be used for CFR correlation
432  *
433  * @bb_captured_channel : Set by RXPCU when MACRX_FREEZE_CAPTURE_CHANNEL TLV is
434  * sent to PHY, SW checks it to correlate current PPDU TLVs with uploaded
435  * channel information.
436  *
437  * @bb_captured_timeout : Set by RxPCU to indicate channel capture condition is
438  * met, but MACRX_FREEZE_CAPTURE_CHANNEL is not sent to PHY due to AST delay,
439  * which means the rx_frame_falling edge to FREEZE TLV ready time exceeds
440  * the threshold time defined by RXPCU register FREEZE_TLV_DELAY_CNT_THRESH.
441  * Bb_captured_reason is still valid in this case.
442  *
443  * @bb_captured_reason : Copy capture_reason of MACRX_FREEZE_CAPTURE_CHANNEL
444  * TLV to here for FW usage. Valid when bb_captured_channel or
445  * bb_captured_timeout is set.
446  * <enum 0 freeze_reason_TM>
447  * <enum 1 freeze_reason_FTM>
448  * <enum 2 freeze_reason_ACK_resp_to_TM_FTM>
449  * <enum 3 freeze_reason_TA_RA_TYPE_FILTER>
450  * <enum 4 freeze_reason_NDPA_NDP>
451  * <enum 5 freeze_reason_ALL_PACKET>
452  * <legal 0-5>
453  *
454  * @rx_location_info_valid: Indicates whether CFR DMA address in the PPDU TLV
455  * is valid
456  * <enum 0 rx_location_info_is_not_valid>
457  * <enum 1 rx_location_info_is_valid>
458  * <legal all>
459  *
460  * @chan_capture_status : capture status reported by ucode
461  * a. CAPTURE_IDLE: FW has disabled "REPETITIVE_CHE_CAPTURE_CTRL"
462  * b. CAPTURE_BUSY: previous PPDU’s channel capture upload DMA ongoing. (Note
463  * that this upload is triggered after receiving freeze_channel_capture TLV
464  * after last PPDU is rx)
465  * c. CAPTURE_ACTIVE: channel capture is enabled and no previous channel
466  * capture ongoing
467  * d. CAPTURE_NO_BUFFER: next buffer in IPC ring not available
468  *
469  * @rtt_che_buffer_pointer_high8 : The high 8 bits of the 40 bits pointer to
470  * external RTT channel information buffer
471  *
472  * @rtt_che_buffer_pointer_low32 : The low 32 bits of the 40 bits pointer to
473  * external RTT channel information buffer
474  *
475  * @rtt_cfo_measurement : raw cfo data extracted from hardware, which is 14 bit
476  * signed number. The first bit used for sign representation and 13 bits for
477  * fractional part.
478  *
479  * @agc_gain_info0: Chain 0 & chain 1 agc gain information reported by PHY
480  *
481  * @agc_gain_info1: Chain 2 & chain 3 agc gain information reported by PHY
482  *
483  * @agc_gain_info2: Chain 4 & chain 5 agc gain information reported by PHY
484  *
485  * @agc_gain_info3: Chain 6 & chain 7 agc gain information reported by PHY
486  *
487  * @rx_start_ts: Rx packet timestamp, the time the first L-STF ADC sample
488  * arrived at Rx antenna.
489  *
490  * @mcs_rate: Indicates the mcs/rate in which packet is received.
491  * If HT,
492  *    0-7: MCS0-MCS7
493  * If VHT,
494  *    0-9: MCS0 to MCS9
495  * If HE,
496  *    0-11: MCS0 to MCS11,
497  *    12-13: 4096QAM,
498  *    14-15: reserved
499  * If Legacy,
500  *    0: 48 Mbps
501  *    1: 24 Mbps
502  *    2: 12 Mbps
503  *    3: 6 Mbps
504  *    4: 54 Mbps
505  *    5: 36 Mbps
506  *    6: 18 Mbps
507  *    7: 9 Mbps
508  *
509  * @gi_type: Indicates the gaurd interval.
510  *    0: 0.8 us
511  *    1: 0.4 us
512  *    2: 1.6 us
513  *    3: 3.2 us
514  */
515 struct cdp_rx_ppdu_cfr_info {
516 	bool bb_captured_channel;
517 	bool bb_captured_timeout;
518 	uint8_t bb_captured_reason;
519 	bool rx_location_info_valid;
520 	uint8_t chan_capture_status;
521 	uint8_t rtt_che_buffer_pointer_high8;
522 	uint32_t rtt_che_buffer_pointer_low32;
523 	int16_t rtt_cfo_measurement;
524 	uint32_t agc_gain_info0;
525 	uint32_t agc_gain_info1;
526 	uint32_t agc_gain_info2;
527 	uint32_t agc_gain_info3;
528 	uint32_t rx_start_ts;
529 	uint32_t mcs_rate;
530 	uint32_t gi_type;
531 };
532 #endif
533 /*
534  * struct cdp_rx_su_evm_info: Rx evm info
535  * @number_of_symbols: number of symbols
536  * @nss_count: number of spatial streams
537  * @pilot_count: number of pilot count
538  */
539 struct cdp_rx_su_evm_info {
540 	uint16_t number_of_symbols;
541 	uint8_t  nss_count;
542 	uint8_t  pilot_count;
543 	uint32_t pilot_evm[DP_RX_MAX_SU_EVM_COUNT];
544 };
545 
546 /*
547  * cdp_delay_stats_mode: Different types of delay statistics
548  *
549  * @CDP_DELAY_STATS_SW_ENQ: Stack to hw enqueue delay
550  * @CDP_DELAY_STATS_TX_INTERFRAME: Interframe delay at radio entry point
551  * @CDP_DELAY_STATS_FW_HW_TRANSMIT: Hw enqueue to tx completion delay
552  * @CDP_DELAY_STATS_REAP_STACK: Delay in ring reap to indicating network stack
553  * @CDP_DELAY_STATS_RX_INTERFRAME: Rx inteframe delay
554  * @CDP_DELAY_STATS_MODE_MAX: Maximum delay mode
555  */
556 enum cdp_delay_stats_mode {
557 	CDP_DELAY_STATS_SW_ENQ,
558 	CDP_DELAY_STATS_TX_INTERFRAME,
559 	CDP_DELAY_STATS_FW_HW_TRANSMIT,
560 	CDP_DELAY_STATS_REAP_STACK,
561 	CDP_DELAY_STATS_RX_INTERFRAME,
562 	CDP_DELAY_STATS_MODE_MAX,
563 };
564 
565 /*
566  * cdp_delay_bucket_index
567  *	Index to be used for all delay stats
568  */
569 enum cdp_delay_bucket_index {
570 	CDP_DELAY_BUCKET_0,
571 	CDP_DELAY_BUCKET_1,
572 	CDP_DELAY_BUCKET_2,
573 	CDP_DELAY_BUCKET_3,
574 	CDP_DELAY_BUCKET_4,
575 	CDP_DELAY_BUCKET_5,
576 	CDP_DELAY_BUCKET_6,
577 	CDP_DELAY_BUCKET_7,
578 	CDP_DELAY_BUCKET_8,
579 	CDP_DELAY_BUCKET_9,
580 	CDP_DELAY_BUCKET_10,
581 	CDP_DELAY_BUCKET_11,
582 	CDP_DELAY_BUCKET_12,
583 	CDP_DELAY_BUCKET_MAX,
584 };
585 
586 /*
587  * struct cdp_tx_host_drop - packet drop due to following reasons.
588  */
589 enum cdp_tx_sw_drop {
590 	TX_DESC_ERR,
591 	TX_HAL_RING_ACCESS_ERR,
592 	TX_DMA_MAP_ERR,
593 	TX_HW_ENQUEUE,
594 	TX_SW_ENQUEUE,
595 	TX_MAX_DROP,
596 };
597 
598 /*
599  * struct cdp_rx_host_drop - packet drop due to following reasons.
600  */
601 enum cdp_rx_sw_drop {
602 	INTRABSS_DROP,
603 	MSDU_DONE_FAILURE,
604 	INVALID_PEER_VDEV,
605 	POLICY_CHECK_DROP,
606 	MEC_DROP,
607 	NAWDS_MCAST_DROP,
608 	MESH_FILTER_DROP,
609 	ENQUEUE_DROP,
610 	RX_MAX_DROP,
611 };
612 
613 /*
614  * struct cdp_delay_stats
615  * @delay_bucket: division of buckets as per latency
616  * @min_delay: minimum delay
617  * @max_delay: maximum delay
618  * @avg_delay: average delay
619  */
620 struct cdp_delay_stats {
621 	uint64_t delay_bucket[CDP_DELAY_BUCKET_MAX];
622 	uint32_t min_delay;
623 	uint32_t max_delay;
624 	uint32_t avg_delay;
625 };
626 
627 /*
628  * struct cdp_tid_tx_stats
629  * @swq_delay: delay between wifi driver entry point and enqueue to HW in tx
630  * @hwtx_delay: delay between wifi driver exit (enqueue to HW) and tx completion
631  * @intfrm_delay: interframe delay
632  * @success_cnt: total successful transmit count
633  * @comp_fail_cnt: firmware drop found in tx completion path
634  * @swdrop_cnt: software drop in tx path
635  * @tqm_status_cnt: TQM completion status count
636  * @htt_status_cnt: HTT completion status count
637  */
638 struct cdp_tid_tx_stats {
639 	struct cdp_delay_stats swq_delay;
640 	struct cdp_delay_stats hwtx_delay;
641 	struct cdp_delay_stats intfrm_delay;
642 	uint64_t success_cnt;
643 	uint64_t comp_fail_cnt;
644 	uint64_t swdrop_cnt[TX_MAX_DROP];
645 	uint64_t tqm_status_cnt[CDP_MAX_TX_TQM_STATUS];
646 	uint64_t htt_status_cnt[CDP_MAX_TX_HTT_STATUS];
647 };
648 
649 /*
650  * cdp_reo_error_stats
651  * @err_src_reo_code_inv: Wireless Buffer Manager source receive reorder ring reason unknown
652  * @err_reo_codes: Receive reoder error codes
653  */
654 struct cdp_reo_error_stats {
655 	uint64_t err_src_reo_code_inv;
656 	uint64_t err_reo_codes[CDP_REO_CODE_MAX];
657 };
658 
659 /*
660  * cdp_rxdma_error_stats
661  * @err_src_rxdma_code_inv: DMA reason unknown count
662  * @err_reo_codes: Receive reoder error codes count
663  */
664 struct cdp_rxdma_error_stats {
665 	uint64_t err_src_rxdma_code_inv;
666 	uint64_t err_dma_codes[CDP_DMA_CODE_MAX];
667 };
668 
669 /*
670  * struct cdp_tid_tx_stats
671  * @to_stack_delay: Time taken between ring reap to indication to network stack
672  * @intfrm_delay: Interframe rx delay
673  * @delivered_cnt: Total packets indicated to stack
674  * @intrabss_cnt: Rx total intraBSS frames
675  * @msdu_cnt: number of msdu received from HW
676  * @mcast_msdu_cnt: Num Mcast Msdus received from HW in Rx
677  * @bcast_msdu_cnt: Num Bcast Msdus received from HW in Rx
678  * @fail_cnt: Rx deliver drop counters
679  * @reo_err: V3 reo error statistics
680  * @rxdma_err: V3 rxdma error statistics
681  */
682 struct cdp_tid_rx_stats {
683 	struct cdp_delay_stats to_stack_delay;
684 	struct cdp_delay_stats intfrm_delay;
685 	uint64_t delivered_to_stack;
686 	uint64_t intrabss_cnt;
687 	uint64_t msdu_cnt;
688 	uint64_t mcast_msdu_cnt;
689 	uint64_t bcast_msdu_cnt;
690 	uint64_t fail_cnt[RX_MAX_DROP];
691 	struct cdp_reo_error_stats reo_err;
692 	struct cdp_rxdma_error_stats rxdma_err;
693 };
694 
695 /*
696  * struct cdp_tid_stats
697  * @ingress_stack: Total packets received from linux stack
698  * @osif_drop: drops in osif layer
699  * @tid_tx_stats: transmit counters per tid
700  * @tid_rx_stats: receive counters per tid
701  */
702 struct cdp_tid_stats {
703 	uint64_t ingress_stack;
704 	uint64_t osif_drop;
705 	struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS]
706 					    [CDP_MAX_DATA_TIDS];
707 	struct cdp_tid_rx_stats tid_rx_stats[CDP_MAX_RX_RINGS]
708 					    [CDP_MAX_DATA_TIDS];
709 };
710 
711 /*
712  * struct cdp_delay_tx_stats: Tx delay stats
713  * @tx_swq_delay: software enqueue delay
714  * @hwtx_delay: HW enque to completion delay
715  */
716 struct cdp_delay_tx_stats {
717 	struct cdp_hist_stats    tx_swq_delay;
718 	struct cdp_hist_stats    hwtx_delay;
719 };
720 
721 /*
722  * struct cdp_delay_rx_stats: Rx delay stats
723  * @to_stack_delay: To stack delay
724  */
725 struct cdp_delay_rx_stats {
726 	struct cdp_hist_stats    to_stack_delay;
727 };
728 
729 /*
730  * struct cdp_delay_tid_stats: Delay tid stats
731  * @tx_delay: Tx delay related stats
732  * @rx_delay: Rx delay related stats
733  */
734 struct cdp_delay_tid_stats {
735 	struct cdp_delay_tx_stats  tx_delay;
736 	struct cdp_delay_rx_stats  rx_delay;
737 };
738 
739 /*
740  * cdp_peer_ext_stats: Peer extended stats
741  * @delay_stats: Per TID delay stats
742  */
743 struct cdp_peer_ext_stats {
744 	struct cdp_delay_tid_stats delay_stats[CDP_MAX_DATA_TIDS]
745 						[CDP_MAX_TXRX_CTX];
746 
747 	/*Customer can add MSDU level Tx/Rx stats */
748 };
749 
750 /* struct cdp_pkt_info - packet info
751  * @num: no of packets
752  * @bytes: total no of bytes
753  */
754 struct cdp_pkt_info {
755 	uint32_t num;
756 	uint64_t bytes;
757 };
758 
759 /* struct cdp_pkt_type - packet type
760  * @mcs_count: Counter array for each MCS index
761  */
762 struct cdp_pkt_type {
763 	uint32_t mcs_count[MAX_MCS];
764 };
765 
766 /*
767  * struct cdp_rx_mu - Rx MU Stats
768  * @ppdu_nss[SS_COUNT]: Packet Count in spatial streams
769  * @mpdu_cnt_fcs_ok: Rx success mpdu count
770  * @mpdu_cnt_fcs_err: Rx fail mpdu count
771  * @cdp_pkt_type: counter array for each MCS index
772  */
773 struct cdp_rx_mu {
774 	uint32_t ppdu_nss[SS_COUNT];
775 	uint32_t mpdu_cnt_fcs_ok;
776 	uint32_t mpdu_cnt_fcs_err;
777 	struct cdp_pkt_type ppdu;
778 };
779 
780 /* struct cdp_tx_pkt_info - tx packet info
781  * num_msdu - successful msdu
782  * num_mpdu - successful mpdu from compltn common
783  * mpdu_tried - mpdu tried
784  *
785  * tx packet info counter field for mpdu success/tried and msdu
786  */
787 struct cdp_tx_pkt_info {
788 	uint32_t num_msdu;
789 	uint32_t num_mpdu;
790 	uint32_t mpdu_tried;
791 };
792 
793 #ifdef FEATURE_TSO_STATS
794 /**
795  * struct cdp_tso_seg_histogram - Segment histogram for TCP Packets
796  * @segs_1: packets with single segments
797  * @segs_2_5: packets with 2-5 segments
798  * @segs_6_10: packets with 6-10 segments
799  * @segs_11_15: packets with 11-15 segments
800  * @segs_16_20: packets with 16-20 segments
801  * @segs_20_plus: packets with 20 plus segments
802  */
803 struct cdp_tso_seg_histogram {
804 	uint64_t segs_1;
805 	uint64_t segs_2_5;
806 	uint64_t segs_6_10;
807 	uint64_t segs_11_15;
808 	uint64_t segs_16_20;
809 	uint64_t segs_20_plus;
810 };
811 
812 /**
813  * struct cdp_tso_packet_info - Stats for TSO segments within a TSO packet
814  * @tso_seg: TSO Segment information
815  * @num_seg: Number of segments
816  * @tso_packet_len: Size of the tso packet
817  * @tso_seg_idx: segment number
818  */
819 struct cdp_tso_packet_info {
820 	struct qdf_tso_seg_t tso_seg[CDP_MAX_TSO_SEGMENTS];
821 	uint8_t num_seg;
822 	size_t tso_packet_len;
823 	uint32_t tso_seg_idx;
824 };
825 
826 /**
827  * struct cdp_tso_info - stats for tso packets
828  * @tso_packet_info: TSO packet information
829  */
830 struct cdp_tso_info {
831 	struct cdp_tso_packet_info tso_packet_info[CDP_MAX_TSO_PACKETS];
832 };
833 #endif /* FEATURE_TSO_STATS */
834 
835 /**
836  * struct cdp_tso_stats -  TSO stats information
837  * @num_tso_pkts: Total number of TSO Packets
838  * @tso_comp: Total tso packet completions
839  * @dropped_host: TSO packets dropped by host
840  * @tso_no_mem_dropped: TSO packets dropped by host due to descriptor
841 			unavailablity
842  * @dropped_target: TSO packets_dropped by target
843  * @tso_info: Per TSO packet counters
844  * @seg_histogram: TSO histogram stats
845  */
846 struct cdp_tso_stats {
847 	struct cdp_pkt_info num_tso_pkts;
848 	uint32_t tso_comp;
849 	struct cdp_pkt_info dropped_host;
850 	struct cdp_pkt_info tso_no_mem_dropped;
851 	uint32_t dropped_target;
852 #ifdef FEATURE_TSO_STATS
853 	struct cdp_tso_info tso_info;
854 	struct cdp_tso_seg_histogram seg_histogram;
855 #endif /* FEATURE_TSO_STATS */
856 };
857 
858 #define CDP_PEER_STATS_START 0
859 
860 enum cdp_peer_stats_type {
861 	cdp_peer_stats_min = CDP_PEER_STATS_START,
862 
863 	/* Tx types */
864 	cdp_peer_tx_ucast = cdp_peer_stats_min,
865 	cdp_peer_tx_mcast,
866 	cdp_peer_tx_rate,
867 	cdp_peer_tx_last_tx_rate,
868 	cdp_peer_tx_inactive_time,
869 	cdp_peer_tx_ratecode,
870 	cdp_peer_tx_flags,
871 	cdp_peer_tx_power,
872 
873 	/* Rx types */
874 	cdp_peer_rx_rate,
875 	cdp_peer_rx_last_rx_rate,
876 	cdp_peer_rx_ratecode,
877 	cdp_peer_rx_ucast,
878 	cdp_peer_rx_flags,
879 	cdp_peer_rx_avg_snr,
880 	cdp_peer_stats_max,
881 };
882 
883 /*
884  * The max size of cdp_peer_stats_param_t is limited to 16 bytes.
885  * If the buffer size is exceeding this size limit,
886  * dp_txrx_get_peer_stats is to be used instead.
887  */
888 typedef union cdp_peer_stats_buf {
889 	/* Tx types */
890 	struct cdp_pkt_info tx_ucast;
891 	struct cdp_pkt_info tx_mcast;
892 	uint32_t tx_rate;
893 	uint32_t last_tx_rate;
894 	uint32_t tx_inactive_time;
895 	uint32_t tx_flags;
896 	uint32_t tx_power;
897 	uint16_t tx_ratecode;
898 
899 	/* Rx types */
900 	struct cdp_pkt_info rx_ucast;
901 	uint32_t rx_rate;
902 	uint32_t last_rx_rate;
903 	uint32_t rx_ratecode;
904 	uint32_t rx_flags;
905 	uint32_t rx_avg_snr;
906 } cdp_peer_stats_param_t; /* Max union size 16 bytes */
907 
908 /**
909  * enum cdp_protocol_trace -  Protocols supported by per-peer protocol trace
910  * @CDP_TRACE_ICMP: ICMP packets
911  * @CDP_TRACE_EAP: EAPOL packets
912  * @CDP_TRACE_ARP: ARP packets
913  *
914  * Enumeration of all protocols supported by per-peer protocol trace feature
915  */
916 enum cdp_protocol_trace {
917 	CDP_TRACE_ICMP,
918 	CDP_TRACE_EAP,
919 	CDP_TRACE_ARP,
920 	CDP_TRACE_MAX
921 };
922 
923 /**
924  * struct protocol_trace_count - type of count on per-peer protocol trace
925  * @egress_cnt: how many packets go out of host driver
926  * @ingress_cnt: how many packets come into the host driver
927  *
928  * Type of count on per-peer protocol trace
929  */
930 struct protocol_trace_count {
931 	uint16_t egress_cnt;
932 	uint16_t ingress_cnt;
933 };
934 /* struct cdp_tx_stats - tx stats
935  * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received
936  * @cdp_pkt_info ucast: Unicast Packet Count
937  * @cdp_pkt_info mcast: Multicast Packet Count
938  * @cdp_pkt_info bcast: Broadcast Packet Count
939  * @cdp_pkt_info nawds_mcast: NAWDS  Multicast Packet Count
940  * @cdp_pkt_info tx_success: Successful Tx Packets
941  * @nawds_mcast_drop: NAWDS  Multicast Drop Count
942  * @protocol_trace_cnt: per-peer protocol counter
943  * @tx_failed: Total Tx failure
944  * @ofdma: Total Packets as ofdma
945  * @stbc: Packets in STBC
946  * @ldpc: Packets in LDPC
947  * @retries: Packet retries
948  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
949  * @amsdu_cnt: Number of MSDUs part of AMSDU
950  * @tx_rate: Tx Rate
951  * @last_tx_rate: Last tx rate for unicast packets
952  * @last_tx_rate_mcs: Tx rate mcs for unicast packets
953  * @mcast_last_tx_rate: Last tx rate for multicast packets
954  * @mcast_last_tx_rate_mcs: Last tx rate mcs for multicast
955  * @last_per: Tx Per
956  * @rnd_avg_tx_rate: Rounded average tx rate
957  * @avg_tx_rate: Average TX rate
958  * @last_ack_rssi: RSSI of last acked packet
959  * @tx_bytes_success_last: last Tx success bytes
960  * @tx_data_success_last: last Tx success data
961  * @tx_byte_rate: Bytes Trasmitted in last one sec
962  * @tx_data_rate: Data Transmitted in last one sec
963  * @sgi_count[MAX_GI]: SGI count
964  * @pream_punct_cnt: Preamble Punctured count
965  * @nss[SS_COUNT]: Packet count for different num_spatial_stream values
966  * @bw[MAX_BW]: Packet Count for different bandwidths
967  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
968  * @excess_retries_per_ac[WME_AC_MAX]: Wireless Multimedia type Count
969  * @dot11_tx_pkts: dot11 tx packets
970  * @fw_rem: Discarded by firmware
971  * @fw_rem_notx: firmware_discard_untransmitted
972  * @fw_rem_tx: firmware_discard_transmitted
973  * @age_out: aged out in mpdu/msdu queues
974  * @fw_reason1: discarded by firmware reason 1
975  * @fw_reason2: discarded by firmware reason 2
976  * @fw_reason3: discarded by firmware reason 3
977  * @mcs_count: MCS Count
978  * @an_tx_cnt: ald tx count
979  * @an_tx_rates_used: ald rx rate used
980  * @an_tx_bytes: ald tx bytes
981  * @ald_txcount: ald tx count
982  * @ald_lastper: ald last PER
983  * @ald_max4msframelen: ald max frame len
984  * @an_tx_ratecount: ald tx ratecount
985  * @ald_retries: ald retries
986  * @ald_ac_nobufs: #buffer overflows per node per AC
987  * @ald_ac_excretries: #pkts dropped after excessive retries per node per AC
988  * @rssi_chain: rssi chain
989  * @inactive_time: inactive time in secs
990  * @tx_flags: tx flags
991  * @tx_power: Tx power latest
992  * @is_tx_no_ack: no ack received
993  * @tx_ratecode: Tx rate code of last frame
994  * @is_tx_nodefkey: tx failed 'cuz no defkey
995  * @is_tx_noheadroom: tx failed 'cuz no space
996  * @is_crypto_enmicfail:
997  * @is_tx_nonode: tx failed for no node
998  * @is_tx_unknownmgt: tx of unknown mgt frame
999  * @is_tx_badcipher: tx failed 'cuz key type
1000  * @ampdu_cnt: completion of aggregation
1001  * @non_ampdu_cnt: tx completion not aggregated
1002  * @failed_retry_count: packets failed due to retry above 802.11 retry limit
1003  * @retry_count: packets successfully send after one or more retry
1004  * @multiple_retry_count: packets successfully sent after more than one retry
1005  * @transmit_type: pkt info for tx transmit type
1006  * @mu_group_id: mumimo mu group id
1007  * @ru_start: RU start index
1008  * @ru_tones: RU tones size
1009  * @ru_loc: pkt info for RU location 26/ 52/ 106/ 242/ 484 counter
1010  * @num_ppdu_cookie_valid : Number of comp received with valid ppdu cookie
1011  * @tx_success_twt: Successful Tx Packets in TWT session
1012  * @nss_info: NSS 1,2, ...8
1013  * @mcs_info: MCS index
1014  * @bw_info: Bandwidth
1015  *       <enum 0 bw_20_MHz>
1016  *       <enum 1 bw_40_MHz>
1017  *       <enum 2 bw_80_MHz>
1018  *       <enum 3 bw_160_MHz>
1019  * @gi_info: <enum 0     0_8_us_sgi > Legacy normal GI
1020  *       <enum 1     0_4_us_sgi > Legacy short GI
1021  *       <enum 2     1_6_us_sgi > HE related GI
1022  *       <enum 3     3_2_us_sgi > HE
1023  * @preamble_info: preamble
1024  */
1025 struct cdp_tx_stats {
1026 	struct cdp_pkt_info comp_pkt;
1027 	struct cdp_pkt_info ucast;
1028 	struct cdp_pkt_info mcast;
1029 	struct cdp_pkt_info bcast;
1030 	struct cdp_pkt_info nawds_mcast;
1031 #ifdef VDEV_PEER_PROTOCOL_COUNT
1032 	struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
1033 #endif
1034 	struct cdp_pkt_info tx_success;
1035 	uint32_t nawds_mcast_drop;
1036 	uint32_t tx_failed;
1037 	uint32_t ofdma;
1038 	uint32_t stbc;
1039 	uint32_t ldpc;
1040 	uint32_t retries;
1041 	uint32_t non_amsdu_cnt;
1042 	uint32_t amsdu_cnt;
1043 	uint32_t tx_rate;
1044 	uint32_t last_tx_rate;
1045 	uint32_t last_tx_rate_mcs;
1046 	uint32_t mcast_last_tx_rate;
1047 	uint32_t mcast_last_tx_rate_mcs;
1048 	uint32_t last_per;
1049 	uint64_t rnd_avg_tx_rate;
1050 	uint64_t avg_tx_rate;
1051 	uint32_t last_ack_rssi;
1052 	uint32_t tx_bytes_success_last;
1053 	uint32_t tx_data_success_last;
1054 	uint32_t tx_byte_rate;
1055 	uint32_t tx_data_rate;
1056 	uint32_t tx_data_ucast_last;
1057 	uint32_t tx_data_ucast_rate;
1058 	struct cdp_pkt_type pkt_type[DOT11_MAX];
1059 	uint32_t sgi_count[MAX_GI];
1060 	uint32_t pream_punct_cnt;
1061 
1062 	uint32_t nss[SS_COUNT];
1063 
1064 	uint32_t bw[MAX_BW];
1065 
1066 	uint32_t wme_ac_type[WME_AC_MAX];
1067 
1068 	uint32_t excess_retries_per_ac[WME_AC_MAX];
1069 	struct cdp_pkt_info dot11_tx_pkts;
1070 
1071 	struct {
1072 		struct cdp_pkt_info fw_rem;
1073 		uint32_t fw_rem_notx;
1074 		uint32_t fw_rem_tx;
1075 		uint32_t age_out;
1076 		uint32_t fw_reason1;
1077 		uint32_t fw_reason2;
1078 		uint32_t fw_reason3;
1079 	} dropped;
1080 
1081 
1082 	uint32_t fw_tx_cnt;
1083 	uint32_t fw_tx_bytes;
1084 	uint32_t fw_txcount;
1085 	uint32_t fw_max4msframelen;
1086 	uint32_t fw_ratecount;
1087 
1088 	uint32_t ac_nobufs[WME_AC_MAX];
1089 	uint32_t rssi_chain[WME_AC_MAX];
1090 	uint32_t inactive_time;
1091 
1092 	uint32_t tx_flags;
1093 	uint32_t tx_power;
1094 
1095 	/* MSDUs which the target sent but couldn't get an ack for */
1096 	struct cdp_pkt_info is_tx_no_ack;
1097 	uint16_t tx_ratecode;
1098 
1099 	/*add for peer and upadted from ppdu*/
1100 	uint32_t ampdu_cnt;
1101 	uint32_t non_ampdu_cnt;
1102 	uint32_t failed_retry_count;
1103 	uint32_t retry_count;
1104 	uint32_t multiple_retry_count;
1105 	uint32_t last_tx_rate_used;
1106 
1107 	struct cdp_tx_pkt_info transmit_type[MAX_TRANSMIT_TYPES];
1108 	uint32_t mu_group_id[MAX_MU_GROUP_ID];
1109 	uint32_t ru_start;
1110 	uint32_t ru_tones;
1111 	struct cdp_tx_pkt_info ru_loc[MAX_RU_LOCATIONS];
1112 
1113 	uint32_t num_ppdu_cookie_valid;
1114 	uint32_t no_ack_count[QDF_PROTO_SUBTYPE_MAX];
1115 	struct cdp_pkt_info tx_success_twt;
1116 
1117 	uint32_t nss_info:4,
1118 		 mcs_info:4,
1119 		 bw_info:4,
1120 		 gi_info:4,
1121 		 preamble_info:4;
1122 };
1123 
1124 /* struct cdp_rx_stats - rx Level Stats
1125  * @to_stack: Total packets sent up the stack
1126  * @rcvd_reo[CDP_MAX_RX_RINGS]:  Packets received on the reo ring
1127  * @unicast: Total unicast packets
1128  * @multicast: Total multicast packets
1129  * @bcast:  Broadcast Packet Count
1130  * @raw: Raw Pakets received
1131  * @nawds_mcast_drop: Total multicast packets
1132  * @mec_drop: Total MEC packets dropped
1133  * @pkts: Intra BSS packets received
1134  * @fail: Intra BSS packets failed
1135  * @mdns_no_fwd: Intra BSS MDNS packets not forwarded
1136  * @protocol_trace_cnt: per-peer protocol counters
1137  * @mic_err: Rx MIC errors CCMP
1138  * @decrypt_err: Rx Decryption Errors CRC
1139  * @fcserr: rx MIC check failed (CCMP)
1140  * @pn_err: pn check failed
1141  * @oor_err: Rx OOR errors
1142  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
1143  * @reception_type[MAX_RECEPTION_TYPES]: Reception type os packets
1144  * @mcs_count[MAX_MCS]: mcs count
1145  * @sgi_count[MAX_GI]: sgi count
1146  * @nss[SS_COUNT]: packet count in spatiel Streams
1147  * @ppdu_nss[SS_COUNT]: PPDU packet count in spatial streams
1148  * @mpdu_cnt_fcs_ok: SU Rx success mpdu count
1149  * @mpdu_cnt_fcs_err: SU Rx fail mpdu count
1150  * @su_ax_ppdu_cnt: SU Rx packet count
1151  * @ppdu_cnt[MAX_RECEPTION_TYPES]: PPDU packet count in reception type
1152  * @rx_mu[RX_TYPE_MU_MAX]: Rx MU stats
1153  * @bw[MAX_BW]:  Packet Count in different bandwidths
1154  * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation
1155  * @ampdu_cnt: Number of MSDUs part of AMSPU
1156  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
1157  * @amsdu_cnt: Number of MSDUs part of AMSDU
1158  * @bar_recv_cnt: Number of bar received
1159  * @avg_snr: Average snr
1160  * @rx_rate: Rx rate
1161  * @last_rx_rate: Previous rx rate
1162  * @rnd_avg_rx_rate: Rounded average rx rate
1163  * @avg_rx_rate:  Average Rx rate
1164  * @dot11_rx_pkts: dot11 rx packets
1165  * @rx_bytes_last: last Rx success bytes
1166  * @rx_data_last: last rx success data
1167  * @rx_byte_rate: bytes received in last one sec
1168  * @rx_data_rate: data received in last one sec
1169  * @rx_retries: retries of packet in rx
1170  * @rx_mpdus: mpdu in rx
1171  * @rx_ppdus: ppdu in rx
1172  * @is_rx_tooshort: tooshort
1173  * @is_rx_decap: rx decap
1174  * @rx_ccmpmic: rx MIC check failed (CCMP)
1175  * @rx_tkipmic: rx MIC check failed (TKIP)
1176  * @rx_tkipicv: rx ICV check failed (TKIP)
1177  * @rx_wpimic: rx MIC check failed (WPI)
1178  * @rx_wepfail: rx wep processing failed
1179  * @rx_aggr: aggregation on rx
1180  * @rx_discard: packets discard in rx
1181  * @rx_ratecode: Rx rate code of last frame
1182  * @rx_flags: rx flags
1183  * @rx_snr_measured_time: Time at which snr is measured
1184  * @snr: SNR of received signal
1185  * @last_snr: Previous snr
1186  * @multipass_rx_pkt_drop: Dropped multipass rx pkt
1187  * @rx_mpdu_cnt: rx mpdu count per MCS rate
1188  * @nss_info: NSS 1,2, ...8
1189  * @mcs_info: MCS index
1190  * @bw_info: Bandwidth
1191  *       <enum 0 bw_20_MHz>
1192  *       <enum 1 bw_40_MHz>
1193  *       <enum 2 bw_80_MHz>
1194  *       <enum 3 bw_160_MHz>
1195  * @gi_info: <enum 0     0_8_us_sgi > Legacy normal GI
1196  *       <enum 1     0_4_us_sgi > Legacy short GI
1197  *       <enum 2     1_6_us_sgi > HE related GI
1198  *       <enum 3     3_2_us_sgi > HE
1199  * @preamble_info: preamble
1200  * @to_stack_twt: Total packets sent up the stack in TWT session
1201  */
1202 struct cdp_rx_stats {
1203 	struct cdp_pkt_info to_stack;
1204 	struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
1205 	struct cdp_pkt_info unicast;
1206 	struct cdp_pkt_info multicast;
1207 	struct cdp_pkt_info bcast;
1208 	struct cdp_pkt_info raw;
1209 	uint32_t nawds_mcast_drop;
1210 	struct cdp_pkt_info mec_drop;
1211 	struct {
1212 		struct cdp_pkt_info pkts;
1213 		struct cdp_pkt_info fail;
1214 		uint32_t mdns_no_fwd;
1215 	} intra_bss;
1216 #ifdef VDEV_PEER_PROTOCOL_COUNT
1217 	struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX];
1218 #endif
1219 
1220 	struct {
1221 		uint32_t mic_err;
1222 		uint32_t decrypt_err;
1223 		uint32_t fcserr;
1224 		uint32_t pn_err;
1225 		uint32_t oor_err;
1226 	} err;
1227 
1228 	uint32_t wme_ac_type[WME_AC_MAX];
1229 	uint32_t reception_type[MAX_RECEPTION_TYPES];
1230 	struct cdp_pkt_type pkt_type[DOT11_MAX];
1231 	uint32_t sgi_count[MAX_GI];
1232 	uint32_t nss[SS_COUNT];
1233 	uint32_t ppdu_nss[SS_COUNT];
1234 	uint32_t mpdu_cnt_fcs_ok;
1235 	uint32_t mpdu_cnt_fcs_err;
1236 	struct cdp_pkt_type su_ax_ppdu_cnt;
1237 	uint32_t ppdu_cnt[MAX_RECEPTION_TYPES];
1238 	struct cdp_rx_mu rx_mu[RX_TYPE_MU_MAX];
1239 	uint32_t bw[MAX_BW];
1240 	uint32_t non_ampdu_cnt;
1241 	uint32_t ampdu_cnt;
1242 	uint32_t non_amsdu_cnt;
1243 	uint32_t amsdu_cnt;
1244 	uint32_t bar_recv_cnt;
1245 	uint32_t avg_snr;
1246 	uint32_t rx_rate;
1247 	uint32_t last_rx_rate;
1248 	uint32_t rnd_avg_rx_rate;
1249 	uint32_t avg_rx_rate;
1250 	struct cdp_pkt_info  dot11_rx_pkts;
1251 
1252 	uint32_t rx_bytes_success_last;
1253 	uint32_t rx_data_success_last;
1254 	uint32_t rx_byte_rate;
1255 	uint32_t rx_data_rate;
1256 
1257 	uint32_t rx_retries;
1258 	uint32_t rx_mpdus;
1259 	uint32_t rx_ppdus;
1260 
1261 	/*add for peer updated for ppdu*/
1262 	uint32_t rx_aggr;
1263 	uint32_t rx_discard;
1264 	uint32_t rx_ratecode;
1265 	uint32_t rx_flags;
1266 	uint32_t rx_snr_measured_time;
1267 	uint8_t snr;
1268 	uint8_t last_snr;
1269 	uint32_t multipass_rx_pkt_drop;
1270 	uint32_t rx_mpdu_cnt[MAX_MCS];
1271 	uint32_t nss_info:4,
1272 		 mcs_info:4,
1273 		 bw_info:4,
1274 		 gi_info:4,
1275 	         preamble_info:4;
1276 	struct cdp_pkt_info to_stack_twt;
1277 };
1278 
1279 /* struct cdp_tx_ingress_stats - Tx ingress Stats
1280  * @rcvd: Total packets received for transmission
1281  * @processed: Tx packets processed
1282  * @inspect_pkts: Total packets passed to inspect handler
1283  * @nawds_mcast: NAWDS  Multicast Packet Count
1284  * @bcast: Number of broadcast packets
1285  * @raw_pkt: Total Raw packets
1286  * @dma_map_error: DMA map error
1287  * @num_frags_overflow_err: msdu's nbuf count exceeds num of segemnts
1288  * @num_seg: No of segments in TSO packets
1289  * @tso_pkt:total no of TSO packets
1290  * @non_tso_pkts: non - TSO packets
1291  * @dropped_host: TSO packets dropped by host
1292  * @dropped_target:TSO packets dropped by target
1293  * @sg_pkt: Total scatter gather packets
1294  * @non_sg_pkts: non SG packets
1295  * @dropped_host: SG packets dropped by host
1296  * @dropped_target: SG packets dropped by target
1297  * @dma_map_error: Dma map error
1298  * @mcast_pkt: total no of multicast conversion packets
1299  * @dropped_map_error: packets dropped due to map error
1300  * @dropped_self_mac: packets dropped due to self Mac address
1301  * @dropped_send_fail: Packets dropped due to send fail
1302  * @ucast: total unicast packets transmitted
1303  * @fail_seg_alloc: Segment allocation failure
1304  * @clone_fail: NBUF clone failure
1305  * @igmp_rcvd: igmp pkts received for conversion to ucast pkts
1306  * @igmp_ucast_converted: unicast pkts sent as part of VoW IGMP improvements
1307  * @dropped_pkt: Total scatter gather packets
1308  * @desc_na: Desc Not Available
1309  * @exc_desc_na: Exception desc Not Available
1310  * @ring_full: ring full
1311  * @enqueue_fail: hw enqueue fail
1312  * @dma_error: dma fail
1313  * @res_full: Resource Full: Congestion Control
1314  * @fail_per_pkt_vdev_id_check: Per pkt vdev id check
1315  * @exception_fw: packets sent to fw
1316  * @completion_fw: packets completions received from fw
1317  * @cce_classified:Number of packets classified by CCE
1318  * @cce_classified_raw:Number of raw packets classified by CCE
1319  * @sniffer_rcvd: Number of packets received with ppdu cookie
1320  */
1321 struct cdp_tx_ingress_stats {
1322 	struct cdp_pkt_info rcvd;
1323 	struct cdp_pkt_info processed;
1324 	struct cdp_pkt_info reinject_pkts;
1325 	struct cdp_pkt_info inspect_pkts;
1326 	struct cdp_pkt_info nawds_mcast;
1327 	struct cdp_pkt_info bcast;
1328 
1329 	struct {
1330 		struct cdp_pkt_info raw_pkt;
1331 		uint32_t dma_map_error;
1332 		uint32_t invalid_raw_pkt_datatype;
1333 		uint32_t num_frags_overflow_err;
1334 	} raw;
1335 
1336 	/* Scatter Gather packet info */
1337 	struct {
1338 		struct cdp_pkt_info sg_pkt;
1339 		struct cdp_pkt_info non_sg_pkts;
1340 		struct cdp_pkt_info  dropped_host;
1341 		uint32_t dropped_target;
1342 		uint32_t dma_map_error;
1343 	} sg;
1344 
1345 	/* Multicast Enhancement packets info */
1346 	struct {
1347 		struct cdp_pkt_info mcast_pkt;
1348 		uint32_t dropped_map_error;
1349 		uint32_t dropped_self_mac;
1350 		uint32_t dropped_send_fail;
1351 		uint32_t ucast;
1352 		uint32_t fail_seg_alloc;
1353 		uint32_t clone_fail;
1354 	} mcast_en;
1355 
1356 	/* IGMP Multicast Enhancement packets info */
1357 	struct {
1358 		uint32_t igmp_rcvd;
1359 		uint32_t igmp_ucast_converted;
1360 	} igmp_mcast_en;
1361 
1362 	/* Packets dropped on the Tx side */
1363 	struct {
1364 		struct cdp_pkt_info dropped_pkt;
1365 		struct cdp_pkt_info  desc_na;
1366 		struct cdp_pkt_info  desc_na_exc_alloc_fail;
1367 		struct cdp_pkt_info  desc_na_exc_outstand;
1368 		struct cdp_pkt_info  exc_desc_na;
1369 		uint32_t ring_full;
1370 		uint32_t enqueue_fail;
1371 		uint32_t dma_error;
1372 		uint32_t res_full;
1373 		/* headroom insufficient */
1374 		uint32_t headroom_insufficient;
1375 		uint32_t fail_per_pkt_vdev_id_check;
1376 	} dropped;
1377 
1378 	/* Mesh packets info */
1379 	struct {
1380 		uint32_t exception_fw;
1381 		uint32_t completion_fw;
1382 	} mesh;
1383 
1384 	uint32_t cce_classified;
1385 	uint32_t cce_classified_raw;
1386 	struct cdp_pkt_info sniffer_rcvd;
1387 	struct cdp_tso_stats tso_stats;
1388 };
1389 
1390 /* struct cdp_vdev_stats - vdev stats structure
1391  * @tx_i: ingress tx stats
1392  * @tx: cdp tx stats
1393  * @rx: cdp rx stats
1394  * @tso_stats: tso stats
1395  */
1396 struct cdp_vdev_stats {
1397 	struct cdp_tx_ingress_stats tx_i;
1398 	struct cdp_tx_stats tx;
1399 	struct cdp_rx_stats rx;
1400 	struct cdp_tso_stats tso_stats;
1401 };
1402 
1403 /* struct cdp_peer_stats - peer stats structure
1404  * @tx: cdp tx stats
1405  * @rx: cdp rx stats
1406  */
1407 struct cdp_peer_stats {
1408 	/* CDP Tx Stats */
1409 	struct cdp_tx_stats tx;
1410 	/* CDP Rx Stats */
1411 	struct cdp_rx_stats rx;
1412 };
1413 
1414 /* struct cdp_peer_tid_stats - Per peer and per TID stats
1415  * @tx_avg_jitter: tx average jitter
1416  * @tx_avg_delay: tx average delay
1417  * @tx_avg_err: tx average error
1418  * @tx_total_success: tx total success
1419  * @tx_drop: tx drop
1420  */
1421 struct cdp_peer_tid_stats {
1422 #ifdef WLAN_PEER_JITTER
1423 	uint32_t tx_avg_jitter;
1424 	uint32_t tx_avg_delay;
1425 	uint64_t tx_avg_err;
1426 	uint64_t tx_total_success;
1427 	uint64_t tx_drop;
1428 #endif
1429 };
1430 
1431 /* struct cdp_interface_peer_stats - interface structure for txrx peer stats
1432  * @peer_mac: peer mac address
1433  * @vdev_id : vdev_id for the peer
1434  * @rssi_changed: denotes rssi is changed
1435  * @last_peer_tx_rate: peer tx rate for last transmission
1436  * @peer_tx_rate: tx rate for current transmission
1437  * @peer_rssi: current rssi value of peer
1438  * @tx_packet_count: tx packet count
1439  * @rx_packet_count: rx packet count
1440  * @tx_byte_count: tx byte count
1441  * @rx_byte_count: rx byte count
1442  * @per: per error rate
1443  * @ack_rssi: RSSI of the last ack received
1444  * @free_buff: free tx descriptor count
1445  */
1446 struct cdp_interface_peer_stats {
1447 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
1448 	uint8_t  vdev_id;
1449 	uint8_t  rssi_changed;
1450 	uint32_t last_peer_tx_rate;
1451 	uint32_t peer_tx_rate;
1452 	uint32_t peer_rssi;
1453 	uint32_t tx_packet_count;
1454 	uint32_t rx_packet_count;
1455 	uint32_t tx_byte_count;
1456 	uint32_t rx_byte_count;
1457 	uint32_t per;
1458 	uint32_t ack_rssi;
1459 	uint32_t free_buff;
1460 };
1461 
1462 /* struct cdp_interface_peer_qos_stats - interface structure for peer qos stats
1463  * @peer_mac: peer mac address
1464  * @frame_control: frame control field
1465  * @qos_control: qos control field
1466  * @frame_control_info_valid: frame_control valid
1467  * @qos_control_info_valid: qos_control valid
1468  * @vdev_id : vdev_id for the peer
1469  */
1470 struct cdp_interface_peer_qos_stats {
1471 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
1472 	uint16_t frame_control;
1473 	uint16_t qos_control;
1474 	uint8_t  frame_control_info_valid;
1475 	uint8_t  qos_control_info_valid;
1476 	uint8_t  vdev_id;
1477 };
1478 
1479 /* Tx completions per interrupt */
1480 struct cdp_hist_tx_comp {
1481 	uint32_t pkts_1;
1482 	uint32_t pkts_2_20;
1483 	uint32_t pkts_21_40;
1484 	uint32_t pkts_41_60;
1485 	uint32_t pkts_61_80;
1486 	uint32_t pkts_81_100;
1487 	uint32_t pkts_101_200;
1488 	uint32_t pkts_201_plus;
1489 };
1490 
1491 /* Rx ring descriptors reaped per interrupt */
1492 struct cdp_hist_rx_ind {
1493 	uint32_t pkts_1;
1494 	uint32_t pkts_2_20;
1495 	uint32_t pkts_21_40;
1496 	uint32_t pkts_41_60;
1497 	uint32_t pkts_61_80;
1498 	uint32_t pkts_81_100;
1499 	uint32_t pkts_101_200;
1500 	uint32_t pkts_201_plus;
1501 };
1502 
1503 struct cdp_htt_tlv_hdr {
1504 	/* BIT [11 :  0]   :- tag
1505 	 * BIT [23 : 12]   :- length
1506 	 * BIT [31 : 24]   :- reserved
1507 	 */
1508 	uint32_t tag__length;
1509 };
1510 
1511 #define HTT_STATS_SUBTYPE_MAX     16
1512 
1513 struct cdp_htt_rx_pdev_fw_stats_tlv {
1514     struct cdp_htt_tlv_hdr tlv_hdr;
1515 
1516     /* BIT [ 7 :  0]   :- mac_id
1517      * BIT [31 :  8]   :- reserved
1518      */
1519     uint32_t mac_id__word;
1520     /* Num PPDU status processed from HW */
1521     uint32_t ppdu_recvd;
1522     /* Num MPDU across PPDUs with FCS ok */
1523     uint32_t mpdu_cnt_fcs_ok;
1524     /* Num MPDU across PPDUs with FCS err */
1525     uint32_t mpdu_cnt_fcs_err;
1526     /* Num MSDU across PPDUs */
1527     uint32_t tcp_msdu_cnt;
1528     /* Num MSDU across PPDUs */
1529     uint32_t tcp_ack_msdu_cnt;
1530     /* Num MSDU across PPDUs */
1531     uint32_t udp_msdu_cnt;
1532     /* Num MSDU across PPDUs */
1533     uint32_t other_msdu_cnt;
1534     /* Num MPDU on FW ring indicated */
1535     uint32_t fw_ring_mpdu_ind;
1536     /* Num MGMT MPDU given to protocol */
1537     uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX];
1538     /* Num ctrl MPDU given to protocol */
1539     uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX];
1540     /* Num mcast data packet received */
1541     uint32_t fw_ring_mcast_data_msdu;
1542     /* Num broadcast data packet received */
1543     uint32_t fw_ring_bcast_data_msdu;
1544     /* Num unicat data packet received */
1545     uint32_t fw_ring_ucast_data_msdu;
1546     /* Num null data packet received  */
1547     uint32_t fw_ring_null_data_msdu;
1548     /* Num MPDU on FW ring dropped */
1549     uint32_t fw_ring_mpdu_drop;
1550 
1551     /* Num buf indication to offload */
1552     uint32_t ofld_local_data_ind_cnt;
1553     /* Num buf recycle from offload */
1554     uint32_t ofld_local_data_buf_recycle_cnt;
1555     /* Num buf indication to data_rx */
1556     uint32_t drx_local_data_ind_cnt;
1557     /* Num buf recycle from data_rx */
1558     uint32_t drx_local_data_buf_recycle_cnt;
1559     /* Num buf indication to protocol */
1560     uint32_t local_nondata_ind_cnt;
1561     /* Num buf recycle from protocol */
1562     uint32_t local_nondata_buf_recycle_cnt;
1563 
1564     /* Num buf fed */
1565     uint32_t fw_status_buf_ring_refill_cnt;
1566     /* Num ring empty encountered */
1567     uint32_t fw_status_buf_ring_empty_cnt;
1568     /* Num buf fed  */
1569     uint32_t fw_pkt_buf_ring_refill_cnt;
1570     /* Num ring empty encountered */
1571     uint32_t fw_pkt_buf_ring_empty_cnt;
1572     /* Num buf fed  */
1573     uint32_t fw_link_buf_ring_refill_cnt;
1574     /* Num ring empty encountered  */
1575     uint32_t fw_link_buf_ring_empty_cnt;
1576 
1577     /* Num buf fed */
1578     uint32_t host_pkt_buf_ring_refill_cnt;
1579     /* Num ring empty encountered */
1580     uint32_t host_pkt_buf_ring_empty_cnt;
1581     /* Num buf fed */
1582     uint32_t mon_pkt_buf_ring_refill_cnt;
1583     /* Num ring empty encountered */
1584     uint32_t mon_pkt_buf_ring_empty_cnt;
1585     /* Num buf fed */
1586     uint32_t mon_status_buf_ring_refill_cnt;
1587     /* Num ring empty encountered */
1588     uint32_t mon_status_buf_ring_empty_cnt;
1589     /* Num buf fed */
1590     uint32_t mon_desc_buf_ring_refill_cnt;
1591     /* Num ring empty encountered */
1592     uint32_t mon_desc_buf_ring_empty_cnt;
1593     /* Num buf fed */
1594     uint32_t mon_dest_ring_update_cnt;
1595     /* Num ring full encountered */
1596     uint32_t mon_dest_ring_full_cnt;
1597 
1598     /* Num rx suspend is attempted */
1599     uint32_t rx_suspend_cnt;
1600     /* Num rx suspend failed */
1601     uint32_t rx_suspend_fail_cnt;
1602     /* Num rx resume attempted */
1603     uint32_t rx_resume_cnt;
1604     /* Num rx resume failed */
1605     uint32_t rx_resume_fail_cnt;
1606     /* Num rx ring switch */
1607     uint32_t rx_ring_switch_cnt;
1608     /* Num rx ring restore */
1609     uint32_t rx_ring_restore_cnt;
1610     /* Num rx flush issued */
1611     uint32_t rx_flush_cnt;
1612 };
1613 
1614 /* == TX PDEV STATS == */
1615 struct cdp_htt_tx_pdev_stats_cmn_tlv {
1616     struct cdp_htt_tlv_hdr tlv_hdr;
1617 
1618     /* BIT [ 7 :  0]   :- mac_id
1619      * BIT [31 :  8]   :- reserved
1620      */
1621     uint32_t mac_id__word;
1622     /* Num queued to HW */
1623     uint32_t hw_queued;
1624     /* Num PPDU reaped from HW */
1625     uint32_t hw_reaped;
1626     /* Num underruns */
1627     uint32_t underrun;
1628     /* Num HW Paused counter. */
1629     uint32_t hw_paused;
1630     /* Num HW flush counter. */
1631     uint32_t hw_flush;
1632     /* Num HW filtered counter. */
1633     uint32_t hw_filt;
1634     /* Num PPDUs cleaned up in TX abort */
1635     uint32_t tx_abort;
1636     /* Num MPDUs requed by SW */
1637     uint32_t mpdu_requed;
1638     /* excessive retries */
1639     uint32_t tx_xretry;
1640     /* Last used data hw rate code */
1641     uint32_t data_rc;
1642     /* frames dropped due to excessive sw retries */
1643     uint32_t mpdu_dropped_xretry;
1644     /* illegal rate phy errors  */
1645     uint32_t illgl_rate_phy_err;
1646     /* wal pdev continuous xretry */
1647     uint32_t cont_xretry;
1648     /* wal pdev continuous xretry */
1649     uint32_t tx_timeout;
1650     /* wal pdev resets  */
1651     uint32_t pdev_resets;
1652     /* PhY/BB underrun */
1653     uint32_t phy_underrun;
1654     /* MPDU is more than txop limit */
1655     uint32_t txop_ovf;
1656     /* Number of Sequences posted */
1657     uint32_t seq_posted;
1658     /* Number of Sequences failed queueing */
1659     uint32_t seq_failed_queueing;
1660     /* Number of Sequences completed */
1661     uint32_t seq_completed;
1662     /* Number of Sequences restarted */
1663     uint32_t seq_restarted;
1664     /* Number of MU Sequences posted */
1665     uint32_t mu_seq_posted;
1666     /* Number of time HW ring is paused between seq switch within ISR */
1667     uint32_t seq_switch_hw_paused;
1668     /* Number of times seq continuation in DSR */
1669     uint32_t next_seq_posted_dsr;
1670     /* Number of times seq continuation in ISR */
1671     uint32_t seq_posted_isr;
1672     /* Number of seq_ctrl cached. */
1673     uint32_t seq_ctrl_cached;
1674     /* Number of MPDUs successfully transmitted */
1675     uint32_t mpdu_count_tqm;
1676     /* Number of MSDUs successfully transmitted */
1677     uint32_t msdu_count_tqm;
1678     /* Number of MPDUs dropped */
1679     uint32_t mpdu_removed_tqm;
1680     /* Number of MSDUs dropped */
1681     uint32_t msdu_removed_tqm;
1682     /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
1683     uint32_t mpdus_sw_flush;
1684     /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
1685     uint32_t mpdus_hw_filter;
1686     /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
1687     uint32_t mpdus_truncated;
1688     /* Num MPDUs that was tried but didn't receive ACK or BA */
1689     uint32_t mpdus_ack_failed;
1690     /* Num MPDUs that was dropped due to expiry (MSDU TTL). */
1691     uint32_t mpdus_expired;
1692     /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */
1693     uint32_t mpdus_seq_hw_retry;
1694     /* Num of TQM acked cmds processed */
1695     uint32_t ack_tlv_proc;
1696     /* coex_abort_mpdu_cnt valid. */
1697     uint32_t coex_abort_mpdu_cnt_valid;
1698     /* coex_abort_mpdu_cnt from TX FES stats. */
1699     uint32_t coex_abort_mpdu_cnt;
1700     /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */
1701     uint32_t num_total_ppdus_tried_ota;
1702     /* Number of data PPDUs tried over the air (OTA) */
1703     uint32_t num_data_ppdus_tried_ota;
1704     /* Num Local control/mgmt frames (MSDUs) queued */
1705     uint32_t local_ctrl_mgmt_enqued;
1706     /* local_ctrl_mgmt_freed:
1707      * Num Local control/mgmt frames (MSDUs) done
1708      * It includes all local ctrl/mgmt completions
1709      * (acked, no ack, flush, TTL, etc)
1710      */
1711     uint32_t local_ctrl_mgmt_freed;
1712     /* Num Local data frames (MSDUs) queued */
1713     uint32_t local_data_enqued;
1714     /* local_data_freed:
1715      * Num Local data frames (MSDUs) done
1716      * It includes all local data completions
1717      * (acked, no ack, flush, TTL, etc)
1718      */
1719     uint32_t local_data_freed;
1720 
1721 	/* Num MPDUs tried by SW */
1722 	uint32_t mpdu_tried;
1723 	/* Num of waiting seq posted in isr completion handler */
1724 	uint32_t isr_wait_seq_posted;
1725 	uint32_t tx_active_dur_us_low;
1726 	uint32_t tx_active_dur_us_high;
1727 };
1728 
1729 struct cdp_htt_tx_pdev_stats_urrn_tlv_v {
1730     struct cdp_htt_tlv_hdr tlv_hdr;
1731     uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */
1732 };
1733 
1734 /* NOTE: Variable length TLV, use length spec to infer array size */
1735 struct cdp_htt_tx_pdev_stats_flush_tlv_v {
1736     struct cdp_htt_tlv_hdr tlv_hdr;
1737     uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
1738 };
1739 
1740 /* NOTE: Variable length TLV, use length spec to infer array size */
1741 struct cdp_htt_tx_pdev_stats_sifs_tlv_v {
1742     struct cdp_htt_tlv_hdr tlv_hdr;
1743     uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
1744 };
1745 
1746 /* NOTE: Variable length TLV, use length spec to infer array size */
1747 struct cdp_htt_tx_pdev_stats_phy_err_tlv_v {
1748     struct cdp_htt_tlv_hdr tlv_hdr;
1749     uint32_t  phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
1750 };
1751 
1752 /* == RX PDEV/SOC STATS == */
1753 /* HTT_STATS_RX_SOC_FW_STATS_TAG */
1754 struct cdp_htt_rx_soc_fw_stats_tlv {
1755     struct cdp_htt_tlv_hdr tlv_hdr;
1756     /* Num Packets received on REO FW ring */
1757     uint32_t fw_reo_ring_data_msdu;
1758     /* Num bc/mc packets indicated from fw to host */
1759     uint32_t fw_to_host_data_msdu_bcmc;
1760     /* Num unicast packets indicated from fw to host */
1761     uint32_t fw_to_host_data_msdu_uc;
1762     /* Num remote buf recycle from offload  */
1763     uint32_t ofld_remote_data_buf_recycle_cnt;
1764     /* Num remote free buf given to offload */
1765     uint32_t ofld_remote_free_buf_indication_cnt;
1766 };
1767 
1768 struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
1769     struct cdp_htt_tlv_hdr tlv_hdr;
1770     /* Num total buf refilled from refill ring */
1771     uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
1772 };
1773 
1774 struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
1775     struct cdp_htt_tlv_hdr tlv_hdr;
1776     /* Num error MPDU for each RxDMA error type  */
1777     uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
1778 };
1779 
1780 struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v {
1781     struct cdp_htt_tlv_hdr tlv_hdr;
1782     /* Num MPDU dropped  */
1783     uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
1784 };
1785 
1786 #define HTT_STATS_PHY_ERR_MAX 43
1787 
1788 struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv {
1789     struct cdp_htt_tlv_hdr tlv_hdr;
1790 
1791     /* BIT [ 7 :  0]   :- mac_id
1792      * BIT [31 :  8]   :- reserved
1793      */
1794     uint32_t mac_id__word;
1795     /* Num of phy err */
1796     uint32_t total_phy_err_cnt;
1797     /* Counts of different types of phy errs
1798      * The mapping of PHY error types to phy_err array elements is HW dependent.
1799      * The only currently-supported mapping is shown below:
1800      *
1801      * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV
1802      * 1 phyrx_err_synth_off
1803      * 2 phyrx_err_ofdma_timing
1804      * 3 phyrx_err_ofdma_signal_parity
1805      * 4 phyrx_err_ofdma_rate_illegal
1806      * 5 phyrx_err_ofdma_length_illegal
1807      * 6 phyrx_err_ofdma_restart
1808      * 7 phyrx_err_ofdma_service
1809      * 8 phyrx_err_ppdu_ofdma_power_drop
1810      * 9 phyrx_err_cck_blokker
1811      * 10 phyrx_err_cck_timing
1812      * 11 phyrx_err_cck_header_crc
1813      * 12 phyrx_err_cck_rate_illegal
1814      * 13 phyrx_err_cck_length_illegal
1815      * 14 phyrx_err_cck_restart
1816      * 15 phyrx_err_cck_service
1817      * 16 phyrx_err_cck_power_drop
1818      * 17 phyrx_err_ht_crc_err
1819      * 18 phyrx_err_ht_length_illegal
1820      * 19 phyrx_err_ht_rate_illegal
1821      * 20 phyrx_err_ht_zlf
1822      * 21 phyrx_err_false_radar_ext
1823      * 22 phyrx_err_green_field
1824      * 23 phyrx_err_bw_gt_dyn_bw
1825      * 24 phyrx_err_leg_ht_mismatch
1826      * 25 phyrx_err_vht_crc_error
1827      * 26 phyrx_err_vht_siga_unsupported
1828      * 27 phyrx_err_vht_lsig_len_invalid
1829      * 28 phyrx_err_vht_ndp_or_zlf
1830      * 29 phyrx_err_vht_nsym_lt_zero
1831      * 30 phyrx_err_vht_rx_extra_symbol_mismatch
1832      * 31 phyrx_err_vht_rx_skip_group_id0
1833      * 32 phyrx_err_vht_rx_skip_group_id1to62
1834      * 33 phyrx_err_vht_rx_skip_group_id63
1835      * 34 phyrx_err_ofdm_ldpc_decoder_disabled
1836      * 35 phyrx_err_defer_nap
1837      * 36 phyrx_err_fdomain_timeout
1838      * 37 phyrx_err_lsig_rel_check
1839      * 38 phyrx_err_bt_collision
1840      * 39 phyrx_err_unsupported_mu_feedback
1841      * 40 phyrx_err_ppdu_tx_interrupt_rx
1842      * 41 phyrx_err_unsupported_cbf
1843      * 42 phyrx_err_other
1844      */
1845     uint32_t phy_err[HTT_STATS_PHY_ERR_MAX];
1846 };
1847 
1848 struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v {
1849     struct cdp_htt_tlv_hdr tlv_hdr;
1850     /* Num ring empty encountered */
1851     uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
1852 };
1853 
1854 struct cdp_htt_tx_pdev_stats {
1855     struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv;
1856     struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv;
1857     struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv;
1858     struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv;
1859     struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv;
1860 };
1861 
1862 struct cdp_htt_rx_soc_stats_t {
1863     struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv;
1864     struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv;
1865     struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv;
1866 };
1867 
1868 struct cdp_htt_rx_pdev_stats {
1869     struct cdp_htt_rx_soc_stats_t soc_stats;
1870     struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv;
1871     struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv;
1872     struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop;
1873     struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv;
1874 };
1875 
1876 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
1877 /* Since protocol type enumeration value is passed as CCE metadata
1878  * to firmware, add a constant offset before passing it to firmware
1879  */
1880 #define RX_PROTOCOL_TAG_START_OFFSET  128
1881 /* This should align with packet type enumerations in ieee80211_ioctl.h
1882  * and wmi_unified_param.h files
1883  */
1884 #define RX_PROTOCOL_TAG_MAX   24
1885 /* Macro that should be used to dump the statistics counter for all
1886  * protocol types
1887  */
1888 #define RX_PROTOCOL_TAG_ALL 0xff
1889 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
1890 
1891 #define OFDMA_NUM_RU_SIZE 7
1892 
1893 #define OFDMA_NUM_USERS	37
1894 
1895 #if defined(WLAN_CFR_ENABLE) && defined(WLAN_ENH_CFR_ENABLE)
1896 /*
1897  * mac_freeze_capture_reason - capture reason counters
1898  * @FREEZE_REASON_TM: When m_directed_ftm is enabled, this CFR data is
1899  * captured for a Timing Measurement (TM) frame.
1900  * @FREEZE_REASON_FTM: When m_directed_ftm is enabled, this CFR data is
1901  * captured for a Fine Timing Measurement (FTM) frame.
1902  * @FREEZE_REASON_ACK_RESP_TO_TM_FTM: When m_all_ftm_ack is enabled, this CFR
1903  * data is captured for an ACK received for the FTM/TM frame sent to a station.
1904  * @FREEZE_REASON_TA_RA_TYPE_FILTER: When m_ta_ra_filter is enabled, this CFR
1905  * data is captured for a PPDU received,since the CFR TA_RA filter is met.
1906  * @FREEZE_REASON_NDPA_NDP: When m_ndpa_ndp_directed(or)m_ndpa_ndp_all is
1907  * enabled, this CFR data is captured for an NDP frame received.
1908  * @FREEZE_REASON_ALL_PACKET: When m_all_packet is enabled, this CFR data is
1909  * captured for an incoming PPDU.
1910  */
1911 enum mac_freeze_capture_reason {
1912 	FREEZE_REASON_TM = 0,
1913 	FREEZE_REASON_FTM,
1914 	FREEZE_REASON_ACK_RESP_TO_TM_FTM,
1915 	FREEZE_REASON_TA_RA_TYPE_FILTER,
1916 	FREEZE_REASON_NDPA_NDP,
1917 	FREEZE_REASON_ALL_PACKET,
1918 	FREEZE_REASON_MAX,
1919 };
1920 
1921 /*
1922  * chan_capture_status: capture status counters
1923  * @CAPTURE_IDLE: CFR data is not captured, since VCSR setting for CFR/RCC is
1924  * not enabled.
1925  * @CAPTURE_BUSY: CFR data is not available, since previous channel
1926  * upload is in progress
1927  * @CAPTURE_ACTIVE: CFR data is captured in HW registers
1928  * @CAPTURE_NO_BUFFER: CFR data is not captured, since no buffer is available
1929  * in IPC ring to DMA CFR data
1930  */
1931 enum chan_capture_status {
1932 	CAPTURE_IDLE = 0,
1933 	CAPTURE_BUSY,
1934 	CAPTURE_ACTIVE,
1935 	CAPTURE_NO_BUFFER,
1936 	CAPTURE_MAX,
1937 };
1938 
1939 /* struct cdp_cfr_rcc_stats - CFR RCC debug statistics
1940  * @bb_captured_channel_cnt: No. of PPDUs for which MAC sent Freeze TLV to PHY
1941  * @bb_captured_timeout_cnt: No. of PPDUs for which CFR filter criteria matched
1942  * but MAC did not send Freeze TLV to PHY as time exceeded freeze tlv delay
1943  * count threshold
1944  * @rx_loc_info_valid_cnt: No. of PPDUs for which PHY could find a valid buffer
1945  * in ucode IPC ring
1946  * @chan_capture_status[]: capture status counters
1947  *	[0] - No. of PPDUs with capture status CAPTURE_IDLE
1948  *	[1] - No. of PPDUs with capture status CAPTURE_BUSY
1949  *	[2] - No. of PPDUs with capture status CAPTURE_ACTIVE
1950  *	[3] - No. of PPDUs with capture status CAPTURE_NO_BUFFER
1951  * @reason_cnt[]: capture reason counters
1952  *	[0] - No. PPDUs filtered due to freeze_reason_TM
1953  *	[1] - No. PPDUs filtered due to freeze_reason_FTM
1954  *	[2] - No. PPDUs filtered due to freeze_reason_ACK_resp_to_TM_FTM
1955  *	[3] - No. PPDUs filtered due to freeze_reason_TA_RA_TYPE_FILTER
1956  *	[4] - No. PPDUs filtered due to freeze_reason_NDPA_NDP
1957  *	[5] - No. PPDUs filtered due to freeze_reason_ALL_PACKET
1958  */
1959 struct cdp_cfr_rcc_stats {
1960 	uint64_t bb_captured_channel_cnt;
1961 	uint64_t bb_captured_timeout_cnt;
1962 	uint64_t rx_loc_info_valid_cnt;
1963 	uint64_t chan_capture_status[CAPTURE_MAX];
1964 	uint64_t reason_cnt[FREEZE_REASON_MAX];
1965 };
1966 #else
1967 struct cdp_cfr_rcc_stats {
1968 };
1969 #endif
1970 
1971 /* struct cdp_soc_stats - soc stats
1972  * @tx.egress: Total packets transmitted
1973  * @rx.ingress: Total rx packets count
1974  * @rx.err_ring_pkts: Total Packets in Rx Error ring
1975  * @rx.rx_frags: No of Fragments
1976  * @rx.reo_reinject: No of reinjected packets
1977  * @rx.bar_frame: Number of bar frames received
1978  * @rx.err.rejected: RX msdu rejected count on delivery to vdev stack_fn
1979  * @rx.err.raw_frm_drop: RX raw frame dropped count
1980  */
1981 struct cdp_soc_stats {
1982 	struct {
1983 		struct cdp_pkt_info egress;
1984 	} tx;
1985 
1986 	struct {
1987 		struct cdp_pkt_info ingress;
1988 		uint32_t err_ring_pkts;
1989 		uint32_t rx_frags;
1990 		uint32_t reo_reinject;
1991 		uint32_t bar_frame;
1992 
1993 		struct {
1994 			uint32_t rx_rejected;
1995 			uint32_t rx_raw_frm_drop;
1996 		} err;
1997 	} rx;
1998 };
1999 
2000 /* struct cdp_pdev_stats - pdev stats
2001  * @msdu_not_done: packets dropped because msdu done bit not set
2002  * @mec:Multicast Echo check
2003  * @mesh_filter: Mesh Filtered packets
2004  * @mon_rx_drop: packets dropped on monitor vap
2005  * @wifi_parse: rxdma errors due to wifi parse error
2006  * @mon_radiotap_update_err: not enough space to update radiotap
2007  * @pkts: total packets replenished
2008  * @rxdma_err: rxdma errors for replenished
2009  * @nbuf_alloc_fail: nbuf alloc failed
2010  * @frag_alloc_fail: frag alloc failed
2011  * @map_err: Mapping failure
2012  * @x86_fail: x86 failures
2013  * @low_thresh_intrs: low threshold interrupts
2014  * @rx_raw_pkts: Rx Raw Packets
2015  * @mesh_mem_alloc: Mesh Rx Stats Alloc fail
2016  * @tso_desc_cnt: TSO descriptors
2017  * @sg_desc_cnt: SG Descriptors
2018  * @vlan_tag_stp_cnt: Vlan tagged Stp packets in wifi parse error
2019  * @desc_alloc_fail: desc alloc failed errors
2020  * @ip_csum_err: ip checksum errors
2021  * @tcp_udp_csum_err: tcp/udp checksum errors
2022  * @buf_freelist: buffers added back in freelist
2023  * @tx_i: Tx Ingress stats
2024  * @tx:CDP Tx Stats
2025  * @rx: CDP Rx Stats
2026  * @tx_comp_histogram: Number of Tx completions per interrupt
2027  * @rx_ind_histogram:  Number of Rx ring descriptors reaped per interrupt
2028  * @ppdu_stats_counter: ppdu stats counter
2029  * @cdp_delayed_ba_not_recev: counter for delayed ba not received
2030  * @htt_tx_pdev_stats: htt pdev stats for tx
2031  * @htt_rx_pdev_stats: htt pdev stats for rx
2032  * @data_rx_ru_size: UL ofdma data ru size counter array
2033  * @nondata_rx_ru_size: UL ofdma non data ru size counter array
2034  * @data_rx_ppdu: data rx ppdu counter
2035  * @data_user: data user counter array
2036  * @tx_ppdu_proc: stats counter for tx ppdu processed
2037  * @ack_ba_comes_twice: stats counter for ack_ba_comes twice
2038  * @ppdu_drop: stats counter for ppdu_desc drop once threshold reached
2039  * @ppdu_wrap_drop: stats counter for ppdu desc drop on wrap around
2040  * @peer_unauth_rx_pkt_drop: stats counter for drops due to unauthorized peer
2041  */
2042 struct cdp_pdev_stats {
2043 	struct {
2044 		uint32_t msdu_not_done;
2045 		uint32_t mec;
2046 		uint32_t mesh_filter;
2047 		uint32_t wifi_parse;
2048 		/* Monitor mode related */
2049 		uint32_t mon_rx_drop;
2050 		uint32_t mon_radiotap_update_err;
2051 	} dropped;
2052 
2053 	struct {
2054 		struct cdp_pkt_info pkts;
2055 		uint32_t rxdma_err;
2056 		uint32_t nbuf_alloc_fail;
2057 		uint32_t frag_alloc_fail;
2058 		uint32_t map_err;
2059 		uint32_t x86_fail;
2060 		uint32_t low_thresh_intrs;
2061 	} replenish;
2062 
2063 	uint32_t rx_raw_pkts;
2064 	uint32_t mesh_mem_alloc;
2065 	uint32_t tso_desc_cnt;
2066 	uint32_t sg_desc_cnt;
2067 	uint32_t vlan_tag_stp_cnt;
2068 
2069 	/* Rx errors */
2070 	struct {
2071 		uint32_t desc_alloc_fail;
2072 		uint32_t ip_csum_err;
2073 		uint32_t tcp_udp_csum_err;
2074 		uint32_t rxdma_error;
2075 		uint32_t reo_error;
2076 	} err;
2077 
2078 	uint32_t buf_freelist;
2079 	struct cdp_tx_ingress_stats tx_i;
2080 	struct cdp_tx_stats tx;
2081 	struct cdp_rx_stats rx;
2082 	struct cdp_hist_tx_comp tx_comp_histogram;
2083 	struct cdp_hist_rx_ind rx_ind_histogram;
2084 	uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG];
2085 	uint32_t cdp_delayed_ba_not_recev;
2086 
2087 	struct cdp_htt_tx_pdev_stats  htt_tx_pdev_stats;
2088 	struct cdp_htt_rx_pdev_stats  htt_rx_pdev_stats;
2089 
2090 	/* Received wdi messages from fw */
2091 	uint32_t wdi_event[CDP_WDI_NUM_EVENTS];
2092 	struct cdp_tid_stats tid_stats;
2093 
2094 	/* numbers of data/nondata per RU sizes */
2095 	struct {
2096 		uint32_t data_rx_ru_size[OFDMA_NUM_RU_SIZE];
2097 		uint32_t nondata_rx_ru_size[OFDMA_NUM_RU_SIZE];
2098 		uint32_t data_rx_ppdu;
2099 		uint32_t data_users[OFDMA_NUM_USERS];
2100 	} ul_ofdma;
2101 
2102 	struct cdp_tso_stats tso_stats;
2103 	struct cdp_cfr_rcc_stats rcc;
2104 
2105 	uint64_t tx_ppdu_proc;
2106 	uint64_t ack_ba_comes_twice;
2107 	uint64_t ppdu_drop;
2108 	uint64_t ppdu_wrap_drop;
2109 
2110 	struct {
2111 		uint64_t num_bufs_consumed;
2112 		uint64_t num_pool_bufs_replenish;
2113 		uint64_t num_bufs_alloc_success;
2114 	} rx_buffer_pool;
2115 
2116 	struct {
2117 		uint64_t num_bufs_refilled;
2118 		uint64_t num_bufs_allocated;
2119 	} rx_refill_buff_pool;
2120 
2121 	uint32_t peer_unauth_rx_pkt_drop;
2122 };
2123 
2124 /* struct cdp_peer_hmwds_ast_add_status - hmwds peer ast add status
2125  * @vdev_id: vdev id
2126  * @status: ast add status
2127  * @peer_mac: peer mac address
2128  * @ast_mac: ast node mac address
2129  */
2130 struct cdp_peer_hmwds_ast_add_status {
2131 	uint32_t vdev_id;
2132 	uint32_t status;
2133 	uint8_t  peer_mac[QDF_MAC_ADDR_SIZE];
2134 	uint8_t  ast_mac[QDF_MAC_ADDR_SIZE];
2135 };
2136 
2137 /*
2138  * Enumeration of cdp soc parameters
2139  * @DP_SOC_PARAM_EAPOL_OVER_CONTROL_PORT: For sending EAPOL's over control port
2140  */
2141 enum cdp_soc_param_t {
2142 	DP_SOC_PARAM_MSDU_EXCEPTION_DESC,
2143 	DP_SOC_PARAM_CMEM_FSE_SUPPORT,
2144 	DP_SOC_PARAM_MAX_AST_AGEOUT,
2145 	DP_SOC_PARAM_EAPOL_OVER_CONTROL_PORT,
2146 	DP_SOC_PARAM_MAX,
2147 };
2148 
2149 #ifdef QCA_ENH_V3_STATS_SUPPORT
2150 /*
2151  * Enumeration of PDEV Configuration parameter
2152  */
2153 enum _dp_param_t {
2154 	DP_PARAM_MSDU_TTL,
2155 	DP_PARAM_TOTAL_Q_SIZE_RANGE0,
2156 	DP_PARAM_TOTAL_Q_SIZE_RANGE1,
2157 	DP_PARAM_TOTAL_Q_SIZE_RANGE2,
2158 	DP_PARAM_TOTAL_Q_SIZE_RANGE3,
2159 	DP_PARAM_VIDEO_DELAY_STATS_FC,
2160 	DP_PARAM_QFLUSHINTERVAL,
2161 	DP_PARAM_TOTAL_Q_SIZE,
2162 	DP_PARAM_MIN_THRESHOLD,
2163 	DP_PARAM_MAX_Q_LIMIT,
2164 	DP_PARAM_MIN_Q_LIMIT,
2165 	DP_PARAM_CONG_CTRL_TIMER_INTV,
2166 	DP_PARAM_STATS_TIMER_INTV,
2167 	DP_PARAM_ROTTING_TIMER_INTV,
2168 	DP_PARAM_LATENCY_PROFILE,
2169 	DP_PARAM_HOSTQ_DUMP,
2170 	DP_PARAM_TIDQ_MAP,
2171 	DP_PARAM_VIDEO_STATS_FC,
2172 	DP_PARAM_STATS_FC,
2173 
2174 	DP_PARAM_MAX,
2175 };
2176 #endif
2177 /* Bitmasks for stats that can block */
2178 #define EXT_TXRX_FW_STATS		0x0001
2179 #endif
2180