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