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