1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
4  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_datapath_h__
8 #define __iwl_fw_api_datapath_h__
9 
10 /**
11  * enum iwl_data_path_subcmd_ids - data path group commands
12  */
13 enum iwl_data_path_subcmd_ids {
14 	/**
15 	 * @DQA_ENABLE_CMD: &struct iwl_dqa_enable_cmd
16 	 */
17 	DQA_ENABLE_CMD = 0x0,
18 
19 	/**
20 	 * @UPDATE_MU_GROUPS_CMD: &struct iwl_mu_group_mgmt_cmd
21 	 */
22 	UPDATE_MU_GROUPS_CMD = 0x1,
23 
24 	/**
25 	 * @TRIGGER_RX_QUEUES_NOTIF_CMD: &struct iwl_rxq_sync_cmd
26 	 */
27 	TRIGGER_RX_QUEUES_NOTIF_CMD = 0x2,
28 
29 	/**
30 	 * @STA_HE_CTXT_CMD: &struct iwl_he_sta_context_cmd
31 	 */
32 	STA_HE_CTXT_CMD = 0x7,
33 
34 	/**
35 	 * @RLC_CONFIG_CMD: &struct iwl_rlc_config_cmd
36 	 */
37 	RLC_CONFIG_CMD = 0x8,
38 
39 	/**
40 	 * @RFH_QUEUE_CONFIG_CMD: &struct iwl_rfh_queue_config
41 	 */
42 	RFH_QUEUE_CONFIG_CMD = 0xD,
43 
44 	/**
45 	 * @TLC_MNG_CONFIG_CMD: &struct iwl_tlc_config_cmd_v4
46 	 */
47 	TLC_MNG_CONFIG_CMD = 0xF,
48 
49 	/**
50 	 * @HE_AIR_SNIFFER_CONFIG_CMD: &struct iwl_he_monitor_cmd
51 	 */
52 	HE_AIR_SNIFFER_CONFIG_CMD = 0x13,
53 
54 	/**
55 	 * @CHEST_COLLECTOR_FILTER_CONFIG_CMD: Configure the CSI
56 	 *	matrix collection, uses &struct iwl_channel_estimation_cfg
57 	 */
58 	CHEST_COLLECTOR_FILTER_CONFIG_CMD = 0x14,
59 
60 	/**
61 	 * @RX_BAID_ALLOCATION_CONFIG_CMD: Allocate/deallocate a BAID for an RX
62 	 *	blockack session, uses &struct iwl_rx_baid_cfg_cmd for the
63 	 *	command, and &struct iwl_rx_baid_cfg_resp as a response.
64 	 */
65 	RX_BAID_ALLOCATION_CONFIG_CMD = 0x16,
66 
67 	/**
68 	 * @SCD_QUEUE_CONFIG_CMD: new scheduler queue allocation/config/removal
69 	 *	command, uses &struct iwl_scd_queue_cfg_cmd and the response
70 	 *	is (same as before) &struct iwl_tx_queue_cfg_rsp.
71 	 */
72 	SCD_QUEUE_CONFIG_CMD = 0x17,
73 
74 	/**
75 	 * @SEC_KEY_CMD: security key command, uses &struct iwl_sec_key_cmd
76 	 */
77 	SEC_KEY_CMD = 0x18,
78 
79 	/**
80 	 * @MONITOR_NOTIF: Datapath monitoring notification, using
81 	 *	&struct iwl_datapath_monitor_notif
82 	 */
83 	MONITOR_NOTIF = 0xF4,
84 
85 	/**
86 	 * @RX_NO_DATA_NOTIF: &struct iwl_rx_no_data
87 	 */
88 	RX_NO_DATA_NOTIF = 0xF5,
89 
90 	/**
91 	 * @THERMAL_DUAL_CHAIN_DISABLE_REQ: firmware request for SMPS mode,
92 	 *	&struct iwl_thermal_dual_chain_request
93 	 */
94 	THERMAL_DUAL_CHAIN_REQUEST = 0xF6,
95 
96 	/**
97 	 * @TLC_MNG_UPDATE_NOTIF: &struct iwl_tlc_update_notif
98 	 */
99 	TLC_MNG_UPDATE_NOTIF = 0xF7,
100 
101 	/**
102 	 * @STA_PM_NOTIF: &struct iwl_mvm_pm_state_notification
103 	 */
104 	STA_PM_NOTIF = 0xFD,
105 
106 	/**
107 	 * @MU_GROUP_MGMT_NOTIF: &struct iwl_mu_group_mgmt_notif
108 	 */
109 	MU_GROUP_MGMT_NOTIF = 0xFE,
110 
111 	/**
112 	 * @RX_QUEUES_NOTIFICATION: &struct iwl_rxq_sync_notification
113 	 */
114 	RX_QUEUES_NOTIFICATION = 0xFF,
115 };
116 
117 /**
118  * struct iwl_mu_group_mgmt_cmd - VHT MU-MIMO group configuration
119  *
120  * @reserved: reserved
121  * @membership_status: a bitmap of MU groups
122  * @user_position:the position of station in a group. If the station is in the
123  *	group then bits (group * 2) is the position -1
124  */
125 struct iwl_mu_group_mgmt_cmd {
126 	__le32 reserved;
127 	__le32 membership_status[2];
128 	__le32 user_position[4];
129 } __packed; /* MU_GROUP_ID_MNG_TABLE_API_S_VER_1 */
130 
131 /**
132  * struct iwl_mu_group_mgmt_notif - VHT MU-MIMO group id notification
133  *
134  * @membership_status: a bitmap of MU groups
135  * @user_position: the position of station in a group. If the station is in the
136  *	group then bits (group * 2) is the position -1
137  */
138 struct iwl_mu_group_mgmt_notif {
139 	__le32 membership_status[2];
140 	__le32 user_position[4];
141 } __packed; /* MU_GROUP_MNG_NTFY_API_S_VER_1 */
142 
143 enum iwl_channel_estimation_flags {
144 	IWL_CHANNEL_ESTIMATION_ENABLE	= BIT(0),
145 	IWL_CHANNEL_ESTIMATION_TIMER	= BIT(1),
146 	IWL_CHANNEL_ESTIMATION_COUNTER	= BIT(2),
147 };
148 
149 /**
150  * struct iwl_channel_estimation_cfg - channel estimation reporting config
151  */
152 struct iwl_channel_estimation_cfg {
153 	/**
154 	 * @flags: flags, see &enum iwl_channel_estimation_flags
155 	 */
156 	__le32 flags;
157 	/**
158 	 * @timer: if enabled via flags, automatically disable after this many
159 	 *	microseconds
160 	 */
161 	__le32 timer;
162 	/**
163 	 * @count: if enabled via flags, automatically disable after this many
164 	 *	frames with channel estimation matrix were captured
165 	 */
166 	__le32 count;
167 	/**
168 	 * @rate_n_flags_mask: only try to record the channel estimation matrix
169 	 *	if the rate_n_flags value for the received frame (let's call
170 	 *	that rx_rnf) matches the mask/value given here like this:
171 	 *	(rx_rnf & rate_n_flags_mask) == rate_n_flags_val.
172 	 */
173 	__le32 rate_n_flags_mask;
174 	/**
175 	 * @rate_n_flags_val: see @rate_n_flags_mask
176 	 */
177 	__le32 rate_n_flags_val;
178 	/**
179 	 * @reserved: reserved (for alignment)
180 	 */
181 	__le32 reserved;
182 	/**
183 	 * @frame_types: bitmap of frame types to capture, the received frame's
184 	 *	subtype|type takes 6 bits in the frame and the corresponding bit
185 	 *	in this field must be set to 1 to capture channel estimation for
186 	 *	that frame type. Set to all-ones to enable capturing for all
187 	 *	frame types.
188 	 */
189 	__le64 frame_types;
190 } __packed; /* CHEST_COLLECTOR_FILTER_CMD_API_S_VER_1 */
191 
192 enum iwl_datapath_monitor_notif_type {
193 	IWL_DP_MON_NOTIF_TYPE_EXT_CCA,
194 };
195 
196 struct iwl_datapath_monitor_notif {
197 	__le32 type;
198 	u8 mac_id;
199 	u8 reserved[3];
200 } __packed; /* MONITOR_NTF_API_S_VER_1 */
201 
202 /**
203  * enum iwl_thermal_dual_chain_req_events - firmware SMPS request event
204  * @THERMAL_DUAL_CHAIN_REQ_ENABLE: (re-)enable dual-chain operation
205  *	(subject to other constraints)
206  * @THERMAL_DUAL_CHAIN_REQ_DISABLE: disable dual-chain operation
207  *	(static SMPS)
208  */
209 enum iwl_thermal_dual_chain_req_events {
210 	THERMAL_DUAL_CHAIN_REQ_ENABLE,
211 	THERMAL_DUAL_CHAIN_REQ_DISABLE,
212 }; /* THERMAL_DUAL_CHAIN_DISABLE_STATE_API_E_VER_1 */
213 
214 /**
215  * struct iwl_thermal_dual_chain_request - SMPS request
216  * @event: the type of request, see &enum iwl_thermal_dual_chain_req_events
217  */
218 struct iwl_thermal_dual_chain_request {
219 	__le32 event;
220 } __packed; /* THERMAL_DUAL_CHAIN_DISABLE_REQ_NTFY_API_S_VER_1 */
221 
222 enum iwl_rlc_chain_info {
223 	IWL_RLC_CHAIN_INFO_DRIVER_FORCE		= BIT(0),
224 	IWL_RLC_CHAIN_INFO_VALID		= 0x000e,
225 	IWL_RLC_CHAIN_INFO_FORCE		= 0x0070,
226 	IWL_RLC_CHAIN_INFO_FORCE_MIMO		= 0x0380,
227 	IWL_RLC_CHAIN_INFO_COUNT		= 0x0c00,
228 	IWL_RLC_CHAIN_INFO_MIMO_COUNT		= 0x3000,
229 };
230 
231 /**
232  * struct iwl_rlc_properties - RLC properties
233  * @rx_chain_info: RX chain info, &enum iwl_rlc_chain_info
234  * @reserved: reserved
235  */
236 struct iwl_rlc_properties {
237 	__le32 rx_chain_info;
238 	__le32 reserved;
239 } __packed; /* RLC_PROPERTIES_S_VER_1 */
240 
241 enum iwl_sad_mode {
242 	IWL_SAD_MODE_ENABLED		= BIT(0),
243 	IWL_SAD_MODE_DEFAULT_ANT_MSK	= 0x6,
244 	IWL_SAD_MODE_DEFAULT_ANT_FW	= 0x0,
245 	IWL_SAD_MODE_DEFAULT_ANT_A	= 0x2,
246 	IWL_SAD_MODE_DEFAULT_ANT_B	= 0x4,
247 };
248 
249 /**
250  * struct iwl_sad_properties - SAD properties
251  * @chain_a_sad_mode: chain A SAD mode, &enum iwl_sad_mode
252  * @chain_b_sad_mode: chain B SAD mode, &enum iwl_sad_mode
253  * @mac_id: MAC index
254  * @reserved: reserved
255  */
256 struct iwl_sad_properties {
257 	__le32 chain_a_sad_mode;
258 	__le32 chain_b_sad_mode;
259 	__le32 mac_id;
260 	__le32 reserved;
261 } __packed;
262 
263 /**
264  * struct iwl_rlc_config_cmd - RLC configuration
265  * @phy_id: PHY index
266  * @rlc: RLC properties, &struct iwl_rlc_properties
267  * @sad: SAD (single antenna diversity) options, &struct iwl_sad_properties
268  * @flags: flags, &enum iwl_rlc_flags
269  * @reserved: reserved
270  */
271 struct iwl_rlc_config_cmd {
272 	__le32 phy_id;
273 	struct iwl_rlc_properties rlc;
274 	struct iwl_sad_properties sad;
275 	u8 flags;
276 	u8 reserved[3];
277 } __packed; /* RLC_CONFIG_CMD_API_S_VER_2 */
278 
279 #define IWL_MAX_BAID_OLD	16 /* MAX_IMMEDIATE_BA_API_D_VER_2 */
280 #define IWL_MAX_BAID		32 /* MAX_IMMEDIATE_BA_API_D_VER_3 */
281 
282 /**
283  * enum iwl_rx_baid_action - BAID allocation/config action
284  * @IWL_RX_BAID_ACTION_ADD: add a new BAID session
285  * @IWL_RX_BAID_ACTION_MODIFY: modify the BAID session
286  * @IWL_RX_BAID_ACTION_REMOVE: remove the BAID session
287  */
288 enum iwl_rx_baid_action {
289 	IWL_RX_BAID_ACTION_ADD,
290 	IWL_RX_BAID_ACTION_MODIFY,
291 	IWL_RX_BAID_ACTION_REMOVE,
292 }; /*  RX_BAID_ALLOCATION_ACTION_E_VER_1 */
293 
294 /**
295  * struct iwl_rx_baid_cfg_cmd_alloc - BAID allocation data
296  * @sta_id_mask: station ID mask
297  * @tid: the TID for this session
298  * @reserved: reserved
299  * @ssn: the starting sequence number
300  * @win_size: RX BA session window size
301  */
302 struct iwl_rx_baid_cfg_cmd_alloc {
303 	__le32 sta_id_mask;
304 	u8 tid;
305 	u8 reserved[3];
306 	__le16 ssn;
307 	__le16 win_size;
308 } __packed; /* RX_BAID_ALLOCATION_ADD_CMD_API_S_VER_1 */
309 
310 /**
311  * struct iwl_rx_baid_cfg_cmd_modify - BAID modification data
312  * @old_sta_id_mask: old station ID mask
313  * @new_sta_id_mask: new station ID mask
314  * @tid: TID of the BAID
315  */
316 struct iwl_rx_baid_cfg_cmd_modify {
317 	__le32 old_sta_id_mask;
318 	__le32 new_sta_id_mask;
319 	__le32 tid;
320 } __packed; /* RX_BAID_ALLOCATION_MODIFY_CMD_API_S_VER_2 */
321 
322 /**
323  * struct iwl_rx_baid_cfg_cmd_remove_v1 - BAID removal data
324  * @baid: the BAID to remove
325  */
326 struct iwl_rx_baid_cfg_cmd_remove_v1 {
327 	__le32 baid;
328 } __packed; /* RX_BAID_ALLOCATION_REMOVE_CMD_API_S_VER_1 */
329 
330 /**
331  * struct iwl_rx_baid_cfg_cmd_remove - BAID removal data
332  * @sta_id_mask: the station mask of the BAID to remove
333  * @tid: the TID of the BAID to remove
334  */
335 struct iwl_rx_baid_cfg_cmd_remove {
336 	__le32 sta_id_mask;
337 	__le32 tid;
338 } __packed; /* RX_BAID_ALLOCATION_REMOVE_CMD_API_S_VER_2 */
339 
340 /**
341  * struct iwl_rx_baid_cfg_cmd - BAID allocation/config command
342  * @action: the action, from &enum iwl_rx_baid_action
343  */
344 struct iwl_rx_baid_cfg_cmd {
345 	__le32 action;
346 	union {
347 		struct iwl_rx_baid_cfg_cmd_alloc alloc;
348 		struct iwl_rx_baid_cfg_cmd_modify modify;
349 		struct iwl_rx_baid_cfg_cmd_remove_v1 remove_v1;
350 		struct iwl_rx_baid_cfg_cmd_remove remove;
351 	}; /* RX_BAID_ALLOCATION_OPERATION_API_U_VER_2 */
352 } __packed; /* RX_BAID_ALLOCATION_CONFIG_CMD_API_S_VER_2 */
353 
354 /**
355  * struct iwl_rx_baid_cfg_resp - BAID allocation response
356  * @baid: the allocated BAID
357  */
358 struct iwl_rx_baid_cfg_resp {
359 	__le32 baid;
360 }; /* RX_BAID_ALLOCATION_RESPONSE_API_S_VER_1 */
361 
362 /**
363  * enum iwl_scd_queue_cfg_operation - scheduler queue operation
364  * @IWL_SCD_QUEUE_ADD: allocate a new queue
365  * @IWL_SCD_QUEUE_REMOVE: remove a queue
366  * @IWL_SCD_QUEUE_MODIFY: modify a queue
367  */
368 enum iwl_scd_queue_cfg_operation {
369 	IWL_SCD_QUEUE_ADD = 0,
370 	IWL_SCD_QUEUE_REMOVE = 1,
371 	IWL_SCD_QUEUE_MODIFY = 2,
372 };
373 
374 /**
375  * struct iwl_scd_queue_cfg_cmd - scheduler queue allocation command
376  * @operation: the operation, see &enum iwl_scd_queue_cfg_operation
377  * @u.add.sta_mask: station mask
378  * @u.add.tid: TID
379  * @u.add.reserved: reserved
380  * @u.add.flags: flags from &enum iwl_tx_queue_cfg_actions, except
381  *	%TX_QUEUE_CFG_ENABLE_QUEUE is not valid
382  * @u.add.cb_size: size code
383  * @u.add.bc_dram_addr: byte-count table IOVA
384  * @u.add.tfdq_dram_addr: TFD queue IOVA
385  * @u.remove.sta_mask: station mask of queue to remove
386  * @u.remove.tid: TID of queue to remove
387  * @u.modify.old_sta_mask: old station mask for modify
388  * @u.modify.tid: TID of queue to modify
389  * @u.modify.new_sta_mask: new station mask for modify
390  */
391 struct iwl_scd_queue_cfg_cmd {
392 	__le32 operation;
393 	union {
394 		struct {
395 			__le32 sta_mask;
396 			u8 tid;
397 			u8 reserved[3];
398 			__le32 flags;
399 			__le32 cb_size;
400 			__le64 bc_dram_addr;
401 			__le64 tfdq_dram_addr;
402 		} __packed add; /* TX_QUEUE_CFG_CMD_ADD_API_S_VER_1 */
403 		struct {
404 			__le32 sta_mask;
405 			__le32 tid;
406 		} __packed remove; /* TX_QUEUE_CFG_CMD_REMOVE_API_S_VER_1 */
407 		struct {
408 			__le32 old_sta_mask;
409 			__le32 tid;
410 			__le32 new_sta_mask;
411 		} __packed modify; /* TX_QUEUE_CFG_CMD_MODIFY_API_S_VER_1 */
412 	} __packed u; /* TX_QUEUE_CFG_CMD_OPERATION_API_U_VER_1 */
413 } __packed; /* TX_QUEUE_CFG_CMD_API_S_VER_3 */
414 
415 /**
416  * enum iwl_sec_key_flags - security key command key flags
417  * @IWL_SEC_KEY_FLAG_CIPHER_MASK: cipher mask
418  * @IWL_SEC_KEY_FLAG_CIPHER_WEP: WEP cipher
419  * @IWL_SEC_KEY_FLAG_CIPHER_CCMP: CCMP/CMAC cipher
420  * @IWL_SEC_KEY_FLAG_CIPHER_TKIP: TKIP cipher
421  * @IWL_SEC_KEY_FLAG_CIPHER_GCMP: GCMP/GMAC cipher
422  * @IWL_SEC_KEY_FLAG_NO_TX: don't install for TX
423  * @IWL_SEC_KEY_FLAG_KEY_SIZE: large key size (WEP-104, GCMP-256, GMAC-256)
424  * @IWL_SEC_KEY_FLAG_MFP: MFP is in used for this key
425  * @IWL_SEC_KEY_FLAG_MCAST_KEY: this is a multicast key
426  * @IWL_SEC_KEY_FLAG_SPP_AMSDU: SPP A-MSDU should be used
427  */
428 enum iwl_sec_key_flags {
429 	IWL_SEC_KEY_FLAG_CIPHER_MASK	= 0x07,
430 	IWL_SEC_KEY_FLAG_CIPHER_WEP	= 0x01,
431 	IWL_SEC_KEY_FLAG_CIPHER_CCMP	= 0x02,
432 	IWL_SEC_KEY_FLAG_CIPHER_TKIP	= 0x03,
433 	IWL_SEC_KEY_FLAG_CIPHER_GCMP	= 0x05,
434 	IWL_SEC_KEY_FLAG_NO_TX		= 0x08,
435 	IWL_SEC_KEY_FLAG_KEY_SIZE	= 0x10,
436 	IWL_SEC_KEY_FLAG_MFP		= 0x20,
437 	IWL_SEC_KEY_FLAG_MCAST_KEY	= 0x40,
438 	IWL_SEC_KEY_FLAG_SPP_AMSDU	= 0x80,
439 };
440 
441 #define IWL_SEC_WEP_KEY_OFFSET	3
442 
443 /**
444  * struct iwl_sec_key_cmd - security key command
445  * @action: action from &enum iwl_ctxt_action
446  * @u.add.sta_mask: station mask for the new key
447  * @u.add.key_id: key ID (0-7) for the new key
448  * @u.add.key_flags: key flags per &enum iwl_sec_key_flags
449  * @u.add.key: key material. WEP keys should start from &IWL_SEC_WEP_KEY_OFFSET.
450  * @u.add.tkip_mic_rx_key: TKIP MIC RX key
451  * @u.add.tkip_mic_tx_key: TKIP MIC TX key
452  * @u.add.rx_seq: RX sequence counter value
453  * @u.add.tx_seq: TX sequence counter value
454  * @u.modify.old_sta_mask: old station mask
455  * @u.modify.new_sta_mask: new station mask
456  * @u.modify.key_id: key ID
457  * @u.modify.key_flags: new key flags
458  * @u.remove.sta_mask: station mask
459  * @u.remove.key_id: key ID
460  * @u.remove.key_flags: key flags
461  */
462 struct iwl_sec_key_cmd {
463 	__le32 action;
464 	union {
465 		struct {
466 			__le32 sta_mask;
467 			__le32 key_id;
468 			__le32 key_flags;
469 			u8 key[32];
470 			u8 tkip_mic_rx_key[8];
471 			u8 tkip_mic_tx_key[8];
472 			__le64 rx_seq;
473 			__le64 tx_seq;
474 		} __packed add; /* SEC_KEY_ADD_CMD_API_S_VER_1 */
475 		struct {
476 			__le32 old_sta_mask;
477 			__le32 new_sta_mask;
478 			__le32 key_id;
479 			__le32 key_flags;
480 		} __packed modify; /* SEC_KEY_MODIFY_CMD_API_S_VER_1 */
481 		struct {
482 			__le32 sta_mask;
483 			__le32 key_id;
484 			__le32 key_flags;
485 		} __packed remove; /* SEC_KEY_REMOVE_CMD_API_S_VER_1 */
486 	} __packed u; /* SEC_KEY_OPERATION_API_U_VER_1 */
487 } __packed; /* SEC_KEY_CMD_API_S_VER_1 */
488 
489 #endif /* __iwl_fw_api_datapath_h__ */
490