1 /****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 9 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 10 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 11 * Copyright(c) 2018 - 2019 Intel Corporation 12 * 13 * This program is free software; you can redistribute it and/or modify 14 * it under the terms of version 2 of the GNU General Public License as 15 * published by the Free Software Foundation. 16 * 17 * This program is distributed in the hope that it will be useful, but 18 * WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * General Public License for more details. 21 * 22 * The full GNU General Public License is included in this distribution 23 * in the file called COPYING. 24 * 25 * Contact Information: 26 * Intel Linux Wireless <linuxwifi@intel.com> 27 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 28 * 29 * BSD LICENSE 30 * 31 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. 32 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH 33 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH 34 * Copyright(c) 2018 - 2019 Intel Corporation 35 * All rights reserved. 36 * 37 * Redistribution and use in source and binary forms, with or without 38 * modification, are permitted provided that the following conditions 39 * are met: 40 * 41 * * Redistributions of source code must retain the above copyright 42 * notice, this list of conditions and the following disclaimer. 43 * * Redistributions in binary form must reproduce the above copyright 44 * notice, this list of conditions and the following disclaimer in 45 * the documentation and/or other materials provided with the 46 * distribution. 47 * * Neither the name Intel Corporation nor the names of its 48 * contributors may be used to endorse or promote products derived 49 * from this software without specific prior written permission. 50 * 51 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 52 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 53 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 54 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 55 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 56 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 57 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 58 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 59 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 60 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 61 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 62 * 63 *****************************************************************************/ 64 65 #ifndef __iwl_fw_api_scan_h__ 66 #define __iwl_fw_api_scan_h__ 67 68 /* Scan Commands, Responses, Notifications */ 69 70 /* Max number of IEs for direct SSID scans in a command */ 71 #define PROBE_OPTION_MAX 20 72 73 /** 74 * struct iwl_ssid_ie - directed scan network information element 75 * 76 * Up to 20 of these may appear in REPLY_SCAN_CMD, 77 * selected by "type" bit field in struct iwl_scan_channel; 78 * each channel may select different ssids from among the 20 entries. 79 * SSID IEs get transmitted in reverse order of entry. 80 * 81 * @id: element ID 82 * @len: element length 83 * @ssid: element (SSID) data 84 */ 85 struct iwl_ssid_ie { 86 u8 id; 87 u8 len; 88 u8 ssid[IEEE80211_MAX_SSID_LEN]; 89 } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */ 90 91 /* scan offload */ 92 #define IWL_SCAN_MAX_BLACKLIST_LEN 64 93 #define IWL_SCAN_SHORT_BLACKLIST_LEN 16 94 #define IWL_SCAN_MAX_PROFILES 11 95 #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512 96 #define SCAN_NUM_BAND_PROBE_DATA_V_1 2 97 #define SCAN_NUM_BAND_PROBE_DATA_V_2 3 98 99 /* Default watchdog (in MS) for scheduled scan iteration */ 100 #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000) 101 102 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) 103 #define CAN_ABORT_STATUS 1 104 105 #define IWL_FULL_SCAN_MULTIPLIER 5 106 #define IWL_FAST_SCHED_SCAN_ITERATIONS 3 107 #define IWL_MAX_SCHED_SCAN_PLANS 2 108 109 enum scan_framework_client { 110 SCAN_CLIENT_SCHED_SCAN = BIT(0), 111 SCAN_CLIENT_NETDETECT = BIT(1), 112 SCAN_CLIENT_ASSET_TRACKING = BIT(2), 113 }; 114 115 /** 116 * struct iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S 117 * @ssid: MAC address to filter out 118 * @reported_rssi: AP rssi reported to the host 119 * @client_bitmap: clients ignore this entry - enum scan_framework_client 120 */ 121 struct iwl_scan_offload_blacklist { 122 u8 ssid[ETH_ALEN]; 123 u8 reported_rssi; 124 u8 client_bitmap; 125 } __packed; 126 127 enum iwl_scan_offload_network_type { 128 IWL_NETWORK_TYPE_BSS = 1, 129 IWL_NETWORK_TYPE_IBSS = 2, 130 IWL_NETWORK_TYPE_ANY = 3, 131 }; 132 133 enum iwl_scan_offload_band_selection { 134 IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4, 135 IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8, 136 IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc, 137 }; 138 139 /** 140 * struct iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S 141 * @ssid_index: index to ssid list in fixed part 142 * @unicast_cipher: encryption algorithm to match - bitmap 143 * @auth_alg: authentication algorithm to match - bitmap 144 * @network_type: enum iwl_scan_offload_network_type 145 * @band_selection: enum iwl_scan_offload_band_selection 146 * @client_bitmap: clients waiting for match - enum scan_framework_client 147 * @reserved: reserved 148 */ 149 struct iwl_scan_offload_profile { 150 u8 ssid_index; 151 u8 unicast_cipher; 152 u8 auth_alg; 153 u8 network_type; 154 u8 band_selection; 155 u8 client_bitmap; 156 u8 reserved[2]; 157 } __packed; 158 159 /** 160 * struct iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1 161 * @profiles: profiles to search for match 162 * @blacklist_len: length of blacklist 163 * @num_profiles: num of profiles in the list 164 * @match_notify: clients waiting for match found notification 165 * @pass_match: clients waiting for the results 166 * @active_clients: active clients bitmap - enum scan_framework_client 167 * @any_beacon_notify: clients waiting for match notification without match 168 * @reserved: reserved 169 */ 170 struct iwl_scan_offload_profile_cfg { 171 struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES]; 172 u8 blacklist_len; 173 u8 num_profiles; 174 u8 match_notify; 175 u8 pass_match; 176 u8 active_clients; 177 u8 any_beacon_notify; 178 u8 reserved[2]; 179 } __packed; 180 181 /** 182 * struct iwl_scan_schedule_lmac - schedule of scan offload 183 * @delay: delay between iterations, in seconds. 184 * @iterations: num of scan iterations 185 * @full_scan_mul: number of partial scans before each full scan 186 */ 187 struct iwl_scan_schedule_lmac { 188 __le16 delay; 189 u8 iterations; 190 u8 full_scan_mul; 191 } __packed; /* SCAN_SCHEDULE_API_S */ 192 193 enum iwl_scan_offload_complete_status { 194 IWL_SCAN_OFFLOAD_COMPLETED = 1, 195 IWL_SCAN_OFFLOAD_ABORTED = 2, 196 }; 197 198 enum iwl_scan_ebs_status { 199 IWL_SCAN_EBS_SUCCESS, 200 IWL_SCAN_EBS_FAILED, 201 IWL_SCAN_EBS_CHAN_NOT_FOUND, 202 IWL_SCAN_EBS_INACTIVE, 203 }; 204 205 /** 206 * struct iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S 207 * @tx_flags: combination of TX_CMD_FLG_* 208 * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is 209 * cleared. Combination of RATE_MCS_* 210 * @sta_id: index of destination station in FW station table 211 * @reserved: for alignment and future use 212 */ 213 struct iwl_scan_req_tx_cmd { 214 __le32 tx_flags; 215 __le32 rate_n_flags; 216 u8 sta_id; 217 u8 reserved[3]; 218 } __packed; 219 220 enum iwl_scan_channel_flags_lmac { 221 IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27), 222 IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28), 223 }; 224 225 /** 226 * struct iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2 227 * @flags: bits 1-20: directed scan to i'th ssid 228 * other bits &enum iwl_scan_channel_flags_lmac 229 * @channel_num: channel number 1-13 etc 230 * @iter_count: scan iteration on this channel 231 * @iter_interval: interval in seconds between iterations on one channel 232 */ 233 struct iwl_scan_channel_cfg_lmac { 234 __le32 flags; 235 __le16 channel_num; 236 __le16 iter_count; 237 __le32 iter_interval; 238 } __packed; 239 240 /* 241 * struct iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1 242 * @offset: offset in the data block 243 * @len: length of the segment 244 */ 245 struct iwl_scan_probe_segment { 246 __le16 offset; 247 __le16 len; 248 } __packed; 249 250 /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2 251 * @mac_header: first (and common) part of the probe 252 * @band_data: band specific data 253 * @common_data: last (and common) part of the probe 254 * @buf: raw data block 255 */ 256 struct iwl_scan_probe_req_v1 { 257 struct iwl_scan_probe_segment mac_header; 258 struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_1]; 259 struct iwl_scan_probe_segment common_data; 260 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE]; 261 } __packed; 262 263 /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_v2 264 * @mac_header: first (and common) part of the probe 265 * @band_data: band specific data 266 * @common_data: last (and common) part of the probe 267 * @buf: raw data block 268 */ 269 struct iwl_scan_probe_req { 270 struct iwl_scan_probe_segment mac_header; 271 struct iwl_scan_probe_segment band_data[SCAN_NUM_BAND_PROBE_DATA_V_2]; 272 struct iwl_scan_probe_segment common_data; 273 u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE]; 274 } __packed; 275 276 enum iwl_scan_channel_flags { 277 IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0), 278 IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1), 279 IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2), 280 IWL_SCAN_CHANNEL_FLAG_EBS_FRAG = BIT(3), 281 }; 282 283 /* struct iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S 284 * @flags: enum iwl_scan_channel_flags 285 * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is 286 * involved. 287 * 1 - EBS is disabled. 288 * 2 - every second scan will be full scan(and so on). 289 */ 290 struct iwl_scan_channel_opt { 291 __le16 flags; 292 __le16 non_ebs_ratio; 293 } __packed; 294 295 /** 296 * enum iwl_mvm_lmac_scan_flags - LMAC scan flags 297 * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses 298 * without filtering. 299 * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels 300 * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan 301 * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification 302 * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS: multiple SSID matching 303 * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented 304 * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report 305 * and DS parameter set IEs into probe requests. 306 * @IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL: use extended dwell time on channels 307 * 1, 6 and 11. 308 * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches 309 */ 310 enum iwl_mvm_lmac_scan_flags { 311 IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0), 312 IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1), 313 IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2), 314 IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3), 315 IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4), 316 IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5), 317 IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6), 318 IWL_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL = BIT(7), 319 IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9), 320 }; 321 322 enum iwl_scan_priority { 323 IWL_SCAN_PRIORITY_LOW, 324 IWL_SCAN_PRIORITY_MEDIUM, 325 IWL_SCAN_PRIORITY_HIGH, 326 }; 327 328 enum iwl_scan_priority_ext { 329 IWL_SCAN_PRIORITY_EXT_0_LOWEST, 330 IWL_SCAN_PRIORITY_EXT_1, 331 IWL_SCAN_PRIORITY_EXT_2, 332 IWL_SCAN_PRIORITY_EXT_3, 333 IWL_SCAN_PRIORITY_EXT_4, 334 IWL_SCAN_PRIORITY_EXT_5, 335 IWL_SCAN_PRIORITY_EXT_6, 336 IWL_SCAN_PRIORITY_EXT_7_HIGHEST, 337 }; 338 339 /** 340 * struct iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1 341 * @reserved1: for alignment and future use 342 * @n_channels: num of channels to scan 343 * @active_dwell: dwell time for active channels 344 * @passive_dwell: dwell time for passive channels 345 * @fragmented_dwell: dwell time for fragmented passive scan 346 * @extended_dwell: dwell time for channels 1, 6 and 11 (in certain cases) 347 * @reserved2: for alignment and future use 348 * @rx_chain_select: PHY_RX_CHAIN_* flags 349 * @scan_flags: &enum iwl_mvm_lmac_scan_flags 350 * @max_out_time: max time (in TU) to be out of associated channel 351 * @suspend_time: pause scan this long (TUs) when returning to service channel 352 * @flags: RXON flags 353 * @filter_flags: RXON filter 354 * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz 355 * @direct_scan: list of SSIDs for directed active scan 356 * @scan_prio: enum iwl_scan_priority 357 * @iter_num: number of scan iterations 358 * @delay: delay in seconds before first iteration 359 * @schedule: two scheduling plans. The first one is finite, the second one can 360 * be infinite. 361 * @channel_opt: channel optimization options, for full and partial scan 362 * @data: channel configuration and probe request packet. 363 */ 364 struct iwl_scan_req_lmac { 365 /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */ 366 __le32 reserved1; 367 u8 n_channels; 368 u8 active_dwell; 369 u8 passive_dwell; 370 u8 fragmented_dwell; 371 u8 extended_dwell; 372 u8 reserved2; 373 __le16 rx_chain_select; 374 __le32 scan_flags; 375 __le32 max_out_time; 376 __le32 suspend_time; 377 /* RX_ON_FLAGS_API_S_VER_1 */ 378 __le32 flags; 379 __le32 filter_flags; 380 struct iwl_scan_req_tx_cmd tx_cmd[2]; 381 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 382 __le32 scan_prio; 383 /* SCAN_REQ_PERIODIC_PARAMS_API_S */ 384 __le32 iter_num; 385 __le32 delay; 386 struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS]; 387 struct iwl_scan_channel_opt channel_opt[2]; 388 u8 data[]; 389 } __packed; 390 391 /** 392 * struct iwl_scan_results_notif - scan results for one channel - 393 * SCAN_RESULT_NTF_API_S_VER_3 394 * @channel: which channel the results are from 395 * @band: 0 for 5.2 GHz, 1 for 2.4 GHz 396 * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request 397 * @num_probe_not_sent: # of request that weren't sent due to not enough time 398 * @duration: duration spent in channel, in usecs 399 */ 400 struct iwl_scan_results_notif { 401 u8 channel; 402 u8 band; 403 u8 probe_status; 404 u8 num_probe_not_sent; 405 __le32 duration; 406 } __packed; 407 408 /** 409 * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels) 410 * SCAN_COMPLETE_NTF_API_S_VER_3 411 * @scanned_channels: number of channels scanned (and number of valid results) 412 * @status: one of SCAN_COMP_STATUS_* 413 * @bt_status: BT on/off status 414 * @last_channel: last channel that was scanned 415 * @tsf_low: TSF timer (lower half) in usecs 416 * @tsf_high: TSF timer (higher half) in usecs 417 * @results: an array of scan results, only "scanned_channels" of them are valid 418 */ 419 struct iwl_lmac_scan_complete_notif { 420 u8 scanned_channels; 421 u8 status; 422 u8 bt_status; 423 u8 last_channel; 424 __le32 tsf_low; 425 __le32 tsf_high; 426 struct iwl_scan_results_notif results[]; 427 } __packed; 428 429 /** 430 * struct iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2 431 * @last_schedule_line: last schedule line executed (fast or regular) 432 * @last_schedule_iteration: last scan iteration executed before scan abort 433 * @status: &enum iwl_scan_offload_complete_status 434 * @ebs_status: EBS success status &enum iwl_scan_ebs_status 435 * @time_after_last_iter: time in seconds elapsed after last iteration 436 * @reserved: reserved 437 */ 438 struct iwl_periodic_scan_complete { 439 u8 last_schedule_line; 440 u8 last_schedule_iteration; 441 u8 status; 442 u8 ebs_status; 443 __le32 time_after_last_iter; 444 __le32 reserved; 445 } __packed; 446 447 /* UMAC Scan API */ 448 449 /* The maximum of either of these cannot exceed 8, because we use an 450 * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h). 451 */ 452 #define IWL_MVM_MAX_UMAC_SCANS 4 453 #define IWL_MVM_MAX_LMAC_SCANS 1 454 455 enum scan_config_flags { 456 SCAN_CONFIG_FLAG_ACTIVATE = BIT(0), 457 SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1), 458 SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2), 459 SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3), 460 SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8), 461 SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9), 462 SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10), 463 SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11), 464 SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12), 465 SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13), 466 SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14), 467 SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15), 468 SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16), 469 SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17), 470 SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18), 471 SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19), 472 SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20), 473 SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21), 474 SCAN_CONFIG_FLAG_SET_LMAC2_FRAGMENTED = BIT(22), 475 SCAN_CONFIG_FLAG_CLEAR_LMAC2_FRAGMENTED = BIT(23), 476 477 /* Bits 26-31 are for num of channels in channel_array */ 478 #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26) 479 }; 480 481 enum scan_config_rates { 482 /* OFDM basic rates */ 483 SCAN_CONFIG_RATE_6M = BIT(0), 484 SCAN_CONFIG_RATE_9M = BIT(1), 485 SCAN_CONFIG_RATE_12M = BIT(2), 486 SCAN_CONFIG_RATE_18M = BIT(3), 487 SCAN_CONFIG_RATE_24M = BIT(4), 488 SCAN_CONFIG_RATE_36M = BIT(5), 489 SCAN_CONFIG_RATE_48M = BIT(6), 490 SCAN_CONFIG_RATE_54M = BIT(7), 491 /* CCK basic rates */ 492 SCAN_CONFIG_RATE_1M = BIT(8), 493 SCAN_CONFIG_RATE_2M = BIT(9), 494 SCAN_CONFIG_RATE_5M = BIT(10), 495 SCAN_CONFIG_RATE_11M = BIT(11), 496 497 /* Bits 16-27 are for supported rates */ 498 #define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16) 499 }; 500 501 enum iwl_channel_flags { 502 IWL_CHANNEL_FLAG_EBS = BIT(0), 503 IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1), 504 IWL_CHANNEL_FLAG_EBS_ADD = BIT(2), 505 IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3), 506 }; 507 508 /** 509 * struct iwl_scan_dwell 510 * @active: default dwell time for active scan 511 * @passive: default dwell time for passive scan 512 * @fragmented: default dwell time for fragmented scan 513 * @extended: default dwell time for channels 1, 6 and 11 514 */ 515 struct iwl_scan_dwell { 516 u8 active; 517 u8 passive; 518 u8 fragmented; 519 u8 extended; 520 } __packed; 521 522 /** 523 * struct iwl_scan_config 524 * @flags: enum scan_config_flags 525 * @tx_chains: valid_tx antenna - ANT_* definitions 526 * @rx_chains: valid_rx antenna - ANT_* definitions 527 * @legacy_rates: default legacy rates - enum scan_config_rates 528 * @out_of_channel_time: default max out of serving channel time 529 * @suspend_time: default max suspend time 530 * @dwell: dwells for the scan 531 * @mac_addr: default mac address to be used in probes 532 * @bcast_sta_id: the index of the station in the fw 533 * @channel_flags: default channel flags - enum iwl_channel_flags 534 * scan_config_channel_flag 535 * @channel_array: default supported channels 536 */ 537 struct iwl_scan_config_v1 { 538 __le32 flags; 539 __le32 tx_chains; 540 __le32 rx_chains; 541 __le32 legacy_rates; 542 __le32 out_of_channel_time; 543 __le32 suspend_time; 544 struct iwl_scan_dwell dwell; 545 u8 mac_addr[ETH_ALEN]; 546 u8 bcast_sta_id; 547 u8 channel_flags; 548 u8 channel_array[]; 549 } __packed; /* SCAN_CONFIG_DB_CMD_API_S */ 550 551 #define SCAN_TWO_LMACS 2 552 #define SCAN_LB_LMAC_IDX 0 553 #define SCAN_HB_LMAC_IDX 1 554 555 struct iwl_scan_config { 556 __le32 flags; 557 __le32 tx_chains; 558 __le32 rx_chains; 559 __le32 legacy_rates; 560 __le32 out_of_channel_time[SCAN_TWO_LMACS]; 561 __le32 suspend_time[SCAN_TWO_LMACS]; 562 struct iwl_scan_dwell dwell; 563 u8 mac_addr[ETH_ALEN]; 564 u8 bcast_sta_id; 565 u8 channel_flags; 566 u8 channel_array[]; 567 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */ 568 569 /** 570 * enum iwl_umac_scan_flags - UMAC scan flags 571 * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request 572 * can be preempted by other scan requests with higher priority. 573 * The low priority scan will be resumed when the higher proirity scan is 574 * completed. 575 * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver 576 * when scan starts. 577 */ 578 enum iwl_umac_scan_flags { 579 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0), 580 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1), 581 }; 582 583 enum iwl_umac_scan_uid_offsets { 584 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0, 585 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8, 586 }; 587 588 enum iwl_umac_scan_general_flags { 589 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0), 590 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1), 591 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2), 592 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3), 593 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4), 594 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5), 595 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6), 596 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7), 597 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8), 598 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9), 599 IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = BIT(10), 600 /* Extended dwell is obselete when adaptive dwell is used, making this 601 * bit reusable. Hence, probe request defer is used only when adaptive 602 * dwell is supported. */ 603 IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP = BIT(10), 604 IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED = BIT(11), 605 IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL = BIT(13), 606 IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME = BIT(14), 607 IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE = BIT(15), 608 }; 609 610 /** 611 * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2 612 * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete 613 * notification per channel or not. 614 * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel 615 * reorder optimization or not. 616 */ 617 enum iwl_umac_scan_general_flags2 { 618 IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL = BIT(0), 619 IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER = BIT(1), 620 }; 621 622 /** 623 * struct iwl_scan_channel_cfg_umac 624 * @flags: bitmap - 0-19: directed scan to i'th ssid. 625 * @channel_num: channel number 1-13 etc. 626 * @band: band of channel: 0 for 2GHz, 1 for 5GHz 627 * @iter_count: repetition count for the channel. 628 * @iter_interval: interval between two scan iterations on one channel. 629 */ 630 struct iwl_scan_channel_cfg_umac { 631 __le32 flags; 632 /* Both versions are of the same size, so use a union without adjusting 633 * the command size later 634 */ 635 union { 636 struct { 637 u8 channel_num; 638 u8 iter_count; 639 __le16 iter_interval; 640 } v1; /* SCAN_CHANNEL_CFG_S_VER1 */ 641 struct { 642 u8 channel_num; 643 u8 band; 644 u8 iter_count; 645 u8 iter_interval; 646 } v2; /* SCAN_CHANNEL_CFG_S_VER2 */ 647 }; 648 } __packed; 649 650 /** 651 * struct iwl_scan_umac_schedule 652 * @interval: interval in seconds between scan iterations 653 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop 654 * @reserved: for alignment and future use 655 */ 656 struct iwl_scan_umac_schedule { 657 __le16 interval; 658 u8 iter_count; 659 u8 reserved; 660 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */ 661 662 struct iwl_scan_req_umac_tail_v1 { 663 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */ 664 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS]; 665 __le16 delay; 666 __le16 reserved; 667 /* SCAN_PROBE_PARAMS_API_S_VER_1 */ 668 struct iwl_scan_probe_req_v1 preq; 669 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 670 } __packed; 671 672 /** 673 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command 674 * parameters following channels configuration array. 675 * @schedule: two scheduling plans. 676 * @delay: delay in TUs before starting the first scan iteration 677 * @reserved: for future use and alignment 678 * @preq: probe request with IEs blocks 679 * @direct_scan: list of SSIDs for directed active scan 680 */ 681 struct iwl_scan_req_umac_tail_v2 { 682 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */ 683 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS]; 684 __le16 delay; 685 __le16 reserved; 686 /* SCAN_PROBE_PARAMS_API_S_VER_2 */ 687 struct iwl_scan_probe_req preq; 688 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 689 } __packed; 690 691 /** 692 * struct iwl_scan_umac_chan_param 693 * @flags: channel flags &enum iwl_scan_channel_flags 694 * @count: num of channels in scan request 695 * @reserved: for future use and alignment 696 */ 697 struct iwl_scan_umac_chan_param { 698 u8 flags; 699 u8 count; 700 __le16 reserved; 701 } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */ 702 703 /** 704 * struct iwl_scan_req_umac 705 * @flags: &enum iwl_umac_scan_flags 706 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 707 * @ooc_priority: out of channel priority - &enum iwl_scan_priority 708 * @general_flags: &enum iwl_umac_scan_general_flags 709 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF 710 * @extended_dwell: dwell time for channels 1, 6 and 11 711 * @active_dwell: dwell time for active scan per LMAC 712 * @passive_dwell: dwell time for passive scan per LMAC 713 * @fragmented_dwell: dwell time for fragmented passive scan 714 * @adwell_default_n_aps: for adaptive dwell the default number of APs 715 * per channel 716 * @adwell_default_n_aps_social: for adaptive dwell the default 717 * number of APs per social (1,6,11) channel 718 * @general_flags2: &enum iwl_umac_scan_general_flags2 719 * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added 720 * to total scan time 721 * @max_out_time: max out of serving channel time, per LMAC - for CDB there 722 * are 2 LMACs 723 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs 724 * @scan_priority: scan internal prioritization &enum iwl_scan_priority 725 * @num_of_fragments: Number of fragments needed for full coverage per band. 726 * Relevant only for fragmented scan. 727 * @channel: &struct iwl_scan_umac_chan_param 728 * @reserved: for future use and alignment 729 * @reserved3: for future use and alignment 730 * @data: &struct iwl_scan_channel_cfg_umac and 731 * &struct iwl_scan_req_umac_tail 732 */ 733 struct iwl_scan_req_umac { 734 __le32 flags; 735 __le32 uid; 736 __le32 ooc_priority; 737 __le16 general_flags; 738 u8 reserved; 739 u8 scan_start_mac_id; 740 union { 741 struct { 742 u8 extended_dwell; 743 u8 active_dwell; 744 u8 passive_dwell; 745 u8 fragmented_dwell; 746 __le32 max_out_time; 747 __le32 suspend_time; 748 __le32 scan_priority; 749 struct iwl_scan_umac_chan_param channel; 750 u8 data[]; 751 } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */ 752 struct { 753 u8 extended_dwell; 754 u8 active_dwell; 755 u8 passive_dwell; 756 u8 fragmented_dwell; 757 __le32 max_out_time[SCAN_TWO_LMACS]; 758 __le32 suspend_time[SCAN_TWO_LMACS]; 759 __le32 scan_priority; 760 struct iwl_scan_umac_chan_param channel; 761 u8 data[]; 762 } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */ 763 struct { 764 u8 active_dwell; 765 u8 passive_dwell; 766 u8 fragmented_dwell; 767 u8 adwell_default_n_aps; 768 u8 adwell_default_n_aps_social; 769 u8 reserved3; 770 __le16 adwell_max_budget; 771 __le32 max_out_time[SCAN_TWO_LMACS]; 772 __le32 suspend_time[SCAN_TWO_LMACS]; 773 __le32 scan_priority; 774 struct iwl_scan_umac_chan_param channel; 775 u8 data[]; 776 } v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */ 777 struct { 778 u8 active_dwell[SCAN_TWO_LMACS]; 779 u8 reserved2; 780 u8 adwell_default_n_aps; 781 u8 adwell_default_n_aps_social; 782 u8 general_flags2; 783 __le16 adwell_max_budget; 784 __le32 max_out_time[SCAN_TWO_LMACS]; 785 __le32 suspend_time[SCAN_TWO_LMACS]; 786 __le32 scan_priority; 787 u8 passive_dwell[SCAN_TWO_LMACS]; 788 u8 num_of_fragments[SCAN_TWO_LMACS]; 789 struct iwl_scan_umac_chan_param channel; 790 u8 data[]; 791 } v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */ 792 struct { 793 u8 active_dwell[SCAN_TWO_LMACS]; 794 u8 adwell_default_hb_n_aps; 795 u8 adwell_default_lb_n_aps; 796 u8 adwell_default_n_aps_social; 797 u8 general_flags2; 798 __le16 adwell_max_budget; 799 __le32 max_out_time[SCAN_TWO_LMACS]; 800 __le32 suspend_time[SCAN_TWO_LMACS]; 801 __le32 scan_priority; 802 u8 passive_dwell[SCAN_TWO_LMACS]; 803 u8 num_of_fragments[SCAN_TWO_LMACS]; 804 struct iwl_scan_umac_chan_param channel; 805 u8 data[]; 806 } v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */ 807 }; 808 } __packed; 809 810 #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac) 811 #define IWL_SCAN_REQ_UMAC_SIZE_V7 48 812 #define IWL_SCAN_REQ_UMAC_SIZE_V6 44 813 #define IWL_SCAN_REQ_UMAC_SIZE_V1 36 814 815 /** 816 * struct iwl_umac_scan_abort 817 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 818 * @flags: reserved 819 */ 820 struct iwl_umac_scan_abort { 821 __le32 uid; 822 __le32 flags; 823 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */ 824 825 /** 826 * struct iwl_umac_scan_complete 827 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 828 * @last_schedule: last scheduling line 829 * @last_iter: last scan iteration number 830 * @status: &enum iwl_scan_offload_complete_status 831 * @ebs_status: &enum iwl_scan_ebs_status 832 * @time_from_last_iter: time elapsed from last iteration 833 * @reserved: for future use 834 */ 835 struct iwl_umac_scan_complete { 836 __le32 uid; 837 u8 last_schedule; 838 u8 last_iter; 839 u8 status; 840 u8 ebs_status; 841 __le32 time_from_last_iter; 842 __le32 reserved; 843 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */ 844 845 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5 846 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 7 847 848 /** 849 * struct iwl_scan_offload_profile_match_v1 - match information 850 * @bssid: matched bssid 851 * @reserved: reserved 852 * @channel: channel where the match occurred 853 * @energy: energy 854 * @matching_feature: feature matches 855 * @matching_channels: bitmap of channels that matched, referencing 856 * the channels passed in the scan offload request. 857 */ 858 struct iwl_scan_offload_profile_match_v1 { 859 u8 bssid[ETH_ALEN]; 860 __le16 reserved; 861 u8 channel; 862 u8 energy; 863 u8 matching_feature; 864 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1]; 865 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */ 866 867 /** 868 * struct iwl_scan_offload_profiles_query_v1 - match results query response 869 * @matched_profiles: bitmap of matched profiles, referencing the 870 * matches passed in the scan offload request 871 * @last_scan_age: age of the last offloaded scan 872 * @n_scans_done: number of offloaded scans done 873 * @gp2_d0u: GP2 when D0U occurred 874 * @gp2_invoked: GP2 when scan offload was invoked 875 * @resume_while_scanning: not used 876 * @self_recovery: obsolete 877 * @reserved: reserved 878 * @matches: array of match information, one for each match 879 */ 880 struct iwl_scan_offload_profiles_query_v1 { 881 __le32 matched_profiles; 882 __le32 last_scan_age; 883 __le32 n_scans_done; 884 __le32 gp2_d0u; 885 __le32 gp2_invoked; 886 u8 resume_while_scanning; 887 u8 self_recovery; 888 __le16 reserved; 889 struct iwl_scan_offload_profile_match_v1 matches[IWL_SCAN_MAX_PROFILES]; 890 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */ 891 892 /** 893 * struct iwl_scan_offload_profile_match - match information 894 * @bssid: matched bssid 895 * @reserved: reserved 896 * @channel: channel where the match occurred 897 * @energy: energy 898 * @matching_feature: feature matches 899 * @matching_channels: bitmap of channels that matched, referencing 900 * the channels passed in the scan offload request. 901 */ 902 struct iwl_scan_offload_profile_match { 903 u8 bssid[ETH_ALEN]; 904 __le16 reserved; 905 u8 channel; 906 u8 energy; 907 u8 matching_feature; 908 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN]; 909 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */ 910 911 /** 912 * struct iwl_scan_offload_profiles_query - match results query response 913 * @matched_profiles: bitmap of matched profiles, referencing the 914 * matches passed in the scan offload request 915 * @last_scan_age: age of the last offloaded scan 916 * @n_scans_done: number of offloaded scans done 917 * @gp2_d0u: GP2 when D0U occurred 918 * @gp2_invoked: GP2 when scan offload was invoked 919 * @resume_while_scanning: not used 920 * @self_recovery: obsolete 921 * @reserved: reserved 922 * @matches: array of match information, one for each match 923 */ 924 struct iwl_scan_offload_profiles_query { 925 __le32 matched_profiles; 926 __le32 last_scan_age; 927 __le32 n_scans_done; 928 __le32 gp2_d0u; 929 __le32 gp2_invoked; 930 u8 resume_while_scanning; 931 u8 self_recovery; 932 __le16 reserved; 933 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES]; 934 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 */ 935 936 /** 937 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration 938 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 939 * @scanned_channels: number of channels scanned and number of valid elements in 940 * results array 941 * @status: one of SCAN_COMP_STATUS_* 942 * @bt_status: BT on/off status 943 * @last_channel: last channel that was scanned 944 * @start_tsf: TSF timer in usecs of the scan start time for the mac specified 945 * in &struct iwl_scan_req_umac. 946 * @results: array of scan results, length in @scanned_channels 947 */ 948 struct iwl_umac_scan_iter_complete_notif { 949 __le32 uid; 950 u8 scanned_channels; 951 u8 status; 952 u8 bt_status; 953 u8 last_channel; 954 __le64 start_tsf; 955 struct iwl_scan_results_notif results[]; 956 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */ 957 958 #endif /* __iwl_fw_api_scan_h__ */ 959