xref: /wlan-dirver/qca-wifi-host-cmn/ipa/dispatcher/src/wlan_ipa_tgt_api.c (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef) !
1 /*
2  * Copyright (c) 2018, 2020-2021 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: Implements public API for ipa to interact with target/WMI
21  */
22 
23 #include "wlan_ipa_tgt_api.h"
24 #include "wlan_ipa_main.h"
25 #include "wlan_ipa_public_struct.h"
26 #include <wlan_objmgr_global_obj.h>
27 #include <wlan_objmgr_pdev_obj.h>
28 #include <wlan_lmac_if_def.h>
29 
30 QDF_STATUS tgt_ipa_uc_offload_enable_disable(struct wlan_objmgr_pdev *pdev,
31 				struct ipa_uc_offload_control_params *req)
32 {
33 	struct wlan_objmgr_psoc *psoc;
34 	struct wlan_lmac_if_tx_ops *tx_ops;
35 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
36 
37 	IPA_ENTER();
38 
39 	psoc = wlan_pdev_get_psoc(pdev);
40 	if (!psoc) {
41 		ipa_err("NULL psoc");
42 		return QDF_STATUS_E_NULL_VALUE;
43 	}
44 
45 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
46 	if (!tx_ops)
47 		return QDF_STATUS_E_NULL_VALUE;
48 
49 	if (tx_ops->ipa_ops.ipa_uc_offload_control_req)
50 		status = tx_ops->ipa_ops.ipa_uc_offload_control_req(psoc, req);
51 
52 	IPA_EXIT();
53 	return status;
54 }
55 
56 QDF_STATUS
57 tgt_ipa_intrabss_enable_disable(struct wlan_objmgr_pdev *pdev,
58 				struct ipa_intrabss_control_params *req)
59 {
60 	struct wlan_objmgr_psoc *psoc;
61 	struct wlan_lmac_if_tx_ops *tx_ops;
62 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
63 
64 	IPA_ENTER();
65 
66 	psoc = wlan_pdev_get_psoc(pdev);
67 	if (!psoc) {
68 		ipa_err("NULL psoc");
69 		return QDF_STATUS_E_NULL_VALUE;
70 	}
71 
72 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
73 	if (!tx_ops)
74 		return QDF_STATUS_E_NULL_VALUE;
75 
76 	if (tx_ops->ipa_ops.ipa_intrabss_control_req)
77 		status = tx_ops->ipa_ops.ipa_intrabss_control_req(psoc, req);
78 
79 	IPA_EXIT();
80 	return status;
81 }
82 
83