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