fw-api-scan.h 25 KB

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