fw-api-sta.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. /******************************************************************************
  2. *
  3. * This file is provided under a dual BSD/GPLv2 license. When using or
  4. * redistributing this file, you may do so under either license.
  5. *
  6. * GPL LICENSE SUMMARY
  7. *
  8. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of version 2 of the GNU General Public License as
  12. * published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
  22. * USA
  23. *
  24. * The full GNU General Public License is included in this distribution
  25. * in the file called LICENSE.GPL.
  26. *
  27. * Contact Information:
  28. * Intel Linux Wireless <ilw@linux.intel.com>
  29. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  30. *
  31. * BSD LICENSE
  32. *
  33. * Copyright(c) 2012 - 2013 Intel Corporation. All rights reserved.
  34. * All rights reserved.
  35. *
  36. * Redistribution and use in source and binary forms, with or without
  37. * modification, are permitted provided that the following conditions
  38. * are met:
  39. *
  40. * * Redistributions of source code must retain the above copyright
  41. * notice, this list of conditions and the following disclaimer.
  42. * * Redistributions in binary form must reproduce the above copyright
  43. * notice, this list of conditions and the following disclaimer in
  44. * the documentation and/or other materials provided with the
  45. * distribution.
  46. * * Neither the name Intel Corporation nor the names of its
  47. * contributors may be used to endorse or promote products derived
  48. * from this software without specific prior written permission.
  49. *
  50. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  51. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  52. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  53. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  54. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  55. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  56. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  57. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  58. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  59. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  60. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  61. *****************************************************************************/
  62. #ifndef __fw_api_sta_h__
  63. #define __fw_api_sta_h__
  64. /**
  65. * enum iwl_sta_flags - flags for the ADD_STA host command
  66. * @STA_FLG_REDUCED_TX_PWR_CTRL:
  67. * @STA_FLG_REDUCED_TX_PWR_DATA:
  68. * @STA_FLG_FLG_ANT_MSK: Antenna selection
  69. * @STA_FLG_PS: set if STA is in Power Save
  70. * @STA_FLG_INVALID: set if STA is invalid
  71. * @STA_FLG_DLP_EN: Direct Link Protocol is enabled
  72. * @STA_FLG_SET_ALL_KEYS: the current key applies to all key IDs
  73. * @STA_FLG_DRAIN_FLOW: drain flow
  74. * @STA_FLG_PAN: STA is for PAN interface
  75. * @STA_FLG_CLASS_AUTH:
  76. * @STA_FLG_CLASS_ASSOC:
  77. * @STA_FLG_CLASS_MIMO_PROT:
  78. * @STA_FLG_MAX_AGG_SIZE_MSK: maximal size for A-MPDU
  79. * @STA_FLG_AGG_MPDU_DENS_MSK: maximal MPDU density for Tx aggregation
  80. * @STA_FLG_FAT_EN_MSK: support for channel width (for Tx). This flag is
  81. * initialised by driver and can be updated by fw upon reception of
  82. * action frames that can change the channel width. When cleared the fw
  83. * will send all the frames in 20MHz even when FAT channel is requested.
  84. * @STA_FLG_MIMO_EN_MSK: support for MIMO. This flag is initialised by the
  85. * driver and can be updated by fw upon reception of action frames.
  86. * @STA_FLG_MFP_EN: Management Frame Protection
  87. */
  88. enum iwl_sta_flags {
  89. STA_FLG_REDUCED_TX_PWR_CTRL = BIT(3),
  90. STA_FLG_REDUCED_TX_PWR_DATA = BIT(6),
  91. STA_FLG_FLG_ANT_A = (1 << 4),
  92. STA_FLG_FLG_ANT_B = (2 << 4),
  93. STA_FLG_FLG_ANT_MSK = (STA_FLG_FLG_ANT_A |
  94. STA_FLG_FLG_ANT_B),
  95. STA_FLG_PS = BIT(8),
  96. STA_FLG_INVALID = BIT(9),
  97. STA_FLG_DLP_EN = BIT(10),
  98. STA_FLG_SET_ALL_KEYS = BIT(11),
  99. STA_FLG_DRAIN_FLOW = BIT(12),
  100. STA_FLG_PAN = BIT(13),
  101. STA_FLG_CLASS_AUTH = BIT(14),
  102. STA_FLG_CLASS_ASSOC = BIT(15),
  103. STA_FLG_RTS_MIMO_PROT = BIT(17),
  104. STA_FLG_MAX_AGG_SIZE_SHIFT = 19,
  105. STA_FLG_MAX_AGG_SIZE_8K = (0 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  106. STA_FLG_MAX_AGG_SIZE_16K = (1 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  107. STA_FLG_MAX_AGG_SIZE_32K = (2 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  108. STA_FLG_MAX_AGG_SIZE_64K = (3 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  109. STA_FLG_MAX_AGG_SIZE_128K = (4 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  110. STA_FLG_MAX_AGG_SIZE_256K = (5 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  111. STA_FLG_MAX_AGG_SIZE_512K = (6 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  112. STA_FLG_MAX_AGG_SIZE_1024K = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  113. STA_FLG_MAX_AGG_SIZE_MSK = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
  114. STA_FLG_AGG_MPDU_DENS_SHIFT = 23,
  115. STA_FLG_AGG_MPDU_DENS_2US = (4 << STA_FLG_AGG_MPDU_DENS_SHIFT),
  116. STA_FLG_AGG_MPDU_DENS_4US = (5 << STA_FLG_AGG_MPDU_DENS_SHIFT),
  117. STA_FLG_AGG_MPDU_DENS_8US = (6 << STA_FLG_AGG_MPDU_DENS_SHIFT),
  118. STA_FLG_AGG_MPDU_DENS_16US = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
  119. STA_FLG_AGG_MPDU_DENS_MSK = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
  120. STA_FLG_FAT_EN_20MHZ = (0 << 26),
  121. STA_FLG_FAT_EN_40MHZ = (1 << 26),
  122. STA_FLG_FAT_EN_80MHZ = (2 << 26),
  123. STA_FLG_FAT_EN_160MHZ = (3 << 26),
  124. STA_FLG_FAT_EN_MSK = (3 << 26),
  125. STA_FLG_MIMO_EN_SISO = (0 << 28),
  126. STA_FLG_MIMO_EN_MIMO2 = (1 << 28),
  127. STA_FLG_MIMO_EN_MIMO3 = (2 << 28),
  128. STA_FLG_MIMO_EN_MSK = (3 << 28),
  129. };
  130. /**
  131. * enum iwl_sta_key_flag - key flags for the ADD_STA host command
  132. * @STA_KEY_FLG_EN_MSK: mask for encryption algorithm
  133. * @STA_KEY_FLG_WEP_KEY_MAP: wep is either a group key (0 - legacy WEP) or from
  134. * station info array (1 - n 1X mode)
  135. * @STA_KEY_FLG_KEYID_MSK: the index of the key
  136. * @STA_KEY_NOT_VALID: key is invalid
  137. * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key
  138. * @STA_KEY_MULTICAST: set for multical key
  139. * @STA_KEY_MFP: key is used for Management Frame Protection
  140. */
  141. enum iwl_sta_key_flag {
  142. STA_KEY_FLG_NO_ENC = (0 << 0),
  143. STA_KEY_FLG_WEP = (1 << 0),
  144. STA_KEY_FLG_CCM = (2 << 0),
  145. STA_KEY_FLG_TKIP = (3 << 0),
  146. STA_KEY_FLG_CMAC = (6 << 0),
  147. STA_KEY_FLG_ENC_UNKNOWN = (7 << 0),
  148. STA_KEY_FLG_EN_MSK = (7 << 0),
  149. STA_KEY_FLG_WEP_KEY_MAP = BIT(3),
  150. STA_KEY_FLG_KEYID_POS = 8,
  151. STA_KEY_FLG_KEYID_MSK = (3 << STA_KEY_FLG_KEYID_POS),
  152. STA_KEY_NOT_VALID = BIT(11),
  153. STA_KEY_FLG_WEP_13BYTES = BIT(12),
  154. STA_KEY_MULTICAST = BIT(14),
  155. STA_KEY_MFP = BIT(15),
  156. };
  157. /**
  158. * enum iwl_sta_modify_flag - indicate to the fw what flag are being changed
  159. * @STA_MODIFY_KEY: this command modifies %key
  160. * @STA_MODIFY_TID_DISABLE_TX: this command modifies %tid_disable_tx
  161. * @STA_MODIFY_TX_RATE: unused
  162. * @STA_MODIFY_ADD_BA_TID: this command modifies %add_immediate_ba_tid
  163. * @STA_MODIFY_REMOVE_BA_TID: this command modifies %remove_immediate_ba_tid
  164. * @STA_MODIFY_SLEEPING_STA_TX_COUNT: this command modifies %sleep_tx_count
  165. * @STA_MODIFY_PROT_TH:
  166. * @STA_MODIFY_QUEUES: modify the queues used by this station
  167. */
  168. enum iwl_sta_modify_flag {
  169. STA_MODIFY_KEY = BIT(0),
  170. STA_MODIFY_TID_DISABLE_TX = BIT(1),
  171. STA_MODIFY_TX_RATE = BIT(2),
  172. STA_MODIFY_ADD_BA_TID = BIT(3),
  173. STA_MODIFY_REMOVE_BA_TID = BIT(4),
  174. STA_MODIFY_SLEEPING_STA_TX_COUNT = BIT(5),
  175. STA_MODIFY_PROT_TH = BIT(6),
  176. STA_MODIFY_QUEUES = BIT(7),
  177. };
  178. #define STA_MODE_MODIFY 1
  179. /**
  180. * enum iwl_sta_sleep_flag - type of sleep of the station
  181. * @STA_SLEEP_STATE_AWAKE:
  182. * @STA_SLEEP_STATE_PS_POLL:
  183. * @STA_SLEEP_STATE_UAPSD:
  184. */
  185. enum iwl_sta_sleep_flag {
  186. STA_SLEEP_STATE_AWAKE = 0,
  187. STA_SLEEP_STATE_PS_POLL = BIT(0),
  188. STA_SLEEP_STATE_UAPSD = BIT(1),
  189. };
  190. /* STA ID and color bits definitions */
  191. #define STA_ID_SEED (0x0f)
  192. #define STA_ID_POS (0)
  193. #define STA_ID_MSK (STA_ID_SEED << STA_ID_POS)
  194. #define STA_COLOR_SEED (0x7)
  195. #define STA_COLOR_POS (4)
  196. #define STA_COLOR_MSK (STA_COLOR_SEED << STA_COLOR_POS)
  197. #define STA_ID_N_COLOR_GET_COLOR(id_n_color) \
  198. (((id_n_color) & STA_COLOR_MSK) >> STA_COLOR_POS)
  199. #define STA_ID_N_COLOR_GET_ID(id_n_color) \
  200. (((id_n_color) & STA_ID_MSK) >> STA_ID_POS)
  201. #define STA_KEY_MAX_NUM (16)
  202. #define STA_KEY_IDX_INVALID (0xff)
  203. #define STA_KEY_MAX_DATA_KEY_NUM (4)
  204. #define IWL_MAX_GLOBAL_KEYS (4)
  205. #define STA_KEY_LEN_WEP40 (5)
  206. #define STA_KEY_LEN_WEP104 (13)
  207. /**
  208. * struct iwl_mvm_keyinfo - key information
  209. * @key_flags: type %iwl_sta_key_flag
  210. * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
  211. * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
  212. * @key_offset: key offset in the fw's key table
  213. * @key: 16-byte unicast decryption key
  214. * @tx_secur_seq_cnt: initial RSC / PN needed for replay check
  215. * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only
  216. * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only
  217. */
  218. struct iwl_mvm_keyinfo {
  219. __le16 key_flags;
  220. u8 tkip_rx_tsc_byte2;
  221. u8 reserved1;
  222. __le16 tkip_rx_ttak[5];
  223. u8 key_offset;
  224. u8 reserved2;
  225. u8 key[16];
  226. __le64 tx_secur_seq_cnt;
  227. __le64 hw_tkip_mic_rx_key;
  228. __le64 hw_tkip_mic_tx_key;
  229. } __packed;
  230. /**
  231. * struct iwl_mvm_add_sta_cmd - Add / modify a station in the fw's station table
  232. * ( REPLY_ADD_STA = 0x18 )
  233. * @add_modify: 1: modify existing, 0: add new station
  234. * @unicast_tx_key_id: unicast tx key id. Relevant only when unicast key sent
  235. * @multicast_tx_key_id: multicast tx key id. Relevant only when multicast key
  236. * sent
  237. * @mac_id_n_color: the Mac context this station belongs to
  238. * @addr[ETH_ALEN]: station's MAC address
  239. * @sta_id: index of station in uCode's station table
  240. * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
  241. * alone. 1 - modify, 0 - don't change.
  242. * @key: look at %iwl_mvm_keyinfo
  243. * @station_flags: look at %iwl_sta_flags
  244. * @station_flags_msk: what of %station_flags have changed
  245. * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
  246. * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
  247. * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
  248. * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
  249. * add_immediate_ba_ssn.
  250. * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
  251. * Set %STA_MODIFY_REMOVE_BA_TID to use this field
  252. * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
  253. * add_immediate_ba_tid.
  254. * @sleep_tx_count: number of packets to transmit to station even though it is
  255. * asleep. Used to synchronise PS-poll and u-APSD responses while ucode
  256. * keeps track of STA sleep state.
  257. * @sleep_state_flags: Look at %iwl_sta_sleep_flag.
  258. * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
  259. * mac-addr.
  260. * @beamform_flags: beam forming controls
  261. * @tfd_queue_msk: tfd queues used by this station
  262. *
  263. * The device contains an internal table of per-station information, with info
  264. * on security keys, aggregation parameters, and Tx rates for initial Tx
  265. * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
  266. *
  267. * ADD_STA sets up the table entry for one station, either creating a new
  268. * entry, or modifying a pre-existing one.
  269. */
  270. struct iwl_mvm_add_sta_cmd {
  271. u8 add_modify;
  272. u8 unicast_tx_key_id;
  273. u8 multicast_tx_key_id;
  274. u8 reserved1;
  275. __le32 mac_id_n_color;
  276. u8 addr[ETH_ALEN];
  277. __le16 reserved2;
  278. u8 sta_id;
  279. u8 modify_mask;
  280. __le16 reserved3;
  281. struct iwl_mvm_keyinfo key;
  282. __le32 station_flags;
  283. __le32 station_flags_msk;
  284. __le16 tid_disable_tx;
  285. __le16 reserved4;
  286. u8 add_immediate_ba_tid;
  287. u8 remove_immediate_ba_tid;
  288. __le16 add_immediate_ba_ssn;
  289. __le16 sleep_tx_count;
  290. __le16 sleep_state_flags;
  291. __le16 assoc_id;
  292. __le16 beamform_flags;
  293. __le32 tfd_queue_msk;
  294. } __packed; /* ADD_STA_CMD_API_S_VER_5 */
  295. /**
  296. * enum iwl_mvm_add_sta_rsp_status - status in the response to ADD_STA command
  297. * @ADD_STA_SUCCESS: operation was executed successfully
  298. * @ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table
  299. * @ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session
  300. * @ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station that
  301. * doesn't exist.
  302. */
  303. enum iwl_mvm_add_sta_rsp_status {
  304. ADD_STA_SUCCESS = 0x1,
  305. ADD_STA_STATIONS_OVERLOAD = 0x2,
  306. ADD_STA_IMMEDIATE_BA_FAILURE = 0x4,
  307. ADD_STA_MODIFY_NON_EXISTING_STA = 0x8,
  308. };
  309. /**
  310. * struct iwl_mvm_rm_sta_cmd - Add / modify a station in the fw's station table
  311. * ( REMOVE_STA = 0x19 )
  312. * @sta_id: the station id of the station to be removed
  313. */
  314. struct iwl_mvm_rm_sta_cmd {
  315. u8 sta_id;
  316. u8 reserved[3];
  317. } __packed; /* REMOVE_STA_CMD_API_S_VER_2 */
  318. /**
  319. * struct iwl_mvm_mgmt_mcast_key_cmd
  320. * ( MGMT_MCAST_KEY = 0x1f )
  321. * @ctrl_flags: %iwl_sta_key_flag
  322. * @IGTK:
  323. * @K1: IGTK master key
  324. * @K2: IGTK sub key
  325. * @sta_id: station ID that support IGTK
  326. * @key_id:
  327. * @receive_seq_cnt: initial RSC/PN needed for replay check
  328. */
  329. struct iwl_mvm_mgmt_mcast_key_cmd {
  330. __le32 ctrl_flags;
  331. u8 IGTK[16];
  332. u8 K1[16];
  333. u8 K2[16];
  334. __le32 key_id;
  335. __le32 sta_id;
  336. __le64 receive_seq_cnt;
  337. } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */
  338. struct iwl_mvm_wep_key {
  339. u8 key_index;
  340. u8 key_offset;
  341. __le16 reserved1;
  342. u8 key_size;
  343. u8 reserved2[3];
  344. u8 key[16];
  345. } __packed;
  346. struct iwl_mvm_wep_key_cmd {
  347. __le32 mac_id_n_color;
  348. u8 num_keys;
  349. u8 decryption_type;
  350. u8 flags;
  351. u8 reserved;
  352. struct iwl_mvm_wep_key wep_key[0];
  353. } __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */
  354. #endif /* __fw_api_sta_h__ */