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