xref: /wlan-driver/qca-wifi-host-cmn/dp/inc/cdp_txrx_ipa.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: cdp_txrx_ipa.h
22  *      Define the host data path IP Acceleraor API functions
23  */
24 #ifndef _CDP_TXRX_IPA_H_
25 #define _CDP_TXRX_IPA_H_
26 
27 #ifdef IPA_OFFLOAD
28 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
29 	defined(CONFIG_IPA_WDI_UNIFIED_API)
30 #include <qdf_ipa_wdi3.h>
31 #else
32 #include <qdf_ipa.h>
33 #endif
34 #include <cdp_txrx_cmn.h>
35 #include "cdp_txrx_handle.h"
36 #ifdef IPA_OPT_WIFI_DP
37 #include <target_if.h>
38 #endif
39 
40 /**
41  * cdp_ipa_get_resource() - Get allocated WLAN resources for IPA data path
42  * @soc: data path soc handle
43  * @pdev_id: device instance id
44  *
45  * Get allocated WLAN resources for IPA data path
46  *
47  * return QDF_STATUS_SUCCESS
48  */
49 static inline QDF_STATUS
cdp_ipa_get_resource(ol_txrx_soc_handle soc,uint8_t pdev_id)50 cdp_ipa_get_resource(ol_txrx_soc_handle soc, uint8_t pdev_id)
51 {
52 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
53 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
54 			"%s invalid instance", __func__);
55 		return QDF_STATUS_E_FAILURE;
56 	}
57 
58 	if (soc->ops->ipa_ops->ipa_get_resource)
59 		return soc->ops->ipa_ops->ipa_get_resource(soc, pdev_id);
60 
61 	return QDF_STATUS_SUCCESS;
62 }
63 
64 /**
65  * cdp_ipa_set_doorbell_paddr() - give IPA db paddr to FW
66  * @soc: data path soc handle
67  * @pdev_id: device instance id
68  *
69  * give IPA db paddr to FW
70  *
71  * return QDF_STATUS_SUCCESS
72  */
73 static inline QDF_STATUS
cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc,uint8_t pdev_id)74 cdp_ipa_set_doorbell_paddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
75 {
76 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
77 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
78 			"%s invalid instance", __func__);
79 		return QDF_STATUS_E_FAILURE;
80 	}
81 
82 	if (soc->ops->ipa_ops->ipa_set_doorbell_paddr)
83 		return soc->ops->ipa_ops->ipa_set_doorbell_paddr(soc, pdev_id);
84 
85 	return QDF_STATUS_SUCCESS;
86 }
87 
88 /**
89  * cdp_ipa_iounmap_doorbell_vaddr() - unmap IPA RX db vaddr
90  * @soc: data path soc handle
91  * @pdev_id: device instance id
92  *
93  * Unmap IPA RX db vaddr
94  *
95  * return QDF_STATUS_SUCCESS
96  */
97 static inline QDF_STATUS
cdp_ipa_iounmap_doorbell_vaddr(ol_txrx_soc_handle soc,uint8_t pdev_id)98 cdp_ipa_iounmap_doorbell_vaddr(ol_txrx_soc_handle soc, uint8_t pdev_id)
99 {
100 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
101 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
102 			 "%s invalid instance", __func__);
103 		return QDF_STATUS_E_FAILURE;
104 	}
105 
106 	if (soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr)
107 		return soc->ops->ipa_ops->ipa_iounmap_doorbell_vaddr(
108 					soc, pdev_id);
109 
110 	return QDF_STATUS_SUCCESS;
111 }
112 
113 /**
114  * cdp_ipa_set_active() - activate/de-ctivate IPA offload path
115  * @soc: data path soc handle
116  * @pdev_id: device instance id
117  * @uc_active: activate or de-activate
118  * @is_tx: toggle tx or rx data path
119  *
120  * activate/de-ctivate IPA offload path
121  *
122  * return QDF_STATUS_SUCCESS
123  */
124 static inline QDF_STATUS
cdp_ipa_set_active(ol_txrx_soc_handle soc,uint8_t pdev_id,bool uc_active,bool is_tx)125 cdp_ipa_set_active(ol_txrx_soc_handle soc, uint8_t pdev_id, bool uc_active,
126 		   bool is_tx)
127 {
128 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
129 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
130 			"%s invalid instance", __func__);
131 		return QDF_STATUS_E_FAILURE;
132 	}
133 
134 	if (soc->ops->ipa_ops->ipa_set_active)
135 		return soc->ops->ipa_ops->ipa_set_active(soc, pdev_id,
136 				uc_active, is_tx);
137 
138 	return QDF_STATUS_SUCCESS;
139 }
140 
141 /**
142  * cdp_ipa_op_response() - event handler from FW
143  * @soc: data path soc handle
144  * @pdev_id: device instance id
145  * @op_msg: event contents from firmware
146  *
147  * event handler from FW
148  *
149  * return QDF_STATUS_SUCCESS
150  */
151 static inline QDF_STATUS
cdp_ipa_op_response(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t * op_msg)152 cdp_ipa_op_response(ol_txrx_soc_handle soc, uint8_t pdev_id, uint8_t *op_msg)
153 {
154 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
155 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
156 			"%s invalid instance", __func__);
157 		return QDF_STATUS_E_FAILURE;
158 	}
159 
160 	if (soc->ops->ipa_ops->ipa_op_response)
161 		return soc->ops->ipa_ops->ipa_op_response(soc, pdev_id, op_msg);
162 
163 	return QDF_STATUS_SUCCESS;
164 }
165 
166 /**
167  * cdp_ipa_register_op_cb() - register event handler function pointer
168  * @soc: data path soc handle
169  * @pdev_id: device instance id
170  * @op_cb: event handler callback function pointer
171  * @usr_ctxt: user context to registered
172  *
173  * register event handler function pointer
174  *
175  * return QDF_STATUS_SUCCESS
176  */
177 static inline QDF_STATUS
cdp_ipa_register_op_cb(ol_txrx_soc_handle soc,uint8_t pdev_id,ipa_uc_op_cb_type op_cb,void * usr_ctxt)178 cdp_ipa_register_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id,
179 		       ipa_uc_op_cb_type op_cb, void *usr_ctxt)
180 {
181 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
182 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
183 			"%s invalid instance", __func__);
184 		return QDF_STATUS_E_FAILURE;
185 	}
186 
187 	if (soc->ops->ipa_ops->ipa_register_op_cb)
188 		return soc->ops->ipa_ops->ipa_register_op_cb(soc, pdev_id,
189 							     op_cb, usr_ctxt);
190 
191 	return QDF_STATUS_SUCCESS;
192 }
193 
194 /**
195  * cdp_ipa_deregister_op_cb() - deregister event handler function pointer
196  * @soc: data path soc handle
197  * @pdev_id: device instance id
198  *
199  * Deregister event handler function pointer from pdev
200  *
201  * return QDF_STATUS_SUCCESS
202  */
203 static inline
cdp_ipa_deregister_op_cb(ol_txrx_soc_handle soc,uint8_t pdev_id)204 void cdp_ipa_deregister_op_cb(ol_txrx_soc_handle soc, uint8_t pdev_id)
205 {
206 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
207 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
208 			  "%s invalid instance", __func__);
209 		return;
210 	}
211 
212 	if (soc->ops->ipa_ops->ipa_deregister_op_cb)
213 		soc->ops->ipa_ops->ipa_deregister_op_cb(soc, pdev_id);
214 }
215 
216 /**
217  * cdp_ipa_get_stat() - get IPA data path stats from FW
218  * @soc: data path soc handle
219  * @pdev_id: device instance id
220  *
221  * get IPA data path stats from FW async
222  *
223  * return QDF_STATUS_SUCCESS
224  */
225 static inline QDF_STATUS
cdp_ipa_get_stat(ol_txrx_soc_handle soc,uint8_t pdev_id)226 cdp_ipa_get_stat(ol_txrx_soc_handle soc, uint8_t pdev_id)
227 {
228 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
229 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
230 			"%s invalid instance", __func__);
231 		return QDF_STATUS_E_FAILURE;
232 	}
233 
234 	if (soc->ops->ipa_ops->ipa_get_stat)
235 		return soc->ops->ipa_ops->ipa_get_stat(soc, pdev_id);
236 
237 	return QDF_STATUS_SUCCESS;
238 }
239 
240 /**
241  * cdp_ipa_tx_send_data_frame() - send IPA data frame
242  * @soc: data path soc handle
243  * @vdev_id: vdev id
244  * @skb: skb
245  *
246  * Return: skb/ NULL is for success
247  */
cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t skb)248 static inline qdf_nbuf_t cdp_ipa_tx_send_data_frame(ol_txrx_soc_handle soc,
249 						    uint8_t vdev_id,
250 						    qdf_nbuf_t skb)
251 {
252 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
253 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
254 			"%s invalid instance", __func__);
255 		return skb;
256 	}
257 
258 	if (soc->ops->ipa_ops->ipa_tx_data_frame)
259 		return soc->ops->ipa_ops->ipa_tx_data_frame(soc, vdev_id, skb);
260 
261 	return skb;
262 }
263 
264 /**
265  * cdp_ipa_set_uc_tx_partition_base() - set tx packet partition base
266  * @soc: data path soc handle
267  * @cfg_pdev: physical device instance config
268  * @value: partition base value
269  *
270  * Return: QDF_STATUS
271  */
272 static inline QDF_STATUS
cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,struct cdp_cfg * cfg_pdev,uint32_t value)273 cdp_ipa_set_uc_tx_partition_base(ol_txrx_soc_handle soc,
274 				struct cdp_cfg *cfg_pdev, uint32_t value)
275 {
276 	if (!soc || !soc->ops || !soc->ops->ipa_ops || !cfg_pdev) {
277 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
278 			"%s invalid instance", __func__);
279 		return QDF_STATUS_E_FAILURE;
280 	}
281 
282 	if (soc->ops->ipa_ops->ipa_set_uc_tx_partition_base)
283 		soc->ops->ipa_ops->ipa_set_uc_tx_partition_base(cfg_pdev,
284 								value);
285 
286 	return QDF_STATUS_SUCCESS;
287 }
288 
289 #ifdef FEATURE_METERING
290 /**
291  * cdp_ipa_uc_get_share_stats() - get Tx/Rx byte stats from FW
292  * @soc: data path soc handle
293  * @pdev_id: physical device instance number
294  * @value: reset stats
295  *
296  * Return: QDF_STATUS
297  */
298 static inline QDF_STATUS
cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc,uint8_t pdev_id,uint8_t value)299 cdp_ipa_uc_get_share_stats(ol_txrx_soc_handle soc, uint8_t pdev_id,
300 			   uint8_t value)
301 {
302 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
303 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
304 			"%s invalid instance", __func__);
305 		return QDF_STATUS_E_FAILURE;
306 	}
307 
308 	if (soc->ops->ipa_ops->ipa_uc_get_share_stats)
309 		return soc->ops->ipa_ops->ipa_uc_get_share_stats(soc, pdev_id,
310 								 value);
311 
312 	return QDF_STATUS_SUCCESS;
313 }
314 
315 /**
316  * cdp_ipa_uc_set_quota() - set quota limit to FW
317  * @soc: data path soc handle
318  * @pdev_id: physical device instance number
319  * @value: quota limit bytes
320  *
321  * Return: QDF_STATUS
322  */
323 static inline QDF_STATUS
cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc,uint8_t pdev_id,uint64_t value)324 cdp_ipa_uc_set_quota(ol_txrx_soc_handle soc, uint8_t pdev_id, uint64_t value)
325 {
326 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
327 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
328 			"%s invalid instance", __func__);
329 		return QDF_STATUS_E_FAILURE;
330 	}
331 
332 	if (soc->ops->ipa_ops->ipa_uc_set_quota)
333 		return soc->ops->ipa_ops->ipa_uc_set_quota(soc, pdev_id, value);
334 
335 	return QDF_STATUS_SUCCESS;
336 }
337 #endif
338 
339 /**
340  * cdp_ipa_enable_autonomy() - Enable autonomy RX data path
341  * @soc: data path soc handle
342  * @pdev_id: physical device instance number
343  *
344  * IPA Data path is enabled and resumed.
345  * All autonomy data path elements are ready to deliver packet
346  * All RX packet should routed to IPA_REO ring, then IPA can receive packet
347  * from WLAN
348  *
349  * Return: QDF_STATUS
350  */
351 static inline QDF_STATUS
cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc,uint8_t pdev_id)352 cdp_ipa_enable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
353 {
354 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
355 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
356 			"%s invalid instance", __func__);
357 		return QDF_STATUS_E_FAILURE;
358 	}
359 
360 	if (soc->ops->ipa_ops->ipa_enable_autonomy)
361 		return soc->ops->ipa_ops->ipa_enable_autonomy(soc, pdev_id);
362 
363 	return QDF_STATUS_SUCCESS;
364 }
365 
366 /**
367  * cdp_ipa_disable_autonomy() - Disable autonomy RX data path
368  * @soc: data path soc handle
369  * @pdev_id: physical device instance number
370  *
371  * IPA Data path is enabled and resumed.
372  * All autonomy datapath elements are ready to deliver packet
373  * All RX packet should routed to IPA_REO ring, then IPA can receive packet
374  * from WLAN
375  *
376  * Return: QDF_STATUS
377  */
378 static inline QDF_STATUS
cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc,uint8_t pdev_id)379 cdp_ipa_disable_autonomy(ol_txrx_soc_handle soc, uint8_t pdev_id)
380 {
381 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
382 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
383 			"%s invalid instance", __func__);
384 		return QDF_STATUS_E_FAILURE;
385 	}
386 	if (soc->ops->ipa_ops->ipa_disable_autonomy)
387 		return soc->ops->ipa_ops->ipa_disable_autonomy(soc, pdev_id);
388 
389 	return QDF_STATUS_SUCCESS;
390 }
391 
392 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || \
393 	defined(CONFIG_IPA_WDI_UNIFIED_API)
394 
395 /**
396  * cdp_ipa_setup() - Setup and connect IPA pipes
397  * @soc: data path soc handle
398  * @pdev_id: handle to the device instance number
399  * @ipa_i2w_cb: IPA to WLAN callback
400  * @ipa_w2i_cb: WLAN to IPA callback
401  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
402  * @ipa_desc_size: IPA descriptor size
403  * @ipa_priv: handle to the HTT instance
404  * @is_rm_enabled: Is IPA RM enabled or not
405  * @tx_pipe_handle: pointer to Tx pipe handle
406  * @rx_pipe_handle: pointer to Rx pipe handle
407  * @is_smmu_enabled: Is SMMU enabled or not
408  * @sys_in: parameters to setup sys pipe in mcc mode
409  * @over_gsi: Is IPA using GSI
410  * @hdl: IPA handle
411  * @id: IPA instance id
412  * @ipa_ast_notify_cb: IPA to WLAN callback for ast create
413  *
414  * Return: QDF_STATUS
415  */
416 static inline QDF_STATUS
cdp_ipa_setup(ol_txrx_soc_handle soc,uint8_t pdev_id,void * ipa_i2w_cb,void * ipa_w2i_cb,void * ipa_wdi_meter_notifier_cb,uint32_t ipa_desc_size,void * ipa_priv,bool is_rm_enabled,uint32_t * tx_pipe_handle,uint32_t * rx_pipe_handle,bool is_smmu_enabled,qdf_ipa_sys_connect_params_t * sys_in,bool over_gsi,qdf_ipa_wdi_hdl_t hdl,qdf_ipa_wdi_hdl_t id,void * ipa_ast_notify_cb)417 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
418 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
419 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
420 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle,
421 	      bool is_smmu_enabled, qdf_ipa_sys_connect_params_t *sys_in,
422 	      bool over_gsi, qdf_ipa_wdi_hdl_t hdl, qdf_ipa_wdi_hdl_t id,
423 	      void *ipa_ast_notify_cb)
424 {
425 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
426 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
427 			"%s invalid instance", __func__);
428 		return QDF_STATUS_E_FAILURE;
429 	}
430 
431 	if (soc->ops->ipa_ops->ipa_setup)
432 		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
433 						    ipa_w2i_cb,
434 						    ipa_wdi_meter_notifier_cb,
435 						    ipa_desc_size, ipa_priv,
436 						    is_rm_enabled,
437 						    tx_pipe_handle,
438 						    rx_pipe_handle,
439 						    is_smmu_enabled,
440 						    sys_in, over_gsi, hdl, id,
441 						    ipa_ast_notify_cb);
442 
443 	return QDF_STATUS_SUCCESS;
444 }
445 #else /* CONFIG_IPA_WDI_UNIFIED_API */
446 /**
447  * cdp_ipa_setup() - Setup and connect IPA pipes
448  * @soc: data path soc handle
449  * @pdev_id: handle to the device instance number
450  * @ipa_i2w_cb: IPA to WLAN callback
451  * @ipa_w2i_cb: WLAN to IPA callback
452  * @ipa_wdi_meter_notifier_cb: IPA WDI metering callback
453  * @ipa_desc_size: IPA descriptor size
454  * @ipa_priv: handle to the HTT instance
455  * @is_rm_enabled: Is IPA RM enabled or not
456  * @tx_pipe_handle: pointer to Tx pipe handle
457  * @rx_pipe_handle: pointer to Rx pipe handle
458  *
459  * Return: QDF_STATUS
460  */
461 static inline QDF_STATUS
cdp_ipa_setup(ol_txrx_soc_handle soc,uint8_t pdev_id,void * ipa_i2w_cb,void * ipa_w2i_cb,void * ipa_wdi_meter_notifier_cb,uint32_t ipa_desc_size,void * ipa_priv,bool is_rm_enabled,uint32_t * tx_pipe_handle,uint32_t * rx_pipe_handle)462 cdp_ipa_setup(ol_txrx_soc_handle soc, uint8_t pdev_id, void *ipa_i2w_cb,
463 	      void *ipa_w2i_cb, void *ipa_wdi_meter_notifier_cb,
464 	      uint32_t ipa_desc_size, void *ipa_priv, bool is_rm_enabled,
465 	      uint32_t *tx_pipe_handle, uint32_t *rx_pipe_handle)
466 {
467 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
468 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
469 			"%s invalid instance", __func__);
470 		return QDF_STATUS_E_FAILURE;
471 	}
472 
473 	if (soc->ops->ipa_ops->ipa_setup)
474 		return soc->ops->ipa_ops->ipa_setup(soc, pdev_id, ipa_i2w_cb,
475 						    ipa_w2i_cb,
476 						    ipa_wdi_meter_notifier_cb,
477 						    ipa_desc_size, ipa_priv,
478 						    is_rm_enabled,
479 						    tx_pipe_handle,
480 						    rx_pipe_handle);
481 
482 	return QDF_STATUS_SUCCESS;
483 }
484 #endif /* CONFIG_IPA_WDI_UNIFIED_API */
485 
486 /**
487  * cdp_ipa_cleanup() - Disconnect IPA pipes
488  * @soc: data path soc handle
489  * @pdev_id: handle to the device instance number
490  * @tx_pipe_handle: Tx pipe handle
491  * @rx_pipe_handle: Rx pipe handle
492  * @hdl: IPA handle
493  *
494  * Return: QDF_STATUS
495  */
496 static inline QDF_STATUS
cdp_ipa_cleanup(ol_txrx_soc_handle soc,uint8_t pdev_id,uint32_t tx_pipe_handle,uint32_t rx_pipe_handle,qdf_ipa_wdi_hdl_t hdl)497 cdp_ipa_cleanup(ol_txrx_soc_handle soc, uint8_t pdev_id,
498 		uint32_t tx_pipe_handle, uint32_t rx_pipe_handle,
499 		qdf_ipa_wdi_hdl_t hdl)
500 {
501 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
502 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
503 			"%s invalid instance", __func__);
504 		return QDF_STATUS_E_FAILURE;
505 	}
506 
507 	if (soc->ops->ipa_ops->ipa_cleanup)
508 		return soc->ops->ipa_ops->ipa_cleanup(soc, pdev_id,
509 						      tx_pipe_handle,
510 						      rx_pipe_handle, hdl);
511 
512 	return QDF_STATUS_SUCCESS;
513 }
514 
515 /**
516  * cdp_ipa_setup_iface() - Setup IPA header and register interface
517  * @soc: data path soc handle
518  * @ifname: Interface name
519  * @mac_addr: Interface MAC address
520  * @prod_client: IPA prod client type
521  * @cons_client: IPA cons client type
522  * @session_id: Session ID
523  * @is_ipv6_enabled: Is IPV6 enabled or not
524  * @hdl: IPA handle
525  *
526  * Return: QDF_STATUS
527  */
528 static inline QDF_STATUS
cdp_ipa_setup_iface(ol_txrx_soc_handle soc,char * ifname,uint8_t * mac_addr,qdf_ipa_client_type_t prod_client,qdf_ipa_client_type_t cons_client,uint8_t session_id,bool is_ipv6_enabled,qdf_ipa_wdi_hdl_t hdl)529 cdp_ipa_setup_iface(ol_txrx_soc_handle soc, char *ifname, uint8_t *mac_addr,
530 		    qdf_ipa_client_type_t prod_client,
531 		    qdf_ipa_client_type_t cons_client,
532 		    uint8_t session_id, bool is_ipv6_enabled,
533 		    qdf_ipa_wdi_hdl_t hdl)
534 {
535 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
536 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
537 			"%s invalid instance", __func__);
538 		return QDF_STATUS_E_FAILURE;
539 	}
540 
541 	if (soc->ops->ipa_ops->ipa_setup_iface)
542 		return soc->ops->ipa_ops->ipa_setup_iface(ifname, mac_addr,
543 							  prod_client,
544 							  cons_client,
545 							  session_id,
546 							  is_ipv6_enabled,
547 							  hdl);
548 
549 	return QDF_STATUS_SUCCESS;
550 }
551 
552 /**
553  * cdp_ipa_cleanup_iface() - Cleanup IPA header and deregister interface
554  * @soc: data path soc handle
555  * @ifname: Interface name
556  * @is_ipv6_enabled: Is IPV6 enabled or not
557  * @hdl: IPA handle
558  *
559  * Return: QDF_STATUS
560  */
561 static inline QDF_STATUS
cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc,char * ifname,bool is_ipv6_enabled,qdf_ipa_wdi_hdl_t hdl)562 cdp_ipa_cleanup_iface(ol_txrx_soc_handle soc, char *ifname,
563 		      bool is_ipv6_enabled, qdf_ipa_wdi_hdl_t hdl)
564 {
565 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
566 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
567 			"%s invalid instance", __func__);
568 		return QDF_STATUS_E_FAILURE;
569 	}
570 
571 	if (soc->ops->ipa_ops->ipa_cleanup_iface)
572 		return soc->ops->ipa_ops->ipa_cleanup_iface(ifname,
573 							    is_ipv6_enabled,
574 							    hdl);
575 
576 	return QDF_STATUS_SUCCESS;
577 }
578 
579  /**
580  * cdp_ipa_uc_enable_pipes() - Enable and resume traffic on Tx/Rx pipes
581  * @soc: data path soc handle
582  * @pdev_id: device instance id
583  * @hdl: IPA handle
584  *
585  * Return: QDF_STATUS
586  */
587 static inline QDF_STATUS
cdp_ipa_enable_pipes(ol_txrx_soc_handle soc,uint8_t pdev_id,qdf_ipa_wdi_hdl_t hdl)588 cdp_ipa_enable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
589 		     qdf_ipa_wdi_hdl_t hdl)
590 {
591 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
592 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
593 			"%s invalid instance", __func__);
594 		return QDF_STATUS_E_FAILURE;
595 	}
596 
597 	if (soc->ops->ipa_ops->ipa_enable_pipes)
598 		return soc->ops->ipa_ops->ipa_enable_pipes(soc, pdev_id, hdl);
599 
600 	return QDF_STATUS_SUCCESS;
601 }
602 
603 /**
604  * cdp_ipa_disable_pipes() - Suspend traffic and disable Tx/Rx pipes
605  * @soc: data path soc handle
606  * @pdev_id: device instance id
607  * @hdl: IPA handle
608  *
609  * Return: QDF_STATUS
610  */
611 static inline QDF_STATUS
cdp_ipa_disable_pipes(ol_txrx_soc_handle soc,uint8_t pdev_id,qdf_ipa_wdi_hdl_t hdl)612 cdp_ipa_disable_pipes(ol_txrx_soc_handle soc, uint8_t pdev_id,
613 		      qdf_ipa_wdi_hdl_t hdl)
614 {
615 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
616 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
617 			"%s invalid instance", __func__);
618 		return QDF_STATUS_E_FAILURE;
619 	}
620 
621 	if (soc->ops->ipa_ops->ipa_disable_pipes)
622 		return soc->ops->ipa_ops->ipa_disable_pipes(soc, pdev_id, hdl);
623 
624 	return QDF_STATUS_SUCCESS;
625 }
626 
627 /**
628  * cdp_ipa_set_perf_level() - Set IPA clock bandwidth based on data rates
629  * @soc: data path soc handle
630  * @client: WLAN Client ID
631  * @max_supported_bw_mbps: Maximum bandwidth needed (in Mbps)
632  * @hdl: IPA handle
633  *
634  * Return: 0 on success, negative errno on error
635  */
636 static inline QDF_STATUS
cdp_ipa_set_perf_level(ol_txrx_soc_handle soc,int client,uint32_t max_supported_bw_mbps,qdf_ipa_wdi_hdl_t hdl)637 cdp_ipa_set_perf_level(ol_txrx_soc_handle soc, int client,
638 		       uint32_t max_supported_bw_mbps, qdf_ipa_wdi_hdl_t hdl)
639 {
640 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
641 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
642 			"%s invalid instance", __func__);
643 		return QDF_STATUS_E_FAILURE;
644 	}
645 
646 	if (soc->ops->ipa_ops->ipa_set_perf_level)
647 		return soc->ops->ipa_ops->ipa_set_perf_level(client,
648 				max_supported_bw_mbps, hdl);
649 
650 	return QDF_STATUS_SUCCESS;
651 }
652 
653 #ifdef QCA_SUPPORT_WDS_EXTENDED
654 /**
655  * cdp_ipa_rx_wdsext_iface() - Forward RX exception packets to wdsext interface
656  * @soc: data path soc handle
657  * @peer_id: Peer id to get respective peer
658  * @skb: socket buffer
659  *
660  * Return: true if packets sent to wds ext interface, else false.
661  */
662 static inline bool
cdp_ipa_rx_wdsext_iface(ol_txrx_soc_handle soc,uint8_t peer_id,qdf_nbuf_t skb)663 cdp_ipa_rx_wdsext_iface(ol_txrx_soc_handle soc, uint8_t peer_id,
664 			qdf_nbuf_t skb)
665 {
666 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
667 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
668 			  "%s invalid instance", __func__);
669 		return false;
670 	}
671 
672 	if (soc->ops->ipa_ops->ipa_rx_wdsext_iface)
673 		return soc->ops->ipa_ops->ipa_rx_wdsext_iface(soc, peer_id,
674 							      skb);
675 
676 	return false;
677 }
678 #endif
679 
680 /**
681  * cdp_ipa_rx_intrabss_fwd() - Perform intra-bss fwd for IPA RX path
682  *
683  * @soc: data path soc handle
684  * @vdev_id: vdev id
685  * @nbuf: pointer to skb of ethernet packet received from IPA RX path
686  * @fwd_success: pointer to indicate if skb succeeded in intra-bss TX
687  *
688  * This function performs intra-bss forwarding for WDI 3.0 IPA RX path.
689  *
690  * Return: true if packet is intra-bss fwd-ed and no need to pass to
691  *	   network stack. false if packet needs to be passed to network stack.
692  */
693 static inline bool
cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc,uint8_t vdev_id,qdf_nbuf_t nbuf,bool * fwd_success)694 cdp_ipa_rx_intrabss_fwd(ol_txrx_soc_handle soc, uint8_t vdev_id,
695 			qdf_nbuf_t nbuf, bool *fwd_success)
696 {
697 	if (!soc || !soc->ops || !soc->ops->ipa_ops || !fwd_success) {
698 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
699 			  "%s invalid instance", __func__);
700 		return QDF_STATUS_E_FAILURE;
701 	}
702 
703 	if (soc->ops->ipa_ops->ipa_rx_intrabss_fwd)
704 		return soc->ops->ipa_ops->ipa_rx_intrabss_fwd(soc, vdev_id,
705 							      nbuf,
706 							      fwd_success);
707 
708 	/* Fall back to pass up to stack */
709 	return false;
710 }
711 
712 /**
713  * cdp_ipa_tx_buf_smmu_mapping() - Create SMMU mappings for Tx
714  *				   buffers allocated to IPA
715  * @soc: data path soc handle
716  * @pdev_id: device instance id
717  * @line: line number
718  * @func: function name
719  *
720  * Create SMMU mappings for Tx buffers allocated to IPA
721  *
722  * return QDF_STATUS_SUCCESS
723  */
724 static inline QDF_STATUS
cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc,uint8_t pdev_id,const char * func,uint32_t line)725 cdp_ipa_tx_buf_smmu_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id,
726 			    const char *func, uint32_t line)
727 {
728 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
729 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
730 			  "%s invalid instance", __func__);
731 		return QDF_STATUS_E_FAILURE;
732 	}
733 
734 	if (soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping)
735 		return soc->ops->ipa_ops->ipa_tx_buf_smmu_mapping(soc, pdev_id,
736 								  func,
737 								  line);
738 
739 	return QDF_STATUS_SUCCESS;
740 }
741 
742 /**
743  * cdp_ipa_tx_buf_smmu_unmapping() - Release SMMU mappings for Tx
744  *				     buffers allocated to IPA
745  * @soc: data path soc handle
746  * @pdev_id: device instance id
747  * @line: line number
748  * @func: function name
749  *
750  * Release SMMU mappings for Tx buffers allocated to IPA
751  *
752  * return QDF_STATUS_SUCCESS
753  */
754 static inline QDF_STATUS
cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc,uint8_t pdev_id,const char * func,uint32_t line)755 cdp_ipa_tx_buf_smmu_unmapping(ol_txrx_soc_handle soc, uint8_t pdev_id,
756 			      const char *func, uint32_t line)
757 {
758 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
759 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
760 			  "%s invalid instance", __func__);
761 		return QDF_STATUS_E_FAILURE;
762 	}
763 
764 	if (soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping)
765 		return soc->ops->ipa_ops->ipa_tx_buf_smmu_unmapping(soc,
766 								    pdev_id,
767 								    func,
768 								    line);
769 
770 	return QDF_STATUS_SUCCESS;
771 }
772 
773 /**
774  * cdp_ipa_rx_buf_smmu_pool_mapping() - Create SMMU mappings for Rx pool
775  * @soc: data path soc handle
776  * @pdev_id: pdev id
777  * @create: Map/unmap
778  * @line: line number
779  * @func: function name
780  *
781  * Create SMMU map/unmap for Rx buffers allocated to IPA
782  *
783  * return QDF_STATUS_SUCCESS
784  */
785 static inline QDF_STATUS
cdp_ipa_rx_buf_smmu_pool_mapping(ol_txrx_soc_handle soc,uint8_t pdev_id,bool create,const char * func,uint32_t line)786 cdp_ipa_rx_buf_smmu_pool_mapping(ol_txrx_soc_handle soc, uint8_t pdev_id,
787 				 bool create, const char *func, uint32_t line)
788 {
789 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
790 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
791 			  "%s invalid instance", __func__);
792 		return QDF_STATUS_E_FAILURE;
793 	}
794 
795 	if (soc->ops->ipa_ops->ipa_rx_buf_smmu_pool_mapping)
796 		return soc->ops->ipa_ops->ipa_rx_buf_smmu_pool_mapping(soc,
797 						pdev_id, create, func, line);
798 
799 	return QDF_STATUS_SUCCESS;
800 }
801 
cdp_ipa_set_smmu_mapped(ol_txrx_soc_handle soc,int val)802 static inline QDF_STATUS cdp_ipa_set_smmu_mapped(ol_txrx_soc_handle soc,
803 						 int val)
804 {
805 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
806 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
807 			  "%s invalid instance", __func__);
808 		return QDF_STATUS_E_FAILURE;
809 	}
810 
811 	if (soc->ops->ipa_ops->ipa_set_smmu_mapped)
812 		return soc->ops->ipa_ops->ipa_set_smmu_mapped(soc, val);
813 
814 	return QDF_STATUS_SUCCESS;
815 }
816 
cdp_ipa_get_smmu_mapped(ol_txrx_soc_handle soc)817 static inline int cdp_ipa_get_smmu_mapped(ol_txrx_soc_handle soc)
818 {
819 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
820 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
821 			  "%s invalid instance", __func__);
822 		return QDF_STATUS_E_FAILURE;
823 	}
824 
825 	if (soc->ops->ipa_ops->ipa_get_smmu_mapped)
826 		return soc->ops->ipa_ops->ipa_get_smmu_mapped(soc);
827 
828 	return QDF_STATUS_SUCCESS;
829 }
830 
831 #ifdef IPA_WDS_EASYMESH_FEATURE
832 /**
833  * cdp_ipa_ast_create() - Create/update AST entry in AST table
834  *			  for learning/roaming packets from IPA
835  * @soc: data path soc handle
836  * @data: Structure used for updating the AST table
837  *
838  * Create/update AST entry in AST table for learning/roaming packets from IPA
839  *
840  * Return: QDF_STATUS
841  */
842 static inline QDF_STATUS
cdp_ipa_ast_create(ol_txrx_soc_handle soc,qdf_ipa_ast_info_type_t * data)843 cdp_ipa_ast_create(ol_txrx_soc_handle soc, qdf_ipa_ast_info_type_t *data)
844 {
845 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
846 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
847 			  "%s invalid instance", __func__);
848 		return QDF_STATUS_E_FAILURE;
849 	}
850 
851 	if (soc->ops->ipa_ops->ipa_ast_create)
852 		return soc->ops->ipa_ops->ipa_ast_create(soc, data);
853 
854 	return QDF_STATUS_SUCCESS;
855 }
856 #endif
857 
858 #ifdef IPA_OPT_WIFI_DP
859 /*
860  * cdp_ipa_pcie_link_up() - Send request to hold PCIe link in L0
861  * @soc - cdp soc handle
862  *
863  * Return: 0 for success, negative for failure
864  */
865 static inline int
cdp_ipa_pcie_link_up(ol_txrx_soc_handle soc)866 cdp_ipa_pcie_link_up(ol_txrx_soc_handle soc)
867 {
868 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
869 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
870 			  "%s invalid instance", __func__);
871 		return QDF_STATUS_E_FAILURE;
872 	}
873 
874 	if (soc->ops->ipa_ops->ipa_pcie_link_up)
875 		return soc->ops->ipa_ops->ipa_pcie_link_up(soc);
876 
877 	return QDF_STATUS_SUCCESS;
878 }
879 
880 /*
881  * cdp_ipa_pcie_link_down() - Release request to hold PCIe link in L0
882  * @soc - cdp soc handle
883  *
884  * Return: 0 for success, negative for failure
885  */
886 static inline int
cdp_ipa_pcie_link_down(ol_txrx_soc_handle soc)887 cdp_ipa_pcie_link_down(ol_txrx_soc_handle soc)
888 {
889 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
890 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
891 			  "%s invalid instance", __func__);
892 		return QDF_STATUS_E_FAILURE;
893 	}
894 
895 	if (soc->ops->ipa_ops->ipa_pcie_link_down)
896 		soc->ops->ipa_ops->ipa_pcie_link_down(soc);
897 
898 	return QDF_STATUS_SUCCESS;
899 }
900 #endif
901 
902 /**
903  * cdp_ipa_update_peer_rx_stats() - update peer rx stats
904  * @soc: data path soc handle
905  * @vdev_id: vdev id
906  * @peer_mac: Peer Mac Address
907  * @nbuf: pointer to data packet
908  *
909  * Return: QDF_STATUS
910  */
911 static inline QDF_STATUS
cdp_ipa_update_peer_rx_stats(ol_txrx_soc_handle soc,uint8_t vdev_id,uint8_t * peer_mac,qdf_nbuf_t nbuf)912 cdp_ipa_update_peer_rx_stats(ol_txrx_soc_handle soc, uint8_t vdev_id,
913 			     uint8_t *peer_mac, qdf_nbuf_t nbuf)
914 {
915 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
916 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
917 			  "%s invalid instance", __func__);
918 		return QDF_STATUS_E_FAILURE;
919 	}
920 
921 	if (soc->ops->ipa_ops->ipa_update_peer_rx_stats)
922 		return soc->ops->ipa_ops->ipa_update_peer_rx_stats(soc,
923 								   vdev_id,
924 								   peer_mac,
925 								   nbuf);
926 
927 	return QDF_STATUS_SUCCESS;
928 }
929 
930 #ifdef IPA_OPT_WIFI_DP
931 #define RX_CCE_SUPER_RULE_SETUP_NUM 2
932 struct addr_params {
933 	uint8_t valid;
934 	uint8_t src_ipv4_addr[4];
935 	uint8_t dst_ipv4_addr[4];
936 	uint8_t src_ipv6_addr[16];
937 	uint8_t dst_ipv6_addr[16];
938 	uint8_t l4_type;
939 	uint16_t l3_type;
940 	uint16_t src_port;
941 	uint16_t dst_port;
942 	uint32_t flt_hdl;
943 	uint8_t ipa_flt_evnt_required;
944 	bool ipa_flt_in_use;
945 };
946 
947 struct wifi_dp_flt_setup {
948 	uint8_t pdev_id;
949 	uint8_t op;
950 	uint8_t num_filters;
951 	uint32_t ipa_flt_evnt_response;
952 	struct addr_params flt_addr_params[RX_CCE_SUPER_RULE_SETUP_NUM];
953 };
954 
955 static inline QDF_STATUS
cdp_ipa_rx_cce_super_rule_setup(ol_txrx_soc_handle soc,void * flt_params)956 cdp_ipa_rx_cce_super_rule_setup(ol_txrx_soc_handle soc,
957 				void *flt_params)
958 {
959 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
960 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
961 			  "%s invalid instance", __func__);
962 		return QDF_STATUS_E_FAILURE;
963 	}
964 
965 	if (soc->ops->ipa_ops->ipa_rx_super_rule_setup)
966 		return soc->ops->ipa_ops->ipa_rx_super_rule_setup(soc,
967 								  flt_params);
968 
969 	return QDF_STATUS_SUCCESS;
970 }
971 
972 static inline QDF_STATUS
cdp_ipa_opt_dp_enable_disable_low_power_mode(struct wlan_objmgr_pdev * pdev,uint32_t pdev_id,int param_val)973 cdp_ipa_opt_dp_enable_disable_low_power_mode(struct wlan_objmgr_pdev *pdev,
974 					     uint32_t pdev_id, int param_val)
975 {
976 	wmi_unified_t wmi_handle;
977 	struct wmi_unified *pdev_wmi_handle = NULL;
978 	struct wlan_objmgr_psoc *psoc;
979 	struct pdev_params pparam;
980 	uint32_t vdev_id, val;
981 	QDF_STATUS status;
982 
983 	psoc = wlan_pdev_get_psoc(pdev);
984 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
985 	if (!wmi_handle) {
986 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
987 			  "Unable to get wmi handle");
988 		return QDF_STATUS_E_NULL_VALUE;
989 	}
990 
991 	pdev_wmi_handle = pdev->tgt_if_handle->wmi_handle;
992 	qdf_mem_set(&pparam, sizeof(pparam), 0);
993 	pparam.is_host_pdev_id = false;
994 
995 	/* Enable-disable IMPS */
996 	pparam.param_id = WMI_PDEV_PARAM_IDLE_PS_CONFIG;
997 	pparam.param_value = param_val;
998 	status =  wmi_unified_pdev_param_send(wmi_handle,
999 					      &pparam, pdev_id);
1000 	if (status != QDF_STATUS_SUCCESS) {
1001 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
1002 			  "%s Unable to enable/disable:(%d) IMPS", __func__,
1003 			  param_val);
1004 		return QDF_STATUS_E_FAILURE;
1005 	}
1006 
1007 	/* Enable-disable ILP */
1008 	pparam.param_id = WMI_PDEV_PARAM_PCIE_HW_ILP;
1009 	pparam.param_value = param_val;
1010 	status =  wmi_unified_pdev_param_send(pdev_wmi_handle,
1011 					      &pparam, pdev_id);
1012 	if (status != QDF_STATUS_SUCCESS) {
1013 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
1014 			  "%s Unable to enable/disable:(%d) ILP", __func__,
1015 			  param_val);
1016 		return QDF_STATUS_E_FAILURE;
1017 	}
1018 
1019 	/* Enable-disable BMPS */
1020 	val = param_val;
1021 	vdev_id = 0; //TODO fix vdev_id
1022 	status = wmi_unified_set_sta_ps_mode(wmi_handle, vdev_id, val);
1023 	if (status != QDF_STATUS_SUCCESS) {
1024 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
1025 			  "%s Unable to enable/disable:(%d) BMPS", __func__,
1026 			  param_val);
1027 		return QDF_STATUS_E_FAILURE;
1028 	}
1029 
1030 	return status;
1031 }
1032 #endif /* IPA_OPT_WIFI_DP */
1033 
1034 /**
1035  * cdp_ipa_get_wdi_version - Get WDI version
1036  * @soc: data path soc handle
1037  * @wdi_ver: Out param for wdi version
1038  *
1039  * Return: None
1040  */
1041 static inline void
cdp_ipa_get_wdi_version(ol_txrx_soc_handle soc,uint8_t * wdi_ver)1042 cdp_ipa_get_wdi_version(ol_txrx_soc_handle soc, uint8_t *wdi_ver)
1043 {
1044 	if (!soc || !soc->ops || !soc->ops->ipa_ops) {
1045 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
1046 			  "%s invalid instance", __func__);
1047 		return;
1048 	}
1049 
1050 	if (soc->ops->ipa_ops->ipa_get_wdi_version)
1051 		soc->ops->ipa_ops->ipa_get_wdi_version(soc, wdi_ver);
1052 }
1053 #endif /* IPA_OFFLOAD */
1054 #endif /* _CDP_TXRX_IPA_H_ */
1055