xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/dp_rx.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef _DP_RX_H
21 #define _DP_RX_H
22 
23 #include "hal_rx.h"
24 #include "dp_peer.h"
25 #include "dp_internal.h"
26 #include <qdf_tracepoint.h>
27 #include "dp_ipa.h"
28 
29 #ifdef RXDMA_OPTIMIZATION
30 #ifndef RX_DATA_BUFFER_ALIGNMENT
31 #define RX_DATA_BUFFER_ALIGNMENT        128
32 #endif
33 #ifndef RX_MONITOR_BUFFER_ALIGNMENT
34 #define RX_MONITOR_BUFFER_ALIGNMENT     128
35 #endif
36 #else /* RXDMA_OPTIMIZATION */
37 #define RX_DATA_BUFFER_ALIGNMENT        4
38 #define RX_MONITOR_BUFFER_ALIGNMENT     4
39 #endif /* RXDMA_OPTIMIZATION */
40 
41 #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
42 #define DP_WBM2SW_RBM(sw0_bm_id)	HAL_RX_BUF_RBM_SW1_BM(sw0_bm_id)
43 /* RBM value used for re-injecting defragmented packets into REO */
44 #define DP_DEFRAG_RBM(sw0_bm_id)	HAL_RX_BUF_RBM_SW3_BM(sw0_bm_id)
45 #endif
46 
47 /* Max buffer in invalid peer SG list*/
48 #define DP_MAX_INVALID_BUFFERS 10
49 #ifdef DP_INVALID_PEER_ASSERT
50 #define DP_PDEV_INVALID_PEER_MSDU_CHECK(head, tail) \
51 		do {                                \
52 			qdf_assert_always(!(head)); \
53 			qdf_assert_always(!(tail)); \
54 		} while (0)
55 #else
56 #define DP_PDEV_INVALID_PEER_MSDU_CHECK(head, tail) /* no op */
57 #endif
58 
59 #define RX_BUFFER_RESERVATION   0
60 #ifdef BE_PKTLOG_SUPPORT
61 #define BUFFER_RESIDUE 1
62 #define RX_MON_MIN_HEAD_ROOM   64
63 #endif
64 
65 #define DP_DEFAULT_NOISEFLOOR	(-96)
66 
67 #define DP_RX_DESC_MAGIC 0xdec0de
68 
69 #define dp_rx_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_RX, params)
70 #define dp_rx_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_RX, params)
71 #define dp_rx_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_RX, params)
72 #define dp_rx_info(params...) \
73 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX, ## params)
74 #define dp_rx_info_rl(params...) \
75 	__QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_RX, ## params)
76 #define dp_rx_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_RX, params)
77 
78 /**
79  * enum dp_rx_desc_state
80  *
81  * @RX_DESC_REPLENISH: rx desc replenished
82  * @RX_DESC_FREELIST: rx desc in freelist
83  */
84 enum dp_rx_desc_state {
85 	RX_DESC_REPLENISHED,
86 	RX_DESC_IN_FREELIST,
87 };
88 
89 #ifndef QCA_HOST_MODE_WIFI_DISABLED
90 /**
91  * struct dp_rx_desc_dbg_info
92  *
93  * @freelist_caller: name of the function that put the
94  *  the rx desc in freelist
95  * @freelist_ts: timestamp when the rx desc is put in
96  *  a freelist
97  * @replenish_caller: name of the function that last
98  *  replenished the rx desc
99  * @replenish_ts: last replenish timestamp
100  * @prev_nbuf: previous nbuf info
101  * @prev_nbuf_data_addr: previous nbuf data address
102  */
103 struct dp_rx_desc_dbg_info {
104 	char freelist_caller[QDF_MEM_FUNC_NAME_SIZE];
105 	uint64_t freelist_ts;
106 	char replenish_caller[QDF_MEM_FUNC_NAME_SIZE];
107 	uint64_t replenish_ts;
108 	qdf_nbuf_t prev_nbuf;
109 	uint8_t *prev_nbuf_data_addr;
110 };
111 
112 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
113 
114 /**
115  * struct dp_rx_desc
116  *
117  * @nbuf		: VA of the "skb" posted
118  * @rx_buf_start	: VA of the original Rx buffer, before
119  *			  movement of any skb->data pointer
120  * @paddr_buf_start     : PA of the original Rx buffer, before
121  *                        movement of any frag pointer
122  * @cookie		: index into the sw array which holds
123  *			  the sw Rx descriptors
124  *			  Cookie space is 21 bits:
125  *			  lower 18 bits -- index
126  *			  upper  3 bits -- pool_id
127  * @pool_id		: pool Id for which this allocated.
128  *			  Can only be used if there is no flow
129  *			  steering
130  * @chip_id		: chip_id indicating MLO chip_id
131  *			  valid or used only in case of multi-chip MLO
132  * @in_use		  rx_desc is in use
133  * @unmapped		  used to mark rx_desc an unmapped if the corresponding
134  *			  nbuf is already unmapped
135  * @in_err_state	: Nbuf sanity failed for this descriptor.
136  * @nbuf_data_addr	: VA of nbuf data posted
137  */
138 struct dp_rx_desc {
139 	qdf_nbuf_t nbuf;
140 	uint8_t *rx_buf_start;
141 	qdf_dma_addr_t paddr_buf_start;
142 	uint32_t cookie;
143 	uint8_t	 pool_id;
144 	uint8_t chip_id;
145 #ifdef RX_DESC_DEBUG_CHECK
146 	uint32_t magic;
147 	uint8_t *nbuf_data_addr;
148 	struct dp_rx_desc_dbg_info *dbg_info;
149 #endif
150 	uint8_t	in_use:1,
151 		unmapped:1,
152 		in_err_state:1;
153 };
154 
155 #ifndef QCA_HOST_MODE_WIFI_DISABLED
156 #ifdef ATH_RX_PRI_SAVE
157 #define DP_RX_TID_SAVE(_nbuf, _tid) \
158 	(qdf_nbuf_set_priority(_nbuf, _tid))
159 #else
160 #define DP_RX_TID_SAVE(_nbuf, _tid)
161 #endif
162 
163 /* RX Descriptor Multi Page memory alloc related */
164 #define DP_RX_DESC_OFFSET_NUM_BITS 8
165 #define DP_RX_DESC_PAGE_ID_NUM_BITS 8
166 #define DP_RX_DESC_POOL_ID_NUM_BITS 4
167 
168 #define DP_RX_DESC_PAGE_ID_SHIFT DP_RX_DESC_OFFSET_NUM_BITS
169 #define DP_RX_DESC_POOL_ID_SHIFT \
170 		(DP_RX_DESC_OFFSET_NUM_BITS + DP_RX_DESC_PAGE_ID_NUM_BITS)
171 #define RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK \
172 	(((1 << DP_RX_DESC_POOL_ID_NUM_BITS) - 1) << DP_RX_DESC_POOL_ID_SHIFT)
173 #define RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK	\
174 			(((1 << DP_RX_DESC_PAGE_ID_NUM_BITS) - 1) << \
175 			 DP_RX_DESC_PAGE_ID_SHIFT)
176 #define RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK \
177 			((1 << DP_RX_DESC_OFFSET_NUM_BITS) - 1)
178 #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(_cookie)		\
179 	(((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_POOL_ID_MASK) >>	\
180 			DP_RX_DESC_POOL_ID_SHIFT)
181 #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(_cookie)		\
182 	(((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_PAGE_ID_MASK) >>	\
183 			DP_RX_DESC_PAGE_ID_SHIFT)
184 #define DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(_cookie)		\
185 	((_cookie) & RX_DESC_MULTI_PAGE_COOKIE_OFFSET_MASK)
186 
187 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
188 
189 #define RX_DESC_COOKIE_INDEX_SHIFT		0
190 #define RX_DESC_COOKIE_INDEX_MASK		0x3ffff /* 18 bits */
191 #define RX_DESC_COOKIE_POOL_ID_SHIFT		18
192 #define RX_DESC_COOKIE_POOL_ID_MASK		0x1c0000
193 
194 #define DP_RX_DESC_COOKIE_MAX	\
195 	(RX_DESC_COOKIE_INDEX_MASK | RX_DESC_COOKIE_POOL_ID_MASK)
196 
197 #define DP_RX_DESC_COOKIE_POOL_ID_GET(_cookie)		\
198 	(((_cookie) & RX_DESC_COOKIE_POOL_ID_MASK) >>	\
199 			RX_DESC_COOKIE_POOL_ID_SHIFT)
200 
201 #define DP_RX_DESC_COOKIE_INDEX_GET(_cookie)		\
202 	(((_cookie) & RX_DESC_COOKIE_INDEX_MASK) >>	\
203 			RX_DESC_COOKIE_INDEX_SHIFT)
204 
205 #define dp_rx_add_to_free_desc_list(head, tail, new) \
206 	__dp_rx_add_to_free_desc_list(head, tail, new, __func__)
207 
208 #define dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool, \
209 				num_buffers, desc_list, tail, req_only) \
210 	__dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool, \
211 				  num_buffers, desc_list, tail, req_only, \
212 				  __func__)
213 
214 #ifdef WLAN_SUPPORT_RX_FISA
215 /**
216  * dp_rx_set_hdr_pad() - set l3 padding in nbuf cb
217  * @nbuf: pkt skb pointer
218  * @l3_padding: l3 padding
219  *
220  * Return: None
221  */
222 static inline
223 void dp_rx_set_hdr_pad(qdf_nbuf_t nbuf, uint32_t l3_padding)
224 {
225 	QDF_NBUF_CB_RX_PACKET_L3_HDR_PAD(nbuf) = l3_padding;
226 }
227 #else
228 static inline
229 void dp_rx_set_hdr_pad(qdf_nbuf_t nbuf, uint32_t l3_padding)
230 {
231 }
232 #endif
233 
234 #ifdef DP_RX_SPECIAL_FRAME_NEED
235 /**
236  * dp_rx_is_special_frame() - check is RX frame special needed
237  *
238  * @nbuf: RX skb pointer
239  * @frame_mask: the mask for special frame needed
240  *
241  * Check is RX frame wanted matched with mask
242  *
243  * Return: true - special frame needed, false - no
244  */
245 static inline
246 bool dp_rx_is_special_frame(qdf_nbuf_t nbuf, uint32_t frame_mask)
247 {
248 	if (((frame_mask & FRAME_MASK_IPV4_ARP) &&
249 	     qdf_nbuf_is_ipv4_arp_pkt(nbuf)) ||
250 	    ((frame_mask & FRAME_MASK_IPV4_DHCP) &&
251 	     qdf_nbuf_is_ipv4_dhcp_pkt(nbuf)) ||
252 	    ((frame_mask & FRAME_MASK_IPV4_EAPOL) &&
253 	     qdf_nbuf_is_ipv4_eapol_pkt(nbuf)) ||
254 	    ((frame_mask & FRAME_MASK_IPV6_DHCP) &&
255 	     qdf_nbuf_is_ipv6_dhcp_pkt(nbuf)))
256 		return true;
257 
258 	return false;
259 }
260 
261 /**
262  * dp_rx_deliver_special_frame() - Deliver the RX special frame to stack
263  *				   if matches mask
264  *
265  * @soc: Datapath soc handler
266  * @peer: pointer to DP peer
267  * @nbuf: pointer to the skb of RX frame
268  * @frame_mask: the mask for special frame needed
269  * @rx_tlv_hdr: start of rx tlv header
270  *
271  * note: Msdu_len must have been stored in QDF_NBUF_CB_RX_PKT_LEN(nbuf) and
272  * single nbuf is expected.
273  *
274  * return: true - nbuf has been delivered to stack, false - not.
275  */
276 bool dp_rx_deliver_special_frame(struct dp_soc *soc, struct dp_txrx_peer *peer,
277 				 qdf_nbuf_t nbuf, uint32_t frame_mask,
278 				 uint8_t *rx_tlv_hdr);
279 #else
280 static inline
281 bool dp_rx_is_special_frame(qdf_nbuf_t nbuf, uint32_t frame_mask)
282 {
283 	return false;
284 }
285 
286 static inline
287 bool dp_rx_deliver_special_frame(struct dp_soc *soc, struct dp_txrx_peer *peer,
288 				 qdf_nbuf_t nbuf, uint32_t frame_mask,
289 				 uint8_t *rx_tlv_hdr)
290 {
291 	return false;
292 }
293 #endif
294 
295 #ifdef FEATURE_RX_LINKSPEED_ROAM_TRIGGER
296 /**
297  * dp_rx_data_is_specific() - Used to exclude specific frames
298  *                            not practical for getting rx
299  *                            stats like rate, mcs, nss, etc.
300  *
301  * @hal-soc_hdl: soc handler
302  * @rx_tlv_hdr: rx tlv header
303  * @nbuf: RX skb pointer
304  *
305  * Return: true - a specific frame  not suitable
306  *                for getting rx stats from it.
307  *         false - a common frame suitable for
308  *                 getting rx stats from it.
309  */
310 static inline
311 bool dp_rx_data_is_specific(hal_soc_handle_t hal_soc_hdl,
312 			    uint8_t *rx_tlv_hdr,
313 			    qdf_nbuf_t nbuf)
314 {
315 	if (qdf_unlikely(qdf_nbuf_is_da_mcbc(nbuf)))
316 		return true;
317 
318 	if (!hal_rx_tlv_first_mpdu_get(hal_soc_hdl, rx_tlv_hdr))
319 		return true;
320 
321 	if (!hal_rx_msdu_end_first_msdu_get(hal_soc_hdl, rx_tlv_hdr))
322 		return true;
323 
324 	/* ARP, EAPOL is neither IPV6 ETH nor IPV4 ETH from L3 level */
325 	if (qdf_likely(hal_rx_tlv_l3_type_get(hal_soc_hdl, rx_tlv_hdr) ==
326 	    QDF_NBUF_TRAC_IPV4_ETH_TYPE)) {
327 		if (qdf_nbuf_is_ipv4_dhcp_pkt(nbuf))
328 			return true;
329 	} else if (qdf_likely(hal_rx_tlv_l3_type_get(hal_soc_hdl, rx_tlv_hdr) ==
330 		   QDF_NBUF_TRAC_IPV6_ETH_TYPE)) {
331 		if (qdf_nbuf_is_ipv6_dhcp_pkt(nbuf))
332 			return true;
333 	} else {
334 		return true;
335 	}
336 	return false;
337 }
338 #else
339 static inline
340 bool dp_rx_data_is_specific(hal_soc_handle_t hal_soc_hdl,
341 			    uint8_t *rx_tlv_hdr,
342 			    qdf_nbuf_t nbuf)
343 
344 {
345 	/*
346 	 * default return is true to make sure that rx stats
347 	 * will not be handled when this feature is disabled
348 	 */
349 	return true;
350 }
351 #endif /* FEATURE_RX_LINKSPEED_ROAM_TRIGGER */
352 
353 #ifndef QCA_HOST_MODE_WIFI_DISABLED
354 #ifdef DP_RX_DISABLE_NDI_MDNS_FORWARDING
355 static inline
356 bool dp_rx_check_ndi_mdns_fwding(struct dp_txrx_peer *ta_txrx_peer,
357 				 qdf_nbuf_t nbuf)
358 {
359 	if (ta_txrx_peer->vdev->opmode == wlan_op_mode_ndi &&
360 	    qdf_nbuf_is_ipv6_mdns_pkt(nbuf)) {
361 		DP_PEER_PER_PKT_STATS_INC(ta_txrx_peer,
362 					  rx.intra_bss.mdns_no_fwd, 1);
363 		return false;
364 	}
365 	return true;
366 }
367 #else
368 static inline
369 bool dp_rx_check_ndi_mdns_fwding(struct dp_txrx_peer *ta_txrx_peer,
370 				 qdf_nbuf_t nbuf)
371 {
372 	return true;
373 }
374 #endif
375 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
376 
377 /* DOC: Offset to obtain LLC hdr
378  *
379  * In the case of Wifi parse error
380  * to reach LLC header from beginning
381  * of VLAN tag we need to skip 8 bytes.
382  * Vlan_tag(4)+length(2)+length added
383  * by HW(2) = 8 bytes.
384  */
385 #define DP_SKIP_VLAN		8
386 
387 #ifndef QCA_HOST_MODE_WIFI_DISABLED
388 
389 /**
390  * struct dp_rx_cached_buf - rx cached buffer
391  * @list: linked list node
392  * @buf: skb buffer
393  */
394 struct dp_rx_cached_buf {
395 	qdf_list_node_t node;
396 	qdf_nbuf_t buf;
397 };
398 
399 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
400 
401 /*
402  *dp_rx_xor_block() - xor block of data
403  *@b: destination data block
404  *@a: source data block
405  *@len: length of the data to process
406  *
407  *Returns: None
408  */
409 static inline void dp_rx_xor_block(uint8_t *b, const uint8_t *a, qdf_size_t len)
410 {
411 	qdf_size_t i;
412 
413 	for (i = 0; i < len; i++)
414 		b[i] ^= a[i];
415 }
416 
417 /*
418  *dp_rx_rotl() - rotate the bits left
419  *@val: unsigned integer input value
420  *@bits: number of bits
421  *
422  *Returns: Integer with left rotated by number of 'bits'
423  */
424 static inline uint32_t dp_rx_rotl(uint32_t val, int bits)
425 {
426 	return (val << bits) | (val >> (32 - bits));
427 }
428 
429 /*
430  *dp_rx_rotr() - rotate the bits right
431  *@val: unsigned integer input value
432  *@bits: number of bits
433  *
434  *Returns: Integer with right rotated by number of 'bits'
435  */
436 static inline uint32_t dp_rx_rotr(uint32_t val, int bits)
437 {
438 	return (val >> bits) | (val << (32 - bits));
439 }
440 
441 /*
442  * dp_set_rx_queue() - set queue_mapping in skb
443  * @nbuf: skb
444  * @queue_id: rx queue_id
445  *
446  * Return: void
447  */
448 #ifdef QCA_OL_RX_MULTIQ_SUPPORT
449 static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
450 {
451 	qdf_nbuf_record_rx_queue(nbuf, queue_id);
452 	return;
453 }
454 #else
455 static inline void dp_set_rx_queue(qdf_nbuf_t nbuf, uint8_t queue_id)
456 {
457 }
458 #endif
459 
460 /*
461  *dp_rx_xswap() - swap the bits left
462  *@val: unsigned integer input value
463  *
464  *Returns: Integer with bits swapped
465  */
466 static inline uint32_t dp_rx_xswap(uint32_t val)
467 {
468 	return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8);
469 }
470 
471 /*
472  *dp_rx_get_le32_split() - get little endian 32 bits split
473  *@b0: byte 0
474  *@b1: byte 1
475  *@b2: byte 2
476  *@b3: byte 3
477  *
478  *Returns: Integer with split little endian 32 bits
479  */
480 static inline uint32_t dp_rx_get_le32_split(uint8_t b0, uint8_t b1, uint8_t b2,
481 					uint8_t b3)
482 {
483 	return b0 | (b1 << 8) | (b2 << 16) | (b3 << 24);
484 }
485 
486 /*
487  *dp_rx_get_le32() - get little endian 32 bits
488  *@b0: byte 0
489  *@b1: byte 1
490  *@b2: byte 2
491  *@b3: byte 3
492  *
493  *Returns: Integer with little endian 32 bits
494  */
495 static inline uint32_t dp_rx_get_le32(const uint8_t *p)
496 {
497 	return dp_rx_get_le32_split(p[0], p[1], p[2], p[3]);
498 }
499 
500 /*
501  * dp_rx_put_le32() - put little endian 32 bits
502  * @p: destination char array
503  * @v: source 32-bit integer
504  *
505  * Returns: None
506  */
507 static inline void dp_rx_put_le32(uint8_t *p, uint32_t v)
508 {
509 	p[0] = (v) & 0xff;
510 	p[1] = (v >> 8) & 0xff;
511 	p[2] = (v >> 16) & 0xff;
512 	p[3] = (v >> 24) & 0xff;
513 }
514 
515 /* Extract michal mic block of data */
516 #define dp_rx_michael_block(l, r)	\
517 	do {					\
518 		r ^= dp_rx_rotl(l, 17);	\
519 		l += r;				\
520 		r ^= dp_rx_xswap(l);		\
521 		l += r;				\
522 		r ^= dp_rx_rotl(l, 3);	\
523 		l += r;				\
524 		r ^= dp_rx_rotr(l, 2);	\
525 		l += r;				\
526 	} while (0)
527 
528 /**
529  * struct dp_rx_desc_list_elem_t
530  *
531  * @next		: Next pointer to form free list
532  * @rx_desc		: DP Rx descriptor
533  */
534 union dp_rx_desc_list_elem_t {
535 	union dp_rx_desc_list_elem_t *next;
536 	struct dp_rx_desc rx_desc;
537 };
538 
539 #ifdef RX_DESC_MULTI_PAGE_ALLOC
540 /**
541  * dp_rx_desc_find() - find dp rx descriptor from page ID and offset
542  * @page_id: Page ID
543  * @offset: Offset of the descriptor element
544  *
545  * Return: RX descriptor element
546  */
547 union dp_rx_desc_list_elem_t *dp_rx_desc_find(uint16_t page_id, uint16_t offset,
548 					      struct rx_desc_pool *rx_pool);
549 
550 static inline
551 struct dp_rx_desc *dp_get_rx_desc_from_cookie(struct dp_soc *soc,
552 					      struct rx_desc_pool *pool,
553 					      uint32_t cookie)
554 {
555 	uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
556 	uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
557 	uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
558 	struct rx_desc_pool *rx_desc_pool;
559 	union dp_rx_desc_list_elem_t *rx_desc_elem;
560 
561 	if (qdf_unlikely(pool_id >= MAX_PDEV_CNT))
562 		return NULL;
563 
564 	rx_desc_pool = &pool[pool_id];
565 	rx_desc_elem = (union dp_rx_desc_list_elem_t *)
566 		(rx_desc_pool->desc_pages.cacheable_pages[page_id] +
567 		rx_desc_pool->elem_size * offset);
568 
569 	return &rx_desc_elem->rx_desc;
570 }
571 
572 static inline
573 struct dp_rx_desc *dp_get_rx_mon_status_desc_from_cookie(struct dp_soc *soc,
574 							 struct rx_desc_pool *pool,
575 							 uint32_t cookie)
576 {
577 	uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
578 	uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
579 	uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
580 	struct rx_desc_pool *rx_desc_pool;
581 	union dp_rx_desc_list_elem_t *rx_desc_elem;
582 
583 	if (qdf_unlikely(pool_id >= NUM_RXDMA_RINGS_PER_PDEV))
584 		return NULL;
585 
586 	rx_desc_pool = &pool[pool_id];
587 	rx_desc_elem = (union dp_rx_desc_list_elem_t *)
588 		(rx_desc_pool->desc_pages.cacheable_pages[page_id] +
589 		rx_desc_pool->elem_size * offset);
590 
591 	return &rx_desc_elem->rx_desc;
592 }
593 
594 /**
595  * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
596  *			 the Rx descriptor on Rx DMA source ring buffer
597  * @soc: core txrx main context
598  * @cookie: cookie used to lookup virtual address
599  *
600  * Return: Pointer to the Rx descriptor
601  */
602 static inline
603 struct dp_rx_desc *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc,
604 					       uint32_t cookie)
605 {
606 	return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_buf[0], cookie);
607 }
608 
609 /**
610  * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
611  *			 the Rx descriptor on monitor ring buffer
612  * @soc: core txrx main context
613  * @cookie: cookie used to lookup virtual address
614  *
615  * Return: Pointer to the Rx descriptor
616  */
617 static inline
618 struct dp_rx_desc *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc,
619 					     uint32_t cookie)
620 {
621 	return dp_get_rx_desc_from_cookie(soc, &soc->rx_desc_mon[0], cookie);
622 }
623 
624 /**
625  * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
626  *			 the Rx descriptor on monitor status ring buffer
627  * @soc: core txrx main context
628  * @cookie: cookie used to lookup virtual address
629  *
630  * Return: Pointer to the Rx descriptor
631  */
632 static inline
633 struct dp_rx_desc *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc,
634 						uint32_t cookie)
635 {
636 	return dp_get_rx_mon_status_desc_from_cookie(soc,
637 						     &soc->rx_desc_status[0],
638 						     cookie);
639 }
640 #else
641 
642 void dp_rx_desc_pool_init(struct dp_soc *soc, uint32_t pool_id,
643 			  uint32_t pool_size,
644 			  struct rx_desc_pool *rx_desc_pool);
645 
646 /**
647  * dp_rx_cookie_2_va_rxdma_buf() - Converts cookie to a virtual address of
648  *			 the Rx descriptor on Rx DMA source ring buffer
649  * @soc: core txrx main context
650  * @cookie: cookie used to lookup virtual address
651  *
652  * Return: void *: Virtual Address of the Rx descriptor
653  */
654 static inline
655 void *dp_rx_cookie_2_va_rxdma_buf(struct dp_soc *soc, uint32_t cookie)
656 {
657 	uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
658 	uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
659 	struct rx_desc_pool *rx_desc_pool;
660 
661 	if (qdf_unlikely(pool_id >= MAX_RXDESC_POOLS))
662 		return NULL;
663 
664 	rx_desc_pool = &soc->rx_desc_buf[pool_id];
665 
666 	if (qdf_unlikely(index >= rx_desc_pool->pool_size))
667 		return NULL;
668 
669 	return &rx_desc_pool->array[index].rx_desc;
670 }
671 
672 /**
673  * dp_rx_cookie_2_va_mon_buf() - Converts cookie to a virtual address of
674  *			 the Rx descriptor on monitor ring buffer
675  * @soc: core txrx main context
676  * @cookie: cookie used to lookup virtual address
677  *
678  * Return: void *: Virtual Address of the Rx descriptor
679  */
680 static inline
681 void *dp_rx_cookie_2_va_mon_buf(struct dp_soc *soc, uint32_t cookie)
682 {
683 	uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
684 	uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
685 	/* TODO */
686 	/* Add sanity for pool_id & index */
687 	return &(soc->rx_desc_mon[pool_id].array[index].rx_desc);
688 }
689 
690 /**
691  * dp_rx_cookie_2_va_mon_status() - Converts cookie to a virtual address of
692  *			 the Rx descriptor on monitor status ring buffer
693  * @soc: core txrx main context
694  * @cookie: cookie used to lookup virtual address
695  *
696  * Return: void *: Virtual Address of the Rx descriptor
697  */
698 static inline
699 void *dp_rx_cookie_2_va_mon_status(struct dp_soc *soc, uint32_t cookie)
700 {
701 	uint8_t pool_id = DP_RX_DESC_COOKIE_POOL_ID_GET(cookie);
702 	uint16_t index = DP_RX_DESC_COOKIE_INDEX_GET(cookie);
703 	/* TODO */
704 	/* Add sanity for pool_id & index */
705 	return &(soc->rx_desc_status[pool_id].array[index].rx_desc);
706 }
707 #endif /* RX_DESC_MULTI_PAGE_ALLOC */
708 
709 #ifndef QCA_HOST_MODE_WIFI_DISABLED
710 
711 static inline bool dp_rx_check_ap_bridge(struct dp_vdev *vdev)
712 {
713 	return vdev->ap_bridge_enabled;
714 }
715 
716 #ifdef DP_RX_DESC_COOKIE_INVALIDATE
717 static inline QDF_STATUS
718 dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc)
719 {
720 	if (qdf_unlikely(HAL_RX_REO_BUF_COOKIE_INVALID_GET(ring_desc)))
721 		return QDF_STATUS_E_FAILURE;
722 
723 	HAL_RX_REO_BUF_COOKIE_INVALID_SET(ring_desc);
724 	return QDF_STATUS_SUCCESS;
725 }
726 
727 /**
728  * dp_rx_cookie_reset_invalid_bit() - Reset the invalid bit of the cookie
729  *  field in ring descriptor
730  * @ring_desc: ring descriptor
731  *
732  * Return: None
733  */
734 static inline void
735 dp_rx_cookie_reset_invalid_bit(hal_ring_desc_t ring_desc)
736 {
737 	HAL_RX_REO_BUF_COOKIE_INVALID_RESET(ring_desc);
738 }
739 #else
740 static inline QDF_STATUS
741 dp_rx_cookie_check_and_invalidate(hal_ring_desc_t ring_desc)
742 {
743 	return QDF_STATUS_SUCCESS;
744 }
745 
746 static inline void
747 dp_rx_cookie_reset_invalid_bit(hal_ring_desc_t ring_desc)
748 {
749 }
750 #endif
751 
752 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
753 
754 #if defined(RX_DESC_MULTI_PAGE_ALLOC) && \
755 	defined(DP_WAR_VALIDATE_RX_ERR_MSDU_COOKIE)
756 /**
757  * dp_rx_is_sw_cookie_valid() - check whether SW cookie valid
758  * @soc: dp soc ref
759  * @cookie: Rx buf SW cookie value
760  *
761  * Return: true if cookie is valid else false
762  */
763 static inline bool dp_rx_is_sw_cookie_valid(struct dp_soc *soc,
764 					    uint32_t cookie)
765 {
766 	uint8_t pool_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_POOL_ID(cookie);
767 	uint16_t page_id = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_PAGE_ID(cookie);
768 	uint8_t offset = DP_RX_DESC_MULTI_PAGE_COOKIE_GET_OFFSET(cookie);
769 	struct rx_desc_pool *rx_desc_pool;
770 
771 	if (qdf_unlikely(pool_id >= MAX_PDEV_CNT))
772 		goto fail;
773 
774 	rx_desc_pool = &soc->rx_desc_buf[pool_id];
775 
776 	if (page_id >= rx_desc_pool->desc_pages.num_pages ||
777 	    offset >= rx_desc_pool->desc_pages.num_element_per_page)
778 		goto fail;
779 
780 	return true;
781 
782 fail:
783 	DP_STATS_INC(soc, rx.err.invalid_cookie, 1);
784 	return false;
785 }
786 #else
787 /**
788  * dp_rx_is_sw_cookie_valid() - check whether SW cookie valid
789  * @soc: dp soc ref
790  * @cookie: Rx buf SW cookie value
791  *
792  * When multi page alloc is disabled SW cookie validness is
793  * checked while fetching Rx descriptor, so no need to check here
794  * Return: true if cookie is valid else false
795  */
796 static inline bool dp_rx_is_sw_cookie_valid(struct dp_soc *soc,
797 					    uint32_t cookie)
798 {
799 	return true;
800 }
801 #endif
802 
803 QDF_STATUS dp_rx_desc_pool_is_allocated(struct rx_desc_pool *rx_desc_pool);
804 QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc,
805 				 uint32_t pool_size,
806 				 struct rx_desc_pool *rx_desc_pool);
807 
808 void dp_rx_desc_pool_init(struct dp_soc *soc, uint32_t pool_id,
809 			  uint32_t pool_size,
810 			  struct rx_desc_pool *rx_desc_pool);
811 
812 void dp_rx_add_desc_list_to_free_list(struct dp_soc *soc,
813 				union dp_rx_desc_list_elem_t **local_desc_list,
814 				union dp_rx_desc_list_elem_t **tail,
815 				uint16_t pool_id,
816 				struct rx_desc_pool *rx_desc_pool);
817 
818 uint16_t dp_rx_get_free_desc_list(struct dp_soc *soc, uint32_t pool_id,
819 				struct rx_desc_pool *rx_desc_pool,
820 				uint16_t num_descs,
821 				union dp_rx_desc_list_elem_t **desc_list,
822 				union dp_rx_desc_list_elem_t **tail);
823 
824 QDF_STATUS dp_rx_pdev_desc_pool_alloc(struct dp_pdev *pdev);
825 void dp_rx_pdev_desc_pool_free(struct dp_pdev *pdev);
826 
827 QDF_STATUS dp_rx_pdev_desc_pool_init(struct dp_pdev *pdev);
828 void dp_rx_pdev_desc_pool_deinit(struct dp_pdev *pdev);
829 void dp_rx_desc_pool_deinit(struct dp_soc *soc,
830 			    struct rx_desc_pool *rx_desc_pool,
831 			    uint32_t pool_id);
832 
833 QDF_STATUS dp_rx_pdev_attach(struct dp_pdev *pdev);
834 QDF_STATUS dp_rx_pdev_buffers_alloc(struct dp_pdev *pdev);
835 void dp_rx_pdev_buffers_free(struct dp_pdev *pdev);
836 
837 void dp_rx_pdev_detach(struct dp_pdev *pdev);
838 
839 void dp_print_napi_stats(struct dp_soc *soc);
840 
841 /**
842  * dp_rx_vdev_detach() - detach vdev from dp rx
843  * @vdev: virtual device instance
844  *
845  * Return: QDF_STATUS_SUCCESS: success
846  *         QDF_STATUS_E_RESOURCES: Error return
847  */
848 QDF_STATUS dp_rx_vdev_detach(struct dp_vdev *vdev);
849 
850 #ifndef QCA_HOST_MODE_WIFI_DISABLED
851 
852 uint32_t
853 dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,
854 	      uint8_t reo_ring_num,
855 	      uint32_t quota);
856 
857 /**
858  * dp_rx_err_process() - Processes error frames routed to REO error ring
859  * @int_ctx: pointer to DP interrupt context
860  * @soc: core txrx main context
861  * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
862  * @quota: No. of units (packets) that can be serviced in one shot.
863  *
864  * This function implements error processing and top level demultiplexer
865  * for all the frames routed to REO error ring.
866  *
867  * Return: uint32_t: No. of elements processed
868  */
869 uint32_t dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
870 			   hal_ring_handle_t hal_ring_hdl, uint32_t quota);
871 
872 /**
873  * dp_rx_wbm_err_process() - Processes error frames routed to WBM release ring
874  * @int_ctx: pointer to DP interrupt context
875  * @soc: core txrx main context
876  * @hal_ring: opaque pointer to the HAL Rx Error Ring, which will be serviced
877  * @quota: No. of units (packets) that can be serviced in one shot.
878  *
879  * This function implements error processing and top level demultiplexer
880  * for all the frames routed to WBM2HOST sw release ring.
881  *
882  * Return: uint32_t: No. of elements processed
883  */
884 uint32_t
885 dp_rx_wbm_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
886 		      hal_ring_handle_t hal_ring_hdl, uint32_t quota);
887 
888 /**
889  * dp_rx_sg_create() - create a frag_list for MSDUs which are spread across
890  *		     multiple nbufs.
891  * @soc: core txrx main context
892  * @nbuf: pointer to the first msdu of an amsdu.
893  *
894  * This function implements the creation of RX frag_list for cases
895  * where an MSDU is spread across multiple nbufs.
896  *
897  * Return: returns the head nbuf which contains complete frag_list.
898  */
899 qdf_nbuf_t dp_rx_sg_create(struct dp_soc *soc, qdf_nbuf_t nbuf);
900 
901 /**
902  * dp_rx_is_sg_supported() - SG packets processing supported or not.
903  *
904  * Return: returns true when processing is supported else false.
905  */
906 bool dp_rx_is_sg_supported(void);
907 
908 /*
909  * dp_rx_desc_nbuf_and_pool_free() - free the sw rx desc pool called during
910  *				     de-initialization of wifi module.
911  *
912  * @soc: core txrx main context
913  * @pool_id: pool_id which is one of 3 mac_ids
914  * @rx_desc_pool: rx descriptor pool pointer
915  *
916  * Return: None
917  */
918 void dp_rx_desc_nbuf_and_pool_free(struct dp_soc *soc, uint32_t pool_id,
919 				   struct rx_desc_pool *rx_desc_pool);
920 
921 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
922 
923 /*
924  * dp_rx_desc_nbuf_free() - free the sw rx desc nbufs called during
925  *			    de-initialization of wifi module.
926  *
927  * @soc: core txrx main context
928  * @pool_id: pool_id which is one of 3 mac_ids
929  * @rx_desc_pool: rx descriptor pool pointer
930  *
931  * Return: None
932  */
933 void dp_rx_desc_nbuf_free(struct dp_soc *soc,
934 			  struct rx_desc_pool *rx_desc_pool);
935 
936 #ifdef DP_RX_MON_MEM_FRAG
937 /*
938  * dp_rx_desc_frag_free() - free the sw rx desc frag called during
939  *			    de-initialization of wifi module.
940  *
941  * @soc: core txrx main context
942  * @rx_desc_pool: rx descriptor pool pointer
943  *
944  * Return: None
945  */
946 void dp_rx_desc_frag_free(struct dp_soc *soc,
947 			  struct rx_desc_pool *rx_desc_pool);
948 #else
949 static inline
950 void dp_rx_desc_frag_free(struct dp_soc *soc,
951 			  struct rx_desc_pool *rx_desc_pool)
952 {
953 }
954 #endif
955 /*
956  * dp_rx_desc_pool_free() - free the sw rx desc array called during
957  *			    de-initialization of wifi module.
958  *
959  * @soc: core txrx main context
960  * @rx_desc_pool: rx descriptor pool pointer
961  *
962  * Return: None
963  */
964 void dp_rx_desc_pool_free(struct dp_soc *soc,
965 			  struct rx_desc_pool *rx_desc_pool);
966 
967 void dp_rx_deliver_raw(struct dp_vdev *vdev, qdf_nbuf_t nbuf_list,
968 				struct dp_txrx_peer *peer);
969 
970 #ifdef RX_DESC_LOGGING
971 /*
972  * dp_rx_desc_alloc_dbg_info() - Alloc memory for rx descriptor debug
973  *  structure
974  * @rx_desc: rx descriptor pointer
975  *
976  * Return: None
977  */
978 static inline
979 void dp_rx_desc_alloc_dbg_info(struct dp_rx_desc *rx_desc)
980 {
981 	rx_desc->dbg_info = qdf_mem_malloc(sizeof(struct dp_rx_desc_dbg_info));
982 }
983 
984 /*
985  * dp_rx_desc_free_dbg_info() - Free rx descriptor debug
986  *  structure memory
987  * @rx_desc: rx descriptor pointer
988  *
989  * Return: None
990  */
991 static inline
992 void dp_rx_desc_free_dbg_info(struct dp_rx_desc *rx_desc)
993 {
994 	qdf_mem_free(rx_desc->dbg_info);
995 }
996 
997 /*
998  * dp_rx_desc_update_dbg_info() - Update rx descriptor debug info
999  *  structure memory
1000  * @rx_desc: rx descriptor pointer
1001  *
1002  * Return: None
1003  */
1004 static
1005 void dp_rx_desc_update_dbg_info(struct dp_rx_desc *rx_desc,
1006 				const char *func_name, uint8_t flag)
1007 {
1008 	struct dp_rx_desc_dbg_info *info = rx_desc->dbg_info;
1009 
1010 	if (!info)
1011 		return;
1012 
1013 	if (flag == RX_DESC_REPLENISHED) {
1014 		qdf_str_lcopy(info->replenish_caller, func_name,
1015 			      QDF_MEM_FUNC_NAME_SIZE);
1016 		info->replenish_ts = qdf_get_log_timestamp();
1017 	} else {
1018 		qdf_str_lcopy(info->freelist_caller, func_name,
1019 			      QDF_MEM_FUNC_NAME_SIZE);
1020 		info->freelist_ts = qdf_get_log_timestamp();
1021 		info->prev_nbuf = rx_desc->nbuf;
1022 		info->prev_nbuf_data_addr = rx_desc->nbuf_data_addr;
1023 		rx_desc->nbuf_data_addr = NULL;
1024 	}
1025 }
1026 #else
1027 
1028 static inline
1029 void dp_rx_desc_alloc_dbg_info(struct dp_rx_desc *rx_desc)
1030 {
1031 }
1032 
1033 static inline
1034 void dp_rx_desc_free_dbg_info(struct dp_rx_desc *rx_desc)
1035 {
1036 }
1037 
1038 static inline
1039 void dp_rx_desc_update_dbg_info(struct dp_rx_desc *rx_desc,
1040 				const char *func_name, uint8_t flag)
1041 {
1042 }
1043 #endif /* RX_DESC_LOGGING */
1044 
1045 /**
1046  * dp_rx_add_to_free_desc_list() - Adds to a local free descriptor list
1047  *
1048  * @head: pointer to the head of local free list
1049  * @tail: pointer to the tail of local free list
1050  * @new: new descriptor that is added to the free list
1051  * @func_name: caller func name
1052  *
1053  * Return: void:
1054  */
1055 static inline
1056 void __dp_rx_add_to_free_desc_list(union dp_rx_desc_list_elem_t **head,
1057 				 union dp_rx_desc_list_elem_t **tail,
1058 				 struct dp_rx_desc *new, const char *func_name)
1059 {
1060 	qdf_assert(head && new);
1061 
1062 	dp_rx_desc_update_dbg_info(new, func_name, RX_DESC_IN_FREELIST);
1063 
1064 	new->nbuf = NULL;
1065 	new->in_use = 0;
1066 
1067 	((union dp_rx_desc_list_elem_t *)new)->next = *head;
1068 	*head = (union dp_rx_desc_list_elem_t *)new;
1069 	/* reset tail if head->next is NULL */
1070 	if (!*tail || !(*head)->next)
1071 		*tail = *head;
1072 }
1073 
1074 uint8_t dp_rx_process_invalid_peer(struct dp_soc *soc, qdf_nbuf_t nbuf,
1075 				   uint8_t mac_id);
1076 void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
1077 		qdf_nbuf_t mpdu, bool mpdu_done, uint8_t mac_id);
1078 void dp_rx_process_mic_error(struct dp_soc *soc, qdf_nbuf_t nbuf,
1079 			     uint8_t *rx_tlv_hdr, struct dp_txrx_peer *peer);
1080 void dp_2k_jump_handle(struct dp_soc *soc, qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
1081 		       uint16_t peer_id, uint8_t tid);
1082 
1083 #define DP_RX_HEAD_APPEND(head, elem) \
1084 	do {                                                            \
1085 		qdf_nbuf_set_next((elem), (head));			\
1086 		(head) = (elem);                                        \
1087 	} while (0)
1088 
1089 
1090 #define DP_RX_LIST_APPEND(head, tail, elem) \
1091 	do {                                                          \
1092 		if (!(head)) {                                        \
1093 			(head) = (elem);                              \
1094 			QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head) = 1;\
1095 		} else {                                              \
1096 			qdf_nbuf_set_next((tail), (elem));            \
1097 			QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(head)++;  \
1098 		}                                                     \
1099 		(tail) = (elem);                                      \
1100 		qdf_nbuf_set_next((tail), NULL);                      \
1101 	} while (0)
1102 
1103 #define DP_RX_MERGE_TWO_LIST(phead, ptail, chead, ctail) \
1104 	do {                                                          \
1105 		if (!(phead)) {                                       \
1106 			(phead) = (chead);                            \
1107 		} else {                                              \
1108 			qdf_nbuf_set_next((ptail), (chead));          \
1109 			QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(phead) += \
1110 			QDF_NBUF_CB_RX_NUM_ELEMENTS_IN_LIST(chead);   \
1111 		}                                                     \
1112 		(ptail) = (ctail);                                    \
1113 		qdf_nbuf_set_next((ptail), NULL);                     \
1114 	} while (0)
1115 
1116 #if defined(QCA_PADDR_CHECK_ON_3TH_PLATFORM)
1117 /*
1118  * on some third-party platform, the memory below 0x2000
1119  * is reserved for target use, so any memory allocated in this
1120  * region should not be used by host
1121  */
1122 #define MAX_RETRY 50
1123 #define DP_PHY_ADDR_RESERVED	0x2000
1124 #elif defined(BUILD_X86)
1125 /*
1126  * in M2M emulation platforms (x86) the memory below 0x50000000
1127  * is reserved for target use, so any memory allocated in this
1128  * region should not be used by host
1129  */
1130 #define MAX_RETRY 100
1131 #define DP_PHY_ADDR_RESERVED	0x50000000
1132 #endif
1133 
1134 #if defined(QCA_PADDR_CHECK_ON_3TH_PLATFORM) || defined(BUILD_X86)
1135 /**
1136  * dp_check_paddr() - check if current phy address is valid or not
1137  * @dp_soc: core txrx main context
1138  * @rx_netbuf: skb buffer
1139  * @paddr: physical address
1140  * @rx_desc_pool: struct of rx descriptor pool
1141  * check if the physical address of the nbuf->data is less
1142  * than DP_PHY_ADDR_RESERVED then free the nbuf and try
1143  * allocating new nbuf. We can try for 100 times.
1144  *
1145  * This is a temp WAR till we fix it properly.
1146  *
1147  * Return: success or failure.
1148  */
1149 static inline
1150 int dp_check_paddr(struct dp_soc *dp_soc,
1151 		   qdf_nbuf_t *rx_netbuf,
1152 		   qdf_dma_addr_t *paddr,
1153 		   struct rx_desc_pool *rx_desc_pool)
1154 {
1155 	uint32_t nbuf_retry = 0;
1156 	int32_t ret;
1157 
1158 	if (qdf_likely(*paddr > DP_PHY_ADDR_RESERVED))
1159 		return QDF_STATUS_SUCCESS;
1160 
1161 	do {
1162 		dp_debug("invalid phy addr 0x%llx, trying again",
1163 			 (uint64_t)(*paddr));
1164 		nbuf_retry++;
1165 		if ((*rx_netbuf)) {
1166 			/* Not freeing buffer intentionally.
1167 			 * Observed that same buffer is getting
1168 			 * re-allocated resulting in longer load time
1169 			 * WMI init timeout.
1170 			 * This buffer is anyway not useful so skip it.
1171 			 *.Add such buffer to invalid list and free
1172 			 *.them when driver unload.
1173 			 **/
1174 			qdf_nbuf_unmap_nbytes_single(dp_soc->osdev,
1175 						     *rx_netbuf,
1176 						     QDF_DMA_FROM_DEVICE,
1177 						     rx_desc_pool->buf_size);
1178 			qdf_nbuf_queue_add(&dp_soc->invalid_buf_queue,
1179 					   *rx_netbuf);
1180 		}
1181 
1182 		*rx_netbuf = qdf_nbuf_alloc(dp_soc->osdev,
1183 					    rx_desc_pool->buf_size,
1184 					    RX_BUFFER_RESERVATION,
1185 					    rx_desc_pool->buf_alignment,
1186 					    FALSE);
1187 
1188 		if (qdf_unlikely(!(*rx_netbuf)))
1189 			return QDF_STATUS_E_FAILURE;
1190 
1191 		ret = qdf_nbuf_map_nbytes_single(dp_soc->osdev,
1192 						 *rx_netbuf,
1193 						 QDF_DMA_FROM_DEVICE,
1194 						 rx_desc_pool->buf_size);
1195 
1196 		if (qdf_unlikely(ret == QDF_STATUS_E_FAILURE)) {
1197 			qdf_nbuf_free(*rx_netbuf);
1198 			*rx_netbuf = NULL;
1199 			continue;
1200 		}
1201 
1202 		*paddr = qdf_nbuf_get_frag_paddr(*rx_netbuf, 0);
1203 
1204 		if (qdf_likely(*paddr > DP_PHY_ADDR_RESERVED))
1205 			return QDF_STATUS_SUCCESS;
1206 
1207 	} while (nbuf_retry < MAX_RETRY);
1208 
1209 	if ((*rx_netbuf)) {
1210 		qdf_nbuf_unmap_nbytes_single(dp_soc->osdev,
1211 					     *rx_netbuf,
1212 					     QDF_DMA_FROM_DEVICE,
1213 					     rx_desc_pool->buf_size);
1214 		qdf_nbuf_queue_add(&dp_soc->invalid_buf_queue,
1215 				   *rx_netbuf);
1216 	}
1217 
1218 	return QDF_STATUS_E_FAILURE;
1219 }
1220 
1221 #else
1222 static inline
1223 int dp_check_paddr(struct dp_soc *dp_soc,
1224 		   qdf_nbuf_t *rx_netbuf,
1225 		   qdf_dma_addr_t *paddr,
1226 		   struct rx_desc_pool *rx_desc_pool)
1227 {
1228 	return QDF_STATUS_SUCCESS;
1229 }
1230 
1231 #endif
1232 
1233 /**
1234  * dp_rx_cookie_2_link_desc_va() - Converts cookie to a virtual address of
1235  *				   the MSDU Link Descriptor
1236  * @soc: core txrx main context
1237  * @buf_info: buf_info includes cookie that is used to lookup
1238  * virtual address of link descriptor after deriving the page id
1239  * and the offset or index of the desc on the associatde page.
1240  *
1241  * This is the VA of the link descriptor, that HAL layer later uses to
1242  * retrieve the list of MSDU's for a given MPDU.
1243  *
1244  * Return: void *: Virtual Address of the Rx descriptor
1245  */
1246 static inline
1247 void *dp_rx_cookie_2_link_desc_va(struct dp_soc *soc,
1248 				  struct hal_buf_info *buf_info)
1249 {
1250 	void *link_desc_va;
1251 	struct qdf_mem_multi_page_t *pages;
1252 	uint16_t page_id = LINK_DESC_COOKIE_PAGE_ID(buf_info->sw_cookie);
1253 
1254 	pages = &soc->link_desc_pages;
1255 	if (!pages)
1256 		return NULL;
1257 	if (qdf_unlikely(page_id >= pages->num_pages))
1258 		return NULL;
1259 	link_desc_va = pages->dma_pages[page_id].page_v_addr_start +
1260 		(buf_info->paddr - pages->dma_pages[page_id].page_p_addr);
1261 	return link_desc_va;
1262 }
1263 
1264 #ifndef QCA_HOST_MODE_WIFI_DISABLED
1265 #ifdef DISABLE_EAPOL_INTRABSS_FWD
1266 #ifdef WLAN_FEATURE_11BE_MLO
1267 static inline bool dp_nbuf_dst_addr_is_mld_addr(struct dp_vdev *vdev,
1268 						qdf_nbuf_t nbuf)
1269 {
1270 	struct qdf_mac_addr *self_mld_mac_addr =
1271 				(struct qdf_mac_addr *)vdev->mld_mac_addr.raw;
1272 	return qdf_is_macaddr_equal(self_mld_mac_addr,
1273 				    (struct qdf_mac_addr *)qdf_nbuf_data(nbuf) +
1274 				    QDF_NBUF_DEST_MAC_OFFSET);
1275 }
1276 #else
1277 static inline bool dp_nbuf_dst_addr_is_mld_addr(struct dp_vdev *vdev,
1278 						qdf_nbuf_t nbuf)
1279 {
1280 	return false;
1281 }
1282 #endif
1283 
1284 static inline bool dp_nbuf_dst_addr_is_self_addr(struct dp_vdev *vdev,
1285 						 qdf_nbuf_t nbuf)
1286 {
1287 	return qdf_is_macaddr_equal((struct qdf_mac_addr *)vdev->mac_addr.raw,
1288 				    (struct qdf_mac_addr *)qdf_nbuf_data(nbuf) +
1289 				    QDF_NBUF_DEST_MAC_OFFSET);
1290 }
1291 
1292 /*
1293  * dp_rx_intrabss_eapol_drop_check() - API For EAPOL
1294  *  pkt with DA not equal to vdev mac addr, fwd is not allowed.
1295  * @soc: core txrx main context
1296  * @ta_txrx_peer: source peer entry
1297  * @rx_tlv_hdr: start address of rx tlvs
1298  * @nbuf: nbuf that has to be intrabss forwarded
1299  *
1300  * Return: true if it is forwarded else false
1301  */
1302 static inline
1303 bool dp_rx_intrabss_eapol_drop_check(struct dp_soc *soc,
1304 				     struct dp_txrx_peer *ta_txrx_peer,
1305 				     uint8_t *rx_tlv_hdr, qdf_nbuf_t nbuf)
1306 {
1307 	if (qdf_unlikely(qdf_nbuf_is_ipv4_eapol_pkt(nbuf) &&
1308 			 !(dp_nbuf_dst_addr_is_self_addr(ta_txrx_peer->vdev,
1309 							 nbuf) ||
1310 			   dp_nbuf_dst_addr_is_mld_addr(ta_txrx_peer->vdev,
1311 							nbuf)))) {
1312 		qdf_nbuf_free(nbuf);
1313 		DP_STATS_INC(soc, rx.err.intrabss_eapol_drop, 1);
1314 		return true;
1315 	}
1316 
1317 	return false;
1318 }
1319 #else /* DISABLE_EAPOL_INTRABSS_FWD */
1320 
1321 static inline
1322 bool dp_rx_intrabss_eapol_drop_check(struct dp_soc *soc,
1323 				     struct dp_txrx_peer *ta_txrx_peer,
1324 				     uint8_t *rx_tlv_hdr, qdf_nbuf_t nbuf)
1325 {
1326 	return false;
1327 }
1328 #endif /* DISABLE_EAPOL_INTRABSS_FWD */
1329 
1330 bool dp_rx_intrabss_mcbc_fwd(struct dp_soc *soc,
1331 			     struct dp_txrx_peer *ta_txrx_peer,
1332 			     uint8_t *rx_tlv_hdr, qdf_nbuf_t nbuf,
1333 			     struct cdp_tid_rx_stats *tid_stats);
1334 
1335 bool dp_rx_intrabss_ucast_fwd(struct dp_soc *soc,
1336 			      struct dp_txrx_peer *ta_txrx_peer,
1337 			      uint8_t tx_vdev_id,
1338 			      uint8_t *rx_tlv_hdr, qdf_nbuf_t nbuf,
1339 			      struct cdp_tid_rx_stats *tid_stats);
1340 
1341 /**
1342  * dp_rx_defrag_concat() - Concatenate the fragments
1343  *
1344  * @dst: destination pointer to the buffer
1345  * @src: source pointer from where the fragment payload is to be copied
1346  *
1347  * Return: QDF_STATUS
1348  */
1349 static inline QDF_STATUS dp_rx_defrag_concat(qdf_nbuf_t dst, qdf_nbuf_t src)
1350 {
1351 	/*
1352 	 * Inside qdf_nbuf_cat, if it is necessary to reallocate dst
1353 	 * to provide space for src, the headroom portion is copied from
1354 	 * the original dst buffer to the larger new dst buffer.
1355 	 * (This is needed, because the headroom of the dst buffer
1356 	 * contains the rx desc.)
1357 	 */
1358 	if (!qdf_nbuf_cat(dst, src)) {
1359 		/*
1360 		 * qdf_nbuf_cat does not free the src memory.
1361 		 * Free src nbuf before returning
1362 		 * For failure case the caller takes of freeing the nbuf
1363 		 */
1364 		qdf_nbuf_free(src);
1365 		return QDF_STATUS_SUCCESS;
1366 	}
1367 
1368 	return QDF_STATUS_E_DEFRAG_ERROR;
1369 }
1370 
1371 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
1372 
1373 #ifndef FEATURE_WDS
1374 void dp_rx_da_learn(struct dp_soc *soc, uint8_t *rx_tlv_hdr,
1375 		    struct dp_txrx_peer *ta_txrx_peer, qdf_nbuf_t nbuf);
1376 
1377 static inline QDF_STATUS dp_rx_ast_set_active(struct dp_soc *soc, uint16_t sa_idx, bool is_active)
1378 {
1379 	return QDF_STATUS_SUCCESS;
1380 }
1381 
1382 static inline void
1383 dp_rx_wds_srcport_learn(struct dp_soc *soc,
1384 			uint8_t *rx_tlv_hdr,
1385 			struct dp_txrx_peer *txrx_peer,
1386 			qdf_nbuf_t nbuf,
1387 			struct hal_rx_msdu_metadata msdu_metadata)
1388 {
1389 }
1390 
1391 static inline void
1392 dp_rx_ipa_wds_srcport_learn(struct dp_soc *soc,
1393 			    struct dp_peer *ta_peer, qdf_nbuf_t nbuf,
1394 			    struct hal_rx_msdu_metadata msdu_end_info,
1395 			    bool ad4_valid, bool chfrag_start)
1396 {
1397 }
1398 #endif
1399 
1400 /*
1401  * dp_rx_desc_dump() - dump the sw rx descriptor
1402  *
1403  * @rx_desc: sw rx descriptor
1404  */
1405 static inline void dp_rx_desc_dump(struct dp_rx_desc *rx_desc)
1406 {
1407 	dp_info("rx_desc->nbuf: %pK, rx_desc->cookie: %d, rx_desc->pool_id: %d, rx_desc->in_use: %d, rx_desc->unmapped: %d",
1408 		rx_desc->nbuf, rx_desc->cookie, rx_desc->pool_id,
1409 		rx_desc->in_use, rx_desc->unmapped);
1410 }
1411 
1412 #ifndef QCA_HOST_MODE_WIFI_DISABLED
1413 
1414 /*
1415  * check_qwrap_multicast_loopback() - Check if rx packet is a loopback packet.
1416  *					In qwrap mode, packets originated from
1417  *					any vdev should not loopback and
1418  *					should be dropped.
1419  * @vdev: vdev on which rx packet is received
1420  * @nbuf: rx pkt
1421  *
1422  */
1423 #if ATH_SUPPORT_WRAP
1424 static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
1425 						qdf_nbuf_t nbuf)
1426 {
1427 	struct dp_vdev *psta_vdev;
1428 	struct dp_pdev *pdev = vdev->pdev;
1429 	uint8_t *data = qdf_nbuf_data(nbuf);
1430 
1431 	if (qdf_unlikely(vdev->proxysta_vdev)) {
1432 		/* In qwrap isolation mode, allow loopback packets as all
1433 		 * packets go to RootAP and Loopback on the mpsta.
1434 		 */
1435 		if (vdev->isolation_vdev)
1436 			return false;
1437 		TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) {
1438 			if (qdf_unlikely(psta_vdev->proxysta_vdev &&
1439 					 !qdf_mem_cmp(psta_vdev->mac_addr.raw,
1440 						      &data[QDF_MAC_ADDR_SIZE],
1441 						      QDF_MAC_ADDR_SIZE))) {
1442 				/* Drop packet if source address is equal to
1443 				 * any of the vdev addresses.
1444 				 */
1445 				return true;
1446 			}
1447 		}
1448 	}
1449 	return false;
1450 }
1451 #else
1452 static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
1453 						qdf_nbuf_t nbuf)
1454 {
1455 	return false;
1456 }
1457 #endif
1458 
1459 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
1460 
1461 #if defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) ||\
1462 	defined(WLAN_SUPPORT_RX_TAG_STATISTICS) ||\
1463 	defined(WLAN_SUPPORT_RX_FLOW_TAG)
1464 #include "dp_rx_tag.h"
1465 #endif
1466 
1467 #if !defined(WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG) &&\
1468 	!defined(WLAN_SUPPORT_RX_FLOW_TAG)
1469 /**
1470  * dp_rx_update_protocol_tag() - Reads CCE metadata from the RX MSDU end TLV
1471  *                              and set the corresponding tag in QDF packet
1472  * @soc: core txrx main context
1473  * @vdev: vdev on which the packet is received
1474  * @nbuf: QDF pkt buffer on which the protocol tag should be set
1475  * @rx_tlv_hdr: rBbase address where the RX TLVs starts
1476  * @ring_index: REO ring number, not used for error & monitor ring
1477  * @is_reo_exception: flag to indicate if rx from REO ring or exception ring
1478  * @is_update_stats: flag to indicate whether to update stats or not
1479  * Return: void
1480  */
1481 static inline void
1482 dp_rx_update_protocol_tag(struct dp_soc *soc, struct dp_vdev *vdev,
1483 			  qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr,
1484 			  uint16_t ring_index,
1485 			  bool is_reo_exception, bool is_update_stats)
1486 {
1487 }
1488 #endif
1489 
1490 #ifndef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG
1491 /**
1492  * dp_rx_err_cce_drop() - Reads CCE metadata from the RX MSDU end TLV
1493  *                        and returns whether cce metadata matches
1494  * @soc: core txrx main context
1495  * @vdev: vdev on which the packet is received
1496  * @nbuf: QDF pkt buffer on which the protocol tag should be set
1497  * @rx_tlv_hdr: rBbase address where the RX TLVs starts
1498  * Return: bool
1499  */
1500 static inline bool
1501 dp_rx_err_cce_drop(struct dp_soc *soc, struct dp_vdev *vdev,
1502 		   qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr)
1503 {
1504 	return false;
1505 }
1506 
1507 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */
1508 
1509 #ifndef WLAN_SUPPORT_RX_FLOW_TAG
1510 /**
1511  * dp_rx_update_flow_tag() - Reads FSE metadata from the RX MSDU end TLV
1512  *                           and set the corresponding tag in QDF packet
1513  * @soc: core txrx main context
1514  * @vdev: vdev on which the packet is received
1515  * @nbuf: QDF pkt buffer on which the protocol tag should be set
1516  * @rx_tlv_hdr: base address where the RX TLVs starts
1517  * @is_update_stats: flag to indicate whether to update stats or not
1518  *
1519  * Return: void
1520  */
1521 static inline void
1522 dp_rx_update_flow_tag(struct dp_soc *soc, struct dp_vdev *vdev,
1523 		      qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr, bool update_stats)
1524 {
1525 }
1526 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */
1527 
1528 #define CRITICAL_BUFFER_THRESHOLD	64
1529 /*
1530  * dp_rx_buffers_replenish() - replenish rxdma ring with rx nbufs
1531  *			       called during dp rx initialization
1532  *			       and at the end of dp_rx_process.
1533  *
1534  * @soc: core txrx main context
1535  * @mac_id: mac_id which is one of 3 mac_ids
1536  * @dp_rxdma_srng: dp rxdma circular ring
1537  * @rx_desc_pool: Pointer to free Rx descriptor pool
1538  * @num_req_buffers: number of buffer to be replenished
1539  * @desc_list: list of descs if called from dp_rx_process
1540  *	       or NULL during dp rx initialization or out of buffer
1541  *	       interrupt.
1542  * @tail: tail of descs list
1543  * @req_only: If true don't replenish more than req buffers
1544  * @func_name: name of the caller function
1545  * Return: return success or failure
1546  */
1547 QDF_STATUS __dp_rx_buffers_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
1548 				 struct dp_srng *dp_rxdma_srng,
1549 				 struct rx_desc_pool *rx_desc_pool,
1550 				 uint32_t num_req_buffers,
1551 				 union dp_rx_desc_list_elem_t **desc_list,
1552 				 union dp_rx_desc_list_elem_t **tail,
1553 				 bool req_only,
1554 				 const char *func_name);
1555 /*
1556  * __dp_rx_buffers_no_map_replenish() - replenish rxdma ring with rx nbufs
1557  *					use direct APIs to get invalidate
1558  *					and get the physical address of the
1559  *					nbuf instead of map api,called during
1560  *					dp rx initialization and at the end
1561  *					of dp_rx_process.
1562  *
1563  * @soc: core txrx main context
1564  * @mac_id: mac_id which is one of 3 mac_ids
1565  * @dp_rxdma_srng: dp rxdma circular ring
1566  * @rx_desc_pool: Pointer to free Rx descriptor pool
1567  * @num_req_buffers: number of buffer to be replenished
1568  * @desc_list: list of descs if called from dp_rx_process
1569  *	       or NULL during dp rx initialization or out of buffer
1570  *	       interrupt.
1571  * @tail: tail of descs list
1572  * Return: return success or failure
1573  */
1574 QDF_STATUS
1575 __dp_rx_buffers_no_map_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
1576 				 struct dp_srng *dp_rxdma_srng,
1577 				 struct rx_desc_pool *rx_desc_pool,
1578 				 uint32_t num_req_buffers,
1579 				 union dp_rx_desc_list_elem_t **desc_list,
1580 				 union dp_rx_desc_list_elem_t **tail);
1581 
1582 /*
1583  * __dp_rx_buffers_no_map__lt_replenish() - replenish rxdma ring with rx nbufs
1584  *					use direct APIs to get invalidate
1585  *					and get the physical address of the
1586  *					nbuf instead of map api,called when
1587  *					low threshold interrupt is triggered
1588  *
1589  * @soc: core txrx main context
1590  * @mac_id: mac_id which is one of 3 mac_ids
1591  * @dp_rxdma_srng: dp rxdma circular ring
1592  * @rx_desc_pool: Pointer to free Rx descriptor pool
1593  * Return: return success or failure
1594  */
1595 QDF_STATUS
1596 __dp_rx_buffers_no_map_lt_replenish(struct dp_soc *dp_soc, uint32_t mac_id,
1597 				    struct dp_srng *dp_rxdma_srng,
1598 				    struct rx_desc_pool *rx_desc_pool);
1599 /*
1600  * __dp_pdev_rx_buffers_no_map_attach() - replenish rxdma ring with rx nbufs
1601  *					use direct APIs to get invalidate
1602  *					and get the physical address of the
1603  *					nbuf instead of map api,called during
1604  *					dp rx initialization.
1605  *
1606  * @soc: core txrx main context
1607  * @mac_id: mac_id which is one of 3 mac_ids
1608  * @dp_rxdma_srng: dp rxdma circular ring
1609  * @rx_desc_pool: Pointer to free Rx descriptor pool
1610  * @num_req_buffers: number of buffer to be replenished
1611  * Return: return success or failure
1612  */
1613 QDF_STATUS __dp_pdev_rx_buffers_no_map_attach(struct dp_soc *dp_soc,
1614 					      uint32_t mac_id,
1615 					      struct dp_srng *dp_rxdma_srng,
1616 					      struct rx_desc_pool *rx_desc_pool,
1617 					      uint32_t num_req_buffers);
1618 
1619 /*
1620  * dp_pdev_rx_buffers_attach() - replenish rxdma ring with rx nbufs
1621  *                               called during dp rx initialization
1622  *
1623  * @soc: core txrx main context
1624  * @mac_id: mac_id which is one of 3 mac_ids
1625  * @dp_rxdma_srng: dp rxdma circular ring
1626  * @rx_desc_pool: Pointer to free Rx descriptor pool
1627  * @num_req_buffers: number of buffer to be replenished
1628  *
1629  * Return: return success or failure
1630  */
1631 QDF_STATUS
1632 dp_pdev_rx_buffers_attach(struct dp_soc *dp_soc, uint32_t mac_id,
1633 			  struct dp_srng *dp_rxdma_srng,
1634 			  struct rx_desc_pool *rx_desc_pool,
1635 			  uint32_t num_req_buffers);
1636 
1637 /**
1638  * dp_rx_link_desc_return() - Return a MPDU link descriptor to HW
1639  *			      (WBM), following error handling
1640  *
1641  * @soc: core DP main context
1642  * @buf_addr_info: opaque pointer to the REO error ring descriptor
1643  * @buf_addr_info: void pointer to the buffer_addr_info
1644  * @bm_action: put to idle_list or release to msdu_list
1645  *
1646  * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
1647  */
1648 QDF_STATUS
1649 dp_rx_link_desc_return(struct dp_soc *soc, hal_ring_desc_t ring_desc,
1650 		       uint8_t bm_action);
1651 
1652 /**
1653  * dp_rx_link_desc_return_by_addr - Return a MPDU link descriptor to
1654  *					(WBM) by address
1655  *
1656  * @soc: core DP main context
1657  * @link_desc_addr: link descriptor addr
1658  *
1659  * Return: QDF_STATUS_E_FAILURE for failure else QDF_STATUS_SUCCESS
1660  */
1661 QDF_STATUS
1662 dp_rx_link_desc_return_by_addr(struct dp_soc *soc,
1663 			       hal_buff_addrinfo_t link_desc_addr,
1664 			       uint8_t bm_action);
1665 
1666 /**
1667  * dp_rxdma_err_process() - RxDMA error processing functionality
1668  * @soc: core txrx main context
1669  * @mac_id: mac id which is one of 3 mac_ids
1670  * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
1671  * @quota: No. of units (packets) that can be serviced in one shot.
1672  *
1673  * Return: num of buffers processed
1674  */
1675 uint32_t
1676 dp_rxdma_err_process(struct dp_intr *int_ctx, struct dp_soc *soc,
1677 		     uint32_t mac_id, uint32_t quota);
1678 
1679 void dp_rx_fill_mesh_stats(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
1680 				uint8_t *rx_tlv_hdr, struct dp_txrx_peer *peer);
1681 QDF_STATUS dp_rx_filter_mesh_packets(struct dp_vdev *vdev, qdf_nbuf_t nbuf,
1682 					uint8_t *rx_tlv_hdr);
1683 
1684 int dp_wds_rx_policy_check(uint8_t *rx_tlv_hdr, struct dp_vdev *vdev,
1685 			   struct dp_txrx_peer *peer);
1686 
1687 /*
1688  * dp_rx_dump_info_and_assert() - dump RX Ring info and Rx Desc info
1689  *
1690  * @soc: core txrx main context
1691  * @hal_ring: opaque pointer to the HAL Rx Ring, which will be serviced
1692  * @ring_desc: opaque pointer to the RX ring descriptor
1693  * @rx_desc: host rx descriptor
1694  *
1695  * Return: void
1696  */
1697 void dp_rx_dump_info_and_assert(struct dp_soc *soc,
1698 				hal_ring_handle_t hal_ring_hdl,
1699 				hal_ring_desc_t ring_desc,
1700 				struct dp_rx_desc *rx_desc);
1701 
1702 void dp_rx_compute_delay(struct dp_vdev *vdev, qdf_nbuf_t nbuf);
1703 
1704 #ifdef QCA_PEER_EXT_STATS
1705 void dp_rx_compute_tid_delay(struct cdp_delay_tid_stats *stats,
1706 			     qdf_nbuf_t nbuf);
1707 #endif /* QCA_PEER_EXT_STATS */
1708 
1709 #ifdef RX_DESC_DEBUG_CHECK
1710 /**
1711  * dp_rx_desc_check_magic() - check the magic value in dp_rx_desc
1712  * @rx_desc: rx descriptor pointer
1713  *
1714  * Return: true, if magic is correct, else false.
1715  */
1716 static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
1717 {
1718 	if (qdf_unlikely(rx_desc->magic != DP_RX_DESC_MAGIC))
1719 		return false;
1720 
1721 	rx_desc->magic = 0;
1722 	return true;
1723 }
1724 
1725 /**
1726  * dp_rx_desc_prep() - prepare rx desc
1727  * @rx_desc: rx descriptor pointer to be prepared
1728  * @nbuf_frag_info_t: struct dp_rx_nbuf_frag_info *
1729  *
1730  * Note: assumption is that we are associating a nbuf which is mapped
1731  *
1732  * Return: none
1733  */
1734 static inline
1735 void dp_rx_desc_prep(struct dp_rx_desc *rx_desc,
1736 		     struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1737 {
1738 	rx_desc->magic = DP_RX_DESC_MAGIC;
1739 	rx_desc->nbuf = (nbuf_frag_info_t->virt_addr).nbuf;
1740 	rx_desc->unmapped = 0;
1741 	rx_desc->nbuf_data_addr = (uint8_t *)qdf_nbuf_data(rx_desc->nbuf);
1742 }
1743 
1744 /**
1745  * dp_rx_desc_frag_prep() - prepare rx desc
1746  * @rx_desc: rx descriptor pointer to be prepared
1747  * @nbuf_frag_info_t: struct dp_rx_nbuf_frag_info *
1748  *
1749  * Note: assumption is that we frag address is mapped
1750  *
1751  * Return: none
1752  */
1753 #ifdef DP_RX_MON_MEM_FRAG
1754 static inline
1755 void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
1756 			  struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1757 {
1758 	rx_desc->magic = DP_RX_DESC_MAGIC;
1759 	rx_desc->rx_buf_start =
1760 		(uint8_t *)((nbuf_frag_info_t->virt_addr).vaddr);
1761 	rx_desc->paddr_buf_start = nbuf_frag_info_t->paddr;
1762 	rx_desc->unmapped = 0;
1763 }
1764 #else
1765 static inline
1766 void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
1767 			  struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1768 {
1769 }
1770 #endif /* DP_RX_MON_MEM_FRAG */
1771 
1772 /**
1773  * dp_rx_desc_paddr_sanity_check() - paddr sanity for ring desc vs rx_desc
1774  * @rx_desc: rx descriptor
1775  * @ring_paddr: paddr obatined from the ring
1776  *
1777  * Returns: QDF_STATUS
1778  */
1779 static inline
1780 bool dp_rx_desc_paddr_sanity_check(struct dp_rx_desc *rx_desc,
1781 				   uint64_t ring_paddr)
1782 {
1783 	return (ring_paddr == qdf_nbuf_get_frag_paddr(rx_desc->nbuf, 0));
1784 }
1785 #else
1786 
1787 static inline bool dp_rx_desc_check_magic(struct dp_rx_desc *rx_desc)
1788 {
1789 	return true;
1790 }
1791 
1792 static inline
1793 void dp_rx_desc_prep(struct dp_rx_desc *rx_desc,
1794 		     struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1795 {
1796 	rx_desc->nbuf = (nbuf_frag_info_t->virt_addr).nbuf;
1797 	rx_desc->unmapped = 0;
1798 }
1799 
1800 #ifdef DP_RX_MON_MEM_FRAG
1801 static inline
1802 void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
1803 			  struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1804 {
1805 	rx_desc->rx_buf_start =
1806 		(uint8_t *)((nbuf_frag_info_t->virt_addr).vaddr);
1807 	rx_desc->paddr_buf_start = nbuf_frag_info_t->paddr;
1808 	rx_desc->unmapped = 0;
1809 }
1810 #else
1811 static inline
1812 void dp_rx_desc_frag_prep(struct dp_rx_desc *rx_desc,
1813 			  struct dp_rx_nbuf_frag_info *nbuf_frag_info_t)
1814 {
1815 }
1816 #endif /* DP_RX_MON_MEM_FRAG */
1817 
1818 static inline
1819 bool dp_rx_desc_paddr_sanity_check(struct dp_rx_desc *rx_desc,
1820 				   uint64_t ring_paddr)
1821 {
1822 	return true;
1823 }
1824 #endif /* RX_DESC_DEBUG_CHECK */
1825 
1826 void dp_rx_enable_mon_dest_frag(struct rx_desc_pool *rx_desc_pool,
1827 				bool is_mon_dest_desc);
1828 
1829 void dp_rx_process_rxdma_err(struct dp_soc *soc, qdf_nbuf_t nbuf,
1830 			     uint8_t *rx_tlv_hdr, struct dp_txrx_peer *peer,
1831 			     uint8_t err_code, uint8_t mac_id);
1832 
1833 #ifndef QCA_MULTIPASS_SUPPORT
1834 static inline
1835 bool dp_rx_multipass_process(struct dp_txrx_peer *peer, qdf_nbuf_t nbuf,
1836 			     uint8_t tid)
1837 {
1838 	return false;
1839 }
1840 #else
1841 bool dp_rx_multipass_process(struct dp_txrx_peer *peer, qdf_nbuf_t nbuf,
1842 			     uint8_t tid);
1843 #endif
1844 
1845 #ifndef QCA_HOST_MODE_WIFI_DISABLED
1846 
1847 #ifndef WLAN_RX_PKT_CAPTURE_ENH
1848 static inline
1849 QDF_STATUS dp_peer_set_rx_capture_enabled(struct dp_pdev *pdev,
1850 					  struct dp_peer *peer_handle,
1851 					  bool value, uint8_t *mac_addr)
1852 {
1853 	return QDF_STATUS_SUCCESS;
1854 }
1855 #endif
1856 
1857 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
1858 
1859 /**
1860  * dp_rx_deliver_to_stack() - deliver pkts to network stack
1861  * Caller to hold peer refcount and check for valid peer
1862  * @soc: soc
1863  * @vdev: vdev
1864  * @txrx_peer: txrx peer
1865  * @nbuf_head: skb list head
1866  * @nbuf_tail: skb list tail
1867  *
1868  * Return: QDF_STATUS
1869  */
1870 QDF_STATUS dp_rx_deliver_to_stack(struct dp_soc *soc,
1871 				  struct dp_vdev *vdev,
1872 				  struct dp_txrx_peer *peer,
1873 				  qdf_nbuf_t nbuf_head,
1874 				  qdf_nbuf_t nbuf_tail);
1875 
1876 #ifdef QCA_SUPPORT_EAPOL_OVER_CONTROL_PORT
1877 /**
1878  * dp_rx_eapol_deliver_to_stack() - deliver pkts to network stack
1879  * caller to hold peer refcount and check for valid peer
1880  * @soc: soc
1881  * @vdev: vdev
1882  * @peer: peer
1883  * @nbuf_head: skb list head
1884  * @nbuf_tail: skb list tail
1885  *
1886  * return: QDF_STATUS
1887  */
1888 QDF_STATUS dp_rx_eapol_deliver_to_stack(struct dp_soc *soc,
1889 					struct dp_vdev *vdev,
1890 					struct dp_txrx_peer *peer,
1891 					qdf_nbuf_t nbuf_head,
1892 					qdf_nbuf_t nbuf_tail);
1893 #endif
1894 
1895 #ifndef QCA_HOST_MODE_WIFI_DISABLED
1896 
1897 #ifdef QCA_OL_RX_LOCK_LESS_ACCESS
1898 /*
1899  * dp_rx_ring_access_start()- Wrapper function to log access start of a hal ring
1900  * @int_ctx: pointer to DP interrupt context
1901  * @dp_soc - DP soc structure pointer
1902  * @hal_ring_hdl - HAL ring handle
1903  *
1904  * Return: 0 on success; error on failure
1905  */
1906 static inline int
1907 dp_rx_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *soc,
1908 			hal_ring_handle_t hal_ring_hdl)
1909 {
1910 	return hal_srng_access_start_unlocked(soc->hal_soc, hal_ring_hdl);
1911 }
1912 
1913 /*
1914  * dp_rx_ring_access_end()- Wrapper function to log access end of a hal ring
1915  * @int_ctx: pointer to DP interrupt context
1916  * @dp_soc - DP soc structure pointer
1917  * @hal_ring_hdl - HAL ring handle
1918  *
1919  * Return - None
1920  */
1921 static inline void
1922 dp_rx_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *soc,
1923 		      hal_ring_handle_t hal_ring_hdl)
1924 {
1925 	hal_srng_access_end_unlocked(soc->hal_soc, hal_ring_hdl);
1926 }
1927 #else
1928 static inline int
1929 dp_rx_srng_access_start(struct dp_intr *int_ctx, struct dp_soc *soc,
1930 			hal_ring_handle_t hal_ring_hdl)
1931 {
1932 	return dp_srng_access_start(int_ctx, soc, hal_ring_hdl);
1933 }
1934 
1935 static inline void
1936 dp_rx_srng_access_end(struct dp_intr *int_ctx, struct dp_soc *soc,
1937 		      hal_ring_handle_t hal_ring_hdl)
1938 {
1939 	dp_srng_access_end(int_ctx, soc, hal_ring_hdl);
1940 }
1941 #endif
1942 
1943 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
1944 
1945 /*
1946  * dp_rx_wbm_sg_list_reset() - Initialize sg list
1947  *
1948  * This api should be called at soc init and afterevery sg processing.
1949  *@soc: DP SOC handle
1950  */
1951 static inline void dp_rx_wbm_sg_list_reset(struct dp_soc *soc)
1952 {
1953 	if (soc) {
1954 		soc->wbm_sg_param.wbm_is_first_msdu_in_sg = false;
1955 		soc->wbm_sg_param.wbm_sg_nbuf_head = NULL;
1956 		soc->wbm_sg_param.wbm_sg_nbuf_tail = NULL;
1957 		soc->wbm_sg_param.wbm_sg_desc_msdu_len = 0;
1958 	}
1959 }
1960 
1961 /*
1962  * dp_rx_wbm_sg_list_deinit() - De-initialize sg list
1963  *
1964  * This api should be called in down path, to avoid any leak.
1965  *@soc: DP SOC handle
1966  */
1967 static inline void dp_rx_wbm_sg_list_deinit(struct dp_soc *soc)
1968 {
1969 	if (soc) {
1970 		if (soc->wbm_sg_param.wbm_sg_nbuf_head)
1971 			qdf_nbuf_list_free(soc->wbm_sg_param.wbm_sg_nbuf_head);
1972 
1973 		dp_rx_wbm_sg_list_reset(soc);
1974 	}
1975 }
1976 
1977 #ifndef QCA_HOST_MODE_WIFI_DISABLED
1978 
1979 #ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL
1980 #define DP_RX_PROCESS_NBUF(soc, head, tail, ebuf_head, ebuf_tail, rx_desc) \
1981 	do {								   \
1982 		if (!soc->rx_buff_pool[rx_desc->pool_id].is_initialized) { \
1983 			DP_RX_LIST_APPEND(head, tail, rx_desc->nbuf);	   \
1984 			break;						   \
1985 		}							   \
1986 		DP_RX_LIST_APPEND(ebuf_head, ebuf_tail, rx_desc->nbuf);	   \
1987 		if (!qdf_nbuf_is_rx_chfrag_cont(rx_desc->nbuf)) {	   \
1988 			if (!dp_rx_buffer_pool_refill(soc, ebuf_head,	   \
1989 						      rx_desc->pool_id))   \
1990 				DP_RX_MERGE_TWO_LIST(head, tail,	   \
1991 						     ebuf_head, ebuf_tail);\
1992 			ebuf_head = NULL;				   \
1993 			ebuf_tail = NULL;				   \
1994 		}							   \
1995 	} while (0)
1996 #else
1997 #define DP_RX_PROCESS_NBUF(soc, head, tail, ebuf_head, ebuf_tail, rx_desc) \
1998 	DP_RX_LIST_APPEND(head, tail, rx_desc->nbuf)
1999 #endif /* WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL */
2000 
2001 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
2002 
2003 /*
2004  * dp_rx_link_desc_refill_duplicate_check() - check if link desc duplicate
2005 					      to refill
2006  * @soc: DP SOC handle
2007  * @buf_info: the last link desc buf info
2008  * @ring_buf_info: current buf address pointor including link desc
2009  *
2010  * return: none.
2011  */
2012 void dp_rx_link_desc_refill_duplicate_check(
2013 				struct dp_soc *soc,
2014 				struct hal_buf_info *buf_info,
2015 				hal_buff_addrinfo_t ring_buf_info);
2016 
2017 #ifdef WLAN_FEATURE_PKT_CAPTURE_V2
2018 /**
2019  * dp_rx_deliver_to_pkt_capture() - deliver rx packet to packet capture
2020  * @soc : dp_soc handle
2021  * @pdev: dp_pdev handle
2022  * @peer_id: peer_id of the peer for which completion came
2023  * @ppdu_id: ppdu_id
2024  * @netbuf: Buffer pointer
2025  *
2026  * This function is used to deliver rx packet to packet capture
2027  */
2028 void dp_rx_deliver_to_pkt_capture(struct dp_soc *soc,  struct dp_pdev *pdev,
2029 				  uint16_t peer_id, uint32_t is_offload,
2030 				  qdf_nbuf_t netbuf);
2031 void dp_rx_deliver_to_pkt_capture_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf,
2032 					  uint32_t is_offload);
2033 #else
2034 static inline void
2035 dp_rx_deliver_to_pkt_capture(struct dp_soc *soc,  struct dp_pdev *pdev,
2036 			     uint16_t peer_id, uint32_t is_offload,
2037 			     qdf_nbuf_t netbuf)
2038 {
2039 }
2040 
2041 static inline void
2042 dp_rx_deliver_to_pkt_capture_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf,
2043 				     uint32_t is_offload)
2044 {
2045 }
2046 #endif
2047 
2048 #ifndef QCA_HOST_MODE_WIFI_DISABLED
2049 #ifdef FEATURE_MEC
2050 /**
2051  * dp_rx_mcast_echo_check() - check if the mcast pkt is a loop
2052  *			      back on same vap or a different vap.
2053  * @soc: core DP main context
2054  * @peer: dp peer handler
2055  * @rx_tlv_hdr: start of the rx TLV header
2056  * @nbuf: pkt buffer
2057  *
2058  * Return: bool (true if it is a looped back pkt else false)
2059  *
2060  */
2061 bool dp_rx_mcast_echo_check(struct dp_soc *soc,
2062 			    struct dp_txrx_peer *peer,
2063 			    uint8_t *rx_tlv_hdr,
2064 			    qdf_nbuf_t nbuf);
2065 #else
2066 static inline bool dp_rx_mcast_echo_check(struct dp_soc *soc,
2067 					  struct dp_txrx_peer *peer,
2068 					  uint8_t *rx_tlv_hdr,
2069 					  qdf_nbuf_t nbuf)
2070 {
2071 	return false;
2072 }
2073 #endif /* FEATURE_MEC */
2074 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
2075 
2076 #ifdef RECEIVE_OFFLOAD
2077 void dp_rx_fill_gro_info(struct dp_soc *soc, uint8_t *rx_tlv,
2078 			 qdf_nbuf_t msdu, uint32_t *rx_ol_pkt_cnt);
2079 #else
2080 static inline
2081 void dp_rx_fill_gro_info(struct dp_soc *soc, uint8_t *rx_tlv,
2082 			 qdf_nbuf_t msdu, uint32_t *rx_ol_pkt_cnt)
2083 {
2084 }
2085 #endif
2086 
2087 void dp_rx_msdu_stats_update(struct dp_soc *soc, qdf_nbuf_t nbuf,
2088 			     uint8_t *rx_tlv_hdr, struct dp_txrx_peer *peer,
2089 			     uint8_t ring_id,
2090 			     struct cdp_tid_rx_stats *tid_stats);
2091 
2092 void dp_rx_deliver_to_stack_no_peer(struct dp_soc *soc, qdf_nbuf_t nbuf);
2093 
2094 uint32_t dp_rx_srng_get_num_pending(hal_soc_handle_t hal_soc,
2095 				    hal_ring_handle_t hal_ring_hdl,
2096 				    uint32_t num_entries,
2097 				    bool *near_full);
2098 
2099 #ifdef WLAN_FEATURE_DP_RX_RING_HISTORY
2100 void dp_rx_ring_record_entry(struct dp_soc *soc, uint8_t ring_num,
2101 			     hal_ring_desc_t ring_desc);
2102 #else
2103 static inline void
2104 dp_rx_ring_record_entry(struct dp_soc *soc, uint8_t ring_num,
2105 			hal_ring_desc_t ring_desc)
2106 {
2107 }
2108 #endif
2109 
2110 #ifndef QCA_HOST_MODE_WIFI_DISABLED
2111 #ifdef RX_DESC_SANITY_WAR
2112 QDF_STATUS dp_rx_desc_sanity(struct dp_soc *soc, hal_soc_handle_t hal_soc,
2113 			     hal_ring_handle_t hal_ring_hdl,
2114 			     hal_ring_desc_t ring_desc,
2115 			     struct dp_rx_desc *rx_desc);
2116 #else
2117 static inline
2118 QDF_STATUS dp_rx_desc_sanity(struct dp_soc *soc, hal_soc_handle_t hal_soc,
2119 			     hal_ring_handle_t hal_ring_hdl,
2120 			     hal_ring_desc_t ring_desc,
2121 			     struct dp_rx_desc *rx_desc)
2122 {
2123 	return QDF_STATUS_SUCCESS;
2124 }
2125 #endif
2126 
2127 #ifdef DP_RX_DROP_RAW_FRM
2128 bool dp_rx_is_raw_frame_dropped(qdf_nbuf_t nbuf);
2129 #else
2130 static inline
2131 bool dp_rx_is_raw_frame_dropped(qdf_nbuf_t nbuf)
2132 {
2133 	return false;
2134 }
2135 #endif
2136 
2137 #ifdef RX_DESC_DEBUG_CHECK
2138 QDF_STATUS dp_rx_desc_nbuf_sanity_check(struct dp_soc *soc,
2139 					hal_ring_desc_t ring_desc,
2140 					struct dp_rx_desc *rx_desc);
2141 #else
2142 static inline
2143 QDF_STATUS dp_rx_desc_nbuf_sanity_check(struct dp_soc *soc,
2144 					hal_ring_desc_t ring_desc,
2145 					struct dp_rx_desc *rx_desc)
2146 {
2147 	return QDF_STATUS_SUCCESS;
2148 }
2149 #endif
2150 
2151 #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR
2152 void dp_rx_update_stats(struct dp_soc *soc, qdf_nbuf_t nbuf);
2153 #else
2154 static inline
2155 void dp_rx_update_stats(struct dp_soc *soc, qdf_nbuf_t nbuf)
2156 {
2157 }
2158 #endif
2159 
2160 /**
2161  * dp_rx_cksum_offload() - set the nbuf checksum as defined by hardware.
2162  * @nbuf: pointer to the first msdu of an amsdu.
2163  * @rx_tlv_hdr: pointer to the start of RX TLV headers.
2164  *
2165  * The ipsumed field of the skb is set based on whether HW validated the
2166  * IP/TCP/UDP checksum.
2167  *
2168  * Return: void
2169  */
2170 #if defined(MAX_PDEV_CNT) && (MAX_PDEV_CNT == 1)
2171 static inline
2172 void dp_rx_cksum_offload(struct dp_pdev *pdev,
2173 			 qdf_nbuf_t nbuf,
2174 			 uint8_t *rx_tlv_hdr)
2175 {
2176 	qdf_nbuf_rx_cksum_t cksum = {0};
2177 	//TODO - Move this to ring desc api
2178 	//HAL_RX_MSDU_DESC_IP_CHKSUM_FAIL_GET
2179 	//HAL_RX_MSDU_DESC_TCP_UDP_CHKSUM_FAIL_GET
2180 	uint32_t ip_csum_err, tcp_udp_csum_er;
2181 
2182 	hal_rx_tlv_csum_err_get(pdev->soc->hal_soc, rx_tlv_hdr, &ip_csum_err,
2183 				&tcp_udp_csum_er);
2184 
2185 	if (qdf_likely(!ip_csum_err && !tcp_udp_csum_er)) {
2186 		cksum.l4_result = QDF_NBUF_RX_CKSUM_TCP_UDP_UNNECESSARY;
2187 		qdf_nbuf_set_rx_cksum(nbuf, &cksum);
2188 	} else {
2189 		DP_STATS_INCC(pdev, err.ip_csum_err, 1, ip_csum_err);
2190 		DP_STATS_INCC(pdev, err.tcp_udp_csum_err, 1, tcp_udp_csum_er);
2191 	}
2192 }
2193 #else
2194 static inline
2195 void dp_rx_cksum_offload(struct dp_pdev *pdev,
2196 			 qdf_nbuf_t nbuf,
2197 			 uint8_t *rx_tlv_hdr)
2198 {
2199 }
2200 #endif
2201 #endif /* QCA_HOST_MODE_WIFI_DISABLED */
2202 
2203 #ifdef WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT
2204 static inline
2205 bool dp_rx_reap_loop_pkt_limit_hit(struct dp_soc *soc, int num_reaped,
2206 				   int max_reap_limit)
2207 {
2208 	bool limit_hit = false;
2209 
2210 	limit_hit =
2211 		(num_reaped >= max_reap_limit) ? true : false;
2212 
2213 	if (limit_hit)
2214 		DP_STATS_INC(soc, rx.reap_loop_pkt_limit_hit, 1)
2215 
2216 	return limit_hit;
2217 }
2218 
2219 static inline
2220 bool dp_rx_enable_eol_data_check(struct dp_soc *soc)
2221 {
2222 	return soc->wlan_cfg_ctx->rx_enable_eol_data_check;
2223 }
2224 
2225 static inline int dp_rx_get_loop_pkt_limit(struct dp_soc *soc)
2226 {
2227 	struct wlan_cfg_dp_soc_ctxt *cfg = soc->wlan_cfg_ctx;
2228 
2229 	return cfg->rx_reap_loop_pkt_limit;
2230 }
2231 #else
2232 static inline
2233 bool dp_rx_reap_loop_pkt_limit_hit(struct dp_soc *soc, int num_reaped,
2234 				   int max_reap_limit)
2235 {
2236 	return false;
2237 }
2238 
2239 static inline
2240 bool dp_rx_enable_eol_data_check(struct dp_soc *soc)
2241 {
2242 	return false;
2243 }
2244 
2245 static inline int dp_rx_get_loop_pkt_limit(struct dp_soc *soc)
2246 {
2247 	return 0;
2248 }
2249 #endif /* WLAN_FEATURE_RX_SOFTIRQ_TIME_LIMIT */
2250 
2251 void dp_rx_update_stats(struct dp_soc *soc, qdf_nbuf_t nbuf);
2252 
2253 #ifdef QCA_SUPPORT_WDS_EXTENDED
2254 /**
2255  * dp_rx_is_list_ready() - Make different lists for 4-address
2256 			   and 3-address frames
2257  * @nbuf_head: skb list head
2258  * @vdev: vdev
2259 * @txrx_peer : txrx_peer
2260  * @peer_id: peer id of new received frame
2261  * @vdev_id: vdev_id of new received frame
2262  *
2263  * Return: true if peer_ids are different.
2264  */
2265 static inline bool
2266 dp_rx_is_list_ready(qdf_nbuf_t nbuf_head,
2267 		    struct dp_vdev *vdev,
2268 		    struct dp_txrx_peer *txrx_peer,
2269 		    uint16_t peer_id,
2270 		    uint8_t vdev_id)
2271 {
2272 	if (nbuf_head && txrx_peer && txrx_peer->peer_id != peer_id)
2273 		return true;
2274 
2275 	return false;
2276 }
2277 #else
2278 static inline bool
2279 dp_rx_is_list_ready(qdf_nbuf_t nbuf_head,
2280 		    struct dp_vdev *vdev,
2281 		    struct dp_txrx_peer *txrx_peer,
2282 		    uint16_t peer_id,
2283 		    uint8_t vdev_id)
2284 {
2285 	if (nbuf_head && vdev && (vdev->vdev_id != vdev_id))
2286 		return true;
2287 
2288 	return false;
2289 }
2290 #endif
2291 
2292 #ifdef WLAN_FEATURE_MARK_FIRST_WAKEUP_PACKET
2293 /**
2294  * dp_rx_mark_first_packet_after_wow_wakeup - get first packet after wow wakeup
2295  * @pdev: pointer to dp_pdev structure
2296  * @rx_tlv: pointer to rx_pkt_tlvs structure
2297  * @nbuf: pointer to skb buffer
2298  *
2299  * Return: None
2300  */
2301 void dp_rx_mark_first_packet_after_wow_wakeup(struct dp_pdev *pdev,
2302 					      uint8_t *rx_tlv,
2303 					      qdf_nbuf_t nbuf);
2304 #else
2305 static inline void
2306 dp_rx_mark_first_packet_after_wow_wakeup(struct dp_pdev *pdev,
2307 					 uint8_t *rx_tlv,
2308 					 qdf_nbuf_t nbuf)
2309 {
2310 }
2311 #endif
2312 
2313 #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
2314 static inline uint8_t
2315 dp_rx_get_defrag_bm_id(struct dp_soc *soc)
2316 {
2317 	return DP_DEFRAG_RBM(soc->wbm_sw0_bm_id);
2318 }
2319 
2320 static inline uint8_t
2321 dp_rx_get_rx_bm_id(struct dp_soc *soc)
2322 {
2323 	return DP_WBM2SW_RBM(soc->wbm_sw0_bm_id);
2324 }
2325 #else
2326 static inline uint8_t
2327 dp_rx_get_rx_bm_id(struct dp_soc *soc)
2328 {
2329 	struct wlan_cfg_dp_soc_ctxt *cfg_ctx = soc->wlan_cfg_ctx;
2330 	uint8_t wbm2_sw_rx_rel_ring_id;
2331 
2332 	wbm2_sw_rx_rel_ring_id = wlan_cfg_get_rx_rel_ring_id(cfg_ctx);
2333 
2334 	return HAL_RX_BUF_RBM_SW_BM(soc->wbm_sw0_bm_id,
2335 				    wbm2_sw_rx_rel_ring_id);
2336 }
2337 
2338 static inline uint8_t
2339 dp_rx_get_defrag_bm_id(struct dp_soc *soc)
2340 {
2341 	return dp_rx_get_rx_bm_id(soc);
2342 }
2343 #endif
2344 
2345 static inline uint16_t
2346 dp_rx_peer_metadata_peer_id_get(struct dp_soc *soc, uint32_t peer_metadata)
2347 {
2348 	return soc->arch_ops.dp_rx_peer_metadata_peer_id_get(soc,
2349 							     peer_metadata);
2350 }
2351 
2352 /**
2353  * dp_rx_desc_pool_init_generic() - Generic Rx descriptors initialization
2354  * @soc: SOC handle
2355  * @rx_desc_pool: pointer to RX descriptor pool
2356  * @pool_id: pool ID
2357  *
2358  * Return: None
2359  */
2360 QDF_STATUS dp_rx_desc_pool_init_generic(struct dp_soc *soc,
2361 				  struct rx_desc_pool *rx_desc_pool,
2362 				  uint32_t pool_id);
2363 
2364 void dp_rx_desc_pool_deinit_generic(struct dp_soc *soc,
2365 				  struct rx_desc_pool *rx_desc_pool,
2366 				  uint32_t pool_id);
2367 
2368 /**
2369  * dp_rx_pkt_tracepoints_enabled() - Get the state of rx pkt tracepoint
2370  *
2371  * Return: True if any rx pkt tracepoint is enabled else false
2372  */
2373 static inline
2374 bool dp_rx_pkt_tracepoints_enabled(void)
2375 {
2376 	return (qdf_trace_dp_rx_tcp_pkt_enabled() ||
2377 		qdf_trace_dp_rx_udp_pkt_enabled() ||
2378 		qdf_trace_dp_rx_pkt_enabled());
2379 }
2380 
2381 #if defined(QCA_DP_RX_NBUF_NO_MAP_UNMAP) && !defined(BUILD_X86)
2382 static inline
2383 QDF_STATUS dp_pdev_rx_buffers_attach_simple(struct dp_soc *soc, uint32_t mac_id,
2384 					    struct dp_srng *rxdma_srng,
2385 					    struct rx_desc_pool *rx_desc_pool,
2386 					    uint32_t num_req_buffers)
2387 {
2388 	return __dp_pdev_rx_buffers_no_map_attach(soc, mac_id,
2389 						  rxdma_srng,
2390 						  rx_desc_pool,
2391 						  num_req_buffers);
2392 }
2393 
2394 static inline
2395 void dp_rx_buffers_replenish_simple(struct dp_soc *soc, uint32_t mac_id,
2396 				    struct dp_srng *rxdma_srng,
2397 				    struct rx_desc_pool *rx_desc_pool,
2398 				    uint32_t num_req_buffers,
2399 				    union dp_rx_desc_list_elem_t **desc_list,
2400 				    union dp_rx_desc_list_elem_t **tail)
2401 {
2402 	__dp_rx_buffers_no_map_replenish(soc, mac_id, rxdma_srng, rx_desc_pool,
2403 					 num_req_buffers, desc_list, tail);
2404 }
2405 
2406 static inline
2407 void dp_rx_buffers_lt_replenish_simple(struct dp_soc *soc, uint32_t mac_id,
2408 				       struct dp_srng *rxdma_srng,
2409 				       struct rx_desc_pool *rx_desc_pool,
2410 				       uint32_t num_req_buffers,
2411 				       union dp_rx_desc_list_elem_t **desc_list,
2412 				       union dp_rx_desc_list_elem_t **tail)
2413 {
2414 	__dp_rx_buffers_no_map_lt_replenish(soc, mac_id, rxdma_srng,
2415 					    rx_desc_pool);
2416 }
2417 
2418 static inline
2419 qdf_dma_addr_t dp_rx_nbuf_sync_no_dsb(struct dp_soc *dp_soc,
2420 				      qdf_nbuf_t nbuf,
2421 				      uint32_t buf_size)
2422 {
2423 	qdf_nbuf_dma_inv_range_no_dsb((void *)nbuf->data,
2424 				      (void *)(nbuf->data + buf_size));
2425 
2426 	return (qdf_dma_addr_t)qdf_mem_virt_to_phys(nbuf->data);
2427 }
2428 
2429 static inline
2430 qdf_dma_addr_t dp_rx_nbuf_sync(struct dp_soc *dp_soc,
2431 			       qdf_nbuf_t nbuf,
2432 			       uint32_t buf_size)
2433 {
2434 	qdf_nbuf_dma_inv_range((void *)nbuf->data,
2435 			       (void *)(nbuf->data + buf_size));
2436 
2437 	return (qdf_dma_addr_t)qdf_mem_virt_to_phys(nbuf->data);
2438 }
2439 
2440 #if !defined(SPECULATIVE_READ_DISABLED)
2441 static inline
2442 void dp_rx_nbuf_unmap(struct dp_soc *soc,
2443 		      struct dp_rx_desc *rx_desc,
2444 		      uint8_t reo_ring_num)
2445 {
2446 	struct rx_desc_pool *rx_desc_pool;
2447 	qdf_nbuf_t nbuf;
2448 
2449 	rx_desc_pool = &soc->rx_desc_buf[rx_desc->pool_id];
2450 	nbuf = rx_desc->nbuf;
2451 
2452 	qdf_nbuf_dma_inv_range_no_dsb((void *)nbuf->data,
2453 			       (void *)(nbuf->data + rx_desc_pool->buf_size));
2454 }
2455 
2456 static inline
2457 void dp_rx_nbuf_unmap_pool(struct dp_soc *soc,
2458 			   struct rx_desc_pool *rx_desc_pool,
2459 			   qdf_nbuf_t nbuf)
2460 {
2461 	qdf_nbuf_dma_inv_range((void *)nbuf->data,
2462 			       (void *)(nbuf->data + rx_desc_pool->buf_size));
2463 }
2464 
2465 #else
2466 static inline
2467 void dp_rx_nbuf_unmap(struct dp_soc *soc,
2468 		      struct dp_rx_desc *rx_desc,
2469 		      uint8_t reo_ring_num)
2470 {
2471 }
2472 
2473 static inline
2474 void dp_rx_nbuf_unmap_pool(struct dp_soc *soc,
2475 			   struct rx_desc_pool *rx_desc_pool,
2476 			   qdf_nbuf_t nbuf)
2477 {
2478 }
2479 #endif
2480 
2481 static inline
2482 void dp_rx_per_core_stats_update(struct dp_soc *soc, uint8_t ring_id,
2483 				 uint32_t bufs_reaped)
2484 {
2485 }
2486 
2487 static inline
2488 qdf_nbuf_t dp_rx_nbuf_alloc(struct dp_soc *soc,
2489 			    struct rx_desc_pool *rx_desc_pool)
2490 {
2491 	return qdf_nbuf_alloc_simple(soc->osdev, rx_desc_pool->buf_size,
2492 				     RX_BUFFER_RESERVATION,
2493 				     rx_desc_pool->buf_alignment, FALSE);
2494 }
2495 
2496 static inline
2497 void  dp_rx_nbuf_free(qdf_nbuf_t nbuf)
2498 {
2499 	qdf_nbuf_free_simple(nbuf);
2500 }
2501 #else
2502 static inline
2503 QDF_STATUS dp_pdev_rx_buffers_attach_simple(struct dp_soc *soc, uint32_t mac_id,
2504 					    struct dp_srng *rxdma_srng,
2505 					    struct rx_desc_pool *rx_desc_pool,
2506 					    uint32_t num_req_buffers)
2507 {
2508 	return dp_pdev_rx_buffers_attach(soc, mac_id,
2509 					 rxdma_srng,
2510 					 rx_desc_pool,
2511 					 num_req_buffers);
2512 }
2513 
2514 static inline
2515 void dp_rx_buffers_replenish_simple(struct dp_soc *soc, uint32_t mac_id,
2516 				    struct dp_srng *rxdma_srng,
2517 				    struct rx_desc_pool *rx_desc_pool,
2518 				    uint32_t num_req_buffers,
2519 				    union dp_rx_desc_list_elem_t **desc_list,
2520 				    union dp_rx_desc_list_elem_t **tail)
2521 {
2522 	dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool,
2523 				num_req_buffers, desc_list, tail, false);
2524 }
2525 
2526 static inline
2527 void dp_rx_buffers_lt_replenish_simple(struct dp_soc *soc, uint32_t mac_id,
2528 				       struct dp_srng *rxdma_srng,
2529 				       struct rx_desc_pool *rx_desc_pool,
2530 				       uint32_t num_req_buffers,
2531 				       union dp_rx_desc_list_elem_t **desc_list,
2532 				       union dp_rx_desc_list_elem_t **tail)
2533 {
2534 	dp_rx_buffers_replenish(soc, mac_id, rxdma_srng, rx_desc_pool,
2535 				num_req_buffers, desc_list, tail, false);
2536 }
2537 
2538 static inline
2539 qdf_dma_addr_t dp_rx_nbuf_sync_no_dsb(struct dp_soc *dp_soc,
2540 				      qdf_nbuf_t nbuf,
2541 				      uint32_t buf_size)
2542 {
2543 	return (qdf_dma_addr_t)NULL;
2544 }
2545 
2546 static inline
2547 qdf_dma_addr_t dp_rx_nbuf_sync(struct dp_soc *dp_soc,
2548 			       qdf_nbuf_t nbuf,
2549 			       uint32_t buf_size)
2550 {
2551 	return (qdf_dma_addr_t)NULL;
2552 }
2553 
2554 static inline
2555 void dp_rx_nbuf_unmap(struct dp_soc *soc,
2556 		      struct dp_rx_desc *rx_desc,
2557 		      uint8_t reo_ring_num)
2558 {
2559 	struct rx_desc_pool *rx_desc_pool;
2560 
2561 	rx_desc_pool = &soc->rx_desc_buf[rx_desc->pool_id];
2562 	dp_ipa_reo_ctx_buf_mapping_lock(soc, reo_ring_num);
2563 	dp_ipa_handle_rx_buf_smmu_mapping(soc, rx_desc->nbuf,
2564 					  rx_desc_pool->buf_size,
2565 					  false, __func__, __LINE__);
2566 
2567 	qdf_nbuf_unmap_nbytes_single(soc->osdev, rx_desc->nbuf,
2568 				     QDF_DMA_FROM_DEVICE,
2569 				     rx_desc_pool->buf_size);
2570 
2571 	dp_ipa_reo_ctx_buf_mapping_unlock(soc, reo_ring_num);
2572 }
2573 
2574 static inline
2575 void dp_rx_nbuf_unmap_pool(struct dp_soc *soc,
2576 			   struct rx_desc_pool *rx_desc_pool,
2577 			   qdf_nbuf_t nbuf)
2578 {
2579 	dp_ipa_handle_rx_buf_smmu_mapping(soc, nbuf, rx_desc_pool->buf_size,
2580 					  false, __func__, __LINE__);
2581 	qdf_nbuf_unmap_nbytes_single(soc->osdev, nbuf, QDF_DMA_FROM_DEVICE,
2582 				     rx_desc_pool->buf_size);
2583 }
2584 
2585 static inline
2586 void dp_rx_per_core_stats_update(struct dp_soc *soc, uint8_t ring_id,
2587 				 uint32_t bufs_reaped)
2588 {
2589 	int cpu_id = qdf_get_cpu();
2590 
2591 	DP_STATS_INC(soc, rx.ring_packets[cpu_id][ring_id], bufs_reaped);
2592 }
2593 
2594 static inline
2595 qdf_nbuf_t dp_rx_nbuf_alloc(struct dp_soc *soc,
2596 			    struct rx_desc_pool *rx_desc_pool)
2597 {
2598 	return qdf_nbuf_alloc(soc->osdev, rx_desc_pool->buf_size,
2599 			      RX_BUFFER_RESERVATION,
2600 			      rx_desc_pool->buf_alignment, FALSE);
2601 }
2602 
2603 static inline
2604 void dp_rx_nbuf_free(qdf_nbuf_t nbuf)
2605 {
2606 	qdf_nbuf_free(nbuf);
2607 }
2608 #endif
2609 
2610 #ifdef DP_UMAC_HW_RESET_SUPPORT
2611 /*
2612  * dp_rx_desc_reuse() - Reuse the rx descriptors to fill the rx buf ring
2613  *
2614  * @soc: core txrx main context
2615  * @nbuf_list: nbuf list for delayed free
2616  *
2617  * Return: void
2618  */
2619 void dp_rx_desc_reuse(struct dp_soc *soc, qdf_nbuf_t *nbuf_list);
2620 
2621 /*
2622  * dp_rx_desc_delayed_free() - Delayed free of the rx descs
2623  *
2624  * @soc: core txrx main context
2625  *
2626  * Return: void
2627  */
2628 void dp_rx_desc_delayed_free(struct dp_soc *soc);
2629 #endif
2630 
2631 /**
2632  * dp_rx_get_txrx_peer_and_vdev() - Get txrx peer and vdev from peer id
2633  * @nbuf : pointer to the first msdu of an amsdu.
2634  * @peer_id : Peer id of the peer
2635  * @txrx_ref_handle : Buffer to save the handle for txrx peer's reference
2636  * @pkt_capture_offload : Flag indicating if pkt capture offload is needed
2637  * @vdev : Buffer to hold pointer to vdev
2638  * @rx_pdev : Buffer to hold pointer to rx pdev
2639  * @dsf : delay stats flag
2640  * @old_tid : Old tid
2641  *
2642  * Get txrx peer and vdev from peer id
2643  *
2644  * Return: Pointer to txrx peer
2645  */
2646 static inline struct dp_txrx_peer *
2647 dp_rx_get_txrx_peer_and_vdev(struct dp_soc *soc,
2648 			     qdf_nbuf_t nbuf,
2649 			     uint16_t peer_id,
2650 			     dp_txrx_ref_handle *txrx_ref_handle,
2651 			     bool pkt_capture_offload,
2652 			     struct dp_vdev **vdev,
2653 			     struct dp_pdev **rx_pdev,
2654 			     uint32_t *dsf,
2655 			     uint32_t *old_tid)
2656 {
2657 	struct dp_txrx_peer *txrx_peer = NULL;
2658 
2659 	txrx_peer = dp_txrx_peer_get_ref_by_id(soc, peer_id, txrx_ref_handle,
2660 					       DP_MOD_ID_RX);
2661 
2662 	if (qdf_likely(txrx_peer)) {
2663 		*vdev = txrx_peer->vdev;
2664 	} else {
2665 		nbuf->next = NULL;
2666 		dp_rx_deliver_to_pkt_capture_no_peer(soc, nbuf,
2667 						     pkt_capture_offload);
2668 		if (!pkt_capture_offload)
2669 			dp_rx_deliver_to_stack_no_peer(soc, nbuf);
2670 
2671 		goto end;
2672 	}
2673 
2674 	if (qdf_unlikely(!(*vdev))) {
2675 		qdf_nbuf_free(nbuf);
2676 		DP_STATS_INC(soc, rx.err.invalid_vdev, 1);
2677 		goto end;
2678 	}
2679 
2680 	*rx_pdev = (*vdev)->pdev;
2681 	*dsf = (*rx_pdev)->delay_stats_flag;
2682 	*old_tid = 0xff;
2683 
2684 end:
2685 	return txrx_peer;
2686 }
2687 
2688 static inline QDF_STATUS
2689 dp_peer_rx_reorder_queue_setup(struct dp_soc *soc, struct dp_peer *peer,
2690 			       int tid, uint32_t ba_window_size)
2691 {
2692 	return soc->arch_ops.dp_peer_rx_reorder_queue_setup(soc,
2693 							    peer, tid,
2694 							    ba_window_size);
2695 }
2696 
2697 static inline
2698 void dp_rx_nbuf_list_deliver(struct dp_soc *soc,
2699 			     struct dp_vdev *vdev,
2700 			     struct dp_txrx_peer *txrx_peer,
2701 			     uint16_t peer_id,
2702 			     uint8_t pkt_capture_offload,
2703 			     qdf_nbuf_t deliver_list_head,
2704 			     qdf_nbuf_t deliver_list_tail)
2705 {
2706 	qdf_nbuf_t nbuf, next;
2707 
2708 	if (qdf_likely(deliver_list_head)) {
2709 		if (qdf_likely(txrx_peer)) {
2710 			dp_rx_deliver_to_pkt_capture(soc, vdev->pdev, peer_id,
2711 						     pkt_capture_offload,
2712 						     deliver_list_head);
2713 			if (!pkt_capture_offload)
2714 				dp_rx_deliver_to_stack(soc, vdev, txrx_peer,
2715 						       deliver_list_head,
2716 						       deliver_list_tail);
2717 		} else {
2718 			nbuf = deliver_list_head;
2719 			while (nbuf) {
2720 				next = nbuf->next;
2721 				nbuf->next = NULL;
2722 				dp_rx_deliver_to_stack_no_peer(soc, nbuf);
2723 				nbuf = next;
2724 			}
2725 		}
2726 	}
2727 }
2728 
2729 #ifdef DP_TX_RX_TPUT_SIMULATE
2730 /*
2731  * Change this macro value to simulate different RX T-put,
2732  * if OTA is 100 Mbps, to simulate 200 Mbps, then multiplication factor
2733  * is 2, set macro value as 1 (multiplication factor - 1).
2734  */
2735 #define DP_RX_PKTS_DUPLICATE_CNT 0
2736 static inline
2737 void dp_rx_nbuf_list_dup_deliver(struct dp_soc *soc,
2738 				 struct dp_vdev *vdev,
2739 				 struct dp_txrx_peer *txrx_peer,
2740 				 uint16_t peer_id,
2741 				 uint8_t pkt_capture_offload,
2742 				 qdf_nbuf_t ori_list_head,
2743 				 qdf_nbuf_t ori_list_tail)
2744 {
2745 	qdf_nbuf_t new_skb = NULL;
2746 	qdf_nbuf_t new_list_head = NULL;
2747 	qdf_nbuf_t new_list_tail = NULL;
2748 	qdf_nbuf_t nbuf = NULL;
2749 	int i;
2750 
2751 	for (i = 0; i < DP_RX_PKTS_DUPLICATE_CNT; i++) {
2752 		nbuf = ori_list_head;
2753 		new_list_head = NULL;
2754 		new_list_tail = NULL;
2755 
2756 		while (nbuf) {
2757 			new_skb = qdf_nbuf_copy(nbuf);
2758 			if (qdf_likely(new_skb))
2759 				DP_RX_LIST_APPEND(new_list_head,
2760 						  new_list_tail,
2761 						  new_skb);
2762 			else
2763 				dp_err("copy skb failed");
2764 
2765 			nbuf = qdf_nbuf_next(nbuf);
2766 		}
2767 
2768 		/* deliver the copied nbuf list */
2769 		dp_rx_nbuf_list_deliver(soc, vdev, txrx_peer, peer_id,
2770 					pkt_capture_offload,
2771 					new_list_head,
2772 					new_list_tail);
2773 	}
2774 
2775 	/* deliver the original skb_list */
2776 	dp_rx_nbuf_list_deliver(soc, vdev, txrx_peer, peer_id,
2777 				pkt_capture_offload,
2778 				ori_list_head,
2779 				ori_list_tail);
2780 }
2781 
2782 #define DP_RX_DELIVER_TO_STACK dp_rx_nbuf_list_dup_deliver
2783 
2784 #else /* !DP_TX_RX_TPUT_SIMULATE */
2785 
2786 #define DP_RX_DELIVER_TO_STACK dp_rx_nbuf_list_deliver
2787 
2788 #endif /* DP_TX_RX_TPUT_SIMULATE */
2789 
2790 #endif /* _DP_RX_H */
2791