scan.h 25 KB

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