1 /*
2 * Copyright (c) 2018, 2020 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 * 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
target_if_ipa_uc_offload_control_req(struct wlan_objmgr_psoc * psoc,struct ipa_uc_offload_control_params * req)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 * target_if_ipa_intrabss_control_req() - Send IPA intra-BSS control request
50 * @psoc: psoc object
51 * @req: IPA intra bss enable/disable control param
52 *
53 * Return: QDF_STATUS_SUCCESS on success
54 */
55 static QDF_STATUS
target_if_ipa_intrabss_control_req(struct wlan_objmgr_psoc * psoc,struct ipa_intrabss_control_params * req)56 target_if_ipa_intrabss_control_req(struct wlan_objmgr_psoc *psoc,
57 struct ipa_intrabss_control_params *req)
58 {
59 struct vdev_set_params param = {0};
60 wmi_unified_t wmi_handle;
61
62 wmi_handle = (wmi_unified_t)get_wmi_unified_hdl_from_psoc(psoc);
63
64 if (!wmi_handle)
65 return QDF_STATUS_E_FAILURE;
66
67 param.vdev_id = req->vdev_id;
68 param.param_id = wmi_vdev_param_intra_bss_fwd;
69 param.param_value = req->enable;
70
71 return wmi_unified_vdev_set_param_send(wmi_handle, ¶m);
72 }
73
74 QDF_STATUS
target_if_ipa_register_tx_ops(struct wlan_lmac_if_tx_ops * tx_ops)75 target_if_ipa_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
76 {
77 struct wlan_lmac_if_ipa_tx_ops *ipa_ops;
78
79 if (!tx_ops) {
80 target_if_err("tx ops is NULL!");
81 return QDF_STATUS_E_INVAL;
82 }
83
84 ipa_ops = &tx_ops->ipa_ops;
85
86 ipa_ops->ipa_uc_offload_control_req =
87 target_if_ipa_uc_offload_control_req;
88 ipa_ops->ipa_intrabss_control_req = target_if_ipa_intrabss_control_req;
89
90 return QDF_STATUS_SUCCESS;
91 }
92