1 /* 2 * Copyright (c) 2022 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 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 if (!psoc) { 39 twt_err("null psoc"); 40 return QDF_STATUS_E_INVAL; 41 } 42 43 if (!req) { 44 twt_err("Invalid input"); 45 return QDF_STATUS_E_INVAL; 46 } 47 48 tx_ops = wlan_twt_get_tx_ops(psoc); 49 if (!tx_ops || !tx_ops->enable_req) { 50 twt_err("twt enable_req tx_ops is null"); 51 return QDF_STATUS_E_NULL_VALUE; 52 } 53 54 status = tx_ops->enable_req(psoc, req); 55 if (QDF_IS_STATUS_ERROR(status)) { 56 twt_err("tx_ops enable_req failed (status=%d)", status); 57 return status; 58 } 59 60 return status; 61 } 62 63 QDF_STATUS 64 tgt_twt_disable_req_send(struct wlan_objmgr_psoc *psoc, 65 struct twt_disable_param *req) 66 { 67 struct wlan_lmac_if_twt_tx_ops *tx_ops; 68 QDF_STATUS status; 69 70 if (!psoc) { 71 twt_err("null psoc"); 72 return QDF_STATUS_E_INVAL; 73 } 74 75 if (!req) { 76 twt_err("Invalid input"); 77 return QDF_STATUS_E_INVAL; 78 } 79 80 tx_ops = wlan_twt_get_tx_ops(psoc); 81 if (!tx_ops || !tx_ops->disable_req) { 82 twt_err("twt disable_req tx_ops is null"); 83 return QDF_STATUS_E_NULL_VALUE; 84 } 85 86 status = tx_ops->disable_req(psoc, req); 87 if (QDF_IS_STATUS_ERROR(status)) { 88 twt_err("tx_ops disable_req failed (status=%d)", status); 89 return status; 90 } 91 92 return status; 93 } 94