xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/sta.h (revision 6fdcba32711044c35c0e1b094cbd8f3f0b4472c9)
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  * Copyright(c) 2018 - 2019 Intel Corporation
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of version 2 of the GNU General Public License as
15  * published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * General Public License for more details.
21  *
22  * The full GNU General Public License is included in this distribution
23  * in the file called COPYING.
24  *
25  * Contact Information:
26  *  Intel Linux Wireless <linuxwifi@intel.com>
27  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28  *
29  * BSD LICENSE
30  *
31  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
32  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
33  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
34  * Copyright(c) 2018 - 2019 Intel Corporation
35  * All rights reserved.
36  *
37  * Redistribution and use in source and binary forms, with or without
38  * modification, are permitted provided that the following conditions
39  * are met:
40  *
41  *  * Redistributions of source code must retain the above copyright
42  *    notice, this list of conditions and the following disclaimer.
43  *  * Redistributions in binary form must reproduce the above copyright
44  *    notice, this list of conditions and the following disclaimer in
45  *    the documentation and/or other materials provided with the
46  *    distribution.
47  *  * Neither the name Intel Corporation nor the names of its
48  *    contributors may be used to endorse or promote products derived
49  *    from this software without specific prior written permission.
50  *
51  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
54  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
55  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
56  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
57  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
58  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
59  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
60  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62  *****************************************************************************/
63 
64 #ifndef __iwl_fw_api_sta_h__
65 #define __iwl_fw_api_sta_h__
66 
67 /**
68  * enum iwl_sta_flags - flags for the ADD_STA host command
69  * @STA_FLG_REDUCED_TX_PWR_CTRL: reduced TX power (control frames)
70  * @STA_FLG_REDUCED_TX_PWR_DATA: reduced TX power (data frames)
71  * @STA_FLG_DISABLE_TX: set if TX should be disabled
72  * @STA_FLG_PS: set if STA is in Power Save
73  * @STA_FLG_DRAIN_FLOW: drain flow
74  * @STA_FLG_PAN: STA is for PAN interface
75  * @STA_FLG_CLASS_AUTH: station is authenticated
76  * @STA_FLG_CLASS_ASSOC: station is associated
77  * @STA_FLG_RTS_MIMO_PROT: station requires RTS MIMO protection (dynamic SMPS)
78  * @STA_FLG_MAX_AGG_SIZE_MSK: maximal size for A-MPDU (mask)
79  * @STA_FLG_MAX_AGG_SIZE_SHIFT: maximal size for A-MPDU (bit shift)
80  * @STA_FLG_MAX_AGG_SIZE_8K: maximal size for A-MPDU (8k supported)
81  * @STA_FLG_MAX_AGG_SIZE_16K: maximal size for A-MPDU (16k supported)
82  * @STA_FLG_MAX_AGG_SIZE_32K: maximal size for A-MPDU (32k supported)
83  * @STA_FLG_MAX_AGG_SIZE_64K: maximal size for A-MPDU (64k supported)
84  * @STA_FLG_MAX_AGG_SIZE_128K: maximal size for A-MPDU (128k supported)
85  * @STA_FLG_MAX_AGG_SIZE_256K: maximal size for A-MPDU (256k supported)
86  * @STA_FLG_MAX_AGG_SIZE_512K: maximal size for A-MPDU (512k supported)
87  * @STA_FLG_MAX_AGG_SIZE_1024K: maximal size for A-MPDU (1024k supported)
88  * @STA_FLG_AGG_MPDU_DENS_MSK: maximal MPDU density for Tx aggregation
89  * @STA_FLG_FAT_EN_MSK: support for channel width (for Tx). This flag is
90  *	initialised by driver and can be updated by fw upon reception of
91  *	action frames that can change the channel width. When cleared the fw
92  *	will send all the frames in 20MHz even when FAT channel is requested.
93  * @STA_FLG_FAT_EN_20MHZ: no wide channels are supported, only 20 MHz
94  * @STA_FLG_FAT_EN_40MHZ: wide channels up to 40 MHz supported
95  * @STA_FLG_FAT_EN_80MHZ: wide channels up to 80 MHz supported
96  * @STA_FLG_FAT_EN_160MHZ: wide channels up to 160 MHz supported
97  * @STA_FLG_MIMO_EN_MSK: support for MIMO. This flag is initialised by the
98  *	driver and can be updated by fw upon reception of action frames.
99  * @STA_FLG_MIMO_EN_SISO: no support for MIMO
100  * @STA_FLG_MIMO_EN_MIMO2: 2 streams supported
101  * @STA_FLG_MIMO_EN_MIMO3: 3 streams supported
102  * @STA_FLG_AGG_MPDU_DENS_MSK: A-MPDU density (mask)
103  * @STA_FLG_AGG_MPDU_DENS_SHIFT: A-MPDU density (bit shift)
104  * @STA_FLG_AGG_MPDU_DENS_2US: A-MPDU density (2 usec gap)
105  * @STA_FLG_AGG_MPDU_DENS_4US: A-MPDU density (4 usec gap)
106  * @STA_FLG_AGG_MPDU_DENS_8US: A-MPDU density (8 usec gap)
107  * @STA_FLG_AGG_MPDU_DENS_16US: A-MPDU density (16 usec gap)
108  */
109 enum iwl_sta_flags {
110 	STA_FLG_REDUCED_TX_PWR_CTRL	= BIT(3),
111 	STA_FLG_REDUCED_TX_PWR_DATA	= BIT(6),
112 
113 	STA_FLG_DISABLE_TX		= BIT(4),
114 
115 	STA_FLG_PS			= BIT(8),
116 	STA_FLG_DRAIN_FLOW		= BIT(12),
117 	STA_FLG_PAN			= BIT(13),
118 	STA_FLG_CLASS_AUTH		= BIT(14),
119 	STA_FLG_CLASS_ASSOC		= BIT(15),
120 	STA_FLG_RTS_MIMO_PROT		= BIT(17),
121 
122 	STA_FLG_MAX_AGG_SIZE_SHIFT	= 19,
123 	STA_FLG_MAX_AGG_SIZE_8K		= (0 << STA_FLG_MAX_AGG_SIZE_SHIFT),
124 	STA_FLG_MAX_AGG_SIZE_16K	= (1 << STA_FLG_MAX_AGG_SIZE_SHIFT),
125 	STA_FLG_MAX_AGG_SIZE_32K	= (2 << STA_FLG_MAX_AGG_SIZE_SHIFT),
126 	STA_FLG_MAX_AGG_SIZE_64K	= (3 << STA_FLG_MAX_AGG_SIZE_SHIFT),
127 	STA_FLG_MAX_AGG_SIZE_128K	= (4 << STA_FLG_MAX_AGG_SIZE_SHIFT),
128 	STA_FLG_MAX_AGG_SIZE_256K	= (5 << STA_FLG_MAX_AGG_SIZE_SHIFT),
129 	STA_FLG_MAX_AGG_SIZE_512K	= (6 << STA_FLG_MAX_AGG_SIZE_SHIFT),
130 	STA_FLG_MAX_AGG_SIZE_1024K	= (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
131 	STA_FLG_MAX_AGG_SIZE_MSK	= (7 << STA_FLG_MAX_AGG_SIZE_SHIFT),
132 
133 	STA_FLG_AGG_MPDU_DENS_SHIFT	= 23,
134 	STA_FLG_AGG_MPDU_DENS_2US	= (4 << STA_FLG_AGG_MPDU_DENS_SHIFT),
135 	STA_FLG_AGG_MPDU_DENS_4US	= (5 << STA_FLG_AGG_MPDU_DENS_SHIFT),
136 	STA_FLG_AGG_MPDU_DENS_8US	= (6 << STA_FLG_AGG_MPDU_DENS_SHIFT),
137 	STA_FLG_AGG_MPDU_DENS_16US	= (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
138 	STA_FLG_AGG_MPDU_DENS_MSK	= (7 << STA_FLG_AGG_MPDU_DENS_SHIFT),
139 
140 	STA_FLG_FAT_EN_20MHZ		= (0 << 26),
141 	STA_FLG_FAT_EN_40MHZ		= (1 << 26),
142 	STA_FLG_FAT_EN_80MHZ		= (2 << 26),
143 	STA_FLG_FAT_EN_160MHZ		= (3 << 26),
144 	STA_FLG_FAT_EN_MSK		= (3 << 26),
145 
146 	STA_FLG_MIMO_EN_SISO		= (0 << 28),
147 	STA_FLG_MIMO_EN_MIMO2		= (1 << 28),
148 	STA_FLG_MIMO_EN_MIMO3		= (2 << 28),
149 	STA_FLG_MIMO_EN_MSK		= (3 << 28),
150 };
151 
152 /**
153  * enum iwl_sta_key_flag - key flags for the ADD_STA host command
154  * @STA_KEY_FLG_NO_ENC: no encryption
155  * @STA_KEY_FLG_WEP: WEP encryption algorithm
156  * @STA_KEY_FLG_CCM: CCMP encryption algorithm
157  * @STA_KEY_FLG_TKIP: TKIP encryption algorithm
158  * @STA_KEY_FLG_EXT: extended cipher algorithm (depends on the FW support)
159  * @STA_KEY_FLG_GCMP: GCMP encryption algorithm
160  * @STA_KEY_FLG_CMAC: CMAC encryption algorithm
161  * @STA_KEY_FLG_ENC_UNKNOWN: unknown encryption algorithm
162  * @STA_KEY_FLG_EN_MSK: mask for encryption algorithmi value
163  * @STA_KEY_FLG_WEP_KEY_MAP: wep is either a group key (0 - legacy WEP) or from
164  *	station info array (1 - n 1X mode)
165  * @STA_KEY_FLG_KEYID_MSK: the index of the key
166  * @STA_KEY_FLG_KEYID_POS: key index bit position
167  * @STA_KEY_NOT_VALID: key is invalid
168  * @STA_KEY_FLG_WEP_13BYTES: set for 13 bytes WEP key
169  * @STA_KEY_FLG_KEY_32BYTES: for non-wep key set for 32 bytes key
170  * @STA_KEY_MULTICAST: set for multical key
171  * @STA_KEY_MFP: key is used for Management Frame Protection
172  */
173 enum iwl_sta_key_flag {
174 	STA_KEY_FLG_NO_ENC		= (0 << 0),
175 	STA_KEY_FLG_WEP			= (1 << 0),
176 	STA_KEY_FLG_CCM			= (2 << 0),
177 	STA_KEY_FLG_TKIP		= (3 << 0),
178 	STA_KEY_FLG_EXT			= (4 << 0),
179 	STA_KEY_FLG_GCMP		= (5 << 0),
180 	STA_KEY_FLG_CMAC		= (6 << 0),
181 	STA_KEY_FLG_ENC_UNKNOWN		= (7 << 0),
182 	STA_KEY_FLG_EN_MSK		= (7 << 0),
183 
184 	STA_KEY_FLG_WEP_KEY_MAP		= BIT(3),
185 	STA_KEY_FLG_KEYID_POS		 = 8,
186 	STA_KEY_FLG_KEYID_MSK		= (3 << STA_KEY_FLG_KEYID_POS),
187 	STA_KEY_NOT_VALID		= BIT(11),
188 	STA_KEY_FLG_WEP_13BYTES		= BIT(12),
189 	STA_KEY_FLG_KEY_32BYTES		= BIT(12),
190 	STA_KEY_MULTICAST		= BIT(14),
191 	STA_KEY_MFP			= BIT(15),
192 };
193 
194 /**
195  * enum iwl_sta_modify_flag - indicate to the fw what flag are being changed
196  * @STA_MODIFY_QUEUE_REMOVAL: this command removes a queue
197  * @STA_MODIFY_TID_DISABLE_TX: this command modifies %tid_disable_tx
198  * @STA_MODIFY_UAPSD_ACS: this command modifies %uapsd_acs
199  * @STA_MODIFY_ADD_BA_TID: this command modifies %add_immediate_ba_tid
200  * @STA_MODIFY_REMOVE_BA_TID: this command modifies %remove_immediate_ba_tid
201  * @STA_MODIFY_SLEEPING_STA_TX_COUNT: this command modifies %sleep_tx_count
202  * @STA_MODIFY_PROT_TH: modify RTS threshold
203  * @STA_MODIFY_QUEUES: modify the queues used by this station
204  */
205 enum iwl_sta_modify_flag {
206 	STA_MODIFY_QUEUE_REMOVAL		= BIT(0),
207 	STA_MODIFY_TID_DISABLE_TX		= BIT(1),
208 	STA_MODIFY_UAPSD_ACS			= BIT(2),
209 	STA_MODIFY_ADD_BA_TID			= BIT(3),
210 	STA_MODIFY_REMOVE_BA_TID		= BIT(4),
211 	STA_MODIFY_SLEEPING_STA_TX_COUNT	= BIT(5),
212 	STA_MODIFY_PROT_TH			= BIT(6),
213 	STA_MODIFY_QUEUES			= BIT(7),
214 };
215 
216 /**
217  * enum iwl_sta_mode - station command mode
218  * @STA_MODE_ADD: add new station
219  * @STA_MODE_MODIFY: modify the station
220  */
221 enum iwl_sta_mode {
222 	STA_MODE_ADD	= 0,
223 	STA_MODE_MODIFY	= 1,
224 };
225 
226 /**
227  * enum iwl_sta_sleep_flag - type of sleep of the station
228  * @STA_SLEEP_STATE_AWAKE: station is awake
229  * @STA_SLEEP_STATE_PS_POLL: station is PS-polling
230  * @STA_SLEEP_STATE_UAPSD: station uses U-APSD
231  * @STA_SLEEP_STATE_MOREDATA: set more-data bit on
232  *	(last) released frame
233  */
234 enum iwl_sta_sleep_flag {
235 	STA_SLEEP_STATE_AWAKE		= 0,
236 	STA_SLEEP_STATE_PS_POLL		= BIT(0),
237 	STA_SLEEP_STATE_UAPSD		= BIT(1),
238 	STA_SLEEP_STATE_MOREDATA	= BIT(2),
239 };
240 
241 #define STA_KEY_MAX_NUM (16)
242 #define STA_KEY_IDX_INVALID (0xff)
243 #define STA_KEY_MAX_DATA_KEY_NUM (4)
244 #define IWL_MAX_GLOBAL_KEYS (4)
245 #define STA_KEY_LEN_WEP40 (5)
246 #define STA_KEY_LEN_WEP104 (13)
247 
248 /**
249  * struct iwl_mvm_keyinfo - key information
250  * @key_flags: type &enum iwl_sta_key_flag
251  * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
252  * @reserved1: reserved
253  * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
254  * @key_offset: key offset in the fw's key table
255  * @reserved2: reserved
256  * @key: 16-byte unicast decryption key
257  * @tx_secur_seq_cnt: initial RSC / PN needed for replay check
258  * @hw_tkip_mic_rx_key: byte: MIC Rx Key - used for TKIP only
259  * @hw_tkip_mic_tx_key: byte: MIC Tx Key - used for TKIP only
260  */
261 struct iwl_mvm_keyinfo {
262 	__le16 key_flags;
263 	u8 tkip_rx_tsc_byte2;
264 	u8 reserved1;
265 	__le16 tkip_rx_ttak[5];
266 	u8 key_offset;
267 	u8 reserved2;
268 	u8 key[16];
269 	__le64 tx_secur_seq_cnt;
270 	__le64 hw_tkip_mic_rx_key;
271 	__le64 hw_tkip_mic_tx_key;
272 } __packed;
273 
274 #define IWL_ADD_STA_STATUS_MASK		0xFF
275 #define IWL_ADD_STA_BAID_VALID_MASK	0x8000
276 #define IWL_ADD_STA_BAID_MASK		0x7F00
277 #define IWL_ADD_STA_BAID_SHIFT		8
278 
279 /**
280  * struct iwl_mvm_add_sta_cmd_v7 - Add/modify a station in the fw's sta table.
281  * ( REPLY_ADD_STA = 0x18 )
282  * @add_modify: see &enum iwl_sta_mode
283  * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
284  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
285  *	AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
286  * @mac_id_n_color: the Mac context this station belongs to,
287  *	see &enum iwl_ctxt_id_and_color
288  * @addr: station's MAC address
289  * @reserved2: reserved
290  * @sta_id: index of station in uCode's station table
291  * @modify_mask: from &enum iwl_sta_modify_flag, selects what to change
292  * @reserved3: reserved
293  * @station_flags: look at &enum iwl_sta_flags
294  * @station_flags_msk: what of %station_flags have changed,
295  *	also &enum iwl_sta_flags
296  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
297  *	Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
298  *	add_immediate_ba_ssn.
299  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
300  *	Set %STA_MODIFY_REMOVE_BA_TID to use this field
301  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
302  *	add_immediate_ba_tid.
303  * @sleep_tx_count: number of packets to transmit to station even though it is
304  *	asleep. Used to synchronise PS-poll and u-APSD responses while ucode
305  *	keeps track of STA sleep state.
306  * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
307  * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
308  *	mac-addr.
309  * @beamform_flags: beam forming controls
310  * @tfd_queue_msk: tfd queues used by this station
311  *
312  * The device contains an internal table of per-station information, with info
313  * on security keys, aggregation parameters, and Tx rates for initial Tx
314  * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
315  *
316  * ADD_STA sets up the table entry for one station, either creating a new
317  * entry, or modifying a pre-existing one.
318  */
319 struct iwl_mvm_add_sta_cmd_v7 {
320 	u8 add_modify;
321 	u8 awake_acs;
322 	__le16 tid_disable_tx;
323 	__le32 mac_id_n_color;
324 	u8 addr[ETH_ALEN];	/* _STA_ID_MODIFY_INFO_API_S_VER_1 */
325 	__le16 reserved2;
326 	u8 sta_id;
327 	u8 modify_mask;
328 	__le16 reserved3;
329 	__le32 station_flags;
330 	__le32 station_flags_msk;
331 	u8 add_immediate_ba_tid;
332 	u8 remove_immediate_ba_tid;
333 	__le16 add_immediate_ba_ssn;
334 	__le16 sleep_tx_count;
335 	__le16 sleep_state_flags;
336 	__le16 assoc_id;
337 	__le16 beamform_flags;
338 	__le32 tfd_queue_msk;
339 } __packed; /* ADD_STA_CMD_API_S_VER_7 */
340 
341 /**
342  * enum iwl_sta_type - FW station types
343  * ( REPLY_ADD_STA = 0x18 )
344  * @IWL_STA_LINK: Link station - normal RX and TX traffic.
345  * @IWL_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons
346  *	and probe responses.
347  * @IWL_STA_MULTICAST: multicast traffic,
348  * @IWL_STA_TDLS_LINK: TDLS link station
349  * @IWL_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on).
350  */
351 enum iwl_sta_type {
352 	IWL_STA_LINK,
353 	IWL_STA_GENERAL_PURPOSE,
354 	IWL_STA_MULTICAST,
355 	IWL_STA_TDLS_LINK,
356 	IWL_STA_AUX_ACTIVITY,
357 };
358 
359 /**
360  * struct iwl_mvm_add_sta_cmd - Add/modify a station in the fw's sta table.
361  * ( REPLY_ADD_STA = 0x18 )
362  * @add_modify: see &enum iwl_sta_mode
363  * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
364  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
365  *	AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
366  * @mac_id_n_color: the Mac context this station belongs to,
367  *	see &enum iwl_ctxt_id_and_color
368  * @addr: station's MAC address
369  * @reserved2: reserved
370  * @sta_id: index of station in uCode's station table
371  * @modify_mask: from &enum iwl_sta_modify_flag, selects what to 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 in actual number of frames
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