1 /*
2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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 * DOC: wlan_twt_tgt_if_tx_api.c
20 *
21 * This file provides definitions for twt tgt_if APIs, which will
22 * further call target_if component using LMAC TWT txops
23 */
24 #include <qdf_types.h>
25 #include <wlan_objmgr_psoc_obj.h>
26 #include <wlan_twt_public_structs.h>
27 #include <wlan_twt_tgt_if_tx_api.h>
28 #include <wlan_lmac_if_def.h>
29 #include <wlan_twt_api.h>
30
31 QDF_STATUS
tgt_twt_enable_req_send(struct wlan_objmgr_psoc * psoc,struct twt_enable_param * req)32 tgt_twt_enable_req_send(struct wlan_objmgr_psoc *psoc,
33 struct twt_enable_param *req)
34 {
35 struct wlan_lmac_if_twt_tx_ops *tx_ops;
36 QDF_STATUS status;
37
38 tx_ops = wlan_twt_get_tx_ops(psoc);
39 if (!tx_ops || !tx_ops->enable_req) {
40 twt_err("twt enable_req tx_ops is null");
41 return QDF_STATUS_E_NULL_VALUE;
42 }
43
44 status = tx_ops->enable_req(psoc, req);
45 if (QDF_IS_STATUS_ERROR(status)) {
46 twt_err("tx_ops enable_req failed (status=%d)", status);
47 return status;
48 }
49
50 return status;
51 }
52
53 QDF_STATUS
tgt_twt_disable_req_send(struct wlan_objmgr_psoc * psoc,struct twt_disable_param * req)54 tgt_twt_disable_req_send(struct wlan_objmgr_psoc *psoc,
55 struct twt_disable_param *req)
56 {
57 struct wlan_lmac_if_twt_tx_ops *tx_ops;
58 QDF_STATUS status;
59
60 tx_ops = wlan_twt_get_tx_ops(psoc);
61 if (!tx_ops || !tx_ops->disable_req) {
62 twt_err("twt disable_req tx_ops is null");
63 return QDF_STATUS_E_NULL_VALUE;
64 }
65
66 status = tx_ops->disable_req(psoc, req);
67 if (QDF_IS_STATUS_ERROR(status)) {
68 twt_err("tx_ops disable_req failed (status=%d)", status);
69 return status;
70 }
71
72 return status;
73 }
74