fw-api-scan.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  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. *
  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
  26. * in the file called COPYING.
  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. *
  34. * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  35. * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  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. #ifndef __fw_api_scan_h__
  66. #define __fw_api_scan_h__
  67. #include "fw-api.h"
  68. /* Scan Commands, Responses, Notifications */
  69. /* Max number of IEs for direct SSID scans in a command */
  70. #define PROBE_OPTION_MAX 20
  71. /**
  72. * struct iwl_ssid_ie - directed scan network information element
  73. *
  74. * Up to 20 of these may appear in REPLY_SCAN_CMD,
  75. * selected by "type" bit field in struct iwl_scan_channel;
  76. * each channel may select different ssids from among the 20 entries.
  77. * SSID IEs get transmitted in reverse order of entry.
  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. * 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. * 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. * @aut_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. */
  131. struct iwl_scan_offload_profile {
  132. u8 ssid_index;
  133. u8 unicast_cipher;
  134. u8 auth_alg;
  135. u8 network_type;
  136. u8 band_selection;
  137. u8 client_bitmap;
  138. u8 reserved[2];
  139. } __packed;
  140. /**
  141. * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
  142. * @blaclist: AP list to filter off from scan results
  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. */
  151. struct iwl_scan_offload_profile_cfg {
  152. struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
  153. u8 blacklist_len;
  154. u8 num_profiles;
  155. u8 match_notify;
  156. u8 pass_match;
  157. u8 active_clients;
  158. u8 any_beacon_notify;
  159. u8 reserved[2];
  160. } __packed;
  161. /**
  162. * iwl_scan_schedule_lmac - schedule of scan offload
  163. * @delay: delay between iterations, in seconds.
  164. * @iterations: num of scan iterations
  165. * @full_scan_mul: number of partial scans before each full scan
  166. */
  167. struct iwl_scan_schedule_lmac {
  168. __le16 delay;
  169. u8 iterations;
  170. u8 full_scan_mul;
  171. } __packed; /* SCAN_SCHEDULE_API_S */
  172. enum iwl_scan_offload_complete_status {
  173. IWL_SCAN_OFFLOAD_COMPLETED = 1,
  174. IWL_SCAN_OFFLOAD_ABORTED = 2,
  175. };
  176. enum iwl_scan_ebs_status {
  177. IWL_SCAN_EBS_SUCCESS,
  178. IWL_SCAN_EBS_FAILED,
  179. IWL_SCAN_EBS_CHAN_NOT_FOUND,
  180. IWL_SCAN_EBS_INACTIVE,
  181. };
  182. /**
  183. * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
  184. * @tx_flags: combination of TX_CMD_FLG_*
  185. * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
  186. * cleared. Combination of RATE_MCS_*
  187. * @sta_id: index of destination station in FW station table
  188. * @reserved: for alignment and future use
  189. */
  190. struct iwl_scan_req_tx_cmd {
  191. __le32 tx_flags;
  192. __le32 rate_n_flags;
  193. u8 sta_id;
  194. u8 reserved[3];
  195. } __packed;
  196. enum iwl_scan_channel_flags_lmac {
  197. IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
  198. IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
  199. };
  200. /**
  201. * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
  202. * @flags: bits 1-20: directed scan to i'th ssid
  203. * other bits &enum iwl_scan_channel_flags_lmac
  204. * @channel_number: channel number 1-13 etc
  205. * @iter_count: scan iteration on this channel
  206. * @iter_interval: interval in seconds between iterations on one channel
  207. */
  208. struct iwl_scan_channel_cfg_lmac {
  209. __le32 flags;
  210. __le16 channel_num;
  211. __le16 iter_count;
  212. __le32 iter_interval;
  213. } __packed;
  214. /*
  215. * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
  216. * @offset: offset in the data block
  217. * @len: length of the segment
  218. */
  219. struct iwl_scan_probe_segment {
  220. __le16 offset;
  221. __le16 len;
  222. } __packed;
  223. /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
  224. * @mac_header: first (and common) part of the probe
  225. * @band_data: band specific data
  226. * @common_data: last (and common) part of the probe
  227. * @buf: raw data block
  228. */
  229. struct iwl_scan_probe_req {
  230. struct iwl_scan_probe_segment mac_header;
  231. struct iwl_scan_probe_segment band_data[2];
  232. struct iwl_scan_probe_segment common_data;
  233. u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
  234. } __packed;
  235. enum iwl_scan_channel_flags {
  236. IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
  237. IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
  238. IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
  239. };
  240. /* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
  241. * @flags: enum iwl_scan_channel_flags
  242. * @non_ebs_ratio: defines the ratio of number of scan iterations where EBS is
  243. * involved.
  244. * 1 - EBS is disabled.
  245. * 2 - every second scan will be full scan(and so on).
  246. */
  247. struct iwl_scan_channel_opt {
  248. __le16 flags;
  249. __le16 non_ebs_ratio;
  250. } __packed;
  251. /**
  252. * iwl_mvm_lmac_scan_flags
  253. * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
  254. * without filtering.
  255. * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
  256. * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
  257. * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
  258. * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
  259. * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
  260. * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
  261. * and DS parameter set IEs into probe requests.
  262. * @IWL_MVM_LMAC_SCAN_FLAG_MATCH: Send match found notification on matches
  263. */
  264. enum iwl_mvm_lmac_scan_flags {
  265. IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
  266. IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
  267. IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
  268. IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
  269. IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
  270. IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
  271. IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
  272. IWL_MVM_LMAC_SCAN_FLAG_MATCH = BIT(9),
  273. };
  274. enum iwl_scan_priority {
  275. IWL_SCAN_PRIORITY_LOW,
  276. IWL_SCAN_PRIORITY_MEDIUM,
  277. IWL_SCAN_PRIORITY_HIGH,
  278. };
  279. enum iwl_scan_priority_ext {
  280. IWL_SCAN_PRIORITY_EXT_0_LOWEST,
  281. IWL_SCAN_PRIORITY_EXT_1,
  282. IWL_SCAN_PRIORITY_EXT_2,
  283. IWL_SCAN_PRIORITY_EXT_3,
  284. IWL_SCAN_PRIORITY_EXT_4,
  285. IWL_SCAN_PRIORITY_EXT_5,
  286. IWL_SCAN_PRIORITY_EXT_6,
  287. IWL_SCAN_PRIORITY_EXT_7_HIGHEST,
  288. };
  289. /**
  290. * iwl_scan_req_lmac - SCAN_REQUEST_CMD_API_S_VER_1
  291. * @reserved1: for alignment and future use
  292. * @channel_num: num of channels to scan
  293. * @active-dwell: dwell time for active channels
  294. * @passive-dwell: dwell time for passive channels
  295. * @fragmented-dwell: dwell time for fragmented passive scan
  296. * @reserved2: for alignment and future use
  297. * @rx_chain_selct: PHY_RX_CHAIN_* flags
  298. * @scan_flags: &enum iwl_mvm_lmac_scan_flags
  299. * @max_out_time: max time (in TU) to be out of associated channel
  300. * @suspend_time: pause scan this long (TUs) when returning to service channel
  301. * @flags: RXON flags
  302. * @filter_flags: RXON filter
  303. * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
  304. * @direct_scan: list of SSIDs for directed active scan
  305. * @scan_prio: enum iwl_scan_priority
  306. * @iter_num: number of scan iterations
  307. * @delay: delay in seconds before first iteration
  308. * @schedule: two scheduling plans. The first one is finite, the second one can
  309. * be infinite.
  310. * @channel_opt: channel optimization options, for full and partial scan
  311. * @data: channel configuration and probe request packet.
  312. */
  313. struct iwl_scan_req_lmac {
  314. /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
  315. __le32 reserved1;
  316. u8 n_channels;
  317. u8 active_dwell;
  318. u8 passive_dwell;
  319. u8 fragmented_dwell;
  320. __le16 reserved2;
  321. __le16 rx_chain_select;
  322. __le32 scan_flags;
  323. __le32 max_out_time;
  324. __le32 suspend_time;
  325. /* RX_ON_FLAGS_API_S_VER_1 */
  326. __le32 flags;
  327. __le32 filter_flags;
  328. struct iwl_scan_req_tx_cmd tx_cmd[2];
  329. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  330. __le32 scan_prio;
  331. /* SCAN_REQ_PERIODIC_PARAMS_API_S */
  332. __le32 iter_num;
  333. __le32 delay;
  334. struct iwl_scan_schedule_lmac schedule[IWL_MAX_SCHED_SCAN_PLANS];
  335. struct iwl_scan_channel_opt channel_opt[2];
  336. u8 data[];
  337. } __packed;
  338. /**
  339. * struct iwl_scan_results_notif - scan results for one channel -
  340. * SCAN_RESULT_NTF_API_S_VER_3
  341. * @channel: which channel the results are from
  342. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  343. * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
  344. * @num_probe_not_sent: # of request that weren't sent due to not enough time
  345. * @duration: duration spent in channel, in usecs
  346. */
  347. struct iwl_scan_results_notif {
  348. u8 channel;
  349. u8 band;
  350. u8 probe_status;
  351. u8 num_probe_not_sent;
  352. __le32 duration;
  353. } __packed;
  354. /**
  355. * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
  356. * SCAN_COMPLETE_NTF_API_S_VER_3
  357. * @scanned_channels: number of channels scanned (and number of valid results)
  358. * @status: one of SCAN_COMP_STATUS_*
  359. * @bt_status: BT on/off status
  360. * @last_channel: last channel that was scanned
  361. * @tsf_low: TSF timer (lower half) in usecs
  362. * @tsf_high: TSF timer (higher half) in usecs
  363. * @results: an array of scan results, only "scanned_channels" of them are valid
  364. */
  365. struct iwl_lmac_scan_complete_notif {
  366. u8 scanned_channels;
  367. u8 status;
  368. u8 bt_status;
  369. u8 last_channel;
  370. __le32 tsf_low;
  371. __le32 tsf_high;
  372. struct iwl_scan_results_notif results[];
  373. } __packed;
  374. /**
  375. * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
  376. * @last_schedule_line: last schedule line executed (fast or regular)
  377. * @last_schedule_iteration: last scan iteration executed before scan abort
  378. * @status: enum iwl_scan_offload_complete_status
  379. * @ebs_status: EBS success status &enum iwl_scan_ebs_status
  380. * @time_after_last_iter; time in seconds elapsed after last iteration
  381. */
  382. struct iwl_periodic_scan_complete {
  383. u8 last_schedule_line;
  384. u8 last_schedule_iteration;
  385. u8 status;
  386. u8 ebs_status;
  387. __le32 time_after_last_iter;
  388. __le32 reserved;
  389. } __packed;
  390. /* UMAC Scan API */
  391. /* The maximum of either of these cannot exceed 8, because we use an
  392. * 8-bit mask (see IWL_MVM_SCAN_MASK in mvm.h).
  393. */
  394. #define IWL_MVM_MAX_UMAC_SCANS 8
  395. #define IWL_MVM_MAX_LMAC_SCANS 1
  396. enum scan_config_flags {
  397. SCAN_CONFIG_FLAG_ACTIVATE = BIT(0),
  398. SCAN_CONFIG_FLAG_DEACTIVATE = BIT(1),
  399. SCAN_CONFIG_FLAG_FORBID_CHUB_REQS = BIT(2),
  400. SCAN_CONFIG_FLAG_ALLOW_CHUB_REQS = BIT(3),
  401. SCAN_CONFIG_FLAG_SET_TX_CHAINS = BIT(8),
  402. SCAN_CONFIG_FLAG_SET_RX_CHAINS = BIT(9),
  403. SCAN_CONFIG_FLAG_SET_AUX_STA_ID = BIT(10),
  404. SCAN_CONFIG_FLAG_SET_ALL_TIMES = BIT(11),
  405. SCAN_CONFIG_FLAG_SET_EFFECTIVE_TIMES = BIT(12),
  406. SCAN_CONFIG_FLAG_SET_CHANNEL_FLAGS = BIT(13),
  407. SCAN_CONFIG_FLAG_SET_LEGACY_RATES = BIT(14),
  408. SCAN_CONFIG_FLAG_SET_MAC_ADDR = BIT(15),
  409. SCAN_CONFIG_FLAG_SET_FRAGMENTED = BIT(16),
  410. SCAN_CONFIG_FLAG_CLEAR_FRAGMENTED = BIT(17),
  411. SCAN_CONFIG_FLAG_SET_CAM_MODE = BIT(18),
  412. SCAN_CONFIG_FLAG_CLEAR_CAM_MODE = BIT(19),
  413. SCAN_CONFIG_FLAG_SET_PROMISC_MODE = BIT(20),
  414. SCAN_CONFIG_FLAG_CLEAR_PROMISC_MODE = BIT(21),
  415. /* Bits 26-31 are for num of channels in channel_array */
  416. #define SCAN_CONFIG_N_CHANNELS(n) ((n) << 26)
  417. };
  418. enum scan_config_rates {
  419. /* OFDM basic rates */
  420. SCAN_CONFIG_RATE_6M = BIT(0),
  421. SCAN_CONFIG_RATE_9M = BIT(1),
  422. SCAN_CONFIG_RATE_12M = BIT(2),
  423. SCAN_CONFIG_RATE_18M = BIT(3),
  424. SCAN_CONFIG_RATE_24M = BIT(4),
  425. SCAN_CONFIG_RATE_36M = BIT(5),
  426. SCAN_CONFIG_RATE_48M = BIT(6),
  427. SCAN_CONFIG_RATE_54M = BIT(7),
  428. /* CCK basic rates */
  429. SCAN_CONFIG_RATE_1M = BIT(8),
  430. SCAN_CONFIG_RATE_2M = BIT(9),
  431. SCAN_CONFIG_RATE_5M = BIT(10),
  432. SCAN_CONFIG_RATE_11M = BIT(11),
  433. /* Bits 16-27 are for supported rates */
  434. #define SCAN_CONFIG_SUPPORTED_RATE(rate) ((rate) << 16)
  435. };
  436. enum iwl_channel_flags {
  437. IWL_CHANNEL_FLAG_EBS = BIT(0),
  438. IWL_CHANNEL_FLAG_ACCURATE_EBS = BIT(1),
  439. IWL_CHANNEL_FLAG_EBS_ADD = BIT(2),
  440. IWL_CHANNEL_FLAG_PRE_SCAN_PASSIVE2ACTIVE = BIT(3),
  441. };
  442. /**
  443. * struct iwl_scan_config
  444. * @flags: enum scan_config_flags
  445. * @tx_chains: valid_tx antenna - ANT_* definitions
  446. * @rx_chains: valid_rx antenna - ANT_* definitions
  447. * @legacy_rates: default legacy rates - enum scan_config_rates
  448. * @out_of_channel_time: default max out of serving channel time
  449. * @suspend_time: default max suspend time
  450. * @dwell_active: default dwell time for active scan
  451. * @dwell_passive: default dwell time for passive scan
  452. * @dwell_fragmented: default dwell time for fragmented scan
  453. * @reserved: for future use and alignment
  454. * @mac_addr: default mac address to be used in probes
  455. * @bcast_sta_id: the index of the station in the fw
  456. * @channel_flags: default channel flags - enum iwl_channel_flags
  457. * scan_config_channel_flag
  458. * @channel_array: default supported channels
  459. */
  460. struct iwl_scan_config {
  461. __le32 flags;
  462. __le32 tx_chains;
  463. __le32 rx_chains;
  464. __le32 legacy_rates;
  465. __le32 out_of_channel_time;
  466. __le32 suspend_time;
  467. u8 dwell_active;
  468. u8 dwell_passive;
  469. u8 dwell_fragmented;
  470. u8 reserved;
  471. u8 mac_addr[ETH_ALEN];
  472. u8 bcast_sta_id;
  473. u8 channel_flags;
  474. u8 channel_array[];
  475. } __packed; /* SCAN_CONFIG_DB_CMD_API_S */
  476. /**
  477. * iwl_umac_scan_flags
  478. *@IWL_UMAC_SCAN_FLAG_PREEMPTIVE: scan process triggered by this scan request
  479. * can be preempted by other scan requests with higher priority.
  480. * The low priority scan will be resumed when the higher proirity scan is
  481. * completed.
  482. *@IWL_UMAC_SCAN_FLAG_START_NOTIF: notification will be sent to the driver
  483. * when scan starts.
  484. */
  485. enum iwl_umac_scan_flags {
  486. IWL_UMAC_SCAN_FLAG_PREEMPTIVE = BIT(0),
  487. IWL_UMAC_SCAN_FLAG_START_NOTIF = BIT(1),
  488. };
  489. enum iwl_umac_scan_uid_offsets {
  490. IWL_UMAC_SCAN_UID_TYPE_OFFSET = 0,
  491. IWL_UMAC_SCAN_UID_SEQ_OFFSET = 8,
  492. };
  493. enum iwl_umac_scan_general_flags {
  494. IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC = BIT(0),
  495. IWL_UMAC_SCAN_GEN_FLAGS_OVER_BT = BIT(1),
  496. IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL = BIT(2),
  497. IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE = BIT(3),
  498. IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT = BIT(4),
  499. IWL_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE = BIT(5),
  500. IWL_UMAC_SCAN_GEN_FLAGS_MULTIPLE_SSID = BIT(6),
  501. IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED = BIT(7),
  502. IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED = BIT(8),
  503. IWL_UMAC_SCAN_GEN_FLAGS_MATCH = BIT(9)
  504. };
  505. /**
  506. * struct iwl_scan_channel_cfg_umac
  507. * @flags: bitmap - 0-19: directed scan to i'th ssid.
  508. * @channel_num: channel number 1-13 etc.
  509. * @iter_count: repetition count for the channel.
  510. * @iter_interval: interval between two scan iterations on one channel.
  511. */
  512. struct iwl_scan_channel_cfg_umac {
  513. __le32 flags;
  514. u8 channel_num;
  515. u8 iter_count;
  516. __le16 iter_interval;
  517. } __packed; /* SCAN_CHANNEL_CFG_S_VER2 */
  518. /**
  519. * struct iwl_scan_umac_schedule
  520. * @interval: interval in seconds between scan iterations
  521. * @iter_count: num of scan iterations for schedule plan, 0xff for infinite loop
  522. * @reserved: for alignment and future use
  523. */
  524. struct iwl_scan_umac_schedule {
  525. __le16 interval;
  526. u8 iter_count;
  527. u8 reserved;
  528. } __packed; /* SCAN_SCHED_PARAM_API_S_VER_1 */
  529. /**
  530. * struct iwl_scan_req_umac_tail - the rest of the UMAC scan request command
  531. * parameters following channels configuration array.
  532. * @schedule: two scheduling plans.
  533. * @delay: delay in TUs before starting the first scan iteration
  534. * @reserved: for future use and alignment
  535. * @preq: probe request with IEs blocks
  536. * @direct_scan: list of SSIDs for directed active scan
  537. */
  538. struct iwl_scan_req_umac_tail {
  539. /* SCAN_PERIODIC_PARAMS_API_S_VER_1 */
  540. struct iwl_scan_umac_schedule schedule[IWL_MAX_SCHED_SCAN_PLANS];
  541. __le16 delay;
  542. __le16 reserved;
  543. /* SCAN_PROBE_PARAMS_API_S_VER_1 */
  544. struct iwl_scan_probe_req preq;
  545. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  546. } __packed;
  547. /**
  548. * struct iwl_scan_req_umac
  549. * @flags: &enum iwl_umac_scan_flags
  550. * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  551. * @ooc_priority: out of channel priority - &enum iwl_scan_priority
  552. * @general_flags: &enum iwl_umac_scan_general_flags
  553. * @reserved1: for future use and alignment
  554. * @active_dwell: dwell time for active scan
  555. * @passive_dwell: dwell time for passive scan
  556. * @fragmented_dwell: dwell time for fragmented passive scan
  557. * @max_out_time: max out of serving channel time
  558. * @suspend_time: max suspend time
  559. * @scan_priority: scan internal prioritization &enum iwl_scan_priority
  560. * @channel_flags: &enum iwl_scan_channel_flags
  561. * @n_channels: num of channels in scan request
  562. * @reserved2: for future use and alignment
  563. * @data: &struct iwl_scan_channel_cfg_umac and
  564. * &struct iwl_scan_req_umac_tail
  565. */
  566. struct iwl_scan_req_umac {
  567. __le32 flags;
  568. __le32 uid;
  569. __le32 ooc_priority;
  570. /* SCAN_GENERAL_PARAMS_API_S_VER_1 */
  571. __le32 general_flags;
  572. u8 reserved1;
  573. u8 active_dwell;
  574. u8 passive_dwell;
  575. u8 fragmented_dwell;
  576. __le32 max_out_time;
  577. __le32 suspend_time;
  578. __le32 scan_priority;
  579. /* SCAN_CHANNEL_PARAMS_API_S_VER_1 */
  580. u8 channel_flags;
  581. u8 n_channels;
  582. __le16 reserved2;
  583. u8 data[];
  584. } __packed; /* SCAN_REQUEST_CMD_UMAC_API_S_VER_1 */
  585. /**
  586. * struct iwl_umac_scan_abort
  587. * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  588. * @flags: reserved
  589. */
  590. struct iwl_umac_scan_abort {
  591. __le32 uid;
  592. __le32 flags;
  593. } __packed; /* SCAN_ABORT_CMD_UMAC_API_S_VER_1 */
  594. /**
  595. * struct iwl_umac_scan_complete
  596. * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  597. * @last_schedule: last scheduling line
  598. * @last_iter: last scan iteration number
  599. * @scan status: &enum iwl_scan_offload_complete_status
  600. * @ebs_status: &enum iwl_scan_ebs_status
  601. * @time_from_last_iter: time elapsed from last iteration
  602. * @reserved: for future use
  603. */
  604. struct iwl_umac_scan_complete {
  605. __le32 uid;
  606. u8 last_schedule;
  607. u8 last_iter;
  608. u8 status;
  609. u8 ebs_status;
  610. __le32 time_from_last_iter;
  611. __le32 reserved;
  612. } __packed; /* SCAN_COMPLETE_NTF_UMAC_API_S_VER_1 */
  613. #define SCAN_OFFLOAD_MATCHING_CHANNELS_LEN 5
  614. /**
  615. * struct iwl_scan_offload_profile_match - match information
  616. * @bssid: matched bssid
  617. * @channel: channel where the match occurred
  618. * @energy:
  619. * @matching_feature:
  620. * @matching_channels: bitmap of channels that matched, referencing
  621. * the channels passed in tue scan offload request
  622. */
  623. struct iwl_scan_offload_profile_match {
  624. u8 bssid[ETH_ALEN];
  625. __le16 reserved;
  626. u8 channel;
  627. u8 energy;
  628. u8 matching_feature;
  629. u8 matching_channels[SCAN_OFFLOAD_MATCHING_CHANNELS_LEN];
  630. } __packed; /* SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S_VER_1 */
  631. /**
  632. * struct iwl_scan_offload_profiles_query - match results query response
  633. * @matched_profiles: bitmap of matched profiles, referencing the
  634. * matches passed in the scan offload request
  635. * @last_scan_age: age of the last offloaded scan
  636. * @n_scans_done: number of offloaded scans done
  637. * @gp2_d0u: GP2 when D0U occurred
  638. * @gp2_invoked: GP2 when scan offload was invoked
  639. * @resume_while_scanning: not used
  640. * @self_recovery: obsolete
  641. * @reserved: reserved
  642. * @matches: array of match information, one for each match
  643. */
  644. struct iwl_scan_offload_profiles_query {
  645. __le32 matched_profiles;
  646. __le32 last_scan_age;
  647. __le32 n_scans_done;
  648. __le32 gp2_d0u;
  649. __le32 gp2_invoked;
  650. u8 resume_while_scanning;
  651. u8 self_recovery;
  652. __le16 reserved;
  653. struct iwl_scan_offload_profile_match matches[IWL_SCAN_MAX_PROFILES];
  654. } __packed; /* SCAN_OFFLOAD_PROFILES_QUERY_RSP_S_VER_2 */
  655. /**
  656. * struct iwl_umac_scan_iter_complete_notif - notifies end of scanning iteration
  657. * @uid: scan id, &enum iwl_umac_scan_uid_offsets
  658. * @scanned_channels: number of channels scanned and number of valid elements in
  659. * results array
  660. * @status: one of SCAN_COMP_STATUS_*
  661. * @bt_status: BT on/off status
  662. * @last_channel: last channel that was scanned
  663. * @tsf_low: TSF timer (lower half) in usecs
  664. * @tsf_high: TSF timer (higher half) in usecs
  665. * @results: array of scan results, only "scanned_channels" of them are valid
  666. */
  667. struct iwl_umac_scan_iter_complete_notif {
  668. __le32 uid;
  669. u8 scanned_channels;
  670. u8 status;
  671. u8 bt_status;
  672. u8 last_channel;
  673. __le32 tsf_low;
  674. __le32 tsf_high;
  675. struct iwl_scan_results_notif results[];
  676. } __packed; /* SCAN_ITER_COMPLETE_NTF_UMAC_API_S_VER_1 */
  677. #endif