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