xref: /wlan-dirver/qca-wifi-host-cmn/dp/wifi3.0/be/dp_be_rx.h (revision 2f4b444fb7e689b83a4ab0e7b3b38f0bf4def8e0)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #ifndef _DP_BE_RX_H_
20 #define _DP_BE_RX_H_
21 
22 #include <dp_types.h>
23 #include "dp_be.h"
24 
25 #ifndef QCA_HOST_MODE_WIFI_DISABLED
26 
27 /*
28  * dp_rx_intrabss_fwd_be() - API for intrabss fwd. For EAPOL
29  *  pkt with DA not equal to vdev mac addr, fwd is not allowed.
30  * @soc: core txrx main context
31  * @ta_peer: source peer entry
32  * @rx_tlv_hdr: start address of rx tlvs
33  * @nbuf: nbuf that has to be intrabss forwarded
34  * @msdu_metadata: msdu metadata
35  *
36  * Return: true if it is forwarded else false
37  */
38 
39 bool dp_rx_intrabss_fwd_be(struct dp_soc *soc,
40 			   struct dp_peer *ta_peer,
41 			   uint8_t *rx_tlv_hdr,
42 			   qdf_nbuf_t nbuf,
43 			   struct hal_rx_msdu_metadata msdu_metadata);
44 #endif
45 
46 uint32_t dp_rx_process_be(struct dp_intr *int_ctx,
47 			  hal_ring_handle_t hal_ring_hdl, uint8_t reo_ring_num,
48 			  uint32_t quota);
49 
50 /**
51  * dp_rx_desc_pool_init_be() - Initialize Rx Descriptor pool(s)
52  * @soc: Handle to DP Soc structure
53  * @rx_desc_pool: Rx descriptor pool handler
54  * @pool_id: Rx descriptor pool ID
55  *
56  * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
57  */
58 QDF_STATUS dp_rx_desc_pool_init_be(struct dp_soc *soc,
59 				   struct rx_desc_pool *rx_desc_pool,
60 				   uint32_t pool_id);
61 
62 /**
63  * dp_rx_desc_pool_deinit_be() - De-initialize Rx Descriptor pool(s)
64  * @soc: Handle to DP Soc structure
65  * @rx_desc_pool: Rx descriptor pool handler
66  * @pool_id: Rx descriptor pool ID
67  *
68  * Return: None
69  */
70 void dp_rx_desc_pool_deinit_be(struct dp_soc *soc,
71 			       struct rx_desc_pool *rx_desc_pool,
72 			       uint32_t pool_id);
73 
74 /**
75  * dp_wbm_get_rx_desc_from_hal_desc_be() - Get corresponding Rx Desc
76  *					address from WBM ring Desc
77  * @soc: Handle to DP Soc structure
78  * @ring_desc: ring descriptor structure pointer
79  * @r_rx_desc: pointer to a pointer of Rx Desc
80  *
81  * Return: QDF_STATUS_SUCCESS - succeeded, others - failed
82  */
83 QDF_STATUS dp_wbm_get_rx_desc_from_hal_desc_be(struct dp_soc *soc,
84 					       void *ring_desc,
85 					       struct dp_rx_desc **r_rx_desc);
86 
87 /**
88  * dp_rx_desc_cookie_2_va_be() - Convert RX Desc cookie ID to VA
89  * @soc:Handle to DP Soc structure
90  * @cookie: cookie used to lookup virtual address
91  *
92  * Return: Rx descriptor virtual address
93  */
94 struct dp_rx_desc *dp_rx_desc_cookie_2_va_be(struct dp_soc *soc,
95 					     uint32_t cookie);
96 
97 #if !defined(DP_FEATURE_HW_COOKIE_CONVERSION) || \
98 		defined(DP_HW_COOKIE_CONVERT_EXCEPTION)
99 /**
100  * dp_rx_desc_sw_cc_check() - check if RX desc VA is got correctly,
101 			      if not, do SW cookie conversion.
102  * @soc:Handle to DP Soc structure
103  * @rx_buf_cookie: RX desc cookie ID
104  * @r_rx_desc: double pointer for RX desc
105  *
106  * Return: None
107  */
108 static inline void
109 dp_rx_desc_sw_cc_check(struct dp_soc *soc,
110 		       uint32_t rx_buf_cookie,
111 		       struct dp_rx_desc **r_rx_desc)
112 {
113 	if (qdf_unlikely(!(*r_rx_desc))) {
114 		*r_rx_desc = (struct dp_rx_desc *)
115 				dp_cc_desc_find(soc,
116 						rx_buf_cookie);
117 	}
118 }
119 #else
120 static inline void
121 dp_rx_desc_sw_cc_check(struct dp_soc *soc,
122 		       uint32_t rx_buf_cookie,
123 		       struct dp_rx_desc **r_rx_desc)
124 {
125 }
126 #endif /* DP_FEATURE_HW_COOKIE_CONVERSION && DP_HW_COOKIE_CONVERT_EXCEPTION */
127 
128 #ifdef WLAN_FEATURE_NEAR_FULL_IRQ
129 /**
130  * dp_rx_nf_process() - Near Full state handler for RX rings.
131  * @int_ctx: interrupt context
132  * @hal_ring_hdl: Rx ring handle
133  * @reo_ring_num: RX ring number
134  * @quota: Quota of work to be done
135  *
136  * Return: work done in the handler
137  */
138 uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
139 			  hal_ring_handle_t hal_ring_hdl,
140 			  uint8_t reo_ring_num,
141 			  uint32_t quota);
142 #else
143 static inline
144 uint32_t dp_rx_nf_process(struct dp_intr *int_ctx,
145 			  hal_ring_handle_t hal_ring_hdl,
146 			  uint8_t reo_ring_num,
147 			  uint32_t quota)
148 {
149 	return 0;
150 }
151 #endif /*WLAN_FEATURE_NEAR_FULL_IRQ */
152 #endif
153