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