fw-api-scan.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  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 - 2014 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 - 2014 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. /* Masks for iwl_scan_channel.type flags */
  70. #define SCAN_CHANNEL_TYPE_ACTIVE BIT(0)
  71. #define SCAN_CHANNEL_NARROW_BAND BIT(22)
  72. /* Max number of IEs for direct SSID scans in a command */
  73. #define PROBE_OPTION_MAX 20
  74. /**
  75. * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
  76. * @channel: band is selected by iwl_scan_cmd "flags" field
  77. * @tx_gain: gain for analog radio
  78. * @dsp_atten: gain for DSP
  79. * @active_dwell: dwell time for active scan in TU, typically 5-50
  80. * @passive_dwell: dwell time for passive scan in TU, typically 20-500
  81. * @type: type is broken down to these bits:
  82. * bit 0: 0 = passive, 1 = active
  83. * bits 1-20: SSID direct bit map. If any of these bits is set then
  84. * the corresponding SSID IE is transmitted in probe request
  85. * (bit i adds IE in position i to the probe request)
  86. * bit 22: channel width, 0 = regular, 1 = TGj narrow channel
  87. *
  88. * @iteration_count:
  89. * @iteration_interval:
  90. * This struct is used once for each channel in the scan list.
  91. * Each channel can independently select:
  92. * 1) SSID for directed active scans
  93. * 2) Txpower setting (for rate specified within Tx command)
  94. * 3) How long to stay on-channel (behavior may be modified by quiet_time,
  95. * quiet_plcp_th, good_CRC_th)
  96. *
  97. * To avoid uCode errors, make sure the following are true (see comments
  98. * under struct iwl_scan_cmd about max_out_time and quiet_time):
  99. * 1) If using passive_dwell (i.e. passive_dwell != 0):
  100. * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
  101. * 2) quiet_time <= active_dwell
  102. * 3) If restricting off-channel time (i.e. max_out_time !=0):
  103. * passive_dwell < max_out_time
  104. * active_dwell < max_out_time
  105. */
  106. struct iwl_scan_channel {
  107. __le32 type;
  108. __le16 channel;
  109. __le16 iteration_count;
  110. __le32 iteration_interval;
  111. __le16 active_dwell;
  112. __le16 passive_dwell;
  113. } __packed; /* SCAN_CHANNEL_CONTROL_API_S_VER_1 */
  114. /**
  115. * struct iwl_ssid_ie - directed scan network information element
  116. *
  117. * Up to 20 of these may appear in REPLY_SCAN_CMD,
  118. * selected by "type" bit field in struct iwl_scan_channel;
  119. * each channel may select different ssids from among the 20 entries.
  120. * SSID IEs get transmitted in reverse order of entry.
  121. */
  122. struct iwl_ssid_ie {
  123. u8 id;
  124. u8 len;
  125. u8 ssid[IEEE80211_MAX_SSID_LEN];
  126. } __packed; /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
  127. /**
  128. * iwl_scan_flags - masks for scan command flags
  129. *@SCAN_FLAGS_PERIODIC_SCAN:
  130. *@SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX:
  131. *@SCAN_FLAGS_DELAYED_SCAN_LOWBAND:
  132. *@SCAN_FLAGS_DELAYED_SCAN_HIGHBAND:
  133. *@SCAN_FLAGS_FRAGMENTED_SCAN:
  134. *@SCAN_FLAGS_PASSIVE2ACTIVE: use active scan on channels that was active
  135. * in the past hour, even if they are marked as passive.
  136. */
  137. enum iwl_scan_flags {
  138. SCAN_FLAGS_PERIODIC_SCAN = BIT(0),
  139. SCAN_FLAGS_P2P_PUBLIC_ACTION_FRAME_TX = BIT(1),
  140. SCAN_FLAGS_DELAYED_SCAN_LOWBAND = BIT(2),
  141. SCAN_FLAGS_DELAYED_SCAN_HIGHBAND = BIT(3),
  142. SCAN_FLAGS_FRAGMENTED_SCAN = BIT(4),
  143. SCAN_FLAGS_PASSIVE2ACTIVE = BIT(5),
  144. };
  145. /**
  146. * enum iwl_scan_type - Scan types for scan command
  147. * @SCAN_TYPE_FORCED:
  148. * @SCAN_TYPE_BACKGROUND:
  149. * @SCAN_TYPE_OS:
  150. * @SCAN_TYPE_ROAMING:
  151. * @SCAN_TYPE_ACTION:
  152. * @SCAN_TYPE_DISCOVERY:
  153. * @SCAN_TYPE_DISCOVERY_FORCED:
  154. */
  155. enum iwl_scan_type {
  156. SCAN_TYPE_FORCED = 0,
  157. SCAN_TYPE_BACKGROUND = 1,
  158. SCAN_TYPE_OS = 2,
  159. SCAN_TYPE_ROAMING = 3,
  160. SCAN_TYPE_ACTION = 4,
  161. SCAN_TYPE_DISCOVERY = 5,
  162. SCAN_TYPE_DISCOVERY_FORCED = 6,
  163. }; /* SCAN_ACTIVITY_TYPE_E_VER_1 */
  164. /**
  165. * struct iwl_scan_cmd - scan request command
  166. * ( SCAN_REQUEST_CMD = 0x80 )
  167. * @len: command length in bytes
  168. * @scan_flags: scan flags from SCAN_FLAGS_*
  169. * @channel_count: num of channels in channel list
  170. * (1 - ucode_capa.n_scan_channels)
  171. * @quiet_time: in msecs, dwell this time for active scan on quiet channels
  172. * @quiet_plcp_th: quiet PLCP threshold (channel is quiet if less than
  173. * this number of packets were received (typically 1)
  174. * @passive2active: is auto switching from passive to active during scan allowed
  175. * @rxchain_sel_flags: RXON_RX_CHAIN_*
  176. * @max_out_time: in TUs, max out of serving channel time
  177. * @suspend_time: how long to pause scan when returning to service channel:
  178. * bits 0-19: beacon interal in TUs (suspend before executing)
  179. * bits 20-23: reserved
  180. * bits 24-31: number of beacons (suspend between channels)
  181. * @rxon_flags: RXON_FLG_*
  182. * @filter_flags: RXON_FILTER_*
  183. * @tx_cmd: for active scans (zero for passive), w/o payload,
  184. * no RS so specify TX rate
  185. * @direct_scan: direct scan SSIDs
  186. * @type: one of SCAN_TYPE_*
  187. * @repeats: how many time to repeat the scan
  188. */
  189. struct iwl_scan_cmd {
  190. __le16 len;
  191. u8 scan_flags;
  192. u8 channel_count;
  193. __le16 quiet_time;
  194. __le16 quiet_plcp_th;
  195. __le16 passive2active;
  196. __le16 rxchain_sel_flags;
  197. __le32 max_out_time;
  198. __le32 suspend_time;
  199. /* RX_ON_FLAGS_API_S_VER_1 */
  200. __le32 rxon_flags;
  201. __le32 filter_flags;
  202. struct iwl_tx_cmd tx_cmd;
  203. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  204. __le32 type;
  205. __le32 repeats;
  206. /*
  207. * Probe request frame, followed by channel list.
  208. *
  209. * Size of probe request frame is specified by byte count in tx_cmd.
  210. * Channel list follows immediately after probe request frame.
  211. * Number of channels in list is specified by channel_count.
  212. * Each channel in list is of type:
  213. *
  214. * struct iwl_scan_channel channels[0];
  215. *
  216. * NOTE: Only one band of channels can be scanned per pass. You
  217. * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
  218. * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
  219. * before requesting another scan.
  220. */
  221. u8 data[0];
  222. } __packed; /* SCAN_REQUEST_FIXED_PART_API_S_VER_5 */
  223. /* Response to scan request contains only status with one of these values */
  224. #define SCAN_RESPONSE_OK 0x1
  225. #define SCAN_RESPONSE_ERROR 0x2
  226. /*
  227. * SCAN_ABORT_CMD = 0x81
  228. * When scan abort is requested, the command has no fields except the common
  229. * header. The response contains only a status with one of these values.
  230. */
  231. #define SCAN_ABORT_POSSIBLE 0x1
  232. #define SCAN_ABORT_IGNORED 0x2 /* no pending scans */
  233. /* TODO: complete documentation */
  234. #define SCAN_OWNER_STATUS 0x1
  235. #define MEASURE_OWNER_STATUS 0x2
  236. /**
  237. * struct iwl_scan_start_notif - notifies start of scan in the device
  238. * ( SCAN_START_NOTIFICATION = 0x82 )
  239. * @tsf_low: TSF timer (lower half) in usecs
  240. * @tsf_high: TSF timer (higher half) in usecs
  241. * @beacon_timer: structured as follows:
  242. * bits 0:19 - beacon interval in usecs
  243. * bits 20:23 - reserved (0)
  244. * bits 24:31 - number of beacons
  245. * @channel: which channel is scanned
  246. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  247. * @status: one of *_OWNER_STATUS
  248. */
  249. struct iwl_scan_start_notif {
  250. __le32 tsf_low;
  251. __le32 tsf_high;
  252. __le32 beacon_timer;
  253. u8 channel;
  254. u8 band;
  255. u8 reserved[2];
  256. __le32 status;
  257. } __packed; /* SCAN_START_NTF_API_S_VER_1 */
  258. /* scan results probe_status first bit indicates success */
  259. #define SCAN_PROBE_STATUS_OK 0
  260. #define SCAN_PROBE_STATUS_TX_FAILED BIT(0)
  261. /* error statuses combined with TX_FAILED */
  262. #define SCAN_PROBE_STATUS_FAIL_TTL BIT(1)
  263. #define SCAN_PROBE_STATUS_FAIL_BT BIT(2)
  264. /* How many statistics are gathered for each channel */
  265. #define SCAN_RESULTS_STATISTICS 1
  266. /**
  267. * enum iwl_scan_complete_status - status codes for scan complete notifications
  268. * @SCAN_COMP_STATUS_OK: scan completed successfully
  269. * @SCAN_COMP_STATUS_ABORT: scan was aborted by user
  270. * @SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed
  271. * @SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready
  272. * @SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed
  273. * @SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed
  274. * @SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command
  275. * @SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort
  276. * @SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax
  277. * @SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful
  278. * (not an error!)
  279. * @SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver
  280. * asked for
  281. * @SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events
  282. */
  283. enum iwl_scan_complete_status {
  284. SCAN_COMP_STATUS_OK = 0x1,
  285. SCAN_COMP_STATUS_ABORT = 0x2,
  286. SCAN_COMP_STATUS_ERR_SLEEP = 0x3,
  287. SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT = 0x4,
  288. SCAN_COMP_STATUS_ERR_PROBE = 0x5,
  289. SCAN_COMP_STATUS_ERR_WAKEUP = 0x6,
  290. SCAN_COMP_STATUS_ERR_ANTENNAS = 0x7,
  291. SCAN_COMP_STATUS_ERR_INTERNAL = 0x8,
  292. SCAN_COMP_STATUS_ERR_COEX = 0x9,
  293. SCAN_COMP_STATUS_P2P_ACTION_OK = 0xA,
  294. SCAN_COMP_STATUS_ITERATION_END = 0x0B,
  295. SCAN_COMP_STATUS_ERR_ALLOC_TE = 0x0C,
  296. };
  297. /**
  298. * struct iwl_scan_results_notif - scan results for one channel
  299. * ( SCAN_RESULTS_NOTIFICATION = 0x83 )
  300. * @channel: which channel the results are from
  301. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  302. * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
  303. * @num_probe_not_sent: # of request that weren't sent due to not enough time
  304. * @duration: duration spent in channel, in usecs
  305. * @statistics: statistics gathered for this channel
  306. */
  307. struct iwl_scan_results_notif {
  308. u8 channel;
  309. u8 band;
  310. u8 probe_status;
  311. u8 num_probe_not_sent;
  312. __le32 duration;
  313. __le32 statistics[SCAN_RESULTS_STATISTICS];
  314. } __packed; /* SCAN_RESULT_NTF_API_S_VER_2 */
  315. /**
  316. * struct iwl_scan_complete_notif - notifies end of scanning (all channels)
  317. * ( SCAN_COMPLETE_NOTIFICATION = 0x84 )
  318. * @scanned_channels: number of channels scanned (and number of valid results)
  319. * @status: one of SCAN_COMP_STATUS_*
  320. * @bt_status: BT on/off status
  321. * @last_channel: last channel that was scanned
  322. * @tsf_low: TSF timer (lower half) in usecs
  323. * @tsf_high: TSF timer (higher half) in usecs
  324. * @results: array of scan results, only "scanned_channels" of them are valid
  325. */
  326. struct iwl_scan_complete_notif {
  327. u8 scanned_channels;
  328. u8 status;
  329. u8 bt_status;
  330. u8 last_channel;
  331. __le32 tsf_low;
  332. __le32 tsf_high;
  333. struct iwl_scan_results_notif results[];
  334. } __packed; /* SCAN_COMPLETE_NTF_API_S_VER_2 */
  335. /* scan offload */
  336. #define IWL_SCAN_MAX_BLACKLIST_LEN 64
  337. #define IWL_SCAN_SHORT_BLACKLIST_LEN 16
  338. #define IWL_SCAN_MAX_PROFILES 11
  339. #define SCAN_OFFLOAD_PROBE_REQ_SIZE 512
  340. /* Default watchdog (in MS) for scheduled scan iteration */
  341. #define IWL_SCHED_SCAN_WATCHDOG cpu_to_le16(15000)
  342. #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
  343. #define CAN_ABORT_STATUS 1
  344. #define IWL_FULL_SCAN_MULTIPLIER 5
  345. #define IWL_FAST_SCHED_SCAN_ITERATIONS 3
  346. enum scan_framework_client {
  347. SCAN_CLIENT_SCHED_SCAN = BIT(0),
  348. SCAN_CLIENT_NETDETECT = BIT(1),
  349. SCAN_CLIENT_ASSET_TRACKING = BIT(2),
  350. };
  351. /**
  352. * struct iwl_scan_offload_cmd - SCAN_REQUEST_FIXED_PART_API_S_VER_6
  353. * @scan_flags: see enum iwl_scan_flags
  354. * @channel_count: channels in channel list
  355. * @quiet_time: dwell time, in milisiconds, on quiet channel
  356. * @quiet_plcp_th: quiet channel num of packets threshold
  357. * @good_CRC_th: passive to active promotion threshold
  358. * @rx_chain: RXON rx chain.
  359. * @max_out_time: max TUs to be out of assoceated channel
  360. * @suspend_time: pause scan this TUs when returning to service channel
  361. * @flags: RXON flags
  362. * @filter_flags: RXONfilter
  363. * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz.
  364. * @direct_scan: list of SSIDs for directed active scan
  365. * @scan_type: see enum iwl_scan_type.
  366. * @rep_count: repetition count for each scheduled scan iteration.
  367. */
  368. struct iwl_scan_offload_cmd {
  369. __le16 len;
  370. u8 scan_flags;
  371. u8 channel_count;
  372. __le16 quiet_time;
  373. __le16 quiet_plcp_th;
  374. __le16 good_CRC_th;
  375. __le16 rx_chain;
  376. __le32 max_out_time;
  377. __le32 suspend_time;
  378. /* RX_ON_FLAGS_API_S_VER_1 */
  379. __le32 flags;
  380. __le32 filter_flags;
  381. struct iwl_tx_cmd tx_cmd[2];
  382. /* SCAN_DIRECT_SSID_IE_API_S_VER_1 */
  383. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  384. __le32 scan_type;
  385. __le32 rep_count;
  386. } __packed;
  387. enum iwl_scan_offload_channel_flags {
  388. IWL_SCAN_OFFLOAD_CHANNEL_ACTIVE = BIT(0),
  389. IWL_SCAN_OFFLOAD_CHANNEL_NARROW = BIT(22),
  390. IWL_SCAN_OFFLOAD_CHANNEL_FULL = BIT(24),
  391. IWL_SCAN_OFFLOAD_CHANNEL_PARTIAL = BIT(25),
  392. };
  393. /* channel configuration for struct iwl_scan_offload_cfg. Each channels needs:
  394. * __le32 type: bitmap; bits 1-20 are for directed scan to i'th ssid and
  395. * see enum iwl_scan_offload_channel_flags.
  396. * __le16 channel_number: channel number 1-13 etc.
  397. * __le16 iter_count: repetition count for the channel.
  398. * __le32 iter_interval: interval between two innteration on one channel.
  399. * u8 active_dwell.
  400. * u8 passive_dwell.
  401. */
  402. #define IWL_SCAN_CHAN_SIZE 14
  403. /**
  404. * iwl_scan_offload_cfg - SCAN_OFFLOAD_CONFIG_API_S
  405. * @scan_cmd: scan command fixed part
  406. * @data: scan channel configuration and probe request frames
  407. */
  408. struct iwl_scan_offload_cfg {
  409. struct iwl_scan_offload_cmd scan_cmd;
  410. u8 data[0];
  411. } __packed;
  412. /**
  413. * iwl_scan_offload_blacklist - SCAN_OFFLOAD_BLACKLIST_S
  414. * @ssid: MAC address to filter out
  415. * @reported_rssi: AP rssi reported to the host
  416. * @client_bitmap: clients ignore this entry - enum scan_framework_client
  417. */
  418. struct iwl_scan_offload_blacklist {
  419. u8 ssid[ETH_ALEN];
  420. u8 reported_rssi;
  421. u8 client_bitmap;
  422. } __packed;
  423. enum iwl_scan_offload_network_type {
  424. IWL_NETWORK_TYPE_BSS = 1,
  425. IWL_NETWORK_TYPE_IBSS = 2,
  426. IWL_NETWORK_TYPE_ANY = 3,
  427. };
  428. enum iwl_scan_offload_band_selection {
  429. IWL_SCAN_OFFLOAD_SELECT_2_4 = 0x4,
  430. IWL_SCAN_OFFLOAD_SELECT_5_2 = 0x8,
  431. IWL_SCAN_OFFLOAD_SELECT_ANY = 0xc,
  432. };
  433. /**
  434. * iwl_scan_offload_profile - SCAN_OFFLOAD_PROFILE_S
  435. * @ssid_index: index to ssid list in fixed part
  436. * @unicast_cipher: encryption olgorithm to match - bitmap
  437. * @aut_alg: authentication olgorithm to match - bitmap
  438. * @network_type: enum iwl_scan_offload_network_type
  439. * @band_selection: enum iwl_scan_offload_band_selection
  440. * @client_bitmap: clients waiting for match - enum scan_framework_client
  441. */
  442. struct iwl_scan_offload_profile {
  443. u8 ssid_index;
  444. u8 unicast_cipher;
  445. u8 auth_alg;
  446. u8 network_type;
  447. u8 band_selection;
  448. u8 client_bitmap;
  449. u8 reserved[2];
  450. } __packed;
  451. /**
  452. * iwl_scan_offload_profile_cfg - SCAN_OFFLOAD_PROFILES_CFG_API_S_VER_1
  453. * @blaclist: AP list to filter off from scan results
  454. * @profiles: profiles to search for match
  455. * @blacklist_len: length of blacklist
  456. * @num_profiles: num of profiles in the list
  457. * @match_notify: clients waiting for match found notification
  458. * @pass_match: clients waiting for the results
  459. * @active_clients: active clients bitmap - enum scan_framework_client
  460. * @any_beacon_notify: clients waiting for match notification without match
  461. */
  462. struct iwl_scan_offload_profile_cfg {
  463. struct iwl_scan_offload_profile profiles[IWL_SCAN_MAX_PROFILES];
  464. u8 blacklist_len;
  465. u8 num_profiles;
  466. u8 match_notify;
  467. u8 pass_match;
  468. u8 active_clients;
  469. u8 any_beacon_notify;
  470. u8 reserved[2];
  471. } __packed;
  472. /**
  473. * iwl_scan_offload_schedule - schedule of scan offload
  474. * @delay: delay between iterations, in seconds.
  475. * @iterations: num of scan iterations
  476. * @full_scan_mul: number of partial scans before each full scan
  477. */
  478. struct iwl_scan_offload_schedule {
  479. __le16 delay;
  480. u8 iterations;
  481. u8 full_scan_mul;
  482. } __packed;
  483. /*
  484. * iwl_scan_offload_flags
  485. *
  486. * IWL_SCAN_OFFLOAD_FLAG_PASS_ALL: pass all results - no filtering.
  487. * IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL: add cached channels to partial scan.
  488. * IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE: EBS duration is 100mSec - typical
  489. * beacon period. Finding channel activity in this mode is not guaranteed.
  490. * IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE: EBS duration is 200mSec.
  491. * Assuming beacon period is 100ms finding channel activity is guaranteed.
  492. */
  493. enum iwl_scan_offload_flags {
  494. IWL_SCAN_OFFLOAD_FLAG_PASS_ALL = BIT(0),
  495. IWL_SCAN_OFFLOAD_FLAG_CACHED_CHANNEL = BIT(2),
  496. IWL_SCAN_OFFLOAD_FLAG_EBS_QUICK_MODE = BIT(5),
  497. IWL_SCAN_OFFLOAD_FLAG_EBS_ACCURATE_MODE = BIT(6),
  498. };
  499. /**
  500. * iwl_scan_offload_req - scan offload request command
  501. * @flags: bitmap - enum iwl_scan_offload_flags.
  502. * @watchdog: maximum scan duration in TU.
  503. * @delay: delay in seconds before first iteration.
  504. * @schedule_line: scan offload schedule, for fast and regular scan.
  505. */
  506. struct iwl_scan_offload_req {
  507. __le16 flags;
  508. __le16 watchdog;
  509. __le16 delay;
  510. __le16 reserved;
  511. struct iwl_scan_offload_schedule schedule_line[2];
  512. } __packed;
  513. enum iwl_scan_offload_compleate_status {
  514. IWL_SCAN_OFFLOAD_COMPLETED = 1,
  515. IWL_SCAN_OFFLOAD_ABORTED = 2,
  516. };
  517. enum iwl_scan_ebs_status {
  518. IWL_SCAN_EBS_SUCCESS,
  519. IWL_SCAN_EBS_FAILED,
  520. IWL_SCAN_EBS_CHAN_NOT_FOUND,
  521. };
  522. /**
  523. * iwl_scan_offload_complete - SCAN_OFFLOAD_COMPLETE_NTF_API_S_VER_1
  524. * @last_schedule_line: last schedule line executed (fast or regular)
  525. * @last_schedule_iteration: last scan iteration executed before scan abort
  526. * @status: enum iwl_scan_offload_compleate_status
  527. * @ebs_status: last EBS status, see IWL_SCAN_EBS_*
  528. */
  529. struct iwl_scan_offload_complete {
  530. u8 last_schedule_line;
  531. u8 last_schedule_iteration;
  532. u8 status;
  533. u8 ebs_status;
  534. } __packed;
  535. /**
  536. * iwl_sched_scan_results - SCAN_OFFLOAD_MATCH_FOUND_NTF_API_S_VER_1
  537. * @ssid_bitmap: SSIDs indexes found in this iteration
  538. * @client_bitmap: clients that are active and wait for this notification
  539. */
  540. struct iwl_sched_scan_results {
  541. __le16 ssid_bitmap;
  542. u8 client_bitmap;
  543. u8 reserved;
  544. };
  545. /* Unified LMAC scan API */
  546. #define IWL_MVM_BASIC_PASSIVE_DWELL 110
  547. /**
  548. * iwl_scan_req_tx_cmd - SCAN_REQ_TX_CMD_API_S
  549. * @tx_flags: combination of TX_CMD_FLG_*
  550. * @rate_n_flags: rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is
  551. * cleared. Combination of RATE_MCS_*
  552. * @sta_id: index of destination station in FW station table
  553. * @reserved: for alignment and future use
  554. */
  555. struct iwl_scan_req_tx_cmd {
  556. __le32 tx_flags;
  557. __le32 rate_n_flags;
  558. u8 sta_id;
  559. u8 reserved[3];
  560. } __packed;
  561. enum iwl_scan_channel_flags_lmac {
  562. IWL_UNIFIED_SCAN_CHANNEL_FULL = BIT(27),
  563. IWL_UNIFIED_SCAN_CHANNEL_PARTIAL = BIT(28),
  564. };
  565. /**
  566. * iwl_scan_channel_cfg_lmac - SCAN_CHANNEL_CFG_S_VER2
  567. * @flags: bits 1-20: directed scan to i'th ssid
  568. * other bits &enum iwl_scan_channel_flags_lmac
  569. * @channel_number: channel number 1-13 etc
  570. * @iter_count: scan iteration on this channel
  571. * @iter_interval: interval in seconds between iterations on one channel
  572. */
  573. struct iwl_scan_channel_cfg_lmac {
  574. __le32 flags;
  575. __le16 channel_num;
  576. __le16 iter_count;
  577. __le32 iter_interval;
  578. } __packed;
  579. /*
  580. * iwl_scan_probe_segment - PROBE_SEGMENT_API_S_VER_1
  581. * @offset: offset in the data block
  582. * @len: length of the segment
  583. */
  584. struct iwl_scan_probe_segment {
  585. __le16 offset;
  586. __le16 len;
  587. } __packed;
  588. /* iwl_scan_probe_req - PROBE_REQUEST_FRAME_API_S_VER_2
  589. * @mac_header: first (and common) part of the probe
  590. * @band_data: band specific data
  591. * @common_data: last (and common) part of the probe
  592. * @buf: raw data block
  593. */
  594. struct iwl_scan_probe_req {
  595. struct iwl_scan_probe_segment mac_header;
  596. struct iwl_scan_probe_segment band_data[2];
  597. struct iwl_scan_probe_segment common_data;
  598. u8 buf[SCAN_OFFLOAD_PROBE_REQ_SIZE];
  599. } __packed;
  600. enum iwl_scan_channel_flags {
  601. IWL_SCAN_CHANNEL_FLAG_EBS = BIT(0),
  602. IWL_SCAN_CHANNEL_FLAG_EBS_ACCURATE = BIT(1),
  603. IWL_SCAN_CHANNEL_FLAG_CACHE_ADD = BIT(2),
  604. };
  605. /* iwl_scan_channel_opt - CHANNEL_OPTIMIZATION_API_S
  606. * @flags: enum iwl_scan_channel_flgs
  607. * @non_ebs_ratio: how many regular scan iteration before EBS
  608. */
  609. struct iwl_scan_channel_opt {
  610. __le16 flags;
  611. __le16 non_ebs_ratio;
  612. } __packed;
  613. /**
  614. * iwl_mvm_lmac_scan_flags
  615. * @IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL: pass all beacons and probe responses
  616. * without filtering.
  617. * @IWL_MVM_LMAC_SCAN_FLAG_PASSIVE: force passive scan on all channels
  618. * @IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION: single channel scan
  619. * @IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE: send iteration complete notification
  620. * @IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS multiple SSID matching
  621. * @IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED: all passive scans will be fragmented
  622. * @IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED: insert WFA vendor-specific TPC report
  623. * and DS parameter set IEs into probe requests.
  624. */
  625. enum iwl_mvm_lmac_scan_flags {
  626. IWL_MVM_LMAC_SCAN_FLAG_PASS_ALL = BIT(0),
  627. IWL_MVM_LMAC_SCAN_FLAG_PASSIVE = BIT(1),
  628. IWL_MVM_LMAC_SCAN_FLAG_PRE_CONNECTION = BIT(2),
  629. IWL_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE = BIT(3),
  630. IWL_MVM_LMAC_SCAN_FLAG_MULTIPLE_SSIDS = BIT(4),
  631. IWL_MVM_LMAC_SCAN_FLAG_FRAGMENTED = BIT(5),
  632. IWL_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED = BIT(6),
  633. };
  634. enum iwl_scan_priority {
  635. IWL_SCAN_PRIORITY_LOW,
  636. IWL_SCAN_PRIORITY_MEDIUM,
  637. IWL_SCAN_PRIORITY_HIGH,
  638. };
  639. /**
  640. * iwl_scan_req_unified_lmac - SCAN_REQUEST_CMD_API_S_VER_1
  641. * @reserved1: for alignment and future use
  642. * @channel_num: num of channels to scan
  643. * @active-dwell: dwell time for active channels
  644. * @passive-dwell: dwell time for passive channels
  645. * @fragmented-dwell: dwell time for fragmented passive scan
  646. * @reserved2: for alignment and future use
  647. * @rx_chain_selct: PHY_RX_CHAIN_* flags
  648. * @scan_flags: &enum iwl_mvm_lmac_scan_flags
  649. * @max_out_time: max time (in TU) to be out of associated channel
  650. * @suspend_time: pause scan this long (TUs) when returning to service channel
  651. * @flags: RXON flags
  652. * @filter_flags: RXON filter
  653. * @tx_cmd: tx command for active scan; for 2GHz and for 5GHz
  654. * @direct_scan: list of SSIDs for directed active scan
  655. * @scan_prio: enum iwl_scan_priority
  656. * @iter_num: number of scan iterations
  657. * @delay: delay in seconds before first iteration
  658. * @schedule: two scheduling plans. The first one is finite, the second one can
  659. * be infinite.
  660. * @channel_opt: channel optimization options, for full and partial scan
  661. * @data: channel configuration and probe request packet.
  662. */
  663. struct iwl_scan_req_unified_lmac {
  664. /* SCAN_REQUEST_FIXED_PART_API_S_VER_7 */
  665. __le32 reserved1;
  666. u8 n_channels;
  667. u8 active_dwell;
  668. u8 passive_dwell;
  669. u8 fragmented_dwell;
  670. __le16 reserved2;
  671. __le16 rx_chain_select;
  672. __le32 scan_flags;
  673. __le32 max_out_time;
  674. __le32 suspend_time;
  675. /* RX_ON_FLAGS_API_S_VER_1 */
  676. __le32 flags;
  677. __le32 filter_flags;
  678. struct iwl_scan_req_tx_cmd tx_cmd[2];
  679. struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX];
  680. __le32 scan_prio;
  681. /* SCAN_REQ_PERIODIC_PARAMS_API_S */
  682. __le32 iter_num;
  683. __le32 delay;
  684. struct iwl_scan_offload_schedule schedule[2];
  685. struct iwl_scan_channel_opt channel_opt[2];
  686. u8 data[];
  687. } __packed;
  688. /**
  689. * struct iwl_lmac_scan_results_notif - scan results for one channel -
  690. * SCAN_RESULT_NTF_API_S_VER_3
  691. * @channel: which channel the results are from
  692. * @band: 0 for 5.2 GHz, 1 for 2.4 GHz
  693. * @probe_status: SCAN_PROBE_STATUS_*, indicates success of probe request
  694. * @num_probe_not_sent: # of request that weren't sent due to not enough time
  695. * @duration: duration spent in channel, in usecs
  696. */
  697. struct iwl_lmac_scan_results_notif {
  698. u8 channel;
  699. u8 band;
  700. u8 probe_status;
  701. u8 num_probe_not_sent;
  702. __le32 duration;
  703. } __packed;
  704. /**
  705. * struct iwl_lmac_scan_complete_notif - notifies end of scanning (all channels)
  706. * SCAN_COMPLETE_NTF_API_S_VER_3
  707. * @scanned_channels: number of channels scanned (and number of valid results)
  708. * @status: one of SCAN_COMP_STATUS_*
  709. * @bt_status: BT on/off status
  710. * @last_channel: last channel that was scanned
  711. * @tsf_low: TSF timer (lower half) in usecs
  712. * @tsf_high: TSF timer (higher half) in usecs
  713. * @results: an array of scan results, only "scanned_channels" of them are valid
  714. */
  715. struct iwl_lmac_scan_complete_notif {
  716. u8 scanned_channels;
  717. u8 status;
  718. u8 bt_status;
  719. u8 last_channel;
  720. __le32 tsf_low;
  721. __le32 tsf_high;
  722. struct iwl_scan_results_notif results[];
  723. } __packed;
  724. /**
  725. * iwl_scan_offload_complete - PERIODIC_SCAN_COMPLETE_NTF_API_S_VER_2
  726. * @last_schedule_line: last schedule line executed (fast or regular)
  727. * @last_schedule_iteration: last scan iteration executed before scan abort
  728. * @status: enum iwl_scan_offload_complete_status
  729. * @ebs_status: EBS success status &enum iwl_scan_ebs_status
  730. * @time_after_last_iter; time in seconds elapsed after last iteration
  731. */
  732. struct iwl_periodic_scan_complete {
  733. u8 last_schedule_line;
  734. u8 last_schedule_iteration;
  735. u8 status;
  736. u8 ebs_status;
  737. __le32 time_after_last_iter;
  738. __le32 reserved;
  739. } __packed;
  740. #endif