GNU Linux-libre 4.14.251-gnu1
[releases.git] / drivers / net / wireless / intel / iwlwifi / fw / api / sta.h
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  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of version 2 of the GNU General Public License as
14  * published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * General Public License for more details.
20  *
21  * The full GNU General Public License is included in this distribution
22  * in the file called COPYING.
23  *
24  * Contact Information:
25  *  Intel Linux Wireless <linuxwifi@intel.com>
26  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27  *
28  * BSD LICENSE
29  *
30  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
31  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
32  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
33  * All rights reserved.
34  *
35  * Redistribution and use in source and binary forms, with or without
36  * modification, are permitted provided that the following conditions
37  * are met:
38  *
39  *  * Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  *  * Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in
43  *    the documentation and/or other materials provided with the
44  *    distribution.
45  *  * Neither the name Intel Corporation nor the names of its
46  *    contributors may be used to endorse or promote products derived
47  *    from this software without specific prior written permission.
48  *
49  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
52  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
53  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
54  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
55  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60  *****************************************************************************/
61
62 #ifndef __iwl_fw_api_sta_h__
63 #define __iwl_fw_api_sta_h__
64
65 /**
66  * enum iwl_sta_flags - flags for the ADD_STA host command
67  * @STA_FLG_REDUCED_TX_PWR_CTRL: reduced TX power (control frames)
68  * @STA_FLG_REDUCED_TX_PWR_DATA: reduced TX power (data frames)
69  * @STA_FLG_DISABLE_TX: set if TX should be disabled
70  * @STA_FLG_PS: set if STA is in Power Save
71  * @STA_FLG_INVALID: set if STA is invalid
72  * @STA_FLG_DLP_EN: Direct Link Protocol is enabled
73  * @STA_FLG_SET_ALL_KEYS: the current key applies to all key IDs
74  * @STA_FLG_DRAIN_FLOW: drain flow
75  * @STA_FLG_PAN: STA is for PAN interface
76  * @STA_FLG_CLASS_AUTH: station is authenticated
77  * @STA_FLG_CLASS_ASSOC: station is associated
78  * @STA_FLG_RTS_MIMO_PROT: station requires RTS MIMO protection (dynamic SMPS)
79  * @STA_FLG_MAX_AGG_SIZE_MSK: maximal size for A-MPDU (mask)
80  * @STA_FLG_MAX_AGG_SIZE_SHIFT: maximal size for A-MPDU (bit shift)
81  * @STA_FLG_MAX_AGG_SIZE_8K: maximal size for A-MPDU (8k supported)
82  * @STA_FLG_MAX_AGG_SIZE_16K: maximal size for A-MPDU (16k supported)
83  * @STA_FLG_MAX_AGG_SIZE_32K: maximal size for A-MPDU (32k supported)
84  * @STA_FLG_MAX_AGG_SIZE_64K: maximal size for A-MPDU (64k supported)
85  * @STA_FLG_MAX_AGG_SIZE_128K: maximal size for A-MPDU (128k supported)
86  * @STA_FLG_MAX_AGG_SIZE_256K: maximal size for A-MPDU (256k supported)
87  * @STA_FLG_MAX_AGG_SIZE_512K: maximal size for A-MPDU (512k supported)
88  * @STA_FLG_MAX_AGG_SIZE_1024K: maximal size for A-MPDU (1024k supported)
89  * @STA_FLG_AGG_MPDU_DENS_MSK: maximal MPDU density for Tx aggregation
90  * @STA_FLG_FAT_EN_MSK: support for channel width (for Tx). This flag is
91  *      initialised by driver and can be updated by fw upon reception of
92  *      action frames that can change the channel width. When cleared the fw
93  *      will send all the frames in 20MHz even when FAT channel is requested.
94  * @STA_FLG_FAT_EN_20MHZ: no wide channels are supported, only 20 MHz
95  * @STA_FLG_FAT_EN_40MHZ: wide channels up to 40 MHz supported
96  * @STA_FLG_FAT_EN_80MHZ: wide channels up to 80 MHz supported
97  * @STA_FLG_FAT_EN_160MHZ: wide channels up to 160 MHz supported
98  * @STA_FLG_MIMO_EN_MSK: support for MIMO. This flag is initialised by the
99  *      driver and can be updated by fw upon reception of action frames.
100  * @STA_FLG_MIMO_EN_SISO: no support for MIMO
101  * @STA_FLG_MIMO_EN_MIMO2: 2 streams supported
102  * @STA_FLG_MIMO_EN_MIMO3: 3 streams supported
103  * @STA_FLG_MFP_EN: Management Frame Protection
104  * @STA_FLG_AGG_MPDU_DENS_MSK: A-MPDU density (mask)
105  * @STA_FLG_AGG_MPDU_DENS_SHIFT: A-MPDU density (bit shift)
106  * @STA_FLG_AGG_MPDU_DENS_2US: A-MPDU density (2 usec gap)
107  * @STA_FLG_AGG_MPDU_DENS_4US: A-MPDU density (4 usec gap)
108  * @STA_FLG_AGG_MPDU_DENS_8US: A-MPDU density (8 usec gap)
109  * @STA_FLG_AGG_MPDU_DENS_16US: A-MPDU density (16 usec gap)
110  */
111 enum iwl_sta_flags {
112         STA_FLG_REDUCED_TX_PWR_CTRL     = BIT(3),
113         STA_FLG_REDUCED_TX_PWR_DATA     = BIT(6),
114
115         STA_FLG_DISABLE_TX              = BIT(4),
116
117         STA_FLG_PS                      = BIT(8),
118         STA_FLG_DRAIN_FLOW              = BIT(12),
119         STA_FLG_PAN                     = BIT(13),
120         STA_FLG_CLASS_AUTH              = BIT(14),
121         STA_FLG_CLASS_ASSOC             = BIT(15),
122         STA_FLG_RTS_MIMO_PROT           = BIT(17),
123
124         STA_FLG_MAX_AGG_SIZE_SHIFT      = 19,
125         STA_FLG_MAX_AGG_SIZE_8K         = (0 << STA_FLG_MAX_AGG_SIZE_SHIFT),
126         STA_FLG_MAX_AGG_SIZE_16K        = (1 << STA_FLG_MAX_AGG_SIZE_SHIFT),
127         STA_FLG_MAX_AGG_SIZE_32K        = (2 << STA_FLG_MAX_AGG_SIZE_SHIFT),
128         STA_FLG_MAX_AGG_SIZE_64K        = (3 << STA_FLG_MAX_AGG_SIZE_SHIFT),
129         STA_FLG_MAX_AGG_SIZE_128K       = (4 << STA_FLG_MAX_AGG_SIZE_SHIFT),
130         STA_FLG_MAX_AGG_SIZE_256K       = (5 << STA_FLG_MAX_AGG_SIZE_SHIFT),
131         STA_FLG_MAX_AGG_SIZE_512K       = (6 << STA_FLG_MAX_AGG_SIZE_SHIFT),
132         STA_FLG_MAX_AGG_SIZE_1024K      = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
133         STA_FLG_MAX_AGG_SIZE_MSK        = (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
134
135         STA_FLG_AGG_MPDU_DENS_SHIFT     = 23,
136         STA_FLG_AGG_MPDU_DENS_2US       = (4 << STA_FLG_AGG_MPDU_DENS_SHIFT),
137         STA_FLG_AGG_MPDU_DENS_4US       = (5 << STA_FLG_AGG_MPDU_DENS_SHIFT),
138         STA_FLG_AGG_MPDU_DENS_8US       = (6 << STA_FLG_AGG_MPDU_DENS_SHIFT),
139         STA_FLG_AGG_MPDU_DENS_16US      = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
140         STA_FLG_AGG_MPDU_DENS_MSK       = (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
141
142         STA_FLG_FAT_EN_20MHZ            = (0 << 26),
143         STA_FLG_FAT_EN_40MHZ            = (1 << 26),
144         STA_FLG_FAT_EN_80MHZ            = (2 << 26),
145         STA_FLG_FAT_EN_160MHZ           = (3 << 26),
146         STA_FLG_FAT_EN_MSK              = (3 << 26),
147
148         STA_FLG_MIMO_EN_SISO            = (0 << 28),
149         STA_FLG_MIMO_EN_MIMO2           = (1 << 28),
150         STA_FLG_MIMO_EN_MIMO3           = (2 << 28),
151         STA_FLG_MIMO_EN_MSK             = (3 << 28),
152 };
153
154 /**
155  * enum iwl_sta_key_flag - key flags for the ADD_STA host command
156  * @STA_KEY_FLG_NO_ENC: no encryption
157  * @STA_KEY_FLG_WEP: WEP encryption algorithm
158  * @STA_KEY_FLG_CCM: CCMP encryption algorithm
159  * @STA_KEY_FLG_TKIP: TKIP encryption algorithm
160  * @STA_KEY_FLG_EXT: extended cipher algorithm (depends on the FW support)
161  * @STA_KEY_FLG_GCMP: GCMP encryption algorithm
162  * @STA_KEY_FLG_CMAC: CMAC encryption algorithm
163  * @STA_KEY_FLG_ENC_UNKNOWN: unknown encryption algorithm
164  * @STA_KEY_FLG_EN_MSK: mask for encryption algorithmi value
165  * @STA_KEY_FLG_WEP_KEY_MAP: wep is either a group key (0 - legacy WEP) or from
166  *      station info array (1 - n 1X mode)
167  * @STA_KEY_FLG_KEYID_MSK: the index of the key
168  * @STA_KEY_FLG_KEYID_POS: key index bit position
169  * @STA_KEY_NOT_VALID: key is invalid
170  * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key
171  * @STA_KEY_FLG_KEY_32BYTES: for non-wep key set for 32 bytes key
172  * @STA_KEY_MULTICAST: set for multical key
173  * @STA_KEY_MFP: key is used for Management Frame Protection
174  */
175 enum iwl_sta_key_flag {
176         STA_KEY_FLG_NO_ENC              = (0 << 0),
177         STA_KEY_FLG_WEP                 = (1 << 0),
178         STA_KEY_FLG_CCM                 = (2 << 0),
179         STA_KEY_FLG_TKIP                = (3 << 0),
180         STA_KEY_FLG_EXT                 = (4 << 0),
181         STA_KEY_FLG_GCMP                = (5 << 0),
182         STA_KEY_FLG_CMAC                = (6 << 0),
183         STA_KEY_FLG_ENC_UNKNOWN         = (7 << 0),
184         STA_KEY_FLG_EN_MSK              = (7 << 0),
185
186         STA_KEY_FLG_WEP_KEY_MAP         = BIT(3),
187         STA_KEY_FLG_KEYID_POS            = 8,
188         STA_KEY_FLG_KEYID_MSK           = (3 << STA_KEY_FLG_KEYID_POS),
189         STA_KEY_NOT_VALID               = BIT(11),
190         STA_KEY_FLG_WEP_13BYTES         = BIT(12),
191         STA_KEY_FLG_KEY_32BYTES         = BIT(12),
192         STA_KEY_MULTICAST               = BIT(14),
193         STA_KEY_MFP                     = BIT(15),
194 };
195
196 /**
197  * enum iwl_sta_modify_flag - indicate to the fw what flag are being changed
198  * @STA_MODIFY_QUEUE_REMOVAL: this command removes a queue
199  * @STA_MODIFY_TID_DISABLE_TX: this command modifies %tid_disable_tx
200  * @STA_MODIFY_UAPSD_ACS: this command modifies %uapsd_acs
201  * @STA_MODIFY_ADD_BA_TID: this command modifies %add_immediate_ba_tid
202  * @STA_MODIFY_REMOVE_BA_TID: this command modifies %remove_immediate_ba_tid
203  * @STA_MODIFY_SLEEPING_STA_TX_COUNT: this command modifies %sleep_tx_count
204  * @STA_MODIFY_PROT_TH: modify RTS threshold
205  * @STA_MODIFY_QUEUES: modify the queues used by this station
206  */
207 enum iwl_sta_modify_flag {
208         STA_MODIFY_QUEUE_REMOVAL                = BIT(0),
209         STA_MODIFY_TID_DISABLE_TX               = BIT(1),
210         STA_MODIFY_UAPSD_ACS                    = BIT(2),
211         STA_MODIFY_ADD_BA_TID                   = BIT(3),
212         STA_MODIFY_REMOVE_BA_TID                = BIT(4),
213         STA_MODIFY_SLEEPING_STA_TX_COUNT        = BIT(5),
214         STA_MODIFY_PROT_TH                      = BIT(6),
215         STA_MODIFY_QUEUES                       = BIT(7),
216 };
217
218 /**
219  * enum iwl_sta_mode - station command mode
220  * @STA_MODE_ADD: add new station
221  * @STA_MODE_MODIFY: modify the station
222  */
223 enum iwl_sta_mode {
224         STA_MODE_ADD    = 0,
225         STA_MODE_MODIFY = 1,
226 };
227
228 /**
229  * enum iwl_sta_sleep_flag - type of sleep of the station
230  * @STA_SLEEP_STATE_AWAKE: station is awake
231  * @STA_SLEEP_STATE_PS_POLL: station is PS-polling
232  * @STA_SLEEP_STATE_UAPSD: station uses U-APSD
233  * @STA_SLEEP_STATE_MOREDATA: set more-data bit on
234  *      (last) released frame
235  */
236 enum iwl_sta_sleep_flag {
237         STA_SLEEP_STATE_AWAKE           = 0,
238         STA_SLEEP_STATE_PS_POLL         = BIT(0),
239         STA_SLEEP_STATE_UAPSD           = BIT(1),
240         STA_SLEEP_STATE_MOREDATA        = BIT(2),
241 };
242
243 #define STA_KEY_MAX_NUM (16)
244 #define STA_KEY_IDX_INVALID (0xff)
245 #define STA_KEY_MAX_DATA_KEY_NUM (4)
246 #define IWL_MAX_GLOBAL_KEYS (4)
247 #define STA_KEY_LEN_WEP40 (5)
248 #define STA_KEY_LEN_WEP104 (13)
249
250 /**
251  * struct iwl_mvm_keyinfo - key information
252  * @key_flags: type &enum iwl_sta_key_flag
253  * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
254  * @reserved1: reserved
255  * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
256  * @key_offset: key offset in the fw's key table
257  * @reserved2: reserved
258  * @key: 16-byte unicast decryption key
259  * @tx_secur_seq_cnt: initial RSC / PN needed for replay check
260  * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only
261  * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only
262  */
263 struct iwl_mvm_keyinfo {
264         __le16 key_flags;
265         u8 tkip_rx_tsc_byte2;
266         u8 reserved1;
267         __le16 tkip_rx_ttak[5];
268         u8 key_offset;
269         u8 reserved2;
270         u8 key[16];
271         __le64 tx_secur_seq_cnt;
272         __le64 hw_tkip_mic_rx_key;
273         __le64 hw_tkip_mic_tx_key;
274 } __packed;
275
276 #define IWL_ADD_STA_STATUS_MASK         0xFF
277 #define IWL_ADD_STA_BAID_VALID_MASK     0x8000
278 #define IWL_ADD_STA_BAID_MASK           0x7F00
279 #define IWL_ADD_STA_BAID_SHIFT          8
280
281 /**
282  * struct iwl_mvm_add_sta_cmd_v7 - Add/modify a station in the fw's sta table.
283  * ( REPLY_ADD_STA = 0x18 )
284  * @add_modify: see &enum iwl_sta_mode
285  * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
286  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
287  *      AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
288  * @mac_id_n_color: the Mac context this station belongs to,
289  *      see &enum iwl_ctxt_id_and_color
290  * @addr: station's MAC address
291  * @reserved2: reserved
292  * @sta_id: index of station in uCode's station table
293  * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
294  *      alone. 1 - modify, 0 - don't change.
295  * @reserved3: reserved
296  * @station_flags: look at &enum iwl_sta_flags
297  * @station_flags_msk: what of %station_flags have changed,
298  *      also &enum iwl_sta_flags
299  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
300  *      Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
301  *      add_immediate_ba_ssn.
302  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
303  *      Set %STA_MODIFY_REMOVE_BA_TID to use this field
304  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
305  *      add_immediate_ba_tid.
306  * @sleep_tx_count: number of packets to transmit to station even though it is
307  *      asleep. Used to synchronise PS-poll and u-APSD responses while ucode
308  *      keeps track of STA sleep state.
309  * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
310  * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
311  *      mac-addr.
312  * @beamform_flags: beam forming controls
313  * @tfd_queue_msk: tfd queues used by this station
314  *
315  * The device contains an internal table of per-station information, with info
316  * on security keys, aggregation parameters, and Tx rates for initial Tx
317  * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
318  *
319  * ADD_STA sets up the table entry for one station, either creating a new
320  * entry, or modifying a pre-existing one.
321  */
322 struct iwl_mvm_add_sta_cmd_v7 {
323         u8 add_modify;
324         u8 awake_acs;
325         __le16 tid_disable_tx;
326         __le32 mac_id_n_color;
327         u8 addr[ETH_ALEN];      /* _STA_ID_MODIFY_INFO_API_S_VER_1 */
328         __le16 reserved2;
329         u8 sta_id;
330         u8 modify_mask;
331         __le16 reserved3;
332         __le32 station_flags;
333         __le32 station_flags_msk;
334         u8 add_immediate_ba_tid;
335         u8 remove_immediate_ba_tid;
336         __le16 add_immediate_ba_ssn;
337         __le16 sleep_tx_count;
338         __le16 sleep_state_flags;
339         __le16 assoc_id;
340         __le16 beamform_flags;
341         __le32 tfd_queue_msk;
342 } __packed; /* ADD_STA_CMD_API_S_VER_7 */
343
344 /**
345  * enum iwl_sta_type - FW station types
346  * ( REPLY_ADD_STA = 0x18 )
347  * @IWL_STA_LINK: Link station - normal RX and TX traffic.
348  * @IWL_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons
349  *      and probe responses.
350  * @IWL_STA_MULTICAST: multicast traffic,
351  * @IWL_STA_TDLS_LINK: TDLS link station
352  * @IWL_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on).
353  */
354 enum iwl_sta_type {
355         IWL_STA_LINK,
356         IWL_STA_GENERAL_PURPOSE,
357         IWL_STA_MULTICAST,
358         IWL_STA_TDLS_LINK,
359         IWL_STA_AUX_ACTIVITY,
360 };
361
362 /**
363  * struct iwl_mvm_add_sta_cmd - Add/modify a station in the fw's sta table.
364  * ( REPLY_ADD_STA = 0x18 )
365  * @add_modify: see &enum iwl_sta_mode
366  * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
367  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
368  *      AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
369  * @mac_id_n_color: the Mac context this station belongs to,
370  *      see &enum iwl_ctxt_id_and_color
371  * @addr: station's MAC address
372  * @reserved2: reserved
373  * @sta_id: index of station in uCode's station table
374  * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
375  *      alone. 1 - modify, 0 - don't change.
376  * @reserved3: reserved
377  * @station_flags: look at &enum iwl_sta_flags
378  * @station_flags_msk: what of %station_flags have changed,
379  *      also &enum iwl_sta_flags
380  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
381  *      Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
382  *      add_immediate_ba_ssn.
383  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
384  *      Set %STA_MODIFY_REMOVE_BA_TID to use this field
385  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
386  *      add_immediate_ba_tid.
387  * @sleep_tx_count: number of packets to transmit to station even though it is
388  *      asleep. Used to synchronise PS-poll and u-APSD responses while ucode
389  *      keeps track of STA sleep state.
390  * @station_type: type of this station. See &enum iwl_sta_type.
391  * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
392  * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
393  *      mac-addr.
394  * @beamform_flags: beam forming controls
395  * @tfd_queue_msk: tfd queues used by this station.
396  *      Obselete for new TX API (9 and above).
397  * @rx_ba_window: aggregation window size
398  * @sp_length: the size of the SP as it appears in the WME IE
399  * @uapsd_acs:  4 LS bits are trigger enabled ACs, 4 MS bits are the deliver
400  *      enabled ACs.
401  *
402  * The device contains an internal table of per-station information, with info
403  * on security keys, aggregation parameters, and Tx rates for initial Tx
404  * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
405  *
406  * ADD_STA sets up the table entry for one station, either creating a new
407  * entry, or modifying a pre-existing one.
408  */
409 struct iwl_mvm_add_sta_cmd {
410         u8 add_modify;
411         u8 awake_acs;
412         __le16 tid_disable_tx;
413         __le32 mac_id_n_color;
414         u8 addr[ETH_ALEN];      /* _STA_ID_MODIFY_INFO_API_S_VER_1 */
415         __le16 reserved2;
416         u8 sta_id;
417         u8 modify_mask;
418         __le16 reserved3;
419         __le32 station_flags;
420         __le32 station_flags_msk;
421         u8 add_immediate_ba_tid;
422         u8 remove_immediate_ba_tid;
423         __le16 add_immediate_ba_ssn;
424         __le16 sleep_tx_count;
425         u8 sleep_state_flags;
426         u8 station_type;
427         __le16 assoc_id;
428         __le16 beamform_flags;
429         __le32 tfd_queue_msk;
430         __le16 rx_ba_window;
431         u8 sp_length;
432         u8 uapsd_acs;
433 } __packed; /* ADD_STA_CMD_API_S_VER_10 */
434
435 /**
436  * struct iwl_mvm_add_sta_key_common - add/modify sta key common part
437  * ( REPLY_ADD_STA_KEY = 0x17 )
438  * @sta_id: index of station in uCode's station table
439  * @key_offset: key offset in key storage
440  * @key_flags: type &enum iwl_sta_key_flag
441  * @key: key material data
442  * @rx_secur_seq_cnt: RX security sequence counter for the key
443  */
444 struct iwl_mvm_add_sta_key_common {
445         u8 sta_id;
446         u8 key_offset;
447         __le16 key_flags;
448         u8 key[32];
449         u8 rx_secur_seq_cnt[16];
450 } __packed;
451
452 /**
453  * struct iwl_mvm_add_sta_key_cmd_v1 - add/modify sta key
454  * @common: see &struct iwl_mvm_add_sta_key_common
455  * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
456  * @reserved: reserved
457  * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
458  */
459 struct iwl_mvm_add_sta_key_cmd_v1 {
460         struct iwl_mvm_add_sta_key_common common;
461         u8 tkip_rx_tsc_byte2;
462         u8 reserved;
463         __le16 tkip_rx_ttak[5];
464 } __packed; /* ADD_MODIFY_STA_KEY_API_S_VER_1 */
465
466 /**
467  * struct iwl_mvm_add_sta_key_cmd - add/modify sta key
468  * @common: see &struct iwl_mvm_add_sta_key_common
469  * @rx_mic_key: TKIP RX unicast or multicast key
470  * @tx_mic_key: TKIP TX key
471  * @transmit_seq_cnt: TSC, transmit packet number
472  */
473 struct iwl_mvm_add_sta_key_cmd {
474         struct iwl_mvm_add_sta_key_common common;
475         __le64 rx_mic_key;
476         __le64 tx_mic_key;
477         __le64 transmit_seq_cnt;
478 } __packed; /* ADD_MODIFY_STA_KEY_API_S_VER_2 */
479
480 /**
481  * enum iwl_mvm_add_sta_rsp_status - status in the response to ADD_STA command
482  * @ADD_STA_SUCCESS: operation was executed successfully
483  * @ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table
484  * @ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session
485  * @ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station that
486  *      doesn't exist.
487  */
488 enum iwl_mvm_add_sta_rsp_status {
489         ADD_STA_SUCCESS                 = 0x1,
490         ADD_STA_STATIONS_OVERLOAD       = 0x2,
491         ADD_STA_IMMEDIATE_BA_FAILURE    = 0x4,
492         ADD_STA_MODIFY_NON_EXISTING_STA = 0x8,
493 };
494
495 /**
496  * struct iwl_mvm_rm_sta_cmd - Add / modify a station in the fw's station table
497  * ( REMOVE_STA = 0x19 )
498  * @sta_id: the station id of the station to be removed
499  * @reserved: reserved
500  */
501 struct iwl_mvm_rm_sta_cmd {
502         u8 sta_id;
503         u8 reserved[3];
504 } __packed; /* REMOVE_STA_CMD_API_S_VER_2 */
505
506 /**
507  * struct iwl_mvm_mgmt_mcast_key_cmd_v1
508  * ( MGMT_MCAST_KEY = 0x1f )
509  * @ctrl_flags: &enum iwl_sta_key_flag
510  * @igtk: IGTK key material
511  * @k1: unused
512  * @k2: unused
513  * @sta_id: station ID that support IGTK
514  * @key_id: key ID
515  * @receive_seq_cnt: initial RSC/PN needed for replay check
516  */
517 struct iwl_mvm_mgmt_mcast_key_cmd_v1 {
518         __le32 ctrl_flags;
519         u8 igtk[16];
520         u8 k1[16];
521         u8 k2[16];
522         __le32 key_id;
523         __le32 sta_id;
524         __le64 receive_seq_cnt;
525 } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */
526
527 /**
528  * struct iwl_mvm_mgmt_mcast_key_cmd
529  * ( MGMT_MCAST_KEY = 0x1f )
530  * @ctrl_flags: &enum iwl_sta_key_flag
531  * @igtk: IGTK master key
532  * @sta_id: station ID that support IGTK
533  * @key_id: key ID
534  * @receive_seq_cnt: initial RSC/PN needed for replay check
535  */
536 struct iwl_mvm_mgmt_mcast_key_cmd {
537         __le32 ctrl_flags;
538         u8 igtk[32];
539         __le32 key_id;
540         __le32 sta_id;
541         __le64 receive_seq_cnt;
542 } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_2 */
543
544 struct iwl_mvm_wep_key {
545         u8 key_index;
546         u8 key_offset;
547         __le16 reserved1;
548         u8 key_size;
549         u8 reserved2[3];
550         u8 key[16];
551 } __packed;
552
553 struct iwl_mvm_wep_key_cmd {
554         __le32 mac_id_n_color;
555         u8 num_keys;
556         u8 decryption_type;
557         u8 flags;
558         u8 reserved;
559         struct iwl_mvm_wep_key wep_key[0];
560 } __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */
561
562 /**
563  * struct iwl_mvm_eosp_notification - EOSP notification from firmware
564  * @remain_frame_count: # of frames remaining, non-zero if SP was cut
565  *      short by GO absence
566  * @sta_id: station ID
567  */
568 struct iwl_mvm_eosp_notification {
569         __le32 remain_frame_count;
570         __le32 sta_id;
571 } __packed; /* UAPSD_EOSP_NTFY_API_S_VER_1 */
572
573 #endif /* __iwl_fw_api_sta_h__ */