blob: 0c3350ad2f2f1ae96a707e57db3d8538c9e564c5 [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
2 *
3 * This file is provided under a dual BSD/GPLv2 license. When using or
4 * redistributing this file, you may do so under either license.
5 *
6 * GPL LICENSE SUMMARY
7 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +02008 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8ca151b2013-01-24 14:25:36 +01009 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
22 * USA
23 *
24 * The full GNU General Public License is included in this distribution
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020025 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010026 *
27 * Contact Information:
Emmanuel Grumbachd01c5362015-11-17 15:39:56 +020028 * Intel Linux Wireless <linuxwifi@intel.com>
Johannes Berg8ca151b2013-01-24 14:25:36 +010029 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
30 *
31 * BSD LICENSE
32 *
Emmanuel Grumbach51368bf2013-12-30 13:15:54 +020033 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
Johannes Berg8ca151b2013-01-24 14:25:36 +010034 * All rights reserved.
35 *
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
38 * are met:
39 *
40 * * Redistributions of source code must retain the above copyright
41 * notice, this list of conditions and the following disclaimer.
42 * * Redistributions in binary form must reproduce the above copyright
43 * notice, this list of conditions and the following disclaimer in
44 * the documentation and/or other materials provided with the
45 * distribution.
46 * * Neither the name Intel Corporation nor the names of its
47 * contributors may be used to endorse or promote products derived
48 * from this software without specific prior written permission.
49 *
50 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
51 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
52 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
53 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
54 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
55 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
56 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
60 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61 *****************************************************************************/
62
63#ifndef __fw_api_mac_h__
64#define __fw_api_mac_h__
65
66/*
Sara Sharon0e7ac012016-09-08 17:32:19 +030067 * The first MAC indices (starting from 0) are available to the driver,
68 * AUX indices follows - 1 for non-CDB, 2 for CDB.
Johannes Berg8ca151b2013-01-24 14:25:36 +010069 */
70#define MAC_INDEX_AUX 4
71#define MAC_INDEX_MIN_DRIVER 0
72#define NUM_MAC_INDEX_DRIVER MAC_INDEX_AUX
Sara Sharon0e7ac012016-09-08 17:32:19 +030073#define NUM_MAC_INDEX (NUM_MAC_INDEX_DRIVER + 1)
74#define NUM_MAC_INDEX_CDB (NUM_MAC_INDEX_DRIVER + 2)
Johannes Berg8ca151b2013-01-24 14:25:36 +010075
Sara Sharon0ae98812017-01-04 14:53:58 +020076#define IWL_MVM_STATION_COUNT 16
77#define IWL_MVM_INVALID_STA 0xFF
78
Sara Sharon988b5962016-04-10 15:06:55 +030079#define IWL_MVM_TDLS_STA_COUNT 4
80
Emmanuel Grumbach86a91ec2013-05-26 20:47:53 +030081enum iwl_ac {
82 AC_BK,
83 AC_BE,
84 AC_VI,
85 AC_VO,
86 AC_NUM,
87};
Johannes Berg8ca151b2013-01-24 14:25:36 +010088
89/**
90 * enum iwl_mac_protection_flags - MAC context flags
91 * @MAC_PROT_FLG_TGG_PROTECT: 11g protection when transmitting OFDM frames,
92 * this will require CCK RTS/CTS2self.
93 * RTS/CTS will protect full burst time.
94 * @MAC_PROT_FLG_HT_PROT: enable HT protection
95 * @MAC_PROT_FLG_FAT_PROT: protect 40 MHz transmissions
96 * @MAC_PROT_FLG_SELF_CTS_EN: allow CTS2self
97 */
98enum iwl_mac_protection_flags {
99 MAC_PROT_FLG_TGG_PROTECT = BIT(3),
100 MAC_PROT_FLG_HT_PROT = BIT(23),
101 MAC_PROT_FLG_FAT_PROT = BIT(24),
102 MAC_PROT_FLG_SELF_CTS_EN = BIT(30),
103};
104
105#define MAC_FLG_SHORT_SLOT BIT(4)
106#define MAC_FLG_SHORT_PREAMBLE BIT(5)
107
108/**
109 * enum iwl_mac_types - Supported MAC types
110 * @FW_MAC_TYPE_FIRST: lowest supported MAC type
111 * @FW_MAC_TYPE_AUX: Auxiliary MAC (internal)
112 * @FW_MAC_TYPE_LISTENER: monitor MAC type (?)
113 * @FW_MAC_TYPE_PIBSS: Pseudo-IBSS
114 * @FW_MAC_TYPE_IBSS: IBSS
115 * @FW_MAC_TYPE_BSS_STA: BSS (managed) station
116 * @FW_MAC_TYPE_P2P_DEVICE: P2P Device
117 * @FW_MAC_TYPE_P2P_STA: P2P client
118 * @FW_MAC_TYPE_GO: P2P GO
119 * @FW_MAC_TYPE_TEST: ?
120 * @FW_MAC_TYPE_MAX: highest support MAC type
121 */
122enum iwl_mac_types {
123 FW_MAC_TYPE_FIRST = 1,
124 FW_MAC_TYPE_AUX = FW_MAC_TYPE_FIRST,
125 FW_MAC_TYPE_LISTENER,
126 FW_MAC_TYPE_PIBSS,
127 FW_MAC_TYPE_IBSS,
128 FW_MAC_TYPE_BSS_STA,
129 FW_MAC_TYPE_P2P_DEVICE,
130 FW_MAC_TYPE_P2P_STA,
131 FW_MAC_TYPE_GO,
132 FW_MAC_TYPE_TEST,
133 FW_MAC_TYPE_MAX = FW_MAC_TYPE_TEST
134}; /* MAC_CONTEXT_TYPE_API_E_VER_1 */
135
136/**
137 * enum iwl_tsf_id - TSF hw timer ID
138 * @TSF_ID_A: use TSF A
139 * @TSF_ID_B: use TSF B
140 * @TSF_ID_C: use TSF C
141 * @TSF_ID_D: use TSF D
142 * @NUM_TSF_IDS: number of TSF timers available
143 */
144enum iwl_tsf_id {
145 TSF_ID_A = 0,
146 TSF_ID_B = 1,
147 TSF_ID_C = 2,
148 TSF_ID_D = 3,
149 NUM_TSF_IDS = 4,
150}; /* TSF_ID_API_E_VER_1 */
151
152/**
153 * struct iwl_mac_data_ap - configuration data for AP MAC context
154 * @beacon_time: beacon transmit time in system time
155 * @beacon_tsf: beacon transmit time in TSF
156 * @bi: beacon interval in TU
157 * @bi_reciprocal: 2^32 / bi
158 * @dtim_interval: dtim transmit time in TU
159 * @dtim_reciprocal: 2^32 / dtim_interval
Sara Sharonced19f22017-02-06 19:09:32 +0200160 * @mcast_qid: queue ID for multicast traffic.
161 * NOTE: obsolete from VER2 and on
Johannes Berg8ca151b2013-01-24 14:25:36 +0100162 * @beacon_template: beacon template ID
163 */
164struct iwl_mac_data_ap {
165 __le32 beacon_time;
166 __le64 beacon_tsf;
167 __le32 bi;
168 __le32 bi_reciprocal;
169 __le32 dtim_interval;
170 __le32 dtim_reciprocal;
171 __le32 mcast_qid;
172 __le32 beacon_template;
Sara Sharonced19f22017-02-06 19:09:32 +0200173} __packed; /* AP_MAC_DATA_API_S_VER_2 */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100174
175/**
176 * struct iwl_mac_data_ibss - configuration data for IBSS MAC context
177 * @beacon_time: beacon transmit time in system time
178 * @beacon_tsf: beacon transmit time in TSF
179 * @bi: beacon interval in TU
180 * @bi_reciprocal: 2^32 / bi
Johannes Berg5023d962013-07-31 14:07:43 +0200181 * @beacon_template: beacon template ID
Johannes Berg8ca151b2013-01-24 14:25:36 +0100182 */
183struct iwl_mac_data_ibss {
184 __le32 beacon_time;
185 __le64 beacon_tsf;
186 __le32 bi;
187 __le32 bi_reciprocal;
Johannes Berg5023d962013-07-31 14:07:43 +0200188 __le32 beacon_template;
Johannes Berg8ca151b2013-01-24 14:25:36 +0100189} __packed; /* IBSS_MAC_DATA_API_S_VER_1 */
190
191/**
192 * struct iwl_mac_data_sta - configuration data for station MAC context
193 * @is_assoc: 1 for associated state, 0 otherwise
194 * @dtim_time: DTIM arrival time in system time
195 * @dtim_tsf: DTIM arrival time in TSF
196 * @bi: beacon interval in TU, applicable only when associated
197 * @bi_reciprocal: 2^32 / bi , applicable only when associated
198 * @dtim_interval: DTIM interval in TU, applicable only when associated
199 * @dtim_reciprocal: 2^32 / dtim_interval , applicable only when associated
200 * @listen_interval: in beacon intervals, applicable only when associated
201 * @assoc_id: unique ID assigned by the AP during association
Luca Coelhoa8d01142017-05-10 11:24:58 +0300202 * @assoc_beacon_arrive_time: TSF of first beacon after association
Johannes Berg8ca151b2013-01-24 14:25:36 +0100203 */
204struct iwl_mac_data_sta {
205 __le32 is_assoc;
206 __le32 dtim_time;
207 __le64 dtim_tsf;
208 __le32 bi;
209 __le32 bi_reciprocal;
210 __le32 dtim_interval;
211 __le32 dtim_reciprocal;
212 __le32 listen_interval;
213 __le32 assoc_id;
214 __le32 assoc_beacon_arrive_time;
215} __packed; /* STA_MAC_DATA_API_S_VER_1 */
216
217/**
218 * struct iwl_mac_data_go - configuration data for P2P GO MAC context
219 * @ap: iwl_mac_data_ap struct with most config data
220 * @ctwin: client traffic window in TU (period after TBTT when GO is present).
221 * 0 indicates that there is no CT window.
222 * @opp_ps_enabled: indicate that opportunistic PS allowed
223 */
224struct iwl_mac_data_go {
225 struct iwl_mac_data_ap ap;
226 __le32 ctwin;
227 __le32 opp_ps_enabled;
228} __packed; /* GO_MAC_DATA_API_S_VER_1 */
229
230/**
231 * struct iwl_mac_data_p2p_sta - configuration data for P2P client MAC context
232 * @sta: iwl_mac_data_sta struct with most config data
233 * @ctwin: client traffic window in TU (period after TBTT when GO is present).
234 * 0 indicates that there is no CT window.
235 */
236struct iwl_mac_data_p2p_sta {
237 struct iwl_mac_data_sta sta;
238 __le32 ctwin;
239} __packed; /* P2P_STA_MAC_DATA_API_S_VER_1 */
240
241/**
242 * struct iwl_mac_data_pibss - Pseudo IBSS config data
243 * @stats_interval: interval in TU between statistics notifications to host.
244 */
245struct iwl_mac_data_pibss {
246 __le32 stats_interval;
247} __packed; /* PIBSS_MAC_DATA_API_S_VER_1 */
248
249/*
250 * struct iwl_mac_data_p2p_dev - configuration data for the P2P Device MAC
251 * context.
252 * @is_disc_extended: if set to true, P2P Device discoverability is enabled on
253 * other channels as well. This should be to true only in case that the
254 * device is discoverable and there is an active GO. Note that setting this
255 * field when not needed, will increase the number of interrupts and have
256 * effect on the platform power, as this setting opens the Rx filters on
257 * all macs.
258 */
259struct iwl_mac_data_p2p_dev {
260 __le32 is_disc_extended;
261} __packed; /* _P2P_DEV_MAC_DATA_API_S_VER_1 */
262
263/**
264 * enum iwl_mac_filter_flags - MAC context filter flags
265 * @MAC_FILTER_IN_PROMISC: accept all data frames
Sara Sharon0d365ae2015-03-31 12:24:05 +0300266 * @MAC_FILTER_IN_CONTROL_AND_MGMT: pass all management and
Johannes Berg8ca151b2013-01-24 14:25:36 +0100267 * control frames to the host
268 * @MAC_FILTER_ACCEPT_GRP: accept multicast frames
269 * @MAC_FILTER_DIS_DECRYPT: don't decrypt unicast frames
270 * @MAC_FILTER_DIS_GRP_DECRYPT: don't decrypt multicast frames
271 * @MAC_FILTER_IN_BEACON: transfer foreign BSS's beacons to host
272 * (in station mode when associated)
273 * @MAC_FILTER_OUT_BCAST: filter out all broadcast frames
274 * @MAC_FILTER_IN_CRC32: extract FCS and append it to frames
275 * @MAC_FILTER_IN_PROBE_REQUEST: pass probe requests to host
276 */
277enum iwl_mac_filter_flags {
278 MAC_FILTER_IN_PROMISC = BIT(0),
279 MAC_FILTER_IN_CONTROL_AND_MGMT = BIT(1),
280 MAC_FILTER_ACCEPT_GRP = BIT(2),
281 MAC_FILTER_DIS_DECRYPT = BIT(3),
282 MAC_FILTER_DIS_GRP_DECRYPT = BIT(4),
283 MAC_FILTER_IN_BEACON = BIT(6),
284 MAC_FILTER_OUT_BCAST = BIT(8),
285 MAC_FILTER_IN_CRC32 = BIT(11),
286 MAC_FILTER_IN_PROBE_REQUEST = BIT(12),
287};
288
289/**
290 * enum iwl_mac_qos_flags - QoS flags
291 * @MAC_QOS_FLG_UPDATE_EDCA: ?
292 * @MAC_QOS_FLG_TGN: HT is enabled
293 * @MAC_QOS_FLG_TXOP_TYPE: ?
294 *
295 */
296enum iwl_mac_qos_flags {
297 MAC_QOS_FLG_UPDATE_EDCA = BIT(0),
298 MAC_QOS_FLG_TGN = BIT(1),
299 MAC_QOS_FLG_TXOP_TYPE = BIT(4),
300};
301
302/**
303 * struct iwl_ac_qos - QOS timing params for MAC_CONTEXT_CMD
304 * @cw_min: Contention window, start value in numbers of slots.
305 * Should be a power-of-2, minus 1. Device's default is 0x0f.
306 * @cw_max: Contention window, max value in numbers of slots.
307 * Should be a power-of-2, minus 1. Device's default is 0x3f.
308 * @aifsn: Number of slots in Arbitration Interframe Space (before
309 * performing random backoff timing prior to Tx). Device default 1.
310 * @fifos_mask: FIFOs used by this MAC for this AC
311 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
312 *
313 * One instance of this config struct for each of 4 EDCA access categories
314 * in struct iwl_qosparam_cmd.
315 *
316 * Device will automatically increase contention window by (2*CW) + 1 for each
317 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
318 * value, to cap the CW value.
319 */
320struct iwl_ac_qos {
321 __le16 cw_min;
322 __le16 cw_max;
323 u8 aifsn;
324 u8 fifos_mask;
325 __le16 edca_txop;
326} __packed; /* AC_QOS_API_S_VER_2 */
327
328/**
329 * struct iwl_mac_ctx_cmd - command structure to configure MAC contexts
330 * ( MAC_CONTEXT_CMD = 0x28 )
331 * @id_and_color: ID and color of the MAC
332 * @action: action to perform, one of FW_CTXT_ACTION_*
Johannes Berg67625862017-03-14 11:01:27 +0100333 * @mac_type: one of &enum iwl_mac_types
Johannes Berg83b03192017-05-16 13:28:53 +0200334 * @tsf_id: TSF HW timer, one of &enum iwl_tsf_id
Johannes Berg8ca151b2013-01-24 14:25:36 +0100335 * @node_addr: MAC address
Johannes Bergacf91dd2017-05-16 16:15:42 +0200336 * @reserved_for_node_addr: reserved
Johannes Berg8ca151b2013-01-24 14:25:36 +0100337 * @bssid_addr: BSSID
Johannes Bergacf91dd2017-05-16 16:15:42 +0200338 * @reserved_for_bssid_addr: reserved
Johannes Berg8ca151b2013-01-24 14:25:36 +0100339 * @cck_rates: basic rates available for CCK
340 * @ofdm_rates: basic rates available for OFDM
Johannes Berg67625862017-03-14 11:01:27 +0100341 * @protection_flags: combination of &enum iwl_mac_protection_flags
Johannes Berg8ca151b2013-01-24 14:25:36 +0100342 * @cck_short_preamble: 0x20 for enabling short preamble, 0 otherwise
343 * @short_slot: 0x10 for enabling short slots, 0 otherwise
Johannes Berg67625862017-03-14 11:01:27 +0100344 * @filter_flags: combination of &enum iwl_mac_filter_flags
345 * @qos_flags: from &enum iwl_mac_qos_flags
Johannes Berg8ca151b2013-01-24 14:25:36 +0100346 * @ac: one iwl_mac_qos configuration for each AC
Johannes Berg8ca151b2013-01-24 14:25:36 +0100347 */
348struct iwl_mac_ctx_cmd {
349 /* COMMON_INDEX_HDR_API_S_VER_1 */
350 __le32 id_and_color;
351 __le32 action;
352 /* MAC_CONTEXT_COMMON_DATA_API_S_VER_1 */
353 __le32 mac_type;
354 __le32 tsf_id;
355 u8 node_addr[6];
356 __le16 reserved_for_node_addr;
357 u8 bssid_addr[6];
358 __le16 reserved_for_bssid_addr;
359 __le32 cck_rates;
360 __le32 ofdm_rates;
361 __le32 protection_flags;
362 __le32 cck_short_preamble;
363 __le32 short_slot;
364 __le32 filter_flags;
365 /* MAC_QOS_PARAM_API_S_VER_1 */
366 __le32 qos_flags;
367 struct iwl_ac_qos ac[AC_NUM+1];
368 /* MAC_CONTEXT_COMMON_DATA_API_S */
369 union {
370 struct iwl_mac_data_ap ap;
371 struct iwl_mac_data_go go;
372 struct iwl_mac_data_sta sta;
373 struct iwl_mac_data_p2p_sta p2p_sta;
374 struct iwl_mac_data_p2p_dev p2p_dev;
375 struct iwl_mac_data_pibss pibss;
376 struct iwl_mac_data_ibss ibss;
377 };
378} __packed; /* MAC_CONTEXT_CMD_API_S_VER_1 */
379
380static inline u32 iwl_mvm_reciprocal(u32 v)
381{
382 if (!v)
383 return 0;
384 return 0xFFFFFFFF / v;
385}
386
Johannes Berg6d9d32b2013-08-06 18:58:56 +0200387#define IWL_NONQOS_SEQ_GET 0x1
388#define IWL_NONQOS_SEQ_SET 0x2
389struct iwl_nonqos_seq_query_cmd {
390 __le32 get_set_flag;
391 __le32 mac_id_n_color;
392 __le16 value;
393 __le16 reserved;
394} __packed; /* NON_QOS_TX_COUNTER_GET_SET_API_S_VER_1 */
395
Johannes Berg8ca151b2013-01-24 14:25:36 +0100396#endif /* __fw_api_mac_h__ */