blob: 85057219cc43ff4c4edbd3e606a9254dae9772e5 [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:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * 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_rs_h__
64#define __fw_api_rs_h__
65
66#include "fw-api-mac.h"
67
68/*
69 * These serve as indexes into
70 * struct iwl_rate_info fw_rate_idx_to_plcp[IWL_RATE_COUNT];
Eyal Shapirad310e402013-08-11 18:43:47 +030071 * TODO: avoid overlap between legacy and HT rates
Johannes Berg8ca151b2013-01-24 14:25:36 +010072 */
73enum {
74 IWL_RATE_1M_INDEX = 0,
75 IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX,
76 IWL_RATE_2M_INDEX,
77 IWL_RATE_5M_INDEX,
78 IWL_RATE_11M_INDEX,
79 IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX,
80 IWL_RATE_6M_INDEX,
81 IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030082 IWL_RATE_MCS_0_INDEX = IWL_RATE_6M_INDEX,
83 IWL_FIRST_HT_RATE = IWL_RATE_MCS_0_INDEX,
84 IWL_FIRST_VHT_RATE = IWL_RATE_MCS_0_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010085 IWL_RATE_9M_INDEX,
86 IWL_RATE_12M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030087 IWL_RATE_MCS_1_INDEX = IWL_RATE_12M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010088 IWL_RATE_18M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030089 IWL_RATE_MCS_2_INDEX = IWL_RATE_18M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010090 IWL_RATE_24M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030091 IWL_RATE_MCS_3_INDEX = IWL_RATE_24M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010092 IWL_RATE_36M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030093 IWL_RATE_MCS_4_INDEX = IWL_RATE_36M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010094 IWL_RATE_48M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030095 IWL_RATE_MCS_5_INDEX = IWL_RATE_48M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010096 IWL_RATE_54M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +030097 IWL_RATE_MCS_6_INDEX = IWL_RATE_54M_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +010098 IWL_LAST_NON_HT_RATE = IWL_RATE_54M_INDEX,
99 IWL_RATE_60M_INDEX,
Eyal Shapira4e82dd32013-08-04 23:58:37 +0300100 IWL_RATE_MCS_7_INDEX = IWL_RATE_60M_INDEX,
101 IWL_LAST_HT_RATE = IWL_RATE_MCS_7_INDEX,
102 IWL_RATE_MCS_8_INDEX,
103 IWL_RATE_MCS_9_INDEX,
104 IWL_LAST_VHT_RATE = IWL_RATE_MCS_9_INDEX,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100105 IWL_RATE_COUNT_LEGACY = IWL_LAST_NON_HT_RATE + 1,
Eyal Shapira4e82dd32013-08-04 23:58:37 +0300106 IWL_RATE_COUNT = IWL_LAST_VHT_RATE + 1,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100107};
108
109#define IWL_RATE_BIT_MSK(r) BIT(IWL_RATE_##r##M_INDEX)
110
111/* fw API values for legacy bit rates, both OFDM and CCK */
112enum {
113 IWL_RATE_6M_PLCP = 13,
114 IWL_RATE_9M_PLCP = 15,
115 IWL_RATE_12M_PLCP = 5,
116 IWL_RATE_18M_PLCP = 7,
117 IWL_RATE_24M_PLCP = 9,
118 IWL_RATE_36M_PLCP = 11,
119 IWL_RATE_48M_PLCP = 1,
120 IWL_RATE_54M_PLCP = 3,
121 IWL_RATE_1M_PLCP = 10,
122 IWL_RATE_2M_PLCP = 20,
123 IWL_RATE_5M_PLCP = 55,
124 IWL_RATE_11M_PLCP = 110,
Eyal Shapirad310e402013-08-11 18:43:47 +0300125 IWL_RATE_INVM_PLCP = -1,
Johannes Berg8ca151b2013-01-24 14:25:36 +0100126};
127
128/*
129 * rate_n_flags bit fields
130 *
131 * The 32-bit value has different layouts in the low 8 bites depending on the
132 * format. There are three formats, HT, VHT and legacy (11abg, with subformats
133 * for CCK and OFDM).
134 *
135 * High-throughput (HT) rate format
136 * bit 8 is 1, bit 26 is 0, bit 9 is 0 (OFDM)
137 * Very High-throughput (VHT) rate format
138 * bit 8 is 0, bit 26 is 1, bit 9 is 0 (OFDM)
139 * Legacy OFDM rate format for bits 7:0
140 * bit 8 is 0, bit 26 is 0, bit 9 is 0 (OFDM)
141 * Legacy CCK rate format for bits 7:0:
142 * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK)
143 */
144
145/* Bit 8: (1) HT format, (0) legacy or VHT format */
146#define RATE_MCS_HT_POS 8
147#define RATE_MCS_HT_MSK (1 << RATE_MCS_HT_POS)
148
149/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
150#define RATE_MCS_CCK_POS 9
151#define RATE_MCS_CCK_MSK (1 << RATE_MCS_CCK_POS)
152
153/* Bit 26: (1) VHT format, (0) legacy format in bits 8:0 */
154#define RATE_MCS_VHT_POS 26
155#define RATE_MCS_VHT_MSK (1 << RATE_MCS_VHT_POS)
156
157
158/*
159 * High-throughput (HT) rate format for bits 7:0
160 *
161 * 2-0: MCS rate base
162 * 0) 6 Mbps
163 * 1) 12 Mbps
164 * 2) 18 Mbps
165 * 3) 24 Mbps
166 * 4) 36 Mbps
167 * 5) 48 Mbps
168 * 6) 54 Mbps
169 * 7) 60 Mbps
170 * 4-3: 0) Single stream (SISO)
171 * 1) Dual stream (MIMO)
172 * 2) Triple stream (MIMO)
173 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
174 * (bits 7-6 are zero)
175 *
176 * Together the low 5 bits work out to the MCS index because we don't
177 * support MCSes above 15/23, and 0-7 have one stream, 8-15 have two
178 * streams and 16-23 have three streams. We could also support MCS 32
179 * which is the duplicate 20 MHz MCS (bit 5 set, all others zero.)
180 */
181#define RATE_HT_MCS_RATE_CODE_MSK 0x7
Eyal Shapirad310e402013-08-11 18:43:47 +0300182#define RATE_HT_MCS_NSS_POS 3
183#define RATE_HT_MCS_NSS_MSK (3 << RATE_HT_MCS_NSS_POS)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100184
185/* Bit 10: (1) Use Green Field preamble */
186#define RATE_HT_MCS_GF_POS 10
187#define RATE_HT_MCS_GF_MSK (1 << RATE_HT_MCS_GF_POS)
188
189#define RATE_HT_MCS_INDEX_MSK 0x3f
190
191/*
192 * Very High-throughput (VHT) rate format for bits 7:0
193 *
194 * 3-0: VHT MCS (0-9)
195 * 5-4: number of streams - 1:
196 * 0) Single stream (SISO)
197 * 1) Dual stream (MIMO)
198 * 2) Triple stream (MIMO)
199 */
200
201/* Bit 4-5: (0) SISO, (1) MIMO2 (2) MIMO3 */
202#define RATE_VHT_MCS_RATE_CODE_MSK 0xf
203#define RATE_VHT_MCS_NSS_POS 4
204#define RATE_VHT_MCS_NSS_MSK (3 << RATE_VHT_MCS_NSS_POS)
205
206/*
207 * Legacy OFDM rate format for bits 7:0
208 *
209 * 3-0: 0xD) 6 Mbps
210 * 0xF) 9 Mbps
211 * 0x5) 12 Mbps
212 * 0x7) 18 Mbps
213 * 0x9) 24 Mbps
214 * 0xB) 36 Mbps
215 * 0x1) 48 Mbps
216 * 0x3) 54 Mbps
217 * (bits 7-4 are 0)
218 *
219 * Legacy CCK rate format for bits 7:0:
220 * bit 8 is 0, bit 26 is 0, bit 9 is 1 (CCK):
221 *
222 * 6-0: 10) 1 Mbps
223 * 20) 2 Mbps
224 * 55) 5.5 Mbps
225 * 110) 11 Mbps
226 * (bit 7 is 0)
227 */
228#define RATE_LEGACY_RATE_MSK 0xff
229
230
231/*
232 * Bit 11-12: (0) 20MHz, (1) 40MHz, (2) 80MHz, (3) 160MHz
233 * 0 and 1 are valid for HT and VHT, 2 and 3 only for VHT
234 */
235#define RATE_MCS_CHAN_WIDTH_POS 11
236#define RATE_MCS_CHAN_WIDTH_MSK (3 << RATE_MCS_CHAN_WIDTH_POS)
237#define RATE_MCS_CHAN_WIDTH_20 (0 << RATE_MCS_CHAN_WIDTH_POS)
238#define RATE_MCS_CHAN_WIDTH_40 (1 << RATE_MCS_CHAN_WIDTH_POS)
239#define RATE_MCS_CHAN_WIDTH_80 (2 << RATE_MCS_CHAN_WIDTH_POS)
240#define RATE_MCS_CHAN_WIDTH_160 (3 << RATE_MCS_CHAN_WIDTH_POS)
241
242/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
243#define RATE_MCS_SGI_POS 13
244#define RATE_MCS_SGI_MSK (1 << RATE_MCS_SGI_POS)
245
246/* Bit 14-16: Antenna selection (1) Ant A, (2) Ant B, (4) Ant C */
247#define RATE_MCS_ANT_POS 14
248#define RATE_MCS_ANT_A_MSK (1 << RATE_MCS_ANT_POS)
249#define RATE_MCS_ANT_B_MSK (2 << RATE_MCS_ANT_POS)
250#define RATE_MCS_ANT_C_MSK (4 << RATE_MCS_ANT_POS)
251#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | \
252 RATE_MCS_ANT_B_MSK)
253#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | \
254 RATE_MCS_ANT_C_MSK)
255#define RATE_MCS_ANT_MSK RATE_MCS_ANT_ABC_MSK
256#define RATE_MCS_ANT_NUM 3
257
258/* Bit 17-18: (0) SS, (1) SS*2 */
259#define RATE_MCS_STBC_POS 17
260#define RATE_MCS_STBC_MSK (1 << RATE_MCS_STBC_POS)
261
262/* Bit 19: (0) Beamforming is off, (1) Beamforming is on */
263#define RATE_MCS_BF_POS 19
264#define RATE_MCS_BF_MSK (1 << RATE_MCS_BF_POS)
265
266/* Bit 20: (0) ZLF is off, (1) ZLF is on */
267#define RATE_MCS_ZLF_POS 20
268#define RATE_MCS_ZLF_MSK (1 << RATE_MCS_ZLF_POS)
269
270/* Bit 24-25: (0) 20MHz (no dup), (1) 2x20MHz, (2) 4x20MHz, 3 8x20MHz */
271#define RATE_MCS_DUP_POS 24
272#define RATE_MCS_DUP_MSK (3 << RATE_MCS_DUP_POS)
273
274/* Bit 27: (1) LDPC enabled, (0) LDPC disabled */
275#define RATE_MCS_LDPC_POS 27
276#define RATE_MCS_LDPC_MSK (1 << RATE_MCS_LDPC_POS)
277
278
279/* Link Quality definitions */
280
281/* # entries in rate scale table to support Tx retries */
282#define LQ_MAX_RETRY_NUM 16
283
Eyal Shapirad307ec82013-11-11 19:56:21 +0200284/* Link quality command flags bit fields */
285
286/* Bit 0: (0) Don't use RTS (1) Use RTS */
287#define LQ_FLAG_USE_RTS_POS 0
288#define LQ_FLAG_USE_RTS_MSK (1 << LQ_FLAG_USE_RTS_POS)
289
290/* Bit 1-3: LQ command color. Used to match responses to LQ commands */
291#define LQ_FLAG_COLOR_POS 1
292#define LQ_FLAG_COLOR_MSK (7 << LQ_FLAG_COLOR_POS)
293
294/* Bit 4-5: Tx RTS BW Signalling
295 * (0) No RTS BW signalling
296 * (1) Static BW signalling
297 * (2) Dynamic BW signalling
298 */
299#define LQ_FLAG_RTS_BW_SIG_POS 4
300#define LQ_FLAG_RTS_BW_SIG_NONE (0 << LQ_FLAG_RTS_BW_SIG_POS)
301#define LQ_FLAG_RTS_BW_SIG_STATIC (1 << LQ_FLAG_RTS_BW_SIG_POS)
302#define LQ_FLAG_RTS_BW_SIG_DYNAMIC (2 << LQ_FLAG_RTS_BW_SIG_POS)
303
304/* Bit 6: (0) No dynamic BW selection (1) Allow dynamic BW selection
305 * Dyanmic BW selection allows Tx with narrower BW then requested in rates
306 */
307#define LQ_FLAG_DYNAMIC_BW_POS 6
308#define LQ_FLAG_DYNAMIC_BW_MSK (1 << LQ_FLAG_DYNAMIC_BW_POS)
Johannes Berg8ca151b2013-01-24 14:25:36 +0100309
310/**
311 * struct iwl_lq_cmd - link quality command
312 * @sta_id: station to update
313 * @control: not used
314 * @flags: combination of LQ_FLAG_*
315 * @mimo_delim: the first SISO index in rs_table, which separates MIMO
316 * and SISO rates
317 * @single_stream_ant_msk: best antenna for SISO (can be dual in CDD).
318 * Should be ANT_[ABC]
319 * @dual_stream_ant_msk: best antennas for MIMO, combination of ANT_[ABC]
320 * @initial_rate_index: first index from rs_table per AC category
321 * @agg_time_limit: aggregation max time threshold in usec/100, meaning
322 * value of 100 is one usec. Range is 100 to 8000
323 * @agg_disable_start_th: try-count threshold for starting aggregation.
324 * If a frame has higher try-count, it should not be selected for
325 * starting an aggregation sequence.
326 * @agg_frame_cnt_limit: max frame count in an aggregation.
327 * 0: no limit
328 * 1: no aggregation (one frame per aggregation)
329 * 2 - 0x3f: maximal number of frames (up to 3f == 63)
330 * @rs_table: array of rates for each TX try, each is rate_n_flags,
331 * meaning it is a combination of RATE_MCS_* and IWL_RATE_*_PLCP
332 * @bf_params: beam forming params, currently not used
333 */
334struct iwl_lq_cmd {
335 u8 sta_id;
336 u8 reserved1;
337 u16 control;
338 /* LINK_QUAL_GENERAL_PARAMS_API_S_VER_1 */
339 u8 flags;
340 u8 mimo_delim;
341 u8 single_stream_ant_msk;
342 u8 dual_stream_ant_msk;
343 u8 initial_rate_index[AC_NUM];
344 /* LINK_QUAL_AGG_PARAMS_API_S_VER_1 */
345 __le16 agg_time_limit;
346 u8 agg_disable_start_th;
347 u8 agg_frame_cnt_limit;
348 __le32 reserved2;
349 __le32 rs_table[LQ_MAX_RETRY_NUM];
350 __le32 bf_params;
351}; /* LINK_QUALITY_CMD_API_S_VER_1 */
352#endif /* __fw_api_rs_h__ */