1 /* 2 * Copyright (c) 2017-2021 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_HINT_S_SSID 10 37 #define WLAN_SCAN_MAX_HINT_BSSID 10 38 #define MAX_RNR_BSS 5 39 #define WLAN_SCAN_MAX_NUM_SSID 16 40 #define WLAN_SCAN_MAX_NUM_BSSID 4 41 42 #define SCM_CANCEL_SCAN_WAIT_TIME 50 43 #define SCM_CANCEL_SCAN_WAIT_ITERATION 600 44 45 #define INVAL_SCAN_ID 0xFFFFFFFF 46 #define CANCEL_HOST_SCAN_ID 0xFFFFFFFE 47 #define INVAL_VDEV_ID 0xFFFFFFFF 48 #define INVAL_PDEV_ID 0xFFFFFFFF 49 50 #define USER_SCAN_REQUESTOR_ID 0xA0000 51 #define PREAUTH_REQUESTOR_ID 0xC0000 52 53 #define BURST_SCAN_MAX_NUM_OFFCHANNELS 3 54 #define P2P_SCAN_MAX_BURST_DURATION 180 55 /* Increase dwell time for P2P search in ms */ 56 #define P2P_SEARCH_DWELL_TIME_INC 20 57 58 #define PROBE_REQ_BITMAP_LEN 8 59 #define MAX_PROBE_REQ_OUIS 16 60 61 #define TBTT_INFO_COUNT 16 62 63 /** 64 * IE Field nomenclature 65 * @MBSSID_INDICATOR_POS: Position of MaxBSSID indicator inside MBSSID tag 66 * @MIN_IE_LEN: 2bytes, which includes Tag Number and Tag length field 67 * @TAG_LEN_POS: Position of tag length field in MBSSID tag 68 * @VALID_ELEM_LEAST_LEN: Minimum fields required after tag length to call 69 * a MBSSID tag valid. (MaxBSSID Indicator + subelement ID + Subelement length 70 * atleast 1 byte of payload from subelement) 71 * @SUBELEMENT_START_POS: Starting position of 1st subelement in MBSSID tag 72 * @MAX_SUBELEM_LEN: Maximum length of a subelement 73 * @PAYLOAD_START_POS: Payload start position of a non tx bssid profile 74 * @FIXED_LENGTH: Length which includes header, timestamp, interval and 75 * capability 76 * @CAP_INFO_POS: Position of capability information in a non tx bssid profile 77 * @CAP_INFO_LEN: Length of capability information 78 * @SUBELEM_DATA_POS_FROM_MBSSID: Position of first byte of subelement payload 79 * from MBSSID Tag 80 * @ID_POS: Position of subelement ID in a non tx BSSID profile 81 * @NONTX_BSSID_CAP_TAG_LEN_POS: Position of tag length field of nontx bssid 82 * capability tag from starting of nontx bssid profile 83 * @VALID_BSS_PROF_LEAST_LEN: At least one tag should present to call it a valid 84 * non tx bssid profile and that is nothing but nontx bssid capability tag which 85 * is of 4 bytes 86 * @SPLIT_PROF_DATA_LEAST_LEN: Least possible length of second part of a split 87 * profile, which includes at least one tag, which may have tag number + tag 88 * length + atleast 1 byte of datai 89 * @BSS_INDEX_POS: Position of BSSID index field in Multiple BSSID index tag 90 * @MIN_VENDOR_TAG_LEN: Minimum length of a vendor specific tag 91 * @OUI_LEN: OUI + OUI Type + Min DATA 92 * @ELEM_ID_EXTN_POS: Position of element ID extension in an extension element 93 * @ELEM_ID_LIST_LEN_POS: Position of length field in list of element IDs 94 * @ELEM_ID_LIST_POS: Position to the start of element ID list 95 */ 96 #define MBSSID_INDICATOR_POS 2 97 #define MIN_IE_LEN 2 98 #define TAG_LEN_POS 1 99 #define VALID_ELEM_LEAST_LEN 4 100 #define SUBELEMENT_START_POS 3 101 #define MAX_SUBELEM_LEN 252 102 #define PAYLOAD_START_POS 2 103 #define FIXED_LENGTH 36 104 #define CAP_INFO_POS 4 105 #define CAP_INFO_LEN 2 106 #define SUBELEM_DATA_POS_FROM_MBSSID 5 107 #define ID_POS 0 108 #define NONTX_BSSID_CAP_TAG_LEN_POS 3 109 #define VALID_BSS_PROF_LEAST_LEN 4 110 #define SPLIT_PROF_DATA_LEAST_LEN 3 111 #define BSS_INDEX_POS 2 112 #define MIN_VENDOR_TAG_LEN 7 113 #define OUI_LEN 5 114 #define ELEM_ID_EXTN_POS 2 115 #define ELEM_ID_LIST_LEN_POS 3 116 #define ELEM_ID_LIST_POS 4 117 118 /* forward declaration */ 119 struct wlan_objmgr_vdev; 120 struct wlan_objmgr_pdev; 121 struct wlan_objmgr_psoc; 122 123 /** 124 * struct channel_info - BSS channel information 125 * @chan_freq: channel frequency 126 * @cfreq0: channel frequency index0 127 * @cfreq1: channel frequency index1 128 * @puncture_bitmap: puncture bitmap advertised in beacon 129 * @priv: channel private information 130 */ 131 struct channel_info { 132 uint32_t chan_freq; 133 uint32_t cfreq0; 134 uint32_t cfreq1; 135 #ifdef WLAN_FEATURE_11BE 136 uint16_t puncture_bitmap; 137 #endif 138 void *priv; 139 }; 140 141 /** 142 * struct ie_list - pointers to various IEs 143 * @tim: pointer to tim ie 144 * @country: pointer to country ie 145 * @ssid: pointer to ssid ie 146 * @rates: pointer to supported rates ie 147 * @xrates: pointer to extended supported rate ie 148 * @ds_param: pointer to ds params 149 * @csa: pointer to csa ie 150 * @xcsa: pointer to extended csa ie 151 * @mcst: pointer to maximum channel switch time ie 152 * @wpa: pointer to wpa ie 153 * @wcn: pointer to wcn ie 154 * @rsn: pointer to rsn ie 155 * @wps: pointer to wps ie 156 * @wmeinfo: pointer to wmeinfo ie 157 * @wmeparam: pointer to wmeparam ie 158 * @quiet: pointer to quiet ie 159 * @htcap: pointer to htcap ie 160 * @htinfo: pointer to htinfo ie 161 * @athcaps: pointer to athcaps ie 162 * @athextcaps: pointer to extended athcaps ie 163 * @sfa: pointer to sfa ie 164 * @vendor: pointer to vendor ie 165 * @qbssload: pointer to qbssload ie 166 * @wapi: pointer to wapi ie 167 * @p2p: pointer to p2p ie 168 * @alt_wcn: pointer to alternate wcn ie 169 * @extcaps: pointer to extended caps ie 170 * @ibssdfs: pointer to ibssdfs ie 171 * @sonadv: pointer to wifi son ie 172 * @vhtcap: pointer to vhtcap ie 173 * @vhtop: pointer to vhtop ie 174 * @opmode: pointer to opmode ie 175 * @tpe: array of pointers to transmit power envelope ie 176 * @cswrp: pointer to channel switch announcement wrapper ie 177 * @widebw: pointer to wide band channel switch sub ie 178 * @txpwrenvlp: pointer to tx power envelop sub ie 179 * @hecap: pointer to hecap ie 180 * @hecap_6g: pointer to he 6ghz cap ie 181 * @srp: pointer to spatial reuse parameter sub extended ie 182 * @fils_indication: pointer to FILS indication ie 183 * @esp: pointer to ESP indication ie 184 * @mbo_oce: pointer to mbo/oce indication ie 185 * @rnrie: reduced neighbor report IE 186 * @adaptive_11r: pointer to adaptive 11r IE 187 * @single_pmk: Pointer to sae single pmk IE 188 * @rsnxe: Pointer to rsnxe IE 189 * @ehtcap: pointer to ehtcap ie 190 * @ehtop: pointer to eht op ie 191 * @multi_link: pointer to multi lik IE 192 */ 193 struct ie_list { 194 uint8_t *tim; 195 uint8_t *country; 196 uint8_t *ssid; 197 uint8_t *rates; 198 uint8_t *xrates; 199 uint8_t *ds_param; 200 uint8_t *csa; 201 uint8_t *xcsa; 202 uint8_t *mcst; 203 uint8_t *wpa; 204 uint8_t *wcn; 205 uint8_t *rsn; 206 uint8_t *wps; 207 uint8_t *wmeinfo; 208 uint8_t *wmeparam; 209 uint8_t *quiet; 210 uint8_t *htcap; 211 uint8_t *htinfo; 212 uint8_t *athcaps; 213 uint8_t *athextcaps; 214 uint8_t *sfa; 215 uint8_t *vendor; 216 uint8_t *qbssload; 217 uint8_t *wapi; 218 uint8_t *p2p; 219 uint8_t *alt_wcn; 220 uint8_t *extcaps; 221 uint8_t *ibssdfs; 222 uint8_t *sonadv; 223 uint8_t *vhtcap; 224 uint8_t *vhtop; 225 uint8_t *opmode; 226 uint8_t *tpe[WLAN_MAX_NUM_TPE_IE]; 227 uint8_t *cswrp; 228 uint8_t *widebw; 229 uint8_t *txpwrenvlp; 230 uint8_t *bwnss_map; 231 uint8_t *secchanoff; 232 uint8_t *mdie; 233 uint8_t *hecap; 234 uint8_t *hecap_6g; 235 uint8_t *heop; 236 uint8_t *srp; 237 uint8_t *fils_indication; 238 uint8_t *esp; 239 uint8_t *mbo_oce; 240 uint8_t *muedca; 241 uint8_t *rnrie; 242 uint8_t *extender; 243 uint8_t *adaptive_11r; 244 uint8_t *single_pmk; 245 uint8_t *rsnxe; 246 #ifdef WLAN_FEATURE_11BE 247 uint8_t *ehtcap; 248 uint8_t *ehtop; 249 #endif 250 #ifdef WLAN_FEATURE_11BE_MLO 251 uint8_t *multi_link; 252 #endif 253 }; 254 255 enum scan_entry_connection_state { 256 SCAN_ENTRY_CON_STATE_NONE, 257 SCAN_ENTRY_CON_STATE_AUTH, 258 SCAN_ENTRY_CON_STATE_ASSOC 259 }; 260 261 /** 262 * struct mlme_info - mlme specific info 263 * temporarily maintained in scan cache for backward compatibility. 264 * must be removed as part of umac convergence. 265 * @bad_ap_time: time when this ap was marked bad 266 * @status: status 267 * @rank: rank 268 * @utility: utility 269 * @assoc_state: association state 270 * @chanload: channel load 271 */ 272 struct mlme_info { 273 qdf_time_t bad_ap_time; 274 uint32_t status; 275 uint32_t rank; 276 uint32_t utility; 277 uint32_t assoc_state; 278 uint32_t chanload; 279 }; 280 281 /** 282 * struct bss_info - information required to uniquely define a bss 283 * @freq: freq of operating primary channel 284 * @ssid: ssid of bss 285 * @bssid: bssid of bss 286 */ 287 struct bss_info { 288 uint32_t freq; 289 struct wlan_ssid ssid; 290 struct qdf_mac_addr bssid; 291 }; 292 293 #define SCAN_NODE_ACTIVE_COOKIE 0x1248F842 294 /** 295 * struct scan_cache_node - Scan cache entry node 296 * @node: node pointers 297 * @ref_cnt: ref count if in use 298 * @cookie: cookie to check if entry is logically active 299 * @entry: scan entry pointer 300 */ 301 struct scan_cache_node { 302 qdf_list_node_t node; 303 qdf_atomic_t ref_cnt; 304 uint32_t cookie; 305 struct scan_cache_entry *entry; 306 }; 307 308 /** 309 * struct security_info - Scan cache security info 310 * @authmodeset: auth mode 311 * @key_mgmt: key management 312 * @ucastcipherset: unicast cipher set 313 * @mcastcipherset: multicast cipher set 314 * @mgmtcipherset: mgmt cipher set 315 * @rsn_caps: rsn caps of scan entry 316 */ 317 struct security_info { 318 uint32_t authmodeset; 319 uint32_t key_mgmt; 320 uint32_t ucastcipherset; 321 uint32_t mcastcipherset; 322 uint32_t mgmtcipherset; 323 uint16_t rsn_caps; 324 }; 325 326 /** 327 * struct scan_mbssid_info - Scan mbssid information 328 * @profile_num: profile number 329 * @profile_count: total profile count 330 * @trans_bssid: TX BSSID address 331 * @split_profile: Indicates if next MBSSID tag has the other part 332 * of the non tx profile 333 * @prof_residue: Set prof_residue to true, if the first non TX 334 * profile of the subsequent MBSSID IE does not contain 335 * nontx BSSID Capability as the 1st tag of the payload 336 * of nontx profile 337 * @split_prof_continue: Indicates if we are evaluating the fragmented part 338 * present in the subsequent MBSSID tag 339 * @skip_bssid_copy: For the 2nd fragmented part of the split profile 340 * skip copying bssid if BSSID index is already found 341 * in the previous part of split profile 342 */ 343 struct scan_mbssid_info { 344 uint8_t profile_num; 345 uint8_t profile_count; 346 uint8_t trans_bssid[QDF_MAC_ADDR_SIZE]; 347 bool split_profile; 348 bool prof_residue; 349 bool split_prof_continue; 350 bool skip_bssid_copy; 351 }; 352 353 /** 354 * enum nontx_profile_reasoncode - Reason codes based on which the decision 355 * needs to be taken whether to continue with the on going nontx profile or 356 * move to the next one 357 * @VALID_NONTX_PROF: Continue with the on-going profile 358 * @INVALID_SPLIT_PROF: Invalid data seen in the split profile 359 * @INVALID_NONTX_PROF: Invalid data in a non split profile 360 */ 361 enum nontx_profile_reasoncode { 362 VALID_NONTX_PROF = 0, 363 INVALID_SPLIT_PROF = 0x1, 364 INVALID_NONTX_PROF = 0x2 365 }; 366 367 /** 368 * struct non_inheritance_ie - Non inheritance tag information 369 * @list_len: Length of element ID list 370 * @extn_len: Length of element ID extension list 371 * @non_inherit: Flag to indicate if any noninheritance tag present 372 * in the non tx BSSID profile 373 * @non_inh_ie_found: Flag to indicate if the noninheritance tag found 374 * from non tx BSSID profile present in the tx profile 375 * so that the copy of that IE can be skipped. 376 */ 377 struct non_inheritance_ie { 378 uint8_t list_len; 379 uint8_t extn_len; 380 bool non_inherit; 381 bool non_inh_ie_found; 382 }; 383 384 #ifdef WLAN_FEATURE_11BE_MLO 385 /** 386 * struct rnr_mld_info - Reduced Neighbor Report MLD information 387 * @mld_id: MLD ID 388 * @link_id: Link ID 389 * @bss_param_change_cnt: BSS parameters change count 390 */ 391 struct rnr_mld_info { 392 uint8_t mld_id; 393 uint16_t link_id: 4, 394 bss_param_change_cnt: 8, 395 reserved: 4; 396 }; 397 #endif 398 /** 399 * struct rnr_bss_info - Reduced Neighbor Report BSS information 400 * @neighbor_ap_tbtt_offset: Neighbor AP TBTT offset 401 * @channel_number: channel number 402 * @operating_class: operting class 403 * @bssid: BSS MAC address 404 * @short_ssid: short ssid 405 * @bss_params: BSS parameters 406 * @psd_20mhz: 20MHz power spectral density 407 * @mld_info: MLD information 408 */ 409 struct rnr_bss_info { 410 uint8_t neighbor_ap_tbtt_offset; 411 uint32_t channel_number; 412 uint32_t operating_class; 413 struct qdf_mac_addr bssid; 414 uint32_t short_ssid; 415 uint8_t bss_params; 416 uint8_t psd_20mhz; 417 #ifdef WLAN_FEATURE_11BE_MLO 418 struct rnr_mld_info mld_info; 419 #endif 420 }; 421 422 /** 423 * struct tbtt_information_header - TBTT information header 424 * @tbbt_info_fieldtype: TBTT information field type 425 * @filter_neighbor_ap: filtered neighbor ap 426 * @tbbt_info_count: TBTT information count 427 * @tbtt_info_length: TBTT informaiton length 428 */ 429 struct tbtt_information_header { 430 uint16_t tbbt_info_fieldtype:2; 431 uint16_t filtered_neighbor_ap:1; 432 uint16_t reserved:1; 433 uint16_t tbtt_info_count:4; 434 uint16_t tbtt_info_length:8; 435 }; 436 437 /** 438 * struct neighbor_ap_info_field - Neighbor information field 439 * @tbtt_info_header: TBTT information header 440 * @operting_class: operating class 441 * @channel_number: channel number 442 */ 443 struct neighbor_ap_info_field { 444 struct tbtt_information_header tbtt_header; 445 uint8_t operting_class; 446 uint8_t channel_number; 447 }; 448 449 /** 450 * enum tbtt_information_field - TBTT information field 451 * @TBTT_NEIGHBOR_AP_OFFSET_ONLY: TBTT information field type 452 * @TBTT_NEIGHBOR_AP_BSS_PARAM: neighbor AP and bss param 453 * @TBTT_NEIGHBOR_AP_MLD_PARAM: neighbor AP and MLD param 454 * @TBTT_NEIGHBOR_AP_SHORTSSID: neighbor AP and Short ssid 455 * @TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM: neighbor AP, short ssid and bss param 456 * @TBTT_NEIGHBOR_AP_BSSID: neighbor AP and bssid 457 * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM: neighbor AP, bssid and bss param 458 * @TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid and bss 459 * param and 20MHz PSD 460 * @TBTT_NEIGHBOR_AP_BSSID_MLD_PARAM: neighbor AP, bssid and MLD param 461 * @TBTT_NEIGHBOR_AP_BSSSID_S_SSID: neighbor AP, bssid and short ssid 462 * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM: neighbor AP, bssid, short ssid 463 * and bss params 464 * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD: neighbor AP, bssid, 465 * short ssid, bss params and 20MHz PSD 466 * @TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD_MLD_PARAM: neighbor AP, 467 * bssid, short ssid, bss params, 20MHz PSD and MLD param 468 */ 469 enum tbtt_information_field { 470 TBTT_NEIGHBOR_AP_OFFSET_ONLY = 1, 471 TBTT_NEIGHBOR_AP_BSS_PARAM = 2, 472 TBTT_NEIGHBOR_AP_MLD_PARAM = 4, 473 TBTT_NEIGHBOR_AP_SHORTSSID = 5, 474 TBTT_NEIGHBOR_AP_S_SSID_BSS_PARAM = 6, 475 TBTT_NEIGHBOR_AP_BSSID = 7, 476 TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM = 8, 477 TBTT_NEIGHBOR_AP_BSSID_BSS_PARAM_20MHZ_PSD = 9, 478 TBTT_NEIGHBOR_AP_BSSID_MLD_PARAM = 10, 479 TBTT_NEIGHBOR_AP_BSSSID_S_SSID = 11, 480 TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM = 12, 481 TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD = 13, 482 TBTT_NEIGHBOR_AP_BSSID_S_SSID_BSS_PARAM_20MHZ_PSD_MLD_PARAM = 16 483 }; 484 485 /** 486 * struct reduced_neighbor_report - Reduced Neighbor Report 487 * @bss_info: RNR BSS Information 488 */ 489 struct reduced_neighbor_report { 490 struct rnr_bss_info bss_info[MAX_RNR_BSS]; 491 }; 492 493 #define SCAN_SECURITY_TYPE_WEP 0x01 494 #define SCAN_SECURITY_TYPE_WPA 0x02 495 #define SCAN_SECURITY_TYPE_WAPI 0x04 496 #define SCAN_SECURITY_TYPE_RSN 0x08 497 498 #ifdef WLAN_FEATURE_11BE_MLO 499 #define MLD_MAX_LINKS 3 500 501 /** 502 * struct partner_link_info: Partner link information of an ML 503 * @link_addr: BSSID of the link 504 * @freq: center frequency in MHz 505 * @cfreq2: center frequency of the secondary channel in MHz 506 * @link_id: Link id advertised by the AP 507 */ 508 struct partner_link_info { 509 struct qdf_mac_addr link_addr; 510 uint16_t freq; 511 uint16_t cfreq2; 512 uint8_t link_id; 513 }; 514 515 /** 516 * struct ml_info: Multi link formation of a 11be beacon 517 * @mld_mac_addr: MLD mac address 518 * @num_links: Number of links supported by ML AP 519 * @self_link_id: Link id of the scan entry 520 * @link_info: Array containing partner links information 521 * @ml_bss_score: Multi link BSS score 522 */ 523 struct ml_info { 524 struct qdf_mac_addr mld_mac_addr; 525 uint8_t num_links; 526 uint8_t self_link_id; 527 struct partner_link_info link_info[MLD_MAX_LINKS - 1]; 528 uint16_t ml_bss_score; 529 }; 530 #endif 531 532 /** 533 * struct scan_cache_entry: structure containing scan entry 534 * @frm_subtype: updated from beacon/probe 535 * @bssid: bssid 536 * @mac_addr: mac address 537 * @ssid: ssid 538 * @is_hidden_ssid: is AP having hidden ssid. 539 * @security_type: security supported 540 * @seq_num: sequence number 541 * @phy_mode: Phy mode of the AP 542 * @avg_rssi: Average RSSI of the AP 543 * @rssi_raw: The rssi of the last beacon/probe received 544 * @snr: The snr of the last beacon/probe received 545 * @avg_snr: Average SNR of the AP 546 * @bcn_int: Beacon interval of the AP 547 * @cap_info: Capability of the AP 548 * @tsf_info: TSF info 549 * @erp: erp info 550 * @dtim_period: dtime period 551 * @air_time_fraction: Air time fraction from ESP param 552 * @qbss_chan_load: Qbss channel load 553 * @nss: supported NSS information 554 * @is_p2p_ssid: is P2P entry 555 * @adaptive_11r_ap: flag to check if AP supports adaptive 11r 556 * @scan_entry_time: boottime in microsec when last beacon/probe is received 557 * @rssi_timestamp: boottime in microsec when RSSI was updated 558 * @hidden_ssid_timestamp: boottime in microsec when hidden 559 * ssid was received 560 * @mbssid_info: Multi bssid information 561 * @rnr: Reduced neighbor report information 562 * @channel: channel info on which AP is present 563 * @channel_mismatch: if channel received in metadata 564 * doesnot match the one in beacon 565 * @tsf_delta: TSF delta 566 * @bss_score: bss score calculated on basis of RSSI/caps etc. 567 * @neg_sec_info: negotiated security info 568 * @per_chain_rssi: per chain RSSI value received. 569 * boottime_ns: boottime in ns. 570 * @rrm_parent_tsf: RRM parent tsf 571 * @mlme_info: Mlme info, this will be updated by MLME for the scan entry 572 * @alt_wcn_ie: alternate WCN IE 573 * @ie_list: IE list pointers 574 * @raw_frame: contain raw frame and the length of the raw frame 575 * @pdev_id: pdev id 576 * @ml_info: Multi link information 577 */ 578 struct scan_cache_entry { 579 uint8_t frm_subtype; 580 struct qdf_mac_addr bssid; 581 struct qdf_mac_addr mac_addr; 582 struct wlan_ssid ssid; 583 bool is_hidden_ssid; 584 uint8_t security_type; 585 uint16_t seq_num; 586 enum wlan_phymode phy_mode; 587 int32_t avg_rssi; 588 int8_t rssi_raw; 589 uint8_t snr; 590 uint32_t avg_snr; 591 uint16_t bcn_int; 592 union wlan_capability cap_info; 593 union { 594 uint8_t data[8]; 595 uint64_t tsf; 596 } tsf_info; 597 uint8_t erp; 598 uint8_t dtim_period; 599 uint8_t air_time_fraction; 600 uint8_t qbss_chan_load; 601 uint8_t nss; 602 bool is_p2p; 603 bool adaptive_11r_ap; 604 qdf_time_t scan_entry_time; 605 qdf_time_t rssi_timestamp; 606 qdf_time_t hidden_ssid_timestamp; 607 struct scan_mbssid_info mbssid_info; 608 struct reduced_neighbor_report rnr; 609 struct channel_info channel; 610 bool channel_mismatch; 611 struct mlme_info mlme_info; 612 uint32_t tsf_delta; 613 uint32_t bss_score; 614 struct security_info neg_sec_info; 615 uint8_t per_chain_rssi[WLAN_MGMT_TXRX_HOST_MAX_ANTENNA]; 616 uint64_t boottime_ns; 617 uint32_t rrm_parent_tsf; 618 struct element_info alt_wcn_ie; 619 struct ie_list ie_list; 620 struct element_info raw_frame; 621 /* 622 * This is added temporarily for 6GHz channel to freq conversion 623 * to get pdev wherever it requores to convert frequency to 624 * channel as regulatory apis requires pdev as argument 625 */ 626 uint8_t pdev_id; 627 #ifdef WLAN_FEATURE_11BE_MLO 628 struct ml_info ml_info; 629 #endif 630 }; 631 632 #define MAX_FAVORED_BSSID 16 633 #define MAX_ALLOWED_SSID_LIST 4 634 635 #define WLAN_SCAN_FILTER_NUM_SSID 5 636 #define WLAN_SCAN_FILTER_NUM_BSSID 5 637 638 #define REALM_HASH_LEN 2 639 #define CACHE_IDENTIFIER_LEN 2 640 #define HESSID_LEN 6 641 642 #ifdef WLAN_FEATURE_FILS_SK 643 /** 644 * struct fils_filter_info: FILS info present in scan filter 645 * @realm_check: whether realm check is required 646 * @fils_realm: realm hash value 647 * @security_type: type of security supported 648 */ 649 struct fils_filter_info { 650 bool realm_check; 651 uint8_t fils_realm[REALM_HASH_LEN]; 652 uint8_t security_type; 653 }; 654 #endif 655 656 /* 657 * struct filter_arg: Opaque pointer for the filter arguments 658 */ 659 struct filter_arg; 660 typedef struct filter_arg *bss_filter_arg_t; 661 662 /** 663 * enum dot11_mode_filter - Filter APs according to dot11mode 664 * @ALLOW_ALL: ignore check 665 * @ALLOW_11N_ONLY: allow only 11n AP 666 * @ALLOW_11AC_ONLY: allow only 11ac AP 667 * @ALLOW_11AX_ONLY: allow only 11ax AP 668 */ 669 enum dot11_mode_filter { 670 ALLOW_ALL, 671 ALLOW_11N_ONLY, 672 ALLOW_11AC_ONLY, 673 ALLOW_11AX_ONLY, 674 }; 675 676 /** 677 * struct scan_filter: scan filter 678 * @enable_adaptive_11r: flag to check if adaptive 11r ini is enabled 679 * @rrm_measurement_filter: For measurement reports.if set, only SSID, BSSID 680 * and channel is considered for filtering. 681 * @ignore_pmf_cap: Ignore pmf capability match 682 * @ignore_auth_enc_type: Ignore enc type if 683 * this is set (For WPS/OSEN connection) 684 * @ignore_nol_chan: Ignore entry with channel in the NOL list 685 * @ignore_6ghz_channel: ignore 6Ghz channels 686 * @age_threshold: If set return entry which are newer than the age_threshold 687 * @num_of_bssid: number of bssid passed 688 * @num_of_ssid: number of ssid 689 * @num_of_channels: number of channels 690 * @bss_type: bss type IBSS or BSS or ANY 691 * @pmf_cap: Pmf capability 692 * @dot11mode: Filter APs based upon dot11mode 693 * @band: to get specific band 2.4G, 5G or 4.9 G 694 * @rssi_threshold: AP having RSSI greater than 695 * rssi threasholed (ignored if set 0) 696 * @mobility_domain: Mobility domain for 11r 697 * @authmodeset: auth mode 698 * @key_mgmt: key management 699 * @ucastcipherset: unicast cipher set 700 * @mcastcipherset: multicast cipher set 701 * @mgmtcipherset: mgmt cipher set 702 * @fils_scan_filter: FILS info 703 * @bssid_hint: Mac address of bssid_hint 704 * @bssid_list: bssid list 705 * @ssid_list: ssid list 706 * @chan_freq_list: channel frequency list, frequency unit: MHz 707 * @match_security_func: Function pointer to custom security filter 708 * @match_security_func_arg: Function argument to custom security filter 709 * @ccx_validate_bss: Function pointer to custom bssid filter 710 * @ccx_validate_bss_arg: Function argument to custom bssid filter 711 */ 712 struct scan_filter { 713 uint8_t enable_adaptive_11r:1, 714 rrm_measurement_filter:1, 715 ignore_pmf_cap:1, 716 ignore_auth_enc_type:1, 717 ignore_nol_chan:1, 718 ignore_6ghz_channel:1; 719 qdf_time_t age_threshold; 720 uint8_t num_of_bssid; 721 uint8_t num_of_ssid; 722 uint16_t num_of_channels; 723 enum wlan_bss_type bss_type; 724 enum wlan_pmf_cap pmf_cap; 725 enum dot11_mode_filter dot11mode; 726 enum wlan_band band; 727 uint8_t rssi_threshold; 728 uint32_t mobility_domain; 729 uint32_t authmodeset; 730 uint32_t key_mgmt; 731 uint32_t ucastcipherset; 732 uint32_t mcastcipherset; 733 uint32_t mgmtcipherset; 734 #ifdef WLAN_FEATURE_FILS_SK 735 struct fils_filter_info fils_scan_filter; 736 #endif 737 struct qdf_mac_addr bssid_hint; 738 /* Variable params list */ 739 struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID]; 740 struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID]; 741 qdf_freq_t chan_freq_list[NUM_CHANNELS]; 742 bool (*match_security_func)(void *, struct scan_cache_entry *); 743 bss_filter_arg_t match_security_func_arg; 744 bool (*ccx_validate_bss)(void *, struct scan_cache_entry *, int); 745 bss_filter_arg_t ccx_validate_bss_arg; 746 }; 747 748 /** 749 * enum scan_disable_reason - scan enable/disable reason 750 * @REASON_SUSPEND: reason is suspend 751 * @REASON_SYSTEM_DOWN: reason is system going down 752 * @REASON_USER_SPACE: reason is user space initiated 753 * @REASON_VDEV_DOWN: reason is vdev going down 754 */ 755 enum scan_disable_reason { 756 REASON_SUSPEND = 0x1, 757 REASON_SYSTEM_DOWN = 0x2, 758 REASON_USER_SPACE = 0x4, 759 REASON_VDEV_DOWN = 0x8, 760 }; 761 762 /** 763 * enum scan_priority - scan priority definitions 764 * @SCAN_PRIORITY_VERY_LOW: very low priority 765 * @SCAN_PRIORITY_LOW: low scan priority 766 * @SCAN_PRIORITY_MEDIUM: medium priority 767 * @SCAN_PRIORITY_HIGH: high priority 768 * @SCAN_PRIORITY_VERY_HIGH: very high priority 769 * @SCAN_PRIORITY_COUNT: number of priorities supported 770 */ 771 enum scan_priority { 772 SCAN_PRIORITY_VERY_LOW, 773 SCAN_PRIORITY_LOW, 774 SCAN_PRIORITY_MEDIUM, 775 SCAN_PRIORITY_HIGH, 776 SCAN_PRIORITY_VERY_HIGH, 777 SCAN_PRIORITY_COUNT, 778 }; 779 780 /** 781 * enum scan_phy_mode - phymode used for scan 782 * @SCAN_PHY_MODE_11A: 11a mode 783 * @SCAN_PHY_MODE_11G: 11g mode 784 * @SCAN_PHY_MODE_11B: 11b mode 785 * @SCAN_PHY_MODE_11GONLY: 11g only mode 786 * @SCAN_PHY_MODE_11NA_HT20: 11na ht20 mode 787 * @SCAN_PHY_MODE_11NG_HT20: 11ng ht20 mode 788 * @SCAN_PHY_MODE_11NA_HT40: 11na ht40 mode 789 * @SCAN_PHY_MODE_11NG_HT40: 11ng ht40 mode 790 * @SCAN_PHY_MODE_11AC_VHT20: 11ac vht20 mode 791 * @SCAN_PHY_MODE_11AC_VHT40: 11ac vht40 mode 792 * @SCAN_PHY_MODE_11AC_VHT80: 11ac vht80 mode 793 * @SCAN_PHY_MODE_11AC_VHT20_2G: 2GHz 11ac vht20 mode 794 * @SCAN_PHY_MODE_11AC_VHT40_2G: 2GHz 11ac vht40 mode 795 * @SCAN_PHY_MODE_11AC_VHT80_2G: 2GHz 11ac vht80 mode 796 * @SCAN_PHY_MODE_11AC_VHT80_80: 11ac vht 80+80 mode 797 * @SCAN_PHY_MODE_11AC_VHT160: 11ac vht160 mode 798 * @SCAN_PHY_MODE_11AX_HE20: 11ax he20 mode 799 * @SCAN_PHY_MODE_11AX_HE40: 11ax he40 mode 800 * @SCAN_PHY_MODE_11AX_HE80: 11ax he80 mode 801 * @SCAN_PHY_MODE_11AX_HE80_80: 11ax he80+80 mode 802 * @SCAN_PHY_MODE_11AX_HE160: 11ax he160 mode 803 * @SCAN_PHY_MODE_11AX_HE20_2G: 2GHz 11ax he20 mode 804 * @SCAN_PHY_MODE_11AX_HE40_2G: 2GHz 11ax he40 mode 805 * @SCAN_PHY_MODE_11AX_HE80_2G: 2GHz 11ax he80 mode 806 * @SCAN_PHY_MODE_UNKNOWN: unknown phy mode 807 * @SCAN_PHY_MODE_MAX: max valid phymode 808 */ 809 enum scan_phy_mode { 810 SCAN_PHY_MODE_11A = 0, 811 SCAN_PHY_MODE_11G = 1, 812 SCAN_PHY_MODE_11B = 2, 813 SCAN_PHY_MODE_11GONLY = 3, 814 SCAN_PHY_MODE_11NA_HT20 = 4, 815 SCAN_PHY_MODE_11NG_HT20 = 5, 816 SCAN_PHY_MODE_11NA_HT40 = 6, 817 SCAN_PHY_MODE_11NG_HT40 = 7, 818 SCAN_PHY_MODE_11AC_VHT20 = 8, 819 SCAN_PHY_MODE_11AC_VHT40 = 9, 820 SCAN_PHY_MODE_11AC_VHT80 = 10, 821 SCAN_PHY_MODE_11AC_VHT20_2G = 11, 822 SCAN_PHY_MODE_11AC_VHT40_2G = 12, 823 SCAN_PHY_MODE_11AC_VHT80_2G = 13, 824 SCAN_PHY_MODE_11AC_VHT80_80 = 14, 825 SCAN_PHY_MODE_11AC_VHT160 = 15, 826 SCAN_PHY_MODE_11AX_HE20 = 16, 827 SCAN_PHY_MODE_11AX_HE40 = 17, 828 SCAN_PHY_MODE_11AX_HE80 = 18, 829 SCAN_PHY_MODE_11AX_HE80_80 = 19, 830 SCAN_PHY_MODE_11AX_HE160 = 20, 831 SCAN_PHY_MODE_11AX_HE20_2G = 21, 832 SCAN_PHY_MODE_11AX_HE40_2G = 22, 833 SCAN_PHY_MODE_11AX_HE80_2G = 23, 834 SCAN_PHY_MODE_UNKNOWN = 24, 835 SCAN_PHY_MODE_MAX = 24 836 }; 837 838 /** 839 * enum scan_dwelltime_adaptive_mode: dwelltime_mode 840 * @SCAN_DWELL_MODE_DEFAULT: Use firmware default mode 841 * @SCAN_DWELL_MODE_CONSERVATIVE: Conservative adaptive mode 842 * @SCAN_DWELL_MODE_MODERATE: Moderate adaptive mode 843 * @SCAN_DWELL_MODE_AGGRESSIVE: Aggressive adaptive mode 844 * @SCAN_DWELL_MODE_STATIC: static adaptive mode 845 */ 846 enum scan_dwelltime_adaptive_mode { 847 SCAN_DWELL_MODE_DEFAULT = 0, 848 SCAN_DWELL_MODE_CONSERVATIVE = 1, 849 SCAN_DWELL_MODE_MODERATE = 2, 850 SCAN_DWELL_MODE_AGGRESSIVE = 3, 851 SCAN_DWELL_MODE_STATIC = 4 852 }; 853 854 /** 855 * struct scan_random_attr - holds scan randomization attrs 856 * @randomize: set to true for scan randomization 857 * @mac_addr: mac addr to be randomized 858 * @mac_mask: used to represent bits in mac_addr for randomization 859 */ 860 struct scan_random_attr { 861 bool randomize; 862 uint8_t mac_addr[QDF_MAC_ADDR_SIZE]; 863 uint8_t mac_mask[QDF_MAC_ADDR_SIZE]; 864 }; 865 866 /** 867 * struct probe_req_whitelist_attr - holds probe req ie whitelist attrs 868 * @white_list: enable/disable whitelist 869 * @ie_bitmap: bitmap of IEs to be enabled 870 * @num_vendor_oui: number of vendor OUIs 871 * @voui: vendor oui buffer 872 */ 873 struct probe_req_whitelist_attr { 874 bool white_list; 875 uint32_t ie_bitmap[PROBE_REQ_BITMAP_LEN]; 876 uint32_t num_vendor_oui; 877 uint32_t voui[MAX_PROBE_REQ_OUIS]; 878 }; 879 880 /** 881 * enum scan_flags: scan flags 882 * @FLAG_SCAN_ONLY_IF_RNR_FOUND: Set this flag for a 6g channel to scan it only 883 * if an RNR IE is found with that channel while scanning 2g/5g bands. 884 */ 885 enum scan_flags { 886 FLAG_SCAN_ONLY_IF_RNR_FOUND = 0x1, 887 }; 888 889 /** 890 * struct chan_info - channel information 891 * @freq: frequency to scan 892 * @phymode: phymode in which @frequency should be scanned 893 * @flags: Flags to define channel property as defined @enum scan_flags. 894 * Firmware can use this info for different operations, e.g.: scan 895 */ 896 struct chan_info { 897 qdf_freq_t freq; 898 enum scan_phy_mode phymode; 899 enum scan_flags flags; 900 }; 901 902 /** 903 * struct chan_list - list of frequencies to be scanned 904 * and their phymode 905 * @num_chan: number of channels to scan 906 * @chan: channel parameters used for this scan 907 */ 908 struct chan_list { 909 uint8_t num_chan; 910 struct chan_info chan[NUM_CHANNELS]; 911 }; 912 913 /** 914 * struct hint_short_ssid - short SSID hint 915 * and their phymode 916 * @freq_flags: freq unit: MHz (upper 16bits) 917 * flags (lower 16bits) 918 * @short_ssid: short SSID 919 */ 920 struct hint_short_ssid { 921 uint32_t freq_flags; 922 uint32_t short_ssid; 923 }; 924 925 /** 926 * struct hint_bssid - BSSID hint 927 * and their phymode 928 * @freq_flags: freq unit: MHz (upper 16bits) 929 * flags (lower 16bits) 930 * @bssid: BSSID 931 */ 932 struct hint_bssid { 933 uint32_t freq_flags; 934 struct qdf_mac_addr bssid; 935 }; 936 937 /** 938 * enum scan_request_type: scan type 939 * @SCAN_TYPE_DEFAULT: Def scan 940 * @SCAN_TYPE_P2P_SEARCH: P2P Search 941 * @SCAN_TYPE_P2P_LISTEN: P2P listed 942 * @SCAN_TYPE_RRM: RRM scan request 943 * @SCAN_TYPE_SCAN_FOR_CONNECT : Scan for connect 944 */ 945 enum scan_request_type { 946 SCAN_TYPE_DEFAULT = 0, 947 SCAN_TYPE_P2P_SEARCH = 1, 948 SCAN_TYPE_P2P_LISTEN = 2, 949 SCAN_TYPE_RRM = 3, 950 SCAN_TYPE_SCAN_FOR_CONNECT = 4 951 }; 952 953 /** 954 * struct scan_req_params - start scan request parameter 955 * @scan_id: scan id 956 * @scan_req_id: scan requester id 957 * @vdev_id: vdev id where scan was originated 958 * @pdev_id: pdev id of parent pdev 959 * @scan_priority: scan priority 960 * @scan_ev_started: notify scan started event 961 * @scan_ev_completed: notify scan completed event 962 * @scan_ev_bss_chan: notify bss chan event 963 * @scan_ev_foreign_chan: notify foreign chan event 964 * @scan_ev_dequeued: notify scan request dequed event 965 * @scan_ev_preempted: notify scan preempted event 966 * @scan_ev_start_failed: notify scan start failed event 967 * @scan_ev_restarted: notify scan restarted event 968 * @scan_ev_foreign_chn_exit: notify foreign chan exit event 969 * @scan_ev_invalid: notify invalid scan request event 970 * @scan_ev_gpio_timeout: notify gpio timeout event 971 * @scan_ev_suspended: notify scan suspend event 972 * @scan_ev_resumed: notify scan resumed event 973 * @scan_events: variable to read and set scan_ev_* flags in one shot 974 * can be used to dump all scan_ev_* flags for debug 975 * @dwell_time_active: active dwell time 976 * @dwell_time_active_2g: active dwell time for 2G channels, if it's not zero 977 * @dwell_time_passive: passive dwell time 978 * @min_dwell_time_6g: 6Ghz min dwell time 979 * @dwell_time_active_6g: 6Ghz active dwell time 980 * @dwell_time_passive_6g: 6Ghz passive dwell time 981 * @min_rest_time: min rest time 982 * @max_rest_time: max rest time 983 * @repeat_probe_time: repeat probe time 984 * @probe_spacing_time: probe spacing time 985 * @idle_time: idle time 986 * @max_scan_time: max scan time 987 * @probe_delay: probe delay 988 * @scan_offset_time: Support split scanning on the 989 * same channel for CBS feature. 990 * @scan_f_passive: passively scan all channels including active channels 991 * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified 992 * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req 993 * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req 994 * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor 995 * @scan_f_filter_prb_req: filter Probe request frames 996 * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels 997 * @scan_f_continue_on_err:continue scan even if few certain erros have occurred 998 * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan 999 * @scan_f_offchan_data_tx: allow data transmission during off channel scan 1000 * @scan_f_promisc_mode: scan with promiscuous mode 1001 * @scan_f_capture_phy_err: enable capture ppdu with phy errrors 1002 * @scan_f_strict_passive_pch: do passive scan on passive channels 1003 * @scan_f_half_rate: enable HALF (10MHz) rate support 1004 * @scan_f_quarter_rate: set Quarter (5MHz) rate support 1005 * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel 1006 * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame 1007 * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame 1008 * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe 1009 * @scan_f_add_rand_seq_in_probe: use random sequence number in probe 1010 * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe 1011 * @scan_f_forced: force scan even in presence of data traffic 1012 * @scan_f_2ghz: scan 2.4 GHz channels 1013 * @scan_f_5ghz: scan 5 GHz channels 1014 * @scan_f_wide_band: scan in 40 MHz or higher bandwidth 1015 * @scan_flags: variable to read and set scan_f_* flags in one shot 1016 * can be used to dump all scan_f_* flags for debug 1017 * @burst_duration: burst duration 1018 * @num_bssid: no of bssid 1019 * @num_ssids: no of ssid 1020 * @n_probes: no of probe 1021 * @chan_list: channel list 1022 * @ssid: ssid list 1023 * @bssid_list: Lisst of bssid to scan 1024 * @scan_random: scan randomization params 1025 * @ie_whitelist: probe req IE whitelist attrs 1026 * @extraie: list of optional/vendor specific ie's to be added in probe requests 1027 * @htcap: htcap ie 1028 * @vhtcap: vhtcap ie 1029 * @scan_ctrl_flags_ext: scan control flag extended 1030 * @num_hint_s_ssid: number of short SSID hints 1031 * @num_hint_bssid: number of BSSID hints 1032 * @hint_s_ssid: short SSID hints 1033 * @hint_bssid: BSSID hints 1034 */ 1035 1036 struct scan_req_params { 1037 uint32_t scan_id; 1038 uint32_t scan_req_id; 1039 uint32_t vdev_id; 1040 uint32_t pdev_id; 1041 enum scan_priority scan_priority; 1042 enum scan_request_type scan_type; 1043 union { 1044 struct { 1045 uint32_t scan_ev_started:1, 1046 scan_ev_completed:1, 1047 scan_ev_bss_chan:1, 1048 scan_ev_foreign_chan:1, 1049 scan_ev_dequeued:1, 1050 scan_ev_preempted:1, 1051 scan_ev_start_failed:1, 1052 scan_ev_restarted:1, 1053 scan_ev_foreign_chn_exit:1, 1054 scan_ev_invalid:1, 1055 scan_ev_gpio_timeout:1, 1056 scan_ev_suspended:1, 1057 scan_ev_resumed:1; 1058 }; 1059 uint32_t scan_events; 1060 }; 1061 uint32_t dwell_time_active; 1062 uint32_t dwell_time_active_2g; 1063 uint32_t dwell_time_passive; 1064 uint32_t min_dwell_time_6g; 1065 uint32_t dwell_time_active_6g; 1066 uint32_t dwell_time_passive_6g; 1067 uint32_t min_rest_time; 1068 uint32_t max_rest_time; 1069 uint32_t repeat_probe_time; 1070 uint32_t probe_spacing_time; 1071 uint32_t idle_time; 1072 uint32_t max_scan_time; 1073 uint32_t probe_delay; 1074 uint32_t scan_offset_time; 1075 union { 1076 struct { 1077 uint32_t scan_f_passive:1, 1078 scan_f_bcast_probe:1, 1079 scan_f_cck_rates:1, 1080 scan_f_ofdm_rates:1, 1081 scan_f_chan_stat_evnt:1, 1082 scan_f_filter_prb_req:1, 1083 scan_f_bypass_dfs_chn:1, 1084 scan_f_continue_on_err:1, 1085 scan_f_offchan_mgmt_tx:1, 1086 scan_f_offchan_data_tx:1, 1087 scan_f_promisc_mode:1, 1088 scan_f_capture_phy_err:1, 1089 scan_f_strict_passive_pch:1, 1090 scan_f_half_rate:1, 1091 scan_f_quarter_rate:1, 1092 scan_f_force_active_dfs_chn:1, 1093 scan_f_add_tpc_ie_in_probe:1, 1094 scan_f_add_ds_ie_in_probe:1, 1095 scan_f_add_spoofed_mac_in_probe:1, 1096 scan_f_add_rand_seq_in_probe:1, 1097 scan_f_en_ie_whitelist_in_probe:1, 1098 scan_f_forced:1, 1099 scan_f_2ghz:1, 1100 scan_f_5ghz:1, 1101 scan_f_wide_band:1; 1102 }; 1103 uint32_t scan_flags; 1104 }; 1105 union { 1106 struct { 1107 uint32_t scan_policy_high_accuracy:1, 1108 scan_policy_low_span:1, 1109 scan_policy_low_power:1; 1110 }; 1111 uint32_t scan_policy_type; 1112 }; 1113 1114 enum scan_dwelltime_adaptive_mode adaptive_dwell_time_mode; 1115 uint32_t burst_duration; 1116 uint32_t num_bssid; 1117 uint32_t num_ssids; 1118 uint32_t n_probes; 1119 struct chan_list chan_list; 1120 struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID]; 1121 struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID]; 1122 struct scan_random_attr scan_random; 1123 struct probe_req_whitelist_attr ie_whitelist; 1124 struct element_info extraie; 1125 struct element_info htcap; 1126 struct element_info vhtcap; 1127 uint32_t scan_ctrl_flags_ext; 1128 uint32_t num_hint_s_ssid; 1129 uint32_t num_hint_bssid; 1130 struct hint_short_ssid hint_s_ssid[WLAN_SCAN_MAX_HINT_S_SSID]; 1131 struct hint_bssid hint_bssid[WLAN_SCAN_MAX_HINT_BSSID]; 1132 }; 1133 1134 /** 1135 * struct scan_start_request - scan request config 1136 * @vdev: vdev 1137 * @scan_req: common scan start request parameters 1138 */ 1139 struct scan_start_request { 1140 struct wlan_objmgr_vdev *vdev; 1141 struct scan_req_params scan_req; 1142 }; 1143 1144 /** 1145 * enum scan_cancel_type - type specifiers for cancel scan request 1146 * @WLAN_SCAN_CANCEL_SINGLE: cancel particular scan specified by scan_id 1147 * @WLAN_SCAN_CANCEL_VAP_ALL: cancel all scans running on a particular vdevid 1148 * @WLAN_SCAN_CANCEL_PDEV_ALL: cancel all scans running on parent pdev of vdevid 1149 * @WLAN_SCAN_CANCEL_HOST_VDEV_ALL: Cancel all host triggered scans alone on 1150 * vdev 1151 */ 1152 enum scan_cancel_req_type { 1153 WLAN_SCAN_CANCEL_SINGLE = 1, 1154 WLAN_SCAN_CANCEL_VDEV_ALL, 1155 WLAN_SCAN_CANCEL_PDEV_ALL, 1156 WLAN_SCAN_CANCEL_HOST_VDEV_ALL, 1157 }; 1158 1159 /** 1160 * struct scan_cancel_param - stop scan cmd parameter 1161 * @requester: scan requester 1162 * @scan_id: scan id 1163 * @req_type: scan request type 1164 * @vdev_id: vdev id 1165 * @pdev_id: pdev id of parent pdev 1166 */ 1167 struct scan_cancel_param { 1168 uint32_t requester; 1169 uint32_t scan_id; 1170 enum scan_cancel_req_type req_type; 1171 uint32_t vdev_id; 1172 uint32_t pdev_id; 1173 }; 1174 1175 /** 1176 * struct scan_cancel_request - stop scan cmd 1177 * @vdev: vdev object 1178 * @wait_tgt_cancel: wait for target to cancel scan 1179 * @cancel_req: stop scan cmd parameter 1180 */ 1181 struct scan_cancel_request { 1182 /* Extra parameters consumed by scan module or serialization */ 1183 struct wlan_objmgr_vdev *vdev; 1184 bool wait_tgt_cancel; 1185 /* Actual scan cancel request parameters */ 1186 struct scan_cancel_param cancel_req; 1187 }; 1188 1189 /** 1190 * enum scan_event_type - scan event types 1191 * @SCAN_EVENT_TYPE_STARTED: scan started 1192 * @SCAN_EVENT_TYPE_COMPLETED: scan completed 1193 * @SCAN_EVENT_TYPE_BSS_CHANNEL: HW came back to home channel 1194 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL: HW moved to foreign channel 1195 * @SCAN_EVENT_TYPE_DEQUEUED: scan request dequeued 1196 * @SCAN_EVENT_TYPE_PREEMPTED: scan got preempted 1197 * @SCAN_EVENT_TYPE_START_FAILED: couldn't start scan 1198 * @SCAN_EVENT_TYPE_RESTARTED: scan restarted 1199 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT: HW exited foreign channel 1200 * @SCAN_EVENT_TYPE_SUSPENDED: scan got suspended 1201 * @SCAN_EVENT_TYPE_RESUMED: scan resumed 1202 * @SCAN_EVENT_TYPE_NLO_COMPLETE: NLO completed 1203 * @SCAN_EVENT_TYPE_NLO_MATCH: NLO match event 1204 * @SCAN_EVENT_TYPE_INVALID: invalid request 1205 * @SCAN_EVENT_TYPE_GPIO_TIMEOUT: gpio timeout 1206 * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START: radio measurement start 1207 * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END: radio measurement end 1208 * @SCAN_EVENT_TYPE_BSSID_MATCH: bssid match found 1209 * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF: foreign channel noise floor 1210 * @SCAN_EVENT_TYPE_MAX: marker for invalid event 1211 */ 1212 enum scan_event_type { 1213 SCAN_EVENT_TYPE_STARTED, 1214 SCAN_EVENT_TYPE_COMPLETED, 1215 SCAN_EVENT_TYPE_BSS_CHANNEL, 1216 SCAN_EVENT_TYPE_FOREIGN_CHANNEL, 1217 SCAN_EVENT_TYPE_DEQUEUED, 1218 SCAN_EVENT_TYPE_PREEMPTED, 1219 SCAN_EVENT_TYPE_START_FAILED, 1220 SCAN_EVENT_TYPE_RESTARTED, 1221 SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT, 1222 SCAN_EVENT_TYPE_SUSPENDED, 1223 SCAN_EVENT_TYPE_RESUMED, 1224 SCAN_EVENT_TYPE_NLO_COMPLETE, 1225 SCAN_EVENT_TYPE_NLO_MATCH, 1226 SCAN_EVENT_TYPE_INVALID, 1227 SCAN_EVENT_TYPE_GPIO_TIMEOUT, 1228 SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START, 1229 SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END, 1230 SCAN_EVENT_TYPE_BSSID_MATCH, 1231 SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF, 1232 SCAN_EVENT_TYPE_MAX, 1233 }; 1234 1235 /** 1236 * enum scan_completion_reason - scan completion reason 1237 * @SCAN_REASON_NONE: un specified reason 1238 * @SCAN_REASON_COMPLETED: scan successfully completed 1239 * @SCAN_REASON_CANCELLED: scan got cancelled 1240 * @SCAN_REASON_PREEMPTED: scan got preempted 1241 * @SCAN_REASON_TIMEDOUT: couldnt complete within specified time 1242 * @SCAN_REASON_INTERNAL_FAILURE: cancelled because of some failure 1243 * @SCAN_REASON_SUSPENDED: scan suspended 1244 * @SCAN_REASON_RUN_FAILED: run failed 1245 * @SCAN_REASON_TERMINATION_FUNCTION: termination function 1246 * @SCAN_REASON_MAX_OFFCHAN_RETRIES: max retries exceeded thresold 1247 * @SCAN_REASON_DFS_VIOLATION: Scan start failure due to DFS violation. 1248 * @SCAN_REASON_MAX: invalid completion reason marker 1249 */ 1250 enum scan_completion_reason { 1251 SCAN_REASON_NONE, 1252 SCAN_REASON_COMPLETED, 1253 SCAN_REASON_CANCELLED, 1254 SCAN_REASON_PREEMPTED, 1255 SCAN_REASON_TIMEDOUT, 1256 SCAN_REASON_INTERNAL_FAILURE, 1257 SCAN_REASON_SUSPENDED, 1258 SCAN_REASON_RUN_FAILED, 1259 SCAN_REASON_TERMINATION_FUNCTION, 1260 SCAN_REASON_MAX_OFFCHAN_RETRIES, 1261 SCAN_REASON_DFS_VIOLATION, 1262 SCAN_REASON_MAX, 1263 }; 1264 1265 /** 1266 * struct scan_event - scan event definition 1267 * @vdev_id: vdev where scan was run 1268 * @type: type of scan event 1269 * @reason: completion reason 1270 * @chan_freq: channel centre frequency 1271 * @requester: requester id 1272 * @scan_id: scan id 1273 * @timestamp: timestamp in microsec recorded by target for the scan event 1274 * @scan_start_req: scan request object used to start this scan 1275 */ 1276 struct scan_event { 1277 uint32_t vdev_id; 1278 enum scan_event_type type; 1279 enum scan_completion_reason reason; 1280 uint32_t chan_freq; 1281 uint32_t requester; 1282 uint32_t scan_id; 1283 uint32_t timestamp; 1284 struct scan_start_request *scan_start_req; 1285 }; 1286 1287 /** 1288 * struct scan_event_info - scan event information 1289 * @vdev: vdev object 1290 * @event: scan event 1291 */ 1292 struct scan_event_info { 1293 struct wlan_objmgr_vdev *vdev; 1294 struct scan_event event; 1295 }; 1296 1297 /** 1298 * enum scm_scan_status - scan status 1299 * @SCAN_NOT_IN_PROGRESS: Neither active nor pending scan in progress 1300 * @SCAN_IS_ACTIVE: scan request is present only in active list 1301 * @SCAN_IS_PENDING: scan request is present only in pending list 1302 * @SCAN_IS_ACTIVE_AND_PENDING: scan request is present in active 1303 * and pending both lists 1304 */ 1305 enum scm_scan_status { 1306 SCAN_NOT_IN_PROGRESS = 0, /* Must be 0 */ 1307 SCAN_IS_ACTIVE, 1308 SCAN_IS_PENDING, 1309 SCAN_IS_ACTIVE_AND_PENDING, 1310 }; 1311 1312 /** 1313 * scan_event_handler() - function prototype of scan event handlers 1314 * @vdev: vdev object 1315 * @event: scan event 1316 * @arg: argument 1317 * 1318 * PROTO TYPE, scan event handler call back function prototype 1319 * 1320 * @Return: void 1321 */ 1322 typedef void (*scan_event_handler) (struct wlan_objmgr_vdev *vdev, 1323 struct scan_event *event, void *arg); 1324 1325 /** 1326 * enum scan_cb_type - update beacon cb type 1327 * @SCAN_CB_TYPE_INFORM_BCN: Calback to indicate beacon to OS 1328 * @SCAN_CB_TYPE_UPDATE_BCN: Calback to indicate beacon 1329 * @SCAN_CB_TYPE_UNLINK_BSS: cb to unlink bss entry 1330 * to MLME and update MLME info 1331 * 1332 */ 1333 enum scan_cb_type { 1334 SCAN_CB_TYPE_INFORM_BCN, 1335 SCAN_CB_TYPE_UPDATE_BCN, 1336 SCAN_CB_TYPE_UNLINK_BSS, 1337 }; 1338 1339 /* Set PNO */ 1340 #define SCAN_PNO_MAX_PLAN_REQUEST 2 1341 #define SCAN_PNO_MAX_NETW_CHANNELS_EX (NUM_CHANNELS) 1342 #define SCAN_PNO_MAX_SUPP_NETWORKS 16 1343 #define SCAN_PNO_DEF_SLOW_SCAN_MULTIPLIER 6 1344 #define SCAN_PNO_DEF_SCAN_TIMER_REPEAT 20 1345 #define SCAN_PNO_MATCH_WAKE_LOCK_TIMEOUT (5 * 1000) /* in msec */ 1346 #define SCAN_MAX_IE_LENGTH 255 1347 #ifdef CONFIG_SLUB_DEBUG_ON 1348 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (2 * 1000) /* in msec */ 1349 #else 1350 #define SCAN_PNO_SCAN_COMPLETE_WAKE_LOCK_TIMEOUT (1 * 1000) /* in msec */ 1351 #endif /* CONFIG_SLUB_DEBUG_ON */ 1352 1353 /** 1354 * enum ssid_bc_type - SSID broadcast type 1355 * @SSID_BC_TYPE_UNKNOWN: Broadcast unknown 1356 * @SSID_BC_TYPE_NORMAL: Broadcast normal 1357 * @SSID_BC_TYPE_HIDDEN: Broadcast hidden 1358 */ 1359 enum ssid_bc_type { 1360 SSID_BC_TYPE_UNKNOWN = 0, 1361 SSID_BC_TYPE_NORMAL = 1, 1362 SSID_BC_TYPE_HIDDEN = 2, 1363 }; 1364 1365 /** 1366 * struct pno_nw_type - pno nw type 1367 * @ssid: ssid 1368 * @authentication: authentication type 1369 * @encryption: encryption type 1370 * @bcastNetwType: broadcast nw type 1371 * @ucChannelCount: uc channel count 1372 * @aChannels: pno channel 1373 * @rssiThreshold: rssi threshold 1374 */ 1375 struct pno_nw_type { 1376 struct wlan_ssid ssid; 1377 uint32_t authentication; 1378 uint32_t encryption; 1379 uint32_t bc_new_type; 1380 uint8_t channel_cnt; 1381 uint32_t channels[SCAN_PNO_MAX_NETW_CHANNELS_EX]; 1382 int32_t rssi_thresh; 1383 }; 1384 1385 /** 1386 * struct connected_pno_band_rssi_pref - BSS preference based on band 1387 * and RSSI 1388 * @band: band preference 1389 * @rssi_pref: RSSI preference 1390 */ 1391 struct cpno_band_rssi_pref { 1392 int8_t band; 1393 int8_t rssi; 1394 }; 1395 1396 /** 1397 * struct nlo_mawc_params - Motion Aided Wireless Connectivity based 1398 * Network List Offload configuration 1399 * @vdev_id: VDEV ID on which the configuration needs to be applied 1400 * @enable: flag to enable or disable 1401 * @exp_backoff_ratio: ratio of exponential backoff 1402 * @init_scan_interval: initial scan interval(msec) 1403 * @max_scan_interval: max scan interval(msec) 1404 */ 1405 struct nlo_mawc_params { 1406 uint8_t vdev_id; 1407 bool enable; 1408 uint32_t exp_backoff_ratio; 1409 uint32_t init_scan_interval; 1410 uint32_t max_scan_interval; 1411 }; 1412 1413 /** 1414 * struct pno_scan_req_params - PNO Scan request structure 1415 * @networks_cnt: Number of networks 1416 * @do_passive_scan: Flag to request passive scan to fw 1417 * @vdev_id: vdev id 1418 * @fast_scan_period: Fast Scan period 1419 * @slow_scan_period: Slow scan period 1420 * @delay_start_time: delay in seconds to use before starting the first scan 1421 * @fast_scan_max_cycles: Fast scan max cycles 1422 * @scan_backoff_multiplier: multiply fast scan period by this after max cycles 1423 * @pno_channel_prediction: PNO channel prediction feature status 1424 * @uint32_t active_dwell_time: active dwell time 1425 * @uint32_t passive_dwell_time: passive dwell time 1426 * @top_k_num_of_channels: top K number of channels are used for tanimoto 1427 * distance calculation. 1428 * @stationary_thresh: threshold value to determine that the STA is stationary. 1429 * @adaptive_dwell_mode: adaptive dwelltime mode for pno scan 1430 * @channel_prediction_full_scan: periodic timer upon which a full scan needs 1431 * to be triggered. 1432 * @networks_list: Preferred network list 1433 * @scan_random: scan randomization params 1434 * @ie_whitelist: probe req IE whitelist attrs 1435 * @relative_rssi_set: Flag to check whether realtive_rssi is set or not 1436 * @relative_rssi: Relative rssi threshold, used for connected pno 1437 * @band_rssi_pref: Band and RSSI preference that can be given to one BSS 1438 * over the other BSS 1439 * 1440 * E.g. 1441 * { fast_scan_period=120, fast_scan_max_cycles=2, 1442 * slow_scan_period=1800, scan_backoff_multiplier=2 } 1443 * Result: 120s x2, 240s x2, 480s x2, 960s x2, 1800s xN 1444 * @mawc_params: Configuration parameters for NLO MAWC. 1445 */ 1446 struct pno_scan_req_params { 1447 uint32_t networks_cnt; 1448 bool do_passive_scan; 1449 uint32_t vdev_id; 1450 uint32_t fast_scan_period; 1451 uint32_t slow_scan_period; 1452 uint32_t delay_start_time; 1453 uint32_t fast_scan_max_cycles; 1454 uint8_t scan_backoff_multiplier; 1455 uint32_t active_dwell_time; 1456 uint32_t passive_dwell_time; 1457 uint32_t pno_channel_prediction; 1458 uint32_t top_k_num_of_channels; 1459 uint32_t stationary_thresh; 1460 enum scan_dwelltime_adaptive_mode adaptive_dwell_mode; 1461 uint32_t channel_prediction_full_scan; 1462 struct pno_nw_type networks_list[SCAN_PNO_MAX_SUPP_NETWORKS]; 1463 struct scan_random_attr scan_random; 1464 struct probe_req_whitelist_attr ie_whitelist; 1465 bool relative_rssi_set; 1466 int8_t relative_rssi; 1467 struct cpno_band_rssi_pref band_rssi_pref; 1468 struct nlo_mawc_params mawc_params; 1469 }; 1470 1471 /** 1472 * struct scan_user_cfg - user configuration required for for scan 1473 * @ie_whitelist: probe req IE whitelist attrs 1474 * @sta_miracast_mcc_rest_time: sta miracast mcc rest time 1475 */ 1476 struct scan_user_cfg { 1477 struct probe_req_whitelist_attr ie_whitelist; 1478 uint32_t sta_miracast_mcc_rest_time; 1479 }; 1480 1481 /** 1482 * update_beacon_cb() - cb to inform/update beacon 1483 * @psoc: psoc pointer 1484 * @scan_params: scan entry to inform/update 1485 * 1486 * @Return: void 1487 */ 1488 typedef void (*update_beacon_cb) (struct wlan_objmgr_pdev *pdev, 1489 struct scan_cache_entry *scan_entry); 1490 1491 /** 1492 * scan_iterator_func() - function prototype of scan iterator function 1493 * @scan_entry: scan entry object 1494 * @arg: extra argument 1495 * 1496 * PROTO TYPE, scan iterator function prototype 1497 * 1498 * @Return: QDF_STATUS 1499 */ 1500 typedef QDF_STATUS (*scan_iterator_func) (void *arg, 1501 struct scan_cache_entry *scan_entry); 1502 1503 /** 1504 * enum scan_priority - scan priority definitions 1505 * @SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT: disable scan command timeout 1506 * @SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH: config to drop beacon/probe 1507 * response frames if received channel and IE channels do not match 1508 */ 1509 enum scan_config { 1510 SCAN_CFG_DISABLE_SCAN_COMMAND_TIMEOUT, 1511 SCAN_CFG_DROP_BCN_ON_CHANNEL_MISMATCH, 1512 }; 1513 1514 /** 1515 * enum ext_cap_bit_field - Extended capabilities bit field 1516 * @BSS_2040_COEX_MGMT_SUPPORT: 20/40 BSS Coexistence Management Support field 1517 * @OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT: OBSS Narrow Bandwidth RU 1518 * in UL OFDMA Tolerance Support 1519 */ 1520 enum ext_cap_bit_field { 1521 BSS_2040_COEX_MGMT_SUPPORT = 0, 1522 OBSS_NARROW_BW_RU_IN_ULOFDMA_TOLERENT_SUPPORT = 79, 1523 }; 1524 1525 /** 1526 * scan_rnr_info - RNR information 1527 * @timestamp: time stamp of beacon/probe 1528 * @short_ssid: Short SSID 1529 * @bssid: BSSID 1530 */ 1531 struct scan_rnr_info { 1532 qdf_time_t timestamp; 1533 uint32_t short_ssid; 1534 struct qdf_mac_addr bssid; 1535 }; 1536 1537 /** 1538 * struct scan_rnr_node - Scan RNR entry node 1539 * @node: node pointers 1540 * @entry: scan RNR entry pointer 1541 */ 1542 struct scan_rnr_node { 1543 qdf_list_node_t node; 1544 struct scan_rnr_info entry; 1545 }; 1546 1547 /** 1548 * meta_rnr_channel - Channel information for scan priority algorithm 1549 * @chan_freq: channel frequency 1550 * @bss_beacon_probe_count: Beacon and probe request count 1551 * @saved_profile_count: Saved profile count 1552 * @beacon_probe_last_time_found: Timestamp of beacon/probe observed 1553 * @rnr_list: RNR list to store RNR IE information 1554 */ 1555 struct meta_rnr_channel { 1556 uint32_t chan_freq; 1557 uint32_t bss_beacon_probe_count; 1558 uint32_t saved_profile_count; 1559 qdf_time_t beacon_probe_last_time_found; 1560 qdf_list_t rnr_list; 1561 }; 1562 1563 #define RNR_UPDATE_SCAN_CNT_THRESHOLD 2 1564 /** 1565 * channel_list_db - Database for channel information 1566 * @channel: channel meta information 1567 * @scan_count: scan count since the db was updated 1568 */ 1569 struct channel_list_db { 1570 struct meta_rnr_channel channel[NUM_6GHZ_CHANNELS]; 1571 uint8_t scan_count; 1572 }; 1573 1574 /** 1575 * rnr_chan_weight - RNR channel weightage 1576 * @chan_freq: channel frequency 1577 * @weight: weightage of the channel 1578 * @phymode: phymode in which @frequency should be scanned 1579 * @flags: Flags to define channel property as defined @enum scan_flags. 1580 * Firmware can use this info for different operations, e.g.: scan 1581 */ 1582 struct rnr_chan_weight { 1583 uint32_t chan_freq; 1584 uint32_t weight; 1585 enum scan_phy_mode phymode; 1586 enum scan_flags flags; 1587 }; 1588 #endif 1589