1 /* 2 * Copyright (c) 2020, 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 * @brief List of DCS capabilities that can be set or unset 30 * dynamically 31 * @see UMAC auto channel selection document for details on each feature 32 * 33 */ 34 #define CAP_DCS_CWIM 0x1 35 #define CAP_DCS_WLANIM 0x2 36 #define CAP_DCS_MASK (CAP_DCS_CWIM | CAP_DCS_WLANIM) 37 38 /** 39 * typedef dcs_callback() - DCS callback 40 * @psoc: Pointer to psoc 41 * @pdev_id: pdev id 42 * @interference_type: interference type 43 * @arg: list of arguments 44 */ 45 typedef void (*dcs_callback)( 46 struct wlan_objmgr_psoc *psoc, 47 uint8_t pdev_id, 48 uint8_t interference_type, 49 void *arg); 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 * @pdev_id: pdev 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 pdev_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_wlan_dcs_cmd(): API to send dcs command 84 * @psoc: pointer to psoc object 85 * @pdev_id: pdev_id 86 * @is_host_pdev_id: pdev_id is host id or not 87 * 88 * This function gets called to send dcs command 89 * 90 * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error 91 */ 92 QDF_STATUS 93 ucfg_wlan_dcs_cmd(struct wlan_objmgr_psoc *psoc, 94 uint32_t pdev_id, 95 bool is_host_pdev_id); 96 97 /** 98 * ucfg_config_dcs_enable() - API to config dcs enable 99 * @psoc: pointer to psoc object 100 * @pdev_id: pdev id 101 * @interference_type: CAP_DCS_CWIM, CAP_DCS_WLANIM, CAP_DCS_MASK 102 * 103 * This function gets called to config dcs enable 104 * 105 * Return: None 106 */ 107 void ucfg_config_dcs_enable(struct wlan_objmgr_psoc *psoc, 108 uint32_t pdev_id, 109 uint8_t interference_type); 110 111 /** 112 * ucfg_config_dcs_disable() - API to config dcs disable 113 * @psoc: pointer to psoc object 114 * @pdev_id: pdev id 115 * @interference_type: CAP_DCS_CWIM, CAP_DCS_WLANIM, CAP_DCS_MASK 116 * 117 * This function gets called to config dcs disable 118 * 119 * Return: None 120 */ 121 void ucfg_config_dcs_disable(struct wlan_objmgr_psoc *psoc, 122 uint32_t pdev_id, 123 uint8_t interference_type); 124 125 /** 126 * ucfg_get_dcs_enable() - API to get dcs enable 127 * @psoc: pointer to psoc object 128 * @pdev_id: pdev id 129 * 130 * This function gets called to get current host 131 * config dcs enable/disable status 132 * 133 * Return: WLANIM/CWIM enable status 134 */ 135 uint8_t ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id); 136 137 /** 138 * ucfg_dcs_clear() - API to clear dcs related information 139 * @psoc: pointer to psoc object 140 * @pdev_id: pdev id 141 * 142 * This function gets called to clear dcs related information 143 * 144 * Return: None 145 */ 146 void ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id); 147 148 /** 149 * ucfg_config_dcs_event_data() - config dcs event data to do algorithm 150 * process or not 151 * @psoc: psoc pointer 152 * @pdev_id: pdev_id 153 * @dcs_algorithm_process: dcs algorithm process or not 154 * 155 * The function gets called to config dcs event data to do algorithm 156 * process or not 157 * 158 * Return: None 159 */ 160 void ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id, 161 bool dcs_algorithm_process); 162 163 /* 164 * ucfg_dcs_reset_user_stats() - API to reset dcs user stats 165 * @psoc: pointer to psoc object 166 * @pdev_id: pdev id 167 * 168 * Return: None 169 */ 170 void ucfg_dcs_reset_user_stats(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id); 171 172 /** 173 * ucfg_dcs_set_user_request() - API to set dcs user stats request counter 174 * @psoc: pointer to psoc object 175 * @pdev_id: pdev id 176 * @user_request_count: user stats request counter 177 * 178 * Return: None 179 */ 180 void ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 181 uint32_t user_request_count); 182 #else 183 static inline void 184 ucfg_dcs_register_cb(struct wlan_objmgr_psoc *psoc, dcs_callback cbk, void *arg) 185 { 186 } 187 188 static inline void 189 ucfg_dcs_register_user_cb(struct wlan_objmgr_psoc *psoc, 190 uint8_t pdev_id, uint8_t vdev_id, 191 void (*cb)(uint8_t vdev_id, 192 struct wlan_host_dcs_im_user_stats *stats, 193 int status)) 194 { 195 } 196 197 static inline QDF_STATUS 198 ucfg_wlan_dcs_cmd(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id, 199 bool is_host_pdev_id) 200 { 201 return QDF_STATUS_SUCCESS; 202 } 203 204 static inline void 205 ucfg_config_dcs_enable(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id, 206 uint8_t interference_type) 207 { 208 } 209 210 static inline void 211 ucfg_config_dcs_disable(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id, 212 uint8_t interference_type) 213 { 214 } 215 216 static inline uint8_t 217 ucfg_get_dcs_enable(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id) 218 { 219 return 0; 220 } 221 222 static inline void 223 ucfg_dcs_clear(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id) 224 { 225 } 226 227 static inline void 228 ucfg_config_dcs_event_data(struct wlan_objmgr_psoc *psoc, uint32_t pdev_id, 229 bool dcs_algorithm_process) 230 { 231 } 232 233 static inline void 234 ucfg_dcs_reset_user_stats(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id) 235 { 236 } 237 238 static inline void 239 ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id, 240 uint32_t user_request_count) 241 { 242 } 243 #endif 244 #endif /* _WLAN_DCS_UCFG_API_H_ */ 245