xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_stats_struct.h (revision 1b9674e21e24478fba4530f5ae7396b9555e9c6a)
1 /*
2  * Copyright (c) 2016-2018 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 #ifndef CONFIG_WIN
27 #include <wlan_defs.h>
28 #endif
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 (12 + 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 /* WME stream classes */
57 #define WME_AC_BE    0    /* best effort */
58 #define WME_AC_BK    1    /* background */
59 #define WME_AC_VI    2    /* video */
60 #define WME_AC_VO    3    /* voice */
61 #define WME_AC_MAX   4    /* MAX AC Value */
62 
63 #define CDP_MAX_RX_RINGS 4
64 
65 /*
66  * Number of TLVs sent by FW. Needs to reflect
67  * HTT_PPDU_STATS_MAX_TAG declared in FW
68  */
69 #define CDP_PPDU_STATS_MAX_TAG 14
70 
71 /* Different Packet Types */
72 enum cdp_packet_type {
73 	DOT11_A = 0,
74 	DOT11_B = 1,
75 	DOT11_N = 2,
76 	DOT11_AC = 3,
77 	DOT11_AX = 4,
78 	DOT11_MAX = 5,
79 };
80 
81 /* struct cdp_pkt_info - packet info
82  * @num: no of packets
83  * @bytes: total no of bytes
84  */
85 struct cdp_pkt_info {
86 	uint32_t num;
87 	uint64_t bytes;
88 };
89 
90 /* struct cdp_tx_stats - tx stats
91  * @cdp_pkt_info comp_pkt: Pkt Info for which completions were received
92  * @cdp_pkt_info ucast: Unicast Packet Count
93  * @cdp_pkt_info mcast: Multicast Packet Count
94  * @cdp_pkt_info bcast: Broadcast Packet Count
95  * @cdp_pkt_info nawds_mcast: NAWDS  Multicast Packet Count
96  * @nawds_mcast_drop: NAWDS  Multicast Drop Count
97  * @cdp_pkt_info tx_success: Successful Tx Packets
98  * @tx_failed: Total Tx failure
99  * @ofdma: Total Packets as ofdma
100  * @stbc: Packets in STBC
101  * @ldpc: Packets in LDPC
102  * @retries: Packet retries
103  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
104  * @amsdu_cnt: Number of MSDUs part of AMSDU
105  * @tx_rate: Tx Rate
106  * @last_tx_rate: Last tx rate
107  * @last_tx_rate_mcs: Tx rate mcs
108  * @last_per: Tx Per
109  * @rnd_avg_tx_rate: Rounded average tx rate
110  * @avg_tx_rate: Average TX rate
111  * @last_ack_rssi: RSSI of last acked packet
112  * @tx_bytes_success_last: last Tx success bytes
113  * @tx_data_success_last: last Tx success data
114  * @tx_byte_rate: Bytes Trasmitted in last one sec
115  * @tx_data_rate: Data Transmitted in last one sec
116  * @sgi_count[MAX_GI]: SGI count
117  * @nss[SS_COUNT]: Packet count for different num_spatial_stream values
118  * @bw[MAX_BW]: Packet Count for different bandwidths
119  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
120  * @excess_retries_per_ac[WME_AC_MAX]: Wireless Multimedia type Count
121  * @fw_rem: Discarded by firmware
122  * @fw_rem_notx: firmware_discard_untransmitted
123  * @fw_rem_tx: firmware_discard_transmitted
124  * @age_out: aged out in mpdu/msdu queues
125  * @fw_reason1: discarded by firmware reason 1
126  * @fw_reason2: discarded by firmware reason 2
127  * @fw_reason3: discarded by firmware reason 3
128  * @mcs_count: MCS Count
129  * @dot11_tx_pkts: dot11 tx packets
130  * @an_tx_cnt: ald tx count
131  * @an_tx_rates_used: ald rx rate used
132  * @an_tx_bytes: ald tx bytes
133  * @ald_txcount: ald tx count
134  * @ald_lastper: ald last PER
135  * @ald_max4msframelen: ald max frame len
136  * @an_tx_ratecount: ald tx ratecount
137  * @ald_retries: ald retries
138  * @ald_ac_nobufs: #buffer overflows per node per AC
139  * @ald_ac_excretries: #pkts dropped after excessive retries per node per AC
140  * @rssi_chain: rssi chain
141  * @inactive_time: inactive time in secs
142  * @tx_ratecode: Tx rate code of last frame
143  * @tx_flags: tx flags
144  * @tx_power: Tx power latest
145  * @is_tx_no_ack: no ack received
146  * @is_tx_nodefkey: tx failed 'cuz no defkey
147  * @is_tx_noheadroom: tx failed 'cuz no space
148  * @is_crypto_enmicfail:
149  * @is_tx_nonode: tx failed for no node
150  * @is_tx_unknownmgt: tx of unknown mgt frame
151  * @is_tx_badcipher: tx failed 'cuz key type
152  * @ampdu_cnt: completion of aggregation
153  * @non_ampdu_cnt: tx completion not aggregated
154  */
155 struct cdp_tx_stats {
156 	struct cdp_pkt_info comp_pkt;
157 	struct cdp_pkt_info ucast;
158 	struct cdp_pkt_info mcast;
159 	struct cdp_pkt_info bcast;
160 	struct cdp_pkt_info nawds_mcast;
161 	uint32_t nawds_mcast_drop;
162 	struct cdp_pkt_info tx_success;
163 	uint32_t tx_failed;
164 	uint32_t ofdma;
165 	uint32_t stbc;
166 	uint32_t ldpc;
167 	uint32_t retries;
168 	uint32_t non_amsdu_cnt;
169 	uint32_t amsdu_cnt;
170 	uint32_t tx_rate;
171 	uint32_t last_tx_rate;
172 	uint32_t last_tx_rate_mcs;
173 	uint32_t last_per;
174 	uint32_t rnd_avg_tx_rate;
175 	uint32_t avg_tx_rate;
176 	uint32_t last_ack_rssi;
177 	uint32_t tx_bytes_success_last;
178 	uint32_t tx_data_success_last;
179 	uint32_t tx_byte_rate;
180 	uint32_t tx_data_rate;
181 	struct {
182 		uint32_t mcs_count[MAX_MCS];
183 	} pkt_type[DOT11_MAX];
184 
185 	uint32_t sgi_count[MAX_GI];
186 
187 	uint32_t nss[SS_COUNT];
188 
189 	uint32_t bw[MAX_BW];
190 
191 	uint32_t wme_ac_type[WME_AC_MAX];
192 
193 	uint32_t excess_retries_per_ac[WME_AC_MAX];
194 
195 	struct {
196 		uint32_t fw_rem;
197 		uint32_t fw_rem_notx;
198 		uint32_t fw_rem_tx;
199 		uint32_t age_out;
200 		uint32_t fw_reason1;
201 		uint32_t fw_reason2;
202 		uint32_t fw_reason3;
203 	} dropped;
204 
205 	struct cdp_pkt_info dot11_tx_pkts;
206 
207 	uint32_t fw_tx_cnt;
208 	uint32_t fw_tx_rates_used;
209 	uint32_t fw_tx_bytes;
210 	uint32_t fw_txcount;
211 	uint32_t fw_max4msframelen;
212 	uint32_t fw_ratecount;
213 
214 	uint32_t ac_nobufs[WME_AC_MAX];
215 	uint32_t rssi_chain[WME_AC_MAX];
216 	uint32_t inactive_time;
217 
218 	uint32_t tx_ratecode;
219 	uint32_t tx_flags;
220 	uint32_t tx_power;
221 
222 	/* MSDUs which the target sent but couldn't get an ack for */
223 	struct cdp_pkt_info is_tx_no_ack;
224 
225 	/*add for peer and upadted from ppdu*/
226 	uint32_t ampdu_cnt;
227 	uint32_t non_ampdu_cnt;
228 };
229 
230 /* struct cdp_rx_stats - rx Level Stats
231  * @to_stack: Total packets sent up the stack
232  * @rcvd_reo[CDP_MAX_RX_RINGS]:  Packets received on the reo ring
233  * @unicast: Total unicast packets
234  * @multicast: Total multicast packets
235  * @bcast:  Broadcast Packet Count
236  * @raw: Raw Pakets received
237  * @nawds_mcast_drop: Total multicast packets
238  * @pkts: Intra BSS packets received
239  * @fail: Intra BSS packets failed
240  * @mic_err: Rx MIC errors CCMP
241  * @decrypt_err: Rx Decryption Errors CRC
242  * @fcserr: rx MIC check failed (CCMP)
243  * @wme_ac_type[WME_AC_MAX]: Wireless Multimedia type Count
244  * @reception_type[MAX_RECEPTION_TYPES]: Reception type os packets
245  * @mcs_count[MAX_MCS]: mcs count
246  * @sgi_count[MAX_GI]: sgi count
247  * @nss[SS_COUNT]: Packet count in spatiel Streams
248  * @bw[MAX_BW]:  Packet Count in different bandwidths
249  * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation
250  * @ampdu_cnt: Number of MSDUs part of AMSPU
251  * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation
252  * @amsdu_cnt: Number of MSDUs part of AMSDU
253  * @bar_recv_cnt: Number of bar received
254  * @rssi: RSSI of received signal
255  * @last_rssi: Previous rssi
256  * @rx_rate: Rx rate
257  * @last_rx_rate: Previous rx rate
258  * @rnd_avg_rx_rate: Rounded average rx rate
259  * @avg_rx_rate:  Average Rx rate
260  * @dot11_rx_pkts: dot11 rx packets
261  * @rx_bytes_last: last Rx success bytes
262  * @rx_data_last: last rx success data
263  * @rx_byte_rate: bytes received in last one sec
264  * @rx_data_rate: data received in last one sec
265  * @rx_retries: retries of packet in rx
266  * @rx_mpdus: mpdu in rx
267  * @rx_ppdus: ppdu in rx
268  * @is_rx_tooshort: tooshort
269  * @is_rx_decap: rx decap
270  * @rx_ccmpmic: rx MIC check failed (CCMP)
271  * @rx_tkipmic: rx MIC check failed (TKIP)
272  * @rx_tkipicv: rx ICV check failed (TKIP)
273  * @rx_wpimic: rx MIC check failed (WPI)
274  * @rx_wepfail: rx wep processing failed
275  * @rx_aggr: aggregation on rx
276  * @rx_discard: packets discard in rx
277  */
278 struct cdp_rx_stats {
279 	struct cdp_pkt_info to_stack;
280 	struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS];
281 	struct cdp_pkt_info unicast;
282 	struct cdp_pkt_info multicast;
283 	struct cdp_pkt_info bcast;
284 	struct cdp_pkt_info raw;
285 	uint32_t nawds_mcast_drop;
286 	struct {
287 		struct cdp_pkt_info pkts;
288 		struct cdp_pkt_info fail;
289 	} intra_bss;
290 
291 	struct {
292 		uint32_t mic_err;
293 		uint32_t decrypt_err;
294 		uint32_t fcserr;
295 	} err;
296 
297 	uint32_t wme_ac_type[WME_AC_MAX];
298 	uint32_t reception_type[MAX_RECEPTION_TYPES];
299 	struct {
300 		uint32_t mcs_count[MAX_MCS];
301 	} pkt_type[DOT11_MAX];
302 	uint32_t sgi_count[MAX_GI];
303 	uint32_t nss[SS_COUNT];
304 	uint32_t bw[MAX_BW];
305 	uint32_t non_ampdu_cnt;
306 	uint32_t ampdu_cnt;
307 	uint32_t non_amsdu_cnt;
308 	uint32_t amsdu_cnt;
309 	uint32_t bar_recv_cnt;
310 	uint32_t rssi;
311 	uint32_t last_rssi;
312 	uint32_t rx_rate;
313 	uint32_t last_rx_rate;
314 	uint32_t rnd_avg_rx_rate;
315 	uint32_t avg_rx_rate;
316 	struct cdp_pkt_info  dot11_rx_pkts;
317 
318 	uint32_t rx_bytes_success_last;
319 	uint32_t rx_data_success_last;
320 	uint32_t rx_byte_rate;
321 	uint32_t rx_data_rate;
322 
323 	uint32_t rx_retries;
324 	uint32_t rx_mpdus;
325 	uint32_t rx_ppdus;
326 
327 	/*add for peer updated for ppdu*/
328 	uint32_t rx_aggr;
329 	uint32_t rx_discard;
330 };
331 
332 /* struct cdp_tx_ingress_stats - Tx ingress Stats
333  * @rcvd: Total packets received for transmission
334  * @processed: Tx packets processed
335  * @inspect_pkts: Total packets passed to inspect handler
336  * @nawds_mcast: NAWDS  Multicast Packet Count
337  * @bcast: Number of broadcast packets
338  * @raw_pkt: Total Raw packets
339  * @dma_map_error: DMA map error
340  * @num_seg: No of segments in TSO packets
341  * @tso_pkt:total no of TSO packets
342  * @non_tso_pkts: non - TSO packets
343  * @tso_desc_cnt: TSO descriptors
344  * @dropped_host: TSO packets dropped by host
345  * @dropped_target:TSO packets dropped by target
346  * @sg_pkt: Total scatter gather packets
347  * @non_sg_pkts: non SG packets
348  * @sg_desc_cnt: SG Descriptors
349  * @dropped_host: SG packets dropped by host
350  * @dropped_target: SG packets dropped by target
351  * @dma_map_error: Dma map error
352  * @mcast_pkt: total no of multicast conversion packets
353  * @dropped_map_error: packets dropped due to map error
354  * @dropped_self_mac: packets dropped due to self Mac address
355  * @dropped_send_fail: Packets dropped due to send fail
356  * @ucast: total unicast packets transmitted
357  * @fail_seg_alloc: Segment allocation failure
358  * @clone_fail: NBUF clone failure
359  * @dropped_pkt: Total scatter gather packets
360  * @desc_na: Desc Not Available
361  * @ring_full: ring full
362  * @enqueue_fail: hw enqueue fail
363  * @dma_error: dma fail
364  * @res_full: Resource Full: Congestion Control
365  * @exception_fw: packets sent to fw
366  * @completion_fw: packets completions received from fw
367  * @cce_classified:Number of packets classified by CCE
368  * @cce_classified_raw:Number of raw packets classified by CCE
369  */
370 struct cdp_tx_ingress_stats {
371 	struct cdp_pkt_info rcvd;
372 	struct cdp_pkt_info processed;
373 	struct cdp_pkt_info reinject_pkts;
374 	struct cdp_pkt_info inspect_pkts;
375 	struct cdp_pkt_info nawds_mcast;
376 	struct cdp_pkt_info bcast;
377 
378 	struct {
379 		struct cdp_pkt_info raw_pkt;
380 		uint32_t dma_map_error;
381 	} raw;
382 
383 	/* TSO packets info */
384 	struct {
385 		uint32_t num_seg;
386 		struct cdp_pkt_info tso_pkt;
387 		struct cdp_pkt_info non_tso_pkts;
388 		uint32_t tso_desc_cnt;
389 		struct cdp_pkt_info  dropped_host;
390 		uint32_t dropped_target;
391 	} tso;
392 
393 	/* Scatter Gather packet info */
394 	struct {
395 		struct cdp_pkt_info sg_pkt;
396 		struct cdp_pkt_info non_sg_pkts;
397 		uint32_t sg_desc_cnt;
398 		struct cdp_pkt_info  dropped_host;
399 		uint32_t dropped_target;
400 		uint32_t dma_map_error;
401 	} sg;
402 
403 	/* Multicast Enhancement packets info */
404 	struct {
405 		struct cdp_pkt_info mcast_pkt;
406 		uint32_t dropped_map_error;
407 		uint32_t dropped_self_mac;
408 		uint32_t dropped_send_fail;
409 		uint32_t ucast;
410 		uint32_t fail_seg_alloc;
411 		uint32_t clone_fail;
412 	} mcast_en;
413 
414 	/* Packets dropped on the Tx side */
415 	struct {
416 		struct cdp_pkt_info dropped_pkt;
417 		struct cdp_pkt_info  desc_na;
418 		uint32_t ring_full;
419 		uint32_t enqueue_fail;
420 		uint32_t dma_error;
421 		uint32_t res_full;
422 	} dropped;
423 
424 	/* Mesh packets info */
425 	struct {
426 		uint32_t exception_fw;
427 		uint32_t completion_fw;
428 	} mesh;
429 
430 	uint32_t cce_classified;
431 	uint32_t cce_classified_raw;
432 };
433 
434 /* struct cdp_vdev_stats - vdev stats structure
435  * @tx_i: ingress tx stats
436  * @tx: cdp tx stats
437  * @rx: cdp rx stats
438  */
439 struct cdp_vdev_stats {
440 	struct cdp_tx_ingress_stats tx_i;
441 	struct cdp_tx_stats tx;
442 	struct cdp_rx_stats rx;
443 };
444 
445 /* struct cdp_peer_stats - peer stats structure
446  * @tx: cdp tx stats
447  * @rx: cdp rx stats
448  */
449 struct cdp_peer_stats {
450 	/* CDP Tx Stats */
451 	struct cdp_tx_stats tx;
452 	/* CDP Rx Stats */
453 	struct cdp_rx_stats rx;
454 };
455 
456 /* struct cdp_interface_peer_stats - interface structure for txrx peer stats
457  * @peer_hdl: control path peer handle
458  * @last_peer_tx_rate: peer tx rate for last transmission
459  * @peer_tx_rate: tx rate for current transmission
460  * @peer_rssi: current rssi value of peer
461  * @rssi_changed: denotes rssi is changed
462  * @tx_packet_count: tx packet count
463  * @rx_packet_count: rx packet count
464  * @tx_byte_count: tx byte count
465  * @rx_byte_count: rx byte count
466  * @per: per error rate
467  */
468 struct cdp_interface_peer_stats {
469 	void  *peer_hdl;
470 	uint32_t last_peer_tx_rate;
471 	uint32_t peer_tx_rate;
472 	uint32_t  peer_rssi;
473 	uint32_t tx_packet_count;
474 	uint32_t rx_packet_count;
475 	uint32_t tx_byte_count;
476 	uint32_t rx_byte_count;
477 	uint32_t per;
478 	uint8_t  rssi_changed;
479 };
480 
481 /* Tx completions per interrupt */
482 struct cdp_hist_tx_comp {
483 	uint32_t pkts_1;
484 	uint32_t pkts_2_20;
485 	uint32_t pkts_21_40;
486 	uint32_t pkts_41_60;
487 	uint32_t pkts_61_80;
488 	uint32_t pkts_81_100;
489 	uint32_t pkts_101_200;
490 	uint32_t pkts_201_plus;
491 };
492 
493 /* Rx ring descriptors reaped per interrupt */
494 struct cdp_hist_rx_ind {
495 	uint32_t pkts_1;
496 	uint32_t pkts_2_20;
497 	uint32_t pkts_21_40;
498 	uint32_t pkts_41_60;
499 	uint32_t pkts_61_80;
500 	uint32_t pkts_81_100;
501 	uint32_t pkts_101_200;
502 	uint32_t pkts_201_plus;
503 };
504 
505 struct cdp_htt_tlv_hdr {
506 	/* BIT [11 :  0]   :- tag
507 	 * BIT [23 : 12]   :- length
508 	 * BIT [31 : 24]   :- reserved
509 	 */
510 	uint32_t tag__length;
511 };
512 
513 #define HTT_STATS_SUBTYPE_MAX     16
514 
515 struct cdp_htt_rx_pdev_fw_stats_tlv {
516     struct cdp_htt_tlv_hdr tlv_hdr;
517 
518     /* BIT [ 7 :  0]   :- mac_id
519      * BIT [31 :  8]   :- reserved
520      */
521     uint32_t mac_id__word;
522     /* Num PPDU status processed from HW */
523     uint32_t ppdu_recvd;
524     /* Num MPDU across PPDUs with FCS ok */
525     uint32_t mpdu_cnt_fcs_ok;
526     /* Num MPDU across PPDUs with FCS err */
527     uint32_t mpdu_cnt_fcs_err;
528     /* Num MSDU across PPDUs */
529     uint32_t tcp_msdu_cnt;
530     /* Num MSDU across PPDUs */
531     uint32_t tcp_ack_msdu_cnt;
532     /* Num MSDU across PPDUs */
533     uint32_t udp_msdu_cnt;
534     /* Num MSDU across PPDUs */
535     uint32_t other_msdu_cnt;
536     /* Num MPDU on FW ring indicated */
537     uint32_t fw_ring_mpdu_ind;
538     /* Num MGMT MPDU given to protocol */
539     uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX];
540     /* Num ctrl MPDU given to protocol */
541     uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX];
542     /* Num mcast data packet received */
543     uint32_t fw_ring_mcast_data_msdu;
544     /* Num broadcast data packet received */
545     uint32_t fw_ring_bcast_data_msdu;
546     /* Num unicat data packet received */
547     uint32_t fw_ring_ucast_data_msdu;
548     /* Num null data packet received  */
549     uint32_t fw_ring_null_data_msdu;
550     /* Num MPDU on FW ring dropped */
551     uint32_t fw_ring_mpdu_drop;
552 
553     /* Num buf indication to offload */
554     uint32_t ofld_local_data_ind_cnt;
555     /* Num buf recycle from offload */
556     uint32_t ofld_local_data_buf_recycle_cnt;
557     /* Num buf indication to data_rx */
558     uint32_t drx_local_data_ind_cnt;
559     /* Num buf recycle from data_rx */
560     uint32_t drx_local_data_buf_recycle_cnt;
561     /* Num buf indication to protocol */
562     uint32_t local_nondata_ind_cnt;
563     /* Num buf recycle from protocol */
564     uint32_t local_nondata_buf_recycle_cnt;
565 
566     /* Num buf fed */
567     uint32_t fw_status_buf_ring_refill_cnt;
568     /* Num ring empty encountered */
569     uint32_t fw_status_buf_ring_empty_cnt;
570     /* Num buf fed  */
571     uint32_t fw_pkt_buf_ring_refill_cnt;
572     /* Num ring empty encountered */
573     uint32_t fw_pkt_buf_ring_empty_cnt;
574     /* Num buf fed  */
575     uint32_t fw_link_buf_ring_refill_cnt;
576     /* Num ring empty encountered  */
577     uint32_t fw_link_buf_ring_empty_cnt;
578 
579     /* Num buf fed */
580     uint32_t host_pkt_buf_ring_refill_cnt;
581     /* Num ring empty encountered */
582     uint32_t host_pkt_buf_ring_empty_cnt;
583     /* Num buf fed */
584     uint32_t mon_pkt_buf_ring_refill_cnt;
585     /* Num ring empty encountered */
586     uint32_t mon_pkt_buf_ring_empty_cnt;
587     /* Num buf fed */
588     uint32_t mon_status_buf_ring_refill_cnt;
589     /* Num ring empty encountered */
590     uint32_t mon_status_buf_ring_empty_cnt;
591     /* Num buf fed */
592     uint32_t mon_desc_buf_ring_refill_cnt;
593     /* Num ring empty encountered */
594     uint32_t mon_desc_buf_ring_empty_cnt;
595     /* Num buf fed */
596     uint32_t mon_dest_ring_update_cnt;
597     /* Num ring full encountered */
598     uint32_t mon_dest_ring_full_cnt;
599 
600     /* Num rx suspend is attempted */
601     uint32_t rx_suspend_cnt;
602     /* Num rx suspend failed */
603     uint32_t rx_suspend_fail_cnt;
604     /* Num rx resume attempted */
605     uint32_t rx_resume_cnt;
606     /* Num rx resume failed */
607     uint32_t rx_resume_fail_cnt;
608     /* Num rx ring switch */
609     uint32_t rx_ring_switch_cnt;
610     /* Num rx ring restore */
611     uint32_t rx_ring_restore_cnt;
612     /* Num rx flush issued */
613     uint32_t rx_flush_cnt;
614 };
615 
616 /* == TX PDEV STATS == */
617 struct cdp_htt_tx_pdev_stats_cmn_tlv {
618     struct cdp_htt_tlv_hdr tlv_hdr;
619 
620     /* BIT [ 7 :  0]   :- mac_id
621      * BIT [31 :  8]   :- reserved
622      */
623     uint32_t mac_id__word;
624     /* Num queued to HW */
625     uint32_t hw_queued;
626     /* Num PPDU reaped from HW */
627     uint32_t hw_reaped;
628     /* Num underruns */
629     uint32_t underrun;
630     /* Num HW Paused counter. */
631     uint32_t hw_paused;
632     /* Num HW flush counter. */
633     uint32_t hw_flush;
634     /* Num HW filtered counter. */
635     uint32_t hw_filt;
636     /* Num PPDUs cleaned up in TX abort */
637     uint32_t tx_abort;
638     /* Num MPDUs requed by SW */
639     uint32_t mpdu_requed;
640     /* excessive retries */
641     uint32_t tx_xretry;
642     /* Last used data hw rate code */
643     uint32_t data_rc;
644     /* frames dropped due to excessive sw retries */
645     uint32_t mpdu_dropped_xretry;
646     /* illegal rate phy errors  */
647     uint32_t illgl_rate_phy_err;
648     /* wal pdev continuous xretry */
649     uint32_t cont_xretry;
650     /* wal pdev continuous xretry */
651     uint32_t tx_timeout;
652     /* wal pdev resets  */
653     uint32_t pdev_resets;
654     /* PhY/BB underrun */
655     uint32_t phy_underrun;
656     /* MPDU is more than txop limit */
657     uint32_t txop_ovf;
658     /* Number of Sequences posted */
659     uint32_t seq_posted;
660     /* Number of Sequences failed queueing */
661     uint32_t seq_failed_queueing;
662     /* Number of Sequences completed */
663     uint32_t seq_completed;
664     /* Number of Sequences restarted */
665     uint32_t seq_restarted;
666     /* Number of MU Sequences posted */
667     uint32_t mu_seq_posted;
668     /* Number of time HW ring is paused between seq switch within ISR */
669     uint32_t seq_switch_hw_paused;
670     /* Number of times seq continuation in DSR */
671     uint32_t next_seq_posted_dsr;
672     /* Number of times seq continuation in ISR */
673     uint32_t seq_posted_isr;
674     /* Number of seq_ctrl cached. */
675     uint32_t seq_ctrl_cached;
676     /* Number of MPDUs successfully transmitted */
677     uint32_t mpdu_count_tqm;
678     /* Number of MSDUs successfully transmitted */
679     uint32_t msdu_count_tqm;
680     /* Number of MPDUs dropped */
681     uint32_t mpdu_removed_tqm;
682     /* Number of MSDUs dropped */
683     uint32_t msdu_removed_tqm;
684     /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
685     uint32_t mpdus_sw_flush;
686     /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
687     uint32_t mpdus_hw_filter;
688     /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
689     uint32_t mpdus_truncated;
690     /* Num MPDUs that was tried but didn't receive ACK or BA */
691     uint32_t mpdus_ack_failed;
692     /* Num MPDUs that was dropped due to expiry (MSDU TTL). */
693     uint32_t mpdus_expired;
694     /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */
695     uint32_t mpdus_seq_hw_retry;
696     /* Num of TQM acked cmds processed */
697     uint32_t ack_tlv_proc;
698     /* coex_abort_mpdu_cnt valid. */
699     uint32_t coex_abort_mpdu_cnt_valid;
700     /* coex_abort_mpdu_cnt from TX FES stats. */
701     uint32_t coex_abort_mpdu_cnt;
702     /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */
703     uint32_t num_total_ppdus_tried_ota;
704     /* Number of data PPDUs tried over the air (OTA) */
705     uint32_t num_data_ppdus_tried_ota;
706     /* Num Local control/mgmt frames (MSDUs) queued */
707     uint32_t local_ctrl_mgmt_enqued;
708     /* local_ctrl_mgmt_freed:
709      * Num Local control/mgmt frames (MSDUs) done
710      * It includes all local ctrl/mgmt completions
711      * (acked, no ack, flush, TTL, etc)
712      */
713     uint32_t local_ctrl_mgmt_freed;
714     /* Num Local data frames (MSDUs) queued */
715     uint32_t local_data_enqued;
716     /* local_data_freed:
717      * Num Local data frames (MSDUs) done
718      * It includes all local data completions
719      * (acked, no ack, flush, TTL, etc)
720      */
721     uint32_t local_data_freed;
722 };
723 
724 struct cdp_htt_tx_pdev_stats_urrn_tlv_v {
725     struct cdp_htt_tlv_hdr tlv_hdr;
726     uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */
727 };
728 
729 /* NOTE: Variable length TLV, use length spec to infer array size */
730 struct cdp_htt_tx_pdev_stats_flush_tlv_v {
731     struct cdp_htt_tlv_hdr tlv_hdr;
732     uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
733 };
734 
735 /* NOTE: Variable length TLV, use length spec to infer array size */
736 struct cdp_htt_tx_pdev_stats_sifs_tlv_v {
737     struct cdp_htt_tlv_hdr tlv_hdr;
738     uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
739 };
740 
741 /* NOTE: Variable length TLV, use length spec to infer array size */
742 struct cdp_htt_tx_pdev_stats_phy_err_tlv_v {
743     struct cdp_htt_tlv_hdr tlv_hdr;
744     uint32_t  phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
745 };
746 
747 /* == RX PDEV/SOC STATS == */
748 /* HTT_STATS_RX_SOC_FW_STATS_TAG */
749 struct cdp_htt_rx_soc_fw_stats_tlv {
750     struct cdp_htt_tlv_hdr tlv_hdr;
751     /* Num Packets received on REO FW ring */
752     uint32_t fw_reo_ring_data_msdu;
753     /* Num bc/mc packets indicated from fw to host */
754     uint32_t fw_to_host_data_msdu_bcmc;
755     /* Num unicast packets indicated from fw to host */
756     uint32_t fw_to_host_data_msdu_uc;
757     /* Num remote buf recycle from offload  */
758     uint32_t ofld_remote_data_buf_recycle_cnt;
759     /* Num remote free buf given to offload */
760     uint32_t ofld_remote_free_buf_indication_cnt;
761 };
762 
763 struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
764     struct cdp_htt_tlv_hdr tlv_hdr;
765     /* Num total buf refilled from refill ring */
766     uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
767 };
768 
769 struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
770     struct cdp_htt_tlv_hdr tlv_hdr;
771     /* Num error MPDU for each RxDMA error type  */
772     uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
773 };
774 
775 struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v {
776     struct cdp_htt_tlv_hdr tlv_hdr;
777     /* Num MPDU dropped  */
778     uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
779 };
780 
781 #define HTT_STATS_PHY_ERR_MAX 43
782 
783 struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv {
784     struct cdp_htt_tlv_hdr tlv_hdr;
785 
786     /* BIT [ 7 :  0]   :- mac_id
787      * BIT [31 :  8]   :- reserved
788      */
789     uint32_t mac_id__word;
790     /* Num of phy err */
791     uint32_t total_phy_err_cnt;
792     /* Counts of different types of phy errs
793      * The mapping of PHY error types to phy_err array elements is HW dependent.
794      * The only currently-supported mapping is shown below:
795      *
796      * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV
797      * 1 phyrx_err_synth_off
798      * 2 phyrx_err_ofdma_timing
799      * 3 phyrx_err_ofdma_signal_parity
800      * 4 phyrx_err_ofdma_rate_illegal
801      * 5 phyrx_err_ofdma_length_illegal
802      * 6 phyrx_err_ofdma_restart
803      * 7 phyrx_err_ofdma_service
804      * 8 phyrx_err_ppdu_ofdma_power_drop
805      * 9 phyrx_err_cck_blokker
806      * 10 phyrx_err_cck_timing
807      * 11 phyrx_err_cck_header_crc
808      * 12 phyrx_err_cck_rate_illegal
809      * 13 phyrx_err_cck_length_illegal
810      * 14 phyrx_err_cck_restart
811      * 15 phyrx_err_cck_service
812      * 16 phyrx_err_cck_power_drop
813      * 17 phyrx_err_ht_crc_err
814      * 18 phyrx_err_ht_length_illegal
815      * 19 phyrx_err_ht_rate_illegal
816      * 20 phyrx_err_ht_zlf
817      * 21 phyrx_err_false_radar_ext
818      * 22 phyrx_err_green_field
819      * 23 phyrx_err_bw_gt_dyn_bw
820      * 24 phyrx_err_leg_ht_mismatch
821      * 25 phyrx_err_vht_crc_error
822      * 26 phyrx_err_vht_siga_unsupported
823      * 27 phyrx_err_vht_lsig_len_invalid
824      * 28 phyrx_err_vht_ndp_or_zlf
825      * 29 phyrx_err_vht_nsym_lt_zero
826      * 30 phyrx_err_vht_rx_extra_symbol_mismatch
827      * 31 phyrx_err_vht_rx_skip_group_id0
828      * 32 phyrx_err_vht_rx_skip_group_id1to62
829      * 33 phyrx_err_vht_rx_skip_group_id63
830      * 34 phyrx_err_ofdm_ldpc_decoder_disabled
831      * 35 phyrx_err_defer_nap
832      * 36 phyrx_err_fdomain_timeout
833      * 37 phyrx_err_lsig_rel_check
834      * 38 phyrx_err_bt_collision
835      * 39 phyrx_err_unsupported_mu_feedback
836      * 40 phyrx_err_ppdu_tx_interrupt_rx
837      * 41 phyrx_err_unsupported_cbf
838      * 42 phyrx_err_other
839      */
840     uint32_t phy_err[HTT_STATS_PHY_ERR_MAX];
841 };
842 
843 struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v {
844     struct cdp_htt_tlv_hdr tlv_hdr;
845     /* Num ring empty encountered */
846     uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
847 };
848 
849 struct cdp_htt_tx_pdev_stats {
850     struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv;
851     struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv;
852     struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv;
853     struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv;
854     struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv;
855 };
856 
857 struct cdp_htt_rx_soc_stats_t {
858     struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv;
859     struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv;
860     struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv;
861 };
862 
863 struct cdp_htt_rx_pdev_stats {
864     struct cdp_htt_rx_soc_stats_t soc_stats;
865     struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv;
866     struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv;
867     struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop;
868     struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv;
869 };
870 
871 /* struct cdp_pdev_stats - pdev stats
872  * @msdu_not_done: packets dropped because msdu done bit not set
873  * @mec:Multicast Echo check
874  * @mesh_filter: Mesh Filtered packets
875  * @mon_rx_drop: packets dropped on monitor vap
876  * @pkts: total packets replenished
877  * @rxdma_err: rxdma errors for replenished
878  * @nbuf_alloc_fail: nbuf alloc failed
879  * @map_err: Mapping failure
880  * @x86_fail: x86 failures
881  * @low_thresh_intrs: low threshold interrupts
882  * @rx_raw_pkts: Rx Raw Packets
883  * @mesh_mem_alloc: Mesh Rx Stats Alloc fail
884  * @desc_alloc_fail: desc alloc failed errors
885  * @ip_csum_err: ip checksum errors
886  * @tcp_udp_csum_err: tcp/udp checksum errors
887  * @buf_freelist: buffers added back in freelist
888  * @tx_i: Tx Ingress stats
889  * @tx:CDP Tx Stats
890  * @rx: CDP Rx Stats
891  * @tx_comp_histogram: Number of Tx completions per interrupt
892  * @rx_ind_histogram:  Number of Rx ring descriptors reaped per interrupt
893  * @ppdu_stats_counter: ppdu stats counter
894  * @htt_tx_pdev_stats: htt pdev stats for tx
895  * @htt_rx_pdev_stats: htt pdev stats for rx
896  */
897 struct cdp_pdev_stats {
898 	struct {
899 		uint32_t msdu_not_done;
900 		uint32_t mec;
901 		uint32_t mesh_filter;
902 		uint32_t mon_rx_drop;
903 	} dropped;
904 
905 	struct {
906 		struct cdp_pkt_info pkts;
907 		uint32_t rxdma_err;
908 		uint32_t nbuf_alloc_fail;
909 		uint32_t map_err;
910 		uint32_t x86_fail;
911 		uint32_t low_thresh_intrs;
912 	} replenish;
913 
914 	uint32_t rx_raw_pkts;
915 	uint32_t mesh_mem_alloc;
916 
917 	/* Rx errors */
918 	struct {
919 		uint32_t desc_alloc_fail;
920 		uint32_t ip_csum_err;
921 		uint32_t tcp_udp_csum_err;
922 	} err;
923 
924 	uint32_t buf_freelist;
925 	struct cdp_tx_ingress_stats tx_i;
926 	struct cdp_tx_stats tx;
927 	struct cdp_rx_stats rx;
928 	struct cdp_hist_tx_comp tx_comp_histogram;
929 	struct cdp_hist_rx_ind rx_ind_histogram;
930 	uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG];
931 
932 	struct cdp_htt_tx_pdev_stats  htt_tx_pdev_stats;
933 	struct cdp_htt_rx_pdev_stats  htt_rx_pdev_stats;
934 };
935 
936 #ifndef BIG_ENDIAN_HOST
937 typedef struct {
938 	uint64_t pkts;
939 	uint64_t bytes;
940 } ol_txrx_stats_elem;
941 #else
942 struct ol_txrx_elem_t {
943 	uint64_t pkts;
944 	uint64_t bytes;
945 };
946 typedef struct ol_txrx_elem_t ol_txrx_stats_elem;
947 #endif
948 
949 #ifndef CONFIG_MCL
950 /**
951  * @brief data stats published by the host txrx layer
952  */
953 struct ol_txrx_stats {
954 	struct {
955 		/* MSDUs received from the stack */
956 		ol_txrx_stats_elem from_stack;
957 		/* MSDUs successfully sent across the WLAN */
958 		ol_txrx_stats_elem delivered;
959 		struct {
960 			/* MSDUs that the host did not accept */
961 			ol_txrx_stats_elem host_reject;
962 			/* MSDUs which could not be downloaded to the target */
963 			ol_txrx_stats_elem download_fail;
964 			/*
965 			 * MSDUs which the target discarded
966 			 * (lack of mem or old age)
967 			 */
968 			ol_txrx_stats_elem target_discard;
969 			/*
970 			 * MSDUs which the target sent but couldn't get
971 			 * an ack for
972 			 */
973 			ol_txrx_stats_elem no_ack;
974 			/* MSDUs dropped in NSS-FW */
975 			ol_txrx_stats_elem nss_ol_dropped;
976 		} dropped;
977 		u_int32_t desc_in_use;
978 		u_int32_t desc_alloc_fails;
979 		u_int32_t ce_ring_full;
980 		u_int32_t dma_map_error;
981 		/* MSDUs given to the txrx layer by the management stack */
982 		ol_txrx_stats_elem mgmt;
983 		struct {
984 			/* TSO applied jumbo packets received from NW Stack */
985 			ol_txrx_stats_elem tso_pkts;
986 			/* Non - TSO packets */
987 			ol_txrx_stats_elem non_tso_pkts;
988 			/* TSO packets : Dropped during TCP segmentation*/
989 			ol_txrx_stats_elem tso_dropped;
990 			/* TSO Descriptors */
991 			u_int32_t tso_desc_cnt;
992 		} tso;
993 
994 		struct {
995 			/* TSO applied jumbo packets received from NW Stack */
996 			ol_txrx_stats_elem sg_pkts;
997 			/* Non - TSO packets */
998 			ol_txrx_stats_elem non_sg_pkts;
999 			/* TSO packets : Dropped during TCP segmentation*/
1000 			ol_txrx_stats_elem sg_dropped;
1001 			/* TSO Descriptors */
1002 			u_int32_t sg_desc_cnt;
1003 		} sg;
1004 		struct {
1005 			/* packets enqueued for flow control */
1006 			u_int32_t fl_ctrl_enqueue;
1007 			/* packets discarded for flow control is full */
1008 			u_int32_t fl_ctrl_discard;
1009 			/* packets sent to CE without flow control */
1010 			u_int32_t fl_ctrl_avoid;
1011 		} fl_ctrl;
1012 	} tx;
1013 	struct {
1014 		/* MSDUs given to the OS shim */
1015 		ol_txrx_stats_elem delivered;
1016 		/* MSDUs forwarded from the rx path to the tx path */
1017 		ol_txrx_stats_elem forwarded;
1018 		/* MSDUs in which ipv4 chksum error detected by HW */
1019 		ol_txrx_stats_elem ipv4_cksum_err;
1020 		/* MSDUs in which tcp chksum error detected by HW */
1021 		ol_txrx_stats_elem tcp_ipv4_cksum_err;
1022 		/* MSDUs in which udp chksum error detected by HW */
1023 		ol_txrx_stats_elem udp_ipv4_cksum_err;
1024 		/* MSDUs in which tcp V6 chksum error detected by HW */
1025 		ol_txrx_stats_elem tcp_ipv6_cksum_err;
1026 		/* MSDUs in which UDP V6 chksum error detected by HW */
1027 		ol_txrx_stats_elem udp_ipv6_cksum_err;
1028 	} rx;
1029 	struct {
1030 		/* Number of mcast received for conversion */
1031 		u_int32_t num_me_rcvd;
1032 		/* Number of unicast sent as part of mcast conversion */
1033 		u_int32_t num_me_ucast;
1034 		/* Number of multicast frames dropped due to dma_map failure */
1035 		u_int32_t num_me_dropped_m;
1036 		/*
1037 		 * Number of multicast frames dropped due to allocation
1038 		 * failure
1039 		 */
1040 		u_int32_t num_me_dropped_a;
1041 		/* Number of multicast frames dropped due to internal failure */
1042 		u_int32_t num_me_dropped_i;
1043 		/* Number of me buf currently in use */
1044 		u_int32_t num_me_buf;
1045 		/* Number of me buf frames to self mac address  */
1046 		u_int32_t num_me_dropped_s;
1047 		/* Number of me buf in use in non pool based allocation*/
1048 		u_int32_t num_me_nonpool;
1049 		/* Number of me buf allocated using non pool based allocation*/
1050 		u_int32_t num_me_nonpool_count;
1051 	} mcast_enhance;
1052 };
1053 
1054 struct ol_ath_dbg_rx_rssi {
1055 	uint8_t     rx_rssi_pri20;
1056 	uint8_t     rx_rssi_sec20;
1057 	uint8_t     rx_rssi_sec40;
1058 	uint8_t     rx_rssi_sec80;
1059 };
1060 
1061 struct ol_ath_radiostats {
1062 	uint64_t    tx_beacon;
1063 	uint32_t    tx_buf_count;
1064 	int32_t     tx_mgmt;
1065 	int32_t     rx_mgmt;
1066 	uint32_t    rx_num_mgmt;
1067 	uint32_t    rx_num_ctl;
1068 	uint32_t    tx_rssi;
1069 	uint32_t    rx_rssi_comb;
1070 	struct      ol_ath_dbg_rx_rssi rx_rssi_chain0;
1071 	struct      ol_ath_dbg_rx_rssi rx_rssi_chain1;
1072 	struct      ol_ath_dbg_rx_rssi rx_rssi_chain2;
1073 	struct      ol_ath_dbg_rx_rssi rx_rssi_chain3;
1074 	uint32_t    rx_overrun;
1075 	uint32_t    rx_phyerr;
1076 	uint32_t    ackRcvBad;
1077 	uint32_t    rtsBad;
1078 	uint32_t    rtsGood;
1079 	uint32_t    fcsBad;
1080 	uint32_t    noBeacons;
1081 	uint32_t    mib_int_count;
1082 	uint32_t    rx_looplimit_start;
1083 	uint32_t    rx_looplimit_end;
1084 	uint8_t     ap_stats_tx_cal_enable;
1085 	uint8_t     self_bss_util;
1086 	uint8_t     obss_util;
1087 	uint32_t    tgt_asserts;
1088 	int16_t     chan_nf;
1089 	int16_t     chan_nf_sec80;
1090 	uint64_t    wmi_tx_mgmt;
1091 	uint64_t    wmi_tx_mgmt_completions;
1092 	uint32_t    wmi_tx_mgmt_completion_err;
1093 	uint32_t    peer_delete_req;
1094 	uint32_t    peer_delete_resp;
1095 	uint32_t    rx_mgmt_rssi_drop;
1096 	uint32_t    tx_frame_count;
1097 	uint32_t    rx_frame_count;
1098 	uint32_t    rx_clear_count;
1099 	uint32_t    cycle_count;
1100 	uint32_t    phy_err_count;
1101 	uint32_t    chan_tx_pwr;
1102 	uint32_t    be_nobuf;
1103 	uint32_t    tx_packets;
1104 	uint32_t    rx_packets;
1105 	uint32_t    tx_num_data;
1106 	uint32_t    rx_num_data;
1107 	uint32_t    tx_mcs[10];
1108 	uint32_t    rx_mcs[10];
1109 	uint64_t    rx_bytes;
1110 	uint64_t    tx_bytes;
1111 	uint32_t    tx_compaggr;
1112 	uint32_t    rx_aggr;
1113 	uint32_t    tx_bawadv;
1114 	uint32_t    tx_compunaggr;
1115 	uint32_t    rx_badcrypt;
1116 	uint32_t    rx_badmic;
1117 	uint32_t    rx_crcerr;
1118 	uint32_t    rx_last_msdu_unset_cnt;
1119 	uint32_t    rx_data_bytes;
1120 	uint32_t    tx_retries;
1121 };
1122 
1123 /*
1124  * Enumeration of PDEV Configuration parameter
1125  */
1126 enum _ol_ath_param_t {
1127 	OL_ATH_PARAM_TXCHAINMASK               = 1,
1128 	OL_ATH_PARAM_RXCHAINMASK               = 2,
1129 	OL_ATH_PARAM_AMPDU                     = 6,
1130 	OL_ATH_PARAM_AMPDU_LIMIT               = 7,
1131 	OL_ATH_PARAM_AMPDU_SUBFRAMES           = 8,
1132 	OL_ATH_PARAM_TXPOWER_LIMIT2G           = 12,
1133 	OL_ATH_PARAM_TXPOWER_LIMIT5G           = 13,
1134 	OL_ATH_PARAM_LDPC                      = 32,
1135 	OL_ATH_PARAM_VOW_EXT_STATS             = 45,
1136 	OL_ATH_PARAM_DYN_TX_CHAINMASK          = 73,
1137 	OL_ATH_PARAM_BURST_ENABLE              = 77,
1138 	OL_ATH_PARAM_BURST_DUR                 = 78,
1139 	OL_ATH_PARAM_BCN_BURST                 = 80,
1140 	OL_ATH_PARAM_DCS                       = 82,
1141 #if UMAC_SUPPORT_PERIODIC_PERFSTATS
1142 	OL_ATH_PARAM_PRDPERFSTAT_THRPUT_ENAB   = 83,
1143 	OL_ATH_PARAM_PRDPERFSTAT_THRPUT_WIN    = 84,
1144 	OL_ATH_PARAM_PRDPERFSTAT_THRPUT        = 85,
1145 	OL_ATH_PARAM_PRDPERFSTAT_PER_ENAB      = 86,
1146 	OL_ATH_PARAM_PRDPERFSTAT_PER_WIN       = 87,
1147 	OL_ATH_PARAM_PRDPERFSTAT_PER           = 88,
1148 #endif
1149 	/* UMAC_SUPPORT_PERIODIC_PERFSTATS */
1150 	OL_ATH_PARAM_TOTAL_PER                 = 89,
1151 	/* set manual rate for rts frame */
1152 	OL_ATH_PARAM_RTS_CTS_RATE              = 92,
1153 	/* co channel interference threshold level */
1154 	OL_ATH_PARAM_DCS_COCH_THR              = 93,
1155 	/* transmit error threshold */
1156 	OL_ATH_PARAM_DCS_TXERR_THR             = 94,
1157 	/* phy error threshold */
1158 	OL_ATH_PARAM_DCS_PHYERR_THR            = 95,
1159 	/*
1160 	 * The IOCTL number is 114, it is made 114, inorder to make the IOCTL
1161 	 * number same as Direct-attach IOCTL.
1162 	 * Please, don't change number. This IOCTL gets the Interface code path
1163 	 * it should be either DIRECT-ATTACH or OFF-LOAD.
1164 	 */
1165 	OL_ATH_PARAM_GET_IF_ID                 = 114,
1166 	/* Enable Acs back Ground Channel selection Scan timer in AP mode*/
1167 	OL_ATH_PARAM_ACS_ENABLE_BK_SCANTIMEREN = 118,
1168 	 /* ACS scan timer value in Seconds */
1169 	OL_ATH_PARAM_ACS_SCANTIME              = 119,
1170 	 /* Negligence Delta RSSI between two channel */
1171 	OL_ATH_PARAM_ACS_RSSIVAR               = 120,
1172 	 /* Negligence Delta Channel load between two channel*/
1173 	OL_ATH_PARAM_ACS_CHLOADVAR             = 121,
1174 	  /* Enable Limited OBSS check */
1175 	OL_ATH_PARAM_ACS_LIMITEDOBSS           = 122,
1176 	/* Acs control flag for Scan timer */
1177 	OL_ATH_PARAM_ACS_CTRLFLAG              = 123,
1178 	 /* Acs Run time Debug level*/
1179 	OL_ATH_PARAM_ACS_DEBUGTRACE            = 124,
1180 	OL_ATH_PARAM_SET_FW_HANG_ID            = 137,
1181 	 /* Radio type 1:11ac 0:11abgn */
1182 	OL_ATH_PARAM_RADIO_TYPE                = 138,
1183 	OL_ATH_PARAM_IGMPMLD_OVERRIDE, /* IGMP/MLD packet override */
1184 	OL_ATH_PARAM_IGMPMLD_TID, /* IGMP/MLD packet TID no */
1185 	OL_ATH_PARAM_ARPDHCP_AC_OVERRIDE,
1186 	OL_ATH_PARAM_NON_AGG_SW_RETRY_TH,
1187 	OL_ATH_PARAM_AGG_SW_RETRY_TH,
1188 	/* Dont change this number it as per sync with DA
1189 	     Blocking certian channel from ic channel list */
1190 	OL_ATH_PARAM_DISABLE_DFS   = 144,
1191 	OL_ATH_PARAM_ENABLE_AMSDU  = 145,
1192 	OL_ATH_PARAM_ENABLE_AMPDU  = 146,
1193 	OL_ATH_PARAM_STA_KICKOUT_TH,
1194 	OL_ATH_PARAM_WLAN_PROF_ENABLE,
1195 	OL_ATH_PARAM_LTR_ENABLE,
1196 	OL_ATH_PARAM_LTR_AC_LATENCY_BE = 150,
1197 	OL_ATH_PARAM_LTR_AC_LATENCY_BK,
1198 	OL_ATH_PARAM_LTR_AC_LATENCY_VI,
1199 	OL_ATH_PARAM_LTR_AC_LATENCY_VO,
1200 	OL_ATH_PARAM_LTR_AC_LATENCY_TIMEOUT,
1201 	OL_ATH_PARAM_LTR_TX_ACTIVITY_TIMEOUT = 155,
1202 	OL_ATH_PARAM_LTR_SLEEP_OVERRIDE,
1203 	OL_ATH_PARAM_LTR_RX_OVERRIDE,
1204 	OL_ATH_PARAM_L1SS_ENABLE,
1205 	OL_ATH_PARAM_DSLEEP_ENABLE,
1206 	/* radar error threshold */
1207 	OL_ATH_PARAM_DCS_RADAR_ERR_THR = 160,
1208 	/* Tx channel utilization due to AP's tx and rx */
1209 	OL_ATH_PARAM_DCS_USERMAX_CU_THR,
1210 	/* interference detection threshold */
1211 	OL_ATH_PARAM_DCS_INTR_DETECT_THR,
1212 	/* sampling window, default 10secs */
1213 	OL_ATH_PARAM_DCS_SAMPLE_WINDOW,
1214 	/* debug logs enable/disable */
1215 	OL_ATH_PARAM_DCS_DEBUG,
1216 	OL_ATH_PARAM_ANI_ENABLE = 165,
1217 	OL_ATH_PARAM_ANI_POLL_PERIOD,
1218 	OL_ATH_PARAM_ANI_LISTEN_PERIOD,
1219 	OL_ATH_PARAM_ANI_OFDM_LEVEL,
1220 	OL_ATH_PARAM_ANI_CCK_LEVEL,
1221 	OL_ATH_PARAM_DSCP_TID_MAP = 170,
1222 	OL_ATH_PARAM_TXPOWER_SCALE,
1223 	/* Phy error penalty */
1224 	OL_ATH_PARAM_DCS_PHYERR_PENALTY,
1225 #if ATH_SUPPORT_DSCP_OVERRIDE
1226 	/* set/get TID for sending HMMC packets */
1227 	OL_ATH_PARAM_HMMC_DSCP_TID_MAP,
1228 	/* set/get DSCP mapping override */
1229 	OL_ATH_PARAM_DSCP_OVERRIDE,
1230 	/* set/get HMMC-DSCP mapping override */
1231 	OL_ATH_PARAM_HMMC_DSCP_OVERRIDE = 175,
1232 #endif
1233 #if ATH_RX_LOOPLIMIT_TIMER
1234 	OL_ATH_PARAM_LOOPLIMIT_NUM,
1235 #endif
1236 	OL_ATH_PARAM_ANTENNA_GAIN_2G,
1237 	OL_ATH_PARAM_ANTENNA_GAIN_5G,
1238 	OL_ATH_PARAM_RX_FILTER,
1239 #if ATH_SUPPORT_HYFI_ENHANCEMENTS
1240 	OL_ATH_PARAM_BUFF_THRESH = 180,
1241 	OL_ATH_PARAM_BLK_REPORT_FLOOD,
1242 	OL_ATH_PARAM_DROP_STA_QUERY,
1243 #endif
1244 	OL_ATH_PARAM_QBOOST,
1245 	OL_ATH_PARAM_SIFS_FRMTYPE,
1246 	OL_ATH_PARAM_SIFS_UAPSD = 185,
1247 	OL_ATH_PARAM_FW_RECOVERY_ID,
1248 	OL_ATH_PARAM_RESET_OL_STATS,
1249 	OL_ATH_PARAM_AGGR_BURST,
1250 	/* Number of deauth sent in consecutive rx_peer_invalid */
1251 	OL_ATH_PARAM_DEAUTH_COUNT,
1252 	OL_ATH_PARAM_BLOCK_INTERBSS = 190,
1253 	/* Firmware reset control for Bmiss / timeout / reset */
1254 	OL_ATH_PARAM_FW_DISABLE_RESET,
1255 	OL_ATH_PARAM_MSDU_TTL,
1256 	OL_ATH_PARAM_PPDU_DURATION,
1257 	OL_ATH_PARAM_SET_TXBF_SND_PERIOD,
1258 	OL_ATH_PARAM_ALLOW_PROMISC = 195,
1259 	OL_ATH_PARAM_BURST_MODE,
1260 	OL_ATH_PARAM_DYN_GROUPING,
1261 	OL_ATH_PARAM_DPD_ENABLE,
1262 	OL_ATH_PARAM_DBGLOG_RATELIM,
1263 	/* firmware should intimate us about ps state change for node  */
1264 	OL_ATH_PARAM_PS_STATE_CHANGE = 200,
1265 	OL_ATH_PARAM_MCAST_BCAST_ECHO,
1266 	/* OBSS RSSI threshold for 20/40 coexistence */
1267 	OL_ATH_PARAM_OBSS_RSSI_THRESHOLD,
1268 	/* Link/node RX RSSI threshold  for 20/40 coexistence */
1269 	OL_ATH_PARAM_OBSS_RX_RSSI_THRESHOLD,
1270 #if ATH_CHANNEL_BLOCKING
1271 	OL_ATH_PARAM_ACS_BLOCK_MODE = 205,
1272 #endif
1273 	OL_ATH_PARAM_ACS_TX_POWER_OPTION,
1274 	/*
1275 	 * Default Antenna Polarization MSB 8 bits (24:31) specifying
1276 	 * enable/disable ; LSB 24 bits (0:23) antenna mask value
1277 	 */
1278 	OL_ATH_PARAM_ANT_POLARIZATION,
1279 	/* rate limit mute type error prints */
1280 	OL_ATH_PARAM_PRINT_RATE_LIMIT,
1281 	OL_ATH_PARAM_PDEV_RESET,   /* Reset FW PDEV*/
1282 	/* Do not crash host when target assert happened*/
1283 	OL_ATH_PARAM_FW_DUMP_NO_HOST_CRASH = 210,
1284 	/* Consider OBSS non-erp to change to long slot*/
1285 	OL_ATH_PARAM_CONSIDER_OBSS_NON_ERP_LONG_SLOT = 211,
1286 	OL_ATH_PARAM_STATS_FC,
1287 	OL_ATH_PARAM_QFLUSHINTERVAL,
1288 	OL_ATH_PARAM_TOTAL_Q_SIZE,
1289 	OL_ATH_PARAM_TOTAL_Q_SIZE_RANGE0,
1290 	OL_ATH_PARAM_TOTAL_Q_SIZE_RANGE1,
1291 	OL_ATH_PARAM_TOTAL_Q_SIZE_RANGE2,
1292 	OL_ATH_PARAM_TOTAL_Q_SIZE_RANGE3,
1293 	OL_ATH_PARAM_MIN_THRESHOLD,
1294 	OL_ATH_PARAM_MAX_Q_LIMIT,
1295 	OL_ATH_PARAM_MIN_Q_LIMIT,
1296 	OL_ATH_PARAM_CONG_CTRL_TIMER_INTV,
1297 	OL_ATH_PARAM_STATS_TIMER_INTV,
1298 	OL_ATH_PARAM_ROTTING_TIMER_INTV,
1299 	OL_ATH_PARAM_LATENCY_PROFILE,
1300 	OL_ATH_PARAM_HOSTQ_DUMP,
1301 	OL_ATH_PARAM_TIDQ_MAP,
1302 	OL_ATH_PARAM_DBG_ARP_SRC_ADDR, /* ARP DEBUG source address*/
1303 	OL_ATH_PARAM_DBG_ARP_DST_ADDR, /* ARP DEBUG destination address*/
1304 	OL_ATH_PARAM_ARP_DBG_CONF,   /* ARP debug configuration */
1305 	OL_ATH_PARAM_DISABLE_STA_VAP_AMSDU, /* Disable AMSDU for station vap */
1306 #if ATH_SUPPORT_DFS && ATH_SUPPORT_STA_DFS
1307 	OL_ATH_PARAM_STADFS_ENABLE = 300,    /* STA DFS is enabled or not  */
1308 #endif
1309 #if QCA_AIRTIME_FAIRNESS
1310 	OL_ATH_PARAM_ATF_STRICT_SCHED = 301,
1311 	OL_ATH_PARAM_ATF_GROUP_POLICY = 302,
1312 #endif
1313 #if DBDC_REPEATER_SUPPORT
1314 	OL_ATH_PARAM_PRIMARY_RADIO,
1315 	OL_ATH_PARAM_DBDC_ENABLE,
1316 #endif
1317 	OL_ATH_PARAM_TXPOWER_DBSCALE,
1318 	OL_ATH_PARAM_CTL_POWER_SCALE,
1319 #if QCA_AIRTIME_FAIRNESS
1320 	OL_ATH_PARAM_ATF_OBSS_SCHED = 307,
1321 	OL_ATH_PARAM_ATF_OBSS_SCALE = 308,
1322 #endif
1323 	OL_ATH_PARAM_PHY_OFDM_ERR = 309,
1324 	OL_ATH_PARAM_PHY_CCK_ERR = 310,
1325 	OL_ATH_PARAM_FCS_ERR = 311,
1326 	OL_ATH_PARAM_CHAN_UTIL = 312,
1327 #if DBDC_REPEATER_SUPPORT
1328 	OL_ATH_PARAM_CLIENT_MCAST,
1329 #endif
1330 	OL_ATH_PARAM_EMIWAR_80P80 = 314,
1331 	OL_ATH_PARAM_BATCHMODE = 315,
1332 	OL_ATH_PARAM_PACK_AGGR_DELAY = 316,
1333 #if UMAC_SUPPORT_ACFG
1334 	OL_ATH_PARAM_DIAG_ENABLE = 317,
1335 #endif
1336 #if ATH_SUPPORT_VAP_QOS
1337 	OL_ATH_PARAM_VAP_QOS = 318,
1338 #endif
1339 	OL_ATH_PARAM_CHAN_STATS_TH = 319,
1340 	/* Passive scan is enabled or disabled  */
1341 	OL_ATH_PARAM_PASSIVE_SCAN_ENABLE = 320,
1342 	OL_ATH_MIN_RSSI_ENABLE = 321,
1343 	OL_ATH_MIN_RSSI = 322,
1344 	OL_ATH_PARAM_ACS_2G_ALLCHAN = 323,
1345 #if DBDC_REPEATER_SUPPORT
1346 	OL_ATH_PARAM_DELAY_STAVAP_UP = 324,
1347 #endif
1348 	/* It is used to set the channel switch options */
1349 	OL_ATH_PARAM_CHANSWITCH_OPTIONS = 327,
1350 	OL_ATH_BTCOEX_ENABLE        = 328,
1351 	OL_ATH_BTCOEX_WL_PRIORITY   = 329,
1352 	OL_ATH_PARAM_TID_OVERRIDE_QUEUE_MAPPING = 330,
1353 	OL_ATH_PARAM_CAL_VER_CHECK = 331,
1354 	OL_ATH_PARAM_NO_VLAN       = 332,
1355 	OL_ATH_PARAM_CCA_THRESHOLD = 333,
1356 	OL_ATH_PARAM_ATF_LOGGING = 334,
1357 	OL_ATH_PARAM_STRICT_DOTH = 335,
1358 	OL_ATH_PARAM_DISCONNECTION_TIMEOUT   = 336,
1359 	OL_ATH_PARAM_RECONFIGURATION_TIMEOUT = 337,
1360 	OL_ATH_PARAM_CHANNEL_SWITCH_COUNT = 338,
1361 	OL_ATH_PARAM_ALWAYS_PRIMARY = 339,
1362 	OL_ATH_PARAM_FAST_LANE = 340,
1363 	OL_ATH_GET_BTCOEX_DUTY_CYCLE = 341,
1364 	OL_ATH_PARAM_SECONDARY_OFFSET_IE = 342,
1365 	OL_ATH_PARAM_WIDE_BAND_SUB_ELEMENT = 343,
1366 	OL_ATH_PARAM_PREFERRED_UPLINK = 344,
1367 	OL_ATH_PARAM_PRECAC_ENABLE = 345,
1368 	OL_ATH_PARAM_PRECAC_TIMEOUT = 346,
1369 	OL_ATH_COEX_VER_CFG = 347,
1370 	OL_ATH_PARAM_DUMP_TARGET = 348,
1371 	OL_ATH_PARAM_PDEV_TO_REO_DEST = 349,
1372 	OL_ATH_PARAM_DUMP_CHAINMASK_TABLES = 350,
1373 	OL_ATH_PARAM_DUMP_OBJECTS = 351,
1374 	OL_ATH_PARAM_ACS_SRLOADVAR = 352,
1375 	OL_ATH_PARAM_MGMT_RSSI_THRESHOLD = 353,
1376 	OL_ATH_PARAM_EXT_NSS_CAPABLE = 354,
1377 	OL_ATH_PARAM_MGMT_PDEV_STATS_TIMER = 355,
1378 	OL_ATH_PARAM_TXACKTIMEOUT = 356,
1379 	OL_ATH_PARAM_ICM_ACTIVE = 357,
1380 	OL_ATH_PARAM_NOMINAL_NOISEFLOOR = 358,
1381 	OL_ATH_PARAM_CHAN_INFO = 359,
1382 	OL_ATH_PARAM_ACS_RANK = 360,
1383 	OL_ATH_PARAM_TXCHAINSOFT = 361,
1384 	OL_ATH_PARAM_WIDE_BAND_SCAN = 362,
1385 	OL_ATH_PARAM_CCK_TX_ENABLE = 363,
1386 	OL_ATH_PARAM_PAPI_ENABLE = 364,
1387 	OL_ATH_PARAM_ISOLATION = 365,
1388 	OL_ATH_PARAM_MAX_CLIENTS_PER_RADIO = 366,
1389 #if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
1390 	OL_ATH_PARAM_DFS_HOST_WAIT_TIMEOUT = 367,
1391 #endif
1392 	OL_ATH_PARAM_NF_THRESH = 368,
1393 #ifdef OL_ATH_SMART_LOGGING
1394 	OL_ATH_PARAM_SMARTLOG_ENABLE = 369,
1395 	OL_ATH_PARAM_SMARTLOG_FATAL_EVENT = 370,
1396 	OL_ATH_PARAM_SMARTLOG_SKB_SZ = 371,
1397 	OL_ATH_PARAM_SMARTLOG_P1PINGFAIL = 372,
1398 #endif /* OL_ATH_SMART_LOGGING */
1399 #ifdef WLAN_DFS_PRECAC_AUTO_CHAN_SUPPORT
1400 	OL_ATH_PARAM_PRECAC_INTER_CHANNEL = 373,
1401 	OL_ATH_PARAM_PRECAC_CHAN_STATE = 374,
1402 #endif
1403 	OL_ATH_PARAM_DBR_RING_STATUS = 375,
1404 #ifdef QCN_ESP_IE
1405 	OL_ATH_PARAM_ESP_PERIODICITY = 376,
1406 	OL_ATH_PARAM_ESP_AIRTIME = 377,
1407 	OL_ATH_PARAM_ESP_PPDU_DURATION = 378,
1408 	OL_ATH_PARAM_ESP_BA_WINDOW = 379,
1409 #endif /* QCN_ESP_IE */
1410 
1411 	OL_ATH_PARAM_CBS = 380,
1412 	OL_ATH_PARAM_DCS_SIM = 381,
1413 	OL_ATH_PARAM_CBS_DWELL_SPLIT_TIME = 382,
1414 	OL_ATH_PARAM_CBS_DWELL_REST_TIME = 383,
1415 	OL_ATH_PARAM_CBS_WAIT_TIME = 384,
1416 	OL_ATH_PARAM_CBS_REST_TIME = 385,
1417 	OL_ATH_PARAM_CBS_CSA = 386,
1418 	OL_ATH_PARAM_TWICE_ANTENNA_GAIN = 387,
1419 	OL_ATH_PARAM_ACTIVITY_FACTOR = 388,
1420 };
1421 
1422 /* Enumeration of PDEV Configuration parameter */
1423 enum _ol_hal_param_t {
1424 	OL_HAL_CONFIG_DMA_BEACON_RESPONSE_TIME         = 0
1425 };
1426 #endif
1427 
1428 /* Bitmasks for stats that can block */
1429 #define EXT_TXRX_FW_STATS		0x0001
1430 #endif
1431