f12b2a25cd3d27eceb72ce31e5771eeb0226ebbe
[linux-2.6-block.git] / drivers / net / wireless / intel / iwlwifi / fw / api / mac-cfg.h
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2019, 2021-2022 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_mac_cfg_h__
8 #define __iwl_fw_api_mac_cfg_h__
9
10 #include "mac.h"
11
12 /**
13  * enum iwl_mac_conf_subcmd_ids - mac configuration command IDs
14  */
15 enum iwl_mac_conf_subcmd_ids {
16         /**
17          * @LOW_LATENCY_CMD: &struct iwl_mac_low_latency_cmd
18          */
19         LOW_LATENCY_CMD = 0x3,
20         /**
21          * @CHANNEL_SWITCH_TIME_EVENT_CMD: &struct iwl_chan_switch_te_cmd
22          */
23         CHANNEL_SWITCH_TIME_EVENT_CMD = 0x4,
24         /**
25          * @MISSED_VAP_NOTIF: &struct iwl_missed_vap_notif
26          */
27         MISSED_VAP_NOTIF = 0xFA,
28         /**
29          * @SESSION_PROTECTION_CMD: &struct iwl_mvm_session_prot_cmd
30          */
31         SESSION_PROTECTION_CMD = 0x5,
32         /**
33          * @CANCEL_CHANNEL_SWITCH_CMD: &struct iwl_cancel_channel_switch_cmd
34          */
35         CANCEL_CHANNEL_SWITCH_CMD = 0x6,
36         /**
37          * @MAC_CONFIG_CMD: &struct iwl_mac_config_cmd
38          */
39         MAC_CONFIG_CMD = 0x8,
40         /**
41          * @SESSION_PROTECTION_NOTIF: &struct iwl_mvm_session_prot_notif
42          */
43         SESSION_PROTECTION_NOTIF = 0xFB,
44
45         /**
46          * @PROBE_RESPONSE_DATA_NOTIF: &struct iwl_probe_resp_data_notif
47          */
48         PROBE_RESPONSE_DATA_NOTIF = 0xFC,
49
50         /**
51          * @CHANNEL_SWITCH_START_NOTIF: &struct iwl_channel_switch_start_notif
52          */
53         CHANNEL_SWITCH_START_NOTIF = 0xFF,
54
55         /**
56          *@CHANNEL_SWITCH_ERROR_NOTIF: &struct iwl_channel_switch_error_notif
57          */
58         CHANNEL_SWITCH_ERROR_NOTIF = 0xF9,
59 };
60
61 #define IWL_P2P_NOA_DESC_COUNT  (2)
62
63 /**
64  * struct iwl_p2p_noa_attr - NOA attr contained in probe resp FW notification
65  *
66  * @id: attribute id
67  * @len_low: length low half
68  * @len_high: length high half
69  * @idx: instance of NoA timing
70  * @ctwin: GO's ct window and pwer save capability
71  * @desc: NoA descriptor
72  * @reserved: reserved for alignment purposes
73  */
74 struct iwl_p2p_noa_attr {
75         u8 id;
76         u8 len_low;
77         u8 len_high;
78         u8 idx;
79         u8 ctwin;
80         struct ieee80211_p2p_noa_desc desc[IWL_P2P_NOA_DESC_COUNT];
81         u8 reserved;
82 } __packed;
83
84 #define IWL_PROBE_RESP_DATA_NO_CSA (0xff)
85
86 /**
87  * struct iwl_probe_resp_data_notif - notification with NOA and CSA counter
88  *
89  * @mac_id: the mac which should send the probe response
90  * @noa_active: notifies if the noa attribute should be handled
91  * @noa_attr: P2P NOA attribute
92  * @csa_counter: current csa counter
93  * @reserved: reserved for alignment purposes
94  */
95 struct iwl_probe_resp_data_notif {
96         __le32 mac_id;
97         __le32 noa_active;
98         struct iwl_p2p_noa_attr noa_attr;
99         u8 csa_counter;
100         u8 reserved[3];
101 } __packed; /* PROBE_RESPONSE_DATA_NTFY_API_S_VER_1 */
102
103 /**
104  * struct iwl_missed_vap_notif - notification of missing vap detection
105  *
106  * @mac_id: the mac for which the ucode sends the notification for
107  * @num_beacon_intervals_elapsed: beacons elpased with no vap profile inside
108  * @profile_periodicity: beacons period to have our profile inside
109  * @reserved: reserved for alignment purposes
110  */
111 struct iwl_missed_vap_notif {
112         __le32 mac_id;
113         u8 num_beacon_intervals_elapsed;
114         u8 profile_periodicity;
115         u8 reserved[2];
116 } __packed; /* MISSED_VAP_NTFY_API_S_VER_1 */
117
118 /**
119  * struct iwl_channel_switch_start_notif - Channel switch start notification
120  *
121  * @id_and_color: ID and color of the MAC
122  */
123 struct iwl_channel_switch_start_notif {
124         __le32 id_and_color;
125 } __packed; /* CHANNEL_SWITCH_START_NTFY_API_S_VER_1 */
126
127 #define CS_ERR_COUNT_ERROR BIT(0)
128 #define CS_ERR_LONG_DELAY_AFTER_CS BIT(1)
129 #define CS_ERR_LONG_TX_BLOCK BIT(2)
130 #define CS_ERR_TX_BLOCK_TIMER_EXPIRED BIT(3)
131
132 /**
133  * struct iwl_channel_switch_error_notif - Channel switch error notification
134  *
135  * @mac_id: the mac for which the ucode sends the notification for
136  * @csa_err_mask: mask of channel switch error that can occur
137  */
138 struct iwl_channel_switch_error_notif {
139         __le32 mac_id;
140         __le32 csa_err_mask;
141 } __packed; /* CHANNEL_SWITCH_ERROR_NTFY_API_S_VER_1 */
142
143 /**
144  * struct iwl_cancel_channel_switch_cmd - Cancel Channel Switch command
145  *
146  * @mac_id: the mac that should cancel the channel switch
147  */
148 struct iwl_cancel_channel_switch_cmd {
149         __le32 mac_id;
150 } __packed; /* MAC_CANCEL_CHANNEL_SWITCH_S_VER_1 */
151
152 /**
153  * struct iwl_chan_switch_te_cmd - Channel Switch Time Event command
154  *
155  * @mac_id: MAC ID for channel switch
156  * @action: action to perform, one of FW_CTXT_ACTION_*
157  * @tsf: beacon tsf
158  * @cs_count: channel switch count from CSA/eCSA IE
159  * @cs_delayed_bcn_count: if set to N (!= 0) GO/AP can delay N beacon intervals
160  *      at the new channel after the channel switch, otherwise (N == 0) expect
161  *      beacon right after the channel switch.
162  * @cs_mode: 1 - quiet, 0 - otherwise
163  * @reserved: reserved for alignment purposes
164  */
165 struct iwl_chan_switch_te_cmd {
166         __le32 mac_id;
167         __le32 action;
168         __le32 tsf;
169         u8 cs_count;
170         u8 cs_delayed_bcn_count;
171         u8 cs_mode;
172         u8 reserved;
173 } __packed; /* MAC_CHANNEL_SWITCH_TIME_EVENT_S_VER_2 */
174
175 /**
176  * struct iwl_mac_low_latency_cmd - set/clear mac to 'low-latency mode'
177  *
178  * @mac_id: MAC ID to whom to apply the low-latency configurations
179  * @low_latency_rx: 1/0 to set/clear Rx low latency direction
180  * @low_latency_tx: 1/0 to set/clear Tx low latency direction
181  * @reserved: reserved for alignment purposes
182  */
183 struct iwl_mac_low_latency_cmd {
184         __le32 mac_id;
185         u8 low_latency_rx;
186         u8 low_latency_tx;
187         __le16 reserved;
188 } __packed; /* MAC_LOW_LATENCY_API_S_VER_1 */
189
190 /**
191  * struct iwl_mac_client_data - configuration data for client MAC context
192  *
193  * @is_assoc: 1 for associated state, 0 otherwise
194  * @assoc_id: unique ID assigned by the AP during association
195  * @data_policy: see &enum iwl_mac_data_policy
196  * @ctwin: client traffic window in TU (period after TBTT when GO is present).
197  *      0 indicates that there is no CT window.
198  */
199 struct iwl_mac_client_data {
200         __le32 is_assoc;
201         __le32 assoc_id;
202         __le32 data_policy;
203         __le32 ctwin;
204 } __packed; /* MAC_CONTEXT_CONFIG_CLIENT_DATA_API_S_VER_1 */
205
206 /**
207  * struct iwl_mac_go_ibss_data - configuration data for GO and IBSS MAC context
208  *
209  * @beacon_template: beacon template ID
210  */
211 struct iwl_mac_go_ibss_data {
212         __le32 beacon_template;
213 } __packed; /* MAC_CONTEXT_CONFIG_GO_IBSS_DATA_API_S_VER_1 */
214
215 /**
216  * struct iwl_mac_p2p_dev_data  - configuration data for P2P device MAC context
217  *
218  * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
219  *      other channels as well. This should be to true only in case that the
220  *      device is discoverable and there is an active GO. Note that setting this
221  *      field when not needed, will increase the number of interrupts and have
222  *      effect on the platform power, as this setting opens the Rx filters on
223  *      all macs.
224  */
225 struct iwl_mac_p2p_dev_data {
226         __le32 is_disc_extended;
227 } __packed; /* MAC_CONTEXT_CONFIG_P2P_DEV_DATA_API_S_VER_1 */
228
229 /**
230  * enum iwl_mac_config_filter_flags - MAC context configuration filter flags
231  *
232  * @MAC_CFG_FILTER_PROMISC: accept all data frames
233  * @MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT: pass all management and
234  *      control frames to the host
235  * @MAC_CFG_FILTER_ACCEPT_GRP: accept multicast frames
236  * @MAC_CFG_FILTER_ACCEPT_BEACON: accept beacon frames
237  * @MAC_CFG_FILTER_ACCEPT_BCAST_PROBE_RESP: accept broadcast probe response
238  * @MAC_CFG_FILTER_ACCEPT_PROBE_REQ: accept probe requests
239  */
240 enum iwl_mac_config_filter_flags {
241         MAC_CFG_FILTER_PROMISC                  = BIT(0),
242         MAC_CFG_FILTER_ACCEPT_CONTROL_AND_MGMT  = BIT(1),
243         MAC_CFG_FILTER_ACCEPT_GRP               = BIT(2),
244         MAC_CFG_FILTER_ACCEPT_BEACON            = BIT(3),
245         MAC_CFG_FILTER_ACCEPT_BCAST_PROBE_RESP  = BIT(4),
246         MAC_CFG_FILTER_ACCEPT_PROBE_REQ         = BIT(5),
247 }; /* MAC_FILTER_FLAGS_MASK_E_VER_1 */
248
249 /**
250  * struct iwl_mac_config_cmd - command structure to configure MAC contexts in
251  *      MLD API
252  * ( MAC_CONTEXT_CONFIG_CMD = 0x8 )
253  *
254  * @id_and_color: ID and color of the MAC
255  * @action: action to perform, one of FW_CTXT_ACTION_*
256  * @mac_type: one of &enum iwl_mac_types
257  * @local_mld_addr: mld address
258  * @reserved_for_local_mld_addr: reserved
259  * @filter_flags: combination of &enum iwl_mac_config_filter_flags
260  * @he_support: does this MAC support HE
261  * @eht_support: does this MAC support EHT. Requires he_support
262  * @nic_not_ack_enabled: mark that the NIC doesn't support receiving
263  *      ACK-enabled AGG, (i.e. both BACK and non-BACK frames in single AGG).
264  *      If the NIC is not ACK_ENABLED it may use the EOF-bit in first non-0
265  *      len delim to determine if AGG or single.
266  * @client: client mac data
267  * @go_ibss: mac data for go or ibss
268  * @p2p_dev: mac data for p2p device
269  */
270 struct iwl_mac_config_cmd {
271         /* COMMON_INDEX_HDR_API_S_VER_1 */
272         __le32 id_and_color;
273         __le32 action;
274         /* MAC_CONTEXT_TYPE_API_E */
275         __le32 mac_type;
276         u8 local_mld_addr[6];
277         __le16 reserved_for_local_mld_addr;
278         __le32 filter_flags;
279         __le32 he_support;
280         __le32 eht_support;
281         __le32 nic_not_ack_enabled;
282         /* MAC_CONTEXT_CONFIG_SPECIFIC_DATA_API_U_VER_1 */
283         union {
284                 struct iwl_mac_client_data client;
285                 struct iwl_mac_go_ibss_data go_ibss;
286                 struct iwl_mac_p2p_dev_data p2p_dev;
287         };
288 } __packed; /* MAC_CONTEXT_CONFIG_CMD_API_S_VER_1 */
289
290 #endif /* __iwl_fw_api_mac_cfg_h__ */