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