xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/dp_types.h (revision 45a38684b07295822dc8eba39e293408f203eec8)
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 #ifndef _DP_TYPES_H_
20 #define _DP_TYPES_H_
21 
22 #include <qdf_types.h>
23 #include <qdf_nbuf.h>
24 #include <qdf_lock.h>
25 #include <qdf_atomic.h>
26 #include <qdf_util.h>
27 #include <qdf_list.h>
28 #include <qdf_lro.h>
29 #include <queue.h>
30 #include <htt_common.h>
31 
32 #include <cdp_txrx_cmn.h>
33 #ifdef DP_MOB_DEFS
34 #include <cds_ieee80211_common.h>
35 #endif
36 #include <wdi_event_api.h>    /* WDI subscriber event list */
37 
38 #include "hal_hw_headers.h"
39 #include <hal_tx.h>
40 #include <hal_reo.h>
41 #include "wlan_cfg.h"
42 #include "hal_rx.h"
43 #include <hal_api.h>
44 #include <hal_api_mon.h>
45 #include "hal_rx.h"
46 //#include "hal_rx_flow.h"
47 
48 #define MAX_BW 7
49 #define MAX_RETRIES 4
50 #define MAX_RECEPTION_TYPES 4
51 
52 #define MINIDUMP_STR_SIZE 25
53 #ifndef REMOVE_PKT_LOG
54 #include <pktlog.h>
55 #endif
56 
57 #ifdef WLAN_TX_PKT_CAPTURE_ENH
58 #include "dp_tx_capture.h"
59 #endif
60 
61 #define REPT_MU_MIMO 1
62 #define REPT_MU_OFDMA_MIMO 3
63 #define DP_VO_TID 6
64  /** MAX TID MAPS AVAILABLE PER PDEV */
65 #define DP_MAX_TID_MAPS 16
66 /** pad DSCP_TID_MAP_MAX with 6 to fix oob issue */
67 #define DSCP_TID_MAP_MAX (64 + 6)
68 #define DP_IP_DSCP_SHIFT 2
69 #define DP_IP_DSCP_MASK 0x3f
70 #define DP_FC0_SUBTYPE_QOS 0x80
71 #define DP_QOS_TID 0x0f
72 #define DP_IPV6_PRIORITY_SHIFT 20
73 #define MAX_MON_LINK_DESC_BANKS 2
74 #define DP_VDEV_ALL 0xff
75 
76 #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
77 #define MAX_PDEV_CNT 1
78 #else
79 #define MAX_PDEV_CNT 3
80 #endif
81 
82 /* Max no. of VDEV per PSOC */
83 #ifdef WLAN_PSOC_MAX_VDEVS
84 #define MAX_VDEV_CNT WLAN_PSOC_MAX_VDEVS
85 #else
86 #define MAX_VDEV_CNT 51
87 #endif
88 
89 #define MAX_TXDESC_POOLS 4
90 #define MAX_RXDESC_POOLS 4
91 #define MAX_REO_DEST_RINGS 4
92 #define EXCEPTION_DEST_RING_ID 0
93 #define MAX_TCL_DATA_RINGS 4
94 #define MAX_IDLE_SCATTER_BUFS 16
95 #define DP_MAX_IRQ_PER_CONTEXT 12
96 #define DEFAULT_HW_PEER_ID 0xffff
97 
98 #define WBM_INT_ERROR_ALL 0
99 #define WBM_INT_ERROR_REO_NULL_BUFFER 1
100 #define WBM_INT_ERROR_REO_NULL_LINK_DESC 2
101 #define WBM_INT_ERROR_REO_NULL_MSDU_BUFF 3
102 #define WBM_INT_ERROR_REO_BUFF_REAPED 4
103 #define MAX_WBM_INT_ERROR_REASONS 5
104 
105 #define MAX_TX_HW_QUEUES MAX_TCL_DATA_RINGS
106 /* Maximum retries for Delba per tid per peer */
107 #define DP_MAX_DELBA_RETRY 3
108 
109 #define PCP_TID_MAP_MAX 8
110 #define MAX_MU_USERS 37
111 
112 #define REO_CMD_EVENT_HIST_MAX 64
113 
114 /* 2G PHYB */
115 #define PHYB_2G_LMAC_ID 2
116 #define PHYB_2G_TARGET_PDEV_ID 2
117 
118 enum rx_pktlog_mode {
119 	DP_RX_PKTLOG_DISABLED = 0,
120 	DP_RX_PKTLOG_FULL,
121 	DP_RX_PKTLOG_LITE,
122 };
123 
124 /* enum m_copy_mode - Available mcopy mode
125  *
126  */
127 enum m_copy_mode {
128 	M_COPY_DISABLED = 0,
129 	M_COPY = 2,
130 	M_COPY_EXTENDED = 4,
131 };
132 
133 struct msdu_list {
134 	qdf_nbuf_t head;
135 	qdf_nbuf_t tail;
136 	uint32 sum_len;
137 };
138 
139 struct dp_soc_cmn;
140 struct dp_pdev;
141 struct dp_vdev;
142 struct dp_tx_desc_s;
143 struct dp_soc;
144 union dp_rx_desc_list_elem_t;
145 struct cdp_peer_rate_stats_ctx;
146 struct cdp_soc_rate_stats_ctx;
147 struct dp_rx_fst;
148 struct dp_mon_filter;
149 struct dp_mon_mpdu;
150 
151 #define DP_PDEV_ITERATE_VDEV_LIST(_pdev, _vdev) \
152 	TAILQ_FOREACH((_vdev), &(_pdev)->vdev_list, vdev_list_elem)
153 
154 #define DP_VDEV_ITERATE_PEER_LIST(_vdev, _peer) \
155 	TAILQ_FOREACH((_peer), &(_vdev)->peer_list, peer_list_elem)
156 
157 #define DP_PEER_ITERATE_ASE_LIST(_peer, _ase, _temp_ase) \
158 	TAILQ_FOREACH_SAFE((_ase), &peer->ast_entry_list, ase_list_elem, (_temp_ase))
159 
160 #define DP_MUTEX_TYPE qdf_spinlock_t
161 
162 #define DP_FRAME_IS_MULTICAST(_a)  (*(_a) & 0x01)
163 #define DP_FRAME_IS_IPV4_MULTICAST(_a)  (*(_a) == 0x01)
164 
165 #define DP_FRAME_IS_IPV6_MULTICAST(_a)         \
166     ((_a)[0] == 0x33 &&                         \
167      (_a)[1] == 0x33)
168 
169 #define DP_FRAME_IS_BROADCAST(_a)              \
170     ((_a)[0] == 0xff &&                         \
171      (_a)[1] == 0xff &&                         \
172      (_a)[2] == 0xff &&                         \
173      (_a)[3] == 0xff &&                         \
174      (_a)[4] == 0xff &&                         \
175      (_a)[5] == 0xff)
176 #define DP_FRAME_IS_SNAP(_llc) ((_llc)->llc_dsap == 0xaa && \
177 		(_llc)->llc_ssap == 0xaa && \
178 		(_llc)->llc_un.type_snap.control == 0x3)
179 #define DP_FRAME_IS_LLC(typeorlen) ((typeorlen) >= 0x600)
180 #define DP_FRAME_FC0_TYPE_MASK 0x0c
181 #define DP_FRAME_FC0_TYPE_DATA 0x08
182 #define DP_FRAME_IS_DATA(_frame) \
183 	(((_frame)->i_fc[0] & DP_FRAME_FC0_TYPE_MASK) == DP_FRAME_FC0_TYPE_DATA)
184 
185 /**
186  * macros to convert hw mac id to sw mac id:
187  * mac ids used by hardware start from a value of 1 while
188  * those in host software start from a value of 0. Use the
189  * macros below to convert between mac ids used by software and
190  * hardware
191  */
192 #define DP_SW2HW_MACID(id) ((id) + 1)
193 #define DP_HW2SW_MACID(id) ((id) > 0 ? ((id) - 1) : 0)
194 
195 /**
196  * Number of Tx Queues
197  * enum and macro to define how many threshold levels is used
198  * for the AC based flow control
199  */
200 #ifdef QCA_AC_BASED_FLOW_CONTROL
201 enum dp_fl_ctrl_threshold {
202 	DP_TH_BE_BK = 0,
203 	DP_TH_VI,
204 	DP_TH_VO,
205 	DP_TH_HI,
206 };
207 
208 #define FL_TH_MAX (4)
209 #define FL_TH_VI_PERCENTAGE (80)
210 #define FL_TH_VO_PERCENTAGE (60)
211 #define FL_TH_HI_PERCENTAGE (40)
212 #endif
213 
214 /**
215  * enum dp_intr_mode
216  * @DP_INTR_INTEGRATED: Line interrupts
217  * @DP_INTR_MSI: MSI interrupts
218  * @DP_INTR_POLL: Polling
219  */
220 enum dp_intr_mode {
221 	DP_INTR_INTEGRATED = 0,
222 	DP_INTR_MSI,
223 	DP_INTR_POLL,
224 };
225 
226 /**
227  * enum dp_tx_frm_type
228  * @dp_tx_frm_std: Regular frame, no added header fragments
229  * @dp_tx_frm_tso: TSO segment, with a modified IP header added
230  * @dp_tx_frm_sg: SG segment
231  * @dp_tx_frm_audio: Audio frames, a custom LLC/SNAP header added
232  * @dp_tx_frm_me: Multicast to Unicast Converted frame
233  * @dp_tx_frm_raw: Raw Frame
234  */
235 enum dp_tx_frm_type {
236 	dp_tx_frm_std = 0,
237 	dp_tx_frm_tso,
238 	dp_tx_frm_sg,
239 	dp_tx_frm_audio,
240 	dp_tx_frm_me,
241 	dp_tx_frm_raw,
242 };
243 
244 /**
245  * enum dp_ast_type
246  * @dp_ast_type_wds: WDS peer AST type
247  * @dp_ast_type_static: static ast entry type
248  * @dp_ast_type_mec: Multicast echo ast entry type
249  */
250 enum dp_ast_type {
251 	dp_ast_type_wds = 0,
252 	dp_ast_type_static,
253 	dp_ast_type_mec,
254 };
255 
256 /**
257  * enum dp_nss_cfg
258  * @dp_nss_cfg_default: No radios are offloaded
259  * @dp_nss_cfg_first_radio: First radio offloaded
260  * @dp_nss_cfg_second_radio: Second radio offloaded
261  * @dp_nss_cfg_dbdc: Dual radios offloaded
262  * @dp_nss_cfg_dbtc: Three radios offloaded
263  */
264 enum dp_nss_cfg {
265 	dp_nss_cfg_default = 0x0,
266 	dp_nss_cfg_first_radio = 0x1,
267 	dp_nss_cfg_second_radio = 0x2,
268 	dp_nss_cfg_dbdc = 0x3,
269 	dp_nss_cfg_dbtc = 0x7,
270 	dp_nss_cfg_max
271 };
272 
273 #ifdef WLAN_TX_PKT_CAPTURE_ENH
274 #define DP_CPU_RING_MAP_1 1
275 #endif
276 
277 /**
278  * dp_cpu_ring_map_type - dp tx cpu ring map
279  * @DP_NSS_DEFAULT_MAP: Default mode with no NSS offloaded
280  * @DP_NSS_FIRST_RADIO_OFFLOADED_MAP: Only First Radio is offloaded
281  * @DP_NSS_SECOND_RADIO_OFFLOADED_MAP: Only second radio is offloaded
282  * @DP_NSS_DBDC_OFFLOADED_MAP: Both radios are offloaded
283  * @DP_NSS_DBTC_OFFLOADED_MAP: All three radios are offloaded
284  * @DP_SINGLE_TX_RING_MAP: to avoid out of order all cpu mapped to single ring
285  * @DP_NSS_CPU_RING_MAP_MAX: Max cpu ring map val
286  */
287 enum dp_cpu_ring_map_types {
288 	DP_NSS_DEFAULT_MAP,
289 	DP_NSS_FIRST_RADIO_OFFLOADED_MAP,
290 	DP_NSS_SECOND_RADIO_OFFLOADED_MAP,
291 	DP_NSS_DBDC_OFFLOADED_MAP,
292 	DP_NSS_DBTC_OFFLOADED_MAP,
293 #ifdef WLAN_TX_PKT_CAPTURE_ENH
294 	DP_SINGLE_TX_RING_MAP,
295 #endif
296 	DP_NSS_CPU_RING_MAP_MAX
297 };
298 
299 /**
300  * dp_rx_nbuf_frag_info - Hold vaddr and paddr for a buffer
301  *
302  * paddr: Physical address of buffer allocated.
303  * nbuf: Allocated nbuf in case of nbuf approach.
304  * vaddr: Virtual address of frag allocated in case of frag approach.
305  */
306 struct dp_rx_nbuf_frag_info {
307 	qdf_dma_addr_t paddr;
308 	union {
309 		qdf_nbuf_t nbuf;
310 		qdf_frag_t vaddr;
311 	} virt_addr;
312 };
313 
314 /**
315  * struct rx_desc_pool
316  * @pool_size: number of RX descriptor in the pool
317  * @elem_size: Element size
318  * @desc_pages: Multi page descriptors
319  * @array: pointer to array of RX descriptor
320  * @freelist: pointer to free RX descriptor link list
321  * @lock: Protection for the RX descriptor pool
322  * @owner: owner for nbuf
323  * @buf_size: Buffer size
324  * @buf_alignment: Buffer alignment
325  * @rx_mon_dest_frag_enable: Enable frag processing for mon dest buffer
326  */
327 struct rx_desc_pool {
328 	uint32_t pool_size;
329 #ifdef RX_DESC_MULTI_PAGE_ALLOC
330 	uint16_t elem_size;
331 	struct qdf_mem_multi_page_t desc_pages;
332 #else
333 	union dp_rx_desc_list_elem_t *array;
334 #endif
335 	union dp_rx_desc_list_elem_t *freelist;
336 	qdf_spinlock_t lock;
337 	uint8_t owner;
338 	uint16_t buf_size;
339 	uint8_t buf_alignment;
340 	bool rx_mon_dest_frag_enable;
341 };
342 
343 /**
344  * struct dp_tx_ext_desc_elem_s
345  * @next: next extension descriptor pointer
346  * @vaddr: hlos virtual address pointer
347  * @paddr: physical address pointer for descriptor
348  */
349 struct dp_tx_ext_desc_elem_s {
350 	struct dp_tx_ext_desc_elem_s *next;
351 	void *vaddr;
352 	qdf_dma_addr_t paddr;
353 };
354 
355 /**
356  * struct dp_tx_ext_desc_s - Tx Extension Descriptor Pool
357  * @elem_count: Number of descriptors in the pool
358  * @elem_size: Size of each descriptor
359  * @num_free: Number of free descriptors
360  * @msdu_ext_desc: MSDU extension descriptor
361  * @desc_pages: multiple page allocation information for actual descriptors
362  * @link_elem_size: size of the link descriptor in cacheable memory used for
363  * 		    chaining the extension descriptors
364  * @desc_link_pages: multiple page allocation information for link descriptors
365  */
366 struct dp_tx_ext_desc_pool_s {
367 	uint16_t elem_count;
368 	int elem_size;
369 	uint16_t num_free;
370 	struct qdf_mem_multi_page_t desc_pages;
371 	int link_elem_size;
372 	struct qdf_mem_multi_page_t desc_link_pages;
373 	struct dp_tx_ext_desc_elem_s *freelist;
374 	qdf_spinlock_t lock;
375 	qdf_dma_mem_context(memctx);
376 };
377 
378 /**
379  * struct dp_tx_desc_s - Tx Descriptor
380  * @next: Next in the chain of descriptors in freelist or in the completion list
381  * @nbuf: Buffer Address
382  * @msdu_ext_desc: MSDU extension descriptor
383  * @id: Descriptor ID
384  * @vdev: vdev over which the packet was transmitted
385  * @pdev: Handle to pdev
386  * @pool_id: Pool ID - used when releasing the descriptor
387  * @flags: Flags to track the state of descriptor and special frame handling
388  * @comp: Pool ID - used when releasing the descriptor
389  * @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet).
390  * 		   This is maintained in descriptor to allow more efficient
391  * 		   processing in completion event processing code.
392  * 		    This field is filled in with the htt_pkt_type enum.
393  * @frm_type: Frame Type - ToDo check if this is redundant
394  * @pkt_offset: Offset from which the actual packet data starts
395  * @me_buffer: Pointer to ME buffer - store this so that it can be freed on
396  *		Tx completion of ME packet
397  * @pool: handle to flow_pool this descriptor belongs to.
398  */
399 struct dp_tx_desc_s {
400 	struct dp_tx_desc_s *next;
401 	qdf_nbuf_t nbuf;
402 	uint16_t length;
403 	uint16_t flags;
404 	uint32_t id;
405 	qdf_dma_addr_t dma_addr;
406 	struct dp_vdev *vdev;
407 	struct dp_pdev *pdev;
408 	uint8_t tx_encap_type;
409 	uint8_t frm_type;
410 	uint8_t pkt_offset;
411 	uint8_t  pool_id;
412 	uint16_t peer_id;
413 	uint16_t tx_status;
414 	struct dp_tx_ext_desc_elem_s *msdu_ext_desc;
415 	void *me_buffer;
416 	void *tso_desc;
417 	void *tso_num_desc;
418 	uint64_t timestamp;
419 	struct hal_tx_desc_comp_s comp;
420 };
421 
422 /**
423  * enum flow_pool_status - flow pool status
424  * @FLOW_POOL_ACTIVE_UNPAUSED : pool is active (can take/put descriptors)
425  *				and network queues are unpaused
426  * @FLOW_POOL_ACTIVE_PAUSED: pool is active (can take/put descriptors)
427  *			   and network queues are paused
428  * @FLOW_POOL_INVALID: pool is invalid (put descriptor)
429  * @FLOW_POOL_INACTIVE: pool is inactive (pool is free)
430  */
431 enum flow_pool_status {
432 	FLOW_POOL_ACTIVE_UNPAUSED = 0,
433 	FLOW_POOL_ACTIVE_PAUSED = 1,
434 	FLOW_POOL_BE_BK_PAUSED = 2,
435 	FLOW_POOL_VI_PAUSED = 3,
436 	FLOW_POOL_VO_PAUSED = 4,
437 	FLOW_POOL_INVALID = 5,
438 	FLOW_POOL_INACTIVE = 6,
439 };
440 
441 /**
442  * struct dp_tx_tso_seg_pool_s
443  * @pool_size: total number of pool elements
444  * @num_free: free element count
445  * @freelist: first free element pointer
446  * @desc_pages: multiple page allocation information for actual descriptors
447  * @lock: lock for accessing the pool
448  */
449 struct dp_tx_tso_seg_pool_s {
450 	uint16_t pool_size;
451 	uint16_t num_free;
452 	struct qdf_tso_seg_elem_t *freelist;
453 	struct qdf_mem_multi_page_t desc_pages;
454 	qdf_spinlock_t lock;
455 };
456 
457 /**
458  * struct dp_tx_tso_num_seg_pool_s {
459  * @num_seg_pool_size: total number of pool elements
460  * @num_free: free element count
461  * @freelist: first free element pointer
462  * @desc_pages: multiple page allocation information for actual descriptors
463  * @lock: lock for accessing the pool
464  */
465 
466 struct dp_tx_tso_num_seg_pool_s {
467 	uint16_t num_seg_pool_size;
468 	uint16_t num_free;
469 	struct qdf_tso_num_seg_elem_t *freelist;
470 	struct qdf_mem_multi_page_t desc_pages;
471 	/*tso mutex */
472 	qdf_spinlock_t lock;
473 };
474 
475 /**
476  * struct dp_tx_desc_pool_s - Tx Descriptor pool information
477  * @elem_size: Size of each descriptor in the pool
478  * @pool_size: Total number of descriptors in the pool
479  * @num_free: Number of free descriptors
480  * @num_allocated: Number of used descriptors
481  * @freelist: Chain of free descriptors
482  * @desc_pages: multiple page allocation information for actual descriptors
483  * @num_invalid_bin: Deleted pool with pending Tx completions.
484  * @flow_pool_array_lock: Lock when operating on flow_pool_array.
485  * @flow_pool_array: List of allocated flow pools
486  * @lock- Lock for descriptor allocation/free from/to the pool
487  */
488 struct dp_tx_desc_pool_s {
489 	uint16_t elem_size;
490 	uint32_t num_allocated;
491 	struct dp_tx_desc_s *freelist;
492 	struct qdf_mem_multi_page_t desc_pages;
493 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
494 	uint16_t pool_size;
495 	uint8_t flow_pool_id;
496 	uint8_t num_invalid_bin;
497 	uint16_t avail_desc;
498 	enum flow_pool_status status;
499 	enum htt_flow_type flow_type;
500 #ifdef QCA_AC_BASED_FLOW_CONTROL
501 	uint16_t stop_th[FL_TH_MAX];
502 	uint16_t start_th[FL_TH_MAX];
503 	qdf_time_t max_pause_time[FL_TH_MAX];
504 	qdf_time_t latest_pause_time[FL_TH_MAX];
505 #else
506 	uint16_t stop_th;
507 	uint16_t start_th;
508 #endif
509 	uint16_t pkt_drop_no_desc;
510 	qdf_spinlock_t flow_pool_lock;
511 	uint8_t pool_create_cnt;
512 	void *pool_owner_ctx;
513 #else
514 	uint16_t elem_count;
515 	uint32_t num_free;
516 	qdf_spinlock_t lock;
517 #endif
518 };
519 
520 /**
521  * struct dp_txrx_pool_stats - flow pool related statistics
522  * @pool_map_count: flow pool map received
523  * @pool_unmap_count: flow pool unmap received
524  * @pkt_drop_no_pool: packets dropped due to unavailablity of pool
525  */
526 struct dp_txrx_pool_stats {
527 	uint16_t pool_map_count;
528 	uint16_t pool_unmap_count;
529 	uint16_t pkt_drop_no_pool;
530 };
531 
532 /**
533  * struct dp_srng - DP srng structure
534  * @hal_srng: hal_srng handle
535  * @base_vaddr_unaligned: un-aligned virtual base address of the srng ring
536  * @base_vaddr_aligned: aligned virtual base address of the srng ring
537  * @base_paddr_unaligned: un-aligned physical base address of the srng ring
538  * @base_paddr_aligned: aligned physical base address of the srng ring
539  * @alloc_size: size of the srng ring
540  * @cached: is the srng ring memory cached or un-cached memory
541  * @irq: irq number of the srng ring
542  * @num_entries: number of entries in the srng ring
543  */
544 struct dp_srng {
545 	hal_ring_handle_t hal_srng;
546 	void *base_vaddr_unaligned;
547 	void *base_vaddr_aligned;
548 	qdf_dma_addr_t base_paddr_unaligned;
549 	qdf_dma_addr_t base_paddr_aligned;
550 	uint32_t alloc_size;
551 	uint8_t cached;
552 	int irq;
553 	uint32_t num_entries;
554 };
555 
556 struct dp_rx_reorder_array_elem {
557 	qdf_nbuf_t head;
558 	qdf_nbuf_t tail;
559 };
560 
561 #define DP_RX_BA_INACTIVE 0
562 #define DP_RX_BA_ACTIVE 1
563 #define DP_RX_BA_IN_PROGRESS 2
564 struct dp_reo_cmd_info {
565 	uint16_t cmd;
566 	enum hal_reo_cmd_type cmd_type;
567 	void *data;
568 	void (*handler)(struct dp_soc *, void *, union hal_reo_status *);
569 	TAILQ_ENTRY(dp_reo_cmd_info) reo_cmd_list_elem;
570 };
571 
572 /* Rx TID */
573 struct dp_rx_tid {
574 	/* TID */
575 	int tid;
576 
577 	/* Num of addba requests */
578 	uint32_t num_of_addba_req;
579 
580 	/* Num of addba responses */
581 	uint32_t num_of_addba_resp;
582 
583 	/* Num of delba requests */
584 	uint32_t num_of_delba_req;
585 
586 	/* Num of addba responses successful */
587 	uint32_t num_addba_rsp_success;
588 
589 	/* Num of addba responses failed */
590 	uint32_t num_addba_rsp_failed;
591 
592 	/* pn size */
593 	uint8_t pn_size;
594 	/* REO TID queue descriptors */
595 	void *hw_qdesc_vaddr_unaligned;
596 	qdf_dma_addr_t hw_qdesc_paddr_unaligned;
597 	qdf_dma_addr_t hw_qdesc_paddr;
598 	uint32_t hw_qdesc_alloc_size;
599 
600 	/* RX ADDBA session state */
601 	int ba_status;
602 
603 	/* RX BA window size */
604 	uint16_t ba_win_size;
605 
606 	/* Starting sequence number in Addba request */
607 	uint16_t startseqnum;
608 
609 	/* TODO: Check the following while adding defragmentation support */
610 	struct dp_rx_reorder_array_elem *array;
611 	/* base - single rx reorder element used for non-aggr cases */
612 	struct dp_rx_reorder_array_elem base;
613 
614 	/* only used for defrag right now */
615 	TAILQ_ENTRY(dp_rx_tid) defrag_waitlist_elem;
616 
617 	/* Store dst desc for reinjection */
618 	hal_ring_desc_t dst_ring_desc;
619 	struct dp_rx_desc *head_frag_desc;
620 
621 	/* rx_tid lock */
622 	qdf_spinlock_t tid_lock;
623 
624 	/* Sequence and fragments that are being processed currently */
625 	uint32_t curr_seq_num;
626 	uint32_t curr_frag_num;
627 
628 	/* head PN number */
629 	uint64_t pn128[2];
630 
631 	uint32_t defrag_timeout_ms;
632 	uint16_t dialogtoken;
633 	uint16_t statuscode;
634 	/* user defined ADDBA response status code */
635 	uint16_t userstatuscode;
636 
637 	/* Store ppdu_id when 2k exception is received */
638 	uint32_t ppdu_id_2k;
639 
640 	/* Delba Tx completion status */
641 	uint8_t delba_tx_status;
642 
643 	/* Delba Tx retry count */
644 	uint8_t delba_tx_retry;
645 
646 	/* Delba stats */
647 	uint32_t delba_tx_success_cnt;
648 	uint32_t delba_tx_fail_cnt;
649 
650 	/* Delba reason code for retries */
651 	uint8_t delba_rcode;
652 
653 	/* Coex Override preserved windows size 1 based */
654 	uint16_t rx_ba_win_size_override;
655 
656 	/* Peer TID statistics */
657 	struct cdp_peer_tid_stats stats;
658 };
659 
660 /**
661  * struct dp_intr_stats - DP Interrupt Stats for an interrupt context
662  * @num_tx_ring_masks: interrupts with tx_ring_mask set
663  * @num_rx_ring_masks: interrupts with rx_ring_mask set
664  * @num_rx_mon_ring_masks: interrupts with rx_mon_ring_mask set
665  * @num_rx_err_ring_masks: interrupts with rx_err_ring_mask set
666  * @num_rx_wbm_rel_ring_masks: interrupts with rx_wbm_rel_ring_mask set
667  * @num_reo_status_ring_masks: interrupts with reo_status_ring_mask set
668  * @num_rxdma2host_ring_masks: interrupts with rxdma2host_ring_mask set
669  * @num_host2rxdma_ring_masks: interrupts with host2rxdma_ring_mask set
670  * @num_host2rxdma_ring_masks: interrupts with host2rxdma_ring_mask set
671  * @num_masks: total number of times the interrupt was received
672  *
673  * Counter for individual masks are incremented only if there are any packets
674  * on that ring.
675  */
676 struct dp_intr_stats {
677 	uint32_t num_tx_ring_masks[MAX_TCL_DATA_RINGS];
678 	uint32_t num_rx_ring_masks[MAX_REO_DEST_RINGS];
679 	uint32_t num_rx_mon_ring_masks;
680 	uint32_t num_rx_err_ring_masks;
681 	uint32_t num_rx_wbm_rel_ring_masks;
682 	uint32_t num_reo_status_ring_masks;
683 	uint32_t num_rxdma2host_ring_masks;
684 	uint32_t num_host2rxdma_ring_masks;
685 	uint32_t num_masks;
686 };
687 
688 /* per interrupt context  */
689 struct dp_intr {
690 	uint8_t tx_ring_mask;   /* WBM Tx completion rings (0-2)
691 				associated with this napi context */
692 	uint8_t rx_ring_mask;   /* Rx REO rings (0-3) associated
693 				with this interrupt context */
694 	uint8_t rx_mon_ring_mask;  /* Rx monitor ring mask (0-2) */
695 	uint8_t rx_err_ring_mask; /* REO Exception Ring */
696 	uint8_t rx_wbm_rel_ring_mask; /* WBM2SW Rx Release Ring */
697 	uint8_t reo_status_ring_mask; /* REO command response ring */
698 	uint8_t rxdma2host_ring_mask; /* RXDMA to host destination ring */
699 	uint8_t host2rxdma_ring_mask; /* Host to RXDMA buffer ring */
700 	/* Host to RXDMA monitor  buffer ring */
701 	uint8_t host2rxdma_mon_ring_mask;
702 	struct dp_soc *soc;    /* Reference to SoC structure ,
703 				to get DMA ring handles */
704 	qdf_lro_ctx_t lro_ctx;
705 	uint8_t dp_intr_id;
706 
707 	/* Interrupt Stats for individual masks */
708 	struct dp_intr_stats intr_stats;
709 };
710 
711 #define REO_DESC_FREELIST_SIZE 64
712 #define REO_DESC_FREE_DEFER_MS 1000
713 struct reo_desc_list_node {
714 	qdf_list_node_t node;
715 	unsigned long free_ts;
716 	struct dp_rx_tid rx_tid;
717 	bool resend_update_reo_cmd;
718 	uint32_t pending_ext_desc_size;
719 };
720 
721 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
722 /**
723  * struct reo_cmd_event_record: Elements to record for each reo command
724  * @cmd_type: reo command type
725  * @cmd_return_status: reo command post status
726  * @timestamp: record timestamp for the reo command
727  */
728 struct reo_cmd_event_record {
729 	enum hal_reo_cmd_type cmd_type;
730 	uint8_t cmd_return_status;
731 	uint32_t timestamp;
732 };
733 
734 /**
735  * struct reo_cmd_event_history: Account for reo cmd events
736  * @index: record number
737  * @cmd_record: list of records
738  */
739 struct reo_cmd_event_history {
740 	qdf_atomic_t index;
741 	struct reo_cmd_event_record cmd_record[REO_CMD_EVENT_HIST_MAX];
742 };
743 #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
744 
745 /* SoC level data path statistics */
746 struct dp_soc_stats {
747 	struct {
748 		uint32_t added;
749 		uint32_t deleted;
750 		uint32_t aged_out;
751 		uint32_t map_err;
752 		uint32_t ast_mismatch;
753 	} ast;
754 
755 	/* SOC level TX stats */
756 	struct {
757 		/* packets dropped on tx because of no peer */
758 		struct cdp_pkt_info tx_invalid_peer;
759 		/* descriptors in each tcl ring */
760 		uint32_t tcl_ring_full[MAX_TCL_DATA_RINGS];
761 		/* Descriptors in use at soc */
762 		uint32_t desc_in_use;
763 		/* tqm_release_reason == FW removed */
764 		uint32_t dropped_fw_removed;
765 		/* tx completion release_src != TQM or FW */
766 		uint32_t invalid_release_source;
767 		/* tx completion wbm_internal_error */
768 		uint32_t wbm_internal_error[MAX_WBM_INT_ERROR_REASONS];
769 		/* tx completion non_wbm_internal_error */
770 		uint32_t non_wbm_internal_err;
771 		/* TX Comp loop packet limit hit */
772 		uint32_t tx_comp_loop_pkt_limit_hit;
773 		/* Head pointer Out of sync at the end of dp_tx_comp_handler */
774 		uint32_t hp_oos2;
775 	} tx;
776 
777 	/* SOC level RX stats */
778 	struct {
779 		/* Rx errors */
780 		/* Total Packets in Rx Error ring */
781 		uint32_t err_ring_pkts;
782 		/* No of Fragments */
783 		uint32_t rx_frags;
784 		/* No of incomplete fragments in waitlist */
785 		uint32_t rx_frag_wait;
786 		/* Fragments dropped due to errors */
787 		uint32_t rx_frag_err;
788 		/* Fragments received OOR causing sequence num mismatch */
789 		uint32_t rx_frag_oor;
790 		/* Fragments dropped due to len errors in skb */
791 		uint32_t rx_frag_err_len_error;
792 		/* Fragments dropped due to no peer found */
793 		uint32_t rx_frag_err_no_peer;
794 		/* No of reinjected packets */
795 		uint32_t reo_reinject;
796 		/* Reap loop packet limit hit */
797 		uint32_t reap_loop_pkt_limit_hit;
798 		/* Head pointer Out of sync at the end of dp_rx_process */
799 		uint32_t hp_oos2;
800 		/* Rx ring near full */
801 		uint32_t near_full;
802 		/* Break ring reaping as not all scattered msdu received */
803 		uint32_t msdu_scatter_wait_break;
804 
805 		struct {
806 			/* Invalid RBM error count */
807 			uint32_t invalid_rbm;
808 			/* Invalid VDEV Error count */
809 			uint32_t invalid_vdev;
810 			/* Invalid PDEV error count */
811 			uint32_t invalid_pdev;
812 
813 			/* Packets delivered to stack that no related peer */
814 			uint32_t pkt_delivered_no_peer;
815 			/* Defrag peer uninit error count */
816 			uint32_t defrag_peer_uninit;
817 			/* Invalid sa_idx or da_idx*/
818 			uint32_t invalid_sa_da_idx;
819 			/* MSDU DONE failures */
820 			uint32_t msdu_done_fail;
821 			/* Invalid PEER Error count */
822 			struct cdp_pkt_info rx_invalid_peer;
823 			/* Invalid PEER ID count */
824 			struct cdp_pkt_info rx_invalid_peer_id;
825 			/* Invalid packet length */
826 			struct cdp_pkt_info rx_invalid_pkt_len;
827 			/* HAL ring access Fail error count */
828 			uint32_t hal_ring_access_fail;
829 			/* HAL ring access full Fail error count */
830 			uint32_t hal_ring_access_full_fail;
831 			/* RX DMA error count */
832 			uint32_t rxdma_error[HAL_RXDMA_ERR_MAX];
833 			/* RX REO DEST Desc Invalid Magic count */
834 			uint32_t rx_desc_invalid_magic;
835 			/* REO Error count */
836 			uint32_t reo_error[HAL_REO_ERR_MAX];
837 			/* HAL REO ERR Count */
838 			uint32_t hal_reo_error[MAX_REO_DEST_RINGS];
839 			/* HAL REO DEST Duplicate count */
840 			uint32_t hal_reo_dest_dup;
841 			/* HAL WBM RELEASE Duplicate count */
842 			uint32_t hal_wbm_rel_dup;
843 			/* HAL RXDMA error Duplicate count */
844 			uint32_t hal_rxdma_err_dup;
845 			/* ipa smmu map duplicate count */
846 			uint32_t ipa_smmu_map_dup;
847 			/* ipa smmu unmap duplicate count */
848 			uint32_t ipa_smmu_unmap_dup;
849 			/* ipa smmu unmap while ipa pipes is disabled */
850 			uint32_t ipa_unmap_no_pipe;
851 			/* REO cmd send fail/requeue count */
852 			uint32_t reo_cmd_send_fail;
853 			/* REO cmd send drain count */
854 			uint32_t reo_cmd_send_drain;
855 			/* RX msdu drop count due to scatter */
856 			uint32_t scatter_msdu;
857 			/* RX msdu drop count due to invalid cookie */
858 			uint32_t invalid_cookie;
859 			/* Count of stale cookie read in RX path */
860 			uint32_t stale_cookie;
861 			/* Delba sent count due to RX 2k jump */
862 			uint32_t rx_2k_jump_delba_sent;
863 			/* RX 2k jump msdu indicated to stack count */
864 			uint32_t rx_2k_jump_to_stack;
865 			/* RX 2k jump msdu dropped count */
866 			uint32_t rx_2k_jump_drop;
867 			/* REO OOR msdu drop count */
868 			uint32_t reo_err_oor_drop;
869 			/* REO OOR msdu indicated to stack count */
870 			uint32_t reo_err_oor_to_stack;
871 			/* REO OOR scattered msdu count */
872 			uint32_t reo_err_oor_sg_count;
873 			/* RX msdu rejected count on delivery to vdev stack_fn*/
874 			uint32_t rejected;
875 			/* Incorrect msdu count in MPDU desc info */
876 			uint32_t msdu_count_mismatch;
877 			/* RX raw frame dropped count */
878 			uint32_t raw_frm_drop;
879 			/* Stale link desc cookie count*/
880 			uint32_t invalid_link_cookie;
881 			/* Nbuf sanity failure */
882 			uint32_t nbuf_sanity_fail;
883 			/* Duplicate link desc refilled */
884 			uint32_t dup_refill_link_desc;
885 		} err;
886 
887 		/* packet count per core - per ring */
888 		uint64_t ring_packets[NR_CPUS][MAX_REO_DEST_RINGS];
889 	} rx;
890 
891 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
892 	struct reo_cmd_event_history cmd_event_history;
893 #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
894 };
895 
896 union dp_align_mac_addr {
897 	uint8_t raw[QDF_MAC_ADDR_SIZE];
898 	struct {
899 		uint16_t bytes_ab;
900 		uint16_t bytes_cd;
901 		uint16_t bytes_ef;
902 	} align2;
903 	struct {
904 		uint32_t bytes_abcd;
905 		uint16_t bytes_ef;
906 	} align4;
907 	struct __attribute__((__packed__)) {
908 		uint16_t bytes_ab;
909 		uint32_t bytes_cdef;
910 	} align4_2;
911 };
912 
913 /**
914  * struct dp_ast_free_cb_params - HMWDS free callback cookie
915  * @mac_addr: ast mac address
916  * @peer_mac_addr: mac address of peer
917  * @type: ast entry type
918  * @vdev_id: vdev_id
919  * @flags: ast flags
920  */
921 struct dp_ast_free_cb_params {
922 	union dp_align_mac_addr mac_addr;
923 	union dp_align_mac_addr peer_mac_addr;
924 	enum cdp_txrx_ast_entry_type type;
925 	uint8_t vdev_id;
926 	uint32_t flags;
927 };
928 
929 /*
930  * dp_ast_entry
931  *
932  * @ast_idx: Hardware AST Index
933  * @mac_addr:  MAC Address for this AST entry
934  * @peer: Next Hop peer (for non-WDS nodes, this will be point to
935  *        associated peer with this MAC address)
936  * @next_hop: Set to 1 if this is for a WDS node
937  * @is_active: flag to indicate active data traffic on this node
938  *             (used for aging out/expiry)
939  * @ase_list_elem: node in peer AST list
940  * @is_bss: flag to indicate if entry corresponds to bss peer
941  * @is_mapped: flag to indicate that we have mapped the AST entry
942  *             in ast_table
943  * @pdev_id: pdev ID
944  * @vdev_id: vdev ID
945  * @ast_hash_value: hast value in HW
946  * @ref_cnt: reference count
947  * @type: flag to indicate type of the entry(static/WDS/MEC)
948  * @delete_in_progress: Flag to indicate that delete commands send to FW
949  *                      and host is waiting for response from FW
950  * @callback: ast free/unmap callback
951  * @cookie: argument to callback
952  * @hash_list_elem: node in soc AST hash list (mac address used as hash)
953  */
954 struct dp_ast_entry {
955 	uint16_t ast_idx;
956 	union dp_align_mac_addr mac_addr;
957 	struct dp_peer *peer;
958 	bool next_hop;
959 	bool is_active;
960 	bool is_mapped;
961 	uint8_t pdev_id;
962 	uint16_t ast_hash_value;
963 	qdf_atomic_t ref_cnt;
964 	enum cdp_txrx_ast_entry_type type;
965 	bool delete_in_progress;
966 	txrx_ast_free_cb callback;
967 	void *cookie;
968 	TAILQ_ENTRY(dp_ast_entry) ase_list_elem;
969 	TAILQ_ENTRY(dp_ast_entry) hash_list_elem;
970 };
971 
972 /* SOC level htt stats */
973 struct htt_t2h_stats {
974 	/* lock to protect htt_stats_msg update */
975 	qdf_spinlock_t lock;
976 
977 	/* work queue to process htt stats */
978 	qdf_work_t work;
979 
980 	/* T2H Ext stats message queue */
981 	qdf_nbuf_queue_t msg;
982 
983 	/* number of completed stats in htt_stats_msg */
984 	uint32_t num_stats;
985 };
986 
987 struct link_desc_bank {
988 	void *base_vaddr_unaligned;
989 	void *base_vaddr;
990 	qdf_dma_addr_t base_paddr_unaligned;
991 	qdf_dma_addr_t base_paddr;
992 	uint32_t size;
993 };
994 
995 struct rx_buff_pool {
996 	qdf_nbuf_queue_head_t emerg_nbuf_q;
997 	uint32_t nbuf_fail_cnt;
998 	bool is_initialized;
999 };
1000 
1001 /*
1002  * The logic for get current index of these history is dependent on this
1003  * value being power of 2.
1004  */
1005 #define DP_RX_HIST_MAX 2048
1006 #define DP_RX_ERR_HIST_MAX 4096
1007 #define DP_RX_REINJECT_HIST_MAX 1024
1008 
1009 QDF_COMPILE_TIME_ASSERT(rx_history_size,
1010 			(DP_RX_HIST_MAX &
1011 			 (DP_RX_HIST_MAX - 1)) == 0);
1012 QDF_COMPILE_TIME_ASSERT(rx_err_history_size,
1013 			(DP_RX_ERR_HIST_MAX &
1014 			 (DP_RX_ERR_HIST_MAX - 1)) == 0);
1015 QDF_COMPILE_TIME_ASSERT(rx_reinject_history_size,
1016 			(DP_RX_REINJECT_HIST_MAX &
1017 			 (DP_RX_REINJECT_HIST_MAX - 1)) == 0);
1018 
1019 /**
1020  * struct dp_buf_info_record - ring buffer info
1021  * @hbi: HW ring buffer info
1022  * @timestamp: timestamp when this entry was recorded
1023  */
1024 struct dp_buf_info_record {
1025 	struct hal_buf_info hbi;
1026 	uint64_t timestamp;
1027 };
1028 
1029 /* struct dp_rx_history - rx ring hisotry
1030  * @index: Index where the last entry is written
1031  * @entry: history entries
1032  */
1033 struct dp_rx_history {
1034 	qdf_atomic_t index;
1035 	struct dp_buf_info_record entry[DP_RX_HIST_MAX];
1036 };
1037 
1038 /* struct dp_rx_err_history - rx err ring hisotry
1039  * @index: Index where the last entry is written
1040  * @entry: history entries
1041  */
1042 struct dp_rx_err_history {
1043 	qdf_atomic_t index;
1044 	struct dp_buf_info_record entry[DP_RX_ERR_HIST_MAX];
1045 };
1046 
1047 /* struct dp_rx_reinject_history - rx reinject ring hisotry
1048  * @index: Index where the last entry is written
1049  * @entry: history entries
1050  */
1051 struct dp_rx_reinject_history {
1052 	qdf_atomic_t index;
1053 	struct dp_buf_info_record entry[DP_RX_REINJECT_HIST_MAX];
1054 };
1055 
1056 /* structure to record recent operation related variable */
1057 struct dp_last_op_info {
1058 	/* last link desc buf info through WBM release ring */
1059 	struct hal_buf_info wbm_rel_link_desc;
1060 	/* last link desc buf info through REO reinject ring */
1061 	struct hal_buf_info reo_reinject_link_desc;
1062 };
1063 
1064 /* SOC level structure for data path */
1065 struct dp_soc {
1066 	/**
1067 	 * re-use memory section starts
1068 	 */
1069 
1070 	/* Common base structure - Should be the first member */
1071 	struct cdp_soc_t cdp_soc;
1072 
1073 	/* SoC Obj */
1074 	struct cdp_ctrl_objmgr_psoc *ctrl_psoc;
1075 
1076 	/* OS device abstraction */
1077 	qdf_device_t osdev;
1078 
1079 	/*cce disable*/
1080 	bool cce_disable;
1081 
1082 	/* WLAN config context */
1083 	struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx;
1084 
1085 	/* HTT handle for host-fw interaction */
1086 	struct htt_soc *htt_handle;
1087 
1088 	/* Commint init done */
1089 	qdf_atomic_t cmn_init_done;
1090 
1091 	/* Opaque hif handle */
1092 	struct hif_opaque_softc *hif_handle;
1093 
1094 	/* PDEVs on this SOC */
1095 	struct dp_pdev *pdev_list[MAX_PDEV_CNT];
1096 
1097 	/* Ring used to replenish rx buffers (maybe to the firmware of MAC) */
1098 	struct dp_srng rx_refill_buf_ring[MAX_PDEV_CNT];
1099 
1100 	struct dp_srng rxdma_mon_desc_ring[MAX_NUM_LMAC_HW];
1101 
1102 	/* RXDMA error destination ring */
1103 	struct dp_srng rxdma_err_dst_ring[MAX_NUM_LMAC_HW];
1104 
1105 	/* RXDMA monitor buffer replenish ring */
1106 	struct dp_srng rxdma_mon_buf_ring[MAX_NUM_LMAC_HW];
1107 
1108 	/* RXDMA monitor destination ring */
1109 	struct dp_srng rxdma_mon_dst_ring[MAX_NUM_LMAC_HW];
1110 
1111 	/* RXDMA monitor status ring. TBD: Check format of this ring */
1112 	struct dp_srng rxdma_mon_status_ring[MAX_NUM_LMAC_HW];
1113 
1114 	/* Number of PDEVs */
1115 	uint8_t pdev_count;
1116 
1117 	/*ast override support in HW*/
1118 	bool ast_override_support;
1119 
1120 	/*number of hw dscp tid map*/
1121 	uint8_t num_hw_dscp_tid_map;
1122 
1123 	/* HAL SOC handle */
1124 	hal_soc_handle_t hal_soc;
1125 
1126 	/* Device ID coming from Bus sub-system */
1127 	uint32_t device_id;
1128 
1129 	/* Link descriptor pages */
1130 	struct qdf_mem_multi_page_t link_desc_pages;
1131 
1132 	/* total link descriptors for regular RX and TX */
1133 	uint32_t total_link_descs;
1134 
1135 	/* monitor link descriptor pages */
1136 	struct qdf_mem_multi_page_t mon_link_desc_pages[MAX_NUM_LMAC_HW];
1137 
1138 	/* total link descriptors for monitor mode for each radio */
1139 	uint32_t total_mon_link_descs[MAX_NUM_LMAC_HW];
1140 
1141 	/* Monitor Link descriptor memory banks */
1142 	struct link_desc_bank
1143 		mon_link_desc_banks[MAX_NUM_LMAC_HW][MAX_MON_LINK_DESC_BANKS];
1144 	uint32_t num_mon_link_desc_banks[MAX_NUM_LMAC_HW];
1145 
1146 	/* Link descriptor Idle list for HW internal use (SRNG mode) */
1147 	struct dp_srng wbm_idle_link_ring;
1148 
1149 	/* Link descriptor Idle list for HW internal use (scatter buffer mode)
1150 	 */
1151 	qdf_dma_addr_t wbm_idle_scatter_buf_base_paddr[MAX_IDLE_SCATTER_BUFS];
1152 	void *wbm_idle_scatter_buf_base_vaddr[MAX_IDLE_SCATTER_BUFS];
1153 	uint32_t num_scatter_bufs;
1154 
1155 	/* Tx SW descriptor pool */
1156 	struct dp_tx_desc_pool_s tx_desc[MAX_TXDESC_POOLS];
1157 
1158 	/* Tx MSDU Extension descriptor pool */
1159 	struct dp_tx_ext_desc_pool_s tx_ext_desc[MAX_TXDESC_POOLS];
1160 
1161 	/* Tx TSO descriptor pool */
1162 	struct dp_tx_tso_seg_pool_s tx_tso_desc[MAX_TXDESC_POOLS];
1163 
1164 	/* Tx TSO Num of segments pool */
1165 	struct dp_tx_tso_num_seg_pool_s tx_tso_num_seg[MAX_TXDESC_POOLS];
1166 
1167 	/* REO destination rings */
1168 	struct dp_srng reo_dest_ring[MAX_REO_DEST_RINGS];
1169 
1170 	/* REO exception ring - See if should combine this with reo_dest_ring */
1171 	struct dp_srng reo_exception_ring;
1172 
1173 	/* REO reinjection ring */
1174 	struct dp_srng reo_reinject_ring;
1175 
1176 	/* REO command ring */
1177 	struct dp_srng reo_cmd_ring;
1178 
1179 	/* REO command status ring */
1180 	struct dp_srng reo_status_ring;
1181 
1182 	/* WBM Rx release ring */
1183 	struct dp_srng rx_rel_ring;
1184 
1185 	/* TCL data ring */
1186 	struct dp_srng tcl_data_ring[MAX_TCL_DATA_RINGS];
1187 
1188 	/* Number of TCL data rings */
1189 	uint8_t num_tcl_data_rings;
1190 
1191 	/* TCL CMD_CREDIT ring */
1192 	/* It is used as credit based ring on QCN9000 else command ring */
1193 	struct dp_srng tcl_cmd_credit_ring;
1194 
1195 	/* TCL command status ring */
1196 	struct dp_srng tcl_status_ring;
1197 
1198 	/* WBM Tx completion rings */
1199 	struct dp_srng tx_comp_ring[MAX_TCL_DATA_RINGS];
1200 
1201 	/* Common WBM link descriptor release ring (SW to WBM) */
1202 	struct dp_srng wbm_desc_rel_ring;
1203 
1204 	/* DP Interrupts */
1205 	struct dp_intr intr_ctx[WLAN_CFG_INT_NUM_CONTEXTS];
1206 
1207 	/* Monitor mode mac id to dp_intr_id map */
1208 	int mon_intr_id_lmac_map[MAX_NUM_LMAC_HW];
1209 	/* Rx SW descriptor pool for RXDMA monitor buffer */
1210 	struct rx_desc_pool rx_desc_mon[MAX_RXDESC_POOLS];
1211 
1212 	/* Rx SW descriptor pool for RXDMA status buffer */
1213 	struct rx_desc_pool rx_desc_status[MAX_RXDESC_POOLS];
1214 
1215 	/* Rx SW descriptor pool for RXDMA buffer */
1216 	struct rx_desc_pool rx_desc_buf[MAX_RXDESC_POOLS];
1217 
1218 	/* Number of REO destination rings */
1219 	uint8_t num_reo_dest_rings;
1220 
1221 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
1222 	/* lock to control access to soc TX descriptors */
1223 	qdf_spinlock_t flow_pool_array_lock;
1224 
1225 	/* pause callback to pause TX queues as per flow control */
1226 	tx_pause_callback pause_cb;
1227 
1228 	/* flow pool related statistics */
1229 	struct dp_txrx_pool_stats pool_stats;
1230 #endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */
1231 
1232 	uint32_t wbm_idle_scatter_buf_size;
1233 
1234 	/* VDEVs on this SOC */
1235 	struct dp_vdev *vdev_id_map[MAX_VDEV_CNT];
1236 
1237 	/* Tx H/W queues lock */
1238 	qdf_spinlock_t tx_queue_lock[MAX_TX_HW_QUEUES];
1239 
1240 	/* Tx ring map for interrupt processing */
1241 	uint8_t tx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS];
1242 
1243 	/* Rx ring map for interrupt processing */
1244 	uint8_t rx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS];
1245 
1246 	/* peer ID to peer object map (array of pointers to peer objects) */
1247 	struct dp_peer **peer_id_to_obj_map;
1248 
1249 	struct {
1250 		unsigned mask;
1251 		unsigned idx_bits;
1252 		TAILQ_HEAD(, dp_peer) * bins;
1253 	} peer_hash;
1254 
1255 	/* rx defrag state – TBD: do we need this per radio? */
1256 	struct {
1257 		struct {
1258 			TAILQ_HEAD(, dp_rx_tid) waitlist;
1259 			uint32_t timeout_ms;
1260 			uint32_t next_flush_ms;
1261 			qdf_spinlock_t defrag_lock;
1262 		} defrag;
1263 		struct {
1264 			int defrag_timeout_check;
1265 			int dup_check;
1266 		} flags;
1267 		TAILQ_HEAD(, dp_reo_cmd_info) reo_cmd_list;
1268 		qdf_spinlock_t reo_cmd_lock;
1269 	} rx;
1270 
1271 	/* optional rx processing function */
1272 	void (*rx_opt_proc)(
1273 		struct dp_vdev *vdev,
1274 		struct dp_peer *peer,
1275 		unsigned tid,
1276 		qdf_nbuf_t msdu_list);
1277 
1278 	/* pool addr for mcast enhance buff */
1279 	struct {
1280 		int size;
1281 		uint32_t paddr;
1282 		uint32_t *vaddr;
1283 		struct dp_tx_me_buf_t *freelist;
1284 		int buf_in_use;
1285 		qdf_dma_mem_context(memctx);
1286 	} me_buf;
1287 
1288 	/**
1289 	 * peer ref mutex:
1290 	 * 1. Protect peer object lookups until the returned peer object's
1291 	 *	reference count is incremented.
1292 	 * 2. Provide mutex when accessing peer object lookup structures.
1293 	 */
1294 	DP_MUTEX_TYPE peer_ref_mutex;
1295 
1296 	/* maximum value for peer_id */
1297 	uint32_t max_peers;
1298 
1299 	/* SoC level data path statistics */
1300 	struct dp_soc_stats stats;
1301 
1302 	/* Enable processing of Tx completion status words */
1303 	bool process_tx_status;
1304 	bool process_rx_status;
1305 	struct dp_ast_entry **ast_table;
1306 	struct {
1307 		unsigned mask;
1308 		unsigned idx_bits;
1309 		TAILQ_HEAD(, dp_ast_entry) * bins;
1310 	} ast_hash;
1311 
1312 	struct dp_rx_history *rx_ring_history[MAX_REO_DEST_RINGS];
1313 	struct dp_rx_err_history *rx_err_ring_history;
1314 	struct dp_rx_reinject_history *rx_reinject_ring_history;
1315 
1316 	qdf_spinlock_t ast_lock;
1317 	/*Timer for AST entry ageout maintainance */
1318 	qdf_timer_t ast_aging_timer;
1319 
1320 	/*Timer counter for WDS AST entry ageout*/
1321 	uint8_t wds_ast_aging_timer_cnt;
1322 
1323 	/*interrupt timer*/
1324 	qdf_timer_t mon_reap_timer;
1325 	uint8_t reap_timer_init;
1326 	qdf_timer_t lmac_reap_timer;
1327 	uint8_t lmac_timer_init;
1328 	qdf_timer_t int_timer;
1329 	uint8_t intr_mode;
1330 	uint8_t lmac_polled_mode;
1331 
1332 	qdf_list_t reo_desc_freelist;
1333 	qdf_spinlock_t reo_desc_freelist_lock;
1334 
1335 	/* htt stats */
1336 	struct htt_t2h_stats htt_stats;
1337 
1338 	void *external_txrx_handle; /* External data path handle */
1339 #ifdef IPA_OFFLOAD
1340 	/* IPA uC datapath offload Wlan Tx resources */
1341 	struct {
1342 		/* Resource info to be passed to IPA */
1343 		qdf_dma_addr_t ipa_tcl_ring_base_paddr;
1344 		void *ipa_tcl_ring_base_vaddr;
1345 		uint32_t ipa_tcl_ring_size;
1346 		qdf_dma_addr_t ipa_tcl_hp_paddr;
1347 		uint32_t alloc_tx_buf_cnt;
1348 
1349 		qdf_dma_addr_t ipa_wbm_ring_base_paddr;
1350 		void *ipa_wbm_ring_base_vaddr;
1351 		uint32_t ipa_wbm_ring_size;
1352 		qdf_dma_addr_t ipa_wbm_tp_paddr;
1353 
1354 		/* TX buffers populated into the WBM ring */
1355 		void **tx_buf_pool_vaddr_unaligned;
1356 		qdf_dma_addr_t *tx_buf_pool_paddr_unaligned;
1357 	} ipa_uc_tx_rsc;
1358 
1359 	/* IPA uC datapath offload Wlan Rx resources */
1360 	struct {
1361 		/* Resource info to be passed to IPA */
1362 		qdf_dma_addr_t ipa_reo_ring_base_paddr;
1363 		void *ipa_reo_ring_base_vaddr;
1364 		uint32_t ipa_reo_ring_size;
1365 		qdf_dma_addr_t ipa_reo_tp_paddr;
1366 
1367 		/* Resource info to be passed to firmware and IPA */
1368 		qdf_dma_addr_t ipa_rx_refill_buf_ring_base_paddr;
1369 		void *ipa_rx_refill_buf_ring_base_vaddr;
1370 		uint32_t ipa_rx_refill_buf_ring_size;
1371 		qdf_dma_addr_t ipa_rx_refill_buf_hp_paddr;
1372 	} ipa_uc_rx_rsc;
1373 
1374 	qdf_atomic_t ipa_pipes_enabled;
1375 	bool ipa_first_tx_db_access;
1376 #endif
1377 
1378 #ifdef WLAN_FEATURE_STATS_EXT
1379 	struct {
1380 		uint32_t rx_mpdu_received;
1381 		uint32_t rx_mpdu_missed;
1382 	} ext_stats;
1383 	qdf_event_t rx_hw_stats_event;
1384 	qdf_spinlock_t rx_hw_stats_lock;
1385 	bool is_last_stats_ctx_init;
1386 #endif /* WLAN_FEATURE_STATS_EXT */
1387 
1388 	/* Smart monitor capability for HKv2 */
1389 	uint8_t hw_nac_monitor_support;
1390 	/* Flag to indicate if HTT v2 is enabled*/
1391 	bool is_peer_map_unmap_v2;
1392 	/* Per peer per Tid ba window size support */
1393 	uint8_t per_tid_basize_max_tid;
1394 	/* Soc level flag to enable da_war */
1395 	uint8_t da_war_enabled;
1396 	/* number of active ast entries */
1397 	uint32_t num_ast_entries;
1398 	/* rdk rate statistics context at soc level*/
1399 	struct cdp_soc_rate_stats_ctx *rate_stats_ctx;
1400 	/* rdk rate statistics control flag */
1401 	bool wlanstats_enabled;
1402 
1403 	/* 8021p PCP-TID map values */
1404 	uint8_t pcp_tid_map[PCP_TID_MAP_MAX];
1405 	/* TID map priority value */
1406 	uint8_t tidmap_prty;
1407 	/* Pointer to global per ring type specific configuration table */
1408 	struct wlan_srng_cfg *wlan_srng_cfg;
1409 	/* Num Tx outstanding on device */
1410 	qdf_atomic_t num_tx_outstanding;
1411 	/* Num Tx exception on device */
1412 	qdf_atomic_t num_tx_exception;
1413 	/* Num Tx allowed */
1414 	uint32_t num_tx_allowed;
1415 	/* Preferred HW mode */
1416 	uint8_t preferred_hw_mode;
1417 
1418 	/**
1419 	 * Flag to indicate whether WAR to address single cache entry
1420 	 * invalidation bug is enabled or not
1421 	 */
1422 	bool is_rx_fse_full_cache_invalidate_war_enabled;
1423 #if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)
1424 	/**
1425 	 * Pointer to DP RX Flow FST at SOC level if
1426 	 * is_rx_flow_search_table_per_pdev is false
1427 	 * TBD: rx_fst[num_macs] if we decide to have per mac FST
1428 	 */
1429 	struct dp_rx_fst *rx_fst;
1430 #ifdef WLAN_SUPPORT_RX_FISA
1431 	uint8_t fisa_enable;
1432 
1433 	/**
1434 	 * Params used for controlling the fisa aggregation dynamically
1435 	 */
1436 	struct {
1437 		qdf_atomic_t skip_fisa;
1438 		uint8_t fisa_force_flush[MAX_REO_DEST_RINGS];
1439 	} skip_fisa_param;
1440 #endif
1441 #endif /* WLAN_SUPPORT_RX_FLOW_TAG || WLAN_SUPPORT_RX_FISA */
1442 	/* Full monitor mode support */
1443 	bool full_mon_mode;
1444 	/* SG supported for msdu continued packets from wbm release ring */
1445 	bool wbm_release_desc_rx_sg_support;
1446 	bool peer_map_attach_success;
1447 	/* Flag to disable mac1 ring interrupts */
1448 	bool disable_mac1_intr;
1449 	/* Flag to disable mac2 ring interrupts */
1450 	bool disable_mac2_intr;
1451 
1452 	struct {
1453 		/* 1st msdu in sg for msdu continued packets in wbm rel ring */
1454 		bool wbm_is_first_msdu_in_sg;
1455 		/* Wbm sg list head */
1456 		qdf_nbuf_t wbm_sg_nbuf_head;
1457 		/* Wbm sg list tail */
1458 		qdf_nbuf_t wbm_sg_nbuf_tail;
1459 		uint32_t wbm_sg_desc_msdu_len;
1460 	} wbm_sg_param;
1461 	/* Number of msdu exception descriptors */
1462 	uint32_t num_msdu_exception_desc;
1463 
1464 	/* RX buffer params */
1465 	struct rx_buff_pool rx_buff_pool[MAX_PDEV_CNT];
1466 	/* Save recent operation related variable */
1467 	struct dp_last_op_info last_op_info;
1468 };
1469 
1470 #ifdef IPA_OFFLOAD
1471 /**
1472  * dp_ipa_resources - Resources needed for IPA
1473  */
1474 struct dp_ipa_resources {
1475 	qdf_shared_mem_t tx_ring;
1476 	uint32_t tx_num_alloc_buffer;
1477 
1478 	qdf_shared_mem_t tx_comp_ring;
1479 	qdf_shared_mem_t rx_rdy_ring;
1480 	qdf_shared_mem_t rx_refill_ring;
1481 
1482 	/* IPA UC doorbell registers paddr */
1483 	qdf_dma_addr_t tx_comp_doorbell_paddr;
1484 	uint32_t *tx_comp_doorbell_vaddr;
1485 	qdf_dma_addr_t rx_ready_doorbell_paddr;
1486 };
1487 #endif
1488 
1489 #define MAX_RX_MAC_RINGS 2
1490 /* Same as NAC_MAX_CLENT */
1491 #define DP_NAC_MAX_CLIENT  24
1492 
1493 /*
1494  * 24 bits cookie size
1495  * 10 bits page id 0 ~ 1023 for MCL
1496  * 3 bits page id 0 ~ 7 for WIN
1497  * WBM Idle List Desc size = 128,
1498  * Num descs per page = 4096/128 = 32 for MCL
1499  * Num descs per page = 2MB/128 = 16384 for WIN
1500  */
1501 /*
1502  * Macros to setup link descriptor cookies - for link descriptors, we just
1503  * need first 3 bits to store bank/page ID for WIN. The
1504  * remaining bytes will be used to set a unique ID, which will
1505  * be useful in debugging
1506  */
1507 #ifdef MAX_ALLOC_PAGE_SIZE
1508 #define LINK_DESC_PAGE_ID_MASK  0x007FE0
1509 #define LINK_DESC_ID_SHIFT      5
1510 #define LINK_DESC_COOKIE(_desc_id, _page_id) \
1511 	((((_page_id) + LINK_DESC_ID_START) << LINK_DESC_ID_SHIFT) | (_desc_id))
1512 #define LINK_DESC_COOKIE_PAGE_ID(_cookie) \
1513 	(((_cookie) & LINK_DESC_PAGE_ID_MASK) >> LINK_DESC_ID_SHIFT)
1514 #else
1515 #define LINK_DESC_PAGE_ID_MASK  0x7
1516 #define LINK_DESC_ID_SHIFT      3
1517 #define LINK_DESC_COOKIE(_desc_id, _page_id) \
1518 	((((_desc_id) + LINK_DESC_ID_START) << LINK_DESC_ID_SHIFT) | (_page_id))
1519 #define LINK_DESC_COOKIE_PAGE_ID(_cookie) \
1520 	((_cookie) & LINK_DESC_PAGE_ID_MASK)
1521 #endif
1522 #define LINK_DESC_ID_START 0x8000
1523 
1524 /* same as ieee80211_nac_param */
1525 enum dp_nac_param_cmd {
1526 	/* IEEE80211_NAC_PARAM_ADD */
1527 	DP_NAC_PARAM_ADD = 1,
1528 	/* IEEE80211_NAC_PARAM_DEL */
1529 	DP_NAC_PARAM_DEL,
1530 	/* IEEE80211_NAC_PARAM_LIST */
1531 	DP_NAC_PARAM_LIST,
1532 };
1533 
1534 /**
1535  * struct dp_neighbour_peer - neighbour peer list type for smart mesh
1536  * @neighbour_peers_macaddr: neighbour peer's mac address
1537  * @neighbour_peer_list_elem: neighbour peer list TAILQ element
1538  * @ast_entry: ast_entry for neighbour peer
1539  * @rssi: rssi value
1540  */
1541 struct dp_neighbour_peer {
1542 	/* MAC address of neighbour's peer */
1543 	union dp_align_mac_addr neighbour_peers_macaddr;
1544 	struct dp_vdev *vdev;
1545 	struct dp_ast_entry *ast_entry;
1546 	uint8_t rssi;
1547 	/* node in the list of neighbour's peer */
1548 	TAILQ_ENTRY(dp_neighbour_peer) neighbour_peer_list_elem;
1549 };
1550 
1551 #ifdef WLAN_TX_PKT_CAPTURE_ENH
1552 #define WLAN_TX_PKT_CAPTURE_ENH 1
1553 #define DP_TX_PPDU_PROC_THRESHOLD 8
1554 #define DP_TX_PPDU_PROC_TIMEOUT 10
1555 #endif
1556 
1557 /**
1558  * struct ppdu_info - PPDU Status info descriptor
1559  * @ppdu_id: Unique ppduid assigned by firmware for every tx packet
1560  * @sched_cmdid: schedule command id, which will be same in a burst
1561  * @max_ppdu_id: wrap around for ppdu id
1562  * @last_tlv_cnt: Keep track for missing ppdu tlvs
1563  * @last_user: last ppdu processed for user
1564  * @is_ampdu: set if Ampdu aggregate
1565  * @nbuf: ppdu descriptor payload
1566  * @ppdu_desc: ppdu descriptor
1567  * @ppdu_info_list_elem: linked list of ppdu tlvs
1568  * @ppdu_info_queue_elem: Singly linked list (queue) of ppdu tlvs
1569  * @mpdu_compltn_common_tlv: Successful tlv counter from COMPLTN COMMON tlv
1570  * @mpdu_ack_ba_tlv: Successful tlv counter from ACK BA tlv
1571  */
1572 struct ppdu_info {
1573 	uint32_t ppdu_id;
1574 	uint32_t sched_cmdid;
1575 	uint32_t max_ppdu_id;
1576 	uint32_t tsf_l32;
1577 	uint16_t tlv_bitmap;
1578 	uint16_t last_tlv_cnt;
1579 	uint16_t last_user:8,
1580 		 is_ampdu:1;
1581 	qdf_nbuf_t nbuf;
1582 	struct cdp_tx_completion_ppdu *ppdu_desc;
1583 #ifdef WLAN_TX_PKT_CAPTURE_ENH
1584 	union {
1585 		TAILQ_ENTRY(ppdu_info) ppdu_info_dlist_elem;
1586 		STAILQ_ENTRY(ppdu_info) ppdu_info_slist_elem;
1587 	} ulist;
1588 #define ppdu_info_list_elem ulist.ppdu_info_dlist_elem
1589 #define ppdu_info_queue_elem ulist.ppdu_info_slist_elem
1590 #else
1591 	TAILQ_ENTRY(ppdu_info) ppdu_info_list_elem;
1592 #endif
1593 	uint8_t compltn_common_tlv;
1594 	uint8_t ack_ba_tlv;
1595 	bool done;
1596 };
1597 
1598 /**
1599  * struct msdu_completion_info - wbm msdu completion info
1600  * @ppdu_id            - Unique ppduid assigned by firmware for every tx packet
1601  * @peer_id            - peer_id
1602  * @tid                - tid which used during transmit
1603  * @first_msdu         - first msdu indication
1604  * @last_msdu          - last msdu indication
1605  * @msdu_part_of_amsdu - msdu part of amsdu
1606  * @transmit_cnt       - retried count
1607  * @status             - transmit status
1608  * @tsf                - timestamp which it transmitted
1609  */
1610 struct msdu_completion_info {
1611 	uint32_t ppdu_id;
1612 	uint16_t peer_id;
1613 	uint8_t tid;
1614 	uint8_t first_msdu:1,
1615 		last_msdu:1,
1616 		msdu_part_of_amsdu:1;
1617 	uint8_t transmit_cnt;
1618 	uint8_t status;
1619 	uint32_t tsf;
1620 };
1621 
1622 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
1623 struct rx_protocol_tag_map {
1624 	/* This is the user configured tag for the said protocol type */
1625 	uint16_t tag;
1626 };
1627 
1628 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
1629 struct rx_protocol_tag_stats {
1630 	uint32_t tag_ctr;
1631 };
1632 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
1633 
1634 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
1635 
1636 #ifndef WLAN_TX_PKT_CAPTURE_ENH
1637 struct dp_pdev_tx_capture {
1638 };
1639 
1640 struct dp_peer_tx_capture {
1641 };
1642 #endif
1643 #ifdef WLAN_RX_PKT_CAPTURE_ENH
1644 /* Template data to be set for Enhanced RX Monitor packets */
1645 #define RX_MON_CAP_ENH_TRAILER 0xdeadc0dedeadda7a
1646 
1647 /**
1648  * struct dp_rx_mon_enh_trailer_data - Data structure to set a known pattern
1649  * at end of each MSDU in monitor-lite mode
1650  * @reserved1: reserved for future use
1651  * @reserved2: reserved for future use
1652  * @flow_tag: flow tag value read from skb->cb
1653  * @protocol_tag: protocol tag value read from skb->cb
1654  */
1655 struct dp_rx_mon_enh_trailer_data {
1656 	uint16_t reserved1;
1657 	uint16_t reserved2;
1658 	uint16_t flow_tag;
1659 	uint16_t protocol_tag;
1660 };
1661 #endif /* WLAN_RX_PKT_CAPTURE_ENH */
1662 
1663 /* PDEV level structure for data path */
1664 struct dp_pdev {
1665 	/**
1666 	 * Re-use Memory Section Starts
1667 	 */
1668 
1669 	/* PDEV Id */
1670 	int pdev_id;
1671 
1672 	/* LMAC Id */
1673 	int lmac_id;
1674 
1675 	/* Target pdev  Id */
1676 	int target_pdev_id;
1677 
1678 	/* TXRX SOC handle */
1679 	struct dp_soc *soc;
1680 
1681 	/* Stuck count on monitor destination ring MPDU process */
1682 	uint32_t mon_dest_ring_stuck_cnt;
1683 
1684 	bool pdev_deinit;
1685 
1686 	/* pdev status down or up required to handle dynamic hw
1687 	 * mode switch between DBS and DBS_SBS.
1688 	 * 1 = down
1689 	 * 0 = up
1690 	 */
1691 	bool is_pdev_down;
1692 
1693 	/* Second ring used to replenish rx buffers */
1694 	struct dp_srng rx_refill_buf_ring2;
1695 
1696 	/* Empty ring used by firmware to post rx buffers to the MAC */
1697 	struct dp_srng rx_mac_buf_ring[MAX_RX_MAC_RINGS];
1698 
1699 	int ch_band_lmac_id_mapping[REG_BAND_UNKNOWN];
1700 
1701 	/* wlan_cfg pdev ctxt*/
1702 	 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx;
1703 
1704 	/**
1705 	 * TODO: See if we need a ring map here for LMAC rings.
1706 	 * 1. Monitor rings are currently planning to be processed on receiving
1707 	 * PPDU end interrupts and hence wont need ring based interrupts.
1708 	 * 2. Rx buffer rings will be replenished during REO destination
1709 	 * processing and doesn't require regular interrupt handling - we will
1710 	 * only handle low water mark interrupts which is not expected
1711 	 * frequently
1712 	 */
1713 
1714 	/* VDEV list */
1715 	TAILQ_HEAD(, dp_vdev) vdev_list;
1716 
1717 	/* vdev list lock */
1718 	qdf_spinlock_t vdev_list_lock;
1719 
1720 	/* Number of vdevs this device have */
1721 	uint16_t vdev_count;
1722 
1723 	/* PDEV transmit lock */
1724 	qdf_spinlock_t tx_lock;
1725 
1726 #ifndef REMOVE_PKT_LOG
1727 	bool pkt_log_init;
1728 	/* Pktlog pdev */
1729 	struct pktlog_dev_t *pl_dev;
1730 #endif /* #ifndef REMOVE_PKT_LOG */
1731 
1732 	/* Monitor mode interface and status storage */
1733 	struct dp_vdev *monitor_vdev;
1734 
1735 	/* Monitor mode operation channel */
1736 	int mon_chan_num;
1737 
1738 	/* Monitor mode operation frequency */
1739 	qdf_freq_t mon_chan_freq;
1740 
1741 	/* Monitor mode band */
1742 	enum reg_wifi_band mon_chan_band;
1743 
1744 	/* monitor mode lock */
1745 	qdf_spinlock_t mon_lock;
1746 
1747 	/*tx_mutex for me*/
1748 	DP_MUTEX_TYPE tx_mutex;
1749 
1750 	/* monitor */
1751 	bool monitor_configured;
1752 
1753 	/* Smart Mesh */
1754 	bool filter_neighbour_peers;
1755 
1756 	/*flag to indicate neighbour_peers_list not empty */
1757 	bool neighbour_peers_added;
1758 	/* smart mesh mutex */
1759 	qdf_spinlock_t neighbour_peer_mutex;
1760 	/* Neighnour peer list */
1761 	TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list;
1762 	/* msdu chain head & tail */
1763 	qdf_nbuf_t invalid_peer_head_msdu;
1764 	qdf_nbuf_t invalid_peer_tail_msdu;
1765 
1766 	/* Band steering  */
1767 	/* TBD */
1768 
1769 	/* PDEV level data path statistics */
1770 	struct cdp_pdev_stats stats;
1771 
1772 	/* Global RX decap mode for the device */
1773 	enum htt_pkt_type rx_decap_mode;
1774 
1775 	/* Enhanced Stats is enabled */
1776 	bool enhanced_stats_en;
1777 
1778 	/* advance filter mode and type*/
1779 	uint8_t mon_filter_mode;
1780 	uint16_t fp_mgmt_filter;
1781 	uint16_t fp_ctrl_filter;
1782 	uint16_t fp_data_filter;
1783 	uint16_t mo_mgmt_filter;
1784 	uint16_t mo_ctrl_filter;
1785 	uint16_t mo_data_filter;
1786 	uint16_t md_data_filter;
1787 
1788 	qdf_atomic_t num_tx_outstanding;
1789 
1790 	qdf_atomic_t num_tx_exception;
1791 
1792 	/* MCL specific local peer handle */
1793 	struct {
1794 		uint8_t pool[OL_TXRX_NUM_LOCAL_PEER_IDS + 1];
1795 		uint8_t freelist;
1796 		qdf_spinlock_t lock;
1797 		struct dp_peer *map[OL_TXRX_NUM_LOCAL_PEER_IDS];
1798 	} local_peer_ids;
1799 
1800 	/* dscp_tid_map_*/
1801 	uint8_t dscp_tid_map[DP_MAX_TID_MAPS][DSCP_TID_MAP_MAX];
1802 
1803 	struct hal_rx_ppdu_info ppdu_info;
1804 
1805 	/* operating channel */
1806 	struct {
1807 		uint8_t num;
1808 		uint8_t band;
1809 		uint16_t freq;
1810 	} operating_channel;
1811 
1812 	qdf_nbuf_queue_t rx_status_q;
1813 	uint32_t mon_ppdu_status;
1814 	struct cdp_mon_status rx_mon_recv_status;
1815 	/* monitor mode status/destination ring PPDU and MPDU count */
1816 	struct cdp_pdev_mon_stats rx_mon_stats;
1817 	/* to track duplicate link descriptor indications by HW for a WAR */
1818 	uint64_t mon_last_linkdesc_paddr;
1819 	/* to track duplicate buffer indications by HW for a WAR */
1820 	uint32_t mon_last_buf_cookie;
1821 	/* 128 bytes mpdu header queue per user for ppdu */
1822 	qdf_nbuf_queue_t mpdu_q[MAX_MU_USERS];
1823 	/* is this a mpdu header TLV and not msdu header TLV */
1824 	bool is_mpdu_hdr[MAX_MU_USERS];
1825 	/* per user 128 bytes msdu header list for MPDU */
1826 	struct msdu_list msdu_list[MAX_MU_USERS];
1827 	/* RX enhanced capture mode */
1828 	uint8_t rx_enh_capture_mode;
1829 	/* Rx per peer enhanced capture mode */
1830 	bool rx_enh_capture_peer;
1831 	struct dp_vdev *rx_enh_monitor_vdev;
1832 	/* RX enhanced capture trailer enable/disable flag */
1833 	bool is_rx_enh_capture_trailer_enabled;
1834 #ifdef WLAN_RX_PKT_CAPTURE_ENH
1835 	/* RX per MPDU/PPDU information */
1836 	struct cdp_rx_indication_mpdu mpdu_ind;
1837 #endif
1838 	/* pool addr for mcast enhance buff */
1839 	struct {
1840 		int size;
1841 		uint32_t paddr;
1842 		char *vaddr;
1843 		struct dp_tx_me_buf_t *freelist;
1844 		int buf_in_use;
1845 		qdf_dma_mem_context(memctx);
1846 	} me_buf;
1847 
1848 	bool hmmc_tid_override_en;
1849 	uint8_t hmmc_tid;
1850 
1851 	/* Number of VAPs with mcast enhancement enabled */
1852 	qdf_atomic_t mc_num_vap_attached;
1853 
1854 	qdf_atomic_t stats_cmd_complete;
1855 
1856 #ifdef IPA_OFFLOAD
1857 	ipa_uc_op_cb_type ipa_uc_op_cb;
1858 	void *usr_ctxt;
1859 	struct dp_ipa_resources ipa_resource;
1860 #endif
1861 
1862 	/* TBD */
1863 
1864 	/* map this pdev to a particular Reo Destination ring */
1865 	enum cdp_host_reo_dest_ring reo_dest;
1866 
1867 	/* Packet log mode */
1868 	uint8_t rx_pktlog_mode;
1869 
1870 	/* WDI event handlers */
1871 	struct wdi_event_subscribe_t **wdi_event_list;
1872 
1873 	/* ppdu_id of last received HTT TX stats */
1874 	uint32_t last_ppdu_id;
1875 	struct {
1876 		uint8_t last_user;
1877 		qdf_nbuf_t buf;
1878 	} tx_ppdu_info;
1879 
1880 	bool tx_sniffer_enable;
1881 	/* mirror copy mode */
1882 	enum m_copy_mode mcopy_mode;
1883 	bool cfr_rcc_mode;
1884 	bool enable_reap_timer_non_pkt;
1885 	bool bpr_enable;
1886 
1887 	/* enable time latency check for tx completion */
1888 	bool latency_capture_enable;
1889 
1890 	/* enable calculation of delay stats*/
1891 	bool delay_stats_flag;
1892 	struct {
1893 		uint32_t tx_ppdu_id;
1894 		uint16_t tx_peer_id;
1895 		uint32_t rx_ppdu_id;
1896 	} m_copy_id;
1897 
1898 	/* To check if PPDU Tx stats are enabled for Pktlog */
1899 	bool pktlog_ppdu_stats;
1900 
1901 	void *dp_txrx_handle; /* Advanced data path handle */
1902 
1903 #ifdef ATH_SUPPORT_NAC_RSSI
1904 	bool nac_rssi_filtering;
1905 #endif
1906 	/* list of ppdu tlvs */
1907 	TAILQ_HEAD(, ppdu_info) ppdu_info_list;
1908 	TAILQ_HEAD(, ppdu_info) sched_comp_ppdu_list;
1909 
1910 	uint32_t sched_comp_list_depth;
1911 	uint16_t delivered_sched_cmdid;
1912 	uint16_t last_sched_cmdid;
1913 	uint32_t tlv_count;
1914 	uint32_t list_depth;
1915 	uint32_t ppdu_id;
1916 	bool first_nbuf;
1917 	struct {
1918 		qdf_nbuf_t last_nbuf; /*Ptr to mgmt last buf */
1919 		uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */
1920 		uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */
1921 		uint32_t ppdu_id;
1922 	} mgmtctrl_frm_info;
1923 
1924 	/* Current noise-floor reading for the pdev channel */
1925 	int16_t chan_noise_floor;
1926 
1927 	/*
1928 	 * For multiradio device, this flag indicates if
1929 	 * this radio is primary or secondary.
1930 	 *
1931 	 * For HK 1.0, this is used for WAR for the AST issue.
1932 	 * HK 1.x mandates creation of only 1 AST entry with same MAC address
1933 	 * across 2 radios. is_primary indicates the radio on which DP should
1934 	 * install HW AST entry if there is a request to add 2 AST entries
1935 	 * with same MAC address across 2 radios
1936 	 */
1937 	uint8_t is_primary;
1938 	/* Context of cal client timer */
1939 	struct cdp_cal_client *cal_client_ctx;
1940 	struct cdp_tx_sojourn_stats sojourn_stats;
1941 	qdf_nbuf_t sojourn_buf;
1942 
1943 	/* peer pointer for collecting invalid peer stats */
1944 	struct dp_peer *invalid_peer;
1945 
1946 	union dp_rx_desc_list_elem_t *free_list_head;
1947 	union dp_rx_desc_list_elem_t *free_list_tail;
1948 	/* Pdev level flag to check peer based pktlog enabled or
1949 	 * disabled
1950 	 */
1951 	uint8_t dp_peer_based_pktlog;
1952 
1953 	/* Cached peer_id from htt_peer_details_tlv */
1954 	uint16_t fw_stats_peer_id;
1955 
1956 	/* qdf_event for fw_peer_stats */
1957 	qdf_event_t fw_peer_stats_event;
1958 
1959 	/* User configured max number of tx buffers */
1960 	uint32_t num_tx_allowed;
1961 
1962 	/* unique cookie required for peer session */
1963 	uint32_t next_peer_cookie;
1964 
1965 	/*
1966 	 * Run time enabled when the first protocol tag is added,
1967 	 * run time disabled when the last protocol tag is deleted
1968 	 */
1969 	bool  is_rx_protocol_tagging_enabled;
1970 
1971 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
1972 	/*
1973 	 * The protocol type is used as array index to save
1974 	 * user provided tag info
1975 	 */
1976 	struct rx_protocol_tag_map rx_proto_tag_map[RX_PROTOCOL_TAG_MAX];
1977 
1978 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS
1979 	/*
1980 	 * Track msdus received from each reo ring separately to avoid
1981 	 * simultaneous writes from different core
1982 	 */
1983 	struct rx_protocol_tag_stats
1984 		reo_proto_tag_stats[MAX_REO_DEST_RINGS][RX_PROTOCOL_TAG_MAX];
1985 	/* Track msdus received from expection ring separately */
1986 	struct rx_protocol_tag_stats
1987 		rx_err_proto_tag_stats[RX_PROTOCOL_TAG_MAX];
1988 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */
1989 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
1990 
1991 	/* tx packet capture enhancement */
1992 	enum cdp_tx_enh_capture_mode tx_capture_enabled;
1993 	struct dp_pdev_tx_capture tx_capture;
1994 
1995 	uint32_t *ppdu_tlv_buf; /* Buffer to hold HTT ppdu stats TLVs*/
1996 
1997 #ifdef WLAN_SUPPORT_RX_FLOW_TAG
1998 	/**
1999 	 * Pointer to DP Flow FST at SOC level if
2000 	 * is_rx_flow_search_table_per_pdev is true
2001 	 */
2002 	struct dp_rx_fst *rx_fst;
2003 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
2004 
2005 #ifdef FEATURE_TSO_STATS
2006 	/* TSO Id to index into TSO packet information */
2007 	qdf_atomic_t tso_idx;
2008 #endif /* FEATURE_TSO_STATS */
2009 
2010 #ifdef WLAN_SUPPORT_DATA_STALL
2011 	data_stall_detect_cb data_stall_detect_callback;
2012 #endif /* WLAN_SUPPORT_DATA_STALL */
2013 
2014 	struct dp_mon_filter **filter;	/* Monitor Filter pointer */
2015 
2016 #ifdef QCA_SUPPORT_FULL_MON
2017 	/* List to maintain all MPDUs for a PPDU in monitor mode */
2018 	TAILQ_HEAD(, dp_mon_mpdu) mon_mpdu_q;
2019 
2020 	/* TODO: define per-user mpdu list
2021 	 * struct dp_mon_mpdu_list mpdu_list[MAX_MU_USERS];
2022 	 */
2023 	struct hal_rx_mon_desc_info *mon_desc;
2024 #endif
2025 	qdf_nbuf_t mcopy_status_nbuf;
2026 
2027 	/* Flag to hold on to monitor destination ring */
2028 	bool hold_mon_dest_ring;
2029 
2030 #ifdef WLAN_ATF_ENABLE
2031 	/* ATF stats enable */
2032 	bool dp_atf_stats_enable;
2033 #endif
2034 
2035 	/* Maintains first status buffer's paddr of a PPDU */
2036 	uint64_t status_buf_addr;
2037 };
2038 
2039 struct dp_peer;
2040 
2041 /* VDEV structure for data path state */
2042 struct dp_vdev {
2043 	/* OS device abstraction */
2044 	qdf_device_t osdev;
2045 
2046 	/* physical device that is the parent of this virtual device */
2047 	struct dp_pdev *pdev;
2048 
2049 	/* VDEV operating mode */
2050 	enum wlan_op_mode opmode;
2051 
2052 	/* VDEV subtype */
2053 	enum wlan_op_subtype subtype;
2054 
2055 	/* Tx encapsulation type for this VAP */
2056 	enum htt_cmn_pkt_type tx_encap_type;
2057 
2058 	/* Rx Decapsulation type for this VAP */
2059 	enum htt_cmn_pkt_type rx_decap_type;
2060 
2061 	/* BSS peer */
2062 	struct dp_peer *vap_bss_peer;
2063 
2064 	/* WDS enabled */
2065 	bool wds_enabled;
2066 
2067 	/* MEC enabled */
2068 	bool mec_enabled;
2069 
2070 	/* WDS Aging timer period */
2071 	uint32_t wds_aging_timer_val;
2072 
2073 	/* NAWDS enabled */
2074 	bool nawds_enabled;
2075 
2076 	/* Multicast enhancement enabled */
2077 	uint8_t mcast_enhancement_en;
2078 
2079 	/* HW TX Checksum Enabled Flag */
2080 	uint8_t csum_enabled;
2081 
2082 	/* vdev_id - ID used to specify a particular vdev to the target */
2083 	uint8_t vdev_id;
2084 
2085 	/* Default HTT meta data for this VDEV */
2086 	/* TBD: check alignment constraints */
2087 	uint16_t htt_tcl_metadata;
2088 
2089 	/* Mesh mode vdev */
2090 	uint32_t mesh_vdev;
2091 
2092 	/* Mesh mode rx filter setting */
2093 	uint32_t mesh_rx_filter;
2094 
2095 	/* DSCP-TID mapping table ID */
2096 	uint8_t dscp_tid_map_id;
2097 
2098 	/* Address search type to be set in TX descriptor */
2099 	uint8_t search_type;
2100 
2101 	/* AST hash value for BSS peer in HW valid for STA VAP*/
2102 	uint16_t bss_ast_hash;
2103 
2104 	/* vdev lmac_id */
2105 	int lmac_id;
2106 
2107 	bool multipass_en;
2108 
2109 	/* Address search flags to be configured in HAL descriptor */
2110 	uint8_t hal_desc_addr_search_flags;
2111 
2112 	/* Handle to the OS shim SW's virtual device */
2113 	ol_osif_vdev_handle osif_vdev;
2114 
2115 	/* MAC address */
2116 	union dp_align_mac_addr mac_addr;
2117 
2118 	/* node in the pdev's list of vdevs */
2119 	TAILQ_ENTRY(dp_vdev) vdev_list_elem;
2120 
2121 	/* dp_peer list */
2122 	TAILQ_HEAD(, dp_peer) peer_list;
2123 
2124 	/* RX call back function to flush GRO packets*/
2125 	ol_txrx_rx_gro_flush_ind_fp osif_gro_flush;
2126 	/* default RX call back function called by dp */
2127 	ol_txrx_rx_fp osif_rx;
2128 	/* callback to deliver rx frames to the OS */
2129 	ol_txrx_rx_fp osif_rx_stack;
2130 	/* Callback to handle rx fisa frames */
2131 	ol_txrx_fisa_rx_fp osif_fisa_rx;
2132 	ol_txrx_fisa_flush_fp osif_fisa_flush;
2133 
2134 	/* call back function to flush out queued rx packets*/
2135 	ol_txrx_rx_flush_fp osif_rx_flush;
2136 	ol_txrx_rsim_rx_decap_fp osif_rsim_rx_decap;
2137 	ol_txrx_get_key_fp osif_get_key;
2138 	ol_txrx_tx_free_ext_fp osif_tx_free_ext;
2139 
2140 #ifdef notyet
2141 	/* callback to check if the msdu is an WAI (WAPI) frame */
2142 	ol_rx_check_wai_fp osif_check_wai;
2143 #endif
2144 
2145 	/* proxy arp function */
2146 	ol_txrx_proxy_arp_fp osif_proxy_arp;
2147 
2148 	/* callback to hand rx monitor 802.11 MPDU to the OS shim */
2149 	ol_txrx_rx_mon_fp osif_rx_mon;
2150 
2151 	ol_txrx_mcast_me_fp me_convert;
2152 
2153 	/* completion function used by this vdev*/
2154 	ol_txrx_completion_fp tx_comp;
2155 
2156 	/* deferred vdev deletion state */
2157 	struct {
2158 		/* VDEV delete pending */
2159 		int pending;
2160 		/*
2161 		* callback and a context argument to provide a
2162 		* notification for when the vdev is deleted.
2163 		*/
2164 		ol_txrx_vdev_delete_cb callback;
2165 		void *context;
2166 	} delete;
2167 
2168 	/* tx data delivery notification callback function */
2169 	struct {
2170 		ol_txrx_data_tx_cb func;
2171 		void *ctxt;
2172 	} tx_non_std_data_callback;
2173 
2174 
2175 	/* safe mode control to bypass the encrypt and decipher process*/
2176 	uint32_t safemode;
2177 
2178 	/* rx filter related */
2179 	uint32_t drop_unenc;
2180 #ifdef notyet
2181 	privacy_exemption privacy_filters[MAX_PRIVACY_FILTERS];
2182 	uint32_t filters_num;
2183 #endif
2184 	/* TDLS Link status */
2185 	bool tdls_link_connected;
2186 	bool is_tdls_frame;
2187 
2188 	/* per vdev rx nbuf queue */
2189 	qdf_nbuf_queue_t rxq;
2190 
2191 	uint8_t tx_ring_id;
2192 	struct dp_tx_desc_pool_s *tx_desc;
2193 	struct dp_tx_ext_desc_pool_s *tx_ext_desc;
2194 
2195 	/* VDEV Stats */
2196 	struct cdp_vdev_stats stats;
2197 
2198 	/* Is this a proxySTA VAP */
2199 	bool proxysta_vdev;
2200 	/* Is isolation mode enabled */
2201 	bool isolation_vdev;
2202 
2203 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
2204 	struct dp_tx_desc_pool_s *pool;
2205 #endif
2206 	/* AP BRIDGE enabled */
2207 	bool ap_bridge_enabled;
2208 
2209 	enum cdp_sec_type  sec_type;
2210 
2211 	/* SWAR for HW: Enable WEP bit in the AMSDU frames for RAW mode */
2212 	bool raw_mode_war;
2213 
2214 
2215 	/* AST hash index for BSS peer in HW valid for STA VAP*/
2216 	uint16_t bss_ast_idx;
2217 
2218 	/* Capture timestamp of previous tx packet enqueued */
2219 	uint64_t prev_tx_enq_tstamp;
2220 
2221 	/* Capture timestamp of previous rx packet delivered */
2222 	uint64_t prev_rx_deliver_tstamp;
2223 
2224 	/* 8021p PCP-TID mapping table ID */
2225 	uint8_t tidmap_tbl_id;
2226 
2227 	/* 8021p PCP-TID map values */
2228 	uint8_t pcp_tid_map[PCP_TID_MAP_MAX];
2229 
2230 	/* TIDmap priority */
2231 	uint8_t tidmap_prty;
2232 
2233 #ifdef QCA_MULTIPASS_SUPPORT
2234 	uint16_t *iv_vlan_map;
2235 
2236 	/* dp_peer special list */
2237 	TAILQ_HEAD(, dp_peer) mpass_peer_list;
2238 	DP_MUTEX_TYPE mpass_peer_mutex;
2239 #endif
2240 	/* Extended data path handle */
2241 	struct cdp_ext_vdev *vdev_dp_ext_handle;
2242 #ifdef VDEV_PEER_PROTOCOL_COUNT
2243 	/*
2244 	 * Rx-Ingress and Tx-Egress are in the lower level DP layer
2245 	 * Rx-Egress and Tx-ingress are handled in osif layer for DP
2246 	 * So
2247 	 * Rx-Egress and Tx-ingress mask definitions are in OSIF layer
2248 	 * Rx-Ingress and Tx-Egress definitions are here below
2249 	 */
2250 #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1
2251 #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2
2252 #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4
2253 #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8
2254 	bool peer_protocol_count_track;
2255 	int peer_protocol_count_dropmask;
2256 #endif
2257 	/* callback to collect connectivity stats */
2258 	ol_txrx_stats_rx_fp stats_cb;
2259 
2260 #ifdef WLAN_SUPPORT_RX_FISA
2261 	/**
2262 	 * Params used for controlling the fisa aggregation dynamically
2263 	 */
2264 	uint8_t fisa_disallowed[MAX_REO_DEST_RINGS];
2265 	uint8_t fisa_force_flushed[MAX_REO_DEST_RINGS];
2266 #endif
2267 };
2268 
2269 
2270 enum {
2271 	dp_sec_mcast = 0,
2272 	dp_sec_ucast
2273 };
2274 
2275 #ifdef WDS_VENDOR_EXTENSION
2276 typedef struct {
2277 	uint8_t	wds_tx_mcast_4addr:1,
2278 		wds_tx_ucast_4addr:1,
2279 		wds_rx_filter:1,      /* enforce rx filter */
2280 		wds_rx_ucast_4addr:1, /* when set, accept 4addr unicast frames    */
2281 		wds_rx_mcast_4addr:1;  /* when set, accept 4addr multicast frames  */
2282 
2283 } dp_ecm_policy;
2284 #endif
2285 
2286 /*
2287  * struct dp_peer_cached_bufq - cached_bufq to enqueue rx packets
2288  * @cached_bufq: nbuff list to enqueue rx packets
2289  * @bufq_lock: spinlock for nbuff list access
2290  * @thres: maximum threshold for number of rx buff to enqueue
2291  * @entries: number of entries
2292  * @dropped: number of packets dropped
2293  */
2294 struct dp_peer_cached_bufq {
2295 	qdf_list_t cached_bufq;
2296 	qdf_spinlock_t bufq_lock;
2297 	uint32_t thresh;
2298 	uint32_t entries;
2299 	uint32_t dropped;
2300 };
2301 
2302 /**
2303  * enum dp_peer_ast_flowq
2304  * @DP_PEER_AST_FLOWQ_HI_PRIO: Hi Priority flow queue
2305  * @DP_PEER_AST_FLOWQ_LOW_PRIO: Low priority flow queue
2306  * @DP_PEER_AST_FLOWQ_UDP: flow queue type is UDP
2307  * @DP_PEER_AST_FLOWQ_NON_UDP: flow queue type is Non UDP
2308  */
2309 enum dp_peer_ast_flowq {
2310 	DP_PEER_AST_FLOWQ_HI_PRIO,
2311 	DP_PEER_AST_FLOWQ_LOW_PRIO,
2312 	DP_PEER_AST_FLOWQ_UDP,
2313 	DP_PEER_AST_FLOWQ_NON_UDP,
2314 	DP_PEER_AST_FLOWQ_MAX,
2315 };
2316 
2317 /*
2318  * struct dp_ast_flow_override_info - ast override info
2319  * @ast_index - ast indexes in peer map message
2320  * @ast_valid_mask - ast valid mask for each ast index
2321  * @ast_flow_mask - ast flow mask for each ast index
2322  * @tid_valid_low_pri_mask - per tid mask for low priority flow
2323  * @tid_valid_hi_pri_mask - per tid mask for hi priority flow
2324  */
2325 struct dp_ast_flow_override_info {
2326 	uint16_t ast_idx[DP_PEER_AST_FLOWQ_MAX];
2327 	uint8_t ast_valid_mask;
2328 	uint8_t ast_flow_mask[DP_PEER_AST_FLOWQ_MAX];
2329 	uint8_t tid_valid_low_pri_mask;
2330 	uint8_t tid_valid_hi_pri_mask;
2331 };
2332 
2333 /*
2334  * struct dp_peer_ast_params - ast parameters for a msdu flow-queue
2335  * @ast_index - ast index populated by FW
2336  * @is_valid - ast flow valid mask
2337  * @valid_tid_mask - per tid mask for this ast index
2338  * @flowQ - flow queue id associated with this ast index
2339  */
2340 struct dp_peer_ast_params {
2341 	uint16_t ast_idx;
2342 	uint8_t is_valid;
2343 	uint8_t valid_tid_mask;
2344 	uint8_t flowQ;
2345 };
2346 
2347 /* Peer structure for data path state */
2348 struct dp_peer {
2349 	/* VDEV to which this peer is associated */
2350 	struct dp_vdev *vdev;
2351 
2352 	struct dp_ast_entry *self_ast_entry;
2353 
2354 	qdf_atomic_t ref_cnt;
2355 
2356 	/* peer ID for this peer */
2357 	uint16_t peer_id;
2358 
2359 	union dp_align_mac_addr mac_addr;
2360 
2361 	/* node in the vdev's list of peers */
2362 	TAILQ_ENTRY(dp_peer) peer_list_elem;
2363 	/* node in the hash table bin's list of peers */
2364 	TAILQ_ENTRY(dp_peer) hash_list_elem;
2365 
2366 	/* TID structures */
2367 	struct dp_rx_tid rx_tid[DP_MAX_TIDS];
2368 	struct dp_peer_tx_capture tx_capture;
2369 
2370 
2371 	/* TBD: No transmit TID state required? */
2372 
2373 	struct {
2374 		enum cdp_sec_type sec_type;
2375 		u_int32_t michael_key[2]; /* relevant for TKIP */
2376 	} security[2]; /* 0 -> multicast, 1 -> unicast */
2377 
2378 	/* NAWDS Flag and Bss Peer bit */
2379 	uint16_t nawds_enabled:1, /* NAWDS flag */
2380 		bss_peer:1, /* set for bss peer */
2381 		wds_enabled:1, /* WDS peer */
2382 		authorize:1, /* Set when authorized */
2383 		nac:1, /* NAC Peer*/
2384 		tx_cap_enabled:1, /* Peer's tx-capture is enabled */
2385 		rx_cap_enabled:1, /* Peer's rx-capture is enabled */
2386 		valid:1, /* valid bit */
2387 		in_twt:1, /* in TWT session */
2388 		delete_in_progress:1, /*delete_in_progress bit*/
2389 		sta_self_peer:1; /* Indicate STA self peer */
2390 
2391 #ifdef QCA_SUPPORT_PEER_ISOLATION
2392 	bool isolation; /* enable peer isolation for this peer */
2393 #endif
2394 
2395 	/* MCL specific peer local id */
2396 	uint16_t local_id;
2397 	enum ol_txrx_peer_state state;
2398 	qdf_spinlock_t peer_info_lock;
2399 
2400 	/* Peer Stats */
2401 	struct cdp_peer_stats stats;
2402 
2403 	/* Peer extended stats */
2404 	struct cdp_peer_ext_stats *pext_stats;
2405 
2406 	TAILQ_HEAD(, dp_ast_entry) ast_entry_list;
2407 	/* TBD */
2408 
2409 #ifdef WDS_VENDOR_EXTENSION
2410 	dp_ecm_policy wds_ecm;
2411 #endif
2412 
2413 	/* Active Block ack sessions */
2414 	uint16_t active_ba_session_cnt;
2415 
2416 	/* Current HW buffersize setting */
2417 	uint16_t hw_buffer_size;
2418 
2419 	/*
2420 	 * Flag to check if sessions with 256 buffersize
2421 	 * should be terminated.
2422 	 */
2423 	uint8_t kill_256_sessions;
2424 	qdf_atomic_t is_default_route_set;
2425 	/* Peer level flag to check peer based pktlog enabled or
2426 	 * disabled
2427 	 */
2428 	uint8_t peer_based_pktlog_filter;
2429 
2430 	/* rdk statistics context */
2431 	struct cdp_peer_rate_stats_ctx *wlanstats_ctx;
2432 	/* average sojourn time */
2433 	qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX];
2434 
2435 #ifdef QCA_MULTIPASS_SUPPORT
2436 	/* node in the special peer list element */
2437 	TAILQ_ENTRY(dp_peer) mpass_peer_list_elem;
2438 	/* vlan id for key */
2439 	uint16_t vlan_id;
2440 #endif
2441 
2442 #ifdef PEER_CACHE_RX_PKTS
2443 	qdf_atomic_t flush_in_progress;
2444 	struct dp_peer_cached_bufq bufq_info;
2445 #endif
2446 #ifdef FEATURE_PERPKT_INFO
2447 	/* delayed ba ppdu stats handling */
2448 	struct cdp_delayed_tx_completion_ppdu_user delayed_ba_ppdu_stats;
2449 	/* delayed ba flag */
2450 	bool last_delayed_ba;
2451 	/* delayed ba ppdu id */
2452 	uint32_t last_delayed_ba_ppduid;
2453 #endif
2454 #ifdef QCA_PEER_MULTIQ_SUPPORT
2455 	struct dp_peer_ast_params peer_ast_flowq_idx[DP_PEER_AST_FLOWQ_MAX];
2456 #endif
2457 };
2458 
2459 /*
2460  * dp_invalid_peer_msg
2461  * @nbuf: data buffer
2462  * @wh: 802.11 header
2463  * @vdev_id: id of vdev
2464  */
2465 struct dp_invalid_peer_msg {
2466 	qdf_nbuf_t nbuf;
2467 	struct ieee80211_frame *wh;
2468 	uint8_t vdev_id;
2469 };
2470 
2471 /*
2472  * dp_tx_me_buf_t: ME buffer
2473  * next: pointer to next buffer
2474  * data: Destination Mac address
2475  */
2476 struct dp_tx_me_buf_t {
2477 	/* Note: ME buf pool initialization logic expects next pointer to
2478 	 * be the first element. Dont add anything before next */
2479 	struct dp_tx_me_buf_t *next;
2480 	uint8_t data[QDF_MAC_ADDR_SIZE];
2481 };
2482 
2483 #if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA)
2484 struct hal_rx_fst;
2485 
2486 #ifdef WLAN_SUPPORT_RX_FLOW_TAG
2487 struct dp_rx_fse {
2488 	/* HAL Rx Flow Search Entry which matches HW definition */
2489 	void *hal_rx_fse;
2490 	/* Toeplitz hash value */
2491 	uint32_t flow_hash;
2492 	/* Flow index, equivalent to hash value truncated to FST size */
2493 	uint32_t flow_id;
2494 	/* Stats tracking for this flow */
2495 	struct cdp_flow_stats stats;
2496 	/* Flag indicating whether flow is IPv4 address tuple */
2497 	uint8_t is_ipv4_addr_entry;
2498 	/* Flag indicating whether flow is valid */
2499 	uint8_t is_valid;
2500 };
2501 
2502 struct dp_rx_fst {
2503 	/* Software (DP) FST */
2504 	uint8_t *base;
2505 	/* Pointer to HAL FST */
2506 	struct hal_rx_fst *hal_rx_fst;
2507 	/* Base physical address of HAL RX HW FST */
2508 	uint64_t hal_rx_fst_base_paddr;
2509 	/* Maximum number of flows FSE supports */
2510 	uint16_t max_entries;
2511 	/* Num entries in flow table */
2512 	uint16_t num_entries;
2513 	/* SKID Length */
2514 	uint16_t max_skid_length;
2515 	/* Hash mask to obtain legitimate hash entry */
2516 	uint32_t hash_mask;
2517 	/* Timer for bundling of flows */
2518 	qdf_timer_t cache_invalidate_timer;
2519 	/**
2520 	 * Flag which tracks whether cache update
2521 	 * is needed on timer expiry
2522 	 */
2523 	qdf_atomic_t is_cache_update_pending;
2524 	/* Flag to indicate completion of FSE setup in HW/FW */
2525 	bool fse_setup_done;
2526 };
2527 
2528 #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_rx_fse)
2529 #elif WLAN_SUPPORT_RX_FISA
2530 
2531 struct dp_fisa_stats {
2532 	/* flow index invalid from RX HW TLV */
2533 	uint32_t invalid_flow_index;
2534 };
2535 
2536 enum fisa_aggr_ret {
2537 	FISA_AGGR_DONE,
2538 	FISA_AGGR_NOT_ELIGIBLE,
2539 	FISA_FLUSH_FLOW
2540 };
2541 
2542 struct dp_fisa_rx_sw_ft {
2543 	/* HAL Rx Flow Search Entry which matches HW definition */
2544 	void *hw_fse;
2545 	/* Toeplitz hash value */
2546 	uint32_t flow_hash;
2547 	/* Flow index, equivalent to hash value truncated to FST size */
2548 	uint32_t flow_id;
2549 	/* Stats tracking for this flow */
2550 	struct cdp_flow_stats stats;
2551 	/* Flag indicating whether flow is IPv4 address tuple */
2552 	uint8_t is_ipv4_addr_entry;
2553 	/* Flag indicating whether flow is valid */
2554 	uint8_t is_valid;
2555 	uint8_t is_populated;
2556 	uint8_t is_flow_udp;
2557 	uint8_t is_flow_tcp;
2558 	qdf_nbuf_t head_skb;
2559 	uint16_t cumulative_l4_checksum;
2560 	uint16_t adjusted_cumulative_ip_length;
2561 	uint16_t cur_aggr;
2562 	uint16_t napi_flush_cumulative_l4_checksum;
2563 	uint16_t napi_flush_cumulative_ip_length;
2564 	qdf_nbuf_t last_skb;
2565 	uint32_t head_skb_ip_hdr_offset;
2566 	uint32_t head_skb_l4_hdr_offset;
2567 	struct cdp_rx_flow_tuple_info rx_flow_tuple_info;
2568 	uint8_t napi_id;
2569 	struct dp_vdev *vdev;
2570 	uint64_t bytes_aggregated;
2571 	uint32_t flush_count;
2572 	uint32_t aggr_count;
2573 	uint8_t do_not_aggregate;
2574 	uint16_t hal_cumultive_ip_len;
2575 	struct dp_soc *soc_hdl;
2576 	/* last aggregate count fetched from RX PKT TLV */
2577 	uint32_t last_hal_aggr_count;
2578 	uint32_t cur_aggr_gso_size;
2579 	struct udphdr *head_skb_udp_hdr;
2580 	uint16_t frags_cumulative_len;
2581 };
2582 
2583 #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_fisa_rx_sw_ft)
2584 #define MAX_FSE_CACHE_FL_HST 10
2585 /**
2586  * struct fse_cache_flush_history - Debug history cache flush
2587  * @timestamp: Entry update timestamp
2588  * @flows_added: Number of flows added for this flush
2589  * @flows_deleted: Number of flows deleted for this flush
2590  */
2591 struct fse_cache_flush_history {
2592 	uint64_t timestamp;
2593 	uint32_t flows_added;
2594 	uint32_t flows_deleted;
2595 };
2596 
2597 struct dp_rx_fst {
2598 	/* Software (DP) FST */
2599 	uint8_t *base;
2600 	/* Pointer to HAL FST */
2601 	struct hal_rx_fst *hal_rx_fst;
2602 	/* Base physical address of HAL RX HW FST */
2603 	uint64_t hal_rx_fst_base_paddr;
2604 	/* Maximum number of flows FSE supports */
2605 	uint16_t max_entries;
2606 	/* Num entries in flow table */
2607 	uint16_t num_entries;
2608 	/* SKID Length */
2609 	uint16_t max_skid_length;
2610 	/* Hash mask to obtain legitimate hash entry */
2611 	uint32_t hash_mask;
2612 	/* Lock for adding/deleting entries of FST */
2613 	qdf_spinlock_t dp_rx_fst_lock;
2614 	uint32_t add_flow_count;
2615 	uint32_t del_flow_count;
2616 	uint32_t hash_collision_cnt;
2617 	struct dp_soc *soc_hdl;
2618 	qdf_atomic_t fse_cache_flush_posted;
2619 	qdf_timer_t fse_cache_flush_timer;
2620 	struct fse_cache_flush_history cache_fl_rec[MAX_FSE_CACHE_FL_HST];
2621 	/* FISA DP stats */
2622 	struct dp_fisa_stats stats;
2623 };
2624 
2625 #endif /* WLAN_SUPPORT_RX_FISA */
2626 #endif /* WLAN_SUPPORT_RX_FLOW_TAG || WLAN_SUPPORT_RX_FISA */
2627 
2628 #ifdef WLAN_FEATURE_STATS_EXT
2629 /*
2630  * dp_req_rx_hw_stats_t: RX peer HW stats query structure
2631  * @pending_tid_query_cnt: pending tid stats count which waits for REO status
2632  * @is_query_timeout: flag to show is stats query timeout
2633  */
2634 struct dp_req_rx_hw_stats_t {
2635 	qdf_atomic_t pending_tid_stats_cnt;
2636 	bool is_query_timeout;
2637 };
2638 #endif
2639 
2640 void dp_hw_link_desc_pool_banks_free(struct dp_soc *soc, uint32_t mac_id);
2641 QDF_STATUS dp_hw_link_desc_pool_banks_alloc(struct dp_soc *soc,
2642 					    uint32_t mac_id);
2643 void dp_link_desc_ring_replenish(struct dp_soc *soc, uint32_t mac_id);
2644 
2645 #endif /* _DP_TYPES_H_ */
2646