xref: /wlan-dirver/qca-wifi-host-cmn/target_if/ipa/src/target_if_ipa.c (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2018, 2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021 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  * DOC: Target interface file for disa component to
21  * Implement api's which shall be used by ipa component
22  * in target if internally.
23  */
24 
25 #include <target_if.h>
26 #include <qdf_status.h>
27 #include <wmi_unified_api.h>
28 #include <wmi_unified_priv.h>
29 #include <wmi_unified_param.h>
30 #include <target_if_ipa.h>
31 #include <wlan_objmgr_psoc_obj.h>
32 
33 /**
34  * target_if_ipa_uc_offload_control_req() - send IPA offload control to FW
35  * @psoc: pointer to PSOC object
36  * @req: IPA UC offload enable/disable control param
37  *
38  * Return: QDF_STATUS_SUCCESS on success
39  */
40 static QDF_STATUS
41 target_if_ipa_uc_offload_control_req(struct wlan_objmgr_psoc *psoc,
42 			struct ipa_uc_offload_control_params *req)
43 {
44 	return wmi_unified_ipa_offload_control_cmd(
45 			get_wmi_unified_hdl_from_psoc(psoc), req);
46 }
47 
48 /**
49  * @req: IPA intra bss enable/disable control param
50  *
51  * Return: QDF_STATUS_SUCCESS on success
52  */
53 static QDF_STATUS
54 target_if_ipa_intrabss_control_req(struct wlan_objmgr_psoc *psoc,
55 				   struct ipa_intrabss_control_params *req)
56 {
57 	struct vdev_set_params param = {0};
58 	wmi_unified_t wmi_handle;
59 
60 	wmi_handle = (wmi_unified_t)get_wmi_unified_hdl_from_psoc(psoc);
61 
62 	if (!wmi_handle)
63 		return QDF_STATUS_E_FAILURE;
64 
65 	param.vdev_id = req->vdev_id;
66 	param.param_id = wmi_vdev_param_intra_bss_fwd;
67 	param.param_value = req->enable;
68 
69 	return wmi_unified_vdev_set_param_send(wmi_handle, &param);
70 }
71 
72 QDF_STATUS
73 target_if_ipa_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
74 {
75 	struct wlan_lmac_if_ipa_tx_ops *ipa_ops;
76 
77 	if (!tx_ops) {
78 		target_if_err("tx ops is NULL!");
79 		return QDF_STATUS_E_INVAL;
80 	}
81 
82 	ipa_ops = &tx_ops->ipa_ops;
83 
84 	ipa_ops->ipa_uc_offload_control_req =
85 			target_if_ipa_uc_offload_control_req;
86 	ipa_ops->ipa_intrabss_control_req = target_if_ipa_intrabss_control_req;
87 
88 	return QDF_STATUS_SUCCESS;
89 }
90