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