fw-api-scan.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  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 - 2013 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called COPYING.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *
  62. *****************************************************************************/
  63. #ifndef __fw_api_scan_h__
  64. #define __fw_api_scan_h__
  65. #include "fw-api.h"
  66. /* Scan Commands, Responses, Notifications */
  67. /* Masks for iwl_scan_channel.type flags */
  68. #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0)
  69. #define SCAN_CHANNEL_NARROW_BAND BIT(22)
  70. /* Max number of IEs for direct SSID scans in a command */
  71. #define PROBE_OPTION_MAX 20
  72. /**
  73. * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
  74. * @channel: band is selected by iwl_scan_cmd "flags" field
  75. * @tx_gain: gain for analog radio
  76. * @dsp_atten: gain for DSP
  77. * @active_dwell: dwell time for active scan in TU, typically 5-50
  78. * @passive_dwell: dwell time for passive scan in TU, typically 20-500
  79. * @type: type is broken down to these bits:
  80. * bit 0: 0 = passive, 1 = active
  81. * bits 1-20: SSID direct bit map. If any of these bits is set then
  82. * the corresponding SSID IE is transmitted in probe request
  83. * (bit i adds IE in position i to the probe request)
  84. * bit 22: channel width, 0 = regular, 1 = TGj narrow channel
  85. *
  86. * @iteration_count:
  87. * @iteration_interval:
  88. * This struct is used once for each channel in the scan list.
  89. * Each channel can independently select:
  90. * 1) SSID for directed active scans
  91. * 2) Txpower setting (for rate specified within Tx command)
  92. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  93. * quiet_plcp_th, good_CRC_th)
  94. *
  95. * To avoid uCode errors, make sure the following are true (see comments
  96. * under struct iwl_scan_cmd about max_out_time and quiet_time):
  97. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  98. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  99. * 2) quiet_time <= active_dwell
  100. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  101. * passive_dwell < max_out_time
  102. * active_dwell < max_out_time
  103. */
  104. struct iwl_scan_channel {
  105. __le32 type;
  106. __le16 channel;
  107. __le16 iteration_count;
  108. __le32 iteration_interval;
  109. __le16 active_dwell;
  110. __le16 passive_dwell;
  111. } __packed; /* SCAN_CHANNEL_CONTROL_API_S_VER_1 */
  112. /**
  113. * struct iwl_ssid_ie - directed scan network information element
  114. *
  115. * Up to 20 of these may appear in REPLY_SCAN_CMD,
  116. * selected by "type" bit field in struct iwl_scan_channel;
  117. * each channel may select different ssids from among the 20 entries.
  118. * SSID IEs get transmitted in reverse order of entry.
  119. */
  120. struct iwl_ssid_ie {
  121. u8 id;
  122. u8 len;
  123. u8 ssid[IEEE80211_MAX_SSID_LEN];
  124. } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
  125. /**
  126. * iwl_scan_flags - masks for scan command flags
  127. *@SCAN_FLAGS_PERIODIC_SCAN:
  128. *@SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX:
  129. *@SCAN_FLAGS_DELAYED_SCAN_LOWBAND:
  130. *@SCAN_FLAGS_DELAYED_SCAN_HIGHBAND:
  131. *@SCAN_FLAGS_FRAGMENTED_SCAN:
  132. *@SCAN_FLAGS_PASSIVE2ACTIVE: use active scan on channels that was active
  133. * in the past hour, even if they are marked as passive.
  134. */
  135. enum iwl_scan_flags {
  136. SCAN_FLAGS_PERIODIC_SCAN = BIT(0),
  137. SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX = BIT(1),
  138. SCAN_FLAGS_DELAYED_SCAN_LOWBAND = BIT(2),
  139. SCAN_FLAGS_DELAYED_SCAN_HIGHBAND = BIT(3),
  140. SCAN_FLAGS_FRAGMENTED_SCAN = BIT(4),
  141. SCAN_FLAGS_PASSIVE2ACTIVE = BIT(5),
  142. };
  143. /**
  144. * enum iwl_scan_type - Scan types for scan command
  145. * @SCAN_TYPE_FORCED:
  146. * @SCAN_TYPE_BACKGROUND:
  147. * @SCAN_TYPE_OS:
  148. * @SCAN_TYPE_ROAMING:
  149. * @SCAN_TYPE_ACTION:
  150. * @SCAN_TYPE_DISCOVERY:
  151. * @SCAN_TYPE_DISCOVERY_FORCED:
  152. */
  153. enum iwl_scan_type {
  154. SCAN_TYPE_FORCED = 0,
  155. SCAN_TYPE_BACKGROUND = 1,
  156. SCAN_TYPE_OS = 2,
  157. SCAN_TYPE_ROAMING = 3,
  158. SCAN_TYPE_ACTION = 4,
  159. SCAN_TYPE_DISCOVERY = 5,
  160. SCAN_TYPE_DISCOVERY_FORCED = 6,
  161. }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */
  162. /* Maximal number of channels to scan */
  163. #define MAX_NUM_SCAN_CHANNELS 0x24
  164. /**
  165. * struct iwl_scan_cmd - scan request command
  166. * ( SCAN_REQUEST_CMD = 0x80 )
  167. * @len: command length in bytes
  168. * @scan_flags: scan flags from SCAN_FLAGS_*
  169. * @channel_count: num of channels in channel list (1 - MAX_NUM_SCAN_CHANNELS)
  170. * @quiet_time: in msecs, dwell this time for active scan on quiet channels
  171. * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than
  172. * this number of packets were received (typically 1)
  173. * @passive2active: is auto switching from passive to active during scan allowed
  174. * @rxchain_sel_flags: RXON_RX_CHAIN_*
  175. * @max_out_time: in usecs, max out of serving channel time
  176. * @suspend_time: how long to pause scan when returning to service channel:
  177. * bits 0-19: beacon interal in usecs (suspend before executing)
  178. * bits 20-23: reserved
  179. * bits 24-31: number of beacons (suspend between channels)
  180. * @rxon_flags: RXON_FLG_*
  181. * @filter_flags: RXON_FILTER_*
  182. * @tx_cmd: for active scans (zero for passive), w/o payload,
  183. * no RS so specify TX rate
  184. * @direct_scan: direct scan SSIDs
  185. * @type: one of SCAN_TYPE_*
  186. * @repeats: how many time to repeat the scan
  187. */
  188. struct iwl_scan_cmd {
  189. __le16 len;
  190. u8 scan_flags;
  191. u8 channel_count;
  192. __le16 quiet_time;
  193. __le16 quiet_plcp_th;
  194. __le16 passive2active;
  195. __le16 rxchain_sel_flags;
  196. __le32 max_out_time;
  197. __le32 suspend_time;
  198. /* RX_ON_FLAGS_API_S_VER_1 */
  199. __le32 rxon_flags;
  200. __le32 filter_flags;
  201. struct iwl_tx_cmd tx_cmd;
  202. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  203. __le32 type;
  204. __le32 repeats;
  205. /*
  206. * Probe request frame, followed by channel list.
  207. *
  208. * Size of probe request frame is specified by byte count in tx_cmd.
  209. * Channel list follows immediately after probe request frame.
  210. * Number of channels in list is specified by channel_count.
  211. * Each channel in list is of type:
  212. *
  213. * struct iwl_scan_channel channels[0];
  214. *
  215. * NOTE: Only one band of channels can be scanned per pass. You
  216. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  217. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  218. * before requesting another scan.
  219. */
  220. u8 data[0];
  221. } __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */
  222. /* Response to scan request contains only status with one of these values */
  223. #define SCAN_RESPONSE_OK 0x1
  224. #define SCAN_RESPONSE_ERROR 0x2
  225. /*
  226. * SCAN_ABORT_CMD = 0x81
  227. * When scan abort is requested, the command has no fields except the common
  228. * header. The response contains only a status with one of these values.
  229. */
  230. #define SCAN_ABORT_POSSIBLE 0x1
  231. #define SCAN_ABORT_IGNORED 0x2 /* no pending scans */
  232. /* TODO: complete documentation */
  233. #define SCAN_OWNER_STATUS 0x1
  234. #define MEASURE_OWNER_STATUS 0x2
  235. /**
  236. * struct iwl_scan_start_notif - notifies start of scan in the device
  237. * ( SCAN_START_NOTIFICATION = 0x82 )
  238. * @tsf_low: TSF timer (lower half) in usecs
  239. * @tsf_high: TSF timer (higher half) in usecs
  240. * @beacon_timer: structured as follows:
  241. * bits 0:19 - beacon interval in usecs
  242. * bits 20:23 - reserved (0)
  243. * bits 24:31 - number of beacons
  244. * @channel: which channel is scanned
  245. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  246. * @status: one of *_OWNER_STATUS
  247. */
  248. struct iwl_scan_start_notif {
  249. __le32 tsf_low;
  250. __le32 tsf_high;
  251. __le32 beacon_timer;
  252. u8 channel;
  253. u8 band;
  254. u8 reserved[2];
  255. __le32 status;
  256. } __packed; /* SCAN_START_NTF_API_S_VER_1 */
  257. /* scan results probe_status first bit indicates success */
  258. #define SCAN_PROBE_STATUS_OK 0
  259. #define SCAN_PROBE_STATUS_TX_FAILED BIT(0)
  260. /* error statuses combined with TX_FAILED */
  261. #define SCAN_PROBE_STATUS_FAIL_TTL BIT(1)
  262. #define SCAN_PROBE_STATUS_FAIL_BT BIT(2)
  263. /* How many statistics are gathered for each channel */
  264. #define SCAN_RESULTS_STATISTICS 1
  265. /**
  266. * enum iwl_scan_complete_status - status codes for scan complete notifications
  267. * @SCAN_COMP_STATUS_OK: scan completed successfully
  268. * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
  269. * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
  270. * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
  271. * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
  272. * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
  273. * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
  274. * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
  275. * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
  276. * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
  277. * (not an error!)
  278. * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver
  279. * asked for
  280. * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
  281. */
  282. enum iwl_scan_complete_status {
  283. SCAN_COMP_STATUS_OK = 0x1,
  284. SCAN_COMP_STATUS_ABORT = 0x2,
  285. SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
  286. SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
  287. SCAN_COMP_STATUS_ERR_PROBE = 0x5,
  288. SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
  289. SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
  290. SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
  291. SCAN_COMP_STATUS_ERR_COEX = 0x9,
  292. SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
  293. SCAN_COMP_STATUS_ITERATION_END = 0x0B,
  294. SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
  295. };
  296. /**
  297. * struct iwl_scan_results_notif - scan results for one channel
  298. * ( SCAN_RESULTS_NOTIFICATION = 0x83 )
  299. * @channel: which channel the results are from
  300. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  301. * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
  302. * @num_probe_not_sent: # of request that weren't sent due to not enough time
  303. * @duration: duration spent in channel, in usecs
  304. * @statistics: statistics gathered for this channel
  305. */
  306. struct iwl_scan_results_notif {
  307. u8 channel;
  308. u8 band;
  309. u8 probe_status;
  310. u8 num_probe_not_sent;
  311. __le32 duration;
  312. __le32 statistics[SCAN_RESULTS_STATISTICS];
  313. } __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */
  314. /**
  315. * struct iwl_scan_complete_notif - notifies end of scanning (all channels)
  316. * ( SCAN_COMPLETE_NOTIFICATION = 0x84 )
  317. * @scanned_channels: number of channels scanned (and number of valid results)
  318. * @status: one of SCAN_COMP_STATUS_*
  319. * @bt_status: BT on/off status
  320. * @last_channel: last channel that was scanned
  321. * @tsf_low: TSF timer (lower half) in usecs
  322. * @tsf_high: TSF timer (higher half) in usecs
  323. * @results: all scan results, only "scanned_channels" of them are valid
  324. */
  325. struct iwl_scan_complete_notif {
  326. u8 scanned_channels;
  327. u8 status;
  328. u8 bt_status;
  329. u8 last_channel;
  330. __le32 tsf_low;
  331. __le32 tsf_high;
  332. struct iwl_scan_results_notif results[MAX_NUM_SCAN_CHANNELS];
  333. } __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */
  334. /* scan offload */
  335. #define IWL_MAX_SCAN_CHANNELS 40
  336. #define IWL_SCAN_MAX_BLACKLIST_LEN 64
  337. #define IWL_SCAN_MAX_PROFILES 11
  338. #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
  339. /* Default watchdog (in MS) for scheduled scan iteration */
  340. #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
  341. #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
  342. #define CAN_ABORT_STATUS 1
  343. #define IWL_FULL_SCAN_MULTIPLIER 5
  344. #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
  345. /**
  346. * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
  347. * @scan_flags: see enum iwl_scan_flags
  348. * @channel_count: channels in channel list
  349. * @quiet_time: dwell time, in milisiconds, on quiet channel
  350. * @quiet_plcp_th: quiet channel num of packets threshold
  351. * @good_CRC_th: passive to active promotion threshold
  352. * @rx_chain: RXON rx chain.
  353. * @max_out_time: max uSec to be out of assoceated channel
  354. * @suspend_time: pause scan this long when returning to service channel
  355. * @flags: RXON flags
  356. * @filter_flags: RXONfilter
  357. * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz.
  358. * @direct_scan: list of SSIDs for directed active scan
  359. * @scan_type: see enum iwl_scan_type.
  360. * @rep_count: repetition count for each scheduled scan iteration.
  361. */
  362. struct iwl_scan_offload_cmd {
  363. __le16 len;
  364. u8 scan_flags;
  365. u8 channel_count;
  366. __le16 quiet_time;
  367. __le16 quiet_plcp_th;
  368. __le16 good_CRC_th;
  369. __le16 rx_chain;
  370. __le32 max_out_time;
  371. __le32 suspend_time;
  372. /* RX_ON_FLAGS_API_S_VER_1 */
  373. __le32 flags;
  374. __le32 filter_flags;
  375. struct iwl_tx_cmd tx_cmd[2];
  376. /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
  377. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  378. __le32 scan_type;
  379. __le32 rep_count;
  380. } __packed;
  381. enum iwl_scan_offload_channel_flags {
  382. IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0),
  383. IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22),
  384. IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24),
  385. IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25),
  386. };
  387. /**
  388. * iwl_scan_channel_cfg - SCAN_CHANNEL_CFG_S
  389. * @type: bitmap - see enum iwl_scan_offload_channel_flags.
  390. * 0: passive (0) or active (1) scan.
  391. * 1-20: directed scan to i'th ssid.
  392. * 22: channel width configuation - 1 for narrow.
  393. * 24: full scan.
  394. * 25: partial scan.
  395. * @channel_number: channel number 1-13 etc.
  396. * @iter_count: repetition count for the channel.
  397. * @iter_interval: interval between two innteration on one channel.
  398. * @dwell_time: entry 0 - active scan, entry 1 - passive scan.
  399. */
  400. struct iwl_scan_channel_cfg {
  401. __le32 type[IWL_MAX_SCAN_CHANNELS];
  402. __le16 channel_number[IWL_MAX_SCAN_CHANNELS];
  403. __le16 iter_count[IWL_MAX_SCAN_CHANNELS];
  404. __le32 iter_interval[IWL_MAX_SCAN_CHANNELS];
  405. u8 dwell_time[IWL_MAX_SCAN_CHANNELS][2];
  406. } __packed;
  407. /**
  408. * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
  409. * @scan_cmd: scan command fixed part
  410. * @channel_cfg: scan channel configuration
  411. * @data: probe request frames (one per band)
  412. */
  413. struct iwl_scan_offload_cfg {
  414. struct iwl_scan_offload_cmd scan_cmd;
  415. struct iwl_scan_channel_cfg channel_cfg;
  416. u8 data[0];
  417. } __packed;
  418. /**
  419. * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
  420. * @ssid: MAC address to filter out
  421. * @reported_rssi: AP rssi reported to the host
  422. */
  423. struct iwl_scan_offload_blacklist {
  424. u8 ssid[ETH_ALEN];
  425. u8 reported_rssi;
  426. u8 reserved;
  427. } __packed;
  428. enum iwl_scan_offload_network_type {
  429. IWL_NETWORK_TYPE_BSS = 1,
  430. IWL_NETWORK_TYPE_IBSS = 2,
  431. IWL_NETWORK_TYPE_ANY = 3,
  432. };
  433. enum iwl_scan_offload_band_selection {
  434. IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
  435. IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
  436. IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
  437. };
  438. /**
  439. * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
  440. * @ssid_index: index to ssid list in fixed part
  441. * @unicast_cipher: encryption olgorithm to match - bitmap
  442. * @aut_alg: authentication olgorithm to match - bitmap
  443. * @network_type: enum iwl_scan_offload_network_type
  444. * @band_selection: enum iwl_scan_offload_band_selection
  445. */
  446. struct iwl_scan_offload_profile {
  447. u8 ssid_index;
  448. u8 unicast_cipher;
  449. u8 auth_alg;
  450. u8 network_type;
  451. u8 band_selection;
  452. u8 reserved[3];
  453. } __packed;
  454. /**
  455. * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
  456. * @blaclist: AP list to filter off from scan results
  457. * @profiles: profiles to search for match
  458. * @blacklist_len: length of blacklist
  459. * @num_profiles: num of profiles in the list
  460. */
  461. struct iwl_scan_offload_profile_cfg {
  462. struct iwl_scan_offload_blacklist blacklist[IWL_SCAN_MAX_BLACKLIST_LEN];
  463. struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
  464. u8 blacklist_len;
  465. u8 num_profiles;
  466. u8 reserved[2];
  467. } __packed;
  468. /**
  469. * iwl_scan_offload_schedule - schedule of scan offload
  470. * @delay: delay between iterations, in seconds.
  471. * @iterations: num of scan iterations
  472. * @full_scan_mul: number of partial scans before each full scan
  473. */
  474. struct iwl_scan_offload_schedule {
  475. u16 delay;
  476. u8 iterations;
  477. u8 full_scan_mul;
  478. } __packed;
  479. /*
  480. * iwl_scan_offload_flags
  481. *
  482. * IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID: filter mode - upload every beacon or match
  483. * ssid list.
  484. * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
  485. * IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN: use energy based scan before partial scan
  486. * on A band.
  487. */
  488. enum iwl_scan_offload_flags {
  489. IWL_SCAN_OFFLOAD_FLAG_FILTER_SSID = BIT(0),
  490. IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2),
  491. IWL_SCAN_OFFLOAD_FLAG_ENERGY_SCAN = BIT(3),
  492. };
  493. /**
  494. * iwl_scan_offload_req - scan offload request command
  495. * @flags: bitmap - enum iwl_scan_offload_flags.
  496. * @watchdog: maximum scan duration in TU.
  497. * @delay: delay in seconds before first iteration.
  498. * @schedule_line: scan offload schedule, for fast and regular scan.
  499. */
  500. struct iwl_scan_offload_req {
  501. __le16 flags;
  502. __le16 watchdog;
  503. __le16 delay;
  504. __le16 reserved;
  505. struct iwl_scan_offload_schedule schedule_line[2];
  506. } __packed;
  507. enum iwl_scan_offload_compleate_status {
  508. IWL_SCAN_OFFLOAD_COMPLETED = 1,
  509. IWL_SCAN_OFFLOAD_ABORTED = 2,
  510. };
  511. /**
  512. * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
  513. * @last_schedule_line: last schedule line executed (fast or regular)
  514. * @last_schedule_iteration: last scan iteration executed before scan abort
  515. * @status: enum iwl_scan_offload_compleate_status
  516. */
  517. struct iwl_scan_offload_complete {
  518. u8 last_schedule_line;
  519. u8 last_schedule_iteration;
  520. u8 status;
  521. u8 reserved;
  522. } __packed;
  523. #endif