1 /* 2 * Copyright (c) 2017-2020 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 init/deinit public api 21 */ 22 23 #ifndef _WLAN_SCAN_MAIN_API_H_ 24 #define _WLAN_SCAN_MAIN_API_H_ 25 26 #include <qdf_atomic.h> 27 #include <wlan_objmgr_psoc_obj.h> 28 #include <wlan_objmgr_pdev_obj.h> 29 #include <wlan_objmgr_vdev_obj.h> 30 #include <wlan_scan_public_structs.h> 31 #include "wlan_scan_cache_db.h" 32 #include "wlan_scan_11d.h" 33 #include "wlan_scan_cfg.h" 34 35 #define scm_alert(params...) \ 36 QDF_TRACE_FATAL(QDF_MODULE_ID_SCAN, params) 37 #define scm_err(params...) \ 38 QDF_TRACE_ERROR(QDF_MODULE_ID_SCAN, params) 39 #define scm_warn(params...) \ 40 QDF_TRACE_WARN(QDF_MODULE_ID_SCAN, params) 41 #define scm_notice(params...) \ 42 QDF_TRACE_INFO(QDF_MODULE_ID_SCAN, params) 43 #define scm_info(params...) \ 44 QDF_TRACE_INFO(QDF_MODULE_ID_SCAN, params) 45 #define scm_debug(params...) \ 46 QDF_TRACE_DEBUG(QDF_MODULE_ID_SCAN, params) 47 48 /* Rate Limited Logs */ 49 #define scm_alert_rl(params...) \ 50 QDF_TRACE_FATAL_RL(QDF_MODULE_ID_SCAN, params) 51 #define scm_err_rl(params...) \ 52 QDF_TRACE_ERROR_RL(QDF_MODULE_ID_SCAN, params) 53 #define scm_warn_rl(params...) \ 54 QDF_TRACE_WARN_RL(QDF_MODULE_ID_SCAN, params) 55 #define scm_info_rl(params...) \ 56 QDF_TRACE_INFO_RL(QDF_MODULE_ID_SCAN, params) 57 #define scm_debug_rl(params...) \ 58 QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_SCAN, params) 59 60 #define scm_nofl_alert(params...) \ 61 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_SCAN, params) 62 #define scm_nofl_err(params...) \ 63 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_SCAN, params) 64 #define scm_nofl_warn(params...) \ 65 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_SCAN, params) 66 #define scm_nofl_info(params...) \ 67 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_SCAN, params) 68 #define scm_nofl_debug(params...) \ 69 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_SCAN, params) 70 71 #define scm_hex_dump(level, data, buf_len) \ 72 qdf_trace_hex_dump(QDF_MODULE_ID_SCAN, level, data, buf_len) 73 74 #define MAX_SCAN_EVENT_HANDLERS_PER_PDEV 100 75 #define WLAN_MAX_MODULE_NAME 40 76 #define WLAN_MAX_REQUESTORS 200 77 #define WLAN_SCAN_ID_MASK 0x00000FFF 78 #define WLAN_HOST_SCAN_REQ_ID_PREFIX 0x0000A000 79 #define SCAN_NPROBES_DEFAULT 2 80 #define WLAN_P2P_SOCIAL_CHANNELS 3 81 82 #define SCAN_BURST_SCAN_MAX_NUM_OFFCHANNELS (3) 83 #define SCAN_SCAN_IDLE_TIME_DEFAULT (25) 84 #define SCAN_3PORT_CONC_SCAN_MAX_BURST_DURATION (25) 85 #define SCAN_CTS_DURATION_MS_MAX (32) 86 #define SCAN_ROAM_SCAN_CHANNEL_SWITCH_TIME (4) 87 #define SCAN_DWELL_TIME_PROBE_TIME_MAP_SIZE (11) 88 #define SCAN_GO_MIN_ACTIVE_SCAN_BURST_DURATION (40) 89 #define SCAN_GO_MAX_ACTIVE_SCAN_BURST_DURATION (240) 90 #define SCAN_P2P_SCAN_MAX_BURST_DURATION (240) 91 #define SCAN_GO_BURST_SCAN_MAX_NUM_OFFCHANNELS (6) 92 93 /* MAX RNR entries per channel*/ 94 #define WLAN_MAX_RNR_COUNT 15 95 96 /** 97 * struct probe_time_dwell_time - probe time, dwell time map 98 * @dwell_time: dwell time 99 * @probe_time: repeat probe time 100 */ 101 struct probe_time_dwell_time { 102 uint8_t dwell_time; 103 uint8_t probe_time; 104 }; 105 106 /* 107 * For the requestor id: 108 * bit 0~12 is used for real requestor id. 109 * bit 13~15 is used for requestor prefix. 110 * bit 16~19 is used by specific user to aware it is issued by himself. 111 * bit 20~31 is reserved. 112 */ 113 #define WLAN_SCAN_REQUESTER_ID_PREFIX 0x0000A000 114 #define WLAN_SCAN_REQUESTER_ID_MASK 0x00001FFF 115 116 #define SCM_NUM_RSSI_CAT 15 117 #define SCAN_STA_MIRACAST_MCC_REST_TIME 400 118 119 #define SCAN_TIMEOUT_GRACE_PERIOD 10 120 #define SCAN_MAX_BSS_PDEV 100 121 #define SCAN_PRIORITY SCAN_PRIORITY_LOW 122 123 /* DBS Scan policy selection ext flags */ 124 #define SCAN_FLAG_EXT_DBS_SCAN_POLICY_MASK 0x00000003 125 #define SCAN_FLAG_EXT_DBS_SCAN_POLICY_BIT 0 126 #define SCAN_DBS_POLICY_DEFAULT 0x0 127 #define SCAN_DBS_POLICY_FORCE_NONDBS 0x1 128 #define SCAN_DBS_POLICY_IGNORE_DUTY 0x2 129 #define SCAN_DBS_POLICY_MAX 0x3 130 /* Minimum number of channels for enabling DBS Scan */ 131 #define SCAN_MIN_CHAN_DBS_SCAN_THRESHOLD 8 132 /* 133 * Enable Reception of Public Action frame with this flag 134 */ 135 #define SCAN_FLAG_EXT_FILTER_PUBLIC_ACTION_FRAME 0x4 136 137 /* Indicate to scan all PSC channel */ 138 #define SCAN_FLAG_EXT_6GHZ_SCAN_ALL_PSC_CH 0x8 139 140 /* Indicate to scan all NON-PSC channel */ 141 #define SCAN_FLAG_EXT_6GHZ_SCAN_ALL_NON_PSC_CH 0x10 142 143 /* Indicate to save scan result matching hint from scan client */ 144 #define SCAN_FLAG_EXT_6GHZ_MATCH_HINT 0x20 145 146 /* Skip any channel on which RNR information is not received */ 147 #define SCAN_FLAG_EXT_6GHZ_SKIP_NON_RNR_CH 0x40 148 149 /* Indicate client hint req is high priority than FW rnr or FILS discovery */ 150 #define SCAN_FLAG_EXT_6GHZ_CLIENT_HIGH_PRIORITY 0x80 151 152 /* Passive dwell time if bt_a2dp is enabled. Time in msecs*/ 153 #define PASSIVE_DWELL_TIME_BT_A2DP_ENABLED 28 154 155 /** 156 * struct cb_handler - defines scan event handler 157 * call back function and arguments 158 * @func: handler function pointer 159 * @arg: argument to handler function 160 */ 161 struct cb_handler { 162 scan_event_handler func; 163 void *arg; 164 }; 165 166 /** 167 * struct pdev_scan_ev_handler - pdev scan event handlers 168 * @cb_handler: array of registered scan handlers 169 */ 170 struct pdev_scan_ev_handler { 171 uint32_t handler_cnt; 172 struct cb_handler cb_handlers[MAX_SCAN_EVENT_HANDLERS_PER_PDEV]; 173 }; 174 175 /** 176 * struct global_scan_ev_handlers - per pdev registered scan event handlers 177 * @pdev_scan_ev_handler: per pdev registered scan event handlers 178 */ 179 struct global_scan_ev_handlers { 180 struct pdev_scan_ev_handler pdev_ev_handlers[WLAN_UMAC_MAX_PDEVS]; 181 }; 182 183 /** 184 * struct scan_requester_info - defines scan requester id 185 * and event handler mapping 186 * @requester: requester ID allocated 187 * @module: module name of requester 188 * @ev_handler: event handlerto be invoked 189 */ 190 struct scan_requester_info { 191 wlan_scan_requester requester; 192 uint8_t module[WLAN_MAX_MODULE_NAME]; 193 struct cb_handler ev_handler; 194 }; 195 196 /** 197 * struct pdev_scan_info - defines per pdev scan info 198 * @wide_band_scan: wide band scan capability 199 * @last_scan_time: time of last scan start on this pdev 200 * @custom_chan_list: scan only these channels 201 * @conf_bssid: configured bssid of the hidden AP 202 * @conf_ssid: configured desired ssid 203 */ 204 struct pdev_scan_info { 205 bool wide_band_scan; 206 qdf_time_t last_scan_time; 207 struct chan_list custom_chan_list; 208 uint8_t conf_bssid[QDF_MAC_ADDR_SIZE]; 209 struct wlan_ssid conf_ssid; 210 }; 211 212 /** 213 * struct scan_vdev_obj - scan vdev obj 214 * @pno_match_evt_received: pno match received 215 * @pno_in_progress: pno in progress 216 * @scan_disabled: if scan is disabled for this vdev 217 * @first_scan_done: Whether its the first scan or not for this particular vdev. 218 */ 219 struct scan_vdev_obj { 220 bool pno_match_evt_received; 221 bool pno_in_progress; 222 uint32_t scan_disabled; 223 bool first_scan_done; 224 }; 225 226 #ifdef FEATURE_WLAN_SCAN_PNO 227 /** 228 * struct pno_def_config - def configuration for PNO 229 * @pno_offload_enabled: flag to check if PNO offload is enabled/disabled 230 * @channel_prediction: config PNO channel prediction feature status 231 * @top_k_num_of_channels: def top K number of channels are used for tanimoto 232 * distance calculation. 233 * @stationary_thresh: def threshold val to determine that STA is stationary. 234 * @pnoscan_adaptive_dwell_mode: def adaptive dwelltime mode for pno scan 235 * @channel_prediction_full_scan: def periodic timer upon which full scan needs 236 * to be triggered. 237 * @dfs_chnl_scan_enable: Enable dfs channel PNO scan 238 * @scan_support_enabled: PNO scan support enabled/disabled 239 * @scan_timer_repeat_value: PNO scan timer repeat value 240 * @slow_scan_multiplier: PNO slow scan timer multiplier 241 * @max_sched_scan_plan_interval: PNO scan interval 242 * @max_sched_scan_plan_iterations: PNO scan number of iterations 243 * @scan_backoff_multiplier: Scan banckoff multiplier 244 * @pno_wake_lock: pno wake lock 245 * @pno_cb: callback to call on PNO completion 246 * @mawc_params: Configuration parameters for NLO MAWC. 247 */ 248 struct pno_def_config { 249 bool pno_offload_enabled; 250 bool channel_prediction; 251 uint8_t top_k_num_of_channels; 252 uint8_t stationary_thresh; 253 enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; 254 uint32_t channel_prediction_full_scan; 255 bool dfs_chnl_scan_enabled; 256 bool scan_support_enabled; 257 uint32_t scan_timer_repeat_value; 258 uint32_t slow_scan_multiplier; 259 uint32_t max_sched_scan_plan_interval; 260 uint32_t max_sched_scan_plan_iterations; 261 uint8_t scan_backoff_multiplier; 262 qdf_wake_lock_t pno_wake_lock; 263 struct cb_handler pno_cb; 264 struct nlo_mawc_params mawc_params; 265 }; 266 #endif 267 268 #ifdef FEATURE_WLAN_EXTSCAN 269 /** 270 * struct extscan_def_config - def configuration for EXTSCAN 271 * @extscan_enabled: enable extscan 272 * @extscan_passive_max_chn_time: max passive channel time 273 * @extscan_passive_min_chn_time: min passive channel time 274 * @extscan_active_max_chn_time: max active channel time 275 * @extscan_active_min_chn_time: min active channel time 276 */ 277 struct extscan_def_config { 278 bool extscan_enabled; 279 uint32_t extscan_passive_max_chn_time; 280 uint32_t extscan_passive_min_chn_time; 281 uint32_t extscan_active_max_chn_time; 282 uint32_t extscan_active_min_chn_time; 283 }; 284 #endif 285 286 /** 287 * struct scan_default_params - default scan parameters to be used 288 * @active_dwell: default active dwell time 289 * @allow_dfs_chan_in_first_scan: first scan should contain dfs channels or not. 290 * @allow_dfs_chan_in_scan: Scan DFS channels or not. 291 * @skip_dfs_chan_in_p2p_search: Skip DFS channels in p2p search. 292 * @use_wake_lock_in_user_scan: if wake lock will be acquired during user scan 293 * @active_dwell_2g: default active dwell time for 2G channels, if it's not zero 294 * @active_dwell_6g: default active dwell time for 6G channels 295 * @passive_dwell_6g: default passive dwell time for 6G channels 296 * @passive_dwell:default passive dwell time 297 * @max_rest_time: default max rest time 298 * @sta_miracast_mcc_rest_time: max rest time for miracast and mcc 299 * @min_rest_time: default min rest time 300 * @idle_time: default idle time 301 * @conc_active_dwell: default concurrent active dwell time 302 * @conc_passive_dwell: default concurrent passive dwell time 303 * @conc_max_rest_time: default concurrent max rest time 304 * @conc_min_rest_time: default concurrent min rest time 305 * @conc_idle_time: default concurrent idle time 306 * @repeat_probe_time: default repeat probe time 307 * @probe_spacing_time: default probe spacing time 308 * @probe_delay: default probe delay 309 * @burst_duration: default burst duration 310 * @max_scan_time: default max scan time 311 * @num_probes: default maximum number of probes to sent 312 * @cache_aging_time: default scan cache aging time 313 * @select_5gh_margin: Prefer connecting to 5G AP even if 314 * its RSSI is lower by select_5gh_margin dbm than 2.4G AP. 315 * applicable if prefer_5ghz is set. 316 * @enable_mac_spoofing: enable mac address spoof in scan 317 * @max_bss_per_pdev: maximum number of bss entries to be maintained per pdev 318 * @max_active_scans_allowed: maximum number of active parallel scan allowed 319 * per psoc 320 * @scan_mode_6g: scan mode in 6Ghz 321 * @enable_connected_scan: enable scans after connection 322 * @scan_priority: default scan priority 323 * @adaptive_dwell_time_mode: adaptive dwell mode with connection 324 * @adaptive_dwell_time_mode_nc: adaptive dwell mode without connection 325 * @honour_nl_scan_policy_flags: honour nl80211 scan policy flags 326 * @extscan_adaptive_dwell_mode: Adaptive dwell mode during ext scan 327 * @scan_f_passive: passively scan all channels including active channels 328 * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified 329 * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req 330 * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req 331 * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor 332 * @scan_f_filter_prb_req: filter Probe request frames 333 * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels 334 * @scan_f_continue_on_err:continue scan even if few certain erros have occurred 335 * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan 336 * @scan_f_offchan_data_tx: allow data transmission during off channel scan 337 * @scan_f_promisc_mode: scan with promiscuous mode 338 * @scan_f_capture_phy_err: enable capture ppdu with phy errrors 339 * @scan_f_strict_passive_pch: do passive scan on passive channels 340 * @scan_f_half_rate: enable HALF (10MHz) rate support 341 * @scan_f_quarter_rate: set Quarter (5MHz) rate support 342 * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel 343 * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame 344 * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame 345 * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe 346 * @scan_f_add_rand_seq_in_probe: use random sequence number in probe 347 * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe 348 * @scan_f_forced: force scan even in presence of data traffic 349 * @scan_f_2ghz: scan 2.4 GHz channels 350 * @scan_f_5ghz: scan 5 GHz channels 351 * @scan_f_wide_band: scan in 40 MHz or higher bandwidth 352 * @scan_flags: variable to read and set scan_f_* flags in one shot 353 * can be used to dump all scan_f_* flags for debug 354 * @scan_ev_started: notify scan started event 355 * @scan_ev_completed: notify scan completed event 356 * @scan_ev_bss_chan: notify bss chan event 357 * @scan_ev_foreign_chan: notify foreign chan event 358 * @scan_ev_dequeued: notify scan request dequed event 359 * @scan_ev_preempted: notify scan preempted event 360 * @scan_ev_start_failed: notify scan start failed event 361 * @scan_ev_restarted: notify scan restarted event 362 * @scan_ev_foreign_chn_exit: notify foreign chan exit event 363 * @scan_ev_invalid: notify invalid scan request event 364 * @scan_ev_gpio_timeout: notify gpio timeout event 365 * @scan_ev_suspended: notify scan suspend event 366 * @scan_ev_resumed: notify scan resumed event 367 * @scan_events: variable to read and set scan_ev_* flags in one shot 368 * can be used to dump all scan_ev_* flags for debug 369 * @roam_params: roam related params 370 */ 371 struct scan_default_params { 372 uint32_t active_dwell; 373 bool allow_dfs_chan_in_first_scan; 374 bool allow_dfs_chan_in_scan; 375 bool skip_dfs_chan_in_p2p_search; 376 bool use_wake_lock_in_user_scan; 377 uint32_t active_dwell_2g; 378 uint32_t active_dwell_6g; 379 uint32_t passive_dwell_6g; 380 uint32_t passive_dwell; 381 uint32_t max_rest_time; 382 uint32_t sta_miracast_mcc_rest_time; 383 uint32_t min_rest_time; 384 uint32_t idle_time; 385 uint32_t conc_active_dwell; 386 uint32_t conc_passive_dwell; 387 uint32_t conc_max_rest_time; 388 uint32_t conc_min_rest_time; 389 uint32_t conc_idle_time; 390 uint32_t repeat_probe_time; 391 uint32_t probe_spacing_time; 392 uint32_t probe_delay; 393 uint32_t burst_duration; 394 uint32_t max_scan_time; 395 uint32_t num_probes; 396 qdf_time_t scan_cache_aging_time; 397 uint32_t select_5ghz_margin; 398 bool enable_mac_spoofing; 399 uint32_t usr_cfg_probe_rpt_time; 400 uint32_t usr_cfg_num_probes; 401 uint16_t max_bss_per_pdev; 402 uint32_t max_active_scans_allowed; 403 uint8_t sta_scan_burst_duration; 404 uint8_t p2p_scan_burst_duration; 405 uint8_t go_scan_burst_duration; 406 uint8_t ap_scan_burst_duration; 407 enum scan_mode_6ghz scan_mode_6g; 408 bool enable_connected_scan; 409 enum scan_priority scan_priority; 410 enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode; 411 enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode_nc; 412 bool honour_nl_scan_policy_flags; 413 enum scan_dwelltime_adaptive_mode extscan_adaptive_dwell_mode; 414 union { 415 struct { 416 uint32_t scan_f_passive:1, 417 scan_f_bcast_probe:1, 418 scan_f_cck_rates:1, 419 scan_f_ofdm_rates:1, 420 scan_f_chan_stat_evnt:1, 421 scan_f_filter_prb_req:1, 422 scan_f_bypass_dfs_chn:1, 423 scan_f_continue_on_err:1, 424 scan_f_offchan_mgmt_tx:1, 425 scan_f_offchan_data_tx:1, 426 scan_f_promisc_mode:1, 427 scan_f_capture_phy_err:1, 428 scan_f_strict_passive_pch:1, 429 scan_f_half_rate:1, 430 scan_f_quarter_rate:1, 431 scan_f_force_active_dfs_chn:1, 432 scan_f_add_tpc_ie_in_probe:1, 433 scan_f_add_ds_ie_in_probe:1, 434 scan_f_add_spoofed_mac_in_probe:1, 435 scan_f_add_rand_seq_in_probe:1, 436 scan_f_en_ie_whitelist_in_probe:1, 437 scan_f_forced:1, 438 scan_f_2ghz:1, 439 scan_f_5ghz:1, 440 scan_f_wide_band:1; 441 }; 442 uint32_t scan_flags; 443 }; 444 union { 445 struct { 446 uint32_t scan_ev_started:1, 447 scan_ev_completed:1, 448 scan_ev_bss_chan:1, 449 scan_ev_foreign_chan:1, 450 scan_ev_dequeued:1, 451 scan_ev_preempted:1, 452 scan_ev_start_failed:1, 453 scan_ev_restarted:1, 454 scan_ev_foreign_chn_exit:1, 455 scan_ev_invalid:1, 456 scan_ev_gpio_timeout:1, 457 scan_ev_suspended:1, 458 scan_ev_resumed:1; 459 }; 460 uint32_t scan_events; 461 }; 462 }; 463 464 /** 465 * struct scan_cb - nif/sif function callbacks 466 * @inform_beacon: cb to indicate frame to OS 467 * @update_beacon: cb to indicate frame to MLME 468 * @unlink_bss: cb to unlink bss from kernel cache 469 */ 470 struct scan_cb { 471 update_beacon_cb inform_beacon; 472 update_beacon_cb update_beacon; 473 update_beacon_cb unlink_bss; 474 /* Define nif/sif function callbacks here */ 475 }; 476 477 /** 478 * struct wlan_scan_obj - scan object definition 479 * @scan_disabled: if scan is disabled 480 * @scan_db: scan cache data base 481 * @cc_db: pointer of country code data base 482 * @lock: spin lock 483 * @scan_def: default scan parameters 484 * @cb: nif/sif function callbacks 485 * @requesters: requester allocation pool 486 * @scan_ids: last allocated scan id 487 * @global_evhandlers: registered scan event handlers 488 * @pdev_info: pointer to pdev info 489 * @pno_cfg: default pno configuration 490 * @extscan_cfg: default extscan configuration 491 * @ie_whitelist: default ie whitelist attrs 492 * @bt_a2dp_enabled: if bt a2dp is enabled 493 * @miracast_enabled: miracast enabled 494 * @disable_timeout: command timeout disabled 495 * @drop_bcn_on_chan_mismatch: drop bcn if channel mismatch 496 * @drop_bcn_on_invalid_freq: drop bcn if freq is invalid in IEs (DS/HT/HE) 497 * @scan_start_request_buff: buffer used to pass 498 * scan config to event handlers 499 * @rnr_channel_db: RNR channel list database 500 */ 501 struct wlan_scan_obj { 502 uint32_t scan_disabled; 503 qdf_spinlock_t lock; 504 qdf_atomic_t scan_ids; 505 struct scan_dbs scan_db[WLAN_UMAC_MAX_PDEVS]; 506 struct scan_country_code_db *cc_db; 507 struct scan_default_params scan_def; 508 struct scan_cb cb; 509 struct scan_requester_info requesters[WLAN_MAX_REQUESTORS]; 510 struct global_scan_ev_handlers global_evhandlers; 511 struct pdev_scan_info pdev_info[WLAN_UMAC_MAX_PDEVS]; 512 #ifdef FEATURE_WLAN_SCAN_PNO 513 struct pno_def_config pno_cfg; 514 #endif 515 #ifdef FEATURE_WLAN_EXTSCAN 516 struct extscan_def_config extscan_cfg; 517 #endif 518 struct probe_req_whitelist_attr ie_whitelist; 519 bool bt_a2dp_enabled; 520 bool miracast_enabled; 521 bool disable_timeout; 522 bool drop_bcn_on_chan_mismatch; 523 bool drop_bcn_on_invalid_freq; 524 struct scan_start_request scan_start_request_buff; 525 #ifdef FEATURE_6G_SCAN_CHAN_SORT_ALGO 526 struct channel_list_db rnr_channel_db; 527 #endif 528 }; 529 530 /** 531 * wlan_psoc_get_scan_obj() - private API to get scan object from psoc 532 * @psoc: psoc object 533 * 534 * Return: scan object 535 */ 536 #define wlan_psoc_get_scan_obj(psoc) \ 537 wlan_psoc_get_scan_obj_fl(psoc, \ 538 __func__, __LINE__) 539 540 static inline struct wlan_scan_obj * 541 wlan_psoc_get_scan_obj_fl(struct wlan_objmgr_psoc *psoc, 542 const char *func, uint32_t line) 543 { 544 struct wlan_scan_obj *scan_obj; 545 546 scan_obj = (struct wlan_scan_obj *) 547 wlan_objmgr_psoc_get_comp_private_obj(psoc, 548 WLAN_UMAC_COMP_SCAN); 549 if (!scan_obj) { 550 scm_err("%s:%u, Failed to get scan object", func, line); 551 return NULL; 552 } 553 return scan_obj; 554 } 555 556 /** 557 * wlan_pdev_get_scan_obj() - private API to get scan object from pdev 558 * @psoc: pdev object 559 * 560 * Return: scan object 561 */ 562 static inline struct wlan_scan_obj * 563 wlan_pdev_get_scan_obj(struct wlan_objmgr_pdev *pdev) 564 { 565 struct wlan_objmgr_psoc *psoc; 566 567 psoc = wlan_pdev_get_psoc(pdev); 568 569 return wlan_psoc_get_scan_obj(psoc); 570 } 571 572 /** 573 * wlan_vdev_get_scan_obj() - private API to get scan object from vdev 574 * @psoc: vdev object 575 * 576 * Return: scan object 577 */ 578 static inline struct wlan_scan_obj * 579 wlan_vdev_get_scan_obj(struct wlan_objmgr_vdev *vdev) 580 { 581 struct wlan_objmgr_pdev *pdev; 582 583 pdev = wlan_vdev_get_pdev(vdev); 584 585 return wlan_pdev_get_scan_obj(pdev); 586 } 587 588 /** 589 * wlan_get_vdev_scan_obj() - private API to get scan object vdev 590 * @vdev: vdev object 591 * 592 * Return: scan object 593 */ 594 static inline struct scan_vdev_obj * 595 wlan_get_vdev_scan_obj(struct wlan_objmgr_vdev *vdev) 596 { 597 struct scan_vdev_obj *scan_vdev_obj; 598 599 scan_vdev_obj = (struct scan_vdev_obj *) 600 wlan_objmgr_vdev_get_comp_private_obj(vdev, 601 WLAN_UMAC_COMP_SCAN); 602 603 return scan_vdev_obj; 604 } 605 606 /** 607 * wlan_scan_vdev_get_pdev_id() - private API to get pdev id from vdev object 608 * @vdev: vdev object 609 * 610 * Return: parent pdev id 611 */ 612 static inline uint8_t 613 wlan_scan_vdev_get_pdev_id(struct wlan_objmgr_vdev *vdev) 614 { 615 struct wlan_objmgr_pdev *pdev; 616 617 pdev = wlan_vdev_get_pdev(vdev); 618 619 return wlan_objmgr_pdev_get_pdev_id(pdev); 620 } 621 622 /** 623 * wlan_pdev_get_pdev_scan_ev_handlers() - private API to get 624 * pdev scan event handlers 625 * @vdev: pdev object 626 * 627 * Return: pdev_scan_ev_handler object 628 */ 629 static inline struct pdev_scan_ev_handler* 630 wlan_pdev_get_pdev_scan_ev_handlers(struct wlan_objmgr_pdev *pdev) 631 { 632 uint8_t pdevid; 633 struct wlan_scan_obj *scan = NULL; 634 635 if (!pdev) 636 goto err; 637 638 pdevid = wlan_objmgr_pdev_get_pdev_id(pdev); 639 scan = wlan_pdev_get_scan_obj(pdev); 640 if (!scan) 641 goto err; 642 643 return &scan->global_evhandlers.pdev_ev_handlers[pdevid]; 644 645 err: 646 scm_err("NULL pointer, pdev: 0x%pK, scan_obj: 0x%pK", 647 pdev, scan); 648 return NULL; 649 } 650 651 /** 652 * wlan_vdev_get_pdev_scan_ev_handlers() - private API to get 653 * pdev scan event handlers 654 * @vdev: vdev object 655 * 656 * Return: pdev_scan_ev_handler object 657 */ 658 static inline struct pdev_scan_ev_handler* 659 wlan_vdev_get_pdev_scan_ev_handlers(struct wlan_objmgr_vdev *vdev) 660 { 661 struct wlan_objmgr_pdev *pdev; 662 663 pdev = wlan_vdev_get_pdev(vdev); 664 665 return wlan_pdev_get_pdev_scan_ev_handlers(pdev); 666 } 667 668 /** 669 * wlan_scan_psoc_get_def_params() - private API to get scan defaults 670 * @psoc: psoc object 671 * 672 * Return: scan defaults 673 */ 674 static inline struct scan_default_params* 675 wlan_scan_psoc_get_def_params(struct wlan_objmgr_psoc *psoc) 676 { 677 struct wlan_scan_obj *scan = NULL; 678 679 if (!psoc) { 680 scm_err("null psoc"); 681 return NULL; 682 } 683 scan = wlan_psoc_get_scan_obj(psoc); 684 685 if (!scan) 686 return NULL; 687 688 return &scan->scan_def; 689 } 690 691 /** 692 * wlan_vdev_get_def_scan_params() - private API to get scan defaults 693 * @vdev: vdev object 694 * 695 * Return: scan defaults 696 */ 697 static inline struct scan_default_params* 698 wlan_vdev_get_def_scan_params(struct wlan_objmgr_vdev *vdev) 699 { 700 struct wlan_objmgr_psoc *psoc = NULL; 701 702 if (!vdev) { 703 scm_err("null vdev"); 704 return NULL; 705 } 706 psoc = wlan_vdev_get_psoc(vdev); 707 708 return wlan_scan_psoc_get_def_params(psoc); 709 } 710 711 /** 712 * wlan_scan_psoc_created_notification() - scan psoc create handler 713 * @psoc: psoc object 714 * @arg_list: Argument list 715 * 716 * Return: QDF_STATUS 717 */ 718 QDF_STATUS wlan_scan_psoc_created_notification(struct wlan_objmgr_psoc *psoc, 719 void *arg_list); 720 721 /** 722 * wlan_scan_psoc_deleted_notification() - scan psoc delete handler 723 * @psoc: psoc object 724 * @arg_list: Argument list 725 * 726 * Return: QDF_STATUS 727 */ 728 QDF_STATUS wlan_scan_psoc_destroyed_notification(struct wlan_objmgr_psoc *psoc, 729 void *arg_list); 730 731 /** 732 * wlan_scan_vdev_created_notification() - scan psoc create handler 733 * @vdev: vdev object 734 * @arg_list: Argument list 735 * 736 * Return: QDF_STATUS 737 */ 738 QDF_STATUS wlan_scan_vdev_created_notification(struct wlan_objmgr_vdev *vdev, 739 void *arg_list); 740 741 /** 742 * wlan_scan_vdev_destroyed_notification() - scan psoc delete handler 743 * @vdev: vdev object 744 * @arg_list: Argument list 745 * 746 * Return: QDF_STATUS 747 */ 748 QDF_STATUS wlan_scan_vdev_destroyed_notification(struct wlan_objmgr_vdev *vdev, 749 void *arg_list); 750 751 #endif 752