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