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 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 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: STA_MODIFY_*, selects which parameters to modify vs. leave
292  *	alone. 1 - modify, 0 - don't change.
293  * @reserved3: reserved
294  * @station_flags: look at &enum iwl_sta_flags
295  * @station_flags_msk: what of %station_flags have changed,
296  *	also &enum iwl_sta_flags
297  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
298  *	Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
299  *	add_immediate_ba_ssn.
300  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
301  *	Set %STA_MODIFY_REMOVE_BA_TID to use this field
302  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
303  *	add_immediate_ba_tid.
304  * @sleep_tx_count: number of packets to transmit to station even though it is
305  *	asleep. Used to synchronise PS-poll and u-APSD responses while ucode
306  *	keeps track of STA sleep state.
307  * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
308  * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
309  *	mac-addr.
310  * @beamform_flags: beam forming controls
311  * @tfd_queue_msk: tfd queues used by this station
312  *
313  * The device contains an internal table of per-station information, with info
314  * on security keys, aggregation parameters, and Tx rates for initial Tx
315  * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
316  *
317  * ADD_STA sets up the table entry for one station, either creating a new
318  * entry, or modifying a pre-existing one.
319  */
320 struct iwl_mvm_add_sta_cmd_v7 {
321 	u8 add_modify;
322 	u8 awake_acs;
323 	__le16 tid_disable_tx;
324 	__le32 mac_id_n_color;
325 	u8 addr[ETH_ALEN];	/* _STA_ID_MODIFY_INFO_API_S_VER_1 */
326 	__le16 reserved2;
327 	u8 sta_id;
328 	u8 modify_mask;
329 	__le16 reserved3;
330 	__le32 station_flags;
331 	__le32 station_flags_msk;
332 	u8 add_immediate_ba_tid;
333 	u8 remove_immediate_ba_tid;
334 	__le16 add_immediate_ba_ssn;
335 	__le16 sleep_tx_count;
336 	__le16 sleep_state_flags;
337 	__le16 assoc_id;
338 	__le16 beamform_flags;
339 	__le32 tfd_queue_msk;
340 } __packed; /* ADD_STA_CMD_API_S_VER_7 */
341 
342 /**
343  * enum iwl_sta_type - FW station types
344  * ( REPLY_ADD_STA = 0x18 )
345  * @IWL_STA_LINK: Link station - normal RX and TX traffic.
346  * @IWL_STA_GENERAL_PURPOSE: General purpose. In AP mode used for beacons
347  *	and probe responses.
348  * @IWL_STA_MULTICAST: multicast traffic,
349  * @IWL_STA_TDLS_LINK: TDLS link station
350  * @IWL_STA_AUX_ACTIVITY: auxilary station (scan, ROC and so on).
351  */
352 enum iwl_sta_type {
353 	IWL_STA_LINK,
354 	IWL_STA_GENERAL_PURPOSE,
355 	IWL_STA_MULTICAST,
356 	IWL_STA_TDLS_LINK,
357 	IWL_STA_AUX_ACTIVITY,
358 };
359 
360 /**
361  * struct iwl_mvm_add_sta_cmd - Add/modify a station in the fw's sta table.
362  * ( REPLY_ADD_STA = 0x18 )
363  * @add_modify: see &enum iwl_sta_mode
364  * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
365  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
366  *	AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
367  * @mac_id_n_color: the Mac context this station belongs to,
368  *	see &enum iwl_ctxt_id_and_color
369  * @addr: station's MAC address
370  * @reserved2: reserved
371  * @sta_id: index of station in uCode's station table
372  * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
373  *	alone. 1 - modify, 0 - don't change.
374  * @reserved3: reserved
375  * @station_flags: look at &enum iwl_sta_flags
376  * @station_flags_msk: what of %station_flags have changed,
377  *	also &enum iwl_sta_flags
378  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
379  *	Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
380  *	add_immediate_ba_ssn.
381  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
382  *	Set %STA_MODIFY_REMOVE_BA_TID to use this field
383  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
384  *	add_immediate_ba_tid.
385  * @sleep_tx_count: number of packets to transmit to station even though it is
386  *	asleep. Used to synchronise PS-poll and u-APSD responses while ucode
387  *	keeps track of STA sleep state.
388  * @station_type: type of this station. See &enum iwl_sta_type.
389  * @sleep_state_flags: Look at &enum iwl_sta_sleep_flag.
390  * @assoc_id: assoc_id to be sent in VHT PLCP (9-bit), for grp use 0, for AP
391  *	mac-addr.
392  * @beamform_flags: beam forming controls
393  * @tfd_queue_msk: tfd queues used by this station.
394  *	Obselete for new TX API (9 and above).
395  * @rx_ba_window: aggregation window size
396  * @sp_length: the size of the SP in actual number of frames
397  * @uapsd_acs:  4 LS bits are trigger enabled ACs, 4 MS bits are the deliver
398  *	enabled ACs.
399  *
400  * The device contains an internal table of per-station information, with info
401  * on security keys, aggregation parameters, and Tx rates for initial Tx
402  * attempt and any retries (set by REPLY_TX_LINK_QUALITY_CMD).
403  *
404  * ADD_STA sets up the table entry for one station, either creating a new
405  * entry, or modifying a pre-existing one.
406  */
407 struct iwl_mvm_add_sta_cmd {
408 	u8 add_modify;
409 	u8 awake_acs;
410 	__le16 tid_disable_tx;
411 	__le32 mac_id_n_color;
412 	u8 addr[ETH_ALEN];	/* _STA_ID_MODIFY_INFO_API_S_VER_1 */
413 	__le16 reserved2;
414 	u8 sta_id;
415 	u8 modify_mask;
416 	__le16 reserved3;
417 	__le32 station_flags;
418 	__le32 station_flags_msk;
419 	u8 add_immediate_ba_tid;
420 	u8 remove_immediate_ba_tid;
421 	__le16 add_immediate_ba_ssn;
422 	__le16 sleep_tx_count;
423 	u8 sleep_state_flags;
424 	u8 station_type;
425 	__le16 assoc_id;
426 	__le16 beamform_flags;
427 	__le32 tfd_queue_msk;
428 	__le16 rx_ba_window;
429 	u8 sp_length;
430 	u8 uapsd_acs;
431 } __packed; /* ADD_STA_CMD_API_S_VER_10 */
432 
433 /**
434  * struct iwl_mvm_add_sta_key_common - add/modify sta key common part
435  * ( REPLY_ADD_STA_KEY = 0x17 )
436  * @sta_id: index of station in uCode's station table
437  * @key_offset: key offset in key storage
438  * @key_flags: type &enum iwl_sta_key_flag
439  * @key: key material data
440  * @rx_secur_seq_cnt: RX security sequence counter for the key
441  */
442 struct iwl_mvm_add_sta_key_common {
443 	u8 sta_id;
444 	u8 key_offset;
445 	__le16 key_flags;
446 	u8 key[32];
447 	u8 rx_secur_seq_cnt[16];
448 } __packed;
449 
450 /**
451  * struct iwl_mvm_add_sta_key_cmd_v1 - add/modify sta key
452  * @common: see &struct iwl_mvm_add_sta_key_common
453  * @tkip_rx_tsc_byte2: TSC[2] for key mix ph1 detection
454  * @reserved: reserved
455  * @tkip_rx_ttak: 10-byte unicast TKIP TTAK for Rx
456  */
457 struct iwl_mvm_add_sta_key_cmd_v1 {
458 	struct iwl_mvm_add_sta_key_common common;
459 	u8 tkip_rx_tsc_byte2;
460 	u8 reserved;
461 	__le16 tkip_rx_ttak[5];
462 } __packed; /* ADD_MODIFY_STA_KEY_API_S_VER_1 */
463 
464 /**
465  * struct iwl_mvm_add_sta_key_cmd - add/modify sta key
466  * @common: see &struct iwl_mvm_add_sta_key_common
467  * @rx_mic_key: TKIP RX unicast or multicast key
468  * @tx_mic_key: TKIP TX key
469  * @transmit_seq_cnt: TSC, transmit packet number
470  */
471 struct iwl_mvm_add_sta_key_cmd {
472 	struct iwl_mvm_add_sta_key_common common;
473 	__le64 rx_mic_key;
474 	__le64 tx_mic_key;
475 	__le64 transmit_seq_cnt;
476 } __packed; /* ADD_MODIFY_STA_KEY_API_S_VER_2 */
477 
478 /**
479  * enum iwl_mvm_add_sta_rsp_status - status in the response to ADD_STA command
480  * @ADD_STA_SUCCESS: operation was executed successfully
481  * @ADD_STA_STATIONS_OVERLOAD: no room left in the fw's station table
482  * @ADD_STA_IMMEDIATE_BA_FAILURE: can't add Rx block ack session
483  * @ADD_STA_MODIFY_NON_EXISTING_STA: driver requested to modify a station that
484  *	doesn't exist.
485  */
486 enum iwl_mvm_add_sta_rsp_status {
487 	ADD_STA_SUCCESS			= 0x1,
488 	ADD_STA_STATIONS_OVERLOAD	= 0x2,
489 	ADD_STA_IMMEDIATE_BA_FAILURE	= 0x4,
490 	ADD_STA_MODIFY_NON_EXISTING_STA	= 0x8,
491 };
492 
493 /**
494  * struct iwl_mvm_rm_sta_cmd - Add / modify a station in the fw's station table
495  * ( REMOVE_STA = 0x19 )
496  * @sta_id: the station id of the station to be removed
497  * @reserved: reserved
498  */
499 struct iwl_mvm_rm_sta_cmd {
500 	u8 sta_id;
501 	u8 reserved[3];
502 } __packed; /* REMOVE_STA_CMD_API_S_VER_2 */
503 
504 /**
505  * struct iwl_mvm_mgmt_mcast_key_cmd_v1
506  * ( MGMT_MCAST_KEY = 0x1f )
507  * @ctrl_flags: &enum iwl_sta_key_flag
508  * @igtk: IGTK key material
509  * @k1: unused
510  * @k2: unused
511  * @sta_id: station ID that support IGTK
512  * @key_id: key ID
513  * @receive_seq_cnt: initial RSC/PN needed for replay check
514  */
515 struct iwl_mvm_mgmt_mcast_key_cmd_v1 {
516 	__le32 ctrl_flags;
517 	u8 igtk[16];
518 	u8 k1[16];
519 	u8 k2[16];
520 	__le32 key_id;
521 	__le32 sta_id;
522 	__le64 receive_seq_cnt;
523 } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_1 */
524 
525 /**
526  * struct iwl_mvm_mgmt_mcast_key_cmd
527  * ( MGMT_MCAST_KEY = 0x1f )
528  * @ctrl_flags: &enum iwl_sta_key_flag
529  * @igtk: IGTK master key
530  * @sta_id: station ID that support IGTK
531  * @key_id: key ID
532  * @receive_seq_cnt: initial RSC/PN needed for replay check
533  */
534 struct iwl_mvm_mgmt_mcast_key_cmd {
535 	__le32 ctrl_flags;
536 	u8 igtk[32];
537 	__le32 key_id;
538 	__le32 sta_id;
539 	__le64 receive_seq_cnt;
540 } __packed; /* SEC_MGMT_MULTICAST_KEY_CMD_API_S_VER_2 */
541 
542 struct iwl_mvm_wep_key {
543 	u8 key_index;
544 	u8 key_offset;
545 	__le16 reserved1;
546 	u8 key_size;
547 	u8 reserved2[3];
548 	u8 key[16];
549 } __packed;
550 
551 struct iwl_mvm_wep_key_cmd {
552 	__le32 mac_id_n_color;
553 	u8 num_keys;
554 	u8 decryption_type;
555 	u8 flags;
556 	u8 reserved;
557 	struct iwl_mvm_wep_key wep_key[0];
558 } __packed; /* SEC_CURR_WEP_KEY_CMD_API_S_VER_2 */
559 
560 /**
561  * struct iwl_mvm_eosp_notification - EOSP notification from firmware
562  * @remain_frame_count: # of frames remaining, non-zero if SP was cut
563  *	short by GO absence
564  * @sta_id: station ID
565  */
566 struct iwl_mvm_eosp_notification {
567 	__le32 remain_frame_count;
568 	__le32 sta_id;
569 } __packed; /* UAPSD_EOSP_NTFY_API_S_VER_1 */
570 
571 #endif /* __iwl_fw_api_sta_h__ */
572