1 /* 2 * Copyright (c) 2017-2018 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 structure definations 21 */ 22 23 #ifndef _WLAN_SCAN_STRUCTS_H_ 24 #define _WLAN_SCAN_STRUCTS_H_ 25 #include <wlan_cmn.h> 26 #include <qdf_time.h> 27 #include <qdf_list.h> 28 #include <qdf_atomic.h> 29 #include <wlan_cmn_ieee80211.h> 30 #include <wlan_mgmt_txrx_utils_api.h> 31 32 typedef uint16_t wlan_scan_requester; 33 typedef uint32_t wlan_scan_id; 34 35 #define WLAN_SCAN_MAX_NUM_SSID 10 36 #define WLAN_SCAN_MAX_NUM_BSSID 10 37 #define WLAN_SCAN_MAX_NUM_CHANNELS 40 38 39 #define SCM_CANCEL_SCAN_WAIT_TIME 50 40 #define SCM_CANCEL_SCAN_WAIT_ITERATION 600 41 42 #define INVAL_SCAN_ID 0xFFFFFFFF 43 #define INVAL_VDEV_ID 0xFFFFFFFF 44 #define INVAL_PDEV_ID 0xFFFFFFFF 45 46 #define USER_SCAN_REQUESTOR_ID 0xA0000 47 #define PREAUTH_REQUESTOR_ID 0xC0000 48 49 #define BURST_SCAN_MAX_NUM_OFFCHANNELS 3 50 #define P2P_SCAN_MAX_BURST_DURATION 180 51 /* Increase dwell time for P2P search in ms */ 52 #define P2P_SEARCH_DWELL_TIME_INC 20 53 54 #define PROBE_REQ_BITMAP_LEN 8 55 #define MAX_PROBE_REQ_OUIS 16 56 57 #define RSSI_WEIGHTAGE 20 58 #define HT_CAPABILITY_WEIGHTAGE 2 59 #define VHT_CAP_WEIGHTAGE 1 60 #define HE_CAP_WEIGHTAGE 2 61 #define CHAN_WIDTH_WEIGHTAGE 17 62 #define CHAN_BAND_WEIGHTAGE 2 63 #define NSS_WEIGHTAGE 16 64 #define BEAMFORMING_CAP_WEIGHTAGE 2 65 #define PCL_WEIGHT 10 66 #define CHANNEL_CONGESTION_WEIGHTAGE 5 67 #define OCE_WAN_WEIGHTAGE 0 68 #define BEST_CANDIDATE_MAX_WEIGHT 100 69 #define MAX_INDEX_SCORE 100 70 #define MAX_INDEX_PER_INI 4 71 72 #define WLAN_GET_BITS(_val, _index, _num_bits) \ 73 (((_val) >> (_index)) & ((1 << (_num_bits)) - 1)) 74 75 #define WLAN_SET_BITS(_var, _index, _num_bits, _val) do { \ 76 (_var) &= ~(((1 << (_num_bits)) - 1) << (_index)); \ 77 (_var) |= (((_val) & ((1 << (_num_bits)) - 1)) << (_index)); \ 78 } while (0) 79 80 #define WLAN_GET_SCORE_PERCENTAGE(value32, bw_index) \ 81 WLAN_GET_BITS(value32, (8 * (bw_index)), 8) 82 #define WLAN_SET_SCORE_PERCENTAGE(value32, score_pcnt, bw_index) \ 83 WLAN_SET_BITS(value32, (8 * (bw_index)), 8, score_pcnt) 84 85 /* forward declaration */ 86 struct wlan_objmgr_vdev; 87 struct wlan_objmgr_pdev; 88 struct wlan_objmgr_psoc; 89 90 /** 91 * struct channel_info - BSS channel information 92 * @chan_idx: current operating channel index 93 * @cfreq0: channel frequency index0 94 * @cfreq1: channel frequency index1 95 * @priv: channel private information 96 */ 97 struct channel_info { 98 uint8_t chan_idx; 99 uint8_t cfreq0; 100 uint8_t cfreq1; 101 void *priv; 102 }; 103 104 /** 105 * struct element_info - defines length of a memory block and memory block 106 * @len: length of memory block 107 * @ptr: memory block pointer 108 */ 109 struct element_info { 110 uint32_t len; 111 uint8_t *ptr; 112 }; 113 114 /** 115 * struct ie_list - pointers to various IEs 116 * @tim: pointer to tim ie 117 * @country: pointer to country ie 118 * @ssid: pointer to ssid ie 119 * @rates: pointer to supported rates ie 120 * @xrates: pointer to extended supported rate ie 121 * @ds_param: pointer to ds params 122 * @csa: pointer to csa ie 123 * @xcsa: pointer to extended csa ie 124 * @wpa: pointer to wpa ie 125 * @wcn: pointer to wcn ie 126 * @rsn: pointer to rsn ie 127 * @wps: pointer to wps ie 128 * @wmeinfo: pointer to wmeinfo ie 129 * @wmeparam: pointer to wmeparam ie 130 * @quiet: pointer to quiet ie 131 * @htcap: pointer to htcap ie 132 * @htinfo: pointer to htinfo ie 133 * @athcaps: pointer to athcaps ie 134 * @athextcaps: pointer to extended athcaps ie 135 * @sfa: pointer to sfa ie 136 * @vendor: pointer to vendor ie 137 * @qbssload: pointer to qbssload ie 138 * @wapi: pointer to wapi ie 139 * @p2p: pointer to p2p ie 140 * @alt_wcn: pointer to alternate wcn ie 141 * @extcaps: pointer to extended caps ie 142 * @ibssdfs: pointer to ibssdfs ie 143 * @sonadv: pointer to wifi son ie 144 * @vhtcap: pointer to vhtcap ie 145 * @vhtop: pointer to vhtop ie 146 * @opmode: pointer to opmode ie 147 * @cswrp: pointer to channel switch announcement wrapper ie 148 * @widebw: pointer to wide band channel switch sub ie 149 * @txpwrenvlp: pointer to tx power envelop sub ie 150 * @srp: pointer to spatial reuse parameter sub extended ie 151 * @fils_indication: pointer to FILS indication ie 152 * @esp: pointer to ESP indication ie 153 * @mbo_oce: pointer to mbo/oce indication ie 154 */ 155 struct ie_list { 156 uint8_t *tim; 157 uint8_t *country; 158 uint8_t *ssid; 159 uint8_t *rates; 160 uint8_t *xrates; 161 uint8_t *ds_param; 162 uint8_t *csa; 163 uint8_t *xcsa; 164 uint8_t *wpa; 165 uint8_t *wcn; 166 uint8_t *rsn; 167 uint8_t *wps; 168 uint8_t *wmeinfo; 169 uint8_t *wmeparam; 170 uint8_t *quiet; 171 uint8_t *htcap; 172 uint8_t *htinfo; 173 uint8_t *athcaps; 174 uint8_t *athextcaps; 175 uint8_t *sfa; 176 uint8_t *vendor; 177 uint8_t *qbssload; 178 uint8_t *wapi; 179 uint8_t *p2p; 180 uint8_t *alt_wcn; 181 uint8_t *extcaps; 182 uint8_t *ibssdfs; 183 uint8_t *sonadv; 184 uint8_t *vhtcap; 185 uint8_t *vhtop; 186 uint8_t *opmode; 187 uint8_t *cswrp; 188 uint8_t *widebw; 189 uint8_t *txpwrenvlp; 190 uint8_t *bwnss_map; 191 uint8_t *secchanoff; 192 uint8_t *mdie; 193 uint8_t *hecap; 194 uint8_t *heop; 195 uint8_t *srp; 196 uint8_t *fils_indication; 197 uint8_t *esp; 198 uint8_t *mbo_oce; 199 uint8_t *muedca; 200 uint8_t *extender; 201 }; 202 203 enum scan_entry_connection_state { 204 SCAN_ENTRY_CON_STATE_NONE, 205 SCAN_ENTRY_CON_STATE_AUTH, 206 SCAN_ENTRY_CON_STATE_ASSOC 207 }; 208 209 /** 210 * struct mlme_info - mlme specific info 211 * temporarily maintained in scan cache for backward compatibility. 212 * must be removed as part of umac convergence. 213 * @bad_ap_time: time when this ap was marked bad 214 * @status: status 215 * @rank: rank 216 * @utility: utility 217 * @assoc_state: association state 218 * @chanload: channel load 219 */ 220 struct mlme_info { 221 qdf_time_t bad_ap_time; 222 uint32_t status; 223 uint32_t rank; 224 uint32_t utility; 225 uint32_t assoc_state; 226 uint32_t chanload; 227 }; 228 229 /** 230 * struct bss_info - information required to uniquely define a bss 231 * @chan: bss operating primary channel index 232 * @ssid: ssid of bss 233 * @bssid: bssid of bss 234 */ 235 struct bss_info { 236 uint8_t chan; 237 struct wlan_ssid ssid; 238 struct qdf_mac_addr bssid; 239 }; 240 241 #define SCAN_NODE_ACTIVE_COOKIE 0x1248F842 242 /** 243 * struct scan_cache_node - Scan cache entry node 244 * @node: node pointers 245 * @ref_cnt: ref count if in use 246 * @cookie: cookie to check if entry is logically active 247 * @entry: scan entry pointer 248 */ 249 struct scan_cache_node { 250 qdf_list_node_t node; 251 qdf_atomic_t ref_cnt; 252 uint32_t cookie; 253 struct scan_cache_entry *entry; 254 }; 255 256 struct security_info { 257 enum wlan_enc_type uc_enc; 258 enum wlan_enc_type mc_enc; 259 enum wlan_auth_type auth_type; 260 }; 261 262 /** 263 * struct scan_cache_entry: structure containing scan entry 264 * @frm_subtype: updated from beacon/probe 265 * @bssid: bssid 266 * @mac_addr: mac address 267 * @ssid: ssid 268 * @seq_num: sequence number 269 * @phy_mode: Phy mode of the AP 270 * @avg_rssi: Average RSSI fof the AP 271 * @rssi_raw: The rssi of the last beacon/probe received 272 * @bcn_int: Beacon interval of the AP 273 * @cap_info: Capability of the AP 274 * @tsf_info: TSF info 275 * @erp: erp info 276 * @dtim_period: dtime period 277 * @air_time_fraction: Air time fraction from ESP param 278 * @qbss_chan_load: Qbss channel load 279 * @nss: supported NSS information 280 * @is_p2p_ssid: is P2P entry 281 * @scan_entry_time: boottime in microsec when last beacon/probe is received 282 * @rssi_timestamp: boottime in microsec when RSSI was updated 283 * @hidden_ssid_timestamp: boottime in microsec when hidden 284 * ssid was received 285 * @channel: channel info on which AP is present 286 * @channel_mismatch: if channel received in metadata 287 * doesnot match the one in beacon 288 * @tsf_delta: TSF delta 289 * @bss_score: bss score calculated on basis of RSSI/caps etc. 290 * @neg_sec_info: negotiated security info 291 * @per_chain_snr: per chain SNR value received. 292 * boottime_ns: boottime in ns. 293 * @rrm_parent_tsf: RRM parent tsf 294 * @mlme_info: Mlme info, this will be updated by MLME for the scan entry 295 * @alt_wcn_ie: alternate WCN IE 296 * @ie_list: IE list pointers 297 * @raw_frame: contain raw frame and the length of the raw frame 298 */ 299 struct scan_cache_entry { 300 uint8_t frm_subtype; 301 struct qdf_mac_addr bssid; 302 struct qdf_mac_addr mac_addr; 303 struct wlan_ssid ssid; 304 uint16_t seq_num; 305 enum wlan_phymode phy_mode; 306 int32_t avg_rssi; 307 int8_t rssi_raw; 308 uint16_t bcn_int; 309 union wlan_capability cap_info; 310 union { 311 uint8_t data[8]; 312 uint64_t tsf; 313 } tsf_info; 314 uint8_t erp; 315 uint8_t dtim_period; 316 uint8_t air_time_fraction; 317 uint8_t qbss_chan_load; 318 uint8_t nss; 319 bool is_p2p; 320 qdf_time_t scan_entry_time; 321 qdf_time_t rssi_timestamp; 322 qdf_time_t hidden_ssid_timestamp; 323 struct channel_info channel; 324 bool channel_mismatch; 325 struct mlme_info mlme_info; 326 uint32_t tsf_delta; 327 uint32_t bss_score; 328 struct security_info neg_sec_info; 329 uint8_t per_chain_snr[WLAN_MGMT_TXRX_HOST_MAX_ANTENNA]; 330 uint64_t boottime_ns; 331 uint32_t rrm_parent_tsf; 332 struct element_info alt_wcn_ie; 333 struct ie_list ie_list; 334 struct element_info raw_frame; 335 }; 336 337 #define MAX_FAVORED_BSSID 16 338 #define MAX_AVOID_LIST_BSSID 16 339 #define MAX_ALLOWED_SSID_LIST 4 340 341 /** 342 * struct roam_filter_params - Structure holding roaming parameters 343 * @num_bssid_avoid_list: The number of BSSID's that we should 344 * avoid connecting to. It is like a 345 * blacklist of BSSID's. 346 * also for roaming apart from the connected one's 347 * @bssid_avoid_list: Blacklist SSID's 348 * 349 * This structure holds all the key parameters related to 350 * initial connection and also roaming connections. 351 */ 352 struct roam_filter_params { 353 uint32_t num_bssid_avoid_list; 354 /* Variable params list */ 355 struct qdf_mac_addr bssid_avoid_list[MAX_AVOID_LIST_BSSID]; 356 }; 357 358 /** 359 * struct weight_config - weight params to calculate best candidate 360 * @rssi_weightage: RSSI weightage 361 * @ht_caps_weightage: HT caps weightage 362 * @vht_caps_weightage: VHT caps weightage 363 * @he_caps_weightage: HE caps weightage 364 * @chan_width_weightage: Channel width weightage 365 * @chan_band_weightage: Channel band weightage 366 * @nss_weightage: NSS weightage 367 * @beamforming_cap_weightage: Beamforming caps weightage 368 * @pcl_weightage: PCL weightage 369 * @channel_congestion_weightage: channel congestion weightage 370 * @oce_wan_weightage: OCE WAN metrics weightage 371 */ 372 struct weight_config { 373 uint8_t rssi_weightage; 374 uint8_t ht_caps_weightage; 375 uint8_t vht_caps_weightage; 376 uint8_t he_caps_weightage; 377 uint8_t chan_width_weightage; 378 uint8_t chan_band_weightage; 379 uint8_t nss_weightage; 380 uint8_t beamforming_cap_weightage; 381 uint8_t pcl_weightage; 382 uint8_t channel_congestion_weightage; 383 uint8_t oce_wan_weightage; 384 }; 385 386 /** 387 * struct rssi_cfg_score - rssi related params for scoring logic 388 * @best_rssi_threshold: RSSI weightage 389 * @good_rssi_threshold: HT caps weightage 390 * @bad_rssi_threshold: VHT caps weightage 391 * @good_rssi_pcnt: HE caps weightage 392 * @bad_rssi_pcnt: Channel width weightage 393 * @good_rssi_bucket_size: Channel band weightage 394 * @bad_rssi_bucket_size: NSS weightage 395 * @rssi_pref_5g_rssi_thresh: Beamforming caps weightage 396 */ 397 struct rssi_cfg_score { 398 uint32_t best_rssi_threshold; 399 uint32_t good_rssi_threshold; 400 uint32_t bad_rssi_threshold; 401 uint32_t good_rssi_pcnt; 402 uint32_t bad_rssi_pcnt; 403 uint32_t good_rssi_bucket_size; 404 uint32_t bad_rssi_bucket_size; 405 uint32_t rssi_pref_5g_rssi_thresh; 406 }; 407 408 /** 409 * struct per_slot_scoring - define % score for differents slots for a 410 * scoring param. 411 * num_slot: number of slots in which the param will be divided. 412 * Max 15. index 0 is used for 'not_present. Num_slot will 413 * equally divide 100. e.g, if num_slot = 4 slot 0 = 0-25%, slot 414 * 1 = 26-50% slot 2 = 51-75%, slot 3 = 76-100% 415 * score_pcnt3_to_0: Conatins score percentage for slot 0-3 416 * BITS 0-7 :- the scoring pcnt when not present 417 * BITS 8-15 :- SLOT_1 418 * BITS 16-23 :- SLOT_2 419 * BITS 24-31 :- SLOT_3 420 * score_pcnt7_to_4: Conatins score percentage for slot 4-7 421 * BITS 0-7 :- SLOT_4 422 * BITS 8-15 :- SLOT_5 423 * BITS 16-23 :- SLOT_6 424 * BITS 24-31 :- SLOT_7 425 * score_pcnt11_to_8: Conatins score percentage for slot 8-11 426 * BITS 0-7 :- SLOT_8 427 * BITS 8-15 :- SLOT_9 428 * BITS 16-23 :- SLOT_10 429 * BITS 24-31 :- SLOT_11 430 * score_pcnt15_to_12: Conatins score percentage for slot 12-15 431 * BITS 0-7 :- SLOT_12 432 * BITS 8-15 :- SLOT_13 433 * BITS 16-23 :- SLOT_14 434 * BITS 24-31 :- SLOT_15 435 */ 436 struct per_slot_scoring { 437 uint32_t num_slot; 438 uint32_t score_pcnt3_to_0; 439 uint32_t score_pcnt7_to_4; 440 uint32_t score_pcnt11_to_8; 441 uint32_t score_pcnt15_to_12; 442 }; 443 444 /** 445 * struct scoring_config - Scoring related configuration 446 * @weight_cfg: weigtage config for config 447 * @rssi_score: Rssi related config for scoring config 448 * @esp_qbss_scoring: esp and qbss related scoring config 449 * @oce_wan_scoring: oce related scoring config 450 * @bandwidth_weight_per_index: BW wight per index 451 * @nss_weight_per_index: nss weight per index 452 * @band_weight_per_index: band weight per index 453 * @cb_mode_24G: cb mode supprted for 2.4Ghz 454 * @cb_mode_5G: cb mode supprted for 5Ghz 455 * @nss: Number of NSS the device support 456 * @ht_cap: If dev is configured as HT capable 457 * @vht_cap:If dev is configured as VHT capable 458 * @he_cap: If dev is configured as HE capable 459 * @vht_24G_cap:If dev is configured as VHT capable for 2.4Ghz 460 * @beamformee_cap:If dev is configured as BF capable 461 */ 462 struct scoring_config { 463 struct weight_config weight_cfg; 464 struct rssi_cfg_score rssi_score; 465 struct per_slot_scoring esp_qbss_scoring; 466 struct per_slot_scoring oce_wan_scoring; 467 uint32_t bandwidth_weight_per_index; 468 uint32_t nss_weight_per_index; 469 uint32_t band_weight_per_index; 470 uint8_t cb_mode_24G; 471 uint8_t cb_mode_5G; 472 uint8_t nss; 473 uint8_t ht_cap:1, 474 vht_cap:1, 475 he_cap:1, 476 vht_24G_cap:1, 477 beamformee_cap:1; 478 }; 479 480 #define WLAN_SCAN_FILTER_NUM_SSID 5 481 #define WLAN_SCAN_FILTER_NUM_BSSID 5 482 483 #define REAM_HASH_LEN 2 484 #define CACHE_IDENTIFIER_LEN 2 485 #define HESSID_LEN 6 486 487 /** 488 * struct fils_filter_info: FILS info present in scan filter 489 * @realm_check: whether realm check is required 490 * @fils_realm: realm hash value 491 * @security_type: type of security supported 492 */ 493 struct fils_filter_info { 494 bool realm_check; 495 uint8_t fils_realm[REAM_HASH_LEN]; 496 uint8_t security_type; 497 }; 498 499 /** 500 * @bss_scoring_required :- flag to bypass scoring filtered results 501 * @age_threshold: If set return entry which are newer than the age_threshold 502 * @p2p_results: If only p2p entries is required 503 * @rrm_measurement_filter: For measurement reports.if set, only SSID, BSSID 504 * and channel is considered for filtering. 505 * @num_of_bssid: number of bssid passed 506 * @num_of_ssid: number of ssid 507 * @num_of_channels: number of channels 508 * @num_of_auth: number of auth types 509 * @num_of_enc_type: number of unicast enc type 510 * @num_of_mc_enc_type: number of multicast enc type 511 * @pmf_cap: Pmf capability 512 * @ignore_pmf_cap: Ignore pmf capability match 513 * @num_of_pcl_channels: number of pcl channels 514 * @bss_type: bss type BSS/IBSS etc 515 * @dot11_mode: operating modes 0 mean any 516 * 11a , 11g, 11n , 11ac , 11b etc 517 * @band: to get specific band 2.4G, 5G or 4.9 G 518 * @rssi_threshold: AP having RSSI greater than 519 * rssi threasholed (ignored if set 0) 520 * @only_wmm_ap: If only Qos AP is needed 521 * @ignore_auth_enc_type: Ignore enc type if 522 * this is set (For WPS/OSEN connection) 523 * @mobility_domain: Mobility domain for 11r 524 * @country[3]: Ap with specific country code 525 * @bssid_list: bssid list 526 * @ssid_list: ssid list 527 * @channel_list: channel list 528 * @auth_type: auth type list 529 * @enc_type: unicast enc type list 530 * @mc_enc_type: multicast cast enc type list 531 * @pcl_channel_list: PCL channel list 532 * @fils_scan_filter: FILS info 533 * @pcl_weight_list: PCL Weight list 534 * @bssid_hint: Mac address of bssid_hint 535 */ 536 struct scan_filter { 537 bool bss_scoring_required; 538 uint32_t age_threshold; 539 uint32_t p2p_results; 540 uint32_t rrm_measurement_filter; 541 uint32_t num_of_bssid; 542 uint32_t num_of_ssid; 543 uint32_t num_of_channels; 544 uint32_t num_of_auth; 545 uint32_t num_of_enc_type; 546 uint32_t num_of_mc_enc_type; 547 enum wlan_pmf_cap pmf_cap; 548 bool ignore_pmf_cap; 549 uint32_t num_of_pcl_channels; 550 enum wlan_bss_type bss_type; 551 enum wlan_phymode dot11_mode; 552 enum wlan_band band; 553 uint32_t rssi_threshold; 554 uint32_t only_wmm_ap; 555 uint32_t ignore_auth_enc_type; 556 uint32_t mobility_domain; 557 /* Variable params list */ 558 uint8_t country[3]; 559 struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID]; 560 struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID]; 561 uint8_t channel_list[QDF_MAX_NUM_CHAN]; 562 enum wlan_auth_type auth_type[WLAN_NUM_OF_SUPPORT_AUTH_TYPE]; 563 enum wlan_enc_type enc_type[WLAN_NUM_OF_ENCRYPT_TYPE]; 564 enum wlan_enc_type mc_enc_type[WLAN_NUM_OF_ENCRYPT_TYPE]; 565 uint8_t pcl_channel_list[QDF_MAX_NUM_CHAN]; 566 struct fils_filter_info fils_scan_filter; 567 uint8_t pcl_weight_list[QDF_MAX_NUM_CHAN]; 568 struct qdf_mac_addr bssid_hint; 569 }; 570 571 572 /** 573 * enum scan_priority - scan priority definitions 574 * @SCAN_PRIORITY_VERY_LOW: very low priority 575 * @SCAN_PRIORITY_LOW: low scan priority 576 * @SCAN_PRIORITY_MEDIUM: medium priority 577 * @SCAN_PRIORITY_HIGH: high priority 578 * @SCAN_PRIORITY_VERY_HIGH: very high priority 579 * @SCAN_PRIORITY_COUNT: number of priorities supported 580 */ 581 enum scan_priority { 582 SCAN_PRIORITY_VERY_LOW, 583 SCAN_PRIORITY_LOW, 584 SCAN_PRIORITY_MEDIUM, 585 SCAN_PRIORITY_HIGH, 586 SCAN_PRIORITY_VERY_HIGH, 587 SCAN_PRIORITY_COUNT, 588 }; 589 590 591 /** 592 * enum scan_type - type of scan 593 * @SCAN_TYPE_BACKGROUND: background scan 594 * @SCAN_TYPE_FOREGROUND: foregrounc scan 595 * @SCAN_TYPE_SPECTRAL: spectral scan 596 * @SCAN_TYPE_REPEATER_BACKGROUND: background scan in repeater 597 * @SCAN_TYPE_REPEATER_EXT_BACKGROUND: background scan in extended repeater 598 * @SCAN_TYPE_RADIO_MEASUREMENTS: redio measurement 599 * @SCAN_TYPE_COUNT: number of scan types supported 600 */ 601 enum scan_type { 602 SCAN_TYPE_BACKGROUND, 603 SCAN_TYPE_FOREGROUND, 604 SCAN_TYPE_SPECTRAL, 605 SCAN_TYPE_REPEATER_BACKGROUND, 606 SCAN_TYPE_REPEATER_EXT_BACKGROUND, 607 SCAN_TYPE_RADIO_MEASUREMENTS, 608 SCAN_TYPE_COUNT, 609 }; 610 611 /** 612 * enum scan_phy_mode - phymode used for scan 613 * @SCAN_PHY_MODE_11A: 11a mode 614 * @SCAN_PHY_MODE_11G: 11g mode 615 * @SCAN_PHY_MODE_11B: 11b mode 616 * @SCAN_PHY_MODE_11GONLY: 11g only mode 617 * @SCAN_PHY_MODE_11NA_HT20: 11na ht20 mode 618 * @SCAN_PHY_MODE_11NG_HT20: 11ng ht20 mode 619 * @SCAN_PHY_MODE_11NA_HT40: 11na ht40 mode 620 * @SCAN_PHY_MODE_11NG_HT40: 11ng ht40 mode 621 * @SCAN_PHY_MODE_11AC_VHT20: 11ac vht20 mode 622 * @SCAN_PHY_MODE_11AC_VHT40: 11ac vht40 mode 623 * @SCAN_PHY_MODE_11AC_VHT80: 11ac vht80 mode 624 * @SCAN_PHY_MODE_11AC_VHT20_2G: 2GHz 11ac vht20 mode 625 * @SCAN_PHY_MODE_11AC_VHT40_2G: 2GHz 11ac vht40 mode 626 * @SCAN_PHY_MODE_11AC_VHT80_2G: 2GHz 11ac vht80 mode 627 * @SCAN_PHY_MODE_11AC_VHT80_80: 11ac vht 80+80 mode 628 * @SCAN_PHY_MODE_11AC_VHT160: 11ac vht160 mode 629 * @SCAN_PHY_MODE_11AX_HE20: 11ax he20 mode 630 * @SCAN_PHY_MODE_11AX_HE40: 11ax he40 mode 631 * @SCAN_PHY_MODE_11AX_HE80: 11ax he80 mode 632 * @SCAN_PHY_MODE_11AX_HE80_80: 11ax he80+80 mode 633 * @SCAN_PHY_MODE_11AX_HE160: 11ax he160 mode 634 * @SCAN_PHY_MODE_11AX_HE20_2G: 2GHz 11ax he20 mode 635 * @SCAN_PHY_MODE_11AX_HE40_2G: 2GHz 11ax he40 mode 636 * @SCAN_PHY_MODE_11AX_HE80_2G: 2GHz 11ax he80 mode 637 * @SCAN_PHY_MODE_UNKNOWN: unknown phy mode 638 * @SCAN_PHY_MODE_MAX: max valid phymode 639 */ 640 enum scan_phy_mode { 641 SCAN_PHY_MODE_11A = 0, 642 SCAN_PHY_MODE_11G = 1, 643 SCAN_PHY_MODE_11B = 2, 644 SCAN_PHY_MODE_11GONLY = 3, 645 SCAN_PHY_MODE_11NA_HT20 = 4, 646 SCAN_PHY_MODE_11NG_HT20 = 5, 647 SCAN_PHY_MODE_11NA_HT40 = 6, 648 SCAN_PHY_MODE_11NG_HT40 = 7, 649 SCAN_PHY_MODE_11AC_VHT20 = 8, 650 SCAN_PHY_MODE_11AC_VHT40 = 9, 651 SCAN_PHY_MODE_11AC_VHT80 = 10, 652 SCAN_PHY_MODE_11AC_VHT20_2G = 11, 653 SCAN_PHY_MODE_11AC_VHT40_2G = 12, 654 SCAN_PHY_MODE_11AC_VHT80_2G = 13, 655 SCAN_PHY_MODE_11AC_VHT80_80 = 14, 656 SCAN_PHY_MODE_11AC_VHT160 = 15, 657 SCAN_PHY_MODE_11AX_HE20 = 16, 658 SCAN_PHY_MODE_11AX_HE40 = 17, 659 SCAN_PHY_MODE_11AX_HE80 = 18, 660 SCAN_PHY_MODE_11AX_HE80_80 = 19, 661 SCAN_PHY_MODE_11AX_HE160 = 20, 662 SCAN_PHY_MODE_11AX_HE20_2G = 21, 663 SCAN_PHY_MODE_11AX_HE40_2G = 22, 664 SCAN_PHY_MODE_11AX_HE80_2G = 23, 665 SCAN_PHY_MODE_UNKNOWN = 24, 666 SCAN_PHY_MODE_MAX = 24 667 }; 668 669 /** 670 * struct scan_extra_params_legacy 671 * extra parameters required for legacy DA scan module 672 * @scan_type: type of scan 673 * @min_dwell_active: min active dwell time 674 * @min_dwell_passive: min passive dwell time 675 * @init_rest_time: init rest time for enhanced independent repeater 676 */ 677 struct scan_extra_params_legacy { 678 enum scan_type scan_type; 679 uint32_t min_dwell_active; 680 uint32_t min_dwell_passive; 681 uint32_t init_rest_time; 682 }; 683 684 /** 685 * enum scan_dwelltime_adaptive_mode: dwelltime_mode 686 * @SCAN_DWELL_MODE_DEFAULT: Use firmware default mode 687 * @SCAN_DWELL_MODE_CONSERVATIVE: Conservative adaptive mode 688 * @SCAN_DWELL_MODE_MODERATE: Moderate adaptive mode 689 * @SCAN_DWELL_MODE_AGGRESSIVE: Aggressive adaptive mode 690 * @SCAN_DWELL_MODE_STATIC: static adaptive mode 691 */ 692 enum scan_dwelltime_adaptive_mode { 693 SCAN_DWELL_MODE_DEFAULT = 0, 694 SCAN_DWELL_MODE_CONSERVATIVE = 1, 695 SCAN_DWELL_MODE_MODERATE = 2, 696 SCAN_DWELL_MODE_AGGRESSIVE = 3, 697 SCAN_DWELL_MODE_STATIC = 4 698 }; 699 700 /** 701 * struct scan_random_attr - holds scan randomization attrs 702 * @randomize: set to true for scan randomization 703 * @mac_addr: mac addr to be randomized 704 * @mac_mask: used to represent bits in mac_addr for randomization 705 */ 706 struct scan_random_attr { 707 bool randomize; 708 uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; 709 uint8_t mac_mask[QDF_MAC_ADDR_SIZE]; 710 }; 711 712 /** 713 * struct probe_req_whitelist_attr - holds probe req ie whitelist attrs 714 * @white_list: enable/disable whitelist 715 * @ie_bitmap: bitmap of IEs to be enabled 716 * @num_vendor_oui: number of vendor OUIs 717 * @voui: vendor oui buffer 718 */ 719 struct probe_req_whitelist_attr { 720 bool white_list; 721 uint32_t ie_bitmap[PROBE_REQ_BITMAP_LEN]; 722 uint32_t num_vendor_oui; 723 uint32_t voui[MAX_PROBE_REQ_OUIS]; 724 }; 725 726 /** 727 * struct chan_info - channel information 728 * @freq: frequency to scan 729 * @phymode: phymode in which @frequency should be scanned 730 */ 731 struct chan_info { 732 uint32_t freq; 733 uint32_t phymode; 734 }; 735 736 /** 737 * struct chan_list - list of frequencies to be scanned 738 * and their phymode 739 * @num_chan: number of channels to scan 740 * @chan: channel parameters used for this scan 741 */ 742 struct chan_list { 743 uint32_t num_chan; 744 struct chan_info chan[WLAN_SCAN_MAX_NUM_CHANNELS]; 745 }; 746 747 /** 748 * enum scan_type: scan type 749 * @SCAN_NON_P2P_DEFAULT: Def scan 750 * @SCAN_P2P_SEARCH: P2P Search 751 * @SCAN_P2P_LISTEN: P2P listed 752 */ 753 enum p2p_scan_type { 754 SCAN_NON_P2P_DEFAULT = 0, 755 SCAN_P2P_SEARCH = 1, 756 SCAN_P2P_LISTEN = 2, 757 }; 758 759 /** 760 * struct scan_req_params - start scan request parameter 761 * @scan_id: scan id 762 * @scan_req_id: scan requester id 763 * @vdev_id: vdev id where scan was originated 764 * @pdev_id: pdev id of parent pdev 765 * @scan_priority: scan priority 766 * @scan_ev_started: notify scan started event 767 * @scan_ev_completed: notify scan completed event 768 * @scan_ev_bss_chan: notify bss chan event 769 * @scan_ev_foreign_chan: notify foreign chan event 770 * @scan_ev_dequeued: notify scan request dequed event 771 * @scan_ev_preempted: notify scan preempted event 772 * @scan_ev_start_failed: notify scan start failed event 773 * @scan_ev_restarted: notify scan restarted event 774 * @scan_ev_foreign_chn_exit: notify foreign chan exit event 775 * @scan_ev_invalid: notify invalid scan request event 776 * @scan_ev_gpio_timeout: notify gpio timeout event 777 * @scan_ev_suspended: notify scan suspend event 778 * @scan_ev_resumed: notify scan resumed event 779 * @scan_events: variable to read and set scan_ev_* flags in one shot 780 * can be used to dump all scan_ev_* flags for debug 781 * @dwell_time_active: active dwell time 782 * @dwell_time_active_2g: active dwell time for 2G channels, if it's not zero 783 * @dwell_time_passive: passive dwell time 784 * @min_rest_time: min rest time 785 * @max_rest_time: max rest time 786 * @repeat_probe_time: repeat probe time 787 * @probe_spacing_time: probe spacing time 788 * @idle_time: idle time 789 * @max_scan_time: max scan time 790 * @probe_delay: probe delay 791 * @scan_offset_time: Support split scanning on the 792 * same channel for CBS feature. 793 * @scan_f_passive: passively scan all channels including active channels 794 * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified 795 * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req 796 * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req 797 * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor 798 * @scan_f_filter_prb_req: filter Probe request frames 799 * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels 800 * @scan_f_continue_on_err:continue scan even if few certain erros have occurred 801 * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan 802 * @scan_f_offchan_data_tx: allow data transmission during off channel scan 803 * @scan_f_promisc_mode: scan with promiscuous mode 804 * @scan_f_capture_phy_err: enable capture ppdu with phy errrors 805 * @scan_f_strict_passive_pch: do passive scan on passive channels 806 * @scan_f_half_rate: enable HALF (10MHz) rate support 807 * @scan_f_quarter_rate: set Quarter (5MHz) rate support 808 * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel 809 * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame 810 * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame 811 * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe 812 * @scan_f_add_rand_seq_in_probe: use random sequence number in probe 813 * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe 814 * @scan_f_forced: force scan even in presence of data traffic 815 * @scan_f_2ghz: scan 2.4 GHz channels 816 * @scan_f_5ghz: scan 5 GHz channels 817 * @scan_f_wide_band: scan in 40 MHz or higher bandwidth 818 * @scan_flags: variable to read and set scan_f_* flags in one shot 819 * can be used to dump all scan_f_* flags for debug 820 * @burst_duration: burst duration 821 * @num_bssid: no of bssid 822 * @num_ssids: no of ssid 823 * @n_probes: no of probe 824 * @chan_list: channel list 825 * @ssid: ssid list 826 * @bssid_list: Lisst of bssid to scan 827 * @scan_random: scan randomization params 828 * @ie_whitelist: probe req IE whitelist attrs 829 * @extraie: list of optional/vendor specific ie's to be added in probe requests 830 * @htcap: htcap ie 831 * @vhtcap: vhtcap ie 832 * @scan_ctrl_flags_ext: scan control flag extended 833 */ 834 835 struct scan_req_params { 836 uint32_t scan_id; 837 uint32_t scan_req_id; 838 uint32_t vdev_id; 839 uint32_t pdev_id; 840 enum scan_priority scan_priority; 841 enum p2p_scan_type p2p_scan_type; 842 union { 843 struct { 844 uint32_t scan_ev_started:1, 845 scan_ev_completed:1, 846 scan_ev_bss_chan:1, 847 scan_ev_foreign_chan:1, 848 scan_ev_dequeued:1, 849 scan_ev_preempted:1, 850 scan_ev_start_failed:1, 851 scan_ev_restarted:1, 852 scan_ev_foreign_chn_exit:1, 853 scan_ev_invalid:1, 854 scan_ev_gpio_timeout:1, 855 scan_ev_suspended:1, 856 scan_ev_resumed:1; 857 }; 858 uint32_t scan_events; 859 }; 860 uint32_t dwell_time_active; 861 uint32_t dwell_time_active_2g; 862 uint32_t dwell_time_passive; 863 uint32_t min_rest_time; 864 uint32_t max_rest_time; 865 uint32_t repeat_probe_time; 866 uint32_t probe_spacing_time; 867 uint32_t idle_time; 868 uint32_t max_scan_time; 869 uint32_t probe_delay; 870 uint32_t scan_offset_time; 871 union { 872 struct { 873 uint32_t scan_f_passive:1, 874 scan_f_bcast_probe:1, 875 scan_f_cck_rates:1, 876 scan_f_ofdm_rates:1, 877 scan_f_chan_stat_evnt:1, 878 scan_f_filter_prb_req:1, 879 scan_f_bypass_dfs_chn:1, 880 scan_f_continue_on_err:1, 881 scan_f_offchan_mgmt_tx:1, 882 scan_f_offchan_data_tx:1, 883 scan_f_promisc_mode:1, 884 scan_f_capture_phy_err:1, 885 scan_f_strict_passive_pch:1, 886 scan_f_half_rate:1, 887 scan_f_quarter_rate:1, 888 scan_f_force_active_dfs_chn:1, 889 scan_f_add_tpc_ie_in_probe:1, 890 scan_f_add_ds_ie_in_probe:1, 891 scan_f_add_spoofed_mac_in_probe:1, 892 scan_f_add_rand_seq_in_probe:1, 893 scan_f_en_ie_whitelist_in_probe:1, 894 scan_f_forced:1, 895 scan_f_2ghz:1, 896 scan_f_5ghz:1, 897 scan_f_wide_band:1; 898 }; 899 uint32_t scan_flags; 900 }; 901 union { 902 struct { 903 uint32_t scan_policy_high_accuracy:1, 904 scan_policy_low_span:1, 905 scan_policy_low_power:1; 906 }; 907 uint32_t scan_policy_type; 908 }; 909 910 enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode; 911 uint32_t burst_duration; 912 uint32_t num_bssid; 913 uint32_t num_ssids; 914 uint32_t n_probes; 915 struct chan_list chan_list; 916 struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; 917 struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; 918 struct scan_random_attr scan_random; 919 struct probe_req_whitelist_attr ie_whitelist; 920 struct element_info extraie; 921 struct element_info htcap; 922 struct element_info vhtcap; 923 uint32_t scan_ctrl_flags_ext; 924 }; 925 926 /** 927 * struct scan_start_request - scan request config 928 * @vdev: vdev 929 * @legacy_params: extra parameters required for legacy DA arch 930 * @scan_req: common scan start request parameters 931 */ 932 struct scan_start_request { 933 struct wlan_objmgr_vdev *vdev; 934 struct scan_extra_params_legacy legacy_params; 935 struct scan_req_params scan_req; 936 }; 937 938 /** 939 * enum scan_cancel_type - type specifiers for cancel scan request 940 * @WLAN_SCAN_CANCEL_SINGLE: cancel particular scan specified by scan_id 941 * @WLAN_SCAN_CANCEL_VAP_ALL: cancel all scans running on a particular vdevid 942 * WLAN_SCAN_CANCEL_PDEV_ALL: cancel all scans running on parent pdev of vdevid 943 */ 944 enum scan_cancel_req_type { 945 WLAN_SCAN_CANCEL_SINGLE = 1, 946 WLAN_SCAN_CANCEL_VDEV_ALL, 947 WLAN_SCAN_CANCEL_PDEV_ALL, 948 }; 949 950 /** 951 * struct scan_cancel_param - stop scan cmd parameter 952 * @requester: scan requester 953 * @scan_id: scan id 954 * @req_type: scan request type 955 * @vdev_id: vdev id 956 * @pdev_id: pdev id of parent pdev 957 */ 958 struct scan_cancel_param { 959 uint32_t requester; 960 uint32_t scan_id; 961 enum scan_cancel_req_type req_type; 962 uint32_t vdev_id; 963 uint32_t pdev_id; 964 }; 965 966 /** 967 * struct scan_cancel_request - stop scan cmd 968 * @vdev: vdev object 969 * @wait_tgt_cancel: wait for target to cancel scan 970 * @cancel_req: stop scan cmd parameter 971 */ 972 struct scan_cancel_request { 973 /* Extra parameters consumed by scan module or serialization */ 974 struct wlan_objmgr_vdev *vdev; 975 bool wait_tgt_cancel; 976 /* Actual scan cancel request parameters */ 977 struct scan_cancel_param cancel_req; 978 }; 979 980 /** 981 * enum scan_event_type - scan event types 982 * @SCAN_EVENT_TYPE_STARTED: scan started 983 * @SCAN_EVENT_TYPE_COMPLETED: scan completed 984 * @SCAN_EVENT_TYPE_BSS_CHANNEL: HW came back to home channel 985 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL: HW moved to foreign channel 986 * @SCAN_EVENT_TYPE_DEQUEUED: scan request dequeued 987 * @SCAN_EVENT_TYPE_PREEMPTED: scan got preempted 988 * @SCAN_EVENT_TYPE_START_FAILED: couldn't start scan 989 * @SCAN_EVENT_TYPE_RESTARTED: scan restarted 990 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT: HW exited foreign channel 991 * @SCAN_EVENT_TYPE_SUSPENDED: scan got suspended 992 * @SCAN_EVENT_TYPE_RESUMED: scan resumed 993 * @SCAN_EVENT_TYPE_NLO_COMPLETE: NLO completed 994 * @SCAN_EVENT_TYPE_NLO_MATCH: NLO match event 995 * @SCAN_EVENT_TYPE_INVALID: invalid request 996 * @SCAN_EVENT_TYPE_GPIO_TIMEOUT: gpio timeout 997 * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START: radio measurement start 998 * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END: radio measurement end 999 * @SCAN_EVENT_TYPE_BSSID_MATCH: bssid match found 1000 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF: foreign channel noise floor 1001 * @SCAN_EVENT_TYPE_MAX: marker for invalid event 1002 */ 1003 enum scan_event_type { 1004 SCAN_EVENT_TYPE_STARTED, 1005 SCAN_EVENT_TYPE_COMPLETED, 1006 SCAN_EVENT_TYPE_BSS_CHANNEL, 1007 SCAN_EVENT_TYPE_FOREIGN_CHANNEL, 1008 SCAN_EVENT_TYPE_DEQUEUED, 1009 SCAN_EVENT_TYPE_PREEMPTED, 1010 SCAN_EVENT_TYPE_START_FAILED, 1011 SCAN_EVENT_TYPE_RESTARTED, 1012 SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT, 1013 SCAN_EVENT_TYPE_SUSPENDED, 1014 SCAN_EVENT_TYPE_RESUMED, 1015 SCAN_EVENT_TYPE_NLO_COMPLETE, 1016 SCAN_EVENT_TYPE_NLO_MATCH, 1017 SCAN_EVENT_TYPE_INVALID, 1018 SCAN_EVENT_TYPE_GPIO_TIMEOUT, 1019 SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START, 1020 SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END, 1021 SCAN_EVENT_TYPE_BSSID_MATCH, 1022 SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF, 1023 SCAN_EVENT_TYPE_MAX, 1024 }; 1025 1026 /** 1027 * enum scan_completion_reason - scan completion reason 1028 * @SCAN_REASON_NONE: un specified reason 1029 * @SCAN_REASON_COMPLETED: scan successfully completed 1030 * @SCAN_REASON_CANCELLED: scan got cancelled 1031 * @SCAN_REASON_PREEMPTED: scan got preempted 1032 * @SCAN_REASON_TIMEDOUT: couldnt complete within specified time 1033 * @SCAN_REASON_INTERNAL_FAILURE: cancelled because of some failure 1034 * @SCAN_REASON_SUSPENDED: scan suspended 1035 * @SCAN_REASON_RUN_FAILED: run failed 1036 * @SCAN_REASON_TERMINATION_FUNCTION: termination function 1037 * @SCAN_REASON_MAX_OFFCHAN_RETRIES: max retries exceeded thresold 1038 * @SCAN_REASON_MAX: invalid completion reason marker 1039 */ 1040 enum scan_completion_reason { 1041 SCAN_REASON_NONE, 1042 SCAN_REASON_COMPLETED, 1043 SCAN_REASON_CANCELLED, 1044 SCAN_REASON_PREEMPTED, 1045 SCAN_REASON_TIMEDOUT, 1046 SCAN_REASON_INTERNAL_FAILURE, 1047 SCAN_REASON_SUSPENDED, 1048 SCAN_REASON_RUN_FAILED, 1049 SCAN_REASON_TERMINATION_FUNCTION, 1050 SCAN_REASON_MAX_OFFCHAN_RETRIES, 1051 SCAN_REASON_MAX, 1052 }; 1053 1054 /** 1055 * struct scan_event - scan event definition 1056 * @vdev_id: vdev where scan was run 1057 * @type: type of scan event 1058 * @reason: completion reason 1059 * @chan_freq: channel centre frequency 1060 * @requester: requester id 1061 * @scan_id: scan id 1062 * @timestamp: timestamp in microsec recorded by target for the scan event 1063 * @scan_start_req: scan request object used to start this scan 1064 */ 1065 struct scan_event { 1066 uint32_t vdev_id; 1067 enum scan_event_type type; 1068 enum scan_completion_reason reason; 1069 uint32_t chan_freq; 1070 uint32_t requester; 1071 uint32_t scan_id; 1072 uint32_t timestamp; 1073 struct scan_start_request *scan_start_req; 1074 }; 1075 1076 /** 1077 * struct scan_event_info - scan event information 1078 * @vdev: vdev object 1079 * @event: scan event 1080 */ 1081 struct scan_event_info { 1082 struct wlan_objmgr_vdev *vdev; 1083 struct scan_event event; 1084 }; 1085 1086 /** 1087 * enum scm_scan_status - scan status 1088 * @SCAN_NOT_IN_PROGRESS: Neither active nor pending scan in progress 1089 * @SCAN_IS_ACTIVE: scan request is present only in active list 1090 * @SCAN_IS_PENDING: scan request is present only in pending list 1091 * @SCAN_IS_ACTIVE_AND_PENDING: scan request is present in active 1092 * and pending both lists 1093 */ 1094 enum scm_scan_status { 1095 SCAN_NOT_IN_PROGRESS = 0, /* Must be 0 */ 1096 SCAN_IS_ACTIVE, 1097 SCAN_IS_PENDING, 1098 SCAN_IS_ACTIVE_AND_PENDING, 1099 }; 1100 1101 /** 1102 * scan_event_handler() - function prototype of scan event handlers 1103 * @vdev: vdev object 1104 * @event: scan event 1105 * @arg: argument 1106 * 1107 * PROTO TYPE, scan event handler call back function prototype 1108 * 1109 * @Return: void 1110 */ 1111 typedef void (*scan_event_handler) (struct wlan_objmgr_vdev *vdev, 1112 struct scan_event *event, void *arg); 1113 1114 /** 1115 * enum scan_cb_type - update beacon cb type 1116 * @SCAN_CB_TYPE_INFORM_BCN: Calback to indicate beacon to OS 1117 * @SCAN_CB_TYPE_UPDATE_BCN: Calback to indicate beacon 1118 * to MLME and update MLME info 1119 * 1120 */ 1121 enum scan_cb_type { 1122 SCAN_CB_TYPE_INFORM_BCN, 1123 SCAN_CB_TYPE_UPDATE_BCN, 1124 }; 1125 1126 /* Set PNO */ 1127 #define SCAN_PNO_MAX_PLAN_REQUEST 2 1128 #define SCAN_PNO_MAX_NETW_CHANNELS_EX 60 1129 #define SCAN_PNO_MAX_SUPP_NETWORKS 16 1130 #define SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER 6 1131 #define SCAN_PNO_DEF_SCAN_TIMER_REPEAT 20 1132 #define SCAN_PNO_MATCH_WAKE_LOCK_TIMEOUT (5 * 1000) /* in msec */ 1133 #ifdef CONFIG_SLUB_DEBUG_ON 1134 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (2 * 1000) /* in msec */ 1135 #else 1136 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (1 * 1000) /* in msec */ 1137 #endif /* CONFIG_SLUB_DEBUG_ON */ 1138 1139 #define SCAN_PNO_CHANNEL_PREDICTION 0 1140 #define SCAN_TOP_K_NUM_OF_CHANNELS 3 1141 #define SCAN_STATIONARY_THRESHOLD 10 1142 #define SCAN_CHANNEL_PREDICTION_FULL_SCAN_MS 60000 1143 #define SCAN_ADAPTIVE_PNOSCAN_DWELL_MODE 0 1144 #define SCAN_MAWC_NLO_ENABLED 1 1145 #define SCAN_MAWC_NLO_EXP_BACKOFF_RATIO 3 1146 #define SCAN_MAWC_NLO_INIT_SCAN_INTERVAL 10000 1147 #define SCAN_MAWC_NLO_MAX_SCAN_INTERVAL 60000 1148 1149 1150 /** 1151 * enum ssid_bc_type - SSID broadcast type 1152 * @SSID_BC_TYPE_UNKNOWN: Broadcast unknown 1153 * @SSID_BC_TYPE_NORMAL: Broadcast normal 1154 * @SSID_BC_TYPE_HIDDEN: Broadcast hidden 1155 */ 1156 enum ssid_bc_type { 1157 SSID_BC_TYPE_UNKNOWN = 0, 1158 SSID_BC_TYPE_NORMAL = 1, 1159 SSID_BC_TYPE_HIDDEN = 2, 1160 }; 1161 1162 /** 1163 * struct pno_nw_type - pno nw type 1164 * @ssid: ssid 1165 * @authentication: authentication type 1166 * @encryption: encryption type 1167 * @bcastNetwType: broadcast nw type 1168 * @ucChannelCount: uc channel count 1169 * @aChannels: pno channel 1170 * @rssiThreshold: rssi threshold 1171 */ 1172 struct pno_nw_type { 1173 struct wlan_ssid ssid; 1174 uint32_t authentication; 1175 uint32_t encryption; 1176 uint32_t bc_new_type; 1177 uint8_t channel_cnt; 1178 uint32_t channels[SCAN_PNO_MAX_NETW_CHANNELS_EX]; 1179 int32_t rssi_thresh; 1180 }; 1181 1182 /** 1183 * struct connected_pno_band_rssi_pref - BSS preference based on band 1184 * and RSSI 1185 * @band: band preference 1186 * @rssi_pref: RSSI preference 1187 */ 1188 struct cpno_band_rssi_pref { 1189 int8_t band; 1190 int8_t rssi; 1191 }; 1192 1193 /** 1194 * struct nlo_mawc_params - Motion Aided Wireless Connectivity based 1195 * Network List Offload configuration 1196 * @vdev_id: VDEV ID on which the configuration needs to be applied 1197 * @enable: flag to enable or disable 1198 * @exp_backoff_ratio: ratio of exponential backoff 1199 * @init_scan_interval: initial scan interval(msec) 1200 * @max_scan_interval: max scan interval(msec) 1201 */ 1202 struct nlo_mawc_params { 1203 uint8_t vdev_id; 1204 bool enable; 1205 uint32_t exp_backoff_ratio; 1206 uint32_t init_scan_interval; 1207 uint32_t max_scan_interval; 1208 }; 1209 1210 /** 1211 * struct pno_scan_req_params - PNO Scan request structure 1212 * @networks_cnt: Number of networks 1213 * @do_passive_scan: Flag to request passive scan to fw 1214 * @vdev_id: vdev id 1215 * @fast_scan_period: Fast Scan period 1216 * @slow_scan_period: Slow scan period 1217 * @delay_start_time: delay in seconds to use before starting the first scan 1218 * @fast_scan_max_cycles: Fast scan max cycles 1219 * @scan_backoff_multiplier: multiply fast scan period by this after max cycles 1220 * @pno_channel_prediction: PNO channel prediction feature status 1221 * @uint32_t active_dwell_time: active dwell time 1222 * @uint32_t passive_dwell_time: passive dwell time 1223 * @top_k_num_of_channels: top K number of channels are used for tanimoto 1224 * distance calculation. 1225 * @stationary_thresh: threshold value to determine that the STA is stationary. 1226 * @adaptive_dwell_mode: adaptive dwelltime mode for pno scan 1227 * @channel_prediction_full_scan: periodic timer upon which a full scan needs 1228 * to be triggered. 1229 * @networks_list: Preferred network list 1230 * @scan_random: scan randomization params 1231 * @ie_whitelist: probe req IE whitelist attrs 1232 * @relative_rssi_set: Flag to check whether realtive_rssi is set or not 1233 * @relative_rssi: Relative rssi threshold, used for connected pno 1234 * @band_rssi_pref: Band and RSSI preference that can be given to one BSS 1235 * over the other BSS 1236 * 1237 * E.g. 1238 * { fast_scan_period=120, fast_scan_max_cycles=2, 1239 * slow_scan_period=1800, scan_backoff_multiplier=2 } 1240 * Result: 120s x2, 240s x2, 480s x2, 960s x2, 1800s xN 1241 * @mawc_params: Configuration parameters for NLO MAWC. 1242 */ 1243 struct pno_scan_req_params { 1244 uint32_t networks_cnt; 1245 bool do_passive_scan; 1246 uint32_t vdev_id; 1247 uint32_t fast_scan_period; 1248 uint32_t slow_scan_period; 1249 uint32_t delay_start_time; 1250 uint32_t fast_scan_max_cycles; 1251 uint8_t scan_backoff_multiplier; 1252 uint32_t active_dwell_time; 1253 uint32_t passive_dwell_time; 1254 uint32_t pno_channel_prediction; 1255 uint32_t top_k_num_of_channels; 1256 uint32_t stationary_thresh; 1257 enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; 1258 uint32_t channel_prediction_full_scan; 1259 struct pno_nw_type networks_list[SCAN_PNO_MAX_SUPP_NETWORKS]; 1260 struct scan_random_attr scan_random; 1261 struct probe_req_whitelist_attr ie_whitelist; 1262 bool relative_rssi_set; 1263 int8_t relative_rssi; 1264 struct cpno_band_rssi_pref band_rssi_pref; 1265 struct nlo_mawc_params mawc_params; 1266 }; 1267 1268 /** 1269 * struct pno_user_cfg - user configuration required for PNO 1270 * @channel_prediction: config PNO channel prediction feature status 1271 * @top_k_num_of_channels: def top K number of channels are used for tanimoto 1272 * distance calculation. 1273 * @stationary_thresh: def threshold val to determine that STA is stationary. 1274 * @pnoscan_adaptive_dwell_mode: def adaptive dwelltime mode for pno scan 1275 * @channel_prediction_full_scan: def periodic timer upon which full scan needs 1276 * to be triggered. 1277 * @mawc_params: Configuration parameters for NLO MAWC. 1278 */ 1279 struct pno_user_cfg { 1280 bool channel_prediction; 1281 uint8_t top_k_num_of_channels; 1282 uint8_t stationary_thresh; 1283 enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; 1284 uint32_t channel_prediction_full_scan; 1285 struct nlo_mawc_params mawc_params; 1286 }; 1287 1288 /** 1289 * struct scan_user_cfg - user configuration required for for scan 1290 * @active_dwell: default active dwell time 1291 * @passive_dwell:default passive dwell time 1292 * @conc_active_dwell: default concurrent active dwell time 1293 * @conc_passive_dwell: default concurrent passive dwell time 1294 * @conc_max_rest_time: default concurrent max rest time 1295 * @conc_min_rest_time: default concurrent min rest time 1296 * @conc_idle_time: default concurrent idle time 1297 * @scan_cache_aging_time: default scan cache aging time 1298 * @is_snr_monitoring_enabled: whether snr monitoring enabled or not 1299 * @prefer_5ghz: Prefer 5ghz AP over 2.4Ghz AP 1300 * @select_5gh_margin: Prefer connecting to 5G AP even if 1301 * its RSSI is lower by select_5gh_margin dbm than 2.4G AP. 1302 * applicable if prefer_5ghz is set. 1303 * @scan_bucket_threshold: first scan bucket 1304 * threshold to the mentioned value and all the AP's which 1305 * have RSSI under this threshold will fall under this 1306 * bucket 1307 * @rssi_cat_gap: set rssi category gap 1308 * @scan_dwell_time_mode: Adaptive dweltime mode 1309 * @pno_cfg: Pno related config params 1310 * @ie_whitelist: probe req IE whitelist attrs 1311 * @is_bssid_hint_priority: True if bssid_hint is priority 1312 * @enable_mac_spoofing: enable mac address spoof in scan 1313 * @sta_miracast_mcc_rest_time: sta miracast mcc rest time 1314 * @score_config: scoring logic configuration 1315 */ 1316 struct scan_user_cfg { 1317 uint32_t active_dwell; 1318 uint32_t passive_dwell; 1319 uint32_t conc_active_dwell; 1320 uint32_t conc_passive_dwell; 1321 uint32_t conc_max_rest_time; 1322 uint32_t conc_min_rest_time; 1323 uint32_t conc_idle_time; 1324 uint32_t scan_cache_aging_time; 1325 bool is_snr_monitoring_enabled; 1326 uint32_t prefer_5ghz; 1327 uint32_t select_5ghz_margin; 1328 int32_t scan_bucket_threshold; 1329 uint32_t rssi_cat_gap; 1330 enum scan_dwelltime_adaptive_mode scan_dwell_time_mode; 1331 struct pno_user_cfg pno_cfg; 1332 struct probe_req_whitelist_attr ie_whitelist; 1333 uint32_t usr_cfg_probe_rpt_time; 1334 uint32_t usr_cfg_num_probes; 1335 bool is_bssid_hint_priority; 1336 bool enable_mac_spoofing; 1337 uint32_t sta_miracast_mcc_rest_time; 1338 struct scoring_config score_config; 1339 }; 1340 1341 /** 1342 * update_beacon_cb() - cb to inform/update beacon 1343 * @psoc: psoc pointer 1344 * @scan_params: scan entry to inform/update 1345 * 1346 * @Return: void 1347 */ 1348 typedef void (*update_beacon_cb) (struct wlan_objmgr_pdev *pdev, 1349 struct scan_cache_entry *scan_entry); 1350 1351 /** 1352 * scan_iterator_func() - function prototype of scan iterator function 1353 * @scan_entry: scan entry object 1354 * @arg: extra argument 1355 * 1356 * PROTO TYPE, scan iterator function prototype 1357 * 1358 * @Return: QDF_STATUS 1359 */ 1360 typedef QDF_STATUS (*scan_iterator_func) (void *arg, 1361 struct scan_cache_entry *scan_entry); 1362 1363 /** 1364 * enum scan_priority - scan priority definitions 1365 * @SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT: disable scan command timeout 1366 * @SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH: config to drop beacon/probe 1367 * response frames if received channel and IE channels do not match 1368 */ 1369 enum scan_config { 1370 SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT, 1371 SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH, 1372 }; 1373 #endif 1374