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