1 /*
2  * Copyright (c) 2017-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 #ifndef _I_QDF_IPA_H
19 #define _I_QDF_IPA_H
20 
21 #ifdef IPA_OFFLOAD
22 
23 #include <linux/ipa.h>
24 #include <linux/version.h>
25 
26 /**
27  * __qdf_ipa_wdi_meter_evt_type_t - type of event client callback is
28  * for AP+STA mode metering
29  * @IPA_GET_WDI_SAP_STATS: get IPA_stats between SAP and STA -
30  *			use ipa_get_wdi_sap_stats structure
31  * @IPA_SET_WIFI_QUOTA: set quota limit on STA -
32  *			use ipa_set_wifi_quota structure
33  */
34 typedef enum ipa_wdi_meter_evt_type __qdf_ipa_wdi_meter_evt_type_t;
35 
36 typedef struct ipa_get_wdi_sap_stats __qdf_ipa_get_wdi_sap_stats_t;
37 
38 #define QDF_IPA_GET_WDI_SAP_STATS_RESET_STATS(wdi_sap_stats)	\
39 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->reset_stats)
40 #define QDF_IPA_GET_WDI_SAP_STATS_STATS_VALID(wdi_sap_stats)	\
41 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->stats_valid)
42 #define QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_PACKETS(wdi_sap_stats)	\
43 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_tx_packets)
44 #define QDF_IPA_GET_WDI_SAP_STATS_IPV4_TX_BYTES(wdi_sap_stats)	\
45 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_tx_bytes)
46 #define QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_PACKETS(wdi_sap_stats)	\
47 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_rx_packets)
48 #define QDF_IPA_GET_WDI_SAP_STATS_IPV4_RX_BYTES(wdi_sap_stats)	\
49 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv4_rx_bytes)
50 #define QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_PACKETS(wdi_sap_stats)	\
51 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_tx_packets)
52 #define QDF_IPA_GET_WDI_SAP_STATS_IPV6_TX_BYTES(wdi_sap_stats)	\
53 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_tx_bytes)
54 #define QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_PACKETS(wdi_sap_stats)	\
55 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_rx_packets)
56 #define QDF_IPA_GET_WDI_SAP_STATS_IPV6_RX_BYTES(wdi_sap_stats)	\
57 	(((struct ipa_get_wdi_sap_stats *)(wdi_sap_stats))->ipv6_rx_bytes)
58 
59 /**
60  * __qdf_ipa_set_wifi_quota_t - structure used for
61  *                                   IPA_SET_WIFI_QUOTA.
62  */
63 typedef struct ipa_set_wifi_quota __qdf_ipa_set_wifi_quota_t;
64 
65 #define QDF_IPA_SET_WIFI_QUOTA_BYTES(ipa_set_quota)	\
66 	(((struct ipa_set_wifi_quota *)(ipa_set_quota))->quota_bytes)
67 #define QDF_IPA_SET_WIFI_QUOTA_SET_QUOTA(ipa_set_quota)	\
68 	(((struct ipa_set_wifi_quota *)(ipa_set_quota))->set_quota)
69 #define QDF_IPA_SET_WIFI_QUOTA_SET_VALID(ipa_set_quota)	\
70 	(((struct ipa_set_wifi_quota *)(ipa_set_quota))->set_valid)
71 
72 /**
73  * __qdf_ipa_connect_params_t - low-level client connect input parameters. Either
74  * client allocates the data and desc FIFO and specifies that in data+desc OR
75  * specifies sizes and pipe_mem pref and IPA does the allocation.
76  */
77 typedef struct ipa_connect_params __qdf_ipa_connect_params_t;
78 
79 /**
80  * __qdf_ipa_tx_meta_t - meta-data for the TX packet
81  */
82 typedef struct ipa_tx_meta __qdf_ipa_tx_meta_t;
83 
84 /**
85  * __qdf_ipa_msg_free_fn_t - callback function
86  *
87  * Message callback registered by kernel client with IPA driver to
88  * free message payload after IPA driver processing is complete
89  */
90 typedef void (*__qdf_ipa_msg_free_fn_t)(void *buff, u32 len, u32 type);
91 
92 /**
93  *  __qdf_ipa_sps_params_t - SPS related output parameters resulting from
94  */
95 typedef struct ipa_sps_params __qdf_ipa_sps_params_t;
96 
97 /**
98  * __qdf_ipa_tx_intf_t - interface tx properties
99  */
100 typedef struct ipa_tx_intf __qdf_ipa_tx_intf_t;
101 
102 #define QDF_IPA_TX_INTF_PROP(tx_intf)	\
103 	(((struct ipa_tx_intf *)(tx_intf))->prop)
104 
105 /**
106  * __qdf_ipa_rx_intf_t - interface rx properties
107  */
108 typedef struct ipa_rx_intf __qdf_ipa_rx_intf_t;
109 
110 #define QDF_IPA_RX_INTF_PROP(rx_intf)	\
111 	(((struct ipa_rx_intf *)(rx_intf))->prop)
112 
113 /**
114  * __qdf_ipa_ext_intf_t - interface ext properties
115  */
116 typedef struct ipa_ext_intf __qdf_ipa_ext_intf_t;
117 
118 /**
119  * __qdf_ipa_sys_connect_params_t - information needed to setup an IPA end-point
120  * in system-BAM mode
121  */
122 typedef struct ipa_sys_connect_params __qdf_ipa_sys_connect_params_t;
123 
124 #define QDF_IPA_SYS_PARAMS_NAT_EN(ipa_sys_params)	\
125 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.nat.nat_en)
126 #define QDF_IPA_SYS_PARAMS_HDR_LEN(ipa_sys_params)	\
127 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_len)
128 #define QDF_IPA_SYS_PARAMS_HDR_ADDITIONAL_CONST_LEN(ipa_sys_params)	\
129 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_additional_const_len)
130 #define QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE_VALID(ipa_sys_params)	\
131 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid)
132 #define QDF_IPA_SYS_PARAMS_HDR_OFST_PKT_SIZE(ipa_sys_params)	\
133 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr.hdr_ofst_pkt_size)
134 #define QDF_IPA_SYS_PARAMS_HDR_LITTLE_ENDIAN(ipa_sys_params)	\
135 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.hdr_ext.hdr_little_endian)
136 #define QDF_IPA_SYS_PARAMS_MODE(ipa_sys_params)	\
137 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->ipa_ep_cfg.mode.mode)
138 #define QDF_IPA_SYS_PARAMS_CLIENT(ipa_sys_params)	\
139 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->client)
140 #define QDF_IPA_SYS_PARAMS_DESC_FIFO_SZ(ipa_sys_params)	\
141 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->desc_fifo_sz)
142 #define QDF_IPA_SYS_PARAMS_PRIV(ipa_sys_params)	\
143 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->priv)
144 #define QDF_IPA_SYS_PARAMS_NOTIFY(ipa_sys_params)	\
145 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->notify)
146 #define QDF_IPA_SYS_PARAMS_SKIP_EP_CFG(ipa_sys_params)	\
147 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->skip_ep_cfg)
148 #define QDF_IPA_SYS_PARAMS_KEEP_IPA_AWAKE(ipa_sys_params)	\
149 	(((struct ipa_sys_connect_params *)(ipa_sys_params))->keep_ipa_awake)
150 
151 /**
152  * __qdf_pa_rm_event_t - IPA RM events
153  *
154  * Indicate the resource state change
155  */
156 typedef enum ipa_rm_event __qdf_ipa_rm_event_t;
157 
158 /**
159  * struct __qdf_ipa_rm_register_params_t - information needed to
160  *      register IPA RM client with IPA RM
161  */
162 typedef struct ipa_rm_register_params __qdf_ipa_rm_register_params_t;
163 
164 /**
165  * struct __qdf_ipa_rm_create_params_t - information needed to initialize
166  *				the resource
167  *
168  * IPA RM client is expected to perform non blocking operations only
169  * in request_resource and release_resource functions and
170  * release notification context as soon as possible.
171  */
172 typedef struct ipa_rm_create_params __qdf_ipa_rm_create_params_t;
173 
174 #define QDF_IPA_RM_CREATE_PARAMS_NAME(create_params)	\
175 	(((struct ipa_rm_create_params *)(create_params))->name)
176 #define QDF_IPA_RM_CREATE_PARAMS_USER_DATA(create_params)	\
177 	(((struct ipa_rm_create_params *)(create_params))->reg_params.user_data)
178 #define QDF_IPA_RM_CREATE_PARAMS_NOTIFY_CB(create_params)	\
179 	(((struct ipa_rm_create_params *)(create_params))->reg_params.notify_cb)
180 #define QDF_IPA_RM_CREATE_PARAMS_REQUEST_RESOURCE(create_params)	\
181 	(((struct ipa_rm_create_params *)(create_params))->request_resource)
182 #define QDF_IPA_RM_CREATE_PARAMS_RELEASE_RESOURCE(create_params)	\
183 	(((struct ipa_rm_create_params *)(create_params))->release_resource)
184 #define QDF_IPA_RM_CREATE_PARAMS_FLOOR_VOLTAGE(create_params)	\
185 	(((struct ipa_rm_create_params *)(create_params))->floor_voltage)
186 
187 /**
188  * __qdf_ipa_rm_perf_profile_t - information regarding IPA RM client performance
189  * profile
190  */
191 typedef struct ipa_rm_perf_profile __qdf_ipa_rm_perf_profile_t;
192 
193 #define QDF_IPA_RM_PERF_PROFILE_MAX_SUPPORTED_BANDWIDTH_MBPS(profile)	\
194 	(((struct ipa_rm_perf_profile *)(profile))->max_supported_bandwidth_mbps)
195 
196 /**
197  * __qdf_ipa_tx_data_desc_t - information needed
198  * to send data packet to HW link: link to data descriptors
199  * priv: client specific private data
200  */
201 typedef struct ipa_tx_data_desc __qdf_ipa_tx_data_desc_t;
202 
203 /**
204  * __qdf_ipa_rx_data_t - information needed
205  * to send to wlan driver on receiving data from ipa hw
206  */
207 typedef struct ipa_rx_data __qdf_ipa_rx_data_t;
208 
209 #define QDF_IPA_RX_DATA_SKB(desc)	\
210 	(((struct ipa_rx_data *)(desc))->skb)
211 #define QDF_IPA_RX_DATA_SKB_LEN(desc)	\
212 	(((struct ipa_rx_data *)(desc))->skb->len)
213 #define QDF_IPA_RX_DATA_DMA_ADDR(desc)	\
214 	(((struct ipa_rx_data *)(desc))->dma_addr)
215 
216 /**
217  * __qdf_ipa_wdi_ul_params_t - WDI_RX configuration
218  */
219 typedef struct ipa_wdi_ul_params __qdf_ipa_wdi_ul_params_t;
220 
221 /**
222  * __qdf_ipa_wdi_ul_params_smmu_t - WDI_RX configuration (with WLAN SMMU)
223  */
224 typedef struct ipa_wdi_ul_params_smmu __qdf_ipa_wdi_ul_params_smmu_t;
225 
226 /**
227  * __qdf_ipa_wdi_dl_params_t - WDI_TX configuration
228  */
229 typedef struct ipa_wdi_dl_params __qdf_ipa_wdi_dl_params_t;
230 
231 /**
232  * __qdf_ipa_wdi_dl_params_smmu_t - WDI_TX configuration (with WLAN SMMU)
233  */
234 typedef struct ipa_wdi_dl_params_smmu __qdf_ipa_wdi_dl_params_smmu_t;
235 
236 /**
237  * __qdf_ipa_wdi_in_params_t - information provided by WDI client
238  */
239 typedef struct ipa_wdi_in_params __qdf_ipa_wdi_in_params_t;
240 
241 #define QDF_IPA_PIPE_IN_NAT_EN(pipe_in)	\
242 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.nat.nat_en)
243 #define QDF_IPA_PIPE_IN_HDR_LEN(pipe_in)	\
244 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_len)
245 #define QDF_IPA_PIPE_IN_HDR_OFST_METADATA_VALID(pipe_in)	\
246 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_metadata_valid)
247 #define QDF_IPA_PIPE_IN_HDR_METADATA_REG_VALID(pipe_in)	\
248 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_metadata_reg_valid)
249 #define QDF_IPA_PIPE_IN_HDR_OFST_PKT_SIZE_VALID(pipe_in)	\
250 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_pkt_size_valid)
251 #define QDF_IPA_PIPE_IN_HDR_OFST_PKT_SIZE(pipe_in)	\
252 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_ofst_pkt_size)
253 #define QDF_IPA_PIPE_IN_HDR_ADDITIONAL_CONST_LEN(pipe_in)	\
254 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr.hdr_additional_const_len)
255 #define QDF_IPA_PIPE_IN_MODE(pipe_in)	\
256 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.mode.mode)
257 #define QDF_IPA_PIPE_IN_CLIENT(pipe_in)	\
258 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.client)
259 #define QDF_IPA_PIPE_IN_DESC_FIFO_SZ(pipe_in)	\
260 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.desc_fifo_sz)
261 #define QDF_IPA_PIPE_IN_PRIV(pipe_in)	\
262 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.priv)
263 #define QDF_IPA_PIPE_IN_HDR_LITTLE_ENDIAN(pipe_in)	\
264 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.ipa_ep_cfg.hdr_ext.hdr_little_endian)
265 #define QDF_IPA_PIPE_IN_NOTIFY(pipe_in)	\
266 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.notify)
267 #define QDF_IPA_PIPE_IN_KEEP_IPA_AWAKE(pipe_in)	\
268 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.keep_ipa_awake)
269 #define QDF_IPA_PIPE_IN_KEEP_IPA_AWAKE(pipe_in)	\
270 	(((struct ipa_wdi_in_params *)(pipe_in))->sys.keep_ipa_awake)
271 #ifdef FEATURE_METERING
272 #define QDF_IPA_PIPE_IN_WDI_NOTIFY(pipe_in)	\
273 	(((struct ipa_wdi_in_params *)(pipe_in))->wdi_notify)
274 #endif
275 
276 #ifdef ENABLE_SMMU_S1_TRANSLATION
277 #define QDF_IPA_PIPE_IN_SMMU_ENABLED(pipe_in)	\
278 	(((struct ipa_wdi_in_params *)(pipe_in))->smmu_enabled)
279 
280 #define QDF_IPA_PIPE_IN_DL_SMMU_COMP_RING(pipe_in)	\
281 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.comp_ring)
282 #define QDF_IPA_PIPE_IN_DL_SMMU_CE_RING(pipe_in)	\
283 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_ring)
284 #define QDF_IPA_PIPE_IN_DL_SMMU_COMP_RING_SIZE(pipe_in)	\
285 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.comp_ring_size)
286 #define QDF_IPA_PIPE_IN_DL_SMMU_CE_RING_SIZE(pipe_in)	\
287 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_ring_size)
288 #define QDF_IPA_PIPE_IN_DL_SMMU_CE_DOOR_BELL_PA(pipe_in)	\
289 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.ce_door_bell_pa)
290 #define QDF_IPA_PIPE_IN_DL_SMMU_NUM_TX_BUFFERS(pipe_in)	\
291 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl_smmu.num_tx_buffers)
292 
293 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING(pipe_in)	\
294 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring)
295 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_SIZE(pipe_in)	\
296 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_size)
297 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_RP_PA(pipe_in)	\
298 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_rp_pa)
299 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_RING_RP_VA(pipe_in)	\
300 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_ring_rp_va)
301 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING(pipe_in)	\
302 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring)
303 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_SIZE(pipe_in)	\
304 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_size)
305 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_WP_PA(pipe_in)	\
306 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_wp_pa)
307 #define QDF_IPA_PIPE_IN_UL_SMMU_RDY_COMP_RING_WP_VA(pipe_in)	\
308 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul_smmu.rdy_comp_ring_wp_va)
309 #endif
310 
311 #define QDF_IPA_PIPE_IN_DL_COMP_RING_BASE_PA(pipe_in)	\
312 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.comp_ring_base_pa)
313 #define QDF_IPA_PIPE_IN_DL_COMP_RING_SIZE(pipe_in)	\
314 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.comp_ring_size)
315 #define QDF_IPA_PIPE_IN_DL_CE_RING_BASE_PA(pipe_in)	\
316 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_ring_base_pa)
317 #define QDF_IPA_PIPE_IN_DL_CE_RING_SIZE(pipe_in)	\
318 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_ring_size)
319 #define QDF_IPA_PIPE_IN_DL_CE_DOOR_BELL_PA(pipe_in)	\
320 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.ce_door_bell_pa)
321 #define QDF_IPA_PIPE_IN_DL_NUM_TX_BUFFERS(pipe_in)	\
322 	(((struct ipa_wdi_in_params *)(pipe_in))->u.dl.num_tx_buffers)
323 
324 #define QDF_IPA_PIPE_IN_UL_RDY_RING_BASE_PA(pipe_in)	\
325 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_base_pa)
326 #define QDF_IPA_PIPE_IN_UL_RDY_RING_SIZE(pipe_in)	\
327 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_size)
328 #define QDF_IPA_PIPE_IN_UL_RDY_RING_RP_PA(pipe_in)	\
329 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_rp_pa)
330 #define QDF_IPA_PIPE_IN_UL_RDY_RING_RP_VA(pipe_in)	\
331 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_ring_rp_va)
332 #define QDF_IPA_PIPE_IN_UL_RDY_COMP_RING(pipe_in)	\
333 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_comp_ring_base_pa)
334 #define QDF_IPA_PIPE_IN_UL_RDY_COMP_RING_SIZE(pipe_in)	\
335 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_comp_ring_size)
336 #define QDF_IPA_PIPE_IN_UL_RDY_COMP_RING_WP_PA(pipe_in)	\
337 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_comp_ring_wp_pa)
338 #define QDF_IPA_PIPE_IN_UL_RDY_COMP_RING_WP_VA(pipe_in)	\
339 	(((struct ipa_wdi_in_params *)(pipe_in))->u.ul.rdy_comp_ring_wp_va)
340 
341 /**
342  * __qdf_ipa_wdi_out_params_t - information provided to WDI client
343  */
344 typedef struct ipa_wdi_out_params __qdf_ipa_wdi_out_params_t;
345 
346 #define QDF_IPA_PIPE_OUT_UC_DOOR_BELL_PA(pipe_out)	\
347 	(((struct ipa_wdi_out_params *)(pipe_out))->uc_door_bell_pa)
348 #define QDF_IPA_PIPE_OUT_CLNT_HDL(pipe_out)	\
349 	(((struct ipa_wdi_out_params *)(pipe_out))->clnt_hdl)
350 
351 /**
352  * __qdf_ipa_wdi_db_params_t - information provided to retrieve
353  *       physical address of uC doorbell
354  */
355 typedef struct ipa_wdi_db_params __qdf_ipa_wdi_db_params_t;
356 
357 /**
358  * __qdf_ipa_wdi_uc_ready_params_t - uC ready CB parameters
359  */
360 typedef void (*__qdf_ipa_uc_ready_cb)(void *priv);
361 typedef struct ipa_wdi_uc_ready_params __qdf_ipa_wdi_uc_ready_params_t;
362 
363 #define QDF_IPA_UC_READY_PARAMS_IS_UC_READY(uc_ready_param)	\
364 	(((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->is_uC_ready)
365 #define QDF_IPA_UC_READY_PARAMS_PRIV(uc_ready_param)	\
366 	(((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->priv)
367 #define QDF_IPA_UC_READY_PARAMS_NOTIFY(uc_ready_param)	\
368 	(((struct ipa_wdi_uc_ready_params *)(uc_ready_param))->notify)
369 
370 /**
371  * __qdf_ipa_wdi_buffer_info_t - address info of a WLAN allocated buffer
372  *
373  * IPA driver will create/release IOMMU mapping in IPA SMMU from iova->pa
374  */
375 typedef struct ipa_wdi_buffer_info __qdf_ipa_wdi_buffer_info_t;
376 
377 /**
378  * __qdf_ipa_gsi_ep_config_t - IPA GSI endpoint configurations
379  */
380 typedef struct ipa_gsi_ep_config __qdf_ipa_gsi_ep_config_t;
381 
382 #ifdef WDI3_STATS_UPDATE
383 /**
384  * __qdf_ipa_wdi_tx_info_t - WLAN embedded TX information
385  */
386 typedef struct ipa_wdi_tx_info __qdf_ipa_wdi_tx_info_t;
387 
388 #define QDF_IPA_WDI_TX_INFO_STA_TX_BYTES(stats_info)	\
389 	(((struct ipa_wdi_tx_info *)stats_info)->sta_tx)
390 #define QDF_IPA_WDI_TX_INFO_SAP_TX_BYTES(stats_info)	\
391 	(((struct ipa_wdi_tx_info *)stats_info)->ap_tx)
392 /**
393  * __qdf_ipa_wdi_bw_info_t - BW levels to be monitored by uC
394  */
395 typedef struct ipa_wdi_bw_info __qdf_ipa_wdi_bw_info_t;
396 
397 #define QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_1(bw_info)	\
398 	(((struct ipa_wdi_bw_info *)bw_info)->threshold[0])
399 #define QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_2(bw_info)	\
400 	(((struct ipa_wdi_bw_info *)bw_info)->threshold[1])
401 #define QDF_IPA_WDI_BW_INFO_THRESHOLD_LEVEL_3(bw_info)	\
402 	(((struct ipa_wdi_bw_info *)bw_info)->threshold[2])
403 #define QDF_IPA_WDI_BW_INFO_START_STOP(bw_info)	\
404 	(((struct ipa_wdi_bw_info *)bw_info)->stop)
405 
406 /**
407  * __qdf_ipa_inform_wlan_bw_t - BW information given by IPA driver
408  */
409 typedef struct ipa_inform_wlan_bw  __qdf_ipa_inform_wlan_bw_t;
410 
411 #define QDF_IPA_INFORM_WLAN_BW_INDEX(bw_inform)	\
412 	(((struct ipa_inform_wlan_bw*)bw_inform)->index)
413 #define QDF_IPA_INFORM_WLAN_BW_THROUGHPUT(bw_inform)	\
414 	(((struct ipa_inform_wlan_bw*)bw_inform)->throughput)
415 
416 #endif /* WDI3_STATS_UPDATE */
417 
418 /**
419  * __qdf_ipa_dp_evt_type_t - type of event client callback is
420  * invoked for on data path
421  * @IPA_RECEIVE: data is struct sk_buff
422  * @IPA_WRITE_DONE: data is struct sk_buff
423  */
424 typedef enum ipa_dp_evt_type __qdf_ipa_dp_evt_type_t;
425 
426 typedef struct ipa_hdr_add __qdf_ipa_hdr_add_t;
427 typedef struct ipa_hdr_del __qdf_ipa_hdr_del_t;
428 typedef struct ipa_ioc_add_hdr __qdf_ipa_ioc_add_hdr_t;
429 
430 #define QDF_IPA_IOC_ADD_HDR_COMMIT(ipa_hdr)	\
431 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->commit)
432 #define QDF_IPA_IOC_ADD_HDR_NUM_HDRS(ipa_hdr)	\
433 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->num_hdrs)
434 #define QDF_IPA_IOC_ADD_HDR_NAME(ipa_hdr)	\
435 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].name)
436 #define QDF_IPA_IOC_ADD_HDR_HDR(ipa_hdr)	\
437 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr)
438 #define QDF_IPA_IOC_ADD_HDR_HDR_LEN(ipa_hdr)	\
439 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr_len)
440 #define QDF_IPA_IOC_ADD_HDR_TYPE(ipa_hdr)	\
441 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].type)
442 #define QDF_IPA_IOC_ADD_HDR_IS_PARTIAL(ipa_hdr)	\
443 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].is_partial)
444 #define QDF_IPA_IOC_ADD_HDR_HDR_HDL(ipa_hdr)	\
445 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].hdr_hdl)
446 #define QDF_IPA_IOC_ADD_HDR_STATUS(ipa_hdr)	\
447 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].status)
448 #define QDF_IPA_IOC_ADD_HDR_IS_ETH2_OFST_VALID(ipa_hdr)	\
449 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].is_eth2_ofst_valid)
450 #define QDF_IPA_IOC_ADD_HDR_ETH2_OFST(ipa_hdr)	\
451 	(((struct ipa_ioc_add_hdr *)(ipa_hdr))->hdr[0].eth2_ofst)
452 
453 typedef struct ipa_ioc_del_hdr __qdf_ipa_ioc_del_hdr_t;
454 
455 #define QDF_IPA_IOC_DEL_HDR_COMMIT(ipa_hdr)	\
456 	(((struct ipa_ioc_del_hdr *)(ipa_hdr))->commit)
457 #define QDF_IPA_IOC_DEL_HDR_NUM_HDRS(ipa_hdr)	\
458 	(((struct ipa_ioc_del_hdr *)(ipa_hdr))->num_hdls)
459 #define QDF_IPA_IOC_DEL_HDR_HDL(ipa_hdr)	\
460 	(((struct ipa_ioc_del_hdr *)(ipa_hdr))->hdl[0].hdl)
461 #define QDF_IPA_IOC_DEL_HDR_STATUS(ipa_hdr)	\
462 	(((struct ipa_ioc_del_hdr *)(ipa_hdr))->hdl[0].status)
463 
464 typedef struct ipa_ioc_get_hdr __qdf_ipa_ioc_get_hdr_t;
465 
466 #define QDF_IPA_IOC_GET_HDR_NAME(ipa_hdr)	\
467 	(((struct ipa_ioc_get_hdr *)(ipa_hdr))->name)
468 #define QDF_IPA_IOC_GET_HDR_HDL(ipa_hdr)	\
469 	(((struct ipa_ioc_get_hdr *)(ipa_hdr))->hdl)
470 
471 typedef struct ipa_ioc_copy_hdr __qdf_ipa_ioc_copy_hdr_t;
472 typedef struct ipa_ioc_add_hdr_proc_ctx __qdf_ipa_ioc_add_hdr_proc_ctx_t;
473 typedef struct ipa_ioc_del_hdr_proc_ctx __qdf_ipa_ioc_del_hdr_proc_ctx_t;
474 typedef struct ipa_msg_meta __qdf_ipa_msg_meta_t;
475 
476 #define QDF_IPA_MSG_META_MSG_TYPE(meta)	\
477 	(((struct ipa_msg_meta *)(meta))->msg_type)
478 #define QDF_IPA_MSG_META_MSG_LEN(meta)	\
479 	(((struct ipa_msg_meta *)(meta))->msg_len)
480 
481 typedef enum ipa_client_type __qdf_ipa_client_type_t;
482 typedef struct IpaHwStatsWDIInfoData_t __qdf_ipa_hw_stats_wdi_info_data_t;
483 typedef enum ipa_rm_resource_name __qdf_ipa_rm_resource_name_t;
484 typedef enum ipa_wlan_event __qdf_ipa_wlan_event_t;
485 typedef struct ipa_wlan_msg __qdf_ipa_wlan_msg_t;
486 
487 #ifdef IPA_WDS_EASYMESH_FEATURE
488 /**
489  * __qdf_ipa_ast_info_type_t - AST entry create/update information
490  */
491 typedef struct ipa_ast_info_type __qdf_ipa_ast_info_type_t;
492 
493 #define QDF_IPA_WLAN_MSG_WDS_UPDATE(ipa_msg)	\
494 	(((struct ipa_wlan_msg *)(ipa_msg))->ast_update)
495 #endif
496 
497 #define QDF_IPA_WLAN_MSG_NAME(ipa_msg)	\
498 	(((struct ipa_wlan_msg *)(ipa_msg))->name)
499 #define QDF_IPA_WLAN_MSG_MAC_ADDR(ipa_msg)	\
500 	(((struct ipa_wlan_msg *)(ipa_msg))->mac_addr)
501 
502 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0))
503 #define QDF_IPA_WLAN_MSG_NETDEV_IF_ID(ipa_msg)	\
504 	(((struct ipa_wlan_msg *)(ipa_msg))->if_index)
505 #else
506 /**
507  * ipa_wlan_msg_if_index - Netdev interface id
508  */
509 struct ipa_wlan_msg_if_index {
510 	char name[IPA_RESOURCE_NAME_MAX];
511 	uint8_t mac_addr[IPA_MAC_ADDR_SIZE];
512 	uint16_t if_index;
513 };
514 
515 #define QDF_IPA_WLAN_MSG_NETDEV_IF_ID(ipa_msg)	\
516 	(((struct ipa_wlan_msg_if_index *)(ipa_msg))->if_index)
517 #endif
518 
519 typedef struct ipa_wlan_msg_ex __qdf_ipa_wlan_msg_ex_t;
520 
521 #define QDF_IPA_WLAN_MSG_EX_NAME(ipa_msg)	\
522 	(((struct ipa_wlan_msg_ex *)(ipa_msg))->name)
523 #define QDF_IPA_WLAN_MSG_EX_EXNUM_OF_ATTRIBS(ipa_msg)	\
524 	(((struct ipa_wlan_msg_ex *)(ipa_msg))->num_of_attribs)
525 #define QDF_IPA_WLAN_MSG_EX_ATTRIB_TYPE(ipa_msg)	\
526 	(((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.attrib_type)
527 #define QDF_IPA_WLAN_MSG_EX_OFFSET(ipa_msg)	\
528 	(((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.offset)
529 #define QDF_IPA_WLAN_MSG_EX_MAC_ADDR(ipa_msg)	\
530 	(((struct ipa_wlan_msg_ex *)(ipa_msg))->attribs.u.mac_addr)
531 
532 typedef struct ipa_ioc_tx_intf_prop __qdf_ipa_ioc_tx_intf_prop_t;
533 
534 #define QDF_IPA_IOC_TX_INTF_PROP_IP(tx_prop)	\
535 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->ip)
536 #define QDF_IPA_IOC_TX_INTF_PROP_ATTRIB_MASK(tx_prop)	\
537 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.attrib_mask)
538 #define QDF_IPA_IOC_TX_INTF_PROP_META_DATA(rx_prop)	\
539 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.meta_data)
540 #define QDF_IPA_IOC_TX_INTF_PROP_META_DATA_MASK(rx_prop)	\
541 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->attrib.meta_data_mask)
542 #define QDF_IPA_IOC_TX_INTF_PROP_DST_PIPE(tx_prop)	\
543 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->dst_pipe)
544 #define QDF_IPA_IOC_TX_INTF_PROP_ALT_DST_PIPE(tx_prop)	\
545 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->alt_dst_pipe)
546 #define QDF_IPA_IOC_TX_INTF_PROP_HDR_NAME(tx_prop)	\
547 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->hdr_name)
548 #define QDF_IPA_IOC_TX_INTF_PROP_HDR_L2_TYPE(tx_prop)	\
549 	(((struct ipa_ioc_tx_intf_prop *)(tx_prop))->hdr_l2_type)
550 
551 typedef struct ipa_ioc_rx_intf_prop __qdf_ipa_ioc_rx_intf_prop_t;
552 
553 #define QDF_IPA_IOC_RX_INTF_PROP_IP(rx_prop)	\
554 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->ip)
555 #define QDF_IPA_IOC_RX_INTF_PROP_ATTRIB_MASK(rx_prop)	\
556 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.attrib_mask)
557 #define QDF_IPA_IOC_RX_INTF_PROP_META_DATA(rx_prop)	\
558 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.meta_data)
559 #define QDF_IPA_IOC_RX_INTF_PROP_META_DATA_MASK(rx_prop)	\
560 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->attrib.meta_data_mask)
561 #define QDF_IPA_IOC_RX_INTF_PROP_SRC_PIPE(rx_prop)	\
562 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->src_pipe)
563 #define QDF_IPA_IOC_RX_INTF_PROP_HDR_L2_TYPE(rx_prop)	\
564 	(((struct ipa_ioc_rx_intf_prop *)(rx_prop))->hdr_l2_type)
565 
566 typedef struct ipa_wlan_hdr_attrib_val __qdf_ipa_wlan_hdr_attrib_val_t;
567 
568 #define __QDF_IPA_SET_META_MSG_TYPE(meta, msg_type)	\
569 	__qdf_ipa_set_meta_msg_type(meta, msg_type)
570 
571 #define __QDF_IPA_RM_RESOURCE_GRANTED IPA_RM_RESOURCE_GRANTED
572 #define __QDF_IPA_RM_RESOURCE_RELEASED IPA_RM_RESOURCE_RELEASED
573 
574 #define __QDF_IPA_RM_RESOURCE_WLAN_PROD IPA_RM_RESOURCE_WLAN_PROD
575 #define __QDF_IPA_RM_RESOURCE_WLAN_CONS IPA_RM_RESOURCE_WLAN_CONS
576 #define __QDF_IPA_RM_RESOURCE_APPS_CONS IPA_RM_RESOURCE_APPS_CONS
577 
578 #define __QDF_IPA_VOLTAGE_LEVEL IPA_VOLTAGE_SVS
579 
580 #define __QDF_IPA_CLIENT_WLAN1_PROD IPA_CLIENT_WLAN1_PROD
581 #define __QDF_IPA_CLIENT_WLAN3_PROD IPA_CLIENT_WLAN3_PROD
582 #define __QDF_IPA_CLIENT_WLAN1_CONS IPA_CLIENT_WLAN1_CONS
583 #define __QDF_IPA_CLIENT_WLAN2_CONS IPA_CLIENT_WLAN2_CONS
584 #define __QDF_IPA_CLIENT_WLAN3_CONS IPA_CLIENT_WLAN3_CONS
585 #define __QDF_IPA_CLIENT_WLAN4_CONS IPA_CLIENT_WLAN4_CONS
586 #define __QDF_IPA_CLIENT_WLAN4_PROD IPA_CLIENT_WLAN4_PROD
587 
588 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0)) && \
589 	(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0))
590 #define __QDF_IPA_CLIENT_WLAN_WDI2_CONS IPA_CLIENT_WLAN4_CONS
591 #define __QDF_IPA_CLIENT_WLAN_WDI2_PROD IPA_CLIENT_WLAN4_PROD
592 #else
593 #define __QDF_IPA_CLIENT_WLAN_WDI2_CONS IPA_CLIENT_WLAN1_CONS
594 #define __QDF_IPA_CLIENT_WLAN_WDI2_PROD IPA_CLIENT_WLAN1_PROD
595 #endif
596 
597 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
598 #define IPA_LAN_RX_NAPI_SUPPORT
599 #endif
600 
601 #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
602 /*
603  * Resume / Suspend
604  */
__qdf_ipa_reset_endpoint(u32 clnt_hdl)605 static inline int __qdf_ipa_reset_endpoint(u32 clnt_hdl)
606 {
607 	return ipa_reset_endpoint(clnt_hdl);
608 }
609 
610 /*
611  * Remove ep delay
612  */
__qdf_ipa_clear_endpoint_delay(u32 clnt_hdl)613 static inline int __qdf_ipa_clear_endpoint_delay(u32 clnt_hdl)
614 {
615 	return ipa_clear_endpoint_delay(clnt_hdl);
616 }
617 
618 /*
619  * Header removal / addition
620  */
__qdf_ipa_add_hdr(struct ipa_ioc_add_hdr * hdrs)621 static inline int __qdf_ipa_add_hdr(struct ipa_ioc_add_hdr *hdrs)
622 {
623 	return ipa_add_hdr(hdrs);
624 }
625 
__qdf_ipa_del_hdr(struct ipa_ioc_del_hdr * hdls)626 static inline int __qdf_ipa_del_hdr(struct ipa_ioc_del_hdr *hdls)
627 {
628 	return ipa_del_hdr(hdls);
629 }
630 
__qdf_ipa_commit_hdr(void)631 static inline int __qdf_ipa_commit_hdr(void)
632 {
633 	return ipa_commit_hdr();
634 }
635 
__qdf_ipa_get_hdr(struct ipa_ioc_get_hdr * lookup)636 static inline int __qdf_ipa_get_hdr(struct ipa_ioc_get_hdr *lookup)
637 {
638 	return ipa_get_hdr(lookup);
639 }
640 
__qdf_ipa_put_hdr(u32 hdr_hdl)641 static inline int __qdf_ipa_put_hdr(u32 hdr_hdl)
642 {
643 	return ipa_put_hdr(hdr_hdl);
644 }
645 
__qdf_ipa_copy_hdr(struct ipa_ioc_copy_hdr * copy)646 static inline int __qdf_ipa_copy_hdr(struct ipa_ioc_copy_hdr *copy)
647 {
648 	return ipa_copy_hdr(copy);
649 }
650 
__qdf_ipa_register_pull_msg(struct ipa_msg_meta * meta,ipa_msg_pull_fn callback)651 static inline int __qdf_ipa_register_pull_msg(struct ipa_msg_meta *meta,
652 		ipa_msg_pull_fn callback)
653 {
654 	return ipa_register_pull_msg(meta, callback);
655 }
656 
__qdf_ipa_deregister_pull_msg(struct ipa_msg_meta * meta)657 static inline int __qdf_ipa_deregister_pull_msg(struct ipa_msg_meta *meta)
658 {
659 	return ipa_deregister_pull_msg(meta);
660 }
661 
662 /*
663  * Interface
664  */
__qdf_ipa_register_intf(const char * name,const struct ipa_tx_intf * tx,const struct ipa_rx_intf * rx)665 static inline int __qdf_ipa_register_intf(const char *name,
666 				     const struct ipa_tx_intf *tx,
667 				     const struct ipa_rx_intf *rx)
668 {
669 	return ipa_register_intf(name, tx, rx);
670 }
671 
__qdf_ipa_register_intf_ext(const char * name,const struct ipa_tx_intf * tx,const struct ipa_rx_intf * rx,const struct ipa_ext_intf * ext)672 static inline int __qdf_ipa_register_intf_ext(const char *name,
673 		const struct ipa_tx_intf *tx,
674 		const struct ipa_rx_intf *rx,
675 		const struct ipa_ext_intf *ext)
676 {
677 	return ipa_register_intf_ext(name, tx, rx, ext);
678 }
679 
__qdf_ipa_deregister_intf(const char * name)680 static inline int __qdf_ipa_deregister_intf(const char *name)
681 {
682 	return ipa_deregister_intf(name);
683 }
684 
685 /*
686  * Data path
687  */
__qdf_ipa_tx_dp(enum ipa_client_type dst,struct sk_buff * skb,struct ipa_tx_meta * metadata)688 static inline int __qdf_ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
689 		struct ipa_tx_meta *metadata)
690 {
691 	return ipa_tx_dp(dst, skb, metadata);
692 }
693 
694 /*
695  * To transfer multiple data packets
696  */
__qdf_ipa_tx_dp_mul(enum ipa_client_type dst,struct ipa_tx_data_desc * data_desc)697 static inline int __qdf_ipa_tx_dp_mul(
698 	enum ipa_client_type dst,
699 	struct ipa_tx_data_desc *data_desc)
700 {
701 	return ipa_tx_dp_mul(dst, data_desc);
702 }
703 
704 /*
705  * System pipes
706  */
__qdf_ipa_get_smem_restr_bytes(void)707 static inline u16 __qdf_ipa_get_smem_restr_bytes(void)
708 {
709 	return ipa_get_smem_restr_bytes();
710 }
711 
__qdf_ipa_connect_wdi_pipe(struct ipa_wdi_in_params * in,struct ipa_wdi_out_params * out)712 static inline int __qdf_ipa_connect_wdi_pipe(struct ipa_wdi_in_params *in,
713 		struct ipa_wdi_out_params *out)
714 {
715 	return ipa_connect_wdi_pipe(in, out);
716 }
717 
__qdf_ipa_disconnect_wdi_pipe(u32 clnt_hdl)718 static inline int __qdf_ipa_disconnect_wdi_pipe(u32 clnt_hdl)
719 {
720 	return ipa_disconnect_wdi_pipe(clnt_hdl);
721 }
722 
__qdf_ipa_enable_wdi_pipe(u32 clnt_hdl)723 static inline int __qdf_ipa_enable_wdi_pipe(u32 clnt_hdl)
724 {
725 	return ipa_enable_wdi_pipe(clnt_hdl);
726 }
727 
__qdf_ipa_disable_wdi_pipe(u32 clnt_hdl)728 static inline int __qdf_ipa_disable_wdi_pipe(u32 clnt_hdl)
729 {
730 	return ipa_disable_wdi_pipe(clnt_hdl);
731 }
732 
__qdf_ipa_resume_wdi_pipe(u32 clnt_hdl)733 static inline int __qdf_ipa_resume_wdi_pipe(u32 clnt_hdl)
734 {
735 	return ipa_resume_wdi_pipe(clnt_hdl);
736 }
737 
__qdf_ipa_suspend_wdi_pipe(u32 clnt_hdl)738 static inline int __qdf_ipa_suspend_wdi_pipe(u32 clnt_hdl)
739 {
740 	return ipa_suspend_wdi_pipe(clnt_hdl);
741 }
742 
__qdf_ipa_uc_wdi_get_dbpa(struct ipa_wdi_db_params * out)743 static inline int __qdf_ipa_uc_wdi_get_dbpa(
744 	struct ipa_wdi_db_params *out)
745 {
746 	return ipa_uc_wdi_get_dbpa(out);
747 }
748 
749 /*
750  * Resource manager
751  */
__qdf_ipa_rm_create_resource(struct ipa_rm_create_params * create_params)752 static inline int __qdf_ipa_rm_create_resource(
753 		struct ipa_rm_create_params *create_params)
754 {
755 	return ipa_rm_create_resource(create_params);
756 }
757 
__qdf_ipa_rm_delete_resource(enum ipa_rm_resource_name resource_name)758 static inline int __qdf_ipa_rm_delete_resource(
759 		enum ipa_rm_resource_name resource_name)
760 {
761 	return ipa_rm_delete_resource(resource_name);
762 }
763 
__qdf_ipa_rm_register(enum ipa_rm_resource_name resource_name,struct ipa_rm_register_params * reg_params)764 static inline int __qdf_ipa_rm_register(enum ipa_rm_resource_name resource_name,
765 			struct ipa_rm_register_params *reg_params)
766 {
767 	return ipa_rm_register(resource_name, reg_params);
768 }
769 
__qdf_ipa_rm_set_perf_profile(enum ipa_rm_resource_name resource_name,struct ipa_rm_perf_profile * profile)770 static inline int __qdf_ipa_rm_set_perf_profile(
771 		enum ipa_rm_resource_name resource_name,
772 		struct ipa_rm_perf_profile *profile)
773 {
774 	return ipa_rm_set_perf_profile(resource_name, profile);
775 }
776 
__qdf_ipa_rm_deregister(enum ipa_rm_resource_name resource_name,struct ipa_rm_register_params * reg_params)777 static inline int __qdf_ipa_rm_deregister(enum ipa_rm_resource_name resource_name,
778 			struct ipa_rm_register_params *reg_params)
779 {
780 	return ipa_rm_deregister(resource_name, reg_params);
781 }
782 
__qdf_ipa_rm_add_dependency(enum ipa_rm_resource_name resource_name,enum ipa_rm_resource_name depends_on_name)783 static inline int __qdf_ipa_rm_add_dependency(
784 		enum ipa_rm_resource_name resource_name,
785 		enum ipa_rm_resource_name depends_on_name)
786 {
787 	return ipa_rm_add_dependency(resource_name, depends_on_name);
788 }
789 
__qdf_ipa_rm_add_dependency_sync(enum ipa_rm_resource_name resource_name,enum ipa_rm_resource_name depends_on_name)790 static inline int __qdf_ipa_rm_add_dependency_sync(
791 		enum ipa_rm_resource_name resource_name,
792 		enum ipa_rm_resource_name depends_on_name)
793 {
794 	return ipa_rm_add_dependency_sync(resource_name, depends_on_name);
795 }
796 
__qdf_ipa_rm_delete_dependency(enum ipa_rm_resource_name resource_name,enum ipa_rm_resource_name depends_on_name)797 static inline int __qdf_ipa_rm_delete_dependency(
798 		enum ipa_rm_resource_name resource_name,
799 		enum ipa_rm_resource_name depends_on_name)
800 {
801 	return ipa_rm_delete_dependency(resource_name, depends_on_name);
802 }
803 
__qdf_ipa_rm_request_resource(enum ipa_rm_resource_name resource_name)804 static inline int __qdf_ipa_rm_request_resource(
805 		enum ipa_rm_resource_name resource_name)
806 {
807 	return ipa_rm_request_resource(resource_name);
808 }
809 
__qdf_ipa_rm_release_resource(enum ipa_rm_resource_name resource_name)810 static inline int __qdf_ipa_rm_release_resource(
811 		enum ipa_rm_resource_name resource_name)
812 {
813 	return ipa_rm_release_resource(resource_name);
814 }
815 
__qdf_ipa_rm_notify_completion(enum ipa_rm_event event,enum ipa_rm_resource_name resource_name)816 static inline int __qdf_ipa_rm_notify_completion(enum ipa_rm_event event,
817 		enum ipa_rm_resource_name resource_name)
818 {
819 	return ipa_rm_notify_completion(event, resource_name);
820 }
821 
__qdf_ipa_rm_inactivity_timer_init(enum ipa_rm_resource_name resource_name,unsigned long msecs)822 static inline int __qdf_ipa_rm_inactivity_timer_init(
823 		enum ipa_rm_resource_name resource_name,
824 			unsigned long msecs)
825 {
826 	return ipa_rm_inactivity_timer_init(resource_name, msecs);
827 }
828 
__qdf_ipa_rm_inactivity_timer_destroy(enum ipa_rm_resource_name resource_name)829 static inline int __qdf_ipa_rm_inactivity_timer_destroy(
830 		enum ipa_rm_resource_name resource_name)
831 {
832 	return ipa_rm_inactivity_timer_destroy(resource_name);
833 }
834 
__qdf_ipa_rm_inactivity_timer_request_resource(enum ipa_rm_resource_name resource_name)835 static inline int __qdf_ipa_rm_inactivity_timer_request_resource(
836 				enum ipa_rm_resource_name resource_name)
837 {
838 	return ipa_rm_inactivity_timer_request_resource(resource_name);
839 }
840 
__qdf_ipa_rm_inactivity_timer_release_resource(enum ipa_rm_resource_name resource_name)841 static inline int __qdf_ipa_rm_inactivity_timer_release_resource(
842 				enum ipa_rm_resource_name resource_name)
843 {
844 	return ipa_rm_inactivity_timer_release_resource(resource_name);
845 }
846 
847 /*
848  * Miscellaneous
849  */
__qdf_ipa_bam_reg_dump(void)850 static inline void __qdf_ipa_bam_reg_dump(void)
851 {
852 	return ipa_bam_reg_dump();
853 }
854 
__qdf_ipa_get_ep_mapping(enum ipa_client_type client)855 static inline int __qdf_ipa_get_ep_mapping(enum ipa_client_type client)
856 {
857 	return ipa_get_ep_mapping(client);
858 }
859 
__qdf_ipa_proxy_clk_vote(void)860 static inline void __qdf_ipa_proxy_clk_vote(void)
861 {
862 	return ipa_proxy_clk_vote();
863 }
864 
__qdf_ipa_proxy_clk_unvote(void)865 static inline void __qdf_ipa_proxy_clk_unvote(void)
866 {
867 	return ipa_proxy_clk_unvote();
868 }
869 
__qdf_ipa_is_client_handle_valid(u32 clnt_hdl)870 static inline bool __qdf_ipa_is_client_handle_valid(u32 clnt_hdl)
871 {
872 	return ipa_is_client_handle_valid(clnt_hdl);
873 }
874 
__qdf_ipa_get_client_mapping(int pipe_idx)875 static inline enum ipa_client_type __qdf_ipa_get_client_mapping(int pipe_idx)
876 {
877 	return ipa_get_client_mapping(pipe_idx);
878 }
879 
__qdf_ipa_get_rm_resource_from_ep(int pipe_idx)880 static inline enum ipa_rm_resource_name __qdf_ipa_get_rm_resource_from_ep(
881 	int pipe_idx)
882 {
883 	return ipa_get_rm_resource_from_ep(pipe_idx);
884 }
885 
__qdf_ipa_get_modem_cfg_emb_pipe_flt(void)886 static inline bool __qdf_ipa_get_modem_cfg_emb_pipe_flt(void)
887 {
888 	return ipa_get_modem_cfg_emb_pipe_flt();
889 }
890 
__qdf_ipa_get_transport_type(void)891 static inline enum ipa_transport_type __qdf_ipa_get_transport_type(void)
892 {
893 	return ipa_get_transport_type();
894 }
895 
__qdf_ipa_get_dma_dev(void)896 static inline struct device *__qdf_ipa_get_dma_dev(void)
897 {
898 	return ipa_get_dma_dev();
899 }
900 
__qdf_ipa_get_smmu_domain(void)901 static inline struct iommu_domain *__qdf_ipa_get_smmu_domain(void)
902 {
903 	return ipa_get_smmu_domain();
904 }
905 
__qdf_ipa_create_wdi_mapping(u32 num_buffers,__qdf_ipa_wdi_buffer_info_t * info)906 static inline int __qdf_ipa_create_wdi_mapping(u32 num_buffers,
907 		__qdf_ipa_wdi_buffer_info_t *info)
908 {
909 	return ipa_create_wdi_mapping(num_buffers, info);
910 }
911 
__qdf_ipa_release_wdi_mapping(u32 num_buffers,struct ipa_wdi_buffer_info * info)912 static inline int __qdf_ipa_release_wdi_mapping(u32 num_buffers,
913 		struct ipa_wdi_buffer_info *info)
914 {
915 	return ipa_release_wdi_mapping(num_buffers, info);
916 }
917 
__qdf_ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size,uint32_t agg_count)918 static inline int __qdf_ipa_disable_apps_wan_cons_deaggr(uint32_t agg_size, uint32_t agg_count)
919 {
920 	return ipa_disable_apps_wan_cons_deaggr(agg_size, agg_count);
921 }
922 
__qdf_ipa_get_gsi_ep_info(enum ipa_client_type client)923 static inline const struct ipa_gsi_ep_config *__qdf_ipa_get_gsi_ep_info(enum ipa_client_type client)
924 {
925 	return ipa_get_gsi_ep_info(client);
926 }
927 
__qdf_ipa_stop_gsi_channel(u32 clnt_hdl)928 static inline int __qdf_ipa_stop_gsi_channel(u32 clnt_hdl)
929 {
930 	return ipa_stop_gsi_channel(clnt_hdl);
931 }
932 
933 #endif
__qdf_ipa_free_skb(struct ipa_rx_data * rx_in)934 static inline void __qdf_ipa_free_skb(struct ipa_rx_data *rx_in)
935 {
936 	return ipa_free_skb(rx_in);
937 }
938 
__qdf_ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t * stats)939 static inline int __qdf_ipa_get_wdi_stats(struct IpaHwStatsWDIInfoData_t *stats)
940 {
941 	return ipa_get_wdi_stats(stats);
942 }
943 
944 /* IPA supports this call only on legacy devices. Starting from
945  * Linux version 6.1.15, IPA has moved out of the kernel and
946  * has deprecated this call.
947  */
948 #if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 15))
__qdf_ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params * param)949 static inline int __qdf_ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params *param)
950 {
951 	return ipa_uc_reg_rdyCB(param);
952 }
953 
__qdf_ipa_uc_dereg_rdyCB(void)954 static inline int __qdf_ipa_uc_dereg_rdyCB(void)
955 {
956 	return ipa_uc_dereg_rdyCB();
957 }
958 #else
959 /* This call has been removed from IPA since
960  * Commit-ID: b37958da466efc1320b7f97ddf876565762f05b7.
961  * This call returns 0 here as ipa_wdi_init_per_inst()
962  * call to IPA would already handle all the initialization steps
963  * and do not require WLAN to make this IPA call.
964  */
__qdf_ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params * param)965 static inline int __qdf_ipa_uc_reg_rdyCB(struct ipa_wdi_uc_ready_params *param)
966 {
967 	return 0;
968 }
969 
__qdf_ipa_uc_dereg_rdyCB(void)970 static inline int __qdf_ipa_uc_dereg_rdyCB(void)
971 {
972 	return 0;
973 }
974 #endif
__qdf_ipa_register_ipa_ready_cb(void (* ipa_ready_cb)(void * user_data),void * user_data)975 static inline int __qdf_ipa_register_ipa_ready_cb(
976 	void (*ipa_ready_cb)(void *user_data),
977 	void *user_data)
978 {
979 	return ipa_register_ipa_ready_cb(ipa_ready_cb, user_data);
980 }
981 
982 static inline
__qdf_ipa_setup_sys_pipe(struct ipa_sys_connect_params * sys_in,u32 * clnt_hdl)983 int __qdf_ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in,
984 			     u32 *clnt_hdl)
985 {
986 	return ipa_setup_sys_pipe(sys_in, clnt_hdl);
987 }
988 
__qdf_ipa_teardown_sys_pipe(u32 clnt_hdl)989 static inline int __qdf_ipa_teardown_sys_pipe(u32 clnt_hdl)
990 {
991 	return ipa_teardown_sys_pipe(clnt_hdl);
992 }
993 
994 /*
995  * Messaging
996  */
__qdf_ipa_send_msg(struct ipa_msg_meta * meta,void * buff,ipa_msg_free_fn callback)997 static inline int __qdf_ipa_send_msg(struct ipa_msg_meta *meta, void *buff,
998 				     ipa_msg_free_fn callback)
999 {
1000 	return ipa_send_msg(meta, buff, callback);
1001 }
1002 
__qdf_ipa_is_ready(void)1003 static inline bool __qdf_ipa_is_ready(void)
1004 {
1005 	return ipa_is_ready();
1006 }
1007 
1008 #ifdef FEATURE_METERING
__qdf_ipa_broadcast_wdi_quota_reach_ind(uint32_t index,uint64_t quota_bytes)1009 static inline int __qdf_ipa_broadcast_wdi_quota_reach_ind(uint32_t index,
1010 							  uint64_t quota_bytes)
1011 {
1012 	return ipa_broadcast_wdi_quota_reach_ind(index, quota_bytes);
1013 }
1014 #endif
1015 
1016 void __qdf_ipa_set_meta_msg_type(__qdf_ipa_msg_meta_t *meta, int type);
1017 
1018 #ifdef ENABLE_SMMU_S1_TRANSLATION
1019 /**
1020  * __qdf_get_ipa_smmu_enabled() - to get IPA SMMU enable status
1021  *
1022  * Return: true when IPA SMMU enabled, otherwise false
1023  */
__qdf_get_ipa_smmu_enabled(void)1024 static bool __qdf_get_ipa_smmu_enabled(void)
1025 {
1026 	struct ipa_smmu_in_params params_in;
1027 	struct ipa_smmu_out_params params_out;
1028 
1029 	params_in.smmu_client = IPA_SMMU_WLAN_CLIENT;
1030 	ipa_get_smmu_params(&params_in, &params_out);
1031 
1032 	return params_out.smmu_enable;
1033 }
1034 #endif
1035 
1036 #ifdef IPA_LAN_RX_NAPI_SUPPORT
1037 /**
1038  * ipa_get_lan_rx_napi() - Check if NAPI is enabled in LAN RX DP
1039  *
1040  * Returns: true if enabled, false otherwise
1041  */
__qdf_ipa_get_lan_rx_napi(void)1042 static inline bool __qdf_ipa_get_lan_rx_napi(void)
1043 {
1044 	return ipa_get_lan_rx_napi();
1045 }
1046 #endif /* IPA_LAN_RX_NAPI_SUPPORT */
1047 #endif /* IPA_OFFLOAD */
1048 #endif /* _I_QDF_IPA_H */
1049