blob: 9eb7a83bbf1b695a639c3b317a193b415ad5813b [file] [log] [blame]
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001/******************************************************************************
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 *
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
9 *
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
25 * in the file called LICENSE.GPL.
26 *
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 *
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
34 * 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 *****************************************************************************/
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080063
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020064#ifndef __il_commands_h__
65#define __il_commands_h__
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080066
Stanislaw Gruszka99412002011-08-31 13:53:04 +020067#include <linux/ieee80211.h>
68
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020069struct il_priv;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080070
71/* uCode version contains 4 values: Major/Minor/API/Serial */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020072#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
73#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
74#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
75#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080076
77
78/* Tx rates */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +020079#define IL_CCK_RATES 4
80#define IL_OFDM_RATES 8
81#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080082
83enum {
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +020084 N_ALIVE = 0x1,
85 N_ERROR = 0x2,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080086
87 /* RXON and QOS commands */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +020088 C_RXON = 0x10,
89 C_RXON_ASSOC = 0x11,
90 C_QOS_PARAM = 0x13,
91 C_RXON_TIMING = 0x14,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080092
93 /* Multi-Station support */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +020094 C_ADD_STA = 0x18,
95 C_REM_STA = 0x19,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080096
97 /* Security */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +020098 C_WEPKEY = 0x20,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -080099
100 /* RX, TX, LEDs */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200101 N_3945_RX = 0x1b, /* 3945 only */
102 C_TX = 0x1c,
103 C_RATE_SCALE = 0x47, /* 3945 only */
104 C_LEDS = 0x48,
105 C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800106
107 /* 802.11h related */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200108 C_CHANNEL_SWITCH = 0x72,
109 N_CHANNEL_SWITCH = 0x73,
110 C_SPECTRUM_MEASUREMENT = 0x74,
111 N_SPECTRUM_MEASUREMENT = 0x75,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800112
113 /* Power Management */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200114 C_POWER_TBL = 0x77,
115 N_PM_SLEEP = 0x7A,
116 N_PM_DEBUG_STATS = 0x7B,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800117
118 /* Scan commands and notifications */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200119 C_SCAN = 0x80,
120 C_SCAN_ABORT = 0x81,
121 N_SCAN_START = 0x82,
122 N_SCAN_RESULTS = 0x83,
123 N_SCAN_COMPLETE = 0x84,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800124
125 /* IBSS/AP commands */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200126 N_BEACON = 0x90,
127 C_TX_BEACON= 0x91,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800128
129 /* Miscellaneous commands */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200130 C_TX_PWR_TBL = 0x97,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800131
132 /* Bluetooth device coexistence config command */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200133 C_BT_CONFIG = 0x9b,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800134
135 /* Statistics */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200136 C_STATS = 0x9c,
137 N_STATS = 0x9d,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800138
139 /* RF-KILL commands and notifications */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200140 N_CARD_STATE = 0xa1,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800141
142 /* Missed beacons notification */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200143 N_MISSED_BEACONS = 0xa2,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800144
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200145 C_CT_KILL_CONFIG = 0xa4,
146 C_SENSITIVITY = 0xa8,
147 C_PHY_CALIBRATION = 0xb0,
148 N_RX_PHY = 0xc0,
149 N_RX_MPDU = 0xc1,
150 N_RX = 0xc3,
151 N_COMPRESSED_BA = 0xc5,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800152
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200153 IL_CN_MAX = 0xff
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800154};
155
156/******************************************************************************
157 * (0)
158 * Commonly used structures and definitions:
159 * Command header, rate_n_flags, txpower
160 *
161 *****************************************************************************/
162
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200163/* il_cmd_header flags value */
164#define IL_CMD_FAILED_MSK 0x40
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800165
166#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
167#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +0200168#define SEQ_TO_IDX(s) ((s) & 0xff)
169#define IDX_TO_SEQ(i) ((i) & 0xff)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800170#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
171#define SEQ_RX_FRAME cpu_to_le16(0x8000)
172
173/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200174 * struct il_cmd_header
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800175 *
176 * This header format appears in the beginning of each command sent from the
177 * driver, and each response/notification received from uCode.
178 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200179struct il_cmd_header {
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200180 u8 cmd; /* Command ID: C_RXON, etc. */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800181 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
182 /*
183 * The driver sets up the sequence number to values of its choosing.
184 * uCode does not use this value, but passes it back to the driver
185 * when sending the response to each driver-originated command, so
186 * the driver can match the response to the command. Since the values
187 * don't get used by uCode, the driver may set up an arbitrary format.
188 *
189 * There is one exception: uCode sets bit 15 when it originates
190 * the response/notification, i.e. when the response/notification
191 * is not a direct response to a command sent by the driver. For
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200192 * example, uCode issues N_3945_RX when it sends a received frame
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800193 * to the driver; it is not a direct response to any driver command.
194 *
195 * The Linux driver uses the following format:
196 *
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100197 * 0:7 tfd idx - position within TX queue
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800198 * 8:12 TX queue id
199 * 13 reserved
200 * 14 huge - driver sets this to indicate command is in the
201 * 'huge' storage at the end of the command buffers
202 * 15 unsolicited RX or uCode-originated notification
203 */
204 __le16 sequence;
205
206 /* command or response/notification data follows immediately */
207 u8 data[0];
208} __packed;
209
210
211/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200212 * struct il3945_tx_power
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800213 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200214 * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800215 *
216 * Each entry contains two values:
217 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
218 * linear value that multiplies the output of the digital signal processor,
219 * before being sent to the analog radio.
220 * 2) Radio gain. This sets the analog gain of the radio Tx path.
221 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
222 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200223 * Driver obtains values from struct il3945_tx_power power_gain_table[][].
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800224 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200225struct il3945_tx_power {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800226 u8 tx_gain; /* gain for analog radio */
227 u8 dsp_atten; /* gain for DSP */
228} __packed;
229
230/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200231 * struct il3945_power_per_rate
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800232 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200233 * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800234 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200235struct il3945_power_per_rate {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800236 u8 rate; /* plcp */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200237 struct il3945_tx_power tpc;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800238 u8 reserved;
239} __packed;
240
241/**
242 * iwl4965 rate_n_flags bit fields
243 *
244 * rate_n_flags format is used in following iwl4965 commands:
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200245 * N_RX (response only)
246 * N_RX_MPDU (response only)
247 * C_TX (both command and response)
248 * C_TX_LINK_QUALITY_CMD
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800249 *
250 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
251 * 2-0: 0) 6 Mbps
252 * 1) 12 Mbps
253 * 2) 18 Mbps
254 * 3) 24 Mbps
255 * 4) 36 Mbps
256 * 5) 48 Mbps
257 * 6) 54 Mbps
258 * 7) 60 Mbps
259 *
260 * 4-3: 0) Single stream (SISO)
261 * 1) Dual stream (MIMO)
262 * 2) Triple stream (MIMO)
263 *
264 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
265 *
266 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
267 * 3-0: 0xD) 6 Mbps
268 * 0xF) 9 Mbps
269 * 0x5) 12 Mbps
270 * 0x7) 18 Mbps
271 * 0x9) 24 Mbps
272 * 0xB) 36 Mbps
273 * 0x1) 48 Mbps
274 * 0x3) 54 Mbps
275 *
276 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
277 * 6-0: 10) 1 Mbps
278 * 20) 2 Mbps
279 * 55) 5.5 Mbps
280 * 110) 11 Mbps
281 */
282#define RATE_MCS_CODE_MSK 0x7
283#define RATE_MCS_SPATIAL_POS 3
284#define RATE_MCS_SPATIAL_MSK 0x18
285#define RATE_MCS_HT_DUP_POS 5
286#define RATE_MCS_HT_DUP_MSK 0x20
287
288/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
289#define RATE_MCS_FLAGS_POS 8
290#define RATE_MCS_HT_POS 8
291#define RATE_MCS_HT_MSK 0x100
292
293/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
294#define RATE_MCS_CCK_POS 9
295#define RATE_MCS_CCK_MSK 0x200
296
297/* Bit 10: (1) Use Green Field preamble */
298#define RATE_MCS_GF_POS 10
299#define RATE_MCS_GF_MSK 0x400
300
301/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
302#define RATE_MCS_HT40_POS 11
303#define RATE_MCS_HT40_MSK 0x800
304
305/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
306#define RATE_MCS_DUP_POS 12
307#define RATE_MCS_DUP_MSK 0x1000
308
309/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
310#define RATE_MCS_SGI_POS 13
311#define RATE_MCS_SGI_MSK 0x2000
312
313/**
314 * rate_n_flags Tx antenna masks
315 * 4965 has 2 transmitters
316 * bit14:16
317 */
318#define RATE_MCS_ANT_POS 14
319#define RATE_MCS_ANT_A_MSK 0x04000
320#define RATE_MCS_ANT_B_MSK 0x08000
321#define RATE_MCS_ANT_C_MSK 0x10000
322#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
323#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
324#define RATE_ANT_NUM 3
325
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +0200326#define POWER_TBL_NUM_ENTRIES 33
327#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32
328#define POWER_TBL_CCK_ENTRY 32
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800329
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200330#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
331#define IL_PWR_CCK_ENTRIES 2
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800332
333/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200334 * union il4965_tx_power_dual_stream
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800335 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200336 * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800337 * Use __le32 version (struct tx_power_dual_stream) when building command.
338 *
339 * Driver provides radio gain and DSP attenuation settings to device in pairs,
340 * one value for each transmitter chain. The first value is for transmitter A,
341 * second for transmitter B.
342 *
343 * For SISO bit rates, both values in a pair should be identical.
344 * For MIMO rates, one value may be different from the other,
345 * in order to balance the Tx output between the two transmitters.
346 *
Stanislaw Gruszkaaf038f42011-08-30 13:58:27 +0200347 * See more details in doc for TXPOWER in 4965.h.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800348 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200349union il4965_tx_power_dual_stream {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800350 struct {
351 u8 radio_tx_gain[2];
352 u8 dsp_predis_atten[2];
353 } s;
354 u32 dw;
355};
356
357/**
358 * struct tx_power_dual_stream
359 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200360 * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800361 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200362 * Same format as il_tx_power_dual_stream, but __le32
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800363 */
364struct tx_power_dual_stream {
365 __le32 dw;
366} __packed;
367
368/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200369 * struct il4965_tx_power_db
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800370 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200371 * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800372 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200373struct il4965_tx_power_db {
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +0200374 struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800375} __packed;
376
377/******************************************************************************
378 * (0a)
379 * Alive and Error Commands & Responses:
380 *
381 *****************************************************************************/
382
383#define UCODE_VALID_OK cpu_to_le32(0x1)
384#define INITIALIZE_SUBTYPE (9)
385
386/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200387 * ("Initialize") N_ALIVE = 0x1 (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800388 *
389 * uCode issues this "initialize alive" notification once the initialization
390 * uCode image has completed its work, and is ready to load the runtime image.
391 * This is the *first* "alive" notification that the driver will receive after
392 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
393 *
394 * See comments documenting "BSM" (bootstrap state machine).
395 *
396 * For 4965, this notification contains important calibration data for
397 * calculating txpower settings:
398 *
399 * 1) Power supply voltage indication. The voltage sensor outputs higher
400 * values for lower voltage, and vice verse.
401 *
402 * 2) Temperature measurement parameters, for each of two channel widths
403 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
404 * is done via one of the receiver chains, and channel width influences
405 * the results.
406 *
407 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
408 * for each of 5 frequency ranges.
409 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200410struct il_init_alive_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800411 u8 ucode_minor;
412 u8 ucode_major;
413 __le16 reserved1;
414 u8 sw_rev[8];
415 u8 ver_type;
416 u8 ver_subtype; /* "9" for initialize alive */
417 __le16 reserved2;
418 __le32 log_event_table_ptr;
419 __le32 error_event_table_ptr;
420 __le32 timestamp;
421 __le32 is_valid;
422
423 /* calibration values from "initialize" uCode */
424 __le32 voltage; /* signed, higher value is lower voltage */
425 __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
426 __le32 therm_r2[2]; /* signed */
427 __le32 therm_r3[2]; /* signed */
428 __le32 therm_r4[2]; /* signed */
429 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
430 * 2 Tx chains */
431} __packed;
432
433
434/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200435 * N_ALIVE = 0x1 (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800436 *
437 * uCode issues this "alive" notification once the runtime image is ready
438 * to receive commands from the driver. This is the *second* "alive"
439 * notification that the driver will receive after rebooting uCode;
440 * this "alive" is indicated by subtype field != 9.
441 *
442 * See comments documenting "BSM" (bootstrap state machine).
443 *
444 * This response includes two pointers to structures within the device's
445 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
446 *
447 * 1) log_event_table_ptr indicates base of the event log. This traces
448 * a 256-entry history of uCode execution within a circular buffer.
449 * Its header format is:
450 *
451 * __le32 log_size; log capacity (in number of entries)
452 * __le32 type; (1) timestamp with each entry, (0) no timestamp
453 * __le32 wraps; # times uCode has wrapped to top of circular buffer
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100454 * __le32 write_idx; next circular buffer entry that uCode would fill
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800455 *
456 * The header is followed by the circular buffer of log entries. Entries
457 * with timestamps have the following format:
458 *
459 * __le32 event_id; range 0 - 1500
460 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
461 * __le32 data; event_id-specific data value
462 *
463 * Entries without timestamps contain only event_id and data.
464 *
465 *
466 * 2) error_event_table_ptr indicates base of the error log. This contains
467 * information about any uCode error that occurs. For 4965, the format
468 * of the error log is:
469 *
470 * __le32 valid; (nonzero) valid, (0) log is empty
471 * __le32 error_id; type of error
472 * __le32 pc; program counter
473 * __le32 blink1; branch link
474 * __le32 blink2; branch link
475 * __le32 ilink1; interrupt link
476 * __le32 ilink2; interrupt link
477 * __le32 data1; error-specific data
478 * __le32 data2; error-specific data
479 * __le32 line; source code line of error
480 * __le32 bcon_time; beacon timer
481 * __le32 tsf_low; network timestamp function timer
482 * __le32 tsf_hi; network timestamp function timer
483 * __le32 gp1; GP1 timer register
484 * __le32 gp2; GP2 timer register
485 * __le32 gp3; GP3 timer register
486 * __le32 ucode_ver; uCode version
487 * __le32 hw_ver; HW Silicon version
488 * __le32 brd_ver; HW board version
489 * __le32 log_pc; log program counter
490 * __le32 frame_ptr; frame pointer
491 * __le32 stack_ptr; stack pointer
492 * __le32 hcmd; last host command
493 * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
494 * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
495 * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
496 * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
497 * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
498 * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
499 * __le32 wait_event; wait event() caller address
500 * __le32 l2p_control; L2pControlField
501 * __le32 l2p_duration; L2pDurationField
502 * __le32 l2p_mhvalid; L2pMhValidBits
503 * __le32 l2p_addr_match; L2pAddrMatchStat
504 * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
505 * __le32 u_timestamp; indicate when the date and time of the compilation
506 * __le32 reserved;
507 *
508 * The Linux driver can print both logs to the system log when a uCode error
509 * occurs.
510 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200511struct il_alive_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800512 u8 ucode_minor;
513 u8 ucode_major;
514 __le16 reserved1;
515 u8 sw_rev[8];
516 u8 ver_type;
517 u8 ver_subtype; /* not "9" for runtime alive */
518 __le16 reserved2;
519 __le32 log_event_table_ptr; /* SRAM address for event log */
520 __le32 error_event_table_ptr; /* SRAM address for error log */
521 __le32 timestamp;
522 __le32 is_valid;
523} __packed;
524
525/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200526 * N_ERROR = 0x2 (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800527 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200528struct il_error_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800529 __le32 error_type;
530 u8 cmd_id;
531 u8 reserved1;
532 __le16 bad_cmd_seq_num;
533 __le32 error_info;
534 __le64 timestamp;
535} __packed;
536
537/******************************************************************************
538 * (1)
539 * RXON Commands & Responses:
540 *
541 *****************************************************************************/
542
543/*
544 * Rx config defines & structure
545 */
546/* rx_config device types */
547enum {
548 RXON_DEV_TYPE_AP = 1,
549 RXON_DEV_TYPE_ESS = 3,
550 RXON_DEV_TYPE_IBSS = 4,
551 RXON_DEV_TYPE_SNIFFER = 6,
552};
553
554
555#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
556#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
557#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
558#define RXON_RX_CHAIN_VALID_POS (1)
559#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
560#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
561#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
562#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
563#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
564#define RXON_RX_CHAIN_CNT_POS (10)
565#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
566#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
567#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
568#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
569
570/* rx_config flags */
571/* band & modulation selection */
572#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
573#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
574/* auto detection enable */
575#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
576/* TGg protection when tx */
577#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
578/* cck short slot & preamble */
579#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
580#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
581/* antenna selection */
582#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
583#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
584#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
585#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
586/* radar detection enable */
587#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
588#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
589/* rx response to host with 8-byte TSF
590* (according to ON_AIR deassertion) */
591#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
592
593
594/* HT flags */
595#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
596#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
597
598#define RXON_FLG_HT_OPERATING_MODE_POS (23)
599
600#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
601#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
602
603#define RXON_FLG_CHANNEL_MODE_POS (25)
604#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
605
606/* channel mode */
607enum {
608 CHANNEL_MODE_LEGACY = 0,
609 CHANNEL_MODE_PURE_40 = 1,
610 CHANNEL_MODE_MIXED = 2,
611 CHANNEL_MODE_RESERVED = 3,
612};
613#define RXON_FLG_CHANNEL_MODE_LEGACY \
614 cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
615#define RXON_FLG_CHANNEL_MODE_PURE_40 \
616 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
617#define RXON_FLG_CHANNEL_MODE_MIXED \
618 cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
619
620/* CTS to self (if spec allows) flag */
621#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
622
623/* rx_config filter flags */
624/* accept all data frames */
625#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
626/* pass control & management to host */
627#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
628/* accept multi-cast */
629#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
630/* don't decrypt uni-cast frames */
631#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
632/* don't decrypt multi-cast frames */
633#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
634/* STA is associated */
635#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
636/* transfer to host non bssid beacons in associated state */
637#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
638
639/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200640 * C_RXON = 0x10 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800641 *
642 * RXON tunes the radio tuner to a service channel, and sets up a number
643 * of parameters that are used primarily for Rx, but also for Tx operations.
644 *
645 * NOTE: When tuning to a new channel, driver must set the
646 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
647 * info within the device, including the station tables, tx retry
648 * rate tables, and txpower tables. Driver must build a new station
649 * table and txpower table before transmitting anything on the RXON
650 * channel.
651 *
652 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200653 * issue a new C_TX_PWR_TBL after each C_RXON (0x10),
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800654 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
655 */
656
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200657struct il3945_rxon_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800658 u8 node_addr[6];
659 __le16 reserved1;
660 u8 bssid_addr[6];
661 __le16 reserved2;
662 u8 wlap_bssid_addr[6];
663 __le16 reserved3;
664 u8 dev_type;
665 u8 air_propagation;
666 __le16 reserved4;
667 u8 ofdm_basic_rates;
668 u8 cck_basic_rates;
669 __le16 assoc_id;
670 __le32 flags;
671 __le32 filter_flags;
672 __le16 channel;
673 __le16 reserved5;
674} __packed;
675
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200676struct il4965_rxon_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800677 u8 node_addr[6];
678 __le16 reserved1;
679 u8 bssid_addr[6];
680 __le16 reserved2;
681 u8 wlap_bssid_addr[6];
682 __le16 reserved3;
683 u8 dev_type;
684 u8 air_propagation;
685 __le16 rx_chain;
686 u8 ofdm_basic_rates;
687 u8 cck_basic_rates;
688 __le16 assoc_id;
689 __le32 flags;
690 __le32 filter_flags;
691 __le16 channel;
692 u8 ofdm_ht_single_stream_basic_rates;
693 u8 ofdm_ht_dual_stream_basic_rates;
694} __packed;
695
696/* Create a common rxon cmd which will be typecast into the 3945 or 4965
697 * specific rxon cmd, depending on where it is called from.
698 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200699struct il_rxon_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800700 u8 node_addr[6];
701 __le16 reserved1;
702 u8 bssid_addr[6];
703 __le16 reserved2;
704 u8 wlap_bssid_addr[6];
705 __le16 reserved3;
706 u8 dev_type;
707 u8 air_propagation;
708 __le16 rx_chain;
709 u8 ofdm_basic_rates;
710 u8 cck_basic_rates;
711 __le16 assoc_id;
712 __le32 flags;
713 __le32 filter_flags;
714 __le16 channel;
715 u8 ofdm_ht_single_stream_basic_rates;
716 u8 ofdm_ht_dual_stream_basic_rates;
717 u8 reserved4;
718 u8 reserved5;
719} __packed;
720
721
722/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200723 * C_RXON_ASSOC = 0x11 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800724 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200725struct il3945_rxon_assoc_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800726 __le32 flags;
727 __le32 filter_flags;
728 u8 ofdm_basic_rates;
729 u8 cck_basic_rates;
730 __le16 reserved;
731} __packed;
732
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200733struct il4965_rxon_assoc_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800734 __le32 flags;
735 __le32 filter_flags;
736 u8 ofdm_basic_rates;
737 u8 cck_basic_rates;
738 u8 ofdm_ht_single_stream_basic_rates;
739 u8 ofdm_ht_dual_stream_basic_rates;
740 __le16 rx_chain_select_flags;
741 __le16 reserved;
742} __packed;
743
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200744#define IL_CONN_MAX_LISTEN_INTERVAL 10
745#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
Stanislaw Gruszkad3175162011-11-15 11:25:42 +0100746#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800747
748/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200749 * C_RXON_TIMING = 0x14 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800750 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200751struct il_rxon_time_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800752 __le64 timestamp;
753 __le16 beacon_interval;
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +0200754 __le16 atim_win;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800755 __le32 beacon_init_val;
756 __le16 listen_interval;
757 u8 dtim_period;
758 u8 delta_cp_bss_tbtts;
759} __packed;
760
761/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200762 * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800763 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200764struct il3945_channel_switch_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800765 u8 band;
766 u8 expect_beacon;
767 __le16 channel;
768 __le32 rxon_flags;
769 __le32 rxon_filter_flags;
770 __le32 switch_time;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200771 struct il3945_power_per_rate power[IL_MAX_RATES];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800772} __packed;
773
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200774struct il4965_channel_switch_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800775 u8 band;
776 u8 expect_beacon;
777 __le16 channel;
778 __le32 rxon_flags;
779 __le32 rxon_filter_flags;
780 __le32 switch_time;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200781 struct il4965_tx_power_db tx_power;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800782} __packed;
783
784/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200785 * N_CHANNEL_SWITCH = 0x73 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800786 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200787struct il_csa_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800788 __le16 band;
789 __le16 channel;
790 __le32 status; /* 0 - OK, 1 - fail */
791} __packed;
792
793/******************************************************************************
794 * (2)
795 * Quality-of-Service (QOS) Commands & Responses:
796 *
797 *****************************************************************************/
798
799/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200800 * struct il_ac_qos -- QOS timing params for C_QOS_PARAM
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200801 * One for each of 4 EDCA access categories in struct il_qosparam_cmd
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800802 *
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +0200803 * @cw_min: Contention win, start value in numbers of slots.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800804 * Should be a power-of-2, minus 1. Device's default is 0x0f.
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +0200805 * @cw_max: Contention win, max value in numbers of slots.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800806 * Should be a power-of-2, minus 1. Device's default is 0x3f.
807 * @aifsn: Number of slots in Arbitration Interframe Space (before
808 * performing random backoff timing prior to Tx). Device default 1.
809 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
810 *
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +0200811 * Device will automatically increase contention win by (2*CW) + 1 for each
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800812 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
813 * value, to cap the CW value.
814 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200815struct il_ac_qos {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800816 __le16 cw_min;
817 __le16 cw_max;
818 u8 aifsn;
819 u8 reserved1;
820 __le16 edca_txop;
821} __packed;
822
823/* QoS flags defines */
824#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
825#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
826#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
827
828/* Number of Access Categories (AC) (EDCA), queues 0..3 */
829#define AC_NUM 4
830
831/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200832 * C_QOS_PARAM = 0x13 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800833 *
834 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
835 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
836 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200837struct il_qosparam_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800838 __le32 qos_flags;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200839 struct il_ac_qos ac[AC_NUM];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800840} __packed;
841
842/******************************************************************************
843 * (3)
844 * Add/Modify Stations Commands & Responses:
845 *
846 *****************************************************************************/
847/*
848 * Multi station support
849 */
850
851/* Special, dedicated locations within device's station table */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200852#define IL_AP_ID 0
853#define IL_STA_ID 2
Stanislaw Gruszkad3175162011-11-15 11:25:42 +0100854#define IL3945_BROADCAST_ID 24
855#define IL3945_STATION_COUNT 25
856#define IL4965_BROADCAST_ID 31
857#define IL4965_STATION_COUNT 32
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800858
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200859#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/
860#define IL_INVALID_STATION 255
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800861
862#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
863#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
864#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
865#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
866#define STA_FLG_MAX_AGG_SIZE_POS (19)
867#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
868#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
869#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
870#define STA_FLG_AGG_MPDU_DENSITY_POS (23)
871#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
872
873/* Use in mode field. 1: modify existing entry, 0: add new station entry */
874#define STA_CONTROL_MODIFY_MSK 0x01
875
876/* key flags __le16*/
877#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
878#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
879#define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
880#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
881#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
882
883#define STA_KEY_FLG_KEYID_POS 8
884#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
885/* wep key is either from global key (0) or from station info array (1) */
886#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
887
888/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
889#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
890#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
891#define STA_KEY_MAX_NUM 8
892
893/* Flags indicate whether to modify vs. don't change various station params */
894#define STA_MODIFY_KEY_MASK 0x01
895#define STA_MODIFY_TID_DISABLE_TX 0x02
896#define STA_MODIFY_TX_RATE_MSK 0x04
897#define STA_MODIFY_ADDBA_TID_MSK 0x08
898#define STA_MODIFY_DELBA_TID_MSK 0x10
899#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
900
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100901/* Receiver address (actually, Rx station's idx into station table),
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800902 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
903#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
904
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200905struct il4965_keyinfo {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800906 __le16 key_flags;
907 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
908 u8 reserved1;
909 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
910 u8 key_offset;
911 u8 reserved2;
912 u8 key[16]; /* 16-byte unicast decryption key */
913} __packed;
914
915/**
916 * struct sta_id_modify
917 * @addr[ETH_ALEN]: station's MAC address
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100918 * @sta_id: idx of station in uCode's station table
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800919 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
920 *
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100921 * Driver selects unused table idx when adding new station,
922 * or the idx to a pre-existing station entry when modifying that station.
923 * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP).
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800924 *
925 * modify_mask flags select which parameters to modify vs. leave alone.
926 */
927struct sta_id_modify {
928 u8 addr[ETH_ALEN];
929 __le16 reserved1;
930 u8 sta_id;
931 u8 modify_mask;
932 __le16 reserved2;
933} __packed;
934
935/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200936 * C_ADD_STA = 0x18 (command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800937 *
938 * The device contains an internal table of per-station information,
939 * with info on security keys, aggregation parameters, and Tx rates for
940 * initial Tx attempt and any retries (4965 devices uses
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200941 * C_TX_LINK_QUALITY_CMD,
942 * 3945 uses C_RATE_SCALE to set up rate tables).
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800943 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +0200944 * C_ADD_STA sets up the table entry for one station, either creating
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800945 * a new entry, or modifying a pre-existing one.
946 *
947 * NOTE: RXON command (without "associated" bit set) wipes the station table
948 * clean. Moving into RF_KILL state does this also. Driver must set up
949 * new station table before transmitting anything on the RXON channel
950 * (except active scans or active measurements; those commands carry
951 * their own txpower/rate setup data).
952 *
953 * When getting started on a new channel, driver must set up the
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200954 * IL_BROADCAST_ID entry (last entry in the table). For a client
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800955 * station in a BSS, once an AP is selected, driver sets up the AP STA
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200956 * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800957 * are all that are needed for a BSS client station. If the device is
958 * used as AP, or in an IBSS network, driver must set up station table
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +0100959 * entries for all STAs in network, starting with idx IL_STA_ID.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800960 */
961
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200962struct il3945_addsta_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800963 u8 mode; /* 1: modify existing, 0: add new station */
964 u8 reserved[3];
965 struct sta_id_modify sta;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200966 struct il4965_keyinfo key;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800967 __le32 station_flags; /* STA_FLG_* */
968 __le32 station_flags_msk; /* STA_FLG_* */
969
970 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
971 * corresponding to bit (e.g. bit 5 controls TID 5).
972 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
973 __le16 tid_disable_tx;
974
975 __le16 rate_n_flags;
976
977 /* TID for which to add block-ack support.
978 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
979 u8 add_immediate_ba_tid;
980
981 /* TID for which to remove block-ack support.
982 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
983 u8 remove_immediate_ba_tid;
984
985 /* Starting Sequence Number for added block-ack support.
986 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
987 __le16 add_immediate_ba_ssn;
988} __packed;
989
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200990struct il4965_addsta_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800991 u8 mode; /* 1: modify existing, 0: add new station */
992 u8 reserved[3];
993 struct sta_id_modify sta;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +0200994 struct il4965_keyinfo key;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -0800995 __le32 station_flags; /* STA_FLG_* */
996 __le32 station_flags_msk; /* STA_FLG_* */
997
998 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
999 * corresponding to bit (e.g. bit 5 controls TID 5).
1000 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1001 __le16 tid_disable_tx;
1002
1003 __le16 reserved1;
1004
1005 /* TID for which to add block-ack support.
1006 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1007 u8 add_immediate_ba_tid;
1008
1009 /* TID for which to remove block-ack support.
1010 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1011 u8 remove_immediate_ba_tid;
1012
1013 /* Starting Sequence Number for added block-ack support.
1014 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1015 __le16 add_immediate_ba_ssn;
1016
1017 /*
1018 * Number of packets OK to transmit to station even though
1019 * it is asleep -- used to synchronise PS-poll and u-APSD
1020 * responses while ucode keeps track of STA sleep state.
1021 */
1022 __le16 sleep_tx_count;
1023
1024 __le16 reserved2;
1025} __packed;
1026
1027/* Wrapper struct for 3945 and 4965 addsta_cmd structures */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001028struct il_addsta_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001029 u8 mode; /* 1: modify existing, 0: add new station */
1030 u8 reserved[3];
1031 struct sta_id_modify sta;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001032 struct il4965_keyinfo key;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001033 __le32 station_flags; /* STA_FLG_* */
1034 __le32 station_flags_msk; /* STA_FLG_* */
1035
1036 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1037 * corresponding to bit (e.g. bit 5 controls TID 5).
1038 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1039 __le16 tid_disable_tx;
1040
1041 __le16 rate_n_flags; /* 3945 only */
1042
1043 /* TID for which to add block-ack support.
1044 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1045 u8 add_immediate_ba_tid;
1046
1047 /* TID for which to remove block-ack support.
1048 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1049 u8 remove_immediate_ba_tid;
1050
1051 /* Starting Sequence Number for added block-ack support.
1052 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1053 __le16 add_immediate_ba_ssn;
1054
1055 /*
1056 * Number of packets OK to transmit to station even though
1057 * it is asleep -- used to synchronise PS-poll and u-APSD
1058 * responses while ucode keeps track of STA sleep state.
1059 */
1060 __le16 sleep_tx_count;
1061
1062 __le16 reserved2;
1063} __packed;
1064
1065
1066#define ADD_STA_SUCCESS_MSK 0x1
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +02001067#define ADD_STA_NO_ROOM_IN_TBL 0x2
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001068#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
1069#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
1070/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001071 * C_ADD_STA = 0x18 (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001072 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001073struct il_add_sta_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001074 u8 status; /* ADD_STA_* */
1075} __packed;
1076
1077#define REM_STA_SUCCESS_MSK 0x1
1078/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001079 * C_REM_STA = 0x19 (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001080 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001081struct il_rem_sta_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001082 u8 status;
1083} __packed;
1084
1085/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001086 * C_REM_STA = 0x19 (command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001087 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001088struct il_rem_sta_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001089 u8 num_sta; /* number of removed stations */
1090 u8 reserved[3];
1091 u8 addr[ETH_ALEN]; /* MAC addr of the first station */
1092 u8 reserved2[2];
1093} __packed;
1094
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001095#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1096#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1097#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1098#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1099#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001100
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001101#define IL_DROP_SINGLE 0
1102#define IL_DROP_SELECTED 1
1103#define IL_DROP_ALL 2
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001104
1105/*
1106 * REPLY_WEP_KEY = 0x20
1107 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001108struct il_wep_key {
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001109 u8 key_idx;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001110 u8 key_offset;
1111 u8 reserved1[2];
1112 u8 key_size;
1113 u8 reserved2[3];
1114 u8 key[16];
1115} __packed;
1116
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001117struct il_wep_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001118 u8 num_keys;
1119 u8 global_key_type;
1120 u8 flags;
1121 u8 reserved;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001122 struct il_wep_key key[0];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001123} __packed;
1124
1125#define WEP_KEY_WEP_TYPE 1
1126#define WEP_KEYS_MAX 4
1127#define WEP_INVALID_OFFSET 0xff
1128#define WEP_KEY_LEN_64 5
1129#define WEP_KEY_LEN_128 13
1130
1131/******************************************************************************
1132 * (4)
1133 * Rx Responses:
1134 *
1135 *****************************************************************************/
1136
1137#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
1138#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
1139
1140#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
1141#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1142#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1143#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
1144#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
1145#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
1146
1147#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
1148#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
1149#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
1150#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
1151#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
1152#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
1153
1154#define RX_RES_STATUS_STATION_FOUND (1<<6)
1155#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
1156
1157#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
1158#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
1159#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
1160#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
1161#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
1162
1163#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
1164#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
1165#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1166#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1167
1168
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001169struct il3945_rx_frame_stats {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001170 u8 phy_count;
1171 u8 id;
1172 u8 rssi;
1173 u8 agc;
1174 __le16 sig_avg;
1175 __le16 noise_diff;
1176 u8 payload[0];
1177} __packed;
1178
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001179struct il3945_rx_frame_hdr {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001180 __le16 channel;
1181 __le16 phy_flags;
1182 u8 reserved1;
1183 u8 rate;
1184 __le16 len;
1185 u8 payload[0];
1186} __packed;
1187
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001188struct il3945_rx_frame_end {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001189 __le32 status;
1190 __le64 timestamp;
1191 __le32 beacon_timestamp;
1192} __packed;
1193
1194/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001195 * N_3945_RX = 0x1b (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001196 *
1197 * NOTE: DO NOT dereference from casts to this structure
1198 * It is provided only for calculating minimum data set size.
1199 * The actual offsets of the hdr and end are dynamic based on
1200 * stats.phy_count
1201 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001202struct il3945_rx_frame {
1203 struct il3945_rx_frame_stats stats;
1204 struct il3945_rx_frame_hdr hdr;
1205 struct il3945_rx_frame_end end;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001206} __packed;
1207
Stanislaw Gruszkad3175162011-11-15 11:25:42 +01001208#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame))
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001209
1210/* Fixed (non-configurable) rx data from phy */
1211
Stanislaw Gruszkad3175162011-11-15 11:25:42 +01001212#define IL49_RX_RES_PHY_CNT 14
1213#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
1214#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1215#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1216#define IL49_AGC_DB_POS (7)
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001217struct il4965_rx_non_cfg_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001218 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1219 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1220 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
1221 u8 pad[0];
1222} __packed;
1223
1224
1225/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001226 * N_RX = 0xc3 (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001227 * Used only for legacy (non 11n) frames.
1228 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001229struct il_rx_phy_res {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001230 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
1231 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
1232 u8 stat_id; /* configurable DSP phy data set ID */
1233 u8 reserved1;
1234 __le64 timestamp; /* TSF at on air rise */
1235 __le32 beacon_time_stamp; /* beacon at on-air rise */
1236 __le16 phy_flags; /* general phy flags: band, modulation, ... */
1237 __le16 channel; /* channel number */
1238 u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
1239 __le32 rate_n_flags; /* RATE_MCS_* */
1240 __le16 byte_count; /* frame's byte-count */
1241 __le16 frame_time; /* frame's time on the air */
1242} __packed;
1243
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001244struct il_rx_mpdu_res_start {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001245 __le16 byte_count;
1246 __le16 reserved;
1247} __packed;
1248
1249
1250/******************************************************************************
1251 * (5)
1252 * Tx Commands & Responses:
1253 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001254 * Driver must place each C_TX command into one of the prioritized Tx
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001255 * queues in host DRAM, shared between driver and device (see comments for
1256 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
1257 * are preparing to transmit, the device pulls the Tx command over the PCI
1258 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1259 * from which data will be transmitted.
1260 *
1261 * uCode handles all timing and protocol related to control frames
1262 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
1263 * handle reception of block-acks; uCode updates the host driver via
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001264 * N_COMPRESSED_BA.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001265 *
1266 * uCode handles retrying Tx when an ACK is expected but not received.
1267 * This includes trying lower data rates than the one requested in the Tx
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001268 * command, as set up by the C_RATE_SCALE (for 3945) or
1269 * C_TX_LINK_QUALITY_CMD (4965).
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001270 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001271 * Driver sets up transmit power for various rates via C_TX_PWR_TBL.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001272 * This command must be executed after every RXON command, before Tx can occur.
1273 *****************************************************************************/
1274
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001275/* C_TX Tx flags field */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001276
1277/*
1278 * 1: Use Request-To-Send protocol before this frame.
1279 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
1280 */
1281#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
1282
1283/*
1284 * 1: Transmit Clear-To-Send to self before this frame.
1285 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
1286 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
1287 */
1288#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
1289
1290/* 1: Expect ACK from receiving station
1291 * 0: Don't expect ACK (MAC header's duration field s/b 0)
1292 * Set this for unicast frames, but not broadcast/multicast. */
1293#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
1294
1295/* For 4965 devices:
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001296 * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD).
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001297 * Tx command's initial_rate_idx indicates first rate to try;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001298 * uCode walks through table for additional Tx attempts.
1299 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1300 * This rate will be used for all Tx attempts; it will not be scaled. */
1301#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
1302
1303/* 1: Expect immediate block-ack.
1304 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
1305#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
1306
1307/*
1308 * 1: Frame requires full Tx-Op protection.
1309 * Set this if either RTS or CTS Tx Flag gets set.
1310 */
1311#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
1312
1313/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices.
1314 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
1315#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
1316#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
1317#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
1318
1319/* 1: uCode overrides sequence control field in MAC header.
1320 * 0: Driver provides sequence control field in MAC header.
1321 * Set this for management frames, non-QOS data frames, non-unicast frames,
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001322 * and also in Tx command embedded in C_SCAN for active scans. */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001323#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
1324
1325/* 1: This frame is non-last MPDU; more fragments are coming.
1326 * 0: Last fragment, or not using fragmentation. */
1327#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
1328
1329/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1330 * 0: No TSF required in outgoing frame.
1331 * Set this for transmitting beacons and probe responses. */
1332#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
1333
1334/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1335 * alignment of frame's payload data field.
1336 * 0: No pad
1337 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1338 * field (but not both). Driver must align frame data (i.e. data following
1339 * MAC header) to DWORD boundary. */
1340#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
1341
1342/* accelerate aggregation support
1343 * 0 - no CCMP encryption; 1 - CCMP encryption */
1344#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
1345
1346/* HCCA-AP - disable duration overwriting. */
1347#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
1348
1349
1350/*
1351 * TX command security control
1352 */
1353#define TX_CMD_SEC_WEP 0x01
1354#define TX_CMD_SEC_CCM 0x02
1355#define TX_CMD_SEC_TKIP 0x03
1356#define TX_CMD_SEC_MSK 0x03
1357#define TX_CMD_SEC_SHIFT 6
1358#define TX_CMD_SEC_KEY128 0x08
1359
1360/*
1361 * security overhead sizes
1362 */
1363#define WEP_IV_LEN 4
1364#define WEP_ICV_LEN 4
1365#define CCMP_MIC_LEN 8
1366#define TKIP_ICV_LEN 4
1367
1368/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001369 * C_TX = 0x1c (command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001370 */
1371
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001372struct il3945_tx_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001373 /*
1374 * MPDU byte count:
1375 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1376 * + 8 byte IV for CCM or TKIP (not used for WEP)
1377 * + Data payload
1378 * + 8-byte MIC (not used for CCM/WEP)
1379 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1380 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1381 * Range: 14-2342 bytes.
1382 */
1383 __le16 len;
1384
1385 /*
1386 * MPDU or MSDU byte count for next frame.
1387 * Used for fragmentation and bursting, but not 11n aggregation.
1388 * Same as "len", but for next frame. Set to 0 if not applicable.
1389 */
1390 __le16 next_frame_len;
1391
1392 __le32 tx_flags; /* TX_CMD_FLG_* */
1393
1394 u8 rate;
1395
1396 /* Index of recipient station in uCode's station table */
1397 u8 sta_id;
1398 u8 tid_tspec;
1399 u8 sec_ctl;
1400 u8 key[16];
1401 union {
1402 u8 byte[8];
1403 __le16 word[4];
1404 __le32 dw[2];
1405 } tkip_mic;
1406 __le32 next_frame_info;
1407 union {
1408 __le32 life_time;
1409 __le32 attempt;
1410 } stop_time;
1411 u8 supp_rates[2];
1412 u8 rts_retry_limit; /*byte 50 */
1413 u8 data_retry_limit; /*byte 51 */
1414 union {
1415 __le16 pm_frame_timeout;
1416 __le16 attempt_duration;
1417 } timeout;
1418
1419 /*
1420 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1421 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1422 */
1423 __le16 driver_txop;
1424
1425 /*
1426 * MAC header goes here, followed by 2 bytes padding if MAC header
1427 * length is 26 or 30 bytes, followed by payload data
1428 */
1429 u8 payload[0];
1430 struct ieee80211_hdr hdr[0];
1431} __packed;
1432
1433/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001434 * C_TX = 0x1c (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001435 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001436struct il3945_tx_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001437 u8 failure_rts;
1438 u8 failure_frame;
1439 u8 bt_kill_count;
1440 u8 rate;
1441 __le32 wireless_media_time;
1442 __le32 status; /* TX status */
1443} __packed;
1444
1445
1446/*
1447 * 4965 uCode updates these Tx attempt count values in host DRAM.
1448 * Used for managing Tx retries when expecting block-acks.
1449 * Driver should set these fields to 0.
1450 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001451struct il_dram_scratch {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001452 u8 try_cnt; /* Tx attempts */
1453 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
1454 __le16 reserved;
1455} __packed;
1456
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001457struct il_tx_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001458 /*
1459 * MPDU byte count:
1460 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1461 * + 8 byte IV for CCM or TKIP (not used for WEP)
1462 * + Data payload
1463 * + 8-byte MIC (not used for CCM/WEP)
1464 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1465 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1466 * Range: 14-2342 bytes.
1467 */
1468 __le16 len;
1469
1470 /*
1471 * MPDU or MSDU byte count for next frame.
1472 * Used for fragmentation and bursting, but not 11n aggregation.
1473 * Same as "len", but for next frame. Set to 0 if not applicable.
1474 */
1475 __le16 next_frame_len;
1476
1477 __le32 tx_flags; /* TX_CMD_FLG_* */
1478
1479 /* uCode may modify this field of the Tx command (in host DRAM!).
1480 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001481 struct il_dram_scratch scratch;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001482
1483 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1484 __le32 rate_n_flags; /* RATE_MCS_* */
1485
1486 /* Index of destination station in uCode's station table */
1487 u8 sta_id;
1488
1489 /* Type of security encryption: CCM or TKIP */
1490 u8 sec_ctl; /* TX_CMD_SEC_* */
1491
1492 /*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001493 * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001494 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1495 * data frames, this field may be used to selectively reduce initial
1496 * rate (via non-0 value) for special frames (e.g. management), while
1497 * still supporting rate scaling for all frames.
1498 */
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001499 u8 initial_rate_idx;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001500 u8 reserved;
1501 u8 key[16];
1502 __le16 next_frame_flags;
1503 __le16 reserved2;
1504 union {
1505 __le32 life_time;
1506 __le32 attempt;
1507 } stop_time;
1508
1509 /* Host DRAM physical address pointer to "scratch" in this command.
1510 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
1511 __le32 dram_lsb_ptr;
1512 u8 dram_msb_ptr;
1513
1514 u8 rts_retry_limit; /*byte 50 */
1515 u8 data_retry_limit; /*byte 51 */
1516 u8 tid_tspec;
1517 union {
1518 __le16 pm_frame_timeout;
1519 __le16 attempt_duration;
1520 } timeout;
1521
1522 /*
1523 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1524 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1525 */
1526 __le16 driver_txop;
1527
1528 /*
1529 * MAC header goes here, followed by 2 bytes padding if MAC header
1530 * length is 26 or 30 bytes, followed by payload data
1531 */
1532 u8 payload[0];
1533 struct ieee80211_hdr hdr[0];
1534} __packed;
1535
1536/* TX command response is sent after *3945* transmission attempts.
1537 *
1538 * NOTES:
1539 *
1540 * TX_STATUS_FAIL_NEXT_FRAG
1541 *
1542 * If the fragment flag in the MAC header for the frame being transmitted
1543 * is set and there is insufficient time to transmit the next frame, the
1544 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1545 *
1546 * TX_STATUS_FIFO_UNDERRUN
1547 *
1548 * Indicates the host did not provide bytes to the FIFO fast enough while
1549 * a TX was in progress.
1550 *
1551 * TX_STATUS_FAIL_MGMNT_ABORT
1552 *
1553 * This status is only possible if the ABORT ON MGMT RX parameter was
1554 * set to true with the TX command.
1555 *
1556 * If the MSB of the status parameter is set then an abort sequence is
1557 * required. This sequence consists of the host activating the TX Abort
1558 * control line, and then waiting for the TX Abort command response. This
1559 * indicates that a the device is no longer in a transmit state, and that the
1560 * command FIFO has been cleared. The host must then deactivate the TX Abort
1561 * control line. Receiving is still allowed in this case.
1562 */
1563enum {
1564 TX_3945_STATUS_SUCCESS = 0x01,
1565 TX_3945_STATUS_DIRECT_DONE = 0x02,
1566 TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
1567 TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
1568 TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1569 TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
1570 TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
1571 TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1572 TX_3945_STATUS_FAIL_DEST_PS = 0x88,
1573 TX_3945_STATUS_FAIL_ABORTED = 0x89,
1574 TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
1575 TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
1576 TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1577 TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
1578 TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
1579 TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1580 TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
1581 TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1582};
1583
1584/*
1585 * TX command response is sent after *4965* transmission attempts.
1586 *
1587 * both postpone and abort status are expected behavior from uCode. there is
1588 * no special operation required from driver; except for RFKILL_FLUSH,
1589 * which required tx flush host command to flush all the tx frames in queues
1590 */
1591enum {
1592 TX_STATUS_SUCCESS = 0x01,
1593 TX_STATUS_DIRECT_DONE = 0x02,
1594 /* postpone TX */
1595 TX_STATUS_POSTPONE_DELAY = 0x40,
1596 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
1597 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
1598 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
1599 /* abort TX */
1600 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
1601 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
1602 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
1603 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1604 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
1605 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
1606 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1607 TX_STATUS_FAIL_DEST_PS = 0x88,
1608 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
1609 TX_STATUS_FAIL_BT_RETRY = 0x8a,
1610 TX_STATUS_FAIL_STA_INVALID = 0x8b,
1611 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1612 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
1613 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
1614 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1615 TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90,
1616 TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1617};
1618
1619#define TX_PACKET_MODE_REGULAR 0x0000
1620#define TX_PACKET_MODE_BURST_SEQ 0x0100
1621#define TX_PACKET_MODE_BURST_FIRST 0x0200
1622
1623enum {
1624 TX_POWER_PA_NOT_ACTIVE = 0x0,
1625};
1626
1627enum {
1628 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
1629 TX_STATUS_DELAY_MSK = 0x00000040,
1630 TX_STATUS_ABORT_MSK = 0x00000080,
1631 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
1632 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
1633 TX_RESERVED = 0x00780000, /* bits 19:22 */
1634 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
1635 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
1636};
1637
1638/* *******************************
1639 * TX aggregation status
1640 ******************************* */
1641
1642enum {
1643 AGG_TX_STATE_TRANSMITTED = 0x00,
1644 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
1645 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
1646 AGG_TX_STATE_ABORT_MSK = 0x08,
1647 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
1648 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
1649 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
1650 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
1651 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
1652 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
1653 AGG_TX_STATE_DELAY_TX_MSK = 0x400
1654};
1655
1656#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */
1657#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */
1658
1659#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
1660 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK)
1661
1662/* # tx attempts for first frame in aggregation */
1663#define AGG_TX_STATE_TRY_CNT_POS 12
1664#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1665
1666/* Command ID and sequence number of Tx command for this frame */
1667#define AGG_TX_STATE_SEQ_NUM_POS 16
1668#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1669
1670/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001671 * C_TX = 0x1c (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001672 *
1673 * This response may be in one of two slightly different formats, indicated
1674 * by the frame_count field:
1675 *
1676 * 1) No aggregation (frame_count == 1). This reports Tx results for
1677 * a single frame. Multiple attempts, at various bit rates, may have
1678 * been made for this frame.
1679 *
1680 * 2) Aggregation (frame_count > 1). This reports Tx results for
1681 * 2 or more frames that used block-acknowledge. All frames were
1682 * transmitted at same rate. Rate scaling may have been used if first
1683 * frame in this new agg block failed in previous agg block(s).
1684 *
1685 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
1686 * block-ack has not been received by the time the 4965 device records
1687 * this status.
1688 * This status relates to reasons the tx might have been blocked or aborted
1689 * within the sending station (this 4965 device), rather than whether it was
1690 * received successfully by the destination station.
1691 */
1692struct agg_tx_status {
1693 __le16 status;
1694 __le16 sequence;
1695} __packed;
1696
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001697struct il4965_tx_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001698 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1699 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1700 u8 failure_rts; /* # failures due to unsuccessful RTS */
1701 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1702
1703 /* For non-agg: Rate at which frame was successful.
1704 * For agg: Rate at which all frames were transmitted. */
1705 __le32 rate_n_flags; /* RATE_MCS_* */
1706
1707 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1708 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1709 __le16 wireless_media_time; /* uSecs */
1710
1711 __le16 reserved;
1712 __le32 pa_power1; /* RF power amplifier measurement (not used) */
1713 __le32 pa_power2;
1714
1715 /*
1716 * For non-agg: frame status TX_STATUS_*
1717 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1718 * fields follow this one, up to frame_count.
1719 * Bit fields:
1720 * 11- 0: AGG_TX_STATE_* status code
1721 * 15-12: Retry count for 1st frame in aggregation (retries
1722 * occur if tx failed for this frame when it was a
1723 * member of a previous aggregation block). If rate
1724 * scaling is used, retry count indicates the rate
1725 * table entry used for all frames in the new agg.
1726 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1727 */
1728 union {
1729 __le32 status;
1730 struct agg_tx_status agg_status[0]; /* for each agg frame */
1731 } u;
1732} __packed;
1733
1734/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001735 * N_COMPRESSED_BA = 0xc5 (response only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001736 *
1737 * Reports Block-Acknowledge from recipient station
1738 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001739struct il_compressed_ba_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001740 __le32 sta_addr_lo32;
1741 __le16 sta_addr_hi16;
1742 __le16 reserved;
1743
1744 /* Index of recipient (BA-sending) station in uCode's station table */
1745 u8 sta_id;
1746 u8 tid;
1747 __le16 seq_ctl;
1748 __le64 bitmap;
1749 __le16 scd_flow;
1750 __le16 scd_ssn;
1751} __packed;
1752
1753/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001754 * C_TX_PWR_TBL = 0x97 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001755 *
Stanislaw Gruszkaaf038f42011-08-30 13:58:27 +02001756 * See details under "TXPOWER" in 4965.h.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001757 */
1758
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001759struct il3945_txpowertable_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001760 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1761 u8 reserved;
1762 __le16 channel;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001763 struct il3945_power_per_rate power[IL_MAX_RATES];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001764} __packed;
1765
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001766struct il4965_txpowertable_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001767 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1768 u8 reserved;
1769 __le16 channel;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001770 struct il4965_tx_power_db tx_power;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001771} __packed;
1772
1773
1774/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001775 * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001776 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001777 * C_RATE_SCALE = 0x47 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001778 *
1779 * NOTE: The table of rates passed to the uCode via the
1780 * RATE_SCALE command sets up the corresponding order of
1781 * rates used for all related commands, including rate
1782 * masks, etc.
1783 *
1784 * For example, if you set 9MB (PLCP 0x0f) as the first
1785 * rate in the rate table, the bit mask for that rate
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001786 * when passed through ofdm_basic_rates on the C_RXON
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001787 * command would be bit 0 (1 << 0)
1788 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001789struct il3945_rate_scaling_info {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001790 __le16 rate_n_flags;
1791 u8 try_cnt;
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001792 u8 next_rate_idx;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001793} __packed;
1794
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001795struct il3945_rate_scaling_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001796 u8 table_id;
1797 u8 reserved[3];
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001798 struct il3945_rate_scaling_info table[IL_MAX_RATES];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001799} __packed;
1800
1801
1802/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
1803#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
1804
1805/* # of EDCA prioritized tx fifos */
1806#define LINK_QUAL_AC_NUM AC_NUM
1807
1808/* # entries in rate scale table to support Tx retries */
1809#define LINK_QUAL_MAX_RETRY_NUM 16
1810
1811/* Tx antenna selection values */
1812#define LINK_QUAL_ANT_A_MSK (1 << 0)
1813#define LINK_QUAL_ANT_B_MSK (1 << 1)
1814#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
1815
1816
1817/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001818 * struct il_link_qual_general_params
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001819 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001820 * Used in C_TX_LINK_QUALITY_CMD
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001821 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001822struct il_link_qual_general_params {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001823 u8 flags;
1824
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001825 /* No entries at or above this (driver chosen) idx contain MIMO */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001826 u8 mimo_delimiter;
1827
1828 /* Best single antenna to use for single stream (legacy, SISO). */
1829 u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
1830
1831 /* Best antennas to use for MIMO (unused for 4965, assumes both). */
1832 u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
1833
1834 /*
1835 * If driver needs to use different initial rates for different
1836 * EDCA QOS access categories (as implemented by tx fifos 0-3),
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001837 * this table will set that up, by indicating the idxes in the
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001838 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
1839 * Otherwise, driver should set all entries to 0.
1840 *
1841 * Entry usage:
1842 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
1843 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
1844 */
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01001845 u8 start_rate_idx[LINK_QUAL_AC_NUM];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001846} __packed;
1847
1848#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
1849#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
1850#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
1851
1852#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
1853#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
1854#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
1855
1856#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
1857#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
1858#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
1859
1860/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001861 * struct il_link_qual_agg_params
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001862 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001863 * Used in C_TX_LINK_QUALITY_CMD
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001864 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001865struct il_link_qual_agg_params {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001866
1867 /*
1868 *Maximum number of uSec in aggregation.
1869 * default set to 4000 (4 milliseconds) if not configured in .cfg
1870 */
1871 __le16 agg_time_limit;
1872
1873 /*
1874 * Number of Tx retries allowed for a frame, before that frame will
1875 * no longer be considered for the start of an aggregation sequence
1876 * (scheduler will then try to tx it as single frame).
1877 * Driver should set this to 3.
1878 */
1879 u8 agg_dis_start_th;
1880
1881 /*
1882 * Maximum number of frames in aggregation.
1883 * 0 = no limit (default). 1 = no aggregation.
1884 * Other values = max # frames in aggregation.
1885 */
1886 u8 agg_frame_cnt_limit;
1887
1888 __le32 reserved;
1889} __packed;
1890
1891/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001892 * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001893 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001894 * For 4965 devices only; 3945 uses C_RATE_SCALE.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001895 *
1896 * Each station in the 4965 device's internal station table has its own table
1897 * of 16
1898 * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
1899 * an ACK is not received. This command replaces the entire table for
1900 * one station.
1901 *
1902 * NOTE: Station must already be in 4965 device's station table.
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02001903 * Use C_ADD_STA.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001904 *
1905 * The rate scaling procedures described below work well. Of course, other
1906 * procedures are possible, and may work better for particular environments.
1907 *
1908 *
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +02001909 * FILLING THE RATE TBL
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001910 *
1911 * Given a particular initial rate and mode, as determined by the rate
1912 * scaling algorithm described below, the Linux driver uses the following
1913 * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
1914 * Link Quality command:
1915 *
1916 *
1917 * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
1918 * a) Use this same initial rate for first 3 entries.
1919 * b) Find next lower available rate using same mode (SISO or MIMO),
1920 * use for next 3 entries. If no lower rate available, switch to
1921 * legacy mode (no HT40 channel, no MIMO, no short guard interval).
1922 * c) If using MIMO, set command's mimo_delimiter to number of entries
1923 * using MIMO (3 or 6).
1924 * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
1925 * no MIMO, no short guard interval), at the next lower bit rate
1926 * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
1927 * legacy procedure for remaining table entries.
1928 *
1929 * 2) If using legacy initial rate:
1930 * a) Use the initial rate for only one entry.
1931 * b) For each following entry, reduce the rate to next lower available
1932 * rate, until reaching the lowest available rate.
1933 * c) When reducing rate, also switch antenna selection.
1934 * d) Once lowest available rate is reached, repeat this rate until
1935 * rate table is filled (16 entries), switching antenna each entry.
1936 *
1937 *
1938 * ACCUMULATING HISTORY
1939 *
1940 * The rate scaling algorithm for 4965 devices, as implemented in Linux driver,
1941 * uses two sets of frame Tx success history: One for the current/active
1942 * modulation mode, and one for a speculative/search mode that is being
1943 * attempted. If the speculative mode turns out to be more effective (i.e.
1944 * actual transfer rate is better), then the driver continues to use the
1945 * speculative mode as the new current active mode.
1946 *
1947 * Each history set contains, separately for each possible rate, data for a
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +02001948 * sliding win of the 62 most recent tx attempts at that rate. The data
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001949 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
1950 * and attempted frames, from which the driver can additionally calculate a
1951 * success ratio (success / attempted) and number of failures
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +02001952 * (attempted - success), and control the size of the win (attempted).
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001953 * The driver uses the bit map to remove successes from the success sum, as
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +02001954 * the oldest tx attempts fall out of the win.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001955 *
1956 * When the 4965 device makes multiple tx attempts for a given frame, each
1957 * attempt might be at a different rate, and have different modulation
1958 * characteristics (e.g. antenna, fat channel, short guard interval), as set
1959 * up in the rate scaling table in the Link Quality command. The driver must
1960 * determine which rate table entry was used for each tx attempt, to determine
1961 * which rate-specific history to update, and record only those attempts that
1962 * match the modulation characteristics of the history set.
1963 *
1964 * When using block-ack (aggregation), all frames are transmitted at the same
1965 * rate, since there is no per-attempt acknowledgment from the destination
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02001966 * station. The Tx response struct il_tx_resp indicates the Tx rate in
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08001967 * rate_n_flags field. After receiving a block-ack, the driver can update
1968 * history for the entire block all at once.
1969 *
1970 *
1971 * FINDING BEST STARTING RATE:
1972 *
1973 * When working with a selected initial modulation mode (see below), the
1974 * driver attempts to find a best initial rate. The initial rate is the
1975 * first entry in the Link Quality command's rate table.
1976 *
1977 * 1) Calculate actual throughput (success ratio * expected throughput, see
1978 * table below) for current initial rate. Do this only if enough frames
1979 * have been attempted to make the value meaningful: at least 6 failed
1980 * tx attempts, or at least 8 successes. If not enough, don't try rate
1981 * scaling yet.
1982 *
1983 * 2) Find available rates adjacent to current initial rate. Available means:
1984 * a) supported by hardware &&
1985 * b) supported by association &&
1986 * c) within any constraints selected by user
1987 *
1988 * 3) Gather measured throughputs for adjacent rates. These might not have
1989 * enough history to calculate a throughput. That's okay, we might try
1990 * using one of them anyway!
1991 *
1992 * 4) Try decreasing rate if, for current rate:
1993 * a) success ratio is < 15% ||
1994 * b) lower adjacent rate has better measured throughput ||
1995 * c) higher adjacent rate has worse throughput, and lower is unmeasured
1996 *
1997 * As a sanity check, if decrease was determined above, leave rate
1998 * unchanged if:
1999 * a) lower rate unavailable
2000 * b) success ratio at current rate > 85% (very good)
2001 * c) current measured throughput is better than expected throughput
2002 * of lower rate (under perfect 100% tx conditions, see table below)
2003 *
2004 * 5) Try increasing rate if, for current rate:
2005 * a) success ratio is < 15% ||
2006 * b) both adjacent rates' throughputs are unmeasured (try it!) ||
2007 * b) higher adjacent rate has better measured throughput ||
2008 * c) lower adjacent rate has worse throughput, and higher is unmeasured
2009 *
2010 * As a sanity check, if increase was determined above, leave rate
2011 * unchanged if:
2012 * a) success ratio at current rate < 70%. This is not particularly
2013 * good performance; higher rate is sure to have poorer success.
2014 *
2015 * 6) Re-evaluate the rate after each tx frame. If working with block-
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002016 * acknowledge, history and stats may be calculated for the entire
Stanislaw Gruszka6ce1dc42011-08-26 15:49:28 +02002017 * block (including prior history that fits within the history wins),
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002018 * before re-evaluation.
2019 *
2020 * FINDING BEST STARTING MODULATION MODE:
2021 *
2022 * After working with a modulation mode for a "while" (and doing rate scaling),
2023 * the driver searches for a new initial mode in an attempt to improve
2024 * throughput. The "while" is measured by numbers of attempted frames:
2025 *
2026 * For legacy mode, search for new mode after:
2027 * 480 successful frames, or 160 failed frames
2028 * For high-throughput modes (SISO or MIMO), search for new mode after:
2029 * 4500 successful frames, or 400 failed frames
2030 *
2031 * Mode switch possibilities are (3 for each mode):
2032 *
2033 * For legacy:
2034 * Change antenna, try SISO (if HT association), try MIMO (if HT association)
2035 * For SISO:
2036 * Change antenna, try MIMO, try shortened guard interval (SGI)
2037 * For MIMO:
2038 * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
2039 *
2040 * When trying a new mode, use the same bit rate as the old/current mode when
2041 * trying antenna switches and shortened guard interval. When switching to
2042 * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
2043 * for which the expected throughput (under perfect conditions) is about the
2044 * same or slightly better than the actual measured throughput delivered by
2045 * the old/current mode.
2046 *
2047 * Actual throughput can be estimated by multiplying the expected throughput
2048 * by the success ratio (successful / attempted tx frames). Frame size is
2049 * not considered in this calculation; it assumes that frame size will average
2050 * out to be fairly consistent over several samples. The following are
2051 * metric values for expected throughput assuming 100% success ratio.
2052 * Only G band has support for CCK rates:
2053 *
2054 * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
2055 *
2056 * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
2057 * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
2058 * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
2059 * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
2060 * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
2061 * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
2062 * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
2063 * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
2064 * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
2065 * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
2066 *
2067 * After the new mode has been tried for a short while (minimum of 6 failed
2068 * frames or 8 successful frames), compare success ratio and actual throughput
2069 * estimate of the new mode with the old. If either is better with the new
2070 * mode, continue to use the new mode.
2071 *
2072 * Continue comparing modes until all 3 possibilities have been tried.
2073 * If moving from legacy to HT, try all 3 possibilities from the new HT
2074 * mode. After trying all 3, a best mode is found. Continue to use this mode
2075 * for the longer "while" described above (e.g. 480 successful frames for
2076 * legacy), and then repeat the search process.
2077 *
2078 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002079struct il_link_quality_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002080
2081 /* Index of destination/recipient station in uCode's station table */
2082 u8 sta_id;
2083 u8 reserved1;
2084 __le16 control; /* not used */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002085 struct il_link_qual_general_params general_params;
2086 struct il_link_qual_agg_params agg_params;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002087
2088 /*
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01002089 * Rate info; when using rate-scaling, Tx command's initial_rate_idx
2090 * specifies 1st Tx rate attempted, via idx into this table.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002091 * 4965 devices works its way through table when retrying Tx.
2092 */
2093 struct {
Stanislaw Gruszka2eb05812011-08-26 16:07:43 +02002094 __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002095 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2096 __le32 reserved2;
2097} __packed;
2098
2099/*
2100 * BT configuration enable flags:
2101 * bit 0 - 1: BT channel announcement enabled
2102 * 0: disable
2103 * bit 1 - 1: priority of BT device enabled
2104 * 0: disable
2105 */
2106#define BT_COEX_DISABLE (0x0)
2107#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2108#define BT_ENABLE_PRIORITY BIT(1)
2109
2110#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
2111
2112#define BT_LEAD_TIME_DEF (0x1E)
2113
2114#define BT_MAX_KILL_DEF (0x5)
2115
2116/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002117 * C_BT_CONFIG = 0x9b (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002118 *
2119 * 3945 and 4965 devices support hardware handshake with Bluetooth device on
2120 * same platform. Bluetooth device alerts wireless device when it will Tx;
2121 * wireless device can delay or kill its own Tx to accommodate.
2122 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002123struct il_bt_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002124 u8 flags;
2125 u8 lead_time;
2126 u8 max_kill;
2127 u8 reserved;
2128 __le32 kill_ack_mask;
2129 __le32 kill_cts_mask;
2130} __packed;
2131
2132
2133/******************************************************************************
2134 * (6)
2135 * Spectrum Management (802.11h) Commands, Responses, Notifications:
2136 *
2137 *****************************************************************************/
2138
2139/*
2140 * Spectrum Management
2141 */
2142#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
2143 RXON_FILTER_CTL2HOST_MSK | \
2144 RXON_FILTER_ACCEPT_GRP_MSK | \
2145 RXON_FILTER_DIS_DECRYPT_MSK | \
2146 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2147 RXON_FILTER_ASSOC_MSK | \
2148 RXON_FILTER_BCON_AWARE_MSK)
2149
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002150struct il_measure_channel {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002151 __le32 duration; /* measurement duration in extended beacon
2152 * format */
2153 u8 channel; /* channel to measure */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002154 u8 type; /* see enum il_measure_type */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002155 __le16 reserved;
2156} __packed;
2157
2158/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002159 * C_SPECTRUM_MEASUREMENT = 0x74 (command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002160 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002161struct il_spectrum_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002162 __le16 len; /* number of bytes starting from token */
2163 u8 token; /* token id */
2164 u8 id; /* measurement id -- 0 or 1 */
2165 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
2166 u8 periodic; /* 1 = periodic */
2167 __le16 path_loss_timeout;
2168 __le32 start_time; /* start time in extended beacon format */
2169 __le32 reserved2;
2170 __le32 flags; /* rxon flags */
2171 __le32 filter_flags; /* rxon filter flags */
2172 __le16 channel_count; /* minimum 1, maximum 10 */
2173 __le16 reserved3;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002174 struct il_measure_channel channels[10];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002175} __packed;
2176
2177/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002178 * C_SPECTRUM_MEASUREMENT = 0x74 (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002179 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002180struct il_spectrum_resp {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002181 u8 token;
2182 u8 id; /* id of the prior command replaced, or 0xff */
2183 __le16 status; /* 0 - command will be handled
2184 * 1 - cannot handle (conflicts with another
2185 * measurement) */
2186} __packed;
2187
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002188enum il_measurement_state {
2189 IL_MEASUREMENT_START = 0,
2190 IL_MEASUREMENT_STOP = 1,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002191};
2192
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002193enum il_measurement_status {
2194 IL_MEASUREMENT_OK = 0,
2195 IL_MEASUREMENT_CONCURRENT = 1,
2196 IL_MEASUREMENT_CSA_CONFLICT = 2,
2197 IL_MEASUREMENT_TGH_CONFLICT = 3,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002198 /* 4-5 reserved */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002199 IL_MEASUREMENT_STOPPED = 6,
2200 IL_MEASUREMENT_TIMEOUT = 7,
2201 IL_MEASUREMENT_PERIODIC_FAILED = 8,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002202};
2203
2204#define NUM_ELEMENTS_IN_HISTOGRAM 8
2205
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002206struct il_measurement_histogram {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002207 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
2208 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
2209} __packed;
2210
2211/* clear channel availability counters */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002212struct il_measurement_cca_counters {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002213 __le32 ofdm;
2214 __le32 cck;
2215} __packed;
2216
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002217enum il_measure_type {
2218 IL_MEASURE_BASIC = (1 << 0),
2219 IL_MEASURE_CHANNEL_LOAD = (1 << 1),
2220 IL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2221 IL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2222 IL_MEASURE_FRAME = (1 << 4),
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002223 /* bits 5:6 are reserved */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002224 IL_MEASURE_IDLE = (1 << 7),
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002225};
2226
2227/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002228 * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002229 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002230struct il_spectrum_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002231 u8 id; /* measurement id -- 0 or 1 */
2232 u8 token;
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01002233 u8 channel_idx; /* idx in measurement channel list */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002234 u8 state; /* 0 - start, 1 - stop */
2235 __le32 start_time; /* lower 32-bits of TSF */
2236 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
2237 u8 channel;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002238 u8 type; /* see enum il_measurement_type */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002239 u8 reserved1;
2240 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2241 * valid if applicable for measurement type requested. */
2242 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
2243 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
2244 __le32 cca_time; /* channel load time in usecs */
2245 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
2246 * unidentified */
2247 u8 reserved2[3];
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002248 struct il_measurement_histogram histogram;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002249 __le32 stop_time; /* lower 32-bits of TSF */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002250 __le32 status; /* see il_measurement_status */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002251} __packed;
2252
2253/******************************************************************************
2254 * (7)
2255 * Power Management Commands, Responses, Notifications:
2256 *
2257 *****************************************************************************/
2258
2259/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002260 * struct il_powertable_cmd - Power Table Command
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002261 * @flags: See below:
2262 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002263 * C_POWER_TBL = 0x77 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002264 *
2265 * PM allow:
2266 * bit 0 - '0' Driver not allow power management
2267 * '1' Driver allow PM (use rest of parameters)
2268 *
2269 * uCode send sleep notifications:
2270 * bit 1 - '0' Don't send sleep notification
2271 * '1' send sleep notification (SEND_PM_NOTIFICATION)
2272 *
2273 * Sleep over DTIM
2274 * bit 2 - '0' PM have to walk up every DTIM
2275 * '1' PM could sleep over DTIM till listen Interval.
2276 *
2277 * PCI power managed
2278 * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2279 * '1' !(PCI_CFG_LINK_CTRL & 0x1)
2280 *
2281 * Fast PD
2282 * bit 4 - '1' Put radio to sleep when receiving frame for others
2283 *
2284 * Force sleep Modes
2285 * bit 31/30- '00' use both mac/xtal sleeps
2286 * '01' force Mac sleep
2287 * '10' force xtal sleep
2288 * '11' Illegal set
2289 *
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +02002290 * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002291 * ucode assume sleep over DTIM is allowed and we don't need to wake up
2292 * for every DTIM.
2293 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002294#define IL_POWER_VEC_SIZE 5
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002295
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002296#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2297#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002298
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002299struct il3945_powertable_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002300 __le16 flags;
2301 u8 reserved[2];
2302 __le32 rx_data_timeout;
2303 __le32 tx_data_timeout;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002304 __le32 sleep_interval[IL_POWER_VEC_SIZE];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002305} __packed;
2306
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002307struct il_powertable_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002308 __le16 flags;
2309 u8 keep_alive_seconds; /* 3945 reserved */
2310 u8 debug_flags; /* 3945 reserved */
2311 __le32 rx_data_timeout;
2312 __le32 tx_data_timeout;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002313 __le32 sleep_interval[IL_POWER_VEC_SIZE];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002314 __le32 keep_alive_beacons;
2315} __packed;
2316
2317/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002318 * N_PM_SLEEP = 0x7A (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002319 * all devices identical.
2320 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002321struct il_sleep_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002322 u8 pm_sleep_mode;
2323 u8 pm_wakeup_src;
2324 __le16 reserved;
2325 __le32 sleep_time;
2326 __le32 tsf_low;
2327 __le32 bcon_timer;
2328} __packed;
2329
2330/* Sleep states. all devices identical. */
2331enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002332 IL_PM_NO_SLEEP = 0,
2333 IL_PM_SLP_MAC = 1,
2334 IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2335 IL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2336 IL_PM_SLP_PHY = 4,
2337 IL_PM_SLP_REPENT = 5,
2338 IL_PM_WAKEUP_BY_TIMER = 6,
2339 IL_PM_WAKEUP_BY_DRIVER = 7,
2340 IL_PM_WAKEUP_BY_RFKILL = 8,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002341 /* 3 reserved */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002342 IL_PM_NUM_OF_MODES = 12,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002343};
2344
2345/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002346 * N_CARD_STATE = 0xa1 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002347 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002348struct il_card_state_notif {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002349 __le32 flags;
2350} __packed;
2351
2352#define HW_CARD_DISABLED 0x01
2353#define SW_CARD_DISABLED 0x02
2354#define CT_CARD_DISABLED 0x04
2355#define RXON_CARD_DISABLED 0x10
2356
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002357struct il_ct_kill_config {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002358 __le32 reserved;
2359 __le32 critical_temperature_M;
2360 __le32 critical_temperature_R;
2361} __packed;
2362
2363/******************************************************************************
2364 * (8)
2365 * Scan Commands, Responses, Notifications:
2366 *
2367 *****************************************************************************/
2368
2369#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
2370#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
2371
2372/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002373 * struct il_scan_channel - entry in C_SCAN channel table
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002374 *
2375 * One for each channel in the scan list.
2376 * Each channel can independently select:
2377 * 1) SSID for directed active scans
2378 * 2) Txpower setting (for rate specified within Tx command)
2379 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
2380 * quiet_plcp_th, good_CRC_th)
2381 *
2382 * To avoid uCode errors, make sure the following are true (see comments
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002383 * under struct il_scan_cmd about max_out_time and quiet_time):
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002384 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2385 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2386 * 2) quiet_time <= active_dwell
2387 * 3) If restricting off-channel time (i.e. max_out_time !=0):
2388 * passive_dwell < max_out_time
2389 * active_dwell < max_out_time
2390 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002391struct il3945_scan_channel {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002392 /*
2393 * type is defined as:
2394 * 0:0 1 = active, 0 = passive
2395 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2396 * SSID IE is transmitted in probe request.
2397 * 5:7 reserved
2398 */
2399 u8 type;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002400 u8 channel; /* band is selected by il3945_scan_cmd "flags" field */
2401 struct il3945_tx_power tpc;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002402 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2403 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2404} __packed;
2405
2406/* set number of direct probes u8 type */
Stanislaw Gruszkad3175162011-11-15 11:25:42 +01002407#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002408
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002409struct il_scan_channel {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002410 /*
2411 * type is defined as:
2412 * 0:0 1 = active, 0 = passive
2413 * 1:20 SSID direct bit map; if a bit is set, then corresponding
2414 * SSID IE is transmitted in probe request.
2415 * 21:31 reserved
2416 */
2417 __le32 type;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002418 __le16 channel; /* band is selected by il_scan_cmd "flags" field */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002419 u8 tx_gain; /* gain for analog radio */
2420 u8 dsp_atten; /* gain for DSP */
2421 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2422 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2423} __packed;
2424
2425/* set number of direct probes __le32 type */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002426#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002427
2428/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002429 * struct il_ssid_ie - directed scan network information element
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002430 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002431 * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002432 * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002433 * each channel may select different ssids from among the 20 (4) entries.
2434 * SSID IEs get transmitted in reverse order of entry.
2435 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002436struct il_ssid_ie {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002437 u8 id;
2438 u8 len;
2439 u8 ssid[32];
2440} __packed;
2441
2442#define PROBE_OPTION_MAX_3945 4
2443#define PROBE_OPTION_MAX 20
2444#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002445#define IL_GOOD_CRC_TH_DISABLED 0
2446#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2447#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2448#define IL_MAX_SCAN_SIZE 1024
2449#define IL_MAX_CMD_SIZE 4096
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002450
2451/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002452 * C_SCAN = 0x80 (command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002453 *
2454 * The hardware scan command is very powerful; the driver can set it up to
2455 * maintain (relatively) normal network traffic while doing a scan in the
2456 * background. The max_out_time and suspend_time control the ratio of how
2457 * long the device stays on an associated network channel ("service channel")
2458 * vs. how long it's away from the service channel, i.e. tuned to other channels
2459 * for scanning.
2460 *
2461 * max_out_time is the max time off-channel (in usec), and suspend_time
2462 * is how long (in "extended beacon" format) that the scan is "suspended"
2463 * after returning to the service channel. That is, suspend_time is the
2464 * time that we stay on the service channel, doing normal work, between
2465 * scan segments. The driver may set these parameters differently to support
2466 * scanning when associated vs. not associated, and light vs. heavy traffic
2467 * loads when associated.
2468 *
2469 * After receiving this command, the device's scan engine does the following;
2470 *
2471 * 1) Sends SCAN_START notification to driver
2472 * 2) Checks to see if it has time to do scan for one channel
2473 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
2474 * to tell AP that we're going off-channel
2475 * 4) Tunes to first channel in scan list, does active or passive scan
2476 * 5) Sends SCAN_RESULT notification to driver
2477 * 6) Checks to see if it has time to do scan on *next* channel in list
2478 * 7) Repeats 4-6 until it no longer has time to scan the next channel
2479 * before max_out_time expires
2480 * 8) Returns to service channel
2481 * 9) Sends NULL packet with PS=0 to tell AP that we're back
2482 * 10) Stays on service channel until suspend_time expires
2483 * 11) Repeats entire process 2-10 until list is complete
2484 * 12) Sends SCAN_COMPLETE notification
2485 *
2486 * For fast, efficient scans, the scan command also has support for staying on
2487 * a channel for just a short time, if doing active scanning and getting no
2488 * responses to the transmitted probe request. This time is controlled by
2489 * quiet_time, and the number of received packets below which a channel is
2490 * considered "quiet" is controlled by quiet_plcp_threshold.
2491 *
2492 * For active scanning on channels that have regulatory restrictions against
2493 * blindly transmitting, the scan can listen before transmitting, to make sure
2494 * that there is already legitimate activity on the channel. If enough
2495 * packets are cleanly received on the channel (controlled by good_CRC_th,
2496 * typical value 1), the scan engine starts transmitting probe requests.
2497 *
2498 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2499 *
2500 * To avoid uCode errors, see timing restrictions described under
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002501 * struct il_scan_channel.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002502 */
2503
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002504struct il3945_scan_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002505 __le16 len;
2506 u8 reserved0;
2507 u8 channel_count; /* # channels in channel list */
2508 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2509 * (only for active scan) */
2510 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2511 __le16 good_CRC_th; /* passive -> active promotion threshold */
2512 __le16 reserved1;
2513 __le32 max_out_time; /* max usec to be away from associated (service)
2514 * channel */
2515 __le32 suspend_time; /* pause scan this long (in "extended beacon
2516 * format") when returning to service channel:
2517 * 3945; 31:24 # beacons, 19:0 additional usec,
2518 * 4965; 31:22 # beacons, 21:0 additional usec.
2519 */
2520 __le32 flags; /* RXON_FLG_* */
2521 __le32 filter_flags; /* RXON_FILTER_* */
2522
2523 /* For active scans (set to all-0s for passive scans).
2524 * Does not include payload. Must specify Tx rate; no rate scaling. */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002525 struct il3945_tx_cmd tx_cmd;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002526
2527 /* For directed active scans (set to all-0s otherwise) */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002528 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002529
2530 /*
2531 * Probe request frame, followed by channel list.
2532 *
2533 * Size of probe request frame is specified by byte count in tx_cmd.
2534 * Channel list follows immediately after probe request frame.
2535 * Number of channels in list is specified by channel_count.
2536 * Each channel in list is of type:
2537 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002538 * struct il3945_scan_channel channels[0];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002539 *
2540 * NOTE: Only one band of channels can be scanned per pass. You
2541 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002542 * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002543 * before requesting another scan.
2544 */
2545 u8 data[0];
2546} __packed;
2547
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002548struct il_scan_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002549 __le16 len;
2550 u8 reserved0;
2551 u8 channel_count; /* # channels in channel list */
2552 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2553 * (only for active scan) */
2554 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2555 __le16 good_CRC_th; /* passive -> active promotion threshold */
2556 __le16 rx_chain; /* RXON_RX_CHAIN_* */
2557 __le32 max_out_time; /* max usec to be away from associated (service)
2558 * channel */
2559 __le32 suspend_time; /* pause scan this long (in "extended beacon
2560 * format") when returning to service chnl:
2561 * 3945; 31:24 # beacons, 19:0 additional usec,
2562 * 4965; 31:22 # beacons, 21:0 additional usec.
2563 */
2564 __le32 flags; /* RXON_FLG_* */
2565 __le32 filter_flags; /* RXON_FILTER_* */
2566
2567 /* For active scans (set to all-0s for passive scans).
2568 * Does not include payload. Must specify Tx rate; no rate scaling. */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002569 struct il_tx_cmd tx_cmd;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002570
2571 /* For directed active scans (set to all-0s otherwise) */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002572 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002573
2574 /*
2575 * Probe request frame, followed by channel list.
2576 *
2577 * Size of probe request frame is specified by byte count in tx_cmd.
2578 * Channel list follows immediately after probe request frame.
2579 * Number of channels in list is specified by channel_count.
2580 * Each channel in list is of type:
2581 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002582 * struct il_scan_channel channels[0];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002583 *
2584 * NOTE: Only one band of channels can be scanned per pass. You
2585 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002586 * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002587 * before requesting another scan.
2588 */
2589 u8 data[0];
2590} __packed;
2591
2592/* Can abort will notify by complete notification with abort status. */
2593#define CAN_ABORT_STATUS cpu_to_le32(0x1)
2594/* complete notification statuses */
2595#define ABORT_STATUS 0x2
2596
2597/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002598 * C_SCAN = 0x80 (response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002599 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002600struct il_scanreq_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002601 __le32 status; /* 1: okay, 2: cannot fulfill request */
2602} __packed;
2603
2604/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002605 * N_SCAN_START = 0x82 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002606 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002607struct il_scanstart_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002608 __le32 tsf_low;
2609 __le32 tsf_high;
2610 __le32 beacon_timer;
2611 u8 channel;
2612 u8 band;
2613 u8 reserved[2];
2614 __le32 status;
2615} __packed;
2616
Phil Carmody497888c2011-07-14 15:07:13 +03002617#define SCAN_OWNER_STATUS 0x1
2618#define MEASURE_OWNER_STATUS 0x2
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002619
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002620#define IL_PROBE_STATUS_OK 0
2621#define IL_PROBE_STATUS_TX_FAILED BIT(0)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002622/* error statuses combined with TX_FAILED */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002623#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
2624#define IL_PROBE_STATUS_FAIL_BT BIT(2)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002625
Stanislaw Gruszkadb7746f2011-11-15 13:11:50 +01002626#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002627/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002628 * N_SCAN_RESULTS = 0x83 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002629 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002630struct il_scanresults_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002631 u8 channel;
2632 u8 band;
2633 u8 probe_status;
2634 u8 num_probe_not_sent; /* not enough time to send */
2635 __le32 tsf_low;
2636 __le32 tsf_high;
Stanislaw Gruszkadb7746f2011-11-15 13:11:50 +01002637 __le32 stats[NUMBER_OF_STATS];
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002638} __packed;
2639
2640/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002641 * N_SCAN_COMPLETE = 0x84 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002642 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002643struct il_scancomplete_notification {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002644 u8 scanned_channels;
2645 u8 status;
2646 u8 last_channel;
2647 __le32 tsf_low;
2648 __le32 tsf_high;
2649} __packed;
2650
2651
2652/******************************************************************************
2653 * (9)
2654 * IBSS/AP Commands and Notifications:
2655 *
2656 *****************************************************************************/
2657
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002658enum il_ibss_manager {
2659 IL_NOT_IBSS_MANAGER = 0,
2660 IL_IBSS_MANAGER = 1,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002661};
2662
2663/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002664 * N_BEACON = 0x90 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002665 */
2666
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002667struct il3945_beacon_notif {
2668 struct il3945_tx_resp beacon_notify_hdr;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002669 __le32 low_tsf;
2670 __le32 high_tsf;
2671 __le32 ibss_mgr_status;
2672} __packed;
2673
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002674struct il4965_beacon_notif {
2675 struct il4965_tx_resp beacon_notify_hdr;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002676 __le32 low_tsf;
2677 __le32 high_tsf;
2678 __le32 ibss_mgr_status;
2679} __packed;
2680
2681/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002682 * C_TX_BEACON= 0x91 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002683 */
2684
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002685struct il3945_tx_beacon_cmd {
2686 struct il3945_tx_cmd tx;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002687 __le16 tim_idx;
2688 u8 tim_size;
2689 u8 reserved1;
2690 struct ieee80211_hdr frame[0]; /* beacon frame */
2691} __packed;
2692
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002693struct il_tx_beacon_cmd {
2694 struct il_tx_cmd tx;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002695 __le16 tim_idx;
2696 u8 tim_size;
2697 u8 reserved1;
2698 struct ieee80211_hdr frame[0]; /* beacon frame */
2699} __packed;
2700
2701/******************************************************************************
2702 * (10)
2703 * Statistics Commands and Notifications:
2704 *
2705 *****************************************************************************/
2706
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002707#define IL_TEMP_CONVERT 260
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002708
2709#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
2710#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
2711#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
2712
2713/* Used for passing to driver number of successes and failures per rate */
2714struct rate_histogram {
2715 union {
2716 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2717 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2718 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2719 } success;
2720 union {
2721 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2722 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2723 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2724 } failed;
2725} __packed;
2726
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002727/* stats command response */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002728
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002729struct iwl39_stats_rx_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002730 __le32 ina_cnt;
2731 __le32 fina_cnt;
2732 __le32 plcp_err;
2733 __le32 crc32_err;
2734 __le32 overrun_err;
2735 __le32 early_overrun_err;
2736 __le32 crc32_good;
2737 __le32 false_alarm_cnt;
2738 __le32 fina_sync_err_cnt;
2739 __le32 sfd_timeout;
2740 __le32 fina_timeout;
2741 __le32 unresponded_rts;
2742 __le32 rxe_frame_limit_overrun;
2743 __le32 sent_ack_cnt;
2744 __le32 sent_cts_cnt;
2745} __packed;
2746
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002747struct iwl39_stats_rx_non_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002748 __le32 bogus_cts; /* CTS received when not expecting CTS */
2749 __le32 bogus_ack; /* ACK received when not expecting ACK */
2750 __le32 non_bssid_frames; /* number of frames with BSSID that
2751 * doesn't belong to the STA BSSID */
2752 __le32 filtered_frames; /* count frames that were dumped in the
2753 * filtering process */
2754 __le32 non_channel_beacons; /* beacons with our bss id but not on
2755 * our serving channel */
2756} __packed;
2757
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002758struct iwl39_stats_rx {
2759 struct iwl39_stats_rx_phy ofdm;
2760 struct iwl39_stats_rx_phy cck;
2761 struct iwl39_stats_rx_non_phy general;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002762} __packed;
2763
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002764struct iwl39_stats_tx {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002765 __le32 preamble_cnt;
2766 __le32 rx_detected_cnt;
2767 __le32 bt_prio_defer_cnt;
2768 __le32 bt_prio_kill_cnt;
2769 __le32 few_bytes_cnt;
2770 __le32 cts_timeout;
2771 __le32 ack_timeout;
2772 __le32 expected_ack_cnt;
2773 __le32 actual_ack_cnt;
2774} __packed;
2775
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002776struct stats_dbg {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002777 __le32 burst_check;
2778 __le32 burst_count;
2779 __le32 wait_for_silence_timeout_cnt;
2780 __le32 reserved[3];
2781} __packed;
2782
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002783struct iwl39_stats_div {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002784 __le32 tx_on_a;
2785 __le32 tx_on_b;
2786 __le32 exec_time;
2787 __le32 probe_time;
2788} __packed;
2789
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002790struct iwl39_stats_general {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002791 __le32 temperature;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002792 struct stats_dbg dbg;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002793 __le32 sleep_time;
2794 __le32 slots_out;
2795 __le32 slots_idle;
2796 __le32 ttl_timestamp;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002797 struct iwl39_stats_div div;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002798} __packed;
2799
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002800struct stats_rx_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002801 __le32 ina_cnt;
2802 __le32 fina_cnt;
2803 __le32 plcp_err;
2804 __le32 crc32_err;
2805 __le32 overrun_err;
2806 __le32 early_overrun_err;
2807 __le32 crc32_good;
2808 __le32 false_alarm_cnt;
2809 __le32 fina_sync_err_cnt;
2810 __le32 sfd_timeout;
2811 __le32 fina_timeout;
2812 __le32 unresponded_rts;
2813 __le32 rxe_frame_limit_overrun;
2814 __le32 sent_ack_cnt;
2815 __le32 sent_cts_cnt;
2816 __le32 sent_ba_rsp_cnt;
2817 __le32 dsp_self_kill;
2818 __le32 mh_format_err;
2819 __le32 re_acq_main_rssi_sum;
2820 __le32 reserved3;
2821} __packed;
2822
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002823struct stats_rx_ht_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002824 __le32 plcp_err;
2825 __le32 overrun_err;
2826 __le32 early_overrun_err;
2827 __le32 crc32_good;
2828 __le32 crc32_err;
2829 __le32 mh_format_err;
2830 __le32 agg_crc32_good;
2831 __le32 agg_mpdu_cnt;
2832 __le32 agg_cnt;
2833 __le32 unsupport_mcs;
2834} __packed;
2835
2836#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
2837
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002838struct stats_rx_non_phy {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002839 __le32 bogus_cts; /* CTS received when not expecting CTS */
2840 __le32 bogus_ack; /* ACK received when not expecting ACK */
2841 __le32 non_bssid_frames; /* number of frames with BSSID that
2842 * doesn't belong to the STA BSSID */
2843 __le32 filtered_frames; /* count frames that were dumped in the
2844 * filtering process */
2845 __le32 non_channel_beacons; /* beacons with our bss id but not on
2846 * our serving channel */
2847 __le32 channel_beacons; /* beacons with our bss id and in our
2848 * serving channel */
2849 __le32 num_missed_bcon; /* number of missed beacons */
2850 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
2851 * ADC was in saturation */
2852 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
2853 * for INA */
2854 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
2855 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
2856 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
2857 __le32 interference_data_flag; /* flag for interference data
2858 * availability. 1 when data is
2859 * available. */
2860 __le32 channel_load; /* counts RX Enable time in uSec */
2861 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
2862 * and CCK) counter */
2863 __le32 beacon_rssi_a;
2864 __le32 beacon_rssi_b;
2865 __le32 beacon_rssi_c;
2866 __le32 beacon_energy_a;
2867 __le32 beacon_energy_b;
2868 __le32 beacon_energy_c;
2869} __packed;
2870
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002871struct stats_rx {
2872 struct stats_rx_phy ofdm;
2873 struct stats_rx_phy cck;
2874 struct stats_rx_non_phy general;
2875 struct stats_rx_ht_phy ofdm_ht;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002876} __packed;
2877
2878/**
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002879 * struct stats_tx_power - current tx power
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002880 *
2881 * @ant_a: current tx power on chain a in 1/2 dB step
2882 * @ant_b: current tx power on chain b in 1/2 dB step
2883 * @ant_c: current tx power on chain c in 1/2 dB step
2884 */
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002885struct stats_tx_power {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002886 u8 ant_a;
2887 u8 ant_b;
2888 u8 ant_c;
2889 u8 reserved;
2890} __packed;
2891
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002892struct stats_tx_non_phy_agg {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002893 __le32 ba_timeout;
2894 __le32 ba_reschedule_frames;
2895 __le32 scd_query_agg_frame_cnt;
2896 __le32 scd_query_no_agg;
2897 __le32 scd_query_agg;
2898 __le32 scd_query_mismatch;
2899 __le32 frame_not_ready;
2900 __le32 underrun;
2901 __le32 bt_prio_kill;
2902 __le32 rx_ba_rsp_cnt;
2903} __packed;
2904
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002905struct stats_tx {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002906 __le32 preamble_cnt;
2907 __le32 rx_detected_cnt;
2908 __le32 bt_prio_defer_cnt;
2909 __le32 bt_prio_kill_cnt;
2910 __le32 few_bytes_cnt;
2911 __le32 cts_timeout;
2912 __le32 ack_timeout;
2913 __le32 expected_ack_cnt;
2914 __le32 actual_ack_cnt;
2915 __le32 dump_msdu_cnt;
2916 __le32 burst_abort_next_frame_mismatch_cnt;
2917 __le32 burst_abort_missing_next_frame_cnt;
2918 __le32 cts_timeout_collision;
2919 __le32 ack_or_ba_timeout_collision;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002920 struct stats_tx_non_phy_agg agg;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002921
2922 __le32 reserved1;
2923} __packed;
2924
2925
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002926struct stats_div {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002927 __le32 tx_on_a;
2928 __le32 tx_on_b;
2929 __le32 exec_time;
2930 __le32 probe_time;
2931 __le32 reserved1;
2932 __le32 reserved2;
2933} __packed;
2934
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002935struct stats_general_common {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002936 __le32 temperature; /* radio temperature */
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002937 struct stats_dbg dbg;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002938 __le32 sleep_time;
2939 __le32 slots_out;
2940 __le32 slots_idle;
2941 __le32 ttl_timestamp;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002942 struct stats_div div;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002943 __le32 rx_enable_counter;
2944 /*
2945 * num_of_sos_states:
2946 * count the number of times we have to re-tune
2947 * in order to get out of bad PHY status
2948 */
2949 __le32 num_of_sos_states;
2950} __packed;
2951
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002952struct stats_general {
2953 struct stats_general_common common;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002954 __le32 reserved2;
2955 __le32 reserved3;
2956} __packed;
2957
Stanislaw Gruszkadb7746f2011-11-15 13:11:50 +01002958#define UCODE_STATS_CLEAR_MSK (0x1 << 0)
2959#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1)
2960#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002961
2962/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002963 * C_STATS = 0x9c,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002964 * all devices identical.
2965 *
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002966 * This command triggers an immediate response containing uCode stats.
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002967 * The response is in the same format as N_STATS 0x9d, below.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002968 *
2969 * If the CLEAR_STATS configuration flag is set, uCode will clear its
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002970 * internal copy of the stats (counters) after issuing the response.
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002971 * This flag does not affect N_STATSs after beacons (see below).
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002972 *
2973 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002974 * N_STATSs after received beacons (see below). This flag
2975 * does not affect the response to the C_STATS 0x9c itself.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002976 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002977#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
2978#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002979struct il_stats_cmd {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02002980 __le32 configuration_flags; /* IL_STATS_CONF_* */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002981} __packed;
2982
2983/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002984 * N_STATS = 0x9d (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002985 *
2986 * By default, uCode issues this notification after receiving a beacon
2987 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002988 * C_STATS 0x9c, above.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002989 *
2990 * Statistics counters continue to increment beacon after beacon, but are
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02002991 * cleared when changing channels or when driver issues C_STATS
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002992 * 0x9c with CLEAR_STATS bit set (see above).
2993 *
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02002994 * uCode also issues this notification during scans. uCode clears stats
2995 * appropriately so that each notification contains stats for only the
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08002996 * one channel that has just been scanned.
2997 */
Stanislaw Gruszkadb7746f2011-11-15 13:11:50 +01002998#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
2999#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003000
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003001struct il3945_notif_stats {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003002 __le32 flag;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003003 struct iwl39_stats_rx rx;
3004 struct iwl39_stats_tx tx;
3005 struct iwl39_stats_general general;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003006} __packed;
3007
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003008struct il_notif_stats {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003009 __le32 flag;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003010 struct stats_rx rx;
3011 struct stats_tx tx;
3012 struct stats_general general;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003013} __packed;
3014
3015/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003016 * N_MISSED_BEACONS = 0xa2 (notification only, not a command)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003017 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003018 * uCode send N_MISSED_BEACONS to driver when detect beacon missed
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003019 * in regardless of how many missed beacons, which mean when driver receive the
3020 * notification, inside the command, it can find all the beacons information
3021 * which include number of total missed beacons, number of consecutive missed
3022 * beacons, number of beacons received and number of beacons expected to
3023 * receive.
3024 *
3025 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3026 * in order to bring the radio/PHY back to working state; which has no relation
3027 * to when driver will perform sensitivity calibration.
3028 *
3029 * Driver should set it own missed_beacon_threshold to decide when to perform
3030 * sensitivity calibration based on number of consecutive missed beacons in
3031 * order to improve overall performance, especially in noisy environment.
3032 *
3033 */
3034
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003035#define IL_MISSED_BEACON_THRESHOLD_MIN (1)
3036#define IL_MISSED_BEACON_THRESHOLD_DEF (5)
3037#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003038
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003039struct il_missed_beacon_notif {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003040 __le32 consecutive_missed_beacons;
3041 __le32 total_missed_becons;
3042 __le32 num_expected_beacons;
3043 __le32 num_recvd_beacons;
3044} __packed;
3045
3046
3047/******************************************************************************
3048 * (11)
3049 * Rx Calibration Commands:
3050 *
3051 * With the uCode used for open source drivers, most Tx calibration (except
3052 * for Tx Power) and most Rx calibration is done by uCode during the
3053 * "initialize" phase of uCode boot. Driver must calibrate only:
3054 *
3055 * 1) Tx power (depends on temperature), described elsewhere
3056 * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3057 * 3) Receiver sensitivity (to optimize signal detection)
3058 *
3059 *****************************************************************************/
3060
3061/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003062 * C_SENSITIVITY = 0xa8 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003063 *
3064 * This command sets up the Rx signal detector for a sensitivity level that
3065 * is high enough to lock onto all signals within the associated network,
3066 * but low enough to ignore signals that are below a certain threshold, so as
3067 * not to have too many "false alarms". False alarms are signals that the
3068 * Rx DSP tries to lock onto, but then discards after determining that they
3069 * are noise.
3070 *
3071 * The optimum number of false alarms is between 5 and 50 per 200 TUs
3072 * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3073 * time listening, not transmitting). Driver must adjust sensitivity so that
3074 * the ratio of actual false alarms to actual Rx time falls within this range.
3075 *
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003076 * While associated, uCode delivers N_STATSs after each
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003077 * received beacon. These provide information to the driver to analyze the
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003078 * sensitivity. Don't analyze stats that come in from scanning, or any
3079 * other non-associated-network source. Pertinent stats include:
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003080 *
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003081 * From "general" stats (struct stats_rx_non_phy):
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003082 *
3083 * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3084 * Measure of energy of desired signal. Used for establishing a level
3085 * below which the device does not detect signals.
3086 *
3087 * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3088 * Measure of background noise in silent period after beacon.
3089 *
3090 * channel_load
3091 * uSecs of actual Rx time during beacon period (varies according to
3092 * how much time was spent transmitting).
3093 *
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003094 * From "cck" and "ofdm" stats (struct stats_rx_phy), separately:
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003095 *
3096 * false_alarm_cnt
3097 * Signal locks abandoned early (before phy-level header).
3098 *
3099 * plcp_err
3100 * Signal locks abandoned late (during phy-level header).
3101 *
3102 * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
3103 * beacon to beacon, i.e. each value is an accumulation of all errors
3104 * before and including the latest beacon. Values will wrap around to 0
3105 * after counting up to 2^32 - 1. Driver must differentiate vs.
3106 * previous beacon's values to determine # false alarms in the current
3107 * beacon period.
3108 *
3109 * Total number of false alarms = false_alarms + plcp_errs
3110 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003111 * For OFDM, adjust the following table entries in struct il_sensitivity_cmd
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003112 * (notice that the start points for OFDM are at or close to settings for
3113 * maximum sensitivity):
3114 *
3115 * START / MIN / MAX
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003116 * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120
3117 * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210
3118 * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140
3119 * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003120 *
3121 * If actual rate of OFDM false alarms (+ plcp_errors) is too high
3122 * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3123 * by *adding* 1 to all 4 of the table entries above, up to the max for
3124 * each entry. Conversely, if false alarm rate is too low (less than 5
3125 * for each 204.8 msecs listening), *subtract* 1 from each entry to
3126 * increase sensitivity.
3127 *
3128 * For CCK sensitivity, keep track of the following:
3129 *
3130 * 1). 20-beacon history of maximum background noise, indicated by
3131 * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3132 * 3 receivers. For any given beacon, the "silence reference" is
3133 * the maximum of last 60 samples (20 beacons * 3 receivers).
3134 *
3135 * 2). 10-beacon history of strongest signal level, as indicated
3136 * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3137 * i.e. the strength of the signal through the best receiver at the
3138 * moment. These measurements are "upside down", with lower values
3139 * for stronger signals, so max energy will be *minimum* value.
3140 *
3141 * Then for any given beacon, the driver must determine the *weakest*
3142 * of the strongest signals; this is the minimum level that needs to be
3143 * successfully detected, when using the best receiver at the moment.
3144 * "Max cck energy" is the maximum (higher value means lower energy!)
3145 * of the last 10 minima. Once this is determined, driver must add
3146 * a little margin by adding "6" to it.
3147 *
3148 * 3). Number of consecutive beacon periods with too few false alarms.
3149 * Reset this to 0 at the first beacon period that falls within the
3150 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3151 *
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003152 * Then, adjust the following CCK table entries in struct il_sensitivity_cmd
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003153 * (notice that the start points for CCK are at maximum sensitivity):
3154 *
3155 * START / MIN / MAX
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003156 * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200
3157 * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400
3158 * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003159 *
3160 * If actual rate of CCK false alarms (+ plcp_errors) is too high
3161 * (greater than 50 for each 204.8 msecs listening), method for reducing
3162 * sensitivity is:
3163 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003164 * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003165 * up to max 400.
3166 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003167 * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003168 * sensitivity has been reduced a significant amount; bring it up to
3169 * a moderate 161. Otherwise, *add* 3, up to max 200.
3170 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003171 * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003172 * sensitivity has been reduced only a moderate or small amount;
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003173 * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003174 * down to min 0. Otherwise (if gain has been significantly reduced),
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003175 * don't change the HD_MIN_ENERGY_CCK_DET_IDX value.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003176 *
3177 * b) Save a snapshot of the "silence reference".
3178 *
3179 * If actual rate of CCK false alarms (+ plcp_errors) is too low
3180 * (less than 5 for each 204.8 msecs listening), method for increasing
3181 * sensitivity is used only if:
3182 *
3183 * 1a) Previous beacon did not have too many false alarms
3184 * 1b) AND difference between previous "silence reference" and current
3185 * "silence reference" (prev - current) is 2 or more,
3186 * OR 2) 100 or more consecutive beacon periods have had rate of
3187 * less than 5 false alarms per 204.8 milliseconds rx time.
3188 *
3189 * Method for increasing sensitivity:
3190 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003191 * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003192 * down to min 125.
3193 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003194 * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003195 * down to min 200.
3196 *
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003197 * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003198 *
3199 * If actual rate of CCK false alarms (+ plcp_errors) is within good range
3200 * (between 5 and 50 for each 204.8 msecs listening):
3201 *
3202 * 1) Save a snapshot of the silence reference.
3203 *
3204 * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
3205 * give some extra margin to energy threshold by *subtracting* 8
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003206 * from value in HD_MIN_ENERGY_CCK_DET_IDX.
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003207 *
3208 * For all cases (too few, too many, good range), make sure that the CCK
3209 * detection threshold (energy) is below the energy level for robust
3210 * detection over the past 10 beacon periods, the "Max cck energy".
3211 * Lower values mean higher energy; this means making sure that the value
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003212 * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy".
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003213 *
3214 */
3215
3216/*
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003217 * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003218 */
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +02003219#define HD_TBL_SIZE (11) /* number of entries */
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01003220#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
Stanislaw Gruszka2d09b062011-08-26 16:10:40 +02003221#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
3222#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
3223#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
3224#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4)
3225#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5)
3226#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6)
3227#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7)
3228#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8)
3229#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9)
3230#define HD_OFDM_ENERGY_TH_IN_IDX (10)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003231
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003232/* Control field in struct il_sensitivity_cmd */
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003233#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0)
3234#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003235
3236/**
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003237 * struct il_sensitivity_cmd
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003238 * @control: (1) updates working table, (0) updates default table
Stanislaw Gruszka0c2c8852011-11-15 12:30:17 +01003239 * @table: energy threshold values, use HD_* as idx into table
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003240 *
3241 * Always use "1" in "control" to update uCode's working table and DSP.
3242 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003243struct il_sensitivity_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003244 __le16 control; /* always use "1" */
Stanislaw Gruszka3b98c7f2011-08-26 16:29:35 +02003245 __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003246} __packed;
3247
3248
3249/**
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003250 * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003251 *
3252 * This command sets the relative gains of 4965 device's 3 radio receiver chains.
3253 *
3254 * After the first association, driver should accumulate signal and noise
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003255 * stats from the N_STATSs that follow the first 20
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003256 * beacons from the associated network (don't collect stats that come
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003257 * in from scanning, or any other non-network source).
3258 *
3259 * DISCONNECTED ANTENNA:
3260 *
3261 * Driver should determine which antennas are actually connected, by comparing
3262 * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
3263 * following values over 20 beacons, one accumulator for each of the chains
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003264 * a/b/c, from struct stats_rx_non_phy:
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003265 *
3266 * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3267 *
3268 * Find the strongest signal from among a/b/c. Compare the other two to the
3269 * strongest. If any signal is more than 15 dB (times 20, unless you
3270 * divide the accumulated values by 20) below the strongest, the driver
3271 * considers that antenna to be disconnected, and should not try to use that
3272 * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
3273 * driver should declare the stronger one as connected, and attempt to use it
3274 * (A and B are the only 2 Tx chains!).
3275 *
3276 *
3277 * RX BALANCE:
3278 *
3279 * Driver should balance the 3 receivers (but just the ones that are connected
3280 * to antennas, see above) for gain, by comparing the average signal levels
3281 * detected during the silence after each beacon (background noise).
3282 * Accumulate (add) the following values over 20 beacons, one accumulator for
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003283 * each of the chains a/b/c, from struct stats_rx_non_phy:
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003284 *
3285 * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3286 *
3287 * Find the weakest background noise level from among a/b/c. This Rx chain
3288 * will be the reference, with 0 gain adjustment. Attenuate other channels by
3289 * finding noise difference:
3290 *
3291 * (accum_noise[i] - accum_noise[reference]) / 30
3292 *
3293 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003294 * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003295 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3296 * and set bit 2 to indicate "reduce gain". The value for the reference
3297 * (weakest) chain should be "0".
3298 *
3299 * diff_gain_[abc] bit fields:
3300 * 2: (1) reduce gain, (0) increase gain
3301 * 1-0: amount of gain, units of 1.5 dB
3302 */
3303
3304/* Phy calibration command for series */
3305/* The default calibrate table size if not specified by firmware */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003306#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003307enum {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003308 IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
3309 IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003310};
3311
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003312#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003313
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003314struct il_calib_hdr {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003315 u8 op_code;
3316 u8 first_group;
3317 u8 groups_num;
3318 u8 data_valid;
3319} __packed;
3320
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003321/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3322struct il_calib_diff_gain_cmd {
3323 struct il_calib_hdr hdr;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003324 s8 diff_gain_a; /* see above */
3325 s8 diff_gain_b;
3326 s8 diff_gain_c;
3327 u8 reserved1;
3328} __packed;
3329
3330/******************************************************************************
3331 * (12)
3332 * Miscellaneous Commands:
3333 *
3334 *****************************************************************************/
3335
3336/*
3337 * LEDs Command & Response
Stanislaw Gruszka4d69c752011-08-30 15:26:35 +02003338 * C_LEDS = 0x48 (command, has simple generic response)
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003339 *
3340 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3341 * this command turns it on or off, or sets up a periodic blinking cycle.
3342 */
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003343struct il_led_cmd {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003344 __le32 interval; /* "interval" in uSec */
3345 u8 id; /* 1: Activity, 2: Link, 3: Tech */
3346 u8 off; /* # intervals off while blinking;
3347 * "0", with >0 "on" value, turns LED on */
3348 u8 on; /* # intervals on while blinking;
3349 * "0", regardless of "off", turns LED off */
3350 u8 reserved;
3351} __packed;
3352
3353
3354/******************************************************************************
3355 * (13)
3356 * Union of all expected notifications/responses:
3357 *
3358 *****************************************************************************/
3359
Stanislaw Gruszkae94a4092011-08-31 13:23:20 +02003360#define IL_RX_FRAME_SIZE_MSK 0x00003fff
3361
Stanislaw Gruszkadcae1c62011-08-26 14:36:21 +02003362struct il_rx_pkt {
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003363 /*
3364 * The first 4 bytes of the RX frame header contain both the RX frame
3365 * size and some flags.
3366 * Bit fields:
3367 * 31: flag flush RB request
3368 * 30: flag ignore TC (terminal counter) request
3369 * 29: flag fast IRQ request
3370 * 28-14: Reserved
3371 * 13-00: RX frame size
3372 */
3373 __le32 len_n_flags;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003374 struct il_cmd_header hdr;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003375 union {
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003376 struct il3945_rx_frame rx_frame;
3377 struct il3945_tx_resp tx_resp;
3378 struct il3945_beacon_notif beacon_status;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003379
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003380 struct il_alive_resp alive_frame;
3381 struct il_spectrum_notification spectrum_notif;
3382 struct il_csa_notification csa_notif;
3383 struct il_error_resp err_resp;
3384 struct il_card_state_notif card_state_notif;
3385 struct il_add_sta_resp add_sta;
3386 struct il_rem_sta_resp rem_sta;
3387 struct il_sleep_notification sleep_notif;
3388 struct il_spectrum_resp spectrum;
Stanislaw Gruszkaebf0d902011-08-26 15:43:47 +02003389 struct il_notif_stats stats;
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003390 struct il_compressed_ba_resp compressed_ba;
3391 struct il_missed_beacon_notif missed_beacon;
Wey-Yi Guybe663ab2011-02-21 11:27:26 -08003392 __le32 status;
3393 u8 raw[0];
3394 } u;
3395} __packed;
3396
Stanislaw Gruszkae2ebc832011-10-24 15:41:30 +02003397#endif /* __il_commands_h__ */