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