xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/datapath.h (revision 8eb2bee6c0f4957c6c1cea826e59cda4d18a2a64)
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 	 * @MONITOR_NOTIF: Datapath monitoring notification, using
76 	 *	&struct iwl_datapath_monitor_notif
77 	 */
78 	MONITOR_NOTIF = 0xF4,
79 
80 	/**
81 	 * @RX_NO_DATA_NOTIF: &struct iwl_rx_no_data
82 	 */
83 	RX_NO_DATA_NOTIF = 0xF5,
84 
85 	/**
86 	 * @THERMAL_DUAL_CHAIN_DISABLE_REQ: firmware request for SMPS mode,
87 	 *	&struct iwl_thermal_dual_chain_request
88 	 */
89 	THERMAL_DUAL_CHAIN_REQUEST = 0xF6,
90 
91 	/**
92 	 * @TLC_MNG_UPDATE_NOTIF: &struct iwl_tlc_update_notif
93 	 */
94 	TLC_MNG_UPDATE_NOTIF = 0xF7,
95 
96 	/**
97 	 * @STA_PM_NOTIF: &struct iwl_mvm_pm_state_notification
98 	 */
99 	STA_PM_NOTIF = 0xFD,
100 
101 	/**
102 	 * @MU_GROUP_MGMT_NOTIF: &struct iwl_mu_group_mgmt_notif
103 	 */
104 	MU_GROUP_MGMT_NOTIF = 0xFE,
105 
106 	/**
107 	 * @RX_QUEUES_NOTIFICATION: &struct iwl_rxq_sync_notification
108 	 */
109 	RX_QUEUES_NOTIFICATION = 0xFF,
110 };
111 
112 /**
113  * struct iwl_mu_group_mgmt_cmd - VHT MU-MIMO group configuration
114  *
115  * @reserved: reserved
116  * @membership_status: a bitmap of MU groups
117  * @user_position:the position of station in a group. If the station is in the
118  *	group then bits (group * 2) is the position -1
119  */
120 struct iwl_mu_group_mgmt_cmd {
121 	__le32 reserved;
122 	__le32 membership_status[2];
123 	__le32 user_position[4];
124 } __packed; /* MU_GROUP_ID_MNG_TABLE_API_S_VER_1 */
125 
126 /**
127  * struct iwl_mu_group_mgmt_notif - VHT MU-MIMO group id notification
128  *
129  * @membership_status: a bitmap of MU groups
130  * @user_position: the position of station in a group. If the station is in the
131  *	group then bits (group * 2) is the position -1
132  */
133 struct iwl_mu_group_mgmt_notif {
134 	__le32 membership_status[2];
135 	__le32 user_position[4];
136 } __packed; /* MU_GROUP_MNG_NTFY_API_S_VER_1 */
137 
138 enum iwl_channel_estimation_flags {
139 	IWL_CHANNEL_ESTIMATION_ENABLE	= BIT(0),
140 	IWL_CHANNEL_ESTIMATION_TIMER	= BIT(1),
141 	IWL_CHANNEL_ESTIMATION_COUNTER	= BIT(2),
142 };
143 
144 /**
145  * struct iwl_channel_estimation_cfg - channel estimation reporting config
146  */
147 struct iwl_channel_estimation_cfg {
148 	/**
149 	 * @flags: flags, see &enum iwl_channel_estimation_flags
150 	 */
151 	__le32 flags;
152 	/**
153 	 * @timer: if enabled via flags, automatically disable after this many
154 	 *	microseconds
155 	 */
156 	__le32 timer;
157 	/**
158 	 * @count: if enabled via flags, automatically disable after this many
159 	 *	frames with channel estimation matrix were captured
160 	 */
161 	__le32 count;
162 	/**
163 	 * @rate_n_flags_mask: only try to record the channel estimation matrix
164 	 *	if the rate_n_flags value for the received frame (let's call
165 	 *	that rx_rnf) matches the mask/value given here like this:
166 	 *	(rx_rnf & rate_n_flags_mask) == rate_n_flags_val.
167 	 */
168 	__le32 rate_n_flags_mask;
169 	/**
170 	 * @rate_n_flags_val: see @rate_n_flags_mask
171 	 */
172 	__le32 rate_n_flags_val;
173 	/**
174 	 * @reserved: reserved (for alignment)
175 	 */
176 	__le32 reserved;
177 	/**
178 	 * @frame_types: bitmap of frame types to capture, the received frame's
179 	 *	subtype|type takes 6 bits in the frame and the corresponding bit
180 	 *	in this field must be set to 1 to capture channel estimation for
181 	 *	that frame type. Set to all-ones to enable capturing for all
182 	 *	frame types.
183 	 */
184 	__le64 frame_types;
185 } __packed; /* CHEST_COLLECTOR_FILTER_CMD_API_S_VER_1 */
186 
187 enum iwl_datapath_monitor_notif_type {
188 	IWL_DP_MON_NOTIF_TYPE_EXT_CCA,
189 };
190 
191 struct iwl_datapath_monitor_notif {
192 	__le32 type;
193 	u8 mac_id;
194 	u8 reserved[3];
195 } __packed; /* MONITOR_NTF_API_S_VER_1 */
196 
197 /**
198  * enum iwl_thermal_dual_chain_req_events - firmware SMPS request event
199  * @THERMAL_DUAL_CHAIN_REQ_ENABLE: (re-)enable dual-chain operation
200  *	(subject to other constraints)
201  * @THERMAL_DUAL_CHAIN_REQ_DISABLE: disable dual-chain operation
202  *	(static SMPS)
203  */
204 enum iwl_thermal_dual_chain_req_events {
205 	THERMAL_DUAL_CHAIN_REQ_ENABLE,
206 	THERMAL_DUAL_CHAIN_REQ_DISABLE,
207 }; /* THERMAL_DUAL_CHAIN_DISABLE_STATE_API_E_VER_1 */
208 
209 /**
210  * struct iwl_thermal_dual_chain_request - SMPS request
211  * @event: the type of request, see &enum iwl_thermal_dual_chain_req_events
212  */
213 struct iwl_thermal_dual_chain_request {
214 	__le32 event;
215 } __packed; /* THERMAL_DUAL_CHAIN_DISABLE_REQ_NTFY_API_S_VER_1 */
216 
217 enum iwl_rlc_chain_info {
218 	IWL_RLC_CHAIN_INFO_DRIVER_FORCE		= BIT(0),
219 	IWL_RLC_CHAIN_INFO_VALID		= 0x000e,
220 	IWL_RLC_CHAIN_INFO_FORCE		= 0x0070,
221 	IWL_RLC_CHAIN_INFO_FORCE_MIMO		= 0x0380,
222 	IWL_RLC_CHAIN_INFO_COUNT		= 0x0c00,
223 	IWL_RLC_CHAIN_INFO_MIMO_COUNT		= 0x3000,
224 };
225 
226 /**
227  * struct iwl_rlc_properties - RLC properties
228  * @rx_chain_info: RX chain info, &enum iwl_rlc_chain_info
229  * @reserved: reserved
230  */
231 struct iwl_rlc_properties {
232 	__le32 rx_chain_info;
233 	__le32 reserved;
234 } __packed; /* RLC_PROPERTIES_S_VER_1 */
235 
236 enum iwl_sad_mode {
237 	IWL_SAD_MODE_ENABLED		= BIT(0),
238 	IWL_SAD_MODE_DEFAULT_ANT_MSK	= 0x6,
239 	IWL_SAD_MODE_DEFAULT_ANT_FW	= 0x0,
240 	IWL_SAD_MODE_DEFAULT_ANT_A	= 0x2,
241 	IWL_SAD_MODE_DEFAULT_ANT_B	= 0x4,
242 };
243 
244 /**
245  * struct iwl_sad_properties - SAD properties
246  * @chain_a_sad_mode: chain A SAD mode, &enum iwl_sad_mode
247  * @chain_b_sad_mode: chain B SAD mode, &enum iwl_sad_mode
248  * @mac_id: MAC index
249  * @reserved: reserved
250  */
251 struct iwl_sad_properties {
252 	__le32 chain_a_sad_mode;
253 	__le32 chain_b_sad_mode;
254 	__le32 mac_id;
255 	__le32 reserved;
256 } __packed;
257 
258 /**
259  * struct iwl_rlc_config_cmd - RLC configuration
260  * @phy_id: PHY index
261  * @rlc: RLC properties, &struct iwl_rlc_properties
262  * @sad: SAD (single antenna diversity) options, &struct iwl_sad_properties
263  * @flags: flags, &enum iwl_rlc_flags
264  * @reserved: reserved
265  */
266 struct iwl_rlc_config_cmd {
267 	__le32 phy_id;
268 	struct iwl_rlc_properties rlc;
269 	struct iwl_sad_properties sad;
270 	u8 flags;
271 	u8 reserved[3];
272 } __packed; /* RLC_CONFIG_CMD_API_S_VER_2 */
273 
274 #define IWL_MAX_BAID_OLD	16 /* MAX_IMMEDIATE_BA_API_D_VER_2 */
275 #define IWL_MAX_BAID		32 /* MAX_IMMEDIATE_BA_API_D_VER_3 */
276 
277 /**
278  * enum iwl_rx_baid_action - BAID allocation/config action
279  * @IWL_RX_BAID_ACTION_ADD: add a new BAID session
280  * @IWL_RX_BAID_ACTION_MODIFY: modify the BAID session
281  * @IWL_RX_BAID_ACTION_REMOVE: remove the BAID session
282  */
283 enum iwl_rx_baid_action {
284 	IWL_RX_BAID_ACTION_ADD,
285 	IWL_RX_BAID_ACTION_MODIFY,
286 	IWL_RX_BAID_ACTION_REMOVE,
287 }; /*  RX_BAID_ALLOCATION_ACTION_E_VER_1 */
288 
289 /**
290  * struct iwl_rx_baid_cfg_cmd_alloc - BAID allocation data
291  * @sta_id_mask: station ID mask
292  * @tid: the TID for this session
293  * @reserved: reserved
294  * @ssn: the starting sequence number
295  * @win_size: RX BA session window size
296  */
297 struct iwl_rx_baid_cfg_cmd_alloc {
298 	__le32 sta_id_mask;
299 	u8 tid;
300 	u8 reserved[3];
301 	__le16 ssn;
302 	__le16 win_size;
303 } __packed; /* RX_BAID_ALLOCATION_ADD_CMD_API_S_VER_1 */
304 
305 /**
306  * struct iwl_rx_baid_cfg_cmd_modify - BAID modification data
307  * @old_sta_id_mask: old station ID mask
308  * @new_sta_id_mask: new station ID mask
309  * @tid: TID of the BAID
310  */
311 struct iwl_rx_baid_cfg_cmd_modify {
312 	__le32 old_sta_id_mask;
313 	__le32 new_sta_id_mask;
314 	__le32 tid;
315 } __packed; /* RX_BAID_ALLOCATION_MODIFY_CMD_API_S_VER_2 */
316 
317 /**
318  * struct iwl_rx_baid_cfg_cmd_remove_v1 - BAID removal data
319  * @baid: the BAID to remove
320  */
321 struct iwl_rx_baid_cfg_cmd_remove_v1 {
322 	__le32 baid;
323 } __packed; /* RX_BAID_ALLOCATION_REMOVE_CMD_API_S_VER_1 */
324 
325 /**
326  * struct iwl_rx_baid_cfg_cmd_remove - BAID removal data
327  * @sta_id_mask: the station mask of the BAID to remove
328  * @tid: the TID of the BAID to remove
329  */
330 struct iwl_rx_baid_cfg_cmd_remove {
331 	__le32 sta_id_mask;
332 	__le32 tid;
333 } __packed; /* RX_BAID_ALLOCATION_REMOVE_CMD_API_S_VER_2 */
334 
335 /**
336  * struct iwl_rx_baid_cfg_cmd - BAID allocation/config command
337  * @action: the action, from &enum iwl_rx_baid_action
338  */
339 struct iwl_rx_baid_cfg_cmd {
340 	__le32 action;
341 	union {
342 		struct iwl_rx_baid_cfg_cmd_alloc alloc;
343 		struct iwl_rx_baid_cfg_cmd_modify modify;
344 		struct iwl_rx_baid_cfg_cmd_remove_v1 remove_v1;
345 		struct iwl_rx_baid_cfg_cmd_remove remove;
346 	}; /* RX_BAID_ALLOCATION_OPERATION_API_U_VER_2 */
347 } __packed; /* RX_BAID_ALLOCATION_CONFIG_CMD_API_S_VER_2 */
348 
349 /**
350  * struct iwl_rx_baid_cfg_resp - BAID allocation response
351  * @baid: the allocated BAID
352  */
353 struct iwl_rx_baid_cfg_resp {
354 	__le32 baid;
355 }; /* RX_BAID_ALLOCATION_RESPONSE_API_S_VER_1 */
356 
357 /**
358  * enum iwl_scd_queue_cfg_operation - scheduler queue operation
359  * @IWL_SCD_QUEUE_ADD: allocate a new queue
360  * @IWL_SCD_QUEUE_REMOVE: remove a queue
361  * @IWL_SCD_QUEUE_MODIFY: modify a queue
362  */
363 enum iwl_scd_queue_cfg_operation {
364 	IWL_SCD_QUEUE_ADD = 0,
365 	IWL_SCD_QUEUE_REMOVE = 1,
366 	IWL_SCD_QUEUE_MODIFY = 2,
367 };
368 
369 /**
370  * struct iwl_scd_queue_cfg_cmd - scheduler queue allocation command
371  * @operation: the operation, see &enum iwl_scd_queue_cfg_operation
372  * @u.add.sta_mask: station mask
373  * @u.add.tid: TID
374  * @u.add.reserved: reserved
375  * @u.add.flags: flags from &enum iwl_tx_queue_cfg_actions, except
376  *	%TX_QUEUE_CFG_ENABLE_QUEUE is not valid
377  * @u.add.cb_size: size code
378  * @u.add.bc_dram_addr: byte-count table IOVA
379  * @u.add.tfdq_dram_addr: TFD queue IOVA
380  * @u.remove.queue: queue ID for removal
381  * @u.modify.sta_mask: new station mask for modify
382  * @u.modify.queue: queue ID to modify
383  */
384 struct iwl_scd_queue_cfg_cmd {
385 	__le32 operation;
386 	union {
387 		struct {
388 			__le32 sta_mask;
389 			u8 tid;
390 			u8 reserved[3];
391 			__le32 flags;
392 			__le32 cb_size;
393 			__le64 bc_dram_addr;
394 			__le64 tfdq_dram_addr;
395 		} __packed add; /* TX_QUEUE_CFG_CMD_ADD_API_S_VER_1 */
396 		struct {
397 			__le32 queue;
398 		} __packed remove; /* TX_QUEUE_CFG_CMD_REMOVE_API_S_VER_1 */
399 		struct {
400 			__le32 sta_mask;
401 			__le32 queue;
402 		} __packed modify; /* TX_QUEUE_CFG_CMD_MODIFY_API_S_VER_1 */
403 	} __packed u; /* TX_QUEUE_CFG_CMD_OPERATION_API_U_VER_1 */
404 } __packed; /* TX_QUEUE_CFG_CMD_API_S_VER_3 */
405 
406 #endif /* __iwl_fw_api_datapath_h__ */
407