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_v1 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_v2 { 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_2 */ 568 569 /** 570 * struct iwl_scan_config 571 * @enable_cam_mode: whether to enable CAM mode. 572 * @enable_promiscouos_mode: whether to enable promiscouos mode 573 * @bcast_sta_id: the index of the station in the fw 574 * @reserved: reserved 575 * @tx_chains: valid_tx antenna - ANT_* definitions 576 * @rx_chains: valid_rx antenna - ANT_* definitions 577 */ 578 struct iwl_scan_config { 579 u8 enable_cam_mode; 580 u8 enable_promiscouos_mode; 581 u8 bcast_sta_id; 582 u8 reserved; 583 __le32 tx_chains; 584 __le32 rx_chains; 585 } __packed; /* SCAN_CONFIG_DB_CMD_API_S_3 */ 586 587 /** 588 * enum iwl_umac_scan_flags - UMAC scan flags 589 * @IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request 590 * can be preempted by other scan requests with higher priority. 591 * The low priority scan will be resumed when the higher proirity scan is 592 * completed. 593 * @IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver 594 * when scan starts. 595 */ 596 enum iwl_umac_scan_flags { 597 IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0), 598 IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1), 599 }; 600 601 enum iwl_umac_scan_uid_offsets { 602 IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0, 603 IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8, 604 }; 605 606 enum iwl_umac_scan_general_flags { 607 IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0), 608 IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1), 609 IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2), 610 IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3), 611 IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4), 612 IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5), 613 IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6), 614 IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7), 615 IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8), 616 IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9), 617 IWL_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL = BIT(10), 618 /* Extended dwell is obselete when adaptive dwell is used, making this 619 * bit reusable. Hence, probe request defer is used only when adaptive 620 * dwell is supported. */ 621 IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_DEFER_SUPP = BIT(10), 622 IWL_UMAC_SCAN_GEN_FLAGS_LMAC2_FRAGMENTED = BIT(11), 623 IWL_UMAC_SCAN_GEN_FLAGS_ADAPTIVE_DWELL = BIT(13), 624 IWL_UMAC_SCAN_GEN_FLAGS_MAX_CHNL_TIME = BIT(14), 625 IWL_UMAC_SCAN_GEN_FLAGS_PROB_REQ_HIGH_TX_RATE = BIT(15), 626 }; 627 628 /** 629 * enum iwl_umac_scan_general_flags2 - UMAC scan general flags #2 630 * @IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL: Whether to send a complete 631 * notification per channel or not. 632 * @IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER: Whether to allow channel 633 * reorder optimization or not. 634 */ 635 enum iwl_umac_scan_general_flags2 { 636 IWL_UMAC_SCAN_GEN_FLAGS2_NOTIF_PER_CHNL = BIT(0), 637 IWL_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER = BIT(1), 638 }; 639 640 /** 641 * struct iwl_scan_channel_cfg_umac 642 * @flags: bitmap - 0-19: directed scan to i'th ssid. 643 * @channel_num: channel number 1-13 etc. 644 * @band: band of channel: 0 for 2GHz, 1 for 5GHz 645 * @iter_count: repetition count for the channel. 646 * @iter_interval: interval between two scan iterations on one channel. 647 */ 648 struct iwl_scan_channel_cfg_umac { 649 __le32 flags; 650 /* Both versions are of the same size, so use a union without adjusting 651 * the command size later 652 */ 653 union { 654 struct { 655 u8 channel_num; 656 u8 iter_count; 657 __le16 iter_interval; 658 } v1; /* SCAN_CHANNEL_CFG_S_VER1 */ 659 struct { 660 u8 channel_num; 661 u8 band; 662 u8 iter_count; 663 u8 iter_interval; 664 } v2; /* SCAN_CHANNEL_CFG_S_VER2 */ 665 }; 666 } __packed; 667 668 /** 669 * struct iwl_scan_umac_schedule 670 * @interval: interval in seconds between scan iterations 671 * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop 672 * @reserved: for alignment and future use 673 */ 674 struct iwl_scan_umac_schedule { 675 __le16 interval; 676 u8 iter_count; 677 u8 reserved; 678 } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */ 679 680 struct iwl_scan_req_umac_tail_v1 { 681 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */ 682 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS]; 683 __le16 delay; 684 __le16 reserved; 685 /* SCAN_PROBE_PARAMS_API_S_VER_1 */ 686 struct iwl_scan_probe_req_v1 preq; 687 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 688 } __packed; 689 690 /** 691 * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command 692 * parameters following channels configuration array. 693 * @schedule: two scheduling plans. 694 * @delay: delay in TUs before starting the first scan iteration 695 * @reserved: for future use and alignment 696 * @preq: probe request with IEs blocks 697 * @direct_scan: list of SSIDs for directed active scan 698 */ 699 struct iwl_scan_req_umac_tail_v2 { 700 /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */ 701 struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS]; 702 __le16 delay; 703 __le16 reserved; 704 /* SCAN_PROBE_PARAMS_API_S_VER_2 */ 705 struct iwl_scan_probe_req preq; 706 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; 707 } __packed; 708 709 /** 710 * struct iwl_scan_umac_chan_param 711 * @flags: channel flags &enum iwl_scan_channel_flags 712 * @count: num of channels in scan request 713 * @reserved: for future use and alignment 714 */ 715 struct iwl_scan_umac_chan_param { 716 u8 flags; 717 u8 count; 718 __le16 reserved; 719 } __packed; /*SCAN_CHANNEL_PARAMS_API_S_VER_1 */ 720 721 /** 722 * struct iwl_scan_req_umac 723 * @flags: &enum iwl_umac_scan_flags 724 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 725 * @ooc_priority: out of channel priority - &enum iwl_scan_priority 726 * @general_flags: &enum iwl_umac_scan_general_flags 727 * @scan_start_mac_id: report the scan start TSF time according to this mac TSF 728 * @extended_dwell: dwell time for channels 1, 6 and 11 729 * @active_dwell: dwell time for active scan per LMAC 730 * @passive_dwell: dwell time for passive scan per LMAC 731 * @fragmented_dwell: dwell time for fragmented passive scan 732 * @adwell_default_n_aps: for adaptive dwell the default number of APs 733 * per channel 734 * @adwell_default_n_aps_social: for adaptive dwell the default 735 * number of APs per social (1,6,11) channel 736 * @general_flags2: &enum iwl_umac_scan_general_flags2 737 * @adwell_max_budget: for adaptive dwell the maximal budget of TU to be added 738 * to total scan time 739 * @max_out_time: max out of serving channel time, per LMAC - for CDB there 740 * are 2 LMACs 741 * @suspend_time: max suspend time, per LMAC - for CDB there are 2 LMACs 742 * @scan_priority: scan internal prioritization &enum iwl_scan_priority 743 * @num_of_fragments: Number of fragments needed for full coverage per band. 744 * Relevant only for fragmented scan. 745 * @channel: &struct iwl_scan_umac_chan_param 746 * @reserved: for future use and alignment 747 * @reserved3: for future use and alignment 748 * @data: &struct iwl_scan_channel_cfg_umac and 749 * &struct iwl_scan_req_umac_tail 750 */ 751 struct iwl_scan_req_umac { 752 __le32 flags; 753 __le32 uid; 754 __le32 ooc_priority; 755 __le16 general_flags; 756 u8 reserved; 757 u8 scan_start_mac_id; 758 union { 759 struct { 760 u8 extended_dwell; 761 u8 active_dwell; 762 u8 passive_dwell; 763 u8 fragmented_dwell; 764 __le32 max_out_time; 765 __le32 suspend_time; 766 __le32 scan_priority; 767 struct iwl_scan_umac_chan_param channel; 768 u8 data[]; 769 } v1; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */ 770 struct { 771 u8 extended_dwell; 772 u8 active_dwell; 773 u8 passive_dwell; 774 u8 fragmented_dwell; 775 __le32 max_out_time[SCAN_TWO_LMACS]; 776 __le32 suspend_time[SCAN_TWO_LMACS]; 777 __le32 scan_priority; 778 struct iwl_scan_umac_chan_param channel; 779 u8 data[]; 780 } v6; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_6 */ 781 struct { 782 u8 active_dwell; 783 u8 passive_dwell; 784 u8 fragmented_dwell; 785 u8 adwell_default_n_aps; 786 u8 adwell_default_n_aps_social; 787 u8 reserved3; 788 __le16 adwell_max_budget; 789 __le32 max_out_time[SCAN_TWO_LMACS]; 790 __le32 suspend_time[SCAN_TWO_LMACS]; 791 __le32 scan_priority; 792 struct iwl_scan_umac_chan_param channel; 793 u8 data[]; 794 } v7; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_7 */ 795 struct { 796 u8 active_dwell[SCAN_TWO_LMACS]; 797 u8 reserved2; 798 u8 adwell_default_n_aps; 799 u8 adwell_default_n_aps_social; 800 u8 general_flags2; 801 __le16 adwell_max_budget; 802 __le32 max_out_time[SCAN_TWO_LMACS]; 803 __le32 suspend_time[SCAN_TWO_LMACS]; 804 __le32 scan_priority; 805 u8 passive_dwell[SCAN_TWO_LMACS]; 806 u8 num_of_fragments[SCAN_TWO_LMACS]; 807 struct iwl_scan_umac_chan_param channel; 808 u8 data[]; 809 } v8; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_8 */ 810 struct { 811 u8 active_dwell[SCAN_TWO_LMACS]; 812 u8 adwell_default_hb_n_aps; 813 u8 adwell_default_lb_n_aps; 814 u8 adwell_default_n_aps_social; 815 u8 general_flags2; 816 __le16 adwell_max_budget; 817 __le32 max_out_time[SCAN_TWO_LMACS]; 818 __le32 suspend_time[SCAN_TWO_LMACS]; 819 __le32 scan_priority; 820 u8 passive_dwell[SCAN_TWO_LMACS]; 821 u8 num_of_fragments[SCAN_TWO_LMACS]; 822 struct iwl_scan_umac_chan_param channel; 823 u8 data[]; 824 } v9; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_9 */ 825 }; 826 } __packed; 827 828 #define IWL_SCAN_REQ_UMAC_SIZE_V8 sizeof(struct iwl_scan_req_umac) 829 #define IWL_SCAN_REQ_UMAC_SIZE_V7 48 830 #define IWL_SCAN_REQ_UMAC_SIZE_V6 44 831 #define IWL_SCAN_REQ_UMAC_SIZE_V1 36 832 833 /** 834 * struct iwl_umac_scan_abort 835 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 836 * @flags: reserved 837 */ 838 struct iwl_umac_scan_abort { 839 __le32 uid; 840 __le32 flags; 841 } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */ 842 843 /** 844 * struct iwl_umac_scan_complete 845 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 846 * @last_schedule: last scheduling line 847 * @last_iter: last scan iteration number 848 * @status: &enum iwl_scan_offload_complete_status 849 * @ebs_status: &enum iwl_scan_ebs_status 850 * @time_from_last_iter: time elapsed from last iteration 851 * @reserved: for future use 852 */ 853 struct iwl_umac_scan_complete { 854 __le32 uid; 855 u8 last_schedule; 856 u8 last_iter; 857 u8 status; 858 u8 ebs_status; 859 __le32 time_from_last_iter; 860 __le32 reserved; 861 } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */ 862 863 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1 5 864 #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 7 865 866 /** 867 * struct iwl_scan_offload_profile_match_v1 - match information 868 * @bssid: matched bssid 869 * @reserved: reserved 870 * @channel: channel where the match occurred 871 * @energy: energy 872 * @matching_feature: feature matches 873 * @matching_channels: bitmap of channels that matched, referencing 874 * the channels passed in the scan offload request. 875 */ 876 struct iwl_scan_offload_profile_match_v1 { 877 u8 bssid[ETH_ALEN]; 878 __le16 reserved; 879 u8 channel; 880 u8 energy; 881 u8 matching_feature; 882 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN_V1]; 883 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */ 884 885 /** 886 * struct iwl_scan_offload_profiles_query_v1 - match results query response 887 * @matched_profiles: bitmap of matched profiles, referencing the 888 * matches passed in the scan offload request 889 * @last_scan_age: age of the last offloaded scan 890 * @n_scans_done: number of offloaded scans done 891 * @gp2_d0u: GP2 when D0U occurred 892 * @gp2_invoked: GP2 when scan offload was invoked 893 * @resume_while_scanning: not used 894 * @self_recovery: obsolete 895 * @reserved: reserved 896 * @matches: array of match information, one for each match 897 */ 898 struct iwl_scan_offload_profiles_query_v1 { 899 __le32 matched_profiles; 900 __le32 last_scan_age; 901 __le32 n_scans_done; 902 __le32 gp2_d0u; 903 __le32 gp2_invoked; 904 u8 resume_while_scanning; 905 u8 self_recovery; 906 __le16 reserved; 907 struct iwl_scan_offload_profile_match_v1 matches[IWL_SCAN_MAX_PROFILES]; 908 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */ 909 910 /** 911 * struct iwl_scan_offload_profile_match - match information 912 * @bssid: matched bssid 913 * @reserved: reserved 914 * @channel: channel where the match occurred 915 * @energy: energy 916 * @matching_feature: feature matches 917 * @matching_channels: bitmap of channels that matched, referencing 918 * the channels passed in the scan offload request. 919 */ 920 struct iwl_scan_offload_profile_match { 921 u8 bssid[ETH_ALEN]; 922 __le16 reserved; 923 u8 channel; 924 u8 energy; 925 u8 matching_feature; 926 u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN]; 927 } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_2 */ 928 929 /** 930 * struct iwl_scan_offload_profiles_query - match results query response 931 * @matched_profiles: bitmap of matched profiles, referencing the 932 * matches passed in the scan offload request 933 * @last_scan_age: age of the last offloaded scan 934 * @n_scans_done: number of offloaded scans done 935 * @gp2_d0u: GP2 when D0U occurred 936 * @gp2_invoked: GP2 when scan offload was invoked 937 * @resume_while_scanning: not used 938 * @self_recovery: obsolete 939 * @reserved: reserved 940 * @matches: array of match information, one for each match 941 */ 942 struct iwl_scan_offload_profiles_query { 943 __le32 matched_profiles; 944 __le32 last_scan_age; 945 __le32 n_scans_done; 946 __le32 gp2_d0u; 947 __le32 gp2_invoked; 948 u8 resume_while_scanning; 949 u8 self_recovery; 950 __le16 reserved; 951 struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES]; 952 } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_3 */ 953 954 /** 955 * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration 956 * @uid: scan id, &enum iwl_umac_scan_uid_offsets 957 * @scanned_channels: number of channels scanned and number of valid elements in 958 * results array 959 * @status: one of SCAN_COMP_STATUS_* 960 * @bt_status: BT on/off status 961 * @last_channel: last channel that was scanned 962 * @start_tsf: TSF timer in usecs of the scan start time for the mac specified 963 * in &struct iwl_scan_req_umac. 964 * @results: array of scan results, length in @scanned_channels 965 */ 966 struct iwl_umac_scan_iter_complete_notif { 967 __le32 uid; 968 u8 scanned_channels; 969 u8 status; 970 u8 bt_status; 971 u8 last_channel; 972 __le64 start_tsf; 973 struct iwl_scan_results_notif results[]; 974 } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_2 */ 975 976 #endif /* __iwl_fw_api_scan_h__ */