1 /* 2 * Copyright (c) 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 any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /** 19 * DOC: This file has the dcs dispatcher API which is exposed to outside of dcs 20 * component. 21 */ 22 #ifndef _WLAN_DCS_UCFG_API_H_ 23 #define _WLAN_DCS_UCFG_API_H_ 24 25 #include <qdf_status.h> 26 #include <wlan_objmgr_pdev_obj.h> 27 #include <wlan_dcs_public_structs.h> 28 29 /** 30 * typedef dcs_callback() - DCS callback 31 * @psoc: Pointer to psoc 32 * @mac_id: mac id 33 * @interference_type: interference type 34 * @arg: list of arguments 35 */ 36 typedef void (*dcs_callback)( 37 struct wlan_objmgr_psoc *psoc, 38 uint8_t mac_id, 39 uint8_t interference_type, 40 void *arg); 41 42 /** 43 * typedef dcs_switch_chan_cb() - DCS callback for switching channel 44 * @vdev: Pointer to vdev 45 * @tgt_freq: target channel frequency 46 * @tgt_width: target channel width 47 */ 48 typedef QDF_STATUS (*dcs_switch_chan_cb)(struct wlan_objmgr_vdev *vdev, 49 qdf_freq_t tgt_freq, 50 enum phy_ch_width tgt_width); 51 52 #ifdef DCS_INTERFERENCE_DETECTION 53 /** 54 * ucfg_dcs_register_cb() - API to register dcs callback 55 * @psoc: pointer to psoc object 56 * @cbk: dcs callback to be registered 57 * @arg: argument 58 * 59 * This function gets called to register dcs callback function 60 * 61 * Return: None 62 */ 63 void ucfg_dcs_register_cb( 64 struct wlan_objmgr_psoc *psoc, 65 dcs_callback cbk, 66 void *arg); 67 68 /** 69 * ucfg_dcs_register_user_cb() - API to register dcs user callback 70 * @psoc: pointer to psoc object 71 * @mac_id: mac id 72 * @vdev_id: vdev id 73 * @cb: dcs user callback to be registered 74 * 75 * Return: None 76 */ 77 void ucfg_dcs_register_user_cb(struct wlan_objmgr_psoc *psoc, 78 uint8_t mac_id, uint8_t vdev_id, 79 void (*cb)(uint8_t vdev_id, 80 struct wlan_host_dcs_im_user_stats *stats, 81 int status)); 82 83 /** 84 * ucfg_dcs_register_awgn_cb() - API to register dcs awgn callback 85 * @psoc: pointer to psoc object 86 * @cb: dcs switch channel callback to be registered 87 * 88 * Return: QDF_STATUS 89 */ 90 QDF_STATUS ucfg_dcs_register_awgn_cb(struct wlan_objmgr_psoc *psoc, 91 dcs_switch_chan_cb cb); 92 93 /** 94 * ucfg_wlan_dcs_cmd(): API to send dcs command 95 * @psoc: pointer to psoc object 96 * @mac_id: mac id 97 * @is_host_pdev_id: pdev_id is host id or not 98 * 99 * This function gets called to send dcs command 100 * 101 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 102 */ 103 QDF_STATUS 104 ucfg_wlan_dcs_cmd(struct wlan_objmgr_psoc *psoc, 105 uint32_t mac_id, 106 bool is_host_pdev_id); 107 108 /** 109 * ucfg_config_dcs_enable() - API to config dcs enable 110 * @psoc: pointer to psoc object 111 * @mac_id: mac id 112 * @interference_type: type mask(WLAN_HOST_DCS_CWIM / WLAN_HOST_DCS_WLANIM) 113 * 114 * This function gets called to config dcs enable 115 * 116 * Return: None 117 */ 118 void ucfg_config_dcs_enable(struct wlan_objmgr_psoc *psoc, 119 uint32_t mac_id, 120 uint8_t interference_type); 121 122 /** 123 * ucfg_config_dcs_disable() - API to config dcs disable 124 * @psoc: pointer to psoc object 125 * @mac_id: mac id 126 * @interference_type: type mask(WLAN_HOST_DCS_CWIM / WLAN_HOST_DCS_WLANIM) 127 * 128 * This function gets called to config dcs disable 129 * 130 * Return: None 131 */ 132 void ucfg_config_dcs_disable(struct wlan_objmgr_psoc *psoc, 133 uint32_t mac_id, 134 uint8_t interference_type); 135 136 /** 137 * ucfg_get_dcs_enable() - API to get dcs enable 138 * @psoc: pointer to psoc object 139 * @mac_id: mac id 140 * 141 * This function gets called to get current host 142 * config dcs enable/disable status 143 * 144 * Return: WLANIM/CWIM enable status 145 */ 146 uint8_t ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint8_t mac_id); 147 148 /** 149 * ucfg_dcs_clear() - API to clear dcs related information 150 * @psoc: pointer to psoc object 151 * @mac_id: mac id 152 * 153 * This function gets called to clear dcs related information 154 * 155 * Return: None 156 */ 157 void ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t mac_id); 158 159 /** 160 * ucfg_config_dcs_event_data() - config dcs event data to do algorithm 161 * process or not 162 * @psoc: psoc pointer 163 * @mac_id: mac id 164 * @dcs_algorithm_process: dcs algorithm process or not 165 * 166 * The function gets called to config dcs event data to do algorithm 167 * process or not 168 * 169 * Return: None 170 */ 171 void ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t mac_id, 172 bool dcs_algorithm_process); 173 174 /* 175 * ucfg_dcs_reset_user_stats() - API to reset dcs user stats 176 * @psoc: pointer to psoc object 177 * @mac_id: mac id 178 * 179 * Return: None 180 */ 181 void ucfg_dcs_reset_user_stats(struct wlan_objmgr_psoc *psoc, uint8_t mac_id); 182 183 /** 184 * ucfg_dcs_set_user_request() - API to set dcs user stats request counter 185 * @psoc: pointer to psoc object 186 * @mac_id: mac id 187 * @user_request_count: user stats request counter 188 * 189 * Return: None 190 */ 191 void ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t mac_id, 192 uint32_t user_request_count); 193 194 /** 195 * ucfg_dcs_get_ch_util() - API to get channel interference values 196 * @psoc: pointer to psoc object 197 * @mac_id: mac id 198 * @dcs_stats: pointer to wlan_host_dcs_ch_util_stats 199 * 200 * Return: Integer 201 */ 202 QDF_STATUS ucfg_dcs_get_ch_util(struct wlan_objmgr_psoc *psoc, uint8_t mac_id, 203 struct wlan_host_dcs_ch_util_stats *dcs_stats); 204 205 #else 206 static inline void 207 ucfg_dcs_register_cb(struct wlan_objmgr_psoc *psoc, dcs_callback cbk, void *arg) 208 { 209 } 210 211 static inline void 212 ucfg_dcs_register_user_cb(struct wlan_objmgr_psoc *psoc, 213 uint8_t mac_id, uint8_t vdev_id, 214 void (*cb)(uint8_t vdev_id, 215 struct wlan_host_dcs_im_user_stats *stats, 216 int status)) 217 { 218 } 219 220 static inline QDF_STATUS 221 ucfg_wlan_dcs_cmd(struct wlan_objmgr_psoc *psoc, uint32_t mac_id, 222 bool is_host_pdev_id) 223 { 224 return QDF_STATUS_SUCCESS; 225 } 226 227 static inline void 228 ucfg_config_dcs_enable(struct wlan_objmgr_psoc *psoc, uint32_t mac_id, 229 uint8_t interference_type) 230 { 231 } 232 233 static inline void 234 ucfg_config_dcs_disable(struct wlan_objmgr_psoc *psoc, uint32_t mac_id, 235 uint8_t interference_type) 236 { 237 } 238 239 static inline uint8_t 240 ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint8_t mac_id) 241 { 242 return 0; 243 } 244 245 static inline void 246 ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t mac_id) 247 { 248 } 249 250 static inline void 251 ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t mac_id, 252 bool dcs_algorithm_process) 253 { 254 } 255 256 static inline void 257 ucfg_dcs_reset_user_stats(struct wlan_objmgr_psoc *psoc, uint8_t mac_id) 258 { 259 } 260 261 static inline void 262 ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t mac_id, 263 uint32_t user_request_count) 264 { 265 } 266 267 static inline QDF_STATUS 268 ucfg_dcs_get_ch_util(struct wlan_objmgr_psoc *psoc, uint8_t mac_id, 269 struct wlan_host_dcs_ch_util_stats *dcs_stats) 270 { 271 return QDF_STATUS_SUCCESS; 272 } 273 #endif 274 #endif /* _WLAN_DCS_UCFG_API_H_ */ 275