1 /* 2 * Copyright (c) 2019-2020 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 #ifndef _TARGET_IF_CFR_H_ 20 #define _TARGET_IF_CFR_H_ 21 22 #include <wlan_objmgr_cmn.h> 23 #include <wlan_objmgr_psoc_obj.h> 24 #include <wlan_objmgr_pdev_obj.h> 25 #include <wlan_objmgr_vdev_obj.h> 26 #include <wlan_objmgr_peer_obj.h> 27 28 #include "wmi_unified_cfr_api.h" 29 #include "wmi_unified_param.h" 30 #include "wmi_unified_cfr_param.h" 31 #define PEER_CFR_CAPTURE_ENABLE 1 32 #define PEER_CFR_CAPTURE_DISABLE 0 33 34 #define PEER_CFR_CAPTURE_EVT_STATUS_MASK 0x80000000 35 #define PEER_CFR_CAPTURE_EVT_PS_STATUS_MASK 0x40000000 36 #define CFR_TX_EVT_STATUS_MASK 0x00000003 37 38 /* Status codes used by correlate and relay function */ 39 #define STATUS_STREAM_AND_RELEASE 0 40 #define STATUS_HOLD 1 41 #define STATUS_ERROR -1 42 43 /* Module IDs using corrlation function */ 44 #define CORRELATE_DBR_MODULE_ID 0 45 /* 46 * HKV2 - Tx completion event for one-shot capture 47 * Cypress - Tx completion event for one-shot capture (or) RXTLV event for RCC 48 */ 49 #define CORRELATE_TX_EV_MODULE_ID 1 50 51 /** 52 * target_if_cfr_init_pdev() - Inits cfr pdev and registers necessary handlers. 53 * @psoc: pointer to psoc object 54 * @pdev: pointer to pdev object 55 * 56 * Return: Registration status for necessary handlers 57 */ 58 QDF_STATUS 59 target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc, 60 struct wlan_objmgr_pdev *pdev); 61 62 /** 63 * target_if_cfr_deinit_pdev() - De-inits corresponding pdev and handlers. 64 * @psoc: pointer to psoc object 65 * @pdev: pointer to pdev object 66 * 67 * Return: De-registration status for necessary handlers 68 */ 69 QDF_STATUS 70 target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc, 71 struct wlan_objmgr_pdev *pdev); 72 73 /** 74 * target_if_cfr_tx_ops_register() - Registers tx ops for cfr module 75 * @tx_ops - pointer to tx_ops structure. 76 */ 77 void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops); 78 79 /** 80 * target_if_cfr_enable_cfr_timer() - Enables cfr timer 81 * @pdev: pointer to pdev object 82 * @cfr_timer: Amount of time this timer has to run 83 * 84 * Return: status of timer 85 */ 86 int target_if_cfr_enable_cfr_timer(struct wlan_objmgr_pdev *pdev, 87 uint32_t cfr_timer); 88 89 /** 90 * target_if_cfr_pdev_set_param() - Function to set params for cfr config 91 * @pdev: pointer to pdev object 92 * @param_id: param id which has to be set 93 * @param_value: value of param being set 94 * 95 * Return: success/failure of setting param 96 */ 97 int target_if_cfr_pdev_set_param(struct wlan_objmgr_pdev *pdev, 98 uint32_t param_id, uint32_t param_value); 99 /** 100 * target_if_cfr_start_capture() - Function to start cfr capture for a peer 101 * @pdev: pointer to pdev object 102 * @peer: pointer to peer object 103 * @cfr_params: capture parameters for this peer 104 * 105 * Return: success/failure status of start capture 106 */ 107 int target_if_cfr_start_capture(struct wlan_objmgr_pdev *pdev, 108 struct wlan_objmgr_peer *peer, 109 struct cfr_capture_params *cfr_params); 110 /** 111 * target_if_cfr_stop_capture() - Function to stop cfr capture for a peer 112 * @pdev: pointer to pdev object 113 * @peer: pointer to peer object 114 * 115 * Return: success/failure status of stop capture 116 */ 117 int target_if_cfr_stop_capture(struct wlan_objmgr_pdev *pdev, 118 struct wlan_objmgr_peer *peer); 119 120 /** 121 * target_if_cfr_get_target_type() - Function to get target type 122 * @psoc: pointer to psoc object 123 * 124 * Return: target type of target 125 */ 126 int target_if_cfr_get_target_type(struct wlan_objmgr_psoc *psoc); 127 128 /** 129 * target_if_cfr_set_cfr_support() - Function to set cfr support 130 * @psoc: pointer to psoc object 131 * @value: value to be set 132 */ 133 void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc, 134 uint8_t value); 135 136 /** 137 * target_if_cfr_set_capture_count_support() - Function to set capture count 138 * support. 139 * @psoc: pointer to psoc object 140 * @value: value to be set 141 * 142 * Return: success/failure 143 */ 144 QDF_STATUS 145 target_if_cfr_set_capture_count_support(struct wlan_objmgr_psoc *psoc, 146 uint8_t value); 147 148 /** 149 * target_if_cfr_set_mo_marking_support() - Function to set MO marking support 150 * @psoc: pointer to psoc object 151 * @value: value to be set 152 * 153 * Return: success/failure 154 */ 155 QDF_STATUS 156 target_if_cfr_set_mo_marking_support(struct wlan_objmgr_psoc *psoc, 157 uint8_t value); 158 159 /** 160 * target_if_cfr_info_send() - Function to send cfr info to upper layers 161 * @pdev: pointer to pdev object 162 * @head: pointer to cfr info head 163 * @hlen: head len 164 * @data: pointer to cfr info data 165 * @dlen: data len 166 * @tail: pointer to cfr info tail 167 * @tlen: tail len 168 */ 169 void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head, 170 size_t hlen, void *data, size_t dlen, void *tail, 171 size_t tlen); 172 173 #ifdef WIFI_TARGET_TYPE_2_0 174 /** 175 * cfr_wifi2_0_init_pdev() - Function to init legacy pdev 176 * @psoc: pointer to psoc object 177 * @pdev: pointer to pdev object 178 * 179 * Return: success/failure status of init 180 */ 181 QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc, 182 struct wlan_objmgr_pdev *pdev); 183 184 /** 185 * cfr_wifi2_0_deinit_pdev() - Function to deinit legacy pdev 186 * @psoc: pointer to psoc object 187 * @pdev: pointer to pdev object 188 * 189 * Return: success/failure status of deinit 190 */ 191 QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc, 192 struct wlan_objmgr_pdev *pdev); 193 194 #else 195 #ifndef CFR_USE_FIXED_FOLDER 196 static QDF_STATUS cfr_wifi2_0_init_pdev(struct wlan_objmgr_psoc *psoc, 197 struct wlan_objmgr_pdev *pdev) 198 { 199 return QDF_STATUS_SUCCESS; 200 } 201 202 static QDF_STATUS cfr_wifi2_0_deinit_pdev(struct wlan_objmgr_psoc *psoc, 203 struct wlan_objmgr_pdev *pdev) 204 { 205 return QDF_STATUS_SUCCESS; 206 } 207 #endif 208 #endif 209 #endif 210