1 /*
2  * Copyright (c) 2017-2019, 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: qdf_ipa_wdi3.h
20  * This file provides OS abstraction for IPA WDI APIs.
21  */
22 
23 #ifndef _QDF_IPA_WDI3_H
24 #define _QDF_IPA_WDI3_H
25 
26 #ifdef IPA_OFFLOAD
27 
28 #include <qdf_ipa.h>
29 #include <i_qdf_ipa_wdi3.h>
30 
31 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
32 	defined(CONFIG_IPA_WDI_UNIFIED_API)
33 
34 /**
35  * qdf_ipa_wdi_version_t - IPA WDI version
36  */
37 typedef __qdf_ipa_wdi_version_t qdf_ipa_wdi_version_t;
38 
39 /**
40  * qdf_ipa_wdi_hdl_t - IPA handle
41  */
42 typedef __qdf_ipa_wdi_hdl_t qdf_ipa_wdi_hdl_t;
43 
44 /**
45  * qdf_ipa_wdi_capabilities_out_params_t - wdi capabilities output parameters
46  */
47 typedef __qdf_ipa_wdi_capabilities_out_params_t	\
48 		qdf_ipa_wdi_capabilities_out_params_t;
49 
50 #define QDF_IPA_WDI_CAPABILITIES_OUT_PARAMS_NUM_INSTANCES(out_params)	\
51 	__QDF_IPA_WDI_CAPABILITIES_OUT_PARAMS_NUM_INSTANCES(out_params)
52 
qdf_ipa_wdi_get_capabilities(qdf_ipa_wdi_capabilities_out_params_t * out)53 static inline int qdf_ipa_wdi_get_capabilities(
54 		qdf_ipa_wdi_capabilities_out_params_t *out)
55 {
56 	return __qdf_ipa_wdi_get_capabilities(out);
57 }
58 
59 /**
60  * qdf_ipa_wdi_init_in_params_t - wdi init input parameters
61  */
62 typedef __qdf_ipa_wdi_init_in_params_t qdf_ipa_wdi_init_in_params_t;
63 
64 #define QDF_IPA_WDI_INIT_IN_PARAMS_WDI_VERSION(in_params)	\
65 	__QDF_IPA_WDI_INIT_IN_PARAMS_WDI_VERSION(in_params)
66 #define QDF_IPA_WDI_INIT_IN_PARAMS_NOTIFY(in_params)	\
67 	__QDF_IPA_WDI_INIT_IN_PARAMS_NOTIFY(in_params)
68 #define QDF_IPA_WDI_INIT_IN_PARAMS_PRIV(in_params)	\
69 	__QDF_IPA_WDI_INIT_IN_PARAMS_PRIV(in_params)
70 #define QDF_IPA_WDI_INIT_IN_PARAMS_WDI_NOTIFY(in_params)	\
71 	__QDF_IPA_WDI_INIT_IN_PARAMS_WDI_NOTIFY(in_params)
72 #define QDF_IPA_WDI_INIT_IN_PARAMS_INSTANCE_ID(in_params)	\
73 	__QDF_IPA_WDI_INIT_IN_PARAMS_INSTANCE_ID(in_params)
74 
75 #ifdef IPA_WDS_EASYMESH_FEATURE
76 #define QDF_IPA_WDI_INIT_IN_PARAMS_WDS_UPDATE(in_params)	\
77 	__QDF_IPA_WDI_INIT_IN_PARAMS_WDS_UPDATE(in_params)
78 #endif
79 
80 /**
81  * qdf_ipa_wdi_init_out_params_t - wdi init output parameters
82  */
83 typedef __qdf_ipa_wdi_init_out_params_t qdf_ipa_wdi_init_out_params_t;
84 
85 #define QDF_IPA_WDI_INIT_OUT_PARAMS_IS_UC_READY(out_params)	\
86 	__QDF_IPA_WDI_INIT_OUT_PARAMS_IS_UC_READY(out_params)
87 #define QDF_IPA_WDI_INIT_OUT_PARAMS_IS_SMMU_ENABLED(out_params)	\
88 	__QDF_IPA_WDI_INIT_OUT_PARAMS_IS_SMMU_ENABLED(out_params)
89 #define QDF_IPA_WDI_INIT_OUT_PARAMS_HANDLE(out_params)	\
90 	__QDF_IPA_WDI_INIT_OUT_PARAMS_HANDLE(out_params)
91 #define QDF_IPA_WDI_INIT_OUT_PARAMS_OPT_WIFI_DP(out_params)   \
92 	__QDF_IPA_WDI_INIT_OUT_PARAMS_OPT_WIFI_DP(out_params)
93 
94 /**
95  * qdf_ipa_wdi_pipe_setup_info_smmu_t - WDI TX/Rx configuration
96  */
97 typedef __qdf_ipa_wdi_pipe_setup_info_smmu_t qdf_ipa_wdi_pipe_setup_info_smmu_t;
98 
99 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EP_CFG(txrx)	\
100 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EP_CFG(txrx)
101 
102 #define QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(txrx)	\
103 	__QDF_IPA_WDI_SETUP_INFO_SMMU_CLIENT(txrx)
104 #define QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_BASE(txrx)	\
105 	__QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_BASE(txrx)
106 #define QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_SIZE(txrx)	\
107 	__QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_SIZE(txrx)
108 #define QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(txrx)	\
109 	__QDF_IPA_WDI_SETUP_INFO_SMMU_TRANSFER_RING_DOORBELL_PA(txrx)
110 #define QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(txrx)	\
111 	__QDF_IPA_WDI_SETUP_INFO_SMMU_IS_TXR_RN_DB_PCIE_ADDR(txrx)
112 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(txrx)	\
113 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_BASE(txrx)
114 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_SIZE(txrx)	\
115 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_SIZE(txrx)
116 #define QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(txrx)	\
117 	__QDF_IPA_WDI_SETUP_INFO_SMMU_EVENT_RING_DOORBELL_PA(txrx)
118 #define QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(txrx)	\
119 	__QDF_IPA_WDI_SETUP_INFO_SMMU_IS_EVT_RN_DB_PCIE_ADDR(txrx)
120 #define QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(txrx)	\
121 	__QDF_IPA_WDI_SETUP_INFO_SMMU_NUM_PKT_BUFFERS(txrx)
122 #define QDF_IPA_WDI_SETUP_INFO_SMMU_PKT_OFFSET(txrx)	\
123 	__QDF_IPA_WDI_SETUP_INFO_SMMU_PKT_OFFSET(txrx)
124 #define QDF_IPA_WDI_SETUP_INFO_SMMU_DESC_FORMAT_TEMPLATE(txrx)	\
125 	__QDF_IPA_WDI_SETUP_INFO_SMMU_DESC_FORMAT_TEMPLATE(txrx)
126 #define QDF_IPA_WDI_SETUP_INFO_SMMU_RX_BANK_ID(txrx, bid)	\
127 	__QDF_IPA_WDI_SETUP_INFO_SMMU_RX_BANK_ID(txrx, bid)
128 #define QDF_IPA_WDI_SETUP_INFO_SMMU_RX_PMAC_ID(txrx, pmac_id)	\
129 	__QDF_IPA_WDI_SETUP_INFO_SMMU_RX_PMAC_ID(txrx, pmac_id)
130 
131 typedef __qdf_ipa_ep_cfg_t qdf_ipa_ep_cfg_t;
132 
133 #define QDF_IPA_EP_CFG_NAT_EN(cfg)	\
134 	__QDF_IPA_EP_CFG_NAT_EN(cfg)
135 #define QDF_IPA_EP_CFG_HDR_LEN(cfg)	\
136 	__QDF_IPA_EP_CFG_HDR_LEN(cfg)
137 #define QDF_IPA_EP_CFG_HDR_OFST_METADATA_VALID(cfg)	\
138 	__QDF_IPA_EP_CFG_HDR_OFST_METADATA_VALID(cfg)
139 #define QDF_IPA_EP_CFG_HDR_METADATA_REG_VALID(cfg)	\
140 	__QDF_IPA_EP_CFG_HDR_METADATA_REG_VALID(cfg)
141 #define QDF_IPA_EP_CFG_HDR_OFST_PKT_SIZE_VALID(cfg)	\
142 	__QDF_IPA_EP_CFG_HDR_OFST_PKT_SIZE_VALID(cfg)
143 #define QDF_IPA_EP_CFG_HDR_OFST_PKT_SIZE(cfg)	\
144 	__QDF_IPA_EP_CFG_HDR_OFST_PKT_SIZE(cfg)
145 #define QDF_IPA_EP_CFG_HDR_ADDITIONAL_CONST_LEN(cfg)	\
146 	__QDF_IPA_EP_CFG_HDR_ADDITIONAL_CONST_LEN(cfg)
147 #define QDF_IPA_EP_CFG_MODE(cfg)	\
148 	__QDF_IPA_EP_CFG_MODE(cfg)
149 #define QDF_IPA_EP_CFG_HDR_LITTLE_ENDIAN(cfg)	\
150 	__QDF_IPA_EP_CFG_HDR_LITTLE_ENDIAN(cfg)
151 
152 /**
153  * qdf_ipa_wdi_init - Client should call this function to
154  * init WDI IPA offload data path
155  *
156  * Note: Should not be called from atomic context and only
157  * after checking IPA readiness using ipa_register_ipa_ready_cb()
158  *
159  * @Return 0 on success, negative on failure
160  */
qdf_ipa_wdi_init(qdf_ipa_wdi_init_in_params_t * in,qdf_ipa_wdi_init_out_params_t * out)161 static inline int qdf_ipa_wdi_init(qdf_ipa_wdi_init_in_params_t *in,
162 		 qdf_ipa_wdi_init_out_params_t *out)
163 {
164 	return __qdf_ipa_wdi_init(in, out);
165 }
166 
167 /**
168  * qdf_ipa_wdi_cleanup - Client should call this function to
169  * clean up WDI IPA offload data path
170  * @hdl: IPA handle
171  *
172  * @Return 0 on success, negative on failure
173  */
qdf_ipa_wdi_cleanup(qdf_ipa_wdi_hdl_t hdl)174 static inline int qdf_ipa_wdi_cleanup(qdf_ipa_wdi_hdl_t hdl)
175 {
176 	return __qdf_ipa_wdi_cleanup(hdl);
177 }
178 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
179 
180 /**
181  * qdf_ipa_wdi_hdr_info_t - Header to install on IPA HW
182  */
183 typedef __qdf_ipa_wdi_hdr_info_t qdf_ipa_wdi_hdr_info_t;
184 
185 #define QDF_IPA_WDI_HDR_INFO_HDR(hdr_info)	\
186 	__QDF_IPA_WDI_HDR_INFO_HDR(hdr_info)
187 #define QDF_IPA_WDI_HDR_INFO_HDR_LEN(hdr_info)	\
188 	__QDF_IPA_WDI_HDR_INFO_HDR_LEN(hdr_info)
189 #define QDF_IPA_WDI_HDR_INFO_DST_MAC_ADDR_OFFSET(hdr_info)	\
190 	__QDF_IPA_WDI_HDR_INFO_DST_MAC_ADDR_OFFSET(hdr_info)
191 #define QDF_IPA_WDI_HDR_INFO_HDR_TYPE(hdr_info)	\
192 	__QDF_IPA_WDI_HDR_INFO_HDR_TYPE(hdr_info)
193 
194 /**
195  * qdf_ipa_wdi_reg_intf_in_params_t - parameters for uC offload
196  *	interface registration
197  */
198 typedef __qdf_ipa_wdi_reg_intf_in_params_t qdf_ipa_wdi_reg_intf_in_params_t;
199 
200 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_NETDEV_NAME(in)	\
201 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_NETDEV_NAME(in)
202 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_HDR_INFO(in)	\
203 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_HDR_INFO(in)
204 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_ALT_DST_PIPE(in)	\
205 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_ALT_DST_PIPE(in)
206 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_META_DATA_VALID(in)	\
207 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_META_DATA_VALID(in)
208 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_META_DATA(in)	\
209 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_META_DATA(in)
210 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_META_DATA_MASK(in)	\
211 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_META_DATA_MASK(in)
212 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_HANDLE(in)	\
213 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_HANDLE(in)
214 #ifdef IPA_WDI3_TX_TWO_PIPES
215 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_TX1_USED(in)	\
216 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_TX1_USED(in)
217 #endif
218 #ifdef IPA_WDI3_VLAN_SUPPORT
219 #define QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_RX1_USED(in)	\
220 	__QDF_IPA_WDI_REG_INTF_IN_PARAMS_IS_RX1_USED(in)
221 #endif
222 
223 /**
224  * qdf_ipa_wdi_pipe_setup_info_t - WDI TX/Rx configuration
225  */
226 typedef __qdf_ipa_wdi_pipe_setup_info_t qdf_ipa_wdi_pipe_setup_info_t;
227 
228 #define QDF_IPA_WDI_SETUP_INFO_EP_CFG(txrx)	\
229 	__QDF_IPA_WDI_SETUP_INFO_EP_CFG(txrx)
230 
231 #define QDF_IPA_WDI_SETUP_INFO_NAT_EN(txrx)	\
232 	__QDF_IPA_WDI_SETUP_INFO_NAT_EN(txrx)
233 #define QDF_IPA_WDI_SETUP_INFO_HDR_LEN(txrx)	\
234 	__QDF_IPA_WDI_SETUP_INFO_HDR_LEN(txrx)
235 #define QDF_IPA_WDI_SETUP_INFO_HDR_OFST_METADATA_VALID(txrx)	\
236 	__QDF_IPA_WDI_SETUP_INFO_HDR_OFST_METADATA_VALID(txrx)
237 #define QDF_IPA_WDI_SETUP_INFO_HDR_METADATA_REG_VALID(txrx)	\
238 	__QDF_IPA_WDI_SETUP_INFO_HDR_METADATA_REG_VALID(txrx)
239 #define QDF_IPA_WDI_SETUP_INFO_HDR_OFST_PKT_SIZE_VALID(txrx)	\
240 	__QDF_IPA_WDI_SETUP_INFO_HDR_OFST_PKT_SIZE_VALID(txrx)
241 #define QDF_IPA_WDI_SETUP_INFO_HDR_OFST_PKT_SIZE(txrx)	\
242 	__QDF_IPA_WDI_SETUP_INFO_HDR_OFST_PKT_SIZE(txrx)
243 #define QDF_IPA_WDI_SETUP_INFO_HDR_ADDITIONAL_CONST_LEN(txrx)	\
244 	__QDF_IPA_WDI_SETUP_INFO_HDR_ADDITIONAL_CONST_LEN(txrx)
245 #define QDF_IPA_WDI_SETUP_INFO_MODE(txrx)	\
246 	__QDF_IPA_WDI_SETUP_INFO_MODE(txrx)
247 #define QDF_IPA_WDI_SETUP_INFO_HDR_LITTLE_ENDIAN(txrx)	\
248 	__QDF_IPA_WDI_SETUP_INFO_HDR_LITTLE_ENDIAN(txrx)
249 
250 #define QDF_IPA_WDI_SETUP_INFO_CLIENT(txrx)	\
251 	__QDF_IPA_WDI_SETUP_INFO_CLIENT(txrx)
252 #define QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_BASE_PA(txrx)	\
253 	__QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_BASE_PA(txrx)
254 #define QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_SIZE(txrx)	\
255 	__QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_SIZE(txrx)
256 #define QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx)	\
257 	__QDF_IPA_WDI_SETUP_INFO_TRANSFER_RING_DOORBELL_PA(txrx)
258 #define QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(txrx)	\
259 	__QDF_IPA_WDI_SETUP_INFO_IS_TXR_RN_DB_PCIE_ADDR(txrx)
260 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(txrx)	\
261 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_BASE_PA(txrx)
262 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_SIZE(txrx)	\
263 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_SIZE(txrx)
264 #define QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx)	\
265 	__QDF_IPA_WDI_SETUP_INFO_EVENT_RING_DOORBELL_PA(txrx)
266 #define QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(txrx)	\
267 	__QDF_IPA_WDI_SETUP_INFO_IS_EVT_RN_DB_PCIE_ADDR(txrx)
268 #define QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(txrx)	\
269 	__QDF_IPA_WDI_SETUP_INFO_NUM_PKT_BUFFERS(txrx)
270 #define QDF_IPA_WDI_SETUP_INFO_PKT_OFFSET(txrx)	\
271 	__QDF_IPA_WDI_SETUP_INFO_PKT_OFFSET(txrx)
272 #define QDF_IPA_WDI_SETUP_INFO_DESC_FORMAT_TEMPLATE(txrx)	\
273 	__QDF_IPA_WDI_SETUP_INFO_DESC_FORMAT_TEMPLATE(txrx)
274 #define QDF_IPA_WDI_SETUP_INFO_RX_BANK_ID(txrx, bid)	\
275 	__QDF_IPA_WDI_SETUP_INFO_RX_BANK_ID(txrx, bid)
276 #define QDF_IPA_WDI_SETUP_INFO_RX_PMAC_ID(txrx, pmac_id)	\
277 	__QDF_IPA_WDI_SETUP_INFO_RX_PMAC_ID(txrx, pmac_id)
278 
279 /**
280  * qdf_ipa_wdi_conn_in_params_t - information provided by
281  *		uC offload client
282  */
283 typedef __qdf_ipa_wdi_conn_in_params_t qdf_ipa_wdi_conn_in_params_t;
284 
285 #define QDF_IPA_WDI_CONN_IN_PARAMS_NOTIFY(pipe_in)	\
286 	__QDF_IPA_WDI_CONN_IN_PARAMS_NOTIFY(pipe_in)
287 #define QDF_IPA_WDI_CONN_IN_PARAMS_PRIV(pipe_in)	\
288 	__QDF_IPA_WDI_CONN_IN_PARAMS_PRIV(pipe_in)
289 #define QDF_IPA_WDI_CONN_IN_PARAMS_SMMU_ENABLED(pipe_in)	\
290 	__QDF_IPA_WDI_CONN_IN_PARAMS_SMMU_ENABLED(pipe_in)
291 #define QDF_IPA_WDI_CONN_IN_PARAMS_NUM_SYS_PIPE_NEEDED(pipe_in)	\
292 	__QDF_IPA_WDI_CONN_IN_PARAMS_NUM_SYS_PIPE_NEEDED(pipe_in)
293 #define QDF_IPA_WDI_CONN_IN_PARAMS_SYS_IN(in)	\
294 	__QDF_IPA_WDI_CONN_IN_PARAMS_SYS_IN(in)
295 #define QDF_IPA_WDI_CONN_IN_PARAMS_TX(pipe_in)	\
296 	__QDF_IPA_WDI_CONN_IN_PARAMS_TX(pipe_in)
297 #define QDF_IPA_WDI_CONN_IN_PARAMS_TX_SMMU(pipe_in)	\
298 	__QDF_IPA_WDI_CONN_IN_PARAMS_TX_SMMU(pipe_in)
299 #define QDF_IPA_WDI_CONN_IN_PARAMS_RX(pipe_in)	\
300 	__QDF_IPA_WDI_CONN_IN_PARAMS_RX(pipe_in)
301 #define QDF_IPA_WDI_CONN_IN_PARAMS_RX_SMMU(pipe_in)	\
302 	__QDF_IPA_WDI_CONN_IN_PARAMS_RX_SMMU(pipe_in)
303 #define QDF_IPA_WDI_CONN_IN_PARAMS_HANDLE(pipe_in)	\
304 	__QDF_IPA_WDI_CONN_IN_PARAMS_HANDLE(pipe_in)
305 
306 #ifdef IPA_WDS_EASYMESH_FEATURE
307 #define QDF_IPA_WDI_CONN_IN_PARAMS_AST_NOTIFY(pipe_in)	\
308 	__QDF_IPA_WDI_CONN_IN_PARAMS_AST_NOTIFY(pipe_in)
309 #endif
310 
311 #ifdef IPA_WDI3_TX_TWO_PIPES
312 #define QDF_IPA_WDI_CONN_IN_PARAMS_IS_TX1_USED(pipe_in)	\
313 	__QDF_IPA_WDI_CONN_IN_PARAMS_IS_TX1_USED(pipe_in)
314 #define QDF_IPA_WDI_CONN_IN_PARAMS_TX_ALT_PIPE(pipe_in)	\
315 	__QDF_IPA_WDI_CONN_IN_PARAMS_TX_ALT_PIPE(pipe_in)
316 #define QDF_IPA_WDI_CONN_IN_PARAMS_TX_ALT_PIPE_SMMU(pipe_in)	\
317 	__QDF_IPA_WDI_CONN_IN_PARAMS_TX_ALT_PIPE_SMMU(pipe_in)
318 #define QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_ALT_DB_PA(pipe_out)	\
319 	__QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_ALT_DB_PA(pipe_out)
320 #endif
321 #ifdef IPA_WDI3_VLAN_SUPPORT
322 #define QDF_IPA_WDI_CONN_IN_PARAMS_IS_RX1_USED(pipe_in)	\
323 	__QDF_IPA_WDI_CONN_IN_PARAMS_IS_RX1_USED(pipe_in)
324 #define QDF_IPA_WDI_CONN_IN_PARAMS_RX_ALT(pipe_in)	\
325 	__QDF_IPA_WDI_CONN_IN_PARAMS_RX_ALT(pipe_in)
326 #define QDF_IPA_WDI_CONN_IN_PARAMS_RX_ALT_SMMU(pipe_in)	\
327 	__QDF_IPA_WDI_CONN_IN_PARAMS_RX_ALT_SMMU(pipe_in)
328 #endif
329 /**
330  * qdf_ipa_wdi_conn_out_params_t - information provided
331  *				to WLAN druver
332  */
333 typedef __qdf_ipa_wdi_conn_out_params_t qdf_ipa_wdi_conn_out_params_t;
334 
335 #define QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_DB_PA(pipe_out)	\
336 	__QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_DB_PA(pipe_out)
337 #define QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_DB_VA(pipe_out)	\
338 	__QDF_IPA_WDI_CONN_OUT_PARAMS_TX_UC_DB_VA(pipe_out)
339 #define QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out)	\
340 	__QDF_IPA_WDI_CONN_OUT_PARAMS_RX_UC_DB_PA(pipe_out)
341 #ifdef IPA_WDI3_VLAN_SUPPORT
342 #define QDF_IPA_WDI_CONN_OUT_PARAMS_RX_ALT_UC_DB_PA(pipe_out)	\
343 	__QDF_IPA_WDI_CONN_OUT_PARAMS_RX_ALT_UC_DB_PA(pipe_out)
344 #endif
345 #define QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out)	\
346 	__QDF_IPA_WDI_CONN_OUT_PARAMS_IS_DB_DDR_MAPPED(pipe_out)
347 
348 /**
349  * qdf_ipa_wdi_perf_profile_t - To set BandWidth profile
350  */
351 typedef __qdf_ipa_wdi_perf_profile_t qdf_ipa_wdi_perf_profile_t;
352 
353 #define QDF_IPA_WDI_PERF_PROFILE_CLIENT(profile)	\
354 	__QDF_IPA_WDI_PERF_PROFILE_CLIENT(profile)
355 #define QDF_IPA_WDI_PERF_PROFILE_MAX_SUPPORTED_BW_MBPS(profile)	\
356 	__QDF_IPA_WDI_PERF_PROFILE_MAX_SUPPORTED_BW_MBPS(profile)
357 
358 /**
359  * qdf_ipa_wdi_reg_intf - Client should call this function to
360  * init WDI IPA offload data path
361  *
362  * Note: Should not be called from atomic context and only
363  * after checking IPA readiness using ipa_register_ipa_ready_cb()
364  *
365  * @Return 0 on success, negative on failure
366  */
qdf_ipa_wdi_reg_intf(qdf_ipa_wdi_reg_intf_in_params_t * in)367 static inline int qdf_ipa_wdi_reg_intf(
368 	qdf_ipa_wdi_reg_intf_in_params_t *in)
369 {
370 	return __qdf_ipa_wdi_reg_intf(in);
371 }
372 
373 /**
374  * qdf_ipa_wdi_dereg_intf - Client Driver should call this
375  * function to deregister before unload and after disconnect
376  * @netdev_name: Net device name
377  * @hdl: IPA handle
378  *
379  * @Return 0 on success, negative on failure
380  */
qdf_ipa_wdi_dereg_intf(const char * netdev_name,qdf_ipa_wdi_hdl_t hdl)381 static inline int qdf_ipa_wdi_dereg_intf(const char *netdev_name,
382 					 qdf_ipa_wdi_hdl_t hdl)
383 {
384 	return __qdf_ipa_wdi_dereg_intf(netdev_name, hdl);
385 }
386 
387 /**
388  * qdf_ipa_wdi_conn_pipes - Client should call this
389  * function to connect pipes
390  * @in:	[in] input parameters from client
391  * @out: [out] output params to client
392  *
393  * Note: Should not be called from atomic context and only
394  * after checking IPA readiness using ipa_register_ipa_ready_cb()
395  *
396  * @Return 0 on success, negative on failure
397  */
qdf_ipa_wdi_conn_pipes(qdf_ipa_wdi_conn_in_params_t * in,qdf_ipa_wdi_conn_out_params_t * out)398 static inline int qdf_ipa_wdi_conn_pipes(qdf_ipa_wdi_conn_in_params_t *in,
399 			qdf_ipa_wdi_conn_out_params_t *out)
400 {
401 	return __qdf_ipa_wdi_conn_pipes(in, out);
402 }
403 
404 /**
405  * qdf_ipa_wdi_disconn_pipes() - Client should call this
406  *		function to disconnect pipes
407  * @hdl: IPA handle
408  *
409  * Note: Should not be called from atomic context
410  *
411  * Returns: 0 on success, negative on failure
412  */
qdf_ipa_wdi_disconn_pipes(qdf_ipa_wdi_hdl_t hdl)413 static inline int qdf_ipa_wdi_disconn_pipes(qdf_ipa_wdi_hdl_t hdl)
414 {
415 	return __qdf_ipa_wdi_disconn_pipes(hdl);
416 }
417 
418 /**
419  * qdf_ipa_wdi_enable_pipes() - Client should call this
420  *		function to enable IPA offload data path
421  * @hdl: IPA handle
422  *
423  * Note: Should not be called from atomic context
424  *
425  * Returns: 0 on success, negative on failure
426  */
qdf_ipa_wdi_enable_pipes(qdf_ipa_wdi_hdl_t hdl)427 static inline int qdf_ipa_wdi_enable_pipes(qdf_ipa_wdi_hdl_t hdl)
428 {
429 	return __qdf_ipa_wdi_enable_pipes(hdl);
430 }
431 
432 /**
433  * qdf_ipa_wdi_disable_pipes() - Client should call this
434  *		function to disable IPA offload data path
435  * @hdl: IPA handle
436  *
437  * Note: Should not be called from atomic context
438  *
439  * Returns: 0 on success, negative on failure
440  */
qdf_ipa_wdi_disable_pipes(qdf_ipa_wdi_hdl_t hdl)441 static inline int qdf_ipa_wdi_disable_pipes(qdf_ipa_wdi_hdl_t hdl)
442 {
443 	return __qdf_ipa_wdi_disable_pipes(hdl);
444 }
445 
446 /**
447  * qdf_ipa_wdi_set_perf_profile() - Client should call this function to
448  *		set IPA clock bandwidth based on data rates
449  * @hdl: IPA handle
450  * @profile: [in] BandWidth profile to use
451  *
452  * Returns: 0 on success, negative on failure
453  */
qdf_ipa_wdi_set_perf_profile(qdf_ipa_wdi_hdl_t hdl,qdf_ipa_wdi_perf_profile_t * profile)454 static inline int qdf_ipa_wdi_set_perf_profile(qdf_ipa_wdi_hdl_t hdl,
455 					       qdf_ipa_wdi_perf_profile_t *profile)
456 {
457 	return __qdf_ipa_wdi_set_perf_profile(hdl, profile);
458 }
459 
460 /**
461  * qdf_ipa_wdi_create_smmu_mapping() - Client should call this function to
462  *		create smmu mapping
463  * @hdl: IPA handle
464  * @num_buffers: [in] number of buffers
465  * @info: [in] wdi buffer info
466  *
467  * Returns: 0 on success, negative on failure
468  */
qdf_ipa_wdi_create_smmu_mapping(qdf_ipa_wdi_hdl_t hdl,uint32_t num_buffers,qdf_ipa_wdi_buffer_info_t * info)469 static inline int qdf_ipa_wdi_create_smmu_mapping(qdf_ipa_wdi_hdl_t hdl,
470 						  uint32_t num_buffers,
471 						  qdf_ipa_wdi_buffer_info_t *info)
472 {
473 	return __qdf_ipa_wdi_create_smmu_mapping(hdl, num_buffers, info);
474 }
475 
476 /**
477  * qdf_ipa_wdi_release_smmu_mapping() - Client should call this function to
478  *		release smmu mapping
479  * @hdl: IPA handle
480  * @num_buffers: [in] number of buffers
481  * @info: [in] wdi buffer info
482  *
483  * Returns: 0 on success, negative on failure
484  */
qdf_ipa_wdi_release_smmu_mapping(qdf_ipa_wdi_hdl_t hdl,uint32_t num_buffers,qdf_ipa_wdi_buffer_info_t * info)485 static inline int qdf_ipa_wdi_release_smmu_mapping(qdf_ipa_wdi_hdl_t hdl,
486 						   uint32_t num_buffers,
487 						   qdf_ipa_wdi_buffer_info_t *info)
488 {
489 	return __qdf_ipa_wdi_release_smmu_mapping(hdl, num_buffers, info);
490 }
491 
492 #ifdef WDI3_STATS_UPDATE
493 /**
494  * qdf_ipa_wdi_wlan_stats() - Client should call this function to
495  *		send Tx byte counts to IPA driver
496  * @tx_count: number of Tx bytes
497  *
498  * Returns: 0 on success, negative on failure
499  */
qdf_ipa_wdi_wlan_stats(qdf_ipa_wdi_tx_info_t * tx_stats)500 static inline int qdf_ipa_wdi_wlan_stats(qdf_ipa_wdi_tx_info_t *tx_stats)
501 {
502 	return __qdf_ipa_wdi_wlan_stats(tx_stats);
503 }
504 
505 /**
506  * qdf_ipa_uc_bw_monitor() - start/stop uc bw monitoring
507  * @bw_info: set bw info levels to monitor
508  *
509  * Returns: 0 on success, negative on failure
510  */
qdf_ipa_uc_bw_monitor(qdf_ipa_wdi_bw_info_t * bw_info)511 static inline int qdf_ipa_uc_bw_monitor(qdf_ipa_wdi_bw_info_t *bw_info)
512 {
513 	return __qdf_ipa_uc_bw_monitor(bw_info);
514 }
515 
516 #endif
517 
518 #ifdef IPA_OPT_WIFI_DP
519 /**
520  * qdf_ipa_wdi_register_flt_cb() - register cb functions with IPA
521  * for optional wifi datapath
522  * @hdl: ipa hdl
523  * @flt_rsrv_cb: cb for filter reservation
524  * @flt_rsrv_rel_cb: cb for filter release
525  * @flt_add_cb: cb for filter addition
526  * @flt_rem_cb: cb for filter removal
527  *
528  * Return: 0 on success, negative on failure
529  */
qdf_ipa_wdi_register_flt_cb(ipa_wdi_hdl_t hdl,ipa_wdi_opt_dpath_flt_rsrv_cb flt_rsrv_cb,ipa_wdi_opt_dpath_flt_rsrv_rel_cb flt_rsrv_rel_cb,ipa_wdi_opt_dpath_flt_add_cb flt_add_cb,ipa_wdi_opt_dpath_flt_rem_cb flt_rem_cb)530 static inline int qdf_ipa_wdi_register_flt_cb(
531 			ipa_wdi_hdl_t hdl,
532 			ipa_wdi_opt_dpath_flt_rsrv_cb flt_rsrv_cb,
533 			ipa_wdi_opt_dpath_flt_rsrv_rel_cb flt_rsrv_rel_cb,
534 			ipa_wdi_opt_dpath_flt_add_cb flt_add_cb,
535 			ipa_wdi_opt_dpath_flt_rem_cb flt_rem_cb)
536 {
537 	return __qdf_ipa_wdi_register_flt_cb((__qdf_ipa_wdi_hdl_t)hdl,
538 					     flt_rsrv_cb, flt_rsrv_rel_cb,
539 					     flt_add_cb, flt_rem_cb);
540 }
541 
542 /**
543  * ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst() - notify IPA with filter
544  * reserve response for optional wifi datapath
545  * @hdl: ipa hdl
546  * @is_succes: true for success, false or failure
547  *
548  * Return: 0 on success, negative on failure
549  */
qdf_ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst(ipa_wdi_hdl_t hdl,bool is_success)550 static inline int qdf_ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst(
551 					    ipa_wdi_hdl_t hdl, bool is_success)
552 {
553 	return __qdf_ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst(hdl,
554 								is_success);
555 }
556 
557 /**
558  * qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst() - notify IPA with filter
559  * release response for optional wifi datapath
560  * @hdl: ipa hdl
561  * @is_succes: true for success, false or failure
562  *
563  * Return: 0 on success, negative on failure
564  */
qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst(ipa_wdi_hdl_t hdl,bool is_success)565 static inline int qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst(
566 				ipa_wdi_hdl_t hdl, bool is_success)
567 {
568 	return __qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst(hdl,
569 								is_success);
570 }
571 
572 #else
qdf_ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst(ipa_wdi_hdl_t hdl,bool is_success)573 static inline int qdf_ipa_wdi_opt_dpath_notify_flt_rsvd_per_inst(
574 				ipa_wdi_hdl_t hdl, bool is_success)
575 {
576 	return 0;
577 }
578 
qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst(ipa_wdi_hdl_t hdl,bool is_success)579 static inline int qdf_ipa_wdi_opt_dpath_notify_flt_rlsd_per_inst(
580 				ipa_wdi_hdl_t hdl, bool is_success)
581 {
582 	return 0;
583 }
584 #endif /* IPA_OPT_WIFI_DP  */
585 #endif /* IPA_OFFLOAD */
586 #endif /* QDF_IPA_WDI3_H */
587