xref: /wlan-dirver/qca-wifi-host-cmn/dp/inc/cdp_txrx_ipa.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 /**
20  * @file cdp_txrx_ipa.h
21  * @brief Define the host data path IP Acceleraor API functions
22  */
23 #ifndef _CDP_TXRX_IPA_H_
24 #define _CDP_TXRX_IPA_H_
25 
26 #ifdef IPA_OFFLOAD
27 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
28 	defined(CONFIG_IPA_WDI_UNIFIED_API)
29 #include <qdf_ipa_wdi3.h>
30 #else
31 #include <qdf_ipa.h>
32 #endif
33 #include <cdp_txrx_cmn.h>
34 #include "cdp_txrx_handle.h"
35 
36 /**
37  * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path
38  * @soc - data path soc handle
39  * @pdev_id - device instance id
40  *
41  * Get allocated WLAN resources for IPA data path
42  *
43  * return QDF_STATUS_SUCCESS
44  */
45 static inline QDF_STATUS
46 cdp_ipa_get_resource(ol_txrx_soc_handle soc, uint8_t pdev_id)
47 {
48 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
49 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
50 			"%s invalid instance", __func__);
51 		return QDF_STATUS_E_FAILURE;
52 	}
53 
54 	if (soc->ops->ipa_ops->ipa_get_resource)
55 		return soc->ops->ipa_ops->ipa_get_resource(soc, pdev_id);
56 
57 	return QDF_STATUS_SUCCESS;
58 }
59 
60 /**
61  * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW
62  * @soc - data path soc handle
63  * @pdev_id - device instance id
64  *
65  * give IPA db paddr to FW
66  *
67  * return QDF_STATUS_SUCCESS
68  */
69 static inline QDF_STATUS
70 cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
71 {
72 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
73 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
74 			"%s invalid instance", __func__);
75 		return QDF_STATUS_E_FAILURE;
76 	}
77 
78 	if (soc->ops->ipa_ops->ipa_set_doorbell_paddr)
79 		return soc->ops->ipa_ops->ipa_set_doorbell_paddr(soc, pdev_id);
80 
81 	return QDF_STATUS_SUCCESS;
82 }
83 
84 /**
85  * cdp_ipa_set_active() - activate/de-ctivate IPA offload path
86  * @soc - data path soc handle
87  * @pdev_id - device instance id
88  * @uc_active - activate or de-activate
89  * @is_tx - toggle tx or rx data path
90  *
91  * activate/de-ctivate IPA offload path
92  *
93  * return QDF_STATUS_SUCCESS
94  */
95 static inline QDF_STATUS
96 cdp_ipa_set_active(ol_txrx_soc_handle soc, uint8_t pdev_id, bool uc_active,
97 		   bool is_tx)
98 {
99 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
100 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
101 			"%s invalid instance", __func__);
102 		return QDF_STATUS_E_FAILURE;
103 	}
104 
105 	if (soc->ops->ipa_ops->ipa_set_active)
106 		return soc->ops->ipa_ops->ipa_set_active(soc, pdev_id,
107 				uc_active, is_tx);
108 
109 	return QDF_STATUS_SUCCESS;
110 }
111 
112 /**
113  * cdp_ipa_op_response() - event handler from FW
114  * @soc - data path soc handle
115  * @pdev_id - device instance id
116  * @op_msg - event contents from firmware
117  *
118  * event handler from FW
119  *
120  * return QDF_STATUS_SUCCESS
121  */
122 static inline QDF_STATUS
123 cdp_ipa_op_response(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t *op_msg)
124 {
125 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
126 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
127 			"%s invalid instance", __func__);
128 		return QDF_STATUS_E_FAILURE;
129 	}
130 
131 	if (soc->ops->ipa_ops->ipa_op_response)
132 		return soc->ops->ipa_ops->ipa_op_response(soc, pdev_id, op_msg);
133 
134 	return QDF_STATUS_SUCCESS;
135 }
136 
137 /**
138  * cdp_ipa_register_op_cb() - register event handler function pointer
139  * @soc - data path soc handle
140  * @pdev_id - device instance id
141  * @op_cb - event handler callback function pointer
142  * @usr_ctxt - user context to registered
143  *
144  * register event handler function pointer
145  *
146  * return QDF_STATUS_SUCCESS
147  */
148 static inline QDF_STATUS
149 cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id,
150 		       ipa_uc_op_cb_type op_cb, void *usr_ctxt)
151 {
152 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
153 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
154 			"%s invalid instance", __func__);
155 		return QDF_STATUS_E_FAILURE;
156 	}
157 
158 	if (soc->ops->ipa_ops->ipa_register_op_cb)
159 		return soc->ops->ipa_ops->ipa_register_op_cb(soc, pdev_id,
160 							     op_cb, usr_ctxt);
161 
162 	return QDF_STATUS_SUCCESS;
163 }
164 
165 /**
166  * cdp_ipa_deregister_op_cb() - deregister event handler function pointer
167  * @soc - data path soc handle
168  * @pdev_id - device instance id
169  *
170  * Deregister event handler function pointer from pdev
171  *
172  * return QDF_STATUS_SUCCESS
173  */
174 static inline
175 void cdp_ipa_deregister_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id)
176 {
177 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
178 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
179 			  "%s invalid instance", __func__);
180 		return;
181 	}
182 
183 	if (soc->ops->ipa_ops->ipa_deregister_op_cb)
184 		soc->ops->ipa_ops->ipa_deregister_op_cb(soc, pdev_id);
185 }
186 
187 /**
188  * cdp_ipa_get_stat() - get IPA data path stats from FW
189  * @soc - data path soc handle
190  * @pdev_id - device instance id
191  *
192  * get IPA data path stats from FW async
193  *
194  * return QDF_STATUS_SUCCESS
195  */
196 static inline QDF_STATUS
197 cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id)
198 {
199 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
200 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
201 			"%s invalid instance", __func__);
202 		return QDF_STATUS_E_FAILURE;
203 	}
204 
205 	if (soc->ops->ipa_ops->ipa_get_stat)
206 		return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id);
207 
208 	return QDF_STATUS_SUCCESS;
209 }
210 
211 /**
212  * cdp_tx_send_ipa_data_frame() - send IPA data frame
213  * @soc - data path soc handle
214  * @vdev_id: vdev id
215  * @skb: skb
216  *
217  * Return: skb/ NULL is for success
218  */
219 static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
220 						    uint8_t vdev_id,
221 						    qdf_nbuf_t skb)
222 {
223 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
224 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
225 			"%s invalid instance", __func__);
226 		return skb;
227 	}
228 
229 	if (soc->ops->ipa_ops->ipa_tx_data_frame)
230 		return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb);
231 
232 	return skb;
233 }
234 
235 /**
236  * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
237  * @soc - data path soc handle
238  * @cfg_pdev: physical device instance config
239  * @value: partition base value
240  *
241  * Return: QDF_STATUS
242  */
243 static inline QDF_STATUS
244 cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
245 				struct cdp_cfg *cfg_pdev, uint32_t value)
246 {
247 	if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_pdev) {
248 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
249 			"%s invalid instance", __func__);
250 		return QDF_STATUS_E_FAILURE;
251 	}
252 
253 	if (soc->ops->ipa_ops->ipa_set_uc_tx_partition_base)
254 		soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev,
255 								value);
256 
257 	return QDF_STATUS_SUCCESS;
258 }
259 
260 #ifdef FEATURE_METERING
261 /**
262  * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
263  * @soc - data path soc handle
264  * @pdev_id: physical device instance number
265  * @value: reset stats
266  *
267  * Return: QDF_STATUS
268  */
269 static inline QDF_STATUS
270 cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
271 			   uint8_t value)
272 {
273 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
274 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
275 			"%s invalid instance", __func__);
276 		return QDF_STATUS_E_FAILURE;
277 	}
278 
279 	if (soc->ops->ipa_ops->ipa_uc_get_share_stats)
280 		return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id,
281 								 value);
282 
283 	return QDF_STATUS_SUCCESS;
284 }
285 
286 /**
287  * cdp_ipa_uc_set_quota() - set quota limit to FW
288  * @soc - data path soc handle
289  * @pdev_id: physical device instance number
290  * @value: quota limit bytes
291  *
292  * Return: QDF_STATUS
293  */
294 static inline QDF_STATUS
295 cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value)
296 {
297 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
298 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
299 			"%s invalid instance", __func__);
300 		return QDF_STATUS_E_FAILURE;
301 	}
302 
303 	if (soc->ops->ipa_ops->ipa_uc_set_quota)
304 		return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value);
305 
306 	return QDF_STATUS_SUCCESS;
307 }
308 #endif
309 
310 /**
311  * cdp_ipa_enable_autonomy() - Enable autonomy RX data path
312  * @soc: data path soc handle
313  * @pdev_id: physical device instance number
314  *
315  * IPA Data path is enabled and resumed.
316  * All autonomy data path elements are ready to deliver packet
317  * All RX packet should routed to IPA_REO ring, then IPA can receive packet
318  * from WLAN
319  *
320  * Return: QDF_STATUS
321  */
322 static inline QDF_STATUS
323 cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
324 {
325 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
326 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
327 			"%s invalid instance", __func__);
328 		return QDF_STATUS_E_FAILURE;
329 	}
330 
331 	if (soc->ops->ipa_ops->ipa_enable_autonomy)
332 		return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id);
333 
334 	return QDF_STATUS_SUCCESS;
335 }
336 
337 /**
338  * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
339  * @soc: data path soc handle
340  * @pdev_id: physical device instance number
341  *
342  * IPA Data path is enabled and resumed.
343  * All autonomy datapath elements are ready to deliver packet
344  * All RX packet should routed to IPA_REO ring, then IPA can receive packet
345  * from WLAN
346  *
347  * Return: QDF_STATUS
348  */
349 static inline QDF_STATUS
350 cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
351 {
352 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
353 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
354 			"%s invalid instance", __func__);
355 		return QDF_STATUS_E_FAILURE;
356 	}
357 	if (soc->ops->ipa_ops->ipa_disable_autonomy)
358 		return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id);
359 
360 	return QDF_STATUS_SUCCESS;
361 }
362 
363 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
364 	defined(CONFIG_IPA_WDI_UNIFIED_API)
365 
366 /**
367  * cdp_ipa_setup() - Setup and connect IPA pipes
368  * @soc: data path soc handle
369  * @pdev_id: handle to the device instance number
370  * @ipa_i2w_cb: IPA to WLAN callback
371  * @ipa_w2i_cb: WLAN to IPA callback
372  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
373  * @ipa_desc_size: IPA descriptor size
374  * @ipa_priv: handle to the HTT instance
375  * @is_rm_enabled: Is IPA RM enabled or not
376  * @tx_pipe_handle: pointer to Tx pipe handle
377  * @rx_pipe_handle: pointer to Rx pipe handle
378  * @is_smmu_enabled: Is SMMU enabled or not
379  * @sys_in: parameters to setup sys pipe in mcc mode
380  * @over_gsi: Is IPA using GSI
381  *
382  * Return: QDF_STATUS
383  */
384 static inline QDF_STATUS
385 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
386 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
387 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
388 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
389 	      bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in,
390 	      bool over_gsi)
391 {
392 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
393 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
394 			"%s invalid instance", __func__);
395 		return QDF_STATUS_E_FAILURE;
396 	}
397 
398 	if (soc->ops->ipa_ops->ipa_setup)
399 		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
400 						    ipa_w2i_cb,
401 						    ipa_wdi_meter_notifier_cb,
402 						    ipa_desc_size, ipa_priv,
403 						    is_rm_enabled,
404 						    tx_pipe_handle,
405 						    rx_pipe_handle,
406 						    is_smmu_enabled,
407 						    sys_in, over_gsi);
408 
409 	return QDF_STATUS_SUCCESS;
410 }
411 #else /* CONFIG_IPA_WDI_UNIFIED_API */
412 /**
413  * cdp_ipa_setup() - Setup and connect IPA pipes
414  * @soc: data path soc handle
415  * @pdev_id: handle to the device instance number
416  * @ipa_i2w_cb: IPA to WLAN callback
417  * @ipa_w2i_cb: WLAN to IPA callback
418  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
419  * @ipa_desc_size: IPA descriptor size
420  * @ipa_priv: handle to the HTT instance
421  * @is_rm_enabled: Is IPA RM enabled or not
422  * @tx_pipe_handle: pointer to Tx pipe handle
423  * @rx_pipe_handle: pointer to Rx pipe handle
424  *
425  * Return: QDF_STATUS
426  */
427 static inline QDF_STATUS
428 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
429 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
430 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
431 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
432 {
433 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
434 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
435 			"%s invalid instance", __func__);
436 		return QDF_STATUS_E_FAILURE;
437 	}
438 
439 	if (soc->ops->ipa_ops->ipa_setup)
440 		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
441 						    ipa_w2i_cb,
442 						    ipa_wdi_meter_notifier_cb,
443 						    ipa_desc_size, ipa_priv,
444 						    is_rm_enabled,
445 						    tx_pipe_handle,
446 						    rx_pipe_handle);
447 
448 	return QDF_STATUS_SUCCESS;
449 }
450 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
451 
452 /**
453  * cdp_ipa_cleanup() - Disconnect IPA pipes
454  * @soc: data path soc handle
455  * @pdev_id: handle to the device instance number
456  * @tx_pipe_handle: Tx pipe handle
457  * @rx_pipe_handle: Rx pipe handle
458  *
459  * Return: QDF_STATUS
460  */
461 static inline QDF_STATUS
462 cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
463 		uint32_t tx_pipe_handle, uint32_t rx_pipe_handle)
464 {
465 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
466 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
467 			"%s invalid instance", __func__);
468 		return QDF_STATUS_E_FAILURE;
469 	}
470 
471 	if (soc->ops->ipa_ops->ipa_cleanup)
472 		return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id,
473 						      tx_pipe_handle,
474 						      rx_pipe_handle);
475 
476 	return QDF_STATUS_SUCCESS;
477 }
478 
479 /**
480  * cdp_ipa_setup_iface() - Setup IPA header and register interface
481  * @soc: data path soc handle
482  * @ifname: Interface name
483  * @mac_addr: Interface MAC address
484  * @prod_client: IPA prod client type
485  * @cons_client: IPA cons client type
486  * @session_id: Session ID
487  * @is_ipv6_enabled: Is IPV6 enabled or not
488  *
489  * Return: QDF_STATUS
490  */
491 static inline QDF_STATUS
492 cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
493 		    qdf_ipa_client_type_t prod_client,
494 		    qdf_ipa_client_type_t cons_client,
495 		    uint8_t session_id, bool is_ipv6_enabled)
496 {
497 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
498 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
499 			"%s invalid instance", __func__);
500 		return QDF_STATUS_E_FAILURE;
501 	}
502 
503 	if (soc->ops->ipa_ops->ipa_setup_iface)
504 		return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr,
505 							  prod_client,
506 							  cons_client,
507 							  session_id,
508 							  is_ipv6_enabled);
509 
510 	return QDF_STATUS_SUCCESS;
511 }
512 
513 /**
514  * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
515  * @soc: data path soc handle
516  * @ifname: Interface name
517  * @is_ipv6_enabled: Is IPV6 enabled or not
518  *
519  * Return: QDF_STATUS
520  */
521 static inline QDF_STATUS
522 cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
523 		      bool is_ipv6_enabled)
524 {
525 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
526 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
527 			"%s invalid instance", __func__);
528 		return QDF_STATUS_E_FAILURE;
529 	}
530 
531 	if (soc->ops->ipa_ops->ipa_cleanup_iface)
532 		return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
533 							    is_ipv6_enabled);
534 
535 	return QDF_STATUS_SUCCESS;
536 }
537 
538  /**
539  * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
540  * @soc - data path soc handle
541  * @pdev_id - device instance id
542  *
543  * Return: QDF_STATUS
544  */
545 static inline QDF_STATUS
546 cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
547 {
548 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
549 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
550 			"%s invalid instance", __func__);
551 		return QDF_STATUS_E_FAILURE;
552 	}
553 
554 	if (soc->ops->ipa_ops->ipa_enable_pipes)
555 		return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id);
556 
557 	return QDF_STATUS_SUCCESS;
558 }
559 
560 /**
561  * cdp_ipa_uc_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
562  * @soc: data path soc handle
563  * @pdev_id - device instance id
564  *
565  * Return: QDF_STATUS
566  */
567 static inline QDF_STATUS
568 cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id)
569 {
570 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
571 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
572 			"%s invalid instance", __func__);
573 		return QDF_STATUS_E_FAILURE;
574 	}
575 
576 	if (soc->ops->ipa_ops->ipa_disable_pipes)
577 		return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id);
578 
579 	return QDF_STATUS_SUCCESS;
580 }
581 
582 /**
583  * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
584  * @soc: data path soc handle
585  * @client: WLAN Client ID
586  * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
587  *
588  * Return: 0 on success, negative errno on error
589  */
590 static inline QDF_STATUS
591 cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
592 		       uint32_t max_supported_bw_mbps)
593 {
594 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
595 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
596 			"%s invalid instance", __func__);
597 		return QDF_STATUS_E_FAILURE;
598 	}
599 
600 	if (soc->ops->ipa_ops->ipa_set_perf_level)
601 		return soc->ops->ipa_ops->ipa_set_perf_level(client,
602 				max_supported_bw_mbps);
603 
604 	return QDF_STATUS_SUCCESS;
605 }
606 
607 /**
608  * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
609  *
610  * @soc: data path soc handle
611  * @vdev_id: vdev id
612  * @nbuf: pointer to skb of ethernet packet received from IPA RX path
613  * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
614  *
615  * This function performs intra-bss forwarding for WDI 3.0 IPA RX path.
616  *
617  * Return: true if packet is intra-bss fwd-ed and no need to pass to
618  *	   network stack. false if packet needs to be passed to network stack.
619  */
620 static inline bool
621 cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
622 			qdf_nbuf_t nbuf, bool *fwd_success)
623 {
624 	if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) {
625 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
626 			  "%s invalid instance", __func__);
627 		return QDF_STATUS_E_FAILURE;
628 	}
629 
630 	if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd)
631 		return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id,
632 							      nbuf,
633 							      fwd_success);
634 
635 	/* Fall back to pass up to stack */
636 	return false;
637 }
638 
639 /**
640  * cdp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for Tx
641  *				   buffers allocated to IPA
642  * @soc: data path soc handle
643  * @pdev_id: device instance id
644  *
645  * Create SMMU mappings for Tx buffers allocated to IPA
646  *
647  * return QDF_STATUS_SUCCESS
648  */
649 static inline QDF_STATUS
650 cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
651 {
652 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
653 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
654 			  "%s invalid instance", __func__);
655 		return QDF_STATUS_E_FAILURE;
656 	}
657 
658 	if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping)
659 		return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id);
660 
661 	return QDF_STATUS_SUCCESS;
662 }
663 
664 /**
665  * cdp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for Tx
666  *				     buffers allocated to IPA
667  * @soc: data path soc handle
668  * @pdev_id: device instance id
669  *
670  * Release SMMU mappings for Tx buffers allocated to IPA
671  *
672  * return QDF_STATUS_SUCCESS
673  */
674 static inline QDF_STATUS
675 cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id)
676 {
677 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
678 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
679 			  "%s invalid instance", __func__);
680 		return QDF_STATUS_E_FAILURE;
681 	}
682 
683 	if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping)
684 		return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc,
685 								    pdev_id);
686 
687 	return QDF_STATUS_SUCCESS;
688 }
689 #endif /* IPA_OFFLOAD */
690 
691 #endif /* _CDP_TXRX_IPA_H_ */
692 
693