1 /* 2 * Copyright (c) 2017-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: contains scan api 21 */ 22 23 #ifndef _WLAN_SCAN_API_H_ 24 #define _WLAN_SCAN_API_H_ 25 26 #include <wlan_objmgr_psoc_obj.h> 27 #include <wlan_objmgr_pdev_obj.h> 28 #include <wlan_objmgr_vdev_obj.h> 29 #include "../../core/src/wlan_scan_main.h" 30 31 /** 32 * wlan_scan_cfg_set_active_2g_dwelltime() - API to set scan active 2g dwelltime 33 * @psoc: pointer to psoc object 34 * @dwell_time: scan active dwell time 35 * 36 * Return: none 37 */ 38 void wlan_scan_cfg_set_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc, 39 uint32_t dwell_time); 40 41 /** 42 * wlan_scan_cfg_get_active_2g_dwelltime() - API to get active 2g dwelltime 43 * @psoc: pointer to psoc object 44 * @dwell_time: scan active dwelltime 45 * 46 * Return: scan active dwell time 47 */ 48 void wlan_scan_cfg_get_active_2g_dwelltime(struct wlan_objmgr_psoc *psoc, 49 uint32_t *dwell_time); 50 51 #ifdef CONFIG_BAND_6GHZ 52 /** 53 * wlan_scan_cfg_set_active_6g_dwelltime() - API to set scan active 6g dwelltime 54 * @psoc: pointer to psoc object 55 * @dwell_time: scan active dwell time 56 * 57 * Return: QDF_STATUS 58 */ 59 QDF_STATUS wlan_scan_cfg_set_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc, 60 uint32_t dwell_time); 61 62 /** 63 * wlan_scan_cfg_get_active_6g_dwelltime() - API to get active 6g dwelltime 64 * @psoc: pointer to psoc object 65 * @dwell_time: scan active dwelltime 66 * 67 * Return: QDF_STATUS 68 */ 69 QDF_STATUS wlan_scan_cfg_get_active_6g_dwelltime(struct wlan_objmgr_psoc *psoc, 70 uint32_t *dwell_time); 71 72 /** 73 * wlan_scan_cfg_set_passive_6g_dwelltime() - API to set scan passive 6g 74 * dwelltime 75 * @psoc: pointer to psoc object 76 * @dwell_time: scan passive dwell time 77 * 78 * Return: QDF_STATUS 79 */ 80 QDF_STATUS wlan_scan_cfg_set_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc, 81 uint32_t dwell_time); 82 83 /** 84 * wlan_scan_cfg_get_passive_6g_dwelltime() - API to get passive 6g dwelltime 85 * @psoc: pointer to psoc object 86 * @dwell_time: scan passive dwelltime 87 * 88 * Return: QDF_STATUS 89 */ 90 QDF_STATUS wlan_scan_cfg_get_passive_6g_dwelltime(struct wlan_objmgr_psoc *psoc, 91 uint32_t *dwell_time); 92 #endif 93 94 /** 95 * wlan_scan_cfg_set_active_dwelltime() - API to set scan active dwelltime 96 * @psoc: pointer to psoc object 97 * @dwell_time: scan active dwell time 98 * 99 * Return: none 100 */ 101 void wlan_scan_cfg_set_active_dwelltime(struct wlan_objmgr_psoc *psoc, 102 uint32_t dwell_time); 103 /** 104 * wlan_scan_cfg_get_active_dwelltime() - API to get active dwelltime 105 * @psoc: pointer to psoc object 106 * @dwell_time: scan active dwelltime 107 * 108 * Return: scan active dwell time 109 */ 110 void wlan_scan_cfg_get_active_dwelltime(struct wlan_objmgr_psoc *psoc, 111 uint32_t *dwell_time); 112 113 /** 114 * wlan_scan_cfg_set_passive_dwelltime() - API to set scan passive dwelltime 115 * @psoc: pointer to psoc object 116 * @dwell_time: scan passive dwell time 117 * 118 * Return: none 119 */ 120 void wlan_scan_cfg_set_passive_dwelltime(struct wlan_objmgr_psoc *psoc, 121 uint32_t dwell_time); 122 /** 123 * wlan_scan_cfg_get_passive_dwelltime() - API to get passive dwelltime 124 * @psoc: pointer to psoc object 125 * @dwell_time: scan passive dwelltime 126 * 127 * Return: scan passive dwell time 128 */ 129 void wlan_scan_cfg_get_passive_dwelltime(struct wlan_objmgr_psoc *psoc, 130 uint32_t *dwell_time); 131 132 #ifdef WLAN_POLICY_MGR_ENABLE 133 /* 134 * wlan_scan_update_pno_dwell_time() - update active and passive dwell time 135 * depending on active concurrency modes 136 * @vdev: vdev object pointer 137 * @req: scan request 138 * 139 * Return: void 140 */ 141 void wlan_scan_update_pno_dwell_time(struct wlan_objmgr_vdev *vdev, 142 struct pno_scan_req_params *req, 143 struct scan_default_params *scan_def); 144 #endif 145 146 /** 147 * wlan_scan_cfg_get_conc_active_dwelltime() - Get concurrent active dwelltime 148 * @psoc: pointer to psoc object 149 * @dwell_time: scan active dwelltime 150 * 151 * Return: scan concurrent active dwell time 152 */ 153 void wlan_scan_cfg_get_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc, 154 uint32_t *dwell_time); 155 156 /** 157 * wlan_scan_cfg_set_conc_active_dwelltime() - Set concurrent active dwelltime 158 * @psoc: pointer to psoc object 159 * @dwell_time: scan active dwelltime 160 * 161 * Return: scan concurrent active dwell time 162 */ 163 void wlan_scan_cfg_set_conc_active_dwelltime(struct wlan_objmgr_psoc *psoc, 164 uint32_t dwell_time); 165 166 /** 167 * wlan_scan_cfg_get_conc_passive_dwelltime() - Get passive concurrent dwelltime 168 * @psoc: pointer to psoc object 169 * @dwell_time: scan passive dwelltime 170 * 171 * Return: scan concurrent passive dwell time 172 */ 173 void wlan_scan_cfg_get_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc, 174 uint32_t *dwell_time); 175 176 /** 177 * wlan_scan_cfg_set_conc_passive_dwelltime() - Set passive concurrent dwelltime 178 * @psoc: pointer to psoc object 179 * @dwell_time: scan passive dwelltime 180 * 181 * Return: scan concurrent passive dwell time 182 */ 183 void wlan_scan_cfg_set_conc_passive_dwelltime(struct wlan_objmgr_psoc *psoc, 184 uint32_t dwell_time); 185 186 /** 187 * wlan_scan_cfg_honour_nl_scan_policy_flags() - API to get nl scan policy 188 * flags honoured 189 * @psoc: pointer to psoc object 190 * 191 * Return: nl scan policy flags honoured or not 192 */ 193 bool wlan_scan_cfg_honour_nl_scan_policy_flags(struct wlan_objmgr_psoc *psoc); 194 195 /** 196 * wlan_scan_cfg_get_conc_max_resttime() - API to get max rest time 197 * @psoc: pointer to psoc object 198 * @rest_time: scan concurrent max resttime 199 * 200 * Return: scan concurrent max rest time 201 */ 202 void wlan_scan_cfg_get_conc_max_resttime(struct wlan_objmgr_psoc *psoc, 203 uint32_t *rest_time); 204 205 /** 206 * wlan_scan_cfg_get_dfs_chan_scan_allowed() - API to get dfs scan enabled 207 * @psoc: pointer to psoc object 208 * @enable_dfs_scan: DFS scan enabled or not. 209 * 210 * Return: None 211 */ 212 void wlan_scan_cfg_get_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc, 213 bool *enable_dfs_scan); 214 215 /** 216 * wlan_scan_cfg_set_dfs_chan_scan_allowed() - API to set dfs scan enabled. 217 * @psoc: pointer to psoc object 218 * @enable_dfs_scan: Set dfs scan enabled or not. 219 * 220 * Return: None 221 */ 222 void wlan_scan_cfg_set_dfs_chan_scan_allowed(struct wlan_objmgr_psoc *psoc, 223 bool enable_dfs_scan); 224 225 /** 226 * wlan_scan_cfg_get_conc_min_resttime() - API to get concurrent min rest time 227 * @psoc: pointer to psoc object 228 * @rest_time: scan concurrent min rest time 229 * 230 * Return: scan concurrent min rest time 231 */ 232 void wlan_scan_cfg_get_conc_min_resttime(struct wlan_objmgr_psoc *psoc, 233 uint32_t *rest_time); 234 235 /** 236 * wlan_scan_is_snr_monitor_enabled() - API to get SNR monitoring enabled or not 237 * @psoc: pointer to psoc object 238 * 239 * Return: enable/disable snr monitor mode. 240 */ 241 bool wlan_scan_is_snr_monitor_enabled(struct wlan_objmgr_psoc *psoc); 242 243 /** 244 * wlan_scan_process_bcn_probe_rx_sync() - handle bcn without posting to 245 * scheduler thread 246 * @psoc: psoc context 247 * @buf: frame buf 248 * @params: rx event params 249 * @frm_type: frame type 250 * 251 * handle bcn without posting to scheduler thread, this should be called 252 * while caller is already in scheduler thread context 253 * 254 * Return: success or error code. 255 */ 256 QDF_STATUS 257 wlan_scan_process_bcn_probe_rx_sync(struct wlan_objmgr_psoc *psoc, 258 qdf_nbuf_t buf, 259 struct mgmt_rx_event_params *rx_param, 260 enum mgmt_frame_type frm_type); 261 262 /** 263 * wlan_scan_get_aging_time - Get the scan aging time config 264 * @psoc: psoc context 265 * 266 * Return: Scan aging time config 267 */ 268 qdf_time_t wlan_scan_get_aging_time(struct wlan_objmgr_psoc *psoc); 269 270 /** 271 * wlan_scan_set_aging_time - Set the scan aging time config 272 * @psoc: psoc context 273 * @time: scan aging time 274 * 275 * Return: success or error code. 276 */ 277 QDF_STATUS wlan_scan_set_aging_time(struct wlan_objmgr_psoc *psoc, 278 qdf_time_t time); 279 280 /** 281 * wlan_scan_purge_results() - purge the scan list 282 * @scan_list: scan list to be purged 283 * 284 * This function purge the temp scan list 285 * 286 * Return: QDF_STATUS 287 */ 288 static inline QDF_STATUS wlan_scan_purge_results(qdf_list_t *scan_list) 289 { 290 return scm_purge_scan_results(scan_list); 291 } 292 293 /** 294 * wlan_scan_get_result() - The Public API to get scan results 295 * @pdev: pdev info 296 * @filter: Filters 297 * 298 * This function fetches scan result 299 * 300 * Return: scan list pointer 301 */ 302 static inline qdf_list_t *wlan_scan_get_result(struct wlan_objmgr_pdev *pdev, 303 struct scan_filter *filter) 304 { 305 return scm_get_scan_result(pdev, filter); 306 } 307 308 /** 309 * wlan_scan_update_mlme_by_bssinfo() - The Public API to update mlme 310 * info in the scan entry 311 * @pdev: pdev object 312 * @bss_info: bssid info to find the matching scan entry 313 * @mlme_info: mlme info to be updated. 314 * 315 * Return: QDF_STATUS 316 */ 317 static inline QDF_STATUS 318 wlan_scan_update_mlme_by_bssinfo(struct wlan_objmgr_pdev *pdev, 319 struct bss_info *bss_info, 320 struct mlme_info *mlme_info) 321 { 322 return scm_scan_update_mlme_by_bssinfo(pdev, bss_info, mlme_info); 323 } 324 325 /** 326 * wlan_scan_start() - Public API to start a scan 327 * @req: start scan req params 328 * 329 * The Public API to start a scan. Post a msg to target_if queue 330 * 331 * Return: QDF_STATUS. 332 */ 333 QDF_STATUS wlan_scan_start(struct scan_start_request *req); 334 335 /** 336 * wlan_scan_cancel() - Public API to stop a scan 337 * @req: stop scan request params 338 * 339 * The Public API to stop a scan. Post a msg to target_if queue 340 * 341 * Return: QDF_STATUS. 342 */ 343 QDF_STATUS wlan_scan_cancel(struct scan_cancel_request *req); 344 345 /** 346 * wlan_scan_get_scan_id() - Public API to allocate scan ID 347 * @psoc: psoc object 348 * 349 * Public API, allocates a new scan id for caller 350 * 351 * Return: newly allocated scan ID 352 */ 353 wlan_scan_id 354 wlan_scan_get_scan_id(struct wlan_objmgr_psoc *psoc); 355 356 /** 357 * wlan_scan_init_default_params() - Public API to initialize scan params 358 * @vdev: vdev object 359 * @req: scan request object 360 * 361 * Public API to initialize scan start request with defaults scan params 362 * 363 * Return: QDF_STATUS_SUCCESS or error code 364 */ 365 QDF_STATUS 366 wlan_scan_init_default_params(struct wlan_objmgr_vdev *vdev, 367 struct scan_start_request *req); 368 369 /** 370 * wlan_scan_register_requester() - Public API, assigns requester ID 371 * to caller and registers scan event call back handler 372 * @psoc: psoc object 373 * @module_name:name of requester module 374 * @event_cb: event callback function pointer 375 * @arg: argument to @event_cb 376 * 377 * API, allows other components to allocate requester id. 378 * Normally used by modules at init time to register their callback 379 * and get one requester id. @event_cb will be invoked for 380 * all scan events whose requester id matches with @requester. 381 * 382 * Return: assigned non zero requester id for success 383 * zero (0) for failure 384 */ 385 wlan_scan_requester 386 wlan_scan_register_requester(struct wlan_objmgr_psoc *psoc, 387 uint8_t *module_name, 388 scan_event_handler event_cb, 389 void *arg); 390 391 /** 392 * wlan_scan_unregister_requester() -Public API, reclaims previously 393 * allocated requester ID 394 * @psoc: psoc object 395 * @requester: requester ID to reclaim. 396 * 397 * API, reclaims previously allocated requester id. 398 * 399 * Return: void 400 */ 401 void 402 wlan_scan_unregister_requester(struct wlan_objmgr_psoc *psoc, 403 wlan_scan_requester requester); 404 405 #endif 406