Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 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 | * |
Emmanuel Grumbach | 51368bf | 2013-12-30 13:15:54 +0200 | [diff] [blame] | 8 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 9 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of version 2 of the GNU General Public License as |
| 13 | * published by the Free Software Foundation. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, but |
| 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 23 | * USA |
| 24 | * |
| 25 | * The full GNU General Public License is included in this distribution |
Emmanuel Grumbach | 410dc5a | 2013-02-18 09:22:28 +0200 | [diff] [blame] | 26 | * in the file called COPYING. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 27 | * |
| 28 | * Contact Information: |
| 29 | * Intel Linux Wireless <ilw@linux.intel.com> |
| 30 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 31 | * |
| 32 | * BSD LICENSE |
| 33 | * |
Emmanuel Grumbach | 51368bf | 2013-12-30 13:15:54 +0200 | [diff] [blame] | 34 | * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved. |
Johannes Berg | 8b4139d | 2014-07-24 14:05:26 +0200 | [diff] [blame] | 35 | * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 36 | * All rights reserved. |
| 37 | * |
| 38 | * Redistribution and use in source and binary forms, with or without |
| 39 | * modification, are permitted provided that the following conditions |
| 40 | * are met: |
| 41 | * |
| 42 | * * Redistributions of source code must retain the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer. |
| 44 | * * Redistributions in binary form must reproduce the above copyright |
| 45 | * notice, this list of conditions and the following disclaimer in |
| 46 | * the documentation and/or other materials provided with the |
| 47 | * distribution. |
| 48 | * * Neither the name Intel Corporation nor the names of its |
| 49 | * contributors may be used to endorse or promote products derived |
| 50 | * from this software without specific prior written permission. |
| 51 | * |
| 52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 53 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 54 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 55 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 56 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 57 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 58 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 59 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 60 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 61 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 62 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 63 | * |
| 64 | *****************************************************************************/ |
| 65 | |
| 66 | #ifndef __fw_api_scan_h__ |
| 67 | #define __fw_api_scan_h__ |
| 68 | |
| 69 | #include "fw-api.h" |
| 70 | |
| 71 | /* Scan Commands, Responses, Notifications */ |
| 72 | |
| 73 | /* Masks for iwl_scan_channel.type flags */ |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 74 | #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0) |
| 75 | #define SCAN_CHANNEL_NARROW_BAND BIT(22) |
| 76 | |
| 77 | /* Max number of IEs for direct SSID scans in a command */ |
| 78 | #define PROBE_OPTION_MAX 20 |
| 79 | |
| 80 | /** |
| 81 | * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table |
| 82 | * @channel: band is selected by iwl_scan_cmd "flags" field |
| 83 | * @tx_gain: gain for analog radio |
| 84 | * @dsp_atten: gain for DSP |
| 85 | * @active_dwell: dwell time for active scan in TU, typically 5-50 |
| 86 | * @passive_dwell: dwell time for passive scan in TU, typically 20-500 |
| 87 | * @type: type is broken down to these bits: |
| 88 | * bit 0: 0 = passive, 1 = active |
| 89 | * bits 1-20: SSID direct bit map. If any of these bits is set then |
| 90 | * the corresponding SSID IE is transmitted in probe request |
| 91 | * (bit i adds IE in position i to the probe request) |
| 92 | * bit 22: channel width, 0 = regular, 1 = TGj narrow channel |
| 93 | * |
| 94 | * @iteration_count: |
| 95 | * @iteration_interval: |
| 96 | * This struct is used once for each channel in the scan list. |
| 97 | * Each channel can independently select: |
| 98 | * 1) SSID for directed active scans |
| 99 | * 2) Txpower setting (for rate specified within Tx command) |
| 100 | * 3) How long to stay on-channel (behavior may be modified by quiet_time, |
| 101 | * quiet_plcp_th, good_CRC_th) |
| 102 | * |
| 103 | * To avoid uCode errors, make sure the following are true (see comments |
| 104 | * under struct iwl_scan_cmd about max_out_time and quiet_time): |
| 105 | * 1) If using passive_dwell (i.e. passive_dwell != 0): |
| 106 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) |
| 107 | * 2) quiet_time <= active_dwell |
| 108 | * 3) If restricting off-channel time (i.e. max_out_time !=0): |
| 109 | * passive_dwell < max_out_time |
| 110 | * active_dwell < max_out_time |
| 111 | */ |
| 112 | struct iwl_scan_channel { |
| 113 | __le32 type; |
| 114 | __le16 channel; |
| 115 | __le16 iteration_count; |
| 116 | __le32 iteration_interval; |
| 117 | __le16 active_dwell; |
| 118 | __le16 passive_dwell; |
| 119 | } __packed; /* SCAN_CHANNEL_CONTROL_API_S_VER_1 */ |
| 120 | |
| 121 | /** |
| 122 | * struct iwl_ssid_ie - directed scan network information element |
| 123 | * |
| 124 | * Up to 20 of these may appear in REPLY_SCAN_CMD, |
| 125 | * selected by "type" bit field in struct iwl_scan_channel; |
| 126 | * each channel may select different ssids from among the 20 entries. |
| 127 | * SSID IEs get transmitted in reverse order of entry. |
| 128 | */ |
| 129 | struct iwl_ssid_ie { |
| 130 | u8 id; |
| 131 | u8 len; |
| 132 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 133 | } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */ |
| 134 | |
| 135 | /** |
| 136 | * iwl_scan_flags - masks for scan command flags |
| 137 | *@SCAN_FLAGS_PERIODIC_SCAN: |
| 138 | *@SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX: |
| 139 | *@SCAN_FLAGS_DELAYED_SCAN_LOWBAND: |
| 140 | *@SCAN_FLAGS_DELAYED_SCAN_HIGHBAND: |
| 141 | *@SCAN_FLAGS_FRAGMENTED_SCAN: |
David Spinadel | 26e05cc | 2013-07-08 13:12:29 +0300 | [diff] [blame] | 142 | *@SCAN_FLAGS_PASSIVE2ACTIVE: use active scan on channels that was active |
| 143 | * in the past hour, even if they are marked as passive. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 144 | */ |
| 145 | enum iwl_scan_flags { |
| 146 | SCAN_FLAGS_PERIODIC_SCAN = BIT(0), |
| 147 | SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX = BIT(1), |
| 148 | SCAN_FLAGS_DELAYED_SCAN_LOWBAND = BIT(2), |
| 149 | SCAN_FLAGS_DELAYED_SCAN_HIGHBAND = BIT(3), |
| 150 | SCAN_FLAGS_FRAGMENTED_SCAN = BIT(4), |
David Spinadel | 26e05cc | 2013-07-08 13:12:29 +0300 | [diff] [blame] | 151 | SCAN_FLAGS_PASSIVE2ACTIVE = BIT(5), |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 152 | }; |
| 153 | |
| 154 | /** |
| 155 | * enum iwl_scan_type - Scan types for scan command |
| 156 | * @SCAN_TYPE_FORCED: |
| 157 | * @SCAN_TYPE_BACKGROUND: |
| 158 | * @SCAN_TYPE_OS: |
| 159 | * @SCAN_TYPE_ROAMING: |
| 160 | * @SCAN_TYPE_ACTION: |
| 161 | * @SCAN_TYPE_DISCOVERY: |
| 162 | * @SCAN_TYPE_DISCOVERY_FORCED: |
| 163 | */ |
| 164 | enum iwl_scan_type { |
| 165 | SCAN_TYPE_FORCED = 0, |
| 166 | SCAN_TYPE_BACKGROUND = 1, |
| 167 | SCAN_TYPE_OS = 2, |
| 168 | SCAN_TYPE_ROAMING = 3, |
| 169 | SCAN_TYPE_ACTION = 4, |
| 170 | SCAN_TYPE_DISCOVERY = 5, |
| 171 | SCAN_TYPE_DISCOVERY_FORCED = 6, |
| 172 | }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */ |
| 173 | |
Eran Harary | 749f1fe | 2014-03-06 09:25:30 +0200 | [diff] [blame] | 174 | /** |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 175 | * struct iwl_scan_cmd - scan request command |
| 176 | * ( SCAN_REQUEST_CMD = 0x80 ) |
| 177 | * @len: command length in bytes |
| 178 | * @scan_flags: scan flags from SCAN_FLAGS_* |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 179 | * @channel_count: num of channels in channel list |
| 180 | * (1 - ucode_capa.n_scan_channels) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 181 | * @quiet_time: in msecs, dwell this time for active scan on quiet channels |
| 182 | * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than |
| 183 | * this number of packets were received (typically 1) |
David Spinadel | 26e05cc | 2013-07-08 13:12:29 +0300 | [diff] [blame] | 184 | * @passive2active: is auto switching from passive to active during scan allowed |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 185 | * @rxchain_sel_flags: RXON_RX_CHAIN_* |
Alexander Bondar | ef67f18d | 2014-03-30 10:47:08 +0300 | [diff] [blame] | 186 | * @max_out_time: in TUs, max out of serving channel time |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 187 | * @suspend_time: how long to pause scan when returning to service channel: |
Alexander Bondar | ef67f18d | 2014-03-30 10:47:08 +0300 | [diff] [blame] | 188 | * bits 0-19: beacon interal in TUs (suspend before executing) |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 189 | * bits 20-23: reserved |
| 190 | * bits 24-31: number of beacons (suspend between channels) |
| 191 | * @rxon_flags: RXON_FLG_* |
| 192 | * @filter_flags: RXON_FILTER_* |
| 193 | * @tx_cmd: for active scans (zero for passive), w/o payload, |
| 194 | * no RS so specify TX rate |
| 195 | * @direct_scan: direct scan SSIDs |
| 196 | * @type: one of SCAN_TYPE_* |
| 197 | * @repeats: how many time to repeat the scan |
| 198 | */ |
| 199 | struct iwl_scan_cmd { |
| 200 | __le16 len; |
| 201 | u8 scan_flags; |
| 202 | u8 channel_count; |
| 203 | __le16 quiet_time; |
| 204 | __le16 quiet_plcp_th; |
| 205 | __le16 passive2active; |
| 206 | __le16 rxchain_sel_flags; |
| 207 | __le32 max_out_time; |
| 208 | __le32 suspend_time; |
| 209 | /* RX_ON_FLAGS_API_S_VER_1 */ |
| 210 | __le32 rxon_flags; |
| 211 | __le32 filter_flags; |
| 212 | struct iwl_tx_cmd tx_cmd; |
| 213 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
| 214 | __le32 type; |
| 215 | __le32 repeats; |
| 216 | |
| 217 | /* |
| 218 | * Probe request frame, followed by channel list. |
| 219 | * |
| 220 | * Size of probe request frame is specified by byte count in tx_cmd. |
| 221 | * Channel list follows immediately after probe request frame. |
| 222 | * Number of channels in list is specified by channel_count. |
| 223 | * Each channel in list is of type: |
| 224 | * |
| 225 | * struct iwl_scan_channel channels[0]; |
| 226 | * |
| 227 | * NOTE: Only one band of channels can be scanned per pass. You |
| 228 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait |
| 229 | * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) |
| 230 | * before requesting another scan. |
| 231 | */ |
| 232 | u8 data[0]; |
| 233 | } __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */ |
| 234 | |
| 235 | /* Response to scan request contains only status with one of these values */ |
| 236 | #define SCAN_RESPONSE_OK 0x1 |
| 237 | #define SCAN_RESPONSE_ERROR 0x2 |
| 238 | |
| 239 | /* |
| 240 | * SCAN_ABORT_CMD = 0x81 |
| 241 | * When scan abort is requested, the command has no fields except the common |
| 242 | * header. The response contains only a status with one of these values. |
| 243 | */ |
| 244 | #define SCAN_ABORT_POSSIBLE 0x1 |
| 245 | #define SCAN_ABORT_IGNORED 0x2 /* no pending scans */ |
| 246 | |
| 247 | /* TODO: complete documentation */ |
| 248 | #define SCAN_OWNER_STATUS 0x1 |
| 249 | #define MEASURE_OWNER_STATUS 0x2 |
| 250 | |
| 251 | /** |
| 252 | * struct iwl_scan_start_notif - notifies start of scan in the device |
| 253 | * ( SCAN_START_NOTIFICATION = 0x82 ) |
| 254 | * @tsf_low: TSF timer (lower half) in usecs |
| 255 | * @tsf_high: TSF timer (higher half) in usecs |
| 256 | * @beacon_timer: structured as follows: |
| 257 | * bits 0:19 - beacon interval in usecs |
| 258 | * bits 20:23 - reserved (0) |
| 259 | * bits 24:31 - number of beacons |
| 260 | * @channel: which channel is scanned |
| 261 | * @band: 0 for 5.2 GHz, 1 for 2.4 GHz |
| 262 | * @status: one of *_OWNER_STATUS |
| 263 | */ |
| 264 | struct iwl_scan_start_notif { |
| 265 | __le32 tsf_low; |
| 266 | __le32 tsf_high; |
| 267 | __le32 beacon_timer; |
| 268 | u8 channel; |
| 269 | u8 band; |
| 270 | u8 reserved[2]; |
| 271 | __le32 status; |
| 272 | } __packed; /* SCAN_START_NTF_API_S_VER_1 */ |
| 273 | |
| 274 | /* scan results probe_status first bit indicates success */ |
| 275 | #define SCAN_PROBE_STATUS_OK 0 |
| 276 | #define SCAN_PROBE_STATUS_TX_FAILED BIT(0) |
| 277 | /* error statuses combined with TX_FAILED */ |
| 278 | #define SCAN_PROBE_STATUS_FAIL_TTL BIT(1) |
| 279 | #define SCAN_PROBE_STATUS_FAIL_BT BIT(2) |
| 280 | |
| 281 | /* How many statistics are gathered for each channel */ |
| 282 | #define SCAN_RESULTS_STATISTICS 1 |
| 283 | |
| 284 | /** |
| 285 | * enum iwl_scan_complete_status - status codes for scan complete notifications |
| 286 | * @SCAN_COMP_STATUS_OK: scan completed successfully |
| 287 | * @SCAN_COMP_STATUS_ABORT: scan was aborted by user |
| 288 | * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed |
| 289 | * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready |
| 290 | * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed |
| 291 | * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed |
| 292 | * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command |
| 293 | * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort |
| 294 | * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax |
| 295 | * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful |
| 296 | * (not an error!) |
| 297 | * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver |
| 298 | * asked for |
| 299 | * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events |
| 300 | */ |
| 301 | enum iwl_scan_complete_status { |
| 302 | SCAN_COMP_STATUS_OK = 0x1, |
| 303 | SCAN_COMP_STATUS_ABORT = 0x2, |
| 304 | SCAN_COMP_STATUS_ERR_SLEEP = 0x3, |
| 305 | SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4, |
| 306 | SCAN_COMP_STATUS_ERR_PROBE = 0x5, |
| 307 | SCAN_COMP_STATUS_ERR_WAKEUP = 0x6, |
| 308 | SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7, |
| 309 | SCAN_COMP_STATUS_ERR_INTERNAL = 0x8, |
| 310 | SCAN_COMP_STATUS_ERR_COEX = 0x9, |
| 311 | SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA, |
| 312 | SCAN_COMP_STATUS_ITERATION_END = 0x0B, |
| 313 | SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C, |
| 314 | }; |
| 315 | |
| 316 | /** |
| 317 | * struct iwl_scan_results_notif - scan results for one channel |
| 318 | * ( SCAN_RESULTS_NOTIFICATION = 0x83 ) |
| 319 | * @channel: which channel the results are from |
| 320 | * @band: 0 for 5.2 GHz, 1 for 2.4 GHz |
| 321 | * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request |
| 322 | * @num_probe_not_sent: # of request that weren't sent due to not enough time |
| 323 | * @duration: duration spent in channel, in usecs |
| 324 | * @statistics: statistics gathered for this channel |
| 325 | */ |
| 326 | struct iwl_scan_results_notif { |
| 327 | u8 channel; |
| 328 | u8 band; |
| 329 | u8 probe_status; |
| 330 | u8 num_probe_not_sent; |
| 331 | __le32 duration; |
| 332 | __le32 statistics[SCAN_RESULTS_STATISTICS]; |
| 333 | } __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */ |
| 334 | |
| 335 | /** |
| 336 | * struct iwl_scan_complete_notif - notifies end of scanning (all channels) |
| 337 | * ( SCAN_COMPLETE_NOTIFICATION = 0x84 ) |
| 338 | * @scanned_channels: number of channels scanned (and number of valid results) |
| 339 | * @status: one of SCAN_COMP_STATUS_* |
| 340 | * @bt_status: BT on/off status |
| 341 | * @last_channel: last channel that was scanned |
| 342 | * @tsf_low: TSF timer (lower half) in usecs |
| 343 | * @tsf_high: TSF timer (higher half) in usecs |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 344 | * @results: array of scan results, only "scanned_channels" of them are valid |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 345 | */ |
| 346 | struct iwl_scan_complete_notif { |
| 347 | u8 scanned_channels; |
| 348 | u8 status; |
| 349 | u8 bt_status; |
| 350 | u8 last_channel; |
| 351 | __le32 tsf_low; |
| 352 | __le32 tsf_high; |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 353 | struct iwl_scan_results_notif results[]; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 354 | } __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */ |
| 355 | |
| 356 | /* scan offload */ |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 357 | #define IWL_SCAN_MAX_BLACKLIST_LEN 64 |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 358 | #define IWL_SCAN_SHORT_BLACKLIST_LEN 16 |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 359 | #define IWL_SCAN_MAX_PROFILES 11 |
| 360 | #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512 |
| 361 | |
| 362 | /* Default watchdog (in MS) for scheduled scan iteration */ |
| 363 | #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000) |
| 364 | |
| 365 | #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1) |
| 366 | #define CAN_ABORT_STATUS 1 |
| 367 | |
| 368 | #define IWL_FULL_SCAN_MULTIPLIER 5 |
| 369 | #define IWL_FAST_SCHED_SCAN_ITERATIONS 3 |
| 370 | |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 371 | enum scan_framework_client { |
| 372 | SCAN_CLIENT_SCHED_SCAN = BIT(0), |
| 373 | SCAN_CLIENT_NETDETECT = BIT(1), |
| 374 | SCAN_CLIENT_ASSET_TRACKING = BIT(2), |
| 375 | }; |
| 376 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 377 | /** |
| 378 | * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6 |
| 379 | * @scan_flags: see enum iwl_scan_flags |
| 380 | * @channel_count: channels in channel list |
| 381 | * @quiet_time: dwell time, in milisiconds, on quiet channel |
| 382 | * @quiet_plcp_th: quiet channel num of packets threshold |
| 383 | * @good_CRC_th: passive to active promotion threshold |
| 384 | * @rx_chain: RXON rx chain. |
Alexander Bondar | ef67f18d | 2014-03-30 10:47:08 +0300 | [diff] [blame] | 385 | * @max_out_time: max TUs to be out of assoceated channel |
| 386 | * @suspend_time: pause scan this TUs when returning to service channel |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 387 | * @flags: RXON flags |
| 388 | * @filter_flags: RXONfilter |
| 389 | * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz. |
| 390 | * @direct_scan: list of SSIDs for directed active scan |
| 391 | * @scan_type: see enum iwl_scan_type. |
| 392 | * @rep_count: repetition count for each scheduled scan iteration. |
| 393 | */ |
| 394 | struct iwl_scan_offload_cmd { |
| 395 | __le16 len; |
| 396 | u8 scan_flags; |
| 397 | u8 channel_count; |
| 398 | __le16 quiet_time; |
| 399 | __le16 quiet_plcp_th; |
| 400 | __le16 good_CRC_th; |
| 401 | __le16 rx_chain; |
| 402 | __le32 max_out_time; |
| 403 | __le32 suspend_time; |
| 404 | /* RX_ON_FLAGS_API_S_VER_1 */ |
| 405 | __le32 flags; |
| 406 | __le32 filter_flags; |
| 407 | struct iwl_tx_cmd tx_cmd[2]; |
| 408 | /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */ |
| 409 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
| 410 | __le32 scan_type; |
| 411 | __le32 rep_count; |
| 412 | } __packed; |
| 413 | |
| 414 | enum iwl_scan_offload_channel_flags { |
| 415 | IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0), |
| 416 | IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22), |
| 417 | IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24), |
| 418 | IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25), |
| 419 | }; |
| 420 | |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 421 | /* channel configuration for struct iwl_scan_offload_cfg. Each channels needs: |
| 422 | * __le32 type: bitmap; bits 1-20 are for directed scan to i'th ssid and |
| 423 | * see enum iwl_scan_offload_channel_flags. |
| 424 | * __le16 channel_number: channel number 1-13 etc. |
| 425 | * __le16 iter_count: repetition count for the channel. |
| 426 | * __le32 iter_interval: interval between two innteration on one channel. |
| 427 | * u8 active_dwell. |
| 428 | * u8 passive_dwell. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 429 | */ |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 430 | #define IWL_SCAN_CHAN_SIZE 14 |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 431 | |
| 432 | /** |
| 433 | * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S |
| 434 | * @scan_cmd: scan command fixed part |
David Spinadel | 762533b | 2014-06-05 11:20:43 +0300 | [diff] [blame] | 435 | * @data: scan channel configuration and probe request frames |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 436 | */ |
| 437 | struct iwl_scan_offload_cfg { |
| 438 | struct iwl_scan_offload_cmd scan_cmd; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 439 | u8 data[0]; |
| 440 | } __packed; |
| 441 | |
| 442 | /** |
| 443 | * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S |
| 444 | * @ssid: MAC address to filter out |
| 445 | * @reported_rssi: AP rssi reported to the host |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 446 | * @client_bitmap: clients ignore this entry - enum scan_framework_client |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 447 | */ |
| 448 | struct iwl_scan_offload_blacklist { |
| 449 | u8 ssid[ETH_ALEN]; |
| 450 | u8 reported_rssi; |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 451 | u8 client_bitmap; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 452 | } __packed; |
| 453 | |
| 454 | enum iwl_scan_offload_network_type { |
| 455 | IWL_NETWORK_TYPE_BSS = 1, |
| 456 | IWL_NETWORK_TYPE_IBSS = 2, |
| 457 | IWL_NETWORK_TYPE_ANY = 3, |
| 458 | }; |
| 459 | |
| 460 | enum iwl_scan_offload_band_selection { |
| 461 | IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4, |
| 462 | IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8, |
| 463 | IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc, |
| 464 | }; |
| 465 | |
| 466 | /** |
| 467 | * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S |
| 468 | * @ssid_index: index to ssid list in fixed part |
| 469 | * @unicast_cipher: encryption olgorithm to match - bitmap |
| 470 | * @aut_alg: authentication olgorithm to match - bitmap |
| 471 | * @network_type: enum iwl_scan_offload_network_type |
| 472 | * @band_selection: enum iwl_scan_offload_band_selection |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 473 | * @client_bitmap: clients waiting for match - enum scan_framework_client |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 474 | */ |
| 475 | struct iwl_scan_offload_profile { |
| 476 | u8 ssid_index; |
| 477 | u8 unicast_cipher; |
| 478 | u8 auth_alg; |
| 479 | u8 network_type; |
| 480 | u8 band_selection; |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 481 | u8 client_bitmap; |
| 482 | u8 reserved[2]; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 483 | } __packed; |
| 484 | |
| 485 | /** |
| 486 | * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1 |
| 487 | * @blaclist: AP list to filter off from scan results |
| 488 | * @profiles: profiles to search for match |
| 489 | * @blacklist_len: length of blacklist |
| 490 | * @num_profiles: num of profiles in the list |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 491 | * @match_notify: clients waiting for match found notification |
| 492 | * @pass_match: clients waiting for the results |
| 493 | * @active_clients: active clients bitmap - enum scan_framework_client |
David Spinadel | 6e0bbe5 | 2013-12-30 09:59:45 +0200 | [diff] [blame] | 494 | * @any_beacon_notify: clients waiting for match notification without match |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 495 | */ |
| 496 | struct iwl_scan_offload_profile_cfg { |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 497 | struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES]; |
| 498 | u8 blacklist_len; |
| 499 | u8 num_profiles; |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 500 | u8 match_notify; |
| 501 | u8 pass_match; |
| 502 | u8 active_clients; |
David Spinadel | 6e0bbe5 | 2013-12-30 09:59:45 +0200 | [diff] [blame] | 503 | u8 any_beacon_notify; |
| 504 | u8 reserved[2]; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 505 | } __packed; |
| 506 | |
| 507 | /** |
| 508 | * iwl_scan_offload_schedule - schedule of scan offload |
| 509 | * @delay: delay between iterations, in seconds. |
| 510 | * @iterations: num of scan iterations |
| 511 | * @full_scan_mul: number of partial scans before each full scan |
| 512 | */ |
| 513 | struct iwl_scan_offload_schedule { |
David Spinadel | b14fc2b | 2014-06-25 13:17:53 +0300 | [diff] [blame] | 514 | __le16 delay; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 515 | u8 iterations; |
| 516 | u8 full_scan_mul; |
| 517 | } __packed; |
| 518 | |
| 519 | /* |
| 520 | * iwl_scan_offload_flags |
| 521 | * |
Eliad Peller | de33fb5 | 2013-11-10 12:59:46 +0200 | [diff] [blame] | 522 | * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 523 | * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan. |
Haim Dreyfuss | e820c2d | 2014-04-06 11:19:09 +0300 | [diff] [blame] | 524 | * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical |
| 525 | * beacon period. Finding channel activity in this mode is not guaranteed. |
| 526 | * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec. |
| 527 | * Assuming beacon period is 100ms finding channel activity is guaranteed. |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 528 | */ |
| 529 | enum iwl_scan_offload_flags { |
Eliad Peller | de33fb5 | 2013-11-10 12:59:46 +0200 | [diff] [blame] | 530 | IWL_SCAN_OFFLOAD_FLAG_PASS_ALL = BIT(0), |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 531 | IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2), |
Haim Dreyfuss | e820c2d | 2014-04-06 11:19:09 +0300 | [diff] [blame] | 532 | IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE = BIT(5), |
| 533 | IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6), |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 534 | }; |
| 535 | |
| 536 | /** |
| 537 | * iwl_scan_offload_req - scan offload request command |
| 538 | * @flags: bitmap - enum iwl_scan_offload_flags. |
| 539 | * @watchdog: maximum scan duration in TU. |
| 540 | * @delay: delay in seconds before first iteration. |
| 541 | * @schedule_line: scan offload schedule, for fast and regular scan. |
| 542 | */ |
| 543 | struct iwl_scan_offload_req { |
| 544 | __le16 flags; |
| 545 | __le16 watchdog; |
| 546 | __le16 delay; |
| 547 | __le16 reserved; |
| 548 | struct iwl_scan_offload_schedule schedule_line[2]; |
| 549 | } __packed; |
| 550 | |
| 551 | enum iwl_scan_offload_compleate_status { |
| 552 | IWL_SCAN_OFFLOAD_COMPLETED = 1, |
| 553 | IWL_SCAN_OFFLOAD_ABORTED = 2, |
| 554 | }; |
| 555 | |
Haim Dreyfuss | e820c2d | 2014-04-06 11:19:09 +0300 | [diff] [blame] | 556 | enum iwl_scan_ebs_status { |
| 557 | IWL_SCAN_EBS_SUCCESS, |
| 558 | IWL_SCAN_EBS_FAILED, |
| 559 | IWL_SCAN_EBS_CHAN_NOT_FOUND, |
| 560 | }; |
| 561 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 562 | /** |
| 563 | * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1 |
| 564 | * @last_schedule_line: last schedule line executed (fast or regular) |
| 565 | * @last_schedule_iteration: last scan iteration executed before scan abort |
| 566 | * @status: enum iwl_scan_offload_compleate_status |
Haim Dreyfuss | e820c2d | 2014-04-06 11:19:09 +0300 | [diff] [blame] | 567 | * @ebs_status: last EBS status, see IWL_SCAN_EBS_* |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 568 | */ |
| 569 | struct iwl_scan_offload_complete { |
| 570 | u8 last_schedule_line; |
| 571 | u8 last_schedule_iteration; |
| 572 | u8 status; |
Haim Dreyfuss | e820c2d | 2014-04-06 11:19:09 +0300 | [diff] [blame] | 573 | u8 ebs_status; |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 574 | } __packed; |
| 575 | |
David Spinadel | 35a000b | 2013-08-28 09:29:43 +0300 | [diff] [blame] | 576 | /** |
| 577 | * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1 |
| 578 | * @ssid_bitmap: SSIDs indexes found in this iteration |
| 579 | * @client_bitmap: clients that are active and wait for this notification |
| 580 | */ |
| 581 | struct iwl_sched_scan_results { |
| 582 | __le16 ssid_bitmap; |
| 583 | u8 client_bitmap; |
| 584 | u8 reserved; |
| 585 | }; |
| 586 | |
David Spinadel | fb98be5 | 2014-05-04 12:51:10 +0300 | [diff] [blame] | 587 | /* Unified LMAC scan API */ |
| 588 | |
| 589 | #define IWL_MVM_BASIC_PASSIVE_DWELL 110 |
| 590 | |
| 591 | /** |
| 592 | * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S |
| 593 | * @tx_flags: combination of TX_CMD_FLG_* |
| 594 | * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is |
| 595 | * cleared. Combination of RATE_MCS_* |
| 596 | * @sta_id: index of destination station in FW station table |
| 597 | * @reserved: for alignment and future use |
| 598 | */ |
| 599 | struct iwl_scan_req_tx_cmd { |
| 600 | __le32 tx_flags; |
| 601 | __le32 rate_n_flags; |
| 602 | u8 sta_id; |
| 603 | u8 reserved[3]; |
| 604 | } __packed; |
| 605 | |
| 606 | enum iwl_scan_channel_flags_lmac { |
| 607 | IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27), |
| 608 | IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28), |
| 609 | }; |
| 610 | |
| 611 | /** |
| 612 | * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2 |
| 613 | * @flags: bits 1-20: directed scan to i'th ssid |
| 614 | * other bits &enum iwl_scan_channel_flags_lmac |
| 615 | * @channel_number: channel number 1-13 etc |
| 616 | * @iter_count: scan iteration on this channel |
| 617 | * @iter_interval: interval in seconds between iterations on one channel |
| 618 | */ |
| 619 | struct iwl_scan_channel_cfg_lmac { |
| 620 | __le32 flags; |
| 621 | __le16 channel_num; |
| 622 | __le16 iter_count; |
| 623 | __le32 iter_interval; |
| 624 | } __packed; |
| 625 | |
| 626 | /* |
| 627 | * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1 |
| 628 | * @offset: offset in the data block |
| 629 | * @len: length of the segment |
| 630 | */ |
| 631 | struct iwl_scan_probe_segment { |
| 632 | __le16 offset; |
| 633 | __le16 len; |
| 634 | } __packed; |
| 635 | |
| 636 | /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2 |
| 637 | * @mac_header: first (and common) part of the probe |
| 638 | * @band_data: band specific data |
| 639 | * @common_data: last (and common) part of the probe |
| 640 | * @buf: raw data block |
| 641 | */ |
| 642 | struct iwl_scan_probe_req { |
| 643 | struct iwl_scan_probe_segment mac_header; |
| 644 | struct iwl_scan_probe_segment band_data[2]; |
| 645 | struct iwl_scan_probe_segment common_data; |
| 646 | u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE]; |
| 647 | } __packed; |
| 648 | |
| 649 | enum iwl_scan_channel_flags { |
| 650 | IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0), |
| 651 | IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1), |
| 652 | IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2), |
| 653 | }; |
| 654 | |
| 655 | /* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S |
| 656 | * @flags: enum iwl_scan_channel_flgs |
| 657 | * @non_ebs_ratio: how many regular scan iteration before EBS |
| 658 | */ |
| 659 | struct iwl_scan_channel_opt { |
| 660 | __le16 flags; |
| 661 | __le16 non_ebs_ratio; |
| 662 | } __packed; |
| 663 | |
| 664 | /** |
| 665 | * iwl_mvm_lmac_scan_flags |
| 666 | * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses |
| 667 | * without filtering. |
| 668 | * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels |
| 669 | * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan |
| 670 | * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification |
| 671 | * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching |
| 672 | * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented |
Andrei Otcheretianski | 73897bd | 2014-07-09 18:59:14 +0300 | [diff] [blame] | 673 | * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report |
| 674 | * and DS parameter set IEs into probe requests. |
David Spinadel | fb98be5 | 2014-05-04 12:51:10 +0300 | [diff] [blame] | 675 | */ |
| 676 | enum iwl_mvm_lmac_scan_flags { |
| 677 | IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0), |
| 678 | IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1), |
| 679 | IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2), |
| 680 | IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3), |
| 681 | IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4), |
| 682 | IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5), |
Andrei Otcheretianski | 73897bd | 2014-07-09 18:59:14 +0300 | [diff] [blame] | 683 | IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6), |
David Spinadel | fb98be5 | 2014-05-04 12:51:10 +0300 | [diff] [blame] | 684 | }; |
| 685 | |
| 686 | enum iwl_scan_priority { |
| 687 | IWL_SCAN_PRIORITY_LOW, |
| 688 | IWL_SCAN_PRIORITY_MEDIUM, |
| 689 | IWL_SCAN_PRIORITY_HIGH, |
| 690 | }; |
| 691 | |
| 692 | /** |
| 693 | * iwl_scan_req_unified_lmac - SCAN_REQUEST_CMD_API_S_VER_1 |
| 694 | * @reserved1: for alignment and future use |
| 695 | * @channel_num: num of channels to scan |
| 696 | * @active-dwell: dwell time for active channels |
| 697 | * @passive-dwell: dwell time for passive channels |
| 698 | * @fragmented-dwell: dwell time for fragmented passive scan |
| 699 | * @reserved2: for alignment and future use |
| 700 | * @rx_chain_selct: PHY_RX_CHAIN_* flags |
| 701 | * @scan_flags: &enum iwl_mvm_lmac_scan_flags |
| 702 | * @max_out_time: max time (in TU) to be out of associated channel |
| 703 | * @suspend_time: pause scan this long (TUs) when returning to service channel |
| 704 | * @flags: RXON flags |
| 705 | * @filter_flags: RXON filter |
| 706 | * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz |
| 707 | * @direct_scan: list of SSIDs for directed active scan |
| 708 | * @scan_prio: enum iwl_scan_priority |
| 709 | * @iter_num: number of scan iterations |
| 710 | * @delay: delay in seconds before first iteration |
| 711 | * @schedule: two scheduling plans. The first one is finite, the second one can |
| 712 | * be infinite. |
| 713 | * @channel_opt: channel optimization options, for full and partial scan |
| 714 | * @data: channel configuration and probe request packet. |
| 715 | */ |
| 716 | struct iwl_scan_req_unified_lmac { |
| 717 | /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */ |
| 718 | __le32 reserved1; |
| 719 | u8 n_channels; |
| 720 | u8 active_dwell; |
| 721 | u8 passive_dwell; |
| 722 | u8 fragmented_dwell; |
| 723 | __le16 reserved2; |
| 724 | __le16 rx_chain_select; |
| 725 | __le32 scan_flags; |
| 726 | __le32 max_out_time; |
| 727 | __le32 suspend_time; |
| 728 | /* RX_ON_FLAGS_API_S_VER_1 */ |
| 729 | __le32 flags; |
| 730 | __le32 filter_flags; |
| 731 | struct iwl_scan_req_tx_cmd tx_cmd[2]; |
| 732 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
| 733 | __le32 scan_prio; |
| 734 | /* SCAN_REQ_PERIODIC_PARAMS_API_S */ |
| 735 | __le32 iter_num; |
| 736 | __le32 delay; |
| 737 | struct iwl_scan_offload_schedule schedule[2]; |
| 738 | struct iwl_scan_channel_opt channel_opt[2]; |
| 739 | u8 data[]; |
| 740 | } __packed; |
| 741 | |
| 742 | /** |
| 743 | * struct iwl_lmac_scan_results_notif - scan results for one channel - |
| 744 | * SCAN_RESULT_NTF_API_S_VER_3 |
| 745 | * @channel: which channel the results are from |
| 746 | * @band: 0 for 5.2 GHz, 1 for 2.4 GHz |
| 747 | * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request |
| 748 | * @num_probe_not_sent: # of request that weren't sent due to not enough time |
| 749 | * @duration: duration spent in channel, in usecs |
| 750 | */ |
| 751 | struct iwl_lmac_scan_results_notif { |
| 752 | u8 channel; |
| 753 | u8 band; |
| 754 | u8 probe_status; |
| 755 | u8 num_probe_not_sent; |
| 756 | __le32 duration; |
| 757 | } __packed; |
| 758 | |
| 759 | /** |
| 760 | * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels) |
| 761 | * SCAN_COMPLETE_NTF_API_S_VER_3 |
| 762 | * @scanned_channels: number of channels scanned (and number of valid results) |
| 763 | * @status: one of SCAN_COMP_STATUS_* |
| 764 | * @bt_status: BT on/off status |
| 765 | * @last_channel: last channel that was scanned |
| 766 | * @tsf_low: TSF timer (lower half) in usecs |
| 767 | * @tsf_high: TSF timer (higher half) in usecs |
| 768 | * @results: an array of scan results, only "scanned_channels" of them are valid |
| 769 | */ |
| 770 | struct iwl_lmac_scan_complete_notif { |
| 771 | u8 scanned_channels; |
| 772 | u8 status; |
| 773 | u8 bt_status; |
| 774 | u8 last_channel; |
| 775 | __le32 tsf_low; |
| 776 | __le32 tsf_high; |
| 777 | struct iwl_scan_results_notif results[]; |
| 778 | } __packed; |
| 779 | |
| 780 | /** |
| 781 | * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2 |
| 782 | * @last_schedule_line: last schedule line executed (fast or regular) |
| 783 | * @last_schedule_iteration: last scan iteration executed before scan abort |
| 784 | * @status: enum iwl_scan_offload_complete_status |
| 785 | * @ebs_status: EBS success status &enum iwl_scan_ebs_status |
| 786 | * @time_after_last_iter; time in seconds elapsed after last iteration |
| 787 | */ |
| 788 | struct iwl_periodic_scan_complete { |
| 789 | u8 last_schedule_line; |
| 790 | u8 last_schedule_iteration; |
| 791 | u8 status; |
| 792 | u8 ebs_status; |
| 793 | __le32 time_after_last_iter; |
| 794 | __le32 reserved; |
| 795 | } __packed; |
| 796 | |
David Spinadel | d249622 | 2014-05-20 12:46:37 +0300 | [diff] [blame] | 797 | /* UMAC Scan API */ |
| 798 | |
| 799 | /** |
| 800 | * struct iwl_mvm_umac_cmd_hdr - Command header for UMAC commands |
| 801 | * @size: size of the command (not including header) |
| 802 | * @reserved0: for future use and alignment |
| 803 | * @ver: API version number |
| 804 | */ |
| 805 | struct iwl_mvm_umac_cmd_hdr { |
| 806 | __le16 size; |
| 807 | u8 reserved0; |
| 808 | u8 ver; |
| 809 | } __packed; |
| 810 | |
| 811 | #define IWL_MVM_MAX_SIMULTANEOUS_SCANS 8 |
| 812 | |
| 813 | enum scan_config_flags { |
| 814 | SCAN_CONFIG_FLAG_ACTIVATE = BIT(0), |
| 815 | SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1), |
| 816 | SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2), |
| 817 | SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3), |
| 818 | SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8), |
| 819 | SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9), |
| 820 | SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10), |
| 821 | SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11), |
| 822 | SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12), |
| 823 | SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13), |
| 824 | SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14), |
| 825 | SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15), |
| 826 | SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16), |
| 827 | SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17), |
| 828 | SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18), |
| 829 | SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19), |
| 830 | SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20), |
| 831 | SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21), |
| 832 | |
| 833 | /* Bits 26-31 are for num of channels in channel_array */ |
| 834 | #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26) |
| 835 | }; |
| 836 | |
| 837 | enum scan_config_rates { |
| 838 | /* OFDM basic rates */ |
| 839 | SCAN_CONFIG_RATE_6M = BIT(0), |
| 840 | SCAN_CONFIG_RATE_9M = BIT(1), |
| 841 | SCAN_CONFIG_RATE_12M = BIT(2), |
| 842 | SCAN_CONFIG_RATE_18M = BIT(3), |
| 843 | SCAN_CONFIG_RATE_24M = BIT(4), |
| 844 | SCAN_CONFIG_RATE_36M = BIT(5), |
| 845 | SCAN_CONFIG_RATE_48M = BIT(6), |
| 846 | SCAN_CONFIG_RATE_54M = BIT(7), |
| 847 | /* CCK basic rates */ |
| 848 | SCAN_CONFIG_RATE_1M = BIT(8), |
| 849 | SCAN_CONFIG_RATE_2M = BIT(9), |
| 850 | SCAN_CONFIG_RATE_5M = BIT(10), |
| 851 | SCAN_CONFIG_RATE_11M = BIT(11), |
| 852 | |
| 853 | /* Bits 16-27 are for supported rates */ |
| 854 | #define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16) |
| 855 | }; |
| 856 | |
| 857 | enum iwl_channel_flags { |
| 858 | IWL_CHANNEL_FLAG_EBS = BIT(0), |
| 859 | IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1), |
| 860 | IWL_CHANNEL_FLAG_EBS_ADD = BIT(2), |
| 861 | IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3), |
| 862 | }; |
| 863 | |
| 864 | /** |
| 865 | * struct iwl_scan_config |
| 866 | * @hdr: umac command header |
| 867 | * @flags: enum scan_config_flags |
| 868 | * @tx_chains: valid_tx antenna - ANT_* definitions |
| 869 | * @rx_chains: valid_rx antenna - ANT_* definitions |
| 870 | * @legacy_rates: default legacy rates - enum scan_config_rates |
| 871 | * @out_of_channel_time: default max out of serving channel time |
| 872 | * @suspend_time: default max suspend time |
| 873 | * @dwell_active: default dwell time for active scan |
| 874 | * @dwell_passive: default dwell time for passive scan |
| 875 | * @dwell_fragmented: default dwell time for fragmented scan |
| 876 | * @reserved: for future use and alignment |
| 877 | * @mac_addr: default mac address to be used in probes |
| 878 | * @bcast_sta_id: the index of the station in the fw |
| 879 | * @channel_flags: default channel flags - enum iwl_channel_flags |
| 880 | * scan_config_channel_flag |
| 881 | * @channel_array: default supported channels |
| 882 | */ |
| 883 | struct iwl_scan_config { |
| 884 | struct iwl_mvm_umac_cmd_hdr hdr; |
| 885 | __le32 flags; |
| 886 | __le32 tx_chains; |
| 887 | __le32 rx_chains; |
| 888 | __le32 legacy_rates; |
| 889 | __le32 out_of_channel_time; |
| 890 | __le32 suspend_time; |
| 891 | u8 dwell_active; |
| 892 | u8 dwell_passive; |
| 893 | u8 dwell_fragmented; |
| 894 | u8 reserved; |
| 895 | u8 mac_addr[ETH_ALEN]; |
| 896 | u8 bcast_sta_id; |
| 897 | u8 channel_flags; |
| 898 | u8 channel_array[]; |
| 899 | } __packed; /* SCAN_CONFIG_DB_CMD_API_S */ |
| 900 | |
| 901 | /** |
| 902 | * iwl_umac_scan_flags |
| 903 | *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request |
| 904 | * can be preempted by other scan requests with higher priority. |
| 905 | * The low priority scan is aborted. |
| 906 | *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver |
| 907 | * when scan starts. |
| 908 | */ |
| 909 | enum iwl_umac_scan_flags { |
| 910 | IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0), |
| 911 | IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1), |
| 912 | }; |
| 913 | |
| 914 | enum iwl_umac_scan_uid_offsets { |
| 915 | IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0, |
| 916 | IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8, |
| 917 | }; |
| 918 | |
| 919 | enum iwl_umac_scan_general_flags { |
| 920 | IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0), |
| 921 | IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1), |
| 922 | IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2), |
| 923 | IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3), |
| 924 | IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4), |
| 925 | IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5), |
| 926 | IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6), |
| 927 | IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7), |
| 928 | IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8), |
| 929 | IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9) |
| 930 | }; |
| 931 | |
| 932 | /** |
| 933 | * struct iwl_scan_channel_cfg_umac |
| 934 | * @flags: bitmap - 0-19: directed scan to i'th ssid. |
| 935 | * @channel_num: channel number 1-13 etc. |
| 936 | * @iter_count: repetition count for the channel. |
| 937 | * @iter_interval: interval between two scan interations on one channel. |
| 938 | */ |
| 939 | struct iwl_scan_channel_cfg_umac { |
| 940 | __le32 flags; |
| 941 | u8 channel_num; |
| 942 | u8 iter_count; |
| 943 | __le16 iter_interval; |
| 944 | } __packed; /* SCAN_CHANNEL_CFG_S_VER2 */ |
| 945 | |
| 946 | /** |
| 947 | * struct iwl_scan_umac_schedule |
| 948 | * @interval: interval in seconds between scan iterations |
| 949 | * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop |
| 950 | * @reserved: for alignment and future use |
| 951 | */ |
| 952 | struct iwl_scan_umac_schedule { |
| 953 | __le16 interval; |
| 954 | u8 iter_count; |
| 955 | u8 reserved; |
| 956 | } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */ |
| 957 | |
| 958 | /** |
| 959 | * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command |
| 960 | * parameters following channels configuration array. |
| 961 | * @schedule: two scheduling plans. |
| 962 | * @delay: delay in TUs before starting the first scan iteration |
| 963 | * @reserved: for future use and alignment |
| 964 | * @preq: probe request with IEs blocks |
| 965 | * @direct_scan: list of SSIDs for directed active scan |
| 966 | */ |
| 967 | struct iwl_scan_req_umac_tail { |
| 968 | /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */ |
| 969 | struct iwl_scan_umac_schedule schedule[2]; |
| 970 | __le16 delay; |
| 971 | __le16 reserved; |
| 972 | /* SCAN_PROBE_PARAMS_API_S_VER_1 */ |
| 973 | struct iwl_scan_probe_req preq; |
| 974 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
| 975 | } __packed; |
| 976 | |
| 977 | /** |
| 978 | * struct iwl_scan_req_umac |
| 979 | * @hdr: umac command header |
| 980 | * @flags: &enum iwl_umac_scan_flags |
| 981 | * @uid: scan id, &enum iwl_umac_scan_uid_offsets |
| 982 | * @ooc_priority: out of channel priority - &enum iwl_scan_priority |
| 983 | * @general_flags: &enum iwl_umac_scan_general_flags |
| 984 | * @reserved1: for future use and alignment |
| 985 | * @active_dwell: dwell time for active scan |
| 986 | * @passive_dwell: dwell time for passive scan |
| 987 | * @fragmented_dwell: dwell time for fragmented passive scan |
| 988 | * @max_out_time: max out of serving channel time |
| 989 | * @suspend_time: max suspend time |
| 990 | * @scan_priority: scan internal prioritization &enum iwl_scan_priority |
| 991 | * @channel_flags: &enum iwl_scan_channel_flags |
| 992 | * @n_channels: num of channels in scan request |
| 993 | * @reserved2: for future use and alignment |
| 994 | * @data: &struct iwl_scan_channel_cfg_umac and |
| 995 | * &struct iwl_scan_req_umac_tail |
| 996 | */ |
| 997 | struct iwl_scan_req_umac { |
| 998 | struct iwl_mvm_umac_cmd_hdr hdr; |
| 999 | __le32 flags; |
| 1000 | __le32 uid; |
| 1001 | __le32 ooc_priority; |
| 1002 | /* SCAN_GENERAL_PARAMS_API_S_VER_1 */ |
| 1003 | __le32 general_flags; |
| 1004 | u8 reserved1; |
| 1005 | u8 active_dwell; |
| 1006 | u8 passive_dwell; |
| 1007 | u8 fragmented_dwell; |
| 1008 | __le32 max_out_time; |
| 1009 | __le32 suspend_time; |
| 1010 | __le32 scan_priority; |
| 1011 | /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */ |
| 1012 | u8 channel_flags; |
| 1013 | u8 n_channels; |
| 1014 | __le16 reserved2; |
| 1015 | u8 data[]; |
| 1016 | } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */ |
| 1017 | |
| 1018 | /** |
| 1019 | * struct iwl_umac_scan_abort |
| 1020 | * @hdr: umac command header |
| 1021 | * @uid: scan id, &enum iwl_umac_scan_uid_offsets |
| 1022 | * @flags: reserved |
| 1023 | */ |
| 1024 | struct iwl_umac_scan_abort { |
| 1025 | struct iwl_mvm_umac_cmd_hdr hdr; |
| 1026 | __le32 uid; |
| 1027 | __le32 flags; |
| 1028 | } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */ |
| 1029 | |
| 1030 | /** |
| 1031 | * struct iwl_umac_scan_complete |
| 1032 | * @uid: scan id, &enum iwl_umac_scan_uid_offsets |
| 1033 | * @last_schedule: last scheduling line |
| 1034 | * @last_iter: last scan iteration number |
| 1035 | * @scan status: &enum iwl_scan_offload_complete_status |
| 1036 | * @ebs_status: &enum iwl_scan_ebs_status |
| 1037 | * @time_from_last_iter: time elapsed from last iteration |
| 1038 | * @reserved: for future use |
| 1039 | */ |
| 1040 | struct iwl_umac_scan_complete { |
| 1041 | __le32 uid; |
| 1042 | u8 last_schedule; |
| 1043 | u8 last_iter; |
| 1044 | u8 status; |
| 1045 | u8 ebs_status; |
| 1046 | __le32 time_from_last_iter; |
| 1047 | __le32 reserved; |
| 1048 | } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */ |
| 1049 | |
Johannes Berg | 8ca151b | 2013-01-24 14:25:36 +0100 | [diff] [blame] | 1050 | #endif |