1 /* 2 * Copyright (c) 2018, 2020-2021 The Linux Foundation. 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 /** 20 * DOC: target_if_cp_stats.h 21 * 22 * This header file provide declarations required for Rx and Tx events from 23 * firmware 24 */ 25 26 #ifndef __TARGET_IF_CP_STATS_H__ 27 #define __TARGET_IF_CP_STATS_H__ 28 29 #include <target_if.h> 30 #include <wlan_lmac_if_def.h> 31 #include <wlan_cp_stats_utils_api.h> 32 33 #ifdef QCA_SUPPORT_CP_STATS 34 35 /** 36 * target_if_cp_stats_get_rx_ops() - get rx ops 37 * @tx_ops: pointer to lmac tx ops 38 * 39 * Return: pointer to rx ops 40 */ 41 static inline struct wlan_lmac_if_cp_stats_rx_ops * 42 target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc *psoc) 43 { 44 struct wlan_lmac_if_rx_ops *rx_ops; 45 46 rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); 47 if (!rx_ops) { 48 cp_stats_err("rx_ops is NULL"); 49 return NULL; 50 } 51 52 return &rx_ops->cp_stats_rx_ops; 53 } 54 55 /** 56 * target_if_cp_stats_get_tx_ops() - get tx ops 57 * @tx_ops: pointer to lmac tx ops 58 * 59 * Return: pointer to tx ops 60 */ 61 static inline struct wlan_lmac_if_cp_stats_tx_ops * 62 target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc *psoc) 63 { 64 struct wlan_lmac_if_tx_ops *tx_ops; 65 66 tx_ops = wlan_psoc_get_lmac_if_txops(psoc); 67 if (!tx_ops) { 68 cp_stats_err("tx_ops is NULL"); 69 return NULL; 70 } 71 72 return &tx_ops->cp_stats_tx_ops; 73 } 74 75 /** 76 * target_if_cp_stats_register_tx_ops() - define cp_stats lmac tx ops functions 77 * @tx_ops: pointer to lmac tx ops 78 * 79 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 80 */ 81 QDF_STATUS 82 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); 83 84 #ifdef WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS 85 /** 86 * @target_if_cp_stats_register_legacy_event_handler() - Register handler 87 * specific to legacy components 88 * @psoc: pointer to psoc object 89 * 90 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 91 * failure 92 */ 93 QDF_STATUS 94 target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc); 95 96 /** 97 * @target_if_cp_stats_unregister_legacy_event_handler() - Unregister handler 98 * specific to legacy components 99 * @psoc: pointer to psoc object 100 * 101 * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on 102 * failure 103 */ 104 QDF_STATUS 105 target_if_cp_stats_unregister_legacy_event_handler( 106 struct wlan_objmgr_psoc *psoc); 107 #else 108 109 static inline QDF_STATUS 110 target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc) 111 { 112 return QDF_STATUS_SUCCESS; 113 } 114 115 static inline QDF_STATUS 116 target_if_cp_stats_unregister_legacy_event_handler( 117 struct wlan_objmgr_psoc *psoc) 118 { 119 return QDF_STATUS_SUCCESS; 120 } 121 #endif /* WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS */ 122 123 #ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS 124 /** 125 * get_infra_cp_stats_id() - convert from to wmi_ctrl_path_stats_id 126 * @type: type from enum infra_cp_stats_id 127 * 128 * Return: wmi_ctrl_path_stats_id code for success or -EINVAL 129 * for failure 130 */ 131 uint32_t get_infra_cp_stats_id(enum infra_cp_stats_id type); 132 133 /** 134 * get_infra_cp_stats_action() - convert action codes from 135 * enum infra_cp_stats_action to wmi_ctrl_path_stats_action 136 * @action: action code from enum infra_cp_stats_action 137 * 138 * Return: wmi_ctrl_path_stats_action code for success or -EINVAL 139 * for failure 140 */ 141 uint32_t get_infra_cp_stats_action(enum infra_cp_stats_action action); 142 #endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */ 143 144 #else 145 static inline QDF_STATUS 146 target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) 147 { 148 return QDF_STATUS_SUCCESS; 149 } 150 #endif /* QCA_SUPPORT_CP_STATS */ 151 152 #endif /* __TARGET_IF_CP_STATS_H__ */ 153