aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/commands.h
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2011-08-31 04:59:02 -0400
committerStanislaw Gruszka <sgruszka@redhat.com>2011-11-15 07:51:26 -0500
commitd4459a99c41e0e4fe7e36b3816b461c42827fb80 (patch)
tree05c32695020d4e768077f86f060bc901931b5866 /drivers/net/wireless/iwlegacy/commands.h
parent7f8e12238049b0e5398e77cdf15f95a41077841f (diff)
iwlegacy: rename iwl-commands.h to commands.h
On the way remove also not needed iwl-fh.h include. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/commands.h')
-rw-r--r--drivers/net/wireless/iwlegacy/commands.h3393
1 files changed, 3393 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlegacy/commands.h b/drivers/net/wireless/iwlegacy/commands.h
new file mode 100644
index 000000000000..82cf472157de
--- /dev/null
+++ b/drivers/net/wireless/iwlegacy/commands.h
@@ -0,0 +1,3393 @@
1/******************************************************************************
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 *****************************************************************************/
63
64#ifndef __il_commands_h__
65#define __il_commands_h__
66
67struct il_priv;
68
69/* uCode version contains 4 values: Major/Minor/API/Serial */
70#define IL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
71#define IL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
72#define IL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
73#define IL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
74
75
76/* Tx rates */
77#define IL_CCK_RATES 4
78#define IL_OFDM_RATES 8
79#define IL_MAX_RATES (IL_CCK_RATES + IL_OFDM_RATES)
80
81enum {
82 N_ALIVE = 0x1,
83 N_ERROR = 0x2,
84
85 /* RXON and QOS commands */
86 C_RXON = 0x10,
87 C_RXON_ASSOC = 0x11,
88 C_QOS_PARAM = 0x13,
89 C_RXON_TIMING = 0x14,
90
91 /* Multi-Station support */
92 C_ADD_STA = 0x18,
93 C_REM_STA = 0x19,
94
95 /* Security */
96 C_WEPKEY = 0x20,
97
98 /* RX, TX, LEDs */
99 N_3945_RX = 0x1b, /* 3945 only */
100 C_TX = 0x1c,
101 C_RATE_SCALE = 0x47, /* 3945 only */
102 C_LEDS = 0x48,
103 C_TX_LINK_QUALITY_CMD = 0x4e, /* for 4965 */
104
105 /* 802.11h related */
106 C_CHANNEL_SWITCH = 0x72,
107 N_CHANNEL_SWITCH = 0x73,
108 C_SPECTRUM_MEASUREMENT = 0x74,
109 N_SPECTRUM_MEASUREMENT = 0x75,
110
111 /* Power Management */
112 C_POWER_TBL = 0x77,
113 N_PM_SLEEP = 0x7A,
114 N_PM_DEBUG_STATS = 0x7B,
115
116 /* Scan commands and notifications */
117 C_SCAN = 0x80,
118 C_SCAN_ABORT = 0x81,
119 N_SCAN_START = 0x82,
120 N_SCAN_RESULTS = 0x83,
121 N_SCAN_COMPLETE = 0x84,
122
123 /* IBSS/AP commands */
124 N_BEACON = 0x90,
125 C_TX_BEACON= 0x91,
126
127 /* Miscellaneous commands */
128 C_TX_PWR_TBL = 0x97,
129
130 /* Bluetooth device coexistence config command */
131 C_BT_CONFIG = 0x9b,
132
133 /* Statistics */
134 C_STATS = 0x9c,
135 N_STATS = 0x9d,
136
137 /* RF-KILL commands and notifications */
138 N_CARD_STATE = 0xa1,
139
140 /* Missed beacons notification */
141 N_MISSED_BEACONS = 0xa2,
142
143 C_CT_KILL_CONFIG = 0xa4,
144 C_SENSITIVITY = 0xa8,
145 C_PHY_CALIBRATION = 0xb0,
146 N_RX_PHY = 0xc0,
147 N_RX_MPDU = 0xc1,
148 N_RX = 0xc3,
149 N_COMPRESSED_BA = 0xc5,
150
151 IL_CN_MAX = 0xff
152};
153
154/******************************************************************************
155 * (0)
156 * Commonly used structures and definitions:
157 * Command header, rate_n_flags, txpower
158 *
159 *****************************************************************************/
160
161/* il_cmd_header flags value */
162#define IL_CMD_FAILED_MSK 0x40
163
164#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
165#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
166#define SEQ_TO_IDX(s) ((s) & 0xff)
167#define IDX_TO_SEQ(i) ((i) & 0xff)
168#define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
169#define SEQ_RX_FRAME cpu_to_le16(0x8000)
170
171/**
172 * struct il_cmd_header
173 *
174 * This header format appears in the beginning of each command sent from the
175 * driver, and each response/notification received from uCode.
176 */
177struct il_cmd_header {
178 u8 cmd; /* Command ID: C_RXON, etc. */
179 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
180 /*
181 * The driver sets up the sequence number to values of its choosing.
182 * uCode does not use this value, but passes it back to the driver
183 * when sending the response to each driver-originated command, so
184 * the driver can match the response to the command. Since the values
185 * don't get used by uCode, the driver may set up an arbitrary format.
186 *
187 * There is one exception: uCode sets bit 15 when it originates
188 * the response/notification, i.e. when the response/notification
189 * is not a direct response to a command sent by the driver. For
190 * example, uCode issues N_3945_RX when it sends a received frame
191 * to the driver; it is not a direct response to any driver command.
192 *
193 * The Linux driver uses the following format:
194 *
195 * 0:7 tfd idx - position within TX queue
196 * 8:12 TX queue id
197 * 13 reserved
198 * 14 huge - driver sets this to indicate command is in the
199 * 'huge' storage at the end of the command buffers
200 * 15 unsolicited RX or uCode-originated notification
201 */
202 __le16 sequence;
203
204 /* command or response/notification data follows immediately */
205 u8 data[0];
206} __packed;
207
208
209/**
210 * struct il3945_tx_power
211 *
212 * Used in C_TX_PWR_TBL, C_SCAN, C_CHANNEL_SWITCH
213 *
214 * Each entry contains two values:
215 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
216 * linear value that multiplies the output of the digital signal processor,
217 * before being sent to the analog radio.
218 * 2) Radio gain. This sets the analog gain of the radio Tx path.
219 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
220 *
221 * Driver obtains values from struct il3945_tx_power power_gain_table[][].
222 */
223struct il3945_tx_power {
224 u8 tx_gain; /* gain for analog radio */
225 u8 dsp_atten; /* gain for DSP */
226} __packed;
227
228/**
229 * struct il3945_power_per_rate
230 *
231 * Used in C_TX_PWR_TBL, C_CHANNEL_SWITCH
232 */
233struct il3945_power_per_rate {
234 u8 rate; /* plcp */
235 struct il3945_tx_power tpc;
236 u8 reserved;
237} __packed;
238
239/**
240 * iwl4965 rate_n_flags bit fields
241 *
242 * rate_n_flags format is used in following iwl4965 commands:
243 * N_RX (response only)
244 * N_RX_MPDU (response only)
245 * C_TX (both command and response)
246 * C_TX_LINK_QUALITY_CMD
247 *
248 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
249 * 2-0: 0) 6 Mbps
250 * 1) 12 Mbps
251 * 2) 18 Mbps
252 * 3) 24 Mbps
253 * 4) 36 Mbps
254 * 5) 48 Mbps
255 * 6) 54 Mbps
256 * 7) 60 Mbps
257 *
258 * 4-3: 0) Single stream (SISO)
259 * 1) Dual stream (MIMO)
260 * 2) Triple stream (MIMO)
261 *
262 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
263 *
264 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
265 * 3-0: 0xD) 6 Mbps
266 * 0xF) 9 Mbps
267 * 0x5) 12 Mbps
268 * 0x7) 18 Mbps
269 * 0x9) 24 Mbps
270 * 0xB) 36 Mbps
271 * 0x1) 48 Mbps
272 * 0x3) 54 Mbps
273 *
274 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
275 * 6-0: 10) 1 Mbps
276 * 20) 2 Mbps
277 * 55) 5.5 Mbps
278 * 110) 11 Mbps
279 */
280#define RATE_MCS_CODE_MSK 0x7
281#define RATE_MCS_SPATIAL_POS 3
282#define RATE_MCS_SPATIAL_MSK 0x18
283#define RATE_MCS_HT_DUP_POS 5
284#define RATE_MCS_HT_DUP_MSK 0x20
285
286/* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
287#define RATE_MCS_FLAGS_POS 8
288#define RATE_MCS_HT_POS 8
289#define RATE_MCS_HT_MSK 0x100
290
291/* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
292#define RATE_MCS_CCK_POS 9
293#define RATE_MCS_CCK_MSK 0x200
294
295/* Bit 10: (1) Use Green Field preamble */
296#define RATE_MCS_GF_POS 10
297#define RATE_MCS_GF_MSK 0x400
298
299/* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
300#define RATE_MCS_HT40_POS 11
301#define RATE_MCS_HT40_MSK 0x800
302
303/* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
304#define RATE_MCS_DUP_POS 12
305#define RATE_MCS_DUP_MSK 0x1000
306
307/* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
308#define RATE_MCS_SGI_POS 13
309#define RATE_MCS_SGI_MSK 0x2000
310
311/**
312 * rate_n_flags Tx antenna masks
313 * 4965 has 2 transmitters
314 * bit14:16
315 */
316#define RATE_MCS_ANT_POS 14
317#define RATE_MCS_ANT_A_MSK 0x04000
318#define RATE_MCS_ANT_B_MSK 0x08000
319#define RATE_MCS_ANT_C_MSK 0x10000
320#define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
321#define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
322#define RATE_ANT_NUM 3
323
324#define POWER_TBL_NUM_ENTRIES 33
325#define POWER_TBL_NUM_HT_OFDM_ENTRIES 32
326#define POWER_TBL_CCK_ENTRY 32
327
328#define IL_PWR_NUM_HT_OFDM_ENTRIES 24
329#define IL_PWR_CCK_ENTRIES 2
330
331/**
332 * union il4965_tx_power_dual_stream
333 *
334 * Host format used for C_TX_PWR_TBL, C_CHANNEL_SWITCH
335 * Use __le32 version (struct tx_power_dual_stream) when building command.
336 *
337 * Driver provides radio gain and DSP attenuation settings to device in pairs,
338 * one value for each transmitter chain. The first value is for transmitter A,
339 * second for transmitter B.
340 *
341 * For SISO bit rates, both values in a pair should be identical.
342 * For MIMO rates, one value may be different from the other,
343 * in order to balance the Tx output between the two transmitters.
344 *
345 * See more details in doc for TXPOWER in 4965.h.
346 */
347union il4965_tx_power_dual_stream {
348 struct {
349 u8 radio_tx_gain[2];
350 u8 dsp_predis_atten[2];
351 } s;
352 u32 dw;
353};
354
355/**
356 * struct tx_power_dual_stream
357 *
358 * Table entries in C_TX_PWR_TBL, C_CHANNEL_SWITCH
359 *
360 * Same format as il_tx_power_dual_stream, but __le32
361 */
362struct tx_power_dual_stream {
363 __le32 dw;
364} __packed;
365
366/**
367 * struct il4965_tx_power_db
368 *
369 * Entire table within C_TX_PWR_TBL, C_CHANNEL_SWITCH
370 */
371struct il4965_tx_power_db {
372 struct tx_power_dual_stream power_tbl[POWER_TBL_NUM_ENTRIES];
373} __packed;
374
375/******************************************************************************
376 * (0a)
377 * Alive and Error Commands & Responses:
378 *
379 *****************************************************************************/
380
381#define UCODE_VALID_OK cpu_to_le32(0x1)
382#define INITIALIZE_SUBTYPE (9)
383
384/*
385 * ("Initialize") N_ALIVE = 0x1 (response only, not a command)
386 *
387 * uCode issues this "initialize alive" notification once the initialization
388 * uCode image has completed its work, and is ready to load the runtime image.
389 * This is the *first* "alive" notification that the driver will receive after
390 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
391 *
392 * See comments documenting "BSM" (bootstrap state machine).
393 *
394 * For 4965, this notification contains important calibration data for
395 * calculating txpower settings:
396 *
397 * 1) Power supply voltage indication. The voltage sensor outputs higher
398 * values for lower voltage, and vice verse.
399 *
400 * 2) Temperature measurement parameters, for each of two channel widths
401 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
402 * is done via one of the receiver chains, and channel width influences
403 * the results.
404 *
405 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
406 * for each of 5 frequency ranges.
407 */
408struct il_init_alive_resp {
409 u8 ucode_minor;
410 u8 ucode_major;
411 __le16 reserved1;
412 u8 sw_rev[8];
413 u8 ver_type;
414 u8 ver_subtype; /* "9" for initialize alive */
415 __le16 reserved2;
416 __le32 log_event_table_ptr;
417 __le32 error_event_table_ptr;
418 __le32 timestamp;
419 __le32 is_valid;
420
421 /* calibration values from "initialize" uCode */
422 __le32 voltage; /* signed, higher value is lower voltage */
423 __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for HT40 */
424 __le32 therm_r2[2]; /* signed */
425 __le32 therm_r3[2]; /* signed */
426 __le32 therm_r4[2]; /* signed */
427 __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups,
428 * 2 Tx chains */
429} __packed;
430
431
432/**
433 * N_ALIVE = 0x1 (response only, not a command)
434 *
435 * uCode issues this "alive" notification once the runtime image is ready
436 * to receive commands from the driver. This is the *second* "alive"
437 * notification that the driver will receive after rebooting uCode;
438 * this "alive" is indicated by subtype field != 9.
439 *
440 * See comments documenting "BSM" (bootstrap state machine).
441 *
442 * This response includes two pointers to structures within the device's
443 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
444 *
445 * 1) log_event_table_ptr indicates base of the event log. This traces
446 * a 256-entry history of uCode execution within a circular buffer.
447 * Its header format is:
448 *
449 * __le32 log_size; log capacity (in number of entries)
450 * __le32 type; (1) timestamp with each entry, (0) no timestamp
451 * __le32 wraps; # times uCode has wrapped to top of circular buffer
452 * __le32 write_idx; next circular buffer entry that uCode would fill
453 *
454 * The header is followed by the circular buffer of log entries. Entries
455 * with timestamps have the following format:
456 *
457 * __le32 event_id; range 0 - 1500
458 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
459 * __le32 data; event_id-specific data value
460 *
461 * Entries without timestamps contain only event_id and data.
462 *
463 *
464 * 2) error_event_table_ptr indicates base of the error log. This contains
465 * information about any uCode error that occurs. For 4965, the format
466 * of the error log is:
467 *
468 * __le32 valid; (nonzero) valid, (0) log is empty
469 * __le32 error_id; type of error
470 * __le32 pc; program counter
471 * __le32 blink1; branch link
472 * __le32 blink2; branch link
473 * __le32 ilink1; interrupt link
474 * __le32 ilink2; interrupt link
475 * __le32 data1; error-specific data
476 * __le32 data2; error-specific data
477 * __le32 line; source code line of error
478 * __le32 bcon_time; beacon timer
479 * __le32 tsf_low; network timestamp function timer
480 * __le32 tsf_hi; network timestamp function timer
481 * __le32 gp1; GP1 timer register
482 * __le32 gp2; GP2 timer register
483 * __le32 gp3; GP3 timer register
484 * __le32 ucode_ver; uCode version
485 * __le32 hw_ver; HW Silicon version
486 * __le32 brd_ver; HW board version
487 * __le32 log_pc; log program counter
488 * __le32 frame_ptr; frame pointer
489 * __le32 stack_ptr; stack pointer
490 * __le32 hcmd; last host command
491 * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
492 * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
493 * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
494 * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
495 * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
496 * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
497 * __le32 wait_event; wait event() caller address
498 * __le32 l2p_control; L2pControlField
499 * __le32 l2p_duration; L2pDurationField
500 * __le32 l2p_mhvalid; L2pMhValidBits
501 * __le32 l2p_addr_match; L2pAddrMatchStat
502 * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
503 * __le32 u_timestamp; indicate when the date and time of the compilation
504 * __le32 reserved;
505 *
506 * The Linux driver can print both logs to the system log when a uCode error
507 * occurs.
508 */
509struct il_alive_resp {
510 u8 ucode_minor;
511 u8 ucode_major;
512 __le16 reserved1;
513 u8 sw_rev[8];
514 u8 ver_type;
515 u8 ver_subtype; /* not "9" for runtime alive */
516 __le16 reserved2;
517 __le32 log_event_table_ptr; /* SRAM address for event log */
518 __le32 error_event_table_ptr; /* SRAM address for error log */
519 __le32 timestamp;
520 __le32 is_valid;
521} __packed;
522
523/*
524 * N_ERROR = 0x2 (response only, not a command)
525 */
526struct il_error_resp {
527 __le32 error_type;
528 u8 cmd_id;
529 u8 reserved1;
530 __le16 bad_cmd_seq_num;
531 __le32 error_info;
532 __le64 timestamp;
533} __packed;
534
535/******************************************************************************
536 * (1)
537 * RXON Commands & Responses:
538 *
539 *****************************************************************************/
540
541/*
542 * Rx config defines & structure
543 */
544/* rx_config device types */
545enum {
546 RXON_DEV_TYPE_AP = 1,
547 RXON_DEV_TYPE_ESS = 3,
548 RXON_DEV_TYPE_IBSS = 4,
549 RXON_DEV_TYPE_SNIFFER = 6,
550};
551
552
553#define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
554#define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
555#define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
556#define RXON_RX_CHAIN_VALID_POS (1)
557#define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
558#define RXON_RX_CHAIN_FORCE_SEL_POS (4)
559#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
560#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
561#define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
562#define RXON_RX_CHAIN_CNT_POS (10)
563#define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
564#define RXON_RX_CHAIN_MIMO_CNT_POS (12)
565#define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
566#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
567
568/* rx_config flags */
569/* band & modulation selection */
570#define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
571#define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
572/* auto detection enable */
573#define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
574/* TGg protection when tx */
575#define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
576/* cck short slot & preamble */
577#define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
578#define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
579/* antenna selection */
580#define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
581#define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
582#define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
583#define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
584/* radar detection enable */
585#define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
586#define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
587/* rx response to host with 8-byte TSF
588* (according to ON_AIR deassertion) */
589#define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
590
591
592/* HT flags */
593#define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
594#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
595
596#define RXON_FLG_HT_OPERATING_MODE_POS (23)
597
598#define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
599#define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
600
601#define RXON_FLG_CHANNEL_MODE_POS (25)
602#define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
603
604/* channel mode */
605enum {
606 CHANNEL_MODE_LEGACY = 0,
607 CHANNEL_MODE_PURE_40 = 1,
608 CHANNEL_MODE_MIXED = 2,
609 CHANNEL_MODE_RESERVED = 3,
610};
611#define RXON_FLG_CHANNEL_MODE_LEGACY \
612 cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
613#define RXON_FLG_CHANNEL_MODE_PURE_40 \
614 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
615#define RXON_FLG_CHANNEL_MODE_MIXED \
616 cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
617
618/* CTS to self (if spec allows) flag */
619#define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
620
621/* rx_config filter flags */
622/* accept all data frames */
623#define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
624/* pass control & management to host */
625#define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
626/* accept multi-cast */
627#define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
628/* don't decrypt uni-cast frames */
629#define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
630/* don't decrypt multi-cast frames */
631#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
632/* STA is associated */
633#define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
634/* transfer to host non bssid beacons in associated state */
635#define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
636
637/**
638 * C_RXON = 0x10 (command, has simple generic response)
639 *
640 * RXON tunes the radio tuner to a service channel, and sets up a number
641 * of parameters that are used primarily for Rx, but also for Tx operations.
642 *
643 * NOTE: When tuning to a new channel, driver must set the
644 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
645 * info within the device, including the station tables, tx retry
646 * rate tables, and txpower tables. Driver must build a new station
647 * table and txpower table before transmitting anything on the RXON
648 * channel.
649 *
650 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
651 * issue a new C_TX_PWR_TBL after each C_RXON (0x10),
652 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
653 */
654
655struct il3945_rxon_cmd {
656 u8 node_addr[6];
657 __le16 reserved1;
658 u8 bssid_addr[6];
659 __le16 reserved2;
660 u8 wlap_bssid_addr[6];
661 __le16 reserved3;
662 u8 dev_type;
663 u8 air_propagation;
664 __le16 reserved4;
665 u8 ofdm_basic_rates;
666 u8 cck_basic_rates;
667 __le16 assoc_id;
668 __le32 flags;
669 __le32 filter_flags;
670 __le16 channel;
671 __le16 reserved5;
672} __packed;
673
674struct il4965_rxon_cmd {
675 u8 node_addr[6];
676 __le16 reserved1;
677 u8 bssid_addr[6];
678 __le16 reserved2;
679 u8 wlap_bssid_addr[6];
680 __le16 reserved3;
681 u8 dev_type;
682 u8 air_propagation;
683 __le16 rx_chain;
684 u8 ofdm_basic_rates;
685 u8 cck_basic_rates;
686 __le16 assoc_id;
687 __le32 flags;
688 __le32 filter_flags;
689 __le16 channel;
690 u8 ofdm_ht_single_stream_basic_rates;
691 u8 ofdm_ht_dual_stream_basic_rates;
692} __packed;
693
694/* Create a common rxon cmd which will be typecast into the 3945 or 4965
695 * specific rxon cmd, depending on where it is called from.
696 */
697struct il_rxon_cmd {
698 u8 node_addr[6];
699 __le16 reserved1;
700 u8 bssid_addr[6];
701 __le16 reserved2;
702 u8 wlap_bssid_addr[6];
703 __le16 reserved3;
704 u8 dev_type;
705 u8 air_propagation;
706 __le16 rx_chain;
707 u8 ofdm_basic_rates;
708 u8 cck_basic_rates;
709 __le16 assoc_id;
710 __le32 flags;
711 __le32 filter_flags;
712 __le16 channel;
713 u8 ofdm_ht_single_stream_basic_rates;
714 u8 ofdm_ht_dual_stream_basic_rates;
715 u8 reserved4;
716 u8 reserved5;
717} __packed;
718
719
720/*
721 * C_RXON_ASSOC = 0x11 (command, has simple generic response)
722 */
723struct il3945_rxon_assoc_cmd {
724 __le32 flags;
725 __le32 filter_flags;
726 u8 ofdm_basic_rates;
727 u8 cck_basic_rates;
728 __le16 reserved;
729} __packed;
730
731struct il4965_rxon_assoc_cmd {
732 __le32 flags;
733 __le32 filter_flags;
734 u8 ofdm_basic_rates;
735 u8 cck_basic_rates;
736 u8 ofdm_ht_single_stream_basic_rates;
737 u8 ofdm_ht_dual_stream_basic_rates;
738 __le16 rx_chain_select_flags;
739 __le16 reserved;
740} __packed;
741
742#define IL_CONN_MAX_LISTEN_INTERVAL 10
743#define IL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
744#define IL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
745
746/*
747 * C_RXON_TIMING = 0x14 (command, has simple generic response)
748 */
749struct il_rxon_time_cmd {
750 __le64 timestamp;
751 __le16 beacon_interval;
752 __le16 atim_win;
753 __le32 beacon_init_val;
754 __le16 listen_interval;
755 u8 dtim_period;
756 u8 delta_cp_bss_tbtts;
757} __packed;
758
759/*
760 * C_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
761 */
762struct il3945_channel_switch_cmd {
763 u8 band;
764 u8 expect_beacon;
765 __le16 channel;
766 __le32 rxon_flags;
767 __le32 rxon_filter_flags;
768 __le32 switch_time;
769 struct il3945_power_per_rate power[IL_MAX_RATES];
770} __packed;
771
772struct il4965_channel_switch_cmd {
773 u8 band;
774 u8 expect_beacon;
775 __le16 channel;
776 __le32 rxon_flags;
777 __le32 rxon_filter_flags;
778 __le32 switch_time;
779 struct il4965_tx_power_db tx_power;
780} __packed;
781
782/*
783 * N_CHANNEL_SWITCH = 0x73 (notification only, not a command)
784 */
785struct il_csa_notification {
786 __le16 band;
787 __le16 channel;
788 __le32 status; /* 0 - OK, 1 - fail */
789} __packed;
790
791/******************************************************************************
792 * (2)
793 * Quality-of-Service (QOS) Commands & Responses:
794 *
795 *****************************************************************************/
796
797/**
798 * struct il_ac_qos -- QOS timing params for C_QOS_PARAM
799 * One for each of 4 EDCA access categories in struct il_qosparam_cmd
800 *
801 * @cw_min: Contention win, start value in numbers of slots.
802 * Should be a power-of-2, minus 1. Device's default is 0x0f.
803 * @cw_max: Contention win, max value in numbers of slots.
804 * Should be a power-of-2, minus 1. Device's default is 0x3f.
805 * @aifsn: Number of slots in Arbitration Interframe Space (before
806 * performing random backoff timing prior to Tx). Device default 1.
807 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
808 *
809 * Device will automatically increase contention win by (2*CW) + 1 for each
810 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
811 * value, to cap the CW value.
812 */
813struct il_ac_qos {
814 __le16 cw_min;
815 __le16 cw_max;
816 u8 aifsn;
817 u8 reserved1;
818 __le16 edca_txop;
819} __packed;
820
821/* QoS flags defines */
822#define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
823#define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
824#define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
825
826/* Number of Access Categories (AC) (EDCA), queues 0..3 */
827#define AC_NUM 4
828
829/*
830 * C_QOS_PARAM = 0x13 (command, has simple generic response)
831 *
832 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
833 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
834 */
835struct il_qosparam_cmd {
836 __le32 qos_flags;
837 struct il_ac_qos ac[AC_NUM];
838} __packed;
839
840/******************************************************************************
841 * (3)
842 * Add/Modify Stations Commands & Responses:
843 *
844 *****************************************************************************/
845/*
846 * Multi station support
847 */
848
849/* Special, dedicated locations within device's station table */
850#define IL_AP_ID 0
851#define IL_STA_ID 2
852#define IL3945_BROADCAST_ID 24
853#define IL3945_STATION_COUNT 25
854#define IL4965_BROADCAST_ID 31
855#define IL4965_STATION_COUNT 32
856
857#define IL_STATION_COUNT 32 /* MAX(3945,4965)*/
858#define IL_INVALID_STATION 255
859
860#define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
861#define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
862#define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
863#define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
864#define STA_FLG_MAX_AGG_SIZE_POS (19)
865#define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
866#define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
867#define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
868#define STA_FLG_AGG_MPDU_DENSITY_POS (23)
869#define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
870
871/* Use in mode field. 1: modify existing entry, 0: add new station entry */
872#define STA_CONTROL_MODIFY_MSK 0x01
873
874/* key flags __le16*/
875#define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
876#define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
877#define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
878#define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
879#define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
880
881#define STA_KEY_FLG_KEYID_POS 8
882#define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
883/* wep key is either from global key (0) or from station info array (1) */
884#define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
885
886/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
887#define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
888#define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
889#define STA_KEY_MAX_NUM 8
890
891/* Flags indicate whether to modify vs. don't change various station params */
892#define STA_MODIFY_KEY_MASK 0x01
893#define STA_MODIFY_TID_DISABLE_TX 0x02
894#define STA_MODIFY_TX_RATE_MSK 0x04
895#define STA_MODIFY_ADDBA_TID_MSK 0x08
896#define STA_MODIFY_DELBA_TID_MSK 0x10
897#define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
898
899/* Receiver address (actually, Rx station's idx into station table),
900 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
901#define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
902
903struct il4965_keyinfo {
904 __le16 key_flags;
905 u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */
906 u8 reserved1;
907 __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
908 u8 key_offset;
909 u8 reserved2;
910 u8 key[16]; /* 16-byte unicast decryption key */
911} __packed;
912
913/**
914 * struct sta_id_modify
915 * @addr[ETH_ALEN]: station's MAC address
916 * @sta_id: idx of station in uCode's station table
917 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
918 *
919 * Driver selects unused table idx when adding new station,
920 * or the idx to a pre-existing station entry when modifying that station.
921 * Some idxes have special purposes (IL_AP_ID, idx 0, is for AP).
922 *
923 * modify_mask flags select which parameters to modify vs. leave alone.
924 */
925struct sta_id_modify {
926 u8 addr[ETH_ALEN];
927 __le16 reserved1;
928 u8 sta_id;
929 u8 modify_mask;
930 __le16 reserved2;
931} __packed;
932
933/*
934 * C_ADD_STA = 0x18 (command)
935 *
936 * The device contains an internal table of per-station information,
937 * with info on security keys, aggregation parameters, and Tx rates for
938 * initial Tx attempt and any retries (4965 devices uses
939 * C_TX_LINK_QUALITY_CMD,
940 * 3945 uses C_RATE_SCALE to set up rate tables).
941 *
942 * C_ADD_STA sets up the table entry for one station, either creating
943 * a new entry, or modifying a pre-existing one.
944 *
945 * NOTE: RXON command (without "associated" bit set) wipes the station table
946 * clean. Moving into RF_KILL state does this also. Driver must set up
947 * new station table before transmitting anything on the RXON channel
948 * (except active scans or active measurements; those commands carry
949 * their own txpower/rate setup data).
950 *
951 * When getting started on a new channel, driver must set up the
952 * IL_BROADCAST_ID entry (last entry in the table). For a client
953 * station in a BSS, once an AP is selected, driver sets up the AP STA
954 * in the IL_AP_ID entry (1st entry in the table). BROADCAST and AP
955 * are all that are needed for a BSS client station. If the device is
956 * used as AP, or in an IBSS network, driver must set up station table
957 * entries for all STAs in network, starting with idx IL_STA_ID.
958 */
959
960struct il3945_addsta_cmd {
961 u8 mode; /* 1: modify existing, 0: add new station */
962 u8 reserved[3];
963 struct sta_id_modify sta;
964 struct il4965_keyinfo key;
965 __le32 station_flags; /* STA_FLG_* */
966 __le32 station_flags_msk; /* STA_FLG_* */
967
968 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
969 * corresponding to bit (e.g. bit 5 controls TID 5).
970 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
971 __le16 tid_disable_tx;
972
973 __le16 rate_n_flags;
974
975 /* TID for which to add block-ack support.
976 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
977 u8 add_immediate_ba_tid;
978
979 /* TID for which to remove block-ack support.
980 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
981 u8 remove_immediate_ba_tid;
982
983 /* Starting Sequence Number for added block-ack support.
984 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
985 __le16 add_immediate_ba_ssn;
986} __packed;
987
988struct il4965_addsta_cmd {
989 u8 mode; /* 1: modify existing, 0: add new station */
990 u8 reserved[3];
991 struct sta_id_modify sta;
992 struct il4965_keyinfo key;
993 __le32 station_flags; /* STA_FLG_* */
994 __le32 station_flags_msk; /* STA_FLG_* */
995
996 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
997 * corresponding to bit (e.g. bit 5 controls TID 5).
998 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
999 __le16 tid_disable_tx;
1000
1001 __le16 reserved1;
1002
1003 /* TID for which to add block-ack support.
1004 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1005 u8 add_immediate_ba_tid;
1006
1007 /* TID for which to remove block-ack support.
1008 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1009 u8 remove_immediate_ba_tid;
1010
1011 /* Starting Sequence Number for added block-ack support.
1012 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1013 __le16 add_immediate_ba_ssn;
1014
1015 /*
1016 * Number of packets OK to transmit to station even though
1017 * it is asleep -- used to synchronise PS-poll and u-APSD
1018 * responses while ucode keeps track of STA sleep state.
1019 */
1020 __le16 sleep_tx_count;
1021
1022 __le16 reserved2;
1023} __packed;
1024
1025/* Wrapper struct for 3945 and 4965 addsta_cmd structures */
1026struct il_addsta_cmd {
1027 u8 mode; /* 1: modify existing, 0: add new station */
1028 u8 reserved[3];
1029 struct sta_id_modify sta;
1030 struct il4965_keyinfo key;
1031 __le32 station_flags; /* STA_FLG_* */
1032 __le32 station_flags_msk; /* STA_FLG_* */
1033
1034 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1035 * corresponding to bit (e.g. bit 5 controls TID 5).
1036 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1037 __le16 tid_disable_tx;
1038
1039 __le16 rate_n_flags; /* 3945 only */
1040
1041 /* TID for which to add block-ack support.
1042 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1043 u8 add_immediate_ba_tid;
1044
1045 /* TID for which to remove block-ack support.
1046 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1047 u8 remove_immediate_ba_tid;
1048
1049 /* Starting Sequence Number for added block-ack support.
1050 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1051 __le16 add_immediate_ba_ssn;
1052
1053 /*
1054 * Number of packets OK to transmit to station even though
1055 * it is asleep -- used to synchronise PS-poll and u-APSD
1056 * responses while ucode keeps track of STA sleep state.
1057 */
1058 __le16 sleep_tx_count;
1059
1060 __le16 reserved2;
1061} __packed;
1062
1063
1064#define ADD_STA_SUCCESS_MSK 0x1
1065#define ADD_STA_NO_ROOM_IN_TBL 0x2
1066#define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
1067#define ADD_STA_MODIFY_NON_EXIST_STA 0x8
1068/*
1069 * C_ADD_STA = 0x18 (response)
1070 */
1071struct il_add_sta_resp {
1072 u8 status; /* ADD_STA_* */
1073} __packed;
1074
1075#define REM_STA_SUCCESS_MSK 0x1
1076/*
1077 * C_REM_STA = 0x19 (response)
1078 */
1079struct il_rem_sta_resp {
1080 u8 status;
1081} __packed;
1082
1083/*
1084 * C_REM_STA = 0x19 (command)
1085 */
1086struct il_rem_sta_cmd {
1087 u8 num_sta; /* number of removed stations */
1088 u8 reserved[3];
1089 u8 addr[ETH_ALEN]; /* MAC addr of the first station */
1090 u8 reserved2[2];
1091} __packed;
1092
1093#define IL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1094#define IL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1095#define IL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1096#define IL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1097#define IL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
1098
1099#define IL_DROP_SINGLE 0
1100#define IL_DROP_SELECTED 1
1101#define IL_DROP_ALL 2
1102
1103/*
1104 * REPLY_WEP_KEY = 0x20
1105 */
1106struct il_wep_key {
1107 u8 key_idx;
1108 u8 key_offset;
1109 u8 reserved1[2];
1110 u8 key_size;
1111 u8 reserved2[3];
1112 u8 key[16];
1113} __packed;
1114
1115struct il_wep_cmd {
1116 u8 num_keys;
1117 u8 global_key_type;
1118 u8 flags;
1119 u8 reserved;
1120 struct il_wep_key key[0];
1121} __packed;
1122
1123#define WEP_KEY_WEP_TYPE 1
1124#define WEP_KEYS_MAX 4
1125#define WEP_INVALID_OFFSET 0xff
1126#define WEP_KEY_LEN_64 5
1127#define WEP_KEY_LEN_128 13
1128
1129/******************************************************************************
1130 * (4)
1131 * Rx Responses:
1132 *
1133 *****************************************************************************/
1134
1135#define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
1136#define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
1137
1138#define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
1139#define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1140#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1141#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
1142#define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
1143#define RX_RES_PHY_FLAGS_ANTENNA_POS 4
1144
1145#define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
1146#define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
1147#define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
1148#define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
1149#define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
1150#define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
1151
1152#define RX_RES_STATUS_STATION_FOUND (1<<6)
1153#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
1154
1155#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
1156#define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
1157#define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
1158#define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
1159#define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
1160
1161#define RX_MPDU_RES_STATUS_ICV_OK (0x20)
1162#define RX_MPDU_RES_STATUS_MIC_OK (0x40)
1163#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1164#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1165
1166
1167struct il3945_rx_frame_stats {
1168 u8 phy_count;
1169 u8 id;
1170 u8 rssi;
1171 u8 agc;
1172 __le16 sig_avg;
1173 __le16 noise_diff;
1174 u8 payload[0];
1175} __packed;
1176
1177struct il3945_rx_frame_hdr {
1178 __le16 channel;
1179 __le16 phy_flags;
1180 u8 reserved1;
1181 u8 rate;
1182 __le16 len;
1183 u8 payload[0];
1184} __packed;
1185
1186struct il3945_rx_frame_end {
1187 __le32 status;
1188 __le64 timestamp;
1189 __le32 beacon_timestamp;
1190} __packed;
1191
1192/*
1193 * N_3945_RX = 0x1b (response only, not a command)
1194 *
1195 * NOTE: DO NOT dereference from casts to this structure
1196 * It is provided only for calculating minimum data set size.
1197 * The actual offsets of the hdr and end are dynamic based on
1198 * stats.phy_count
1199 */
1200struct il3945_rx_frame {
1201 struct il3945_rx_frame_stats stats;
1202 struct il3945_rx_frame_hdr hdr;
1203 struct il3945_rx_frame_end end;
1204} __packed;
1205
1206#define IL39_RX_FRAME_SIZE (4 + sizeof(struct il3945_rx_frame))
1207
1208/* Fixed (non-configurable) rx data from phy */
1209
1210#define IL49_RX_RES_PHY_CNT 14
1211#define IL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
1212#define IL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1213#define IL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1214#define IL49_AGC_DB_POS (7)
1215struct il4965_rx_non_cfg_phy {
1216 __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1217 __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1218 u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
1219 u8 pad[0];
1220} __packed;
1221
1222
1223/*
1224 * N_RX = 0xc3 (response only, not a command)
1225 * Used only for legacy (non 11n) frames.
1226 */
1227struct il_rx_phy_res {
1228 u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */
1229 u8 cfg_phy_cnt; /* configurable DSP phy data byte count */
1230 u8 stat_id; /* configurable DSP phy data set ID */
1231 u8 reserved1;
1232 __le64 timestamp; /* TSF at on air rise */
1233 __le32 beacon_time_stamp; /* beacon at on-air rise */
1234 __le16 phy_flags; /* general phy flags: band, modulation, ... */
1235 __le16 channel; /* channel number */
1236 u8 non_cfg_phy_buf[32]; /* for various implementations of non_cfg_phy */
1237 __le32 rate_n_flags; /* RATE_MCS_* */
1238 __le16 byte_count; /* frame's byte-count */
1239 __le16 frame_time; /* frame's time on the air */
1240} __packed;
1241
1242struct il_rx_mpdu_res_start {
1243 __le16 byte_count;
1244 __le16 reserved;
1245} __packed;
1246
1247
1248/******************************************************************************
1249 * (5)
1250 * Tx Commands & Responses:
1251 *
1252 * Driver must place each C_TX command into one of the prioritized Tx
1253 * queues in host DRAM, shared between driver and device (see comments for
1254 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
1255 * are preparing to transmit, the device pulls the Tx command over the PCI
1256 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1257 * from which data will be transmitted.
1258 *
1259 * uCode handles all timing and protocol related to control frames
1260 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
1261 * handle reception of block-acks; uCode updates the host driver via
1262 * N_COMPRESSED_BA.
1263 *
1264 * uCode handles retrying Tx when an ACK is expected but not received.
1265 * This includes trying lower data rates than the one requested in the Tx
1266 * command, as set up by the C_RATE_SCALE (for 3945) or
1267 * C_TX_LINK_QUALITY_CMD (4965).
1268 *
1269 * Driver sets up transmit power for various rates via C_TX_PWR_TBL.
1270 * This command must be executed after every RXON command, before Tx can occur.
1271 *****************************************************************************/
1272
1273/* C_TX Tx flags field */
1274
1275/*
1276 * 1: Use Request-To-Send protocol before this frame.
1277 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
1278 */
1279#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
1280
1281/*
1282 * 1: Transmit Clear-To-Send to self before this frame.
1283 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
1284 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
1285 */
1286#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
1287
1288/* 1: Expect ACK from receiving station
1289 * 0: Don't expect ACK (MAC header's duration field s/b 0)
1290 * Set this for unicast frames, but not broadcast/multicast. */
1291#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
1292
1293/* For 4965 devices:
1294 * 1: Use rate scale table (see C_TX_LINK_QUALITY_CMD).
1295 * Tx command's initial_rate_idx indicates first rate to try;
1296 * uCode walks through table for additional Tx attempts.
1297 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1298 * This rate will be used for all Tx attempts; it will not be scaled. */
1299#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
1300
1301/* 1: Expect immediate block-ack.
1302 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
1303#define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
1304
1305/*
1306 * 1: Frame requires full Tx-Op protection.
1307 * Set this if either RTS or CTS Tx Flag gets set.
1308 */
1309#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
1310
1311/* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices.
1312 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
1313#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
1314#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
1315#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
1316
1317/* 1: uCode overrides sequence control field in MAC header.
1318 * 0: Driver provides sequence control field in MAC header.
1319 * Set this for management frames, non-QOS data frames, non-unicast frames,
1320 * and also in Tx command embedded in C_SCAN for active scans. */
1321#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
1322
1323/* 1: This frame is non-last MPDU; more fragments are coming.
1324 * 0: Last fragment, or not using fragmentation. */
1325#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
1326
1327/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1328 * 0: No TSF required in outgoing frame.
1329 * Set this for transmitting beacons and probe responses. */
1330#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
1331
1332/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1333 * alignment of frame's payload data field.
1334 * 0: No pad
1335 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1336 * field (but not both). Driver must align frame data (i.e. data following
1337 * MAC header) to DWORD boundary. */
1338#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
1339
1340/* accelerate aggregation support
1341 * 0 - no CCMP encryption; 1 - CCMP encryption */
1342#define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
1343
1344/* HCCA-AP - disable duration overwriting. */
1345#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
1346
1347
1348/*
1349 * TX command security control
1350 */
1351#define TX_CMD_SEC_WEP 0x01
1352#define TX_CMD_SEC_CCM 0x02
1353#define TX_CMD_SEC_TKIP 0x03
1354#define TX_CMD_SEC_MSK 0x03
1355#define TX_CMD_SEC_SHIFT 6
1356#define TX_CMD_SEC_KEY128 0x08
1357
1358/*
1359 * security overhead sizes
1360 */
1361#define WEP_IV_LEN 4
1362#define WEP_ICV_LEN 4
1363#define CCMP_MIC_LEN 8
1364#define TKIP_ICV_LEN 4
1365
1366/*
1367 * C_TX = 0x1c (command)
1368 */
1369
1370struct il3945_tx_cmd {
1371 /*
1372 * MPDU byte count:
1373 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1374 * + 8 byte IV for CCM or TKIP (not used for WEP)
1375 * + Data payload
1376 * + 8-byte MIC (not used for CCM/WEP)
1377 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1378 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1379 * Range: 14-2342 bytes.
1380 */
1381 __le16 len;
1382
1383 /*
1384 * MPDU or MSDU byte count for next frame.
1385 * Used for fragmentation and bursting, but not 11n aggregation.
1386 * Same as "len", but for next frame. Set to 0 if not applicable.
1387 */
1388 __le16 next_frame_len;
1389
1390 __le32 tx_flags; /* TX_CMD_FLG_* */
1391
1392 u8 rate;
1393
1394 /* Index of recipient station in uCode's station table */
1395 u8 sta_id;
1396 u8 tid_tspec;
1397 u8 sec_ctl;
1398 u8 key[16];
1399 union {
1400 u8 byte[8];
1401 __le16 word[4];
1402 __le32 dw[2];
1403 } tkip_mic;
1404 __le32 next_frame_info;
1405 union {
1406 __le32 life_time;
1407 __le32 attempt;
1408 } stop_time;
1409 u8 supp_rates[2];
1410 u8 rts_retry_limit; /*byte 50 */
1411 u8 data_retry_limit; /*byte 51 */
1412 union {
1413 __le16 pm_frame_timeout;
1414 __le16 attempt_duration;
1415 } timeout;
1416
1417 /*
1418 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1419 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1420 */
1421 __le16 driver_txop;
1422
1423 /*
1424 * MAC header goes here, followed by 2 bytes padding if MAC header
1425 * length is 26 or 30 bytes, followed by payload data
1426 */
1427 u8 payload[0];
1428 struct ieee80211_hdr hdr[0];
1429} __packed;
1430
1431/*
1432 * C_TX = 0x1c (response)
1433 */
1434struct il3945_tx_resp {
1435 u8 failure_rts;
1436 u8 failure_frame;
1437 u8 bt_kill_count;
1438 u8 rate;
1439 __le32 wireless_media_time;
1440 __le32 status; /* TX status */
1441} __packed;
1442
1443
1444/*
1445 * 4965 uCode updates these Tx attempt count values in host DRAM.
1446 * Used for managing Tx retries when expecting block-acks.
1447 * Driver should set these fields to 0.
1448 */
1449struct il_dram_scratch {
1450 u8 try_cnt; /* Tx attempts */
1451 u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */
1452 __le16 reserved;
1453} __packed;
1454
1455struct il_tx_cmd {
1456 /*
1457 * MPDU byte count:
1458 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1459 * + 8 byte IV for CCM or TKIP (not used for WEP)
1460 * + Data payload
1461 * + 8-byte MIC (not used for CCM/WEP)
1462 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1463 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1464 * Range: 14-2342 bytes.
1465 */
1466 __le16 len;
1467
1468 /*
1469 * MPDU or MSDU byte count for next frame.
1470 * Used for fragmentation and bursting, but not 11n aggregation.
1471 * Same as "len", but for next frame. Set to 0 if not applicable.
1472 */
1473 __le16 next_frame_len;
1474
1475 __le32 tx_flags; /* TX_CMD_FLG_* */
1476
1477 /* uCode may modify this field of the Tx command (in host DRAM!).
1478 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
1479 struct il_dram_scratch scratch;
1480
1481 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1482 __le32 rate_n_flags; /* RATE_MCS_* */
1483
1484 /* Index of destination station in uCode's station table */
1485 u8 sta_id;
1486
1487 /* Type of security encryption: CCM or TKIP */
1488 u8 sec_ctl; /* TX_CMD_SEC_* */
1489
1490 /*
1491 * Index into rate table (see C_TX_LINK_QUALITY_CMD) for initial
1492 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1493 * data frames, this field may be used to selectively reduce initial
1494 * rate (via non-0 value) for special frames (e.g. management), while
1495 * still supporting rate scaling for all frames.
1496 */
1497 u8 initial_rate_idx;
1498 u8 reserved;
1499 u8 key[16];
1500 __le16 next_frame_flags;
1501 __le16 reserved2;
1502 union {
1503 __le32 life_time;
1504 __le32 attempt;
1505 } stop_time;
1506
1507 /* Host DRAM physical address pointer to "scratch" in this command.
1508 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
1509 __le32 dram_lsb_ptr;
1510 u8 dram_msb_ptr;
1511
1512 u8 rts_retry_limit; /*byte 50 */
1513 u8 data_retry_limit; /*byte 51 */
1514 u8 tid_tspec;
1515 union {
1516 __le16 pm_frame_timeout;
1517 __le16 attempt_duration;
1518 } timeout;
1519
1520 /*
1521 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1522 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1523 */
1524 __le16 driver_txop;
1525
1526 /*
1527 * MAC header goes here, followed by 2 bytes padding if MAC header
1528 * length is 26 or 30 bytes, followed by payload data
1529 */
1530 u8 payload[0];
1531 struct ieee80211_hdr hdr[0];
1532} __packed;
1533
1534/* TX command response is sent after *3945* transmission attempts.
1535 *
1536 * NOTES:
1537 *
1538 * TX_STATUS_FAIL_NEXT_FRAG
1539 *
1540 * If the fragment flag in the MAC header for the frame being transmitted
1541 * is set and there is insufficient time to transmit the next frame, the
1542 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1543 *
1544 * TX_STATUS_FIFO_UNDERRUN
1545 *
1546 * Indicates the host did not provide bytes to the FIFO fast enough while
1547 * a TX was in progress.
1548 *
1549 * TX_STATUS_FAIL_MGMNT_ABORT
1550 *
1551 * This status is only possible if the ABORT ON MGMT RX parameter was
1552 * set to true with the TX command.
1553 *
1554 * If the MSB of the status parameter is set then an abort sequence is
1555 * required. This sequence consists of the host activating the TX Abort
1556 * control line, and then waiting for the TX Abort command response. This
1557 * indicates that a the device is no longer in a transmit state, and that the
1558 * command FIFO has been cleared. The host must then deactivate the TX Abort
1559 * control line. Receiving is still allowed in this case.
1560 */
1561enum {
1562 TX_3945_STATUS_SUCCESS = 0x01,
1563 TX_3945_STATUS_DIRECT_DONE = 0x02,
1564 TX_3945_STATUS_FAIL_SHORT_LIMIT = 0x82,
1565 TX_3945_STATUS_FAIL_LONG_LIMIT = 0x83,
1566 TX_3945_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1567 TX_3945_STATUS_FAIL_MGMNT_ABORT = 0x85,
1568 TX_3945_STATUS_FAIL_NEXT_FRAG = 0x86,
1569 TX_3945_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1570 TX_3945_STATUS_FAIL_DEST_PS = 0x88,
1571 TX_3945_STATUS_FAIL_ABORTED = 0x89,
1572 TX_3945_STATUS_FAIL_BT_RETRY = 0x8a,
1573 TX_3945_STATUS_FAIL_STA_INVALID = 0x8b,
1574 TX_3945_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1575 TX_3945_STATUS_FAIL_TID_DISABLE = 0x8d,
1576 TX_3945_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
1577 TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1578 TX_3945_STATUS_FAIL_TX_LOCKED = 0x90,
1579 TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1580};
1581
1582/*
1583 * TX command response is sent after *4965* transmission attempts.
1584 *
1585 * both postpone and abort status are expected behavior from uCode. there is
1586 * no special operation required from driver; except for RFKILL_FLUSH,
1587 * which required tx flush host command to flush all the tx frames in queues
1588 */
1589enum {
1590 TX_STATUS_SUCCESS = 0x01,
1591 TX_STATUS_DIRECT_DONE = 0x02,
1592 /* postpone TX */
1593 TX_STATUS_POSTPONE_DELAY = 0x40,
1594 TX_STATUS_POSTPONE_FEW_BYTES = 0x41,
1595 TX_STATUS_POSTPONE_QUIET_PERIOD = 0x43,
1596 TX_STATUS_POSTPONE_CALC_TTAK = 0x44,
1597 /* abort TX */
1598 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY = 0x81,
1599 TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
1600 TX_STATUS_FAIL_LONG_LIMIT = 0x83,
1601 TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
1602 TX_STATUS_FAIL_DRAIN_FLOW = 0x85,
1603 TX_STATUS_FAIL_RFKILL_FLUSH = 0x86,
1604 TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
1605 TX_STATUS_FAIL_DEST_PS = 0x88,
1606 TX_STATUS_FAIL_HOST_ABORTED = 0x89,
1607 TX_STATUS_FAIL_BT_RETRY = 0x8a,
1608 TX_STATUS_FAIL_STA_INVALID = 0x8b,
1609 TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
1610 TX_STATUS_FAIL_TID_DISABLE = 0x8d,
1611 TX_STATUS_FAIL_FIFO_FLUSHED = 0x8e,
1612 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
1613 TX_STATUS_FAIL_PASSIVE_NO_RX = 0x90,
1614 TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
1615};
1616
1617#define TX_PACKET_MODE_REGULAR 0x0000
1618#define TX_PACKET_MODE_BURST_SEQ 0x0100
1619#define TX_PACKET_MODE_BURST_FIRST 0x0200
1620
1621enum {
1622 TX_POWER_PA_NOT_ACTIVE = 0x0,
1623};
1624
1625enum {
1626 TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */
1627 TX_STATUS_DELAY_MSK = 0x00000040,
1628 TX_STATUS_ABORT_MSK = 0x00000080,
1629 TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */
1630 TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */
1631 TX_RESERVED = 0x00780000, /* bits 19:22 */
1632 TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */
1633 TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */
1634};
1635
1636/* *******************************
1637 * TX aggregation status
1638 ******************************* */
1639
1640enum {
1641 AGG_TX_STATE_TRANSMITTED = 0x00,
1642 AGG_TX_STATE_UNDERRUN_MSK = 0x01,
1643 AGG_TX_STATE_FEW_BYTES_MSK = 0x04,
1644 AGG_TX_STATE_ABORT_MSK = 0x08,
1645 AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10,
1646 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20,
1647 AGG_TX_STATE_SCD_QUERY_MSK = 0x80,
1648 AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100,
1649 AGG_TX_STATE_RESPONSE_MSK = 0x1ff,
1650 AGG_TX_STATE_DUMP_TX_MSK = 0x200,
1651 AGG_TX_STATE_DELAY_TX_MSK = 0x400
1652};
1653
1654#define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */
1655#define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */
1656
1657#define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
1658 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK)
1659
1660/* # tx attempts for first frame in aggregation */
1661#define AGG_TX_STATE_TRY_CNT_POS 12
1662#define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1663
1664/* Command ID and sequence number of Tx command for this frame */
1665#define AGG_TX_STATE_SEQ_NUM_POS 16
1666#define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1667
1668/*
1669 * C_TX = 0x1c (response)
1670 *
1671 * This response may be in one of two slightly different formats, indicated
1672 * by the frame_count field:
1673 *
1674 * 1) No aggregation (frame_count == 1). This reports Tx results for
1675 * a single frame. Multiple attempts, at various bit rates, may have
1676 * been made for this frame.
1677 *
1678 * 2) Aggregation (frame_count > 1). This reports Tx results for
1679 * 2 or more frames that used block-acknowledge. All frames were
1680 * transmitted at same rate. Rate scaling may have been used if first
1681 * frame in this new agg block failed in previous agg block(s).
1682 *
1683 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
1684 * block-ack has not been received by the time the 4965 device records
1685 * this status.
1686 * This status relates to reasons the tx might have been blocked or aborted
1687 * within the sending station (this 4965 device), rather than whether it was
1688 * received successfully by the destination station.
1689 */
1690struct agg_tx_status {
1691 __le16 status;
1692 __le16 sequence;
1693} __packed;
1694
1695struct il4965_tx_resp {
1696 u8 frame_count; /* 1 no aggregation, >1 aggregation */
1697 u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */
1698 u8 failure_rts; /* # failures due to unsuccessful RTS */
1699 u8 failure_frame; /* # failures due to no ACK (unused for agg) */
1700
1701 /* For non-agg: Rate at which frame was successful.
1702 * For agg: Rate at which all frames were transmitted. */
1703 __le32 rate_n_flags; /* RATE_MCS_* */
1704
1705 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1706 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1707 __le16 wireless_media_time; /* uSecs */
1708
1709 __le16 reserved;
1710 __le32 pa_power1; /* RF power amplifier measurement (not used) */
1711 __le32 pa_power2;
1712
1713 /*
1714 * For non-agg: frame status TX_STATUS_*
1715 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1716 * fields follow this one, up to frame_count.
1717 * Bit fields:
1718 * 11- 0: AGG_TX_STATE_* status code
1719 * 15-12: Retry count for 1st frame in aggregation (retries
1720 * occur if tx failed for this frame when it was a
1721 * member of a previous aggregation block). If rate
1722 * scaling is used, retry count indicates the rate
1723 * table entry used for all frames in the new agg.
1724 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1725 */
1726 union {
1727 __le32 status;
1728 struct agg_tx_status agg_status[0]; /* for each agg frame */
1729 } u;
1730} __packed;
1731
1732/*
1733 * N_COMPRESSED_BA = 0xc5 (response only, not a command)
1734 *
1735 * Reports Block-Acknowledge from recipient station
1736 */
1737struct il_compressed_ba_resp {
1738 __le32 sta_addr_lo32;
1739 __le16 sta_addr_hi16;
1740 __le16 reserved;
1741
1742 /* Index of recipient (BA-sending) station in uCode's station table */
1743 u8 sta_id;
1744 u8 tid;
1745 __le16 seq_ctl;
1746 __le64 bitmap;
1747 __le16 scd_flow;
1748 __le16 scd_ssn;
1749} __packed;
1750
1751/*
1752 * C_TX_PWR_TBL = 0x97 (command, has simple generic response)
1753 *
1754 * See details under "TXPOWER" in 4965.h.
1755 */
1756
1757struct il3945_txpowertable_cmd {
1758 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1759 u8 reserved;
1760 __le16 channel;
1761 struct il3945_power_per_rate power[IL_MAX_RATES];
1762} __packed;
1763
1764struct il4965_txpowertable_cmd {
1765 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1766 u8 reserved;
1767 __le16 channel;
1768 struct il4965_tx_power_db tx_power;
1769} __packed;
1770
1771
1772/**
1773 * struct il3945_rate_scaling_cmd - Rate Scaling Command & Response
1774 *
1775 * C_RATE_SCALE = 0x47 (command, has simple generic response)
1776 *
1777 * NOTE: The table of rates passed to the uCode via the
1778 * RATE_SCALE command sets up the corresponding order of
1779 * rates used for all related commands, including rate
1780 * masks, etc.
1781 *
1782 * For example, if you set 9MB (PLCP 0x0f) as the first
1783 * rate in the rate table, the bit mask for that rate
1784 * when passed through ofdm_basic_rates on the C_RXON
1785 * command would be bit 0 (1 << 0)
1786 */
1787struct il3945_rate_scaling_info {
1788 __le16 rate_n_flags;
1789 u8 try_cnt;
1790 u8 next_rate_idx;
1791} __packed;
1792
1793struct il3945_rate_scaling_cmd {
1794 u8 table_id;
1795 u8 reserved[3];
1796 struct il3945_rate_scaling_info table[IL_MAX_RATES];
1797} __packed;
1798
1799
1800/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
1801#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
1802
1803/* # of EDCA prioritized tx fifos */
1804#define LINK_QUAL_AC_NUM AC_NUM
1805
1806/* # entries in rate scale table to support Tx retries */
1807#define LINK_QUAL_MAX_RETRY_NUM 16
1808
1809/* Tx antenna selection values */
1810#define LINK_QUAL_ANT_A_MSK (1 << 0)
1811#define LINK_QUAL_ANT_B_MSK (1 << 1)
1812#define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
1813
1814
1815/**
1816 * struct il_link_qual_general_params
1817 *
1818 * Used in C_TX_LINK_QUALITY_CMD
1819 */
1820struct il_link_qual_general_params {
1821 u8 flags;
1822
1823 /* No entries at or above this (driver chosen) idx contain MIMO */
1824 u8 mimo_delimiter;
1825
1826 /* Best single antenna to use for single stream (legacy, SISO). */
1827 u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */
1828
1829 /* Best antennas to use for MIMO (unused for 4965, assumes both). */
1830 u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */
1831
1832 /*
1833 * If driver needs to use different initial rates for different
1834 * EDCA QOS access categories (as implemented by tx fifos 0-3),
1835 * this table will set that up, by indicating the idxes in the
1836 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
1837 * Otherwise, driver should set all entries to 0.
1838 *
1839 * Entry usage:
1840 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
1841 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
1842 */
1843 u8 start_rate_idx[LINK_QUAL_AC_NUM];
1844} __packed;
1845
1846#define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
1847#define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
1848#define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
1849
1850#define LINK_QUAL_AGG_DISABLE_START_DEF (3)
1851#define LINK_QUAL_AGG_DISABLE_START_MAX (255)
1852#define LINK_QUAL_AGG_DISABLE_START_MIN (0)
1853
1854#define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
1855#define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
1856#define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
1857
1858/**
1859 * struct il_link_qual_agg_params
1860 *
1861 * Used in C_TX_LINK_QUALITY_CMD
1862 */
1863struct il_link_qual_agg_params {
1864
1865 /*
1866 *Maximum number of uSec in aggregation.
1867 * default set to 4000 (4 milliseconds) if not configured in .cfg
1868 */
1869 __le16 agg_time_limit;
1870
1871 /*
1872 * Number of Tx retries allowed for a frame, before that frame will
1873 * no longer be considered for the start of an aggregation sequence
1874 * (scheduler will then try to tx it as single frame).
1875 * Driver should set this to 3.
1876 */
1877 u8 agg_dis_start_th;
1878
1879 /*
1880 * Maximum number of frames in aggregation.
1881 * 0 = no limit (default). 1 = no aggregation.
1882 * Other values = max # frames in aggregation.
1883 */
1884 u8 agg_frame_cnt_limit;
1885
1886 __le32 reserved;
1887} __packed;
1888
1889/*
1890 * C_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
1891 *
1892 * For 4965 devices only; 3945 uses C_RATE_SCALE.
1893 *
1894 * Each station in the 4965 device's internal station table has its own table
1895 * of 16
1896 * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
1897 * an ACK is not received. This command replaces the entire table for
1898 * one station.
1899 *
1900 * NOTE: Station must already be in 4965 device's station table.
1901 * Use C_ADD_STA.
1902 *
1903 * The rate scaling procedures described below work well. Of course, other
1904 * procedures are possible, and may work better for particular environments.
1905 *
1906 *
1907 * FILLING THE RATE TBL
1908 *
1909 * Given a particular initial rate and mode, as determined by the rate
1910 * scaling algorithm described below, the Linux driver uses the following
1911 * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
1912 * Link Quality command:
1913 *
1914 *
1915 * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
1916 * a) Use this same initial rate for first 3 entries.
1917 * b) Find next lower available rate using same mode (SISO or MIMO),
1918 * use for next 3 entries. If no lower rate available, switch to
1919 * legacy mode (no HT40 channel, no MIMO, no short guard interval).
1920 * c) If using MIMO, set command's mimo_delimiter to number of entries
1921 * using MIMO (3 or 6).
1922 * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
1923 * no MIMO, no short guard interval), at the next lower bit rate
1924 * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
1925 * legacy procedure for remaining table entries.
1926 *
1927 * 2) If using legacy initial rate:
1928 * a) Use the initial rate for only one entry.
1929 * b) For each following entry, reduce the rate to next lower available
1930 * rate, until reaching the lowest available rate.
1931 * c) When reducing rate, also switch antenna selection.
1932 * d) Once lowest available rate is reached, repeat this rate until
1933 * rate table is filled (16 entries), switching antenna each entry.
1934 *
1935 *
1936 * ACCUMULATING HISTORY
1937 *
1938 * The rate scaling algorithm for 4965 devices, as implemented in Linux driver,
1939 * uses two sets of frame Tx success history: One for the current/active
1940 * modulation mode, and one for a speculative/search mode that is being
1941 * attempted. If the speculative mode turns out to be more effective (i.e.
1942 * actual transfer rate is better), then the driver continues to use the
1943 * speculative mode as the new current active mode.
1944 *
1945 * Each history set contains, separately for each possible rate, data for a
1946 * sliding win of the 62 most recent tx attempts at that rate. The data
1947 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
1948 * and attempted frames, from which the driver can additionally calculate a
1949 * success ratio (success / attempted) and number of failures
1950 * (attempted - success), and control the size of the win (attempted).
1951 * The driver uses the bit map to remove successes from the success sum, as
1952 * the oldest tx attempts fall out of the win.
1953 *
1954 * When the 4965 device makes multiple tx attempts for a given frame, each
1955 * attempt might be at a different rate, and have different modulation
1956 * characteristics (e.g. antenna, fat channel, short guard interval), as set
1957 * up in the rate scaling table in the Link Quality command. The driver must
1958 * determine which rate table entry was used for each tx attempt, to determine
1959 * which rate-specific history to update, and record only those attempts that
1960 * match the modulation characteristics of the history set.
1961 *
1962 * When using block-ack (aggregation), all frames are transmitted at the same
1963 * rate, since there is no per-attempt acknowledgment from the destination
1964 * station. The Tx response struct il_tx_resp indicates the Tx rate in
1965 * rate_n_flags field. After receiving a block-ack, the driver can update
1966 * history for the entire block all at once.
1967 *
1968 *
1969 * FINDING BEST STARTING RATE:
1970 *
1971 * When working with a selected initial modulation mode (see below), the
1972 * driver attempts to find a best initial rate. The initial rate is the
1973 * first entry in the Link Quality command's rate table.
1974 *
1975 * 1) Calculate actual throughput (success ratio * expected throughput, see
1976 * table below) for current initial rate. Do this only if enough frames
1977 * have been attempted to make the value meaningful: at least 6 failed
1978 * tx attempts, or at least 8 successes. If not enough, don't try rate
1979 * scaling yet.
1980 *
1981 * 2) Find available rates adjacent to current initial rate. Available means:
1982 * a) supported by hardware &&
1983 * b) supported by association &&
1984 * c) within any constraints selected by user
1985 *
1986 * 3) Gather measured throughputs for adjacent rates. These might not have
1987 * enough history to calculate a throughput. That's okay, we might try
1988 * using one of them anyway!
1989 *
1990 * 4) Try decreasing rate if, for current rate:
1991 * a) success ratio is < 15% ||
1992 * b) lower adjacent rate has better measured throughput ||
1993 * c) higher adjacent rate has worse throughput, and lower is unmeasured
1994 *
1995 * As a sanity check, if decrease was determined above, leave rate
1996 * unchanged if:
1997 * a) lower rate unavailable
1998 * b) success ratio at current rate > 85% (very good)
1999 * c) current measured throughput is better than expected throughput
2000 * of lower rate (under perfect 100% tx conditions, see table below)
2001 *
2002 * 5) Try increasing rate if, for current rate:
2003 * a) success ratio is < 15% ||
2004 * b) both adjacent rates' throughputs are unmeasured (try it!) ||
2005 * b) higher adjacent rate has better measured throughput ||
2006 * c) lower adjacent rate has worse throughput, and higher is unmeasured
2007 *
2008 * As a sanity check, if increase was determined above, leave rate
2009 * unchanged if:
2010 * a) success ratio at current rate < 70%. This is not particularly
2011 * good performance; higher rate is sure to have poorer success.
2012 *
2013 * 6) Re-evaluate the rate after each tx frame. If working with block-
2014 * acknowledge, history and stats may be calculated for the entire
2015 * block (including prior history that fits within the history wins),
2016 * before re-evaluation.
2017 *
2018 * FINDING BEST STARTING MODULATION MODE:
2019 *
2020 * After working with a modulation mode for a "while" (and doing rate scaling),
2021 * the driver searches for a new initial mode in an attempt to improve
2022 * throughput. The "while" is measured by numbers of attempted frames:
2023 *
2024 * For legacy mode, search for new mode after:
2025 * 480 successful frames, or 160 failed frames
2026 * For high-throughput modes (SISO or MIMO), search for new mode after:
2027 * 4500 successful frames, or 400 failed frames
2028 *
2029 * Mode switch possibilities are (3 for each mode):
2030 *
2031 * For legacy:
2032 * Change antenna, try SISO (if HT association), try MIMO (if HT association)
2033 * For SISO:
2034 * Change antenna, try MIMO, try shortened guard interval (SGI)
2035 * For MIMO:
2036 * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
2037 *
2038 * When trying a new mode, use the same bit rate as the old/current mode when
2039 * trying antenna switches and shortened guard interval. When switching to
2040 * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
2041 * for which the expected throughput (under perfect conditions) is about the
2042 * same or slightly better than the actual measured throughput delivered by
2043 * the old/current mode.
2044 *
2045 * Actual throughput can be estimated by multiplying the expected throughput
2046 * by the success ratio (successful / attempted tx frames). Frame size is
2047 * not considered in this calculation; it assumes that frame size will average
2048 * out to be fairly consistent over several samples. The following are
2049 * metric values for expected throughput assuming 100% success ratio.
2050 * Only G band has support for CCK rates:
2051 *
2052 * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
2053 *
2054 * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
2055 * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
2056 * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
2057 * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
2058 * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
2059 * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
2060 * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
2061 * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
2062 * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
2063 * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
2064 *
2065 * After the new mode has been tried for a short while (minimum of 6 failed
2066 * frames or 8 successful frames), compare success ratio and actual throughput
2067 * estimate of the new mode with the old. If either is better with the new
2068 * mode, continue to use the new mode.
2069 *
2070 * Continue comparing modes until all 3 possibilities have been tried.
2071 * If moving from legacy to HT, try all 3 possibilities from the new HT
2072 * mode. After trying all 3, a best mode is found. Continue to use this mode
2073 * for the longer "while" described above (e.g. 480 successful frames for
2074 * legacy), and then repeat the search process.
2075 *
2076 */
2077struct il_link_quality_cmd {
2078
2079 /* Index of destination/recipient station in uCode's station table */
2080 u8 sta_id;
2081 u8 reserved1;
2082 __le16 control; /* not used */
2083 struct il_link_qual_general_params general_params;
2084 struct il_link_qual_agg_params agg_params;
2085
2086 /*
2087 * Rate info; when using rate-scaling, Tx command's initial_rate_idx
2088 * specifies 1st Tx rate attempted, via idx into this table.
2089 * 4965 devices works its way through table when retrying Tx.
2090 */
2091 struct {
2092 __le32 rate_n_flags; /* RATE_MCS_*, RATE_* */
2093 } rs_table[LINK_QUAL_MAX_RETRY_NUM];
2094 __le32 reserved2;
2095} __packed;
2096
2097/*
2098 * BT configuration enable flags:
2099 * bit 0 - 1: BT channel announcement enabled
2100 * 0: disable
2101 * bit 1 - 1: priority of BT device enabled
2102 * 0: disable
2103 */
2104#define BT_COEX_DISABLE (0x0)
2105#define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2106#define BT_ENABLE_PRIORITY BIT(1)
2107
2108#define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
2109
2110#define BT_LEAD_TIME_DEF (0x1E)
2111
2112#define BT_MAX_KILL_DEF (0x5)
2113
2114/*
2115 * C_BT_CONFIG = 0x9b (command, has simple generic response)
2116 *
2117 * 3945 and 4965 devices support hardware handshake with Bluetooth device on
2118 * same platform. Bluetooth device alerts wireless device when it will Tx;
2119 * wireless device can delay or kill its own Tx to accommodate.
2120 */
2121struct il_bt_cmd {
2122 u8 flags;
2123 u8 lead_time;
2124 u8 max_kill;
2125 u8 reserved;
2126 __le32 kill_ack_mask;
2127 __le32 kill_cts_mask;
2128} __packed;
2129
2130
2131/******************************************************************************
2132 * (6)
2133 * Spectrum Management (802.11h) Commands, Responses, Notifications:
2134 *
2135 *****************************************************************************/
2136
2137/*
2138 * Spectrum Management
2139 */
2140#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
2141 RXON_FILTER_CTL2HOST_MSK | \
2142 RXON_FILTER_ACCEPT_GRP_MSK | \
2143 RXON_FILTER_DIS_DECRYPT_MSK | \
2144 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2145 RXON_FILTER_ASSOC_MSK | \
2146 RXON_FILTER_BCON_AWARE_MSK)
2147
2148struct il_measure_channel {
2149 __le32 duration; /* measurement duration in extended beacon
2150 * format */
2151 u8 channel; /* channel to measure */
2152 u8 type; /* see enum il_measure_type */
2153 __le16 reserved;
2154} __packed;
2155
2156/*
2157 * C_SPECTRUM_MEASUREMENT = 0x74 (command)
2158 */
2159struct il_spectrum_cmd {
2160 __le16 len; /* number of bytes starting from token */
2161 u8 token; /* token id */
2162 u8 id; /* measurement id -- 0 or 1 */
2163 u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */
2164 u8 periodic; /* 1 = periodic */
2165 __le16 path_loss_timeout;
2166 __le32 start_time; /* start time in extended beacon format */
2167 __le32 reserved2;
2168 __le32 flags; /* rxon flags */
2169 __le32 filter_flags; /* rxon filter flags */
2170 __le16 channel_count; /* minimum 1, maximum 10 */
2171 __le16 reserved3;
2172 struct il_measure_channel channels[10];
2173} __packed;
2174
2175/*
2176 * C_SPECTRUM_MEASUREMENT = 0x74 (response)
2177 */
2178struct il_spectrum_resp {
2179 u8 token;
2180 u8 id; /* id of the prior command replaced, or 0xff */
2181 __le16 status; /* 0 - command will be handled
2182 * 1 - cannot handle (conflicts with another
2183 * measurement) */
2184} __packed;
2185
2186enum il_measurement_state {
2187 IL_MEASUREMENT_START = 0,
2188 IL_MEASUREMENT_STOP = 1,
2189};
2190
2191enum il_measurement_status {
2192 IL_MEASUREMENT_OK = 0,
2193 IL_MEASUREMENT_CONCURRENT = 1,
2194 IL_MEASUREMENT_CSA_CONFLICT = 2,
2195 IL_MEASUREMENT_TGH_CONFLICT = 3,
2196 /* 4-5 reserved */
2197 IL_MEASUREMENT_STOPPED = 6,
2198 IL_MEASUREMENT_TIMEOUT = 7,
2199 IL_MEASUREMENT_PERIODIC_FAILED = 8,
2200};
2201
2202#define NUM_ELEMENTS_IN_HISTOGRAM 8
2203
2204struct il_measurement_histogram {
2205 __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
2206 __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */
2207} __packed;
2208
2209/* clear channel availability counters */
2210struct il_measurement_cca_counters {
2211 __le32 ofdm;
2212 __le32 cck;
2213} __packed;
2214
2215enum il_measure_type {
2216 IL_MEASURE_BASIC = (1 << 0),
2217 IL_MEASURE_CHANNEL_LOAD = (1 << 1),
2218 IL_MEASURE_HISTOGRAM_RPI = (1 << 2),
2219 IL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
2220 IL_MEASURE_FRAME = (1 << 4),
2221 /* bits 5:6 are reserved */
2222 IL_MEASURE_IDLE = (1 << 7),
2223};
2224
2225/*
2226 * N_SPECTRUM_MEASUREMENT = 0x75 (notification only, not a command)
2227 */
2228struct il_spectrum_notification {
2229 u8 id; /* measurement id -- 0 or 1 */
2230 u8 token;
2231 u8 channel_idx; /* idx in measurement channel list */
2232 u8 state; /* 0 - start, 1 - stop */
2233 __le32 start_time; /* lower 32-bits of TSF */
2234 u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */
2235 u8 channel;
2236 u8 type; /* see enum il_measurement_type */
2237 u8 reserved1;
2238 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2239 * valid if applicable for measurement type requested. */
2240 __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */
2241 __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */
2242 __le32 cca_time; /* channel load time in usecs */
2243 u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 -
2244 * unidentified */
2245 u8 reserved2[3];
2246 struct il_measurement_histogram histogram;
2247 __le32 stop_time; /* lower 32-bits of TSF */
2248 __le32 status; /* see il_measurement_status */
2249} __packed;
2250
2251/******************************************************************************
2252 * (7)
2253 * Power Management Commands, Responses, Notifications:
2254 *
2255 *****************************************************************************/
2256
2257/**
2258 * struct il_powertable_cmd - Power Table Command
2259 * @flags: See below:
2260 *
2261 * C_POWER_TBL = 0x77 (command, has simple generic response)
2262 *
2263 * PM allow:
2264 * bit 0 - '0' Driver not allow power management
2265 * '1' Driver allow PM (use rest of parameters)
2266 *
2267 * uCode send sleep notifications:
2268 * bit 1 - '0' Don't send sleep notification
2269 * '1' send sleep notification (SEND_PM_NOTIFICATION)
2270 *
2271 * Sleep over DTIM
2272 * bit 2 - '0' PM have to walk up every DTIM
2273 * '1' PM could sleep over DTIM till listen Interval.
2274 *
2275 * PCI power managed
2276 * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2277 * '1' !(PCI_CFG_LINK_CTRL & 0x1)
2278 *
2279 * Fast PD
2280 * bit 4 - '1' Put radio to sleep when receiving frame for others
2281 *
2282 * Force sleep Modes
2283 * bit 31/30- '00' use both mac/xtal sleeps
2284 * '01' force Mac sleep
2285 * '10' force xtal sleep
2286 * '11' Illegal set
2287 *
2288 * NOTE: if sleep_interval[SLEEP_INTRVL_TBL_SIZE-1] > DTIM period then
2289 * ucode assume sleep over DTIM is allowed and we don't need to wake up
2290 * for every DTIM.
2291 */
2292#define IL_POWER_VEC_SIZE 5
2293
2294#define IL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2295#define IL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
2296
2297struct il3945_powertable_cmd {
2298 __le16 flags;
2299 u8 reserved[2];
2300 __le32 rx_data_timeout;
2301 __le32 tx_data_timeout;
2302 __le32 sleep_interval[IL_POWER_VEC_SIZE];
2303} __packed;
2304
2305struct il_powertable_cmd {
2306 __le16 flags;
2307 u8 keep_alive_seconds; /* 3945 reserved */
2308 u8 debug_flags; /* 3945 reserved */
2309 __le32 rx_data_timeout;
2310 __le32 tx_data_timeout;
2311 __le32 sleep_interval[IL_POWER_VEC_SIZE];
2312 __le32 keep_alive_beacons;
2313} __packed;
2314
2315/*
2316 * N_PM_SLEEP = 0x7A (notification only, not a command)
2317 * all devices identical.
2318 */
2319struct il_sleep_notification {
2320 u8 pm_sleep_mode;
2321 u8 pm_wakeup_src;
2322 __le16 reserved;
2323 __le32 sleep_time;
2324 __le32 tsf_low;
2325 __le32 bcon_timer;
2326} __packed;
2327
2328/* Sleep states. all devices identical. */
2329enum {
2330 IL_PM_NO_SLEEP = 0,
2331 IL_PM_SLP_MAC = 1,
2332 IL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
2333 IL_PM_SLP_FULL_MAC_CARD_STATE = 3,
2334 IL_PM_SLP_PHY = 4,
2335 IL_PM_SLP_REPENT = 5,
2336 IL_PM_WAKEUP_BY_TIMER = 6,
2337 IL_PM_WAKEUP_BY_DRIVER = 7,
2338 IL_PM_WAKEUP_BY_RFKILL = 8,
2339 /* 3 reserved */
2340 IL_PM_NUM_OF_MODES = 12,
2341};
2342
2343/*
2344 * N_CARD_STATE = 0xa1 (notification only, not a command)
2345 */
2346struct il_card_state_notif {
2347 __le32 flags;
2348} __packed;
2349
2350#define HW_CARD_DISABLED 0x01
2351#define SW_CARD_DISABLED 0x02
2352#define CT_CARD_DISABLED 0x04
2353#define RXON_CARD_DISABLED 0x10
2354
2355struct il_ct_kill_config {
2356 __le32 reserved;
2357 __le32 critical_temperature_M;
2358 __le32 critical_temperature_R;
2359} __packed;
2360
2361/******************************************************************************
2362 * (8)
2363 * Scan Commands, Responses, Notifications:
2364 *
2365 *****************************************************************************/
2366
2367#define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
2368#define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
2369
2370/**
2371 * struct il_scan_channel - entry in C_SCAN channel table
2372 *
2373 * One for each channel in the scan list.
2374 * Each channel can independently select:
2375 * 1) SSID for directed active scans
2376 * 2) Txpower setting (for rate specified within Tx command)
2377 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
2378 * quiet_plcp_th, good_CRC_th)
2379 *
2380 * To avoid uCode errors, make sure the following are true (see comments
2381 * under struct il_scan_cmd about max_out_time and quiet_time):
2382 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2383 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2384 * 2) quiet_time <= active_dwell
2385 * 3) If restricting off-channel time (i.e. max_out_time !=0):
2386 * passive_dwell < max_out_time
2387 * active_dwell < max_out_time
2388 */
2389struct il3945_scan_channel {
2390 /*
2391 * type is defined as:
2392 * 0:0 1 = active, 0 = passive
2393 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2394 * SSID IE is transmitted in probe request.
2395 * 5:7 reserved
2396 */
2397 u8 type;
2398 u8 channel; /* band is selected by il3945_scan_cmd "flags" field */
2399 struct il3945_tx_power tpc;
2400 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2401 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2402} __packed;
2403
2404/* set number of direct probes u8 type */
2405#define IL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
2406
2407struct il_scan_channel {
2408 /*
2409 * type is defined as:
2410 * 0:0 1 = active, 0 = passive
2411 * 1:20 SSID direct bit map; if a bit is set, then corresponding
2412 * SSID IE is transmitted in probe request.
2413 * 21:31 reserved
2414 */
2415 __le32 type;
2416 __le16 channel; /* band is selected by il_scan_cmd "flags" field */
2417 u8 tx_gain; /* gain for analog radio */
2418 u8 dsp_atten; /* gain for DSP */
2419 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2420 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2421} __packed;
2422
2423/* set number of direct probes __le32 type */
2424#define IL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
2425
2426/**
2427 * struct il_ssid_ie - directed scan network information element
2428 *
2429 * Up to 20 of these may appear in C_SCAN (Note: Only 4 are in
2430 * 3945 SCAN api), selected by "type" bit field in struct il_scan_channel;
2431 * each channel may select different ssids from among the 20 (4) entries.
2432 * SSID IEs get transmitted in reverse order of entry.
2433 */
2434struct il_ssid_ie {
2435 u8 id;
2436 u8 len;
2437 u8 ssid[32];
2438} __packed;
2439
2440#define PROBE_OPTION_MAX_3945 4
2441#define PROBE_OPTION_MAX 20
2442#define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2443#define IL_GOOD_CRC_TH_DISABLED 0
2444#define IL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2445#define IL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2446#define IL_MAX_SCAN_SIZE 1024
2447#define IL_MAX_CMD_SIZE 4096
2448
2449/*
2450 * C_SCAN = 0x80 (command)
2451 *
2452 * The hardware scan command is very powerful; the driver can set it up to
2453 * maintain (relatively) normal network traffic while doing a scan in the
2454 * background. The max_out_time and suspend_time control the ratio of how
2455 * long the device stays on an associated network channel ("service channel")
2456 * vs. how long it's away from the service channel, i.e. tuned to other channels
2457 * for scanning.
2458 *
2459 * max_out_time is the max time off-channel (in usec), and suspend_time
2460 * is how long (in "extended beacon" format) that the scan is "suspended"
2461 * after returning to the service channel. That is, suspend_time is the
2462 * time that we stay on the service channel, doing normal work, between
2463 * scan segments. The driver may set these parameters differently to support
2464 * scanning when associated vs. not associated, and light vs. heavy traffic
2465 * loads when associated.
2466 *
2467 * After receiving this command, the device's scan engine does the following;
2468 *
2469 * 1) Sends SCAN_START notification to driver
2470 * 2) Checks to see if it has time to do scan for one channel
2471 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
2472 * to tell AP that we're going off-channel
2473 * 4) Tunes to first channel in scan list, does active or passive scan
2474 * 5) Sends SCAN_RESULT notification to driver
2475 * 6) Checks to see if it has time to do scan on *next* channel in list
2476 * 7) Repeats 4-6 until it no longer has time to scan the next channel
2477 * before max_out_time expires
2478 * 8) Returns to service channel
2479 * 9) Sends NULL packet with PS=0 to tell AP that we're back
2480 * 10) Stays on service channel until suspend_time expires
2481 * 11) Repeats entire process 2-10 until list is complete
2482 * 12) Sends SCAN_COMPLETE notification
2483 *
2484 * For fast, efficient scans, the scan command also has support for staying on
2485 * a channel for just a short time, if doing active scanning and getting no
2486 * responses to the transmitted probe request. This time is controlled by
2487 * quiet_time, and the number of received packets below which a channel is
2488 * considered "quiet" is controlled by quiet_plcp_threshold.
2489 *
2490 * For active scanning on channels that have regulatory restrictions against
2491 * blindly transmitting, the scan can listen before transmitting, to make sure
2492 * that there is already legitimate activity on the channel. If enough
2493 * packets are cleanly received on the channel (controlled by good_CRC_th,
2494 * typical value 1), the scan engine starts transmitting probe requests.
2495 *
2496 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2497 *
2498 * To avoid uCode errors, see timing restrictions described under
2499 * struct il_scan_channel.
2500 */
2501
2502struct il3945_scan_cmd {
2503 __le16 len;
2504 u8 reserved0;
2505 u8 channel_count; /* # channels in channel list */
2506 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2507 * (only for active scan) */
2508 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2509 __le16 good_CRC_th; /* passive -> active promotion threshold */
2510 __le16 reserved1;
2511 __le32 max_out_time; /* max usec to be away from associated (service)
2512 * channel */
2513 __le32 suspend_time; /* pause scan this long (in "extended beacon
2514 * format") when returning to service channel:
2515 * 3945; 31:24 # beacons, 19:0 additional usec,
2516 * 4965; 31:22 # beacons, 21:0 additional usec.
2517 */
2518 __le32 flags; /* RXON_FLG_* */
2519 __le32 filter_flags; /* RXON_FILTER_* */
2520
2521 /* For active scans (set to all-0s for passive scans).
2522 * Does not include payload. Must specify Tx rate; no rate scaling. */
2523 struct il3945_tx_cmd tx_cmd;
2524
2525 /* For directed active scans (set to all-0s otherwise) */
2526 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX_3945];
2527
2528 /*
2529 * Probe request frame, followed by channel list.
2530 *
2531 * Size of probe request frame is specified by byte count in tx_cmd.
2532 * Channel list follows immediately after probe request frame.
2533 * Number of channels in list is specified by channel_count.
2534 * Each channel in list is of type:
2535 *
2536 * struct il3945_scan_channel channels[0];
2537 *
2538 * NOTE: Only one band of channels can be scanned per pass. You
2539 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2540 * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
2541 * before requesting another scan.
2542 */
2543 u8 data[0];
2544} __packed;
2545
2546struct il_scan_cmd {
2547 __le16 len;
2548 u8 reserved0;
2549 u8 channel_count; /* # channels in channel list */
2550 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2551 * (only for active scan) */
2552 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2553 __le16 good_CRC_th; /* passive -> active promotion threshold */
2554 __le16 rx_chain; /* RXON_RX_CHAIN_* */
2555 __le32 max_out_time; /* max usec to be away from associated (service)
2556 * channel */
2557 __le32 suspend_time; /* pause scan this long (in "extended beacon
2558 * format") when returning to service chnl:
2559 * 3945; 31:24 # beacons, 19:0 additional usec,
2560 * 4965; 31:22 # beacons, 21:0 additional usec.
2561 */
2562 __le32 flags; /* RXON_FLG_* */
2563 __le32 filter_flags; /* RXON_FILTER_* */
2564
2565 /* For active scans (set to all-0s for passive scans).
2566 * Does not include payload. Must specify Tx rate; no rate scaling. */
2567 struct il_tx_cmd tx_cmd;
2568
2569 /* For directed active scans (set to all-0s otherwise) */
2570 struct il_ssid_ie direct_scan[PROBE_OPTION_MAX];
2571
2572 /*
2573 * Probe request frame, followed by channel list.
2574 *
2575 * Size of probe request frame is specified by byte count in tx_cmd.
2576 * Channel list follows immediately after probe request frame.
2577 * Number of channels in list is specified by channel_count.
2578 * Each channel in list is of type:
2579 *
2580 * struct il_scan_channel channels[0];
2581 *
2582 * NOTE: Only one band of channels can be scanned per pass. You
2583 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2584 * for one scan to complete (i.e. receive N_SCAN_COMPLETE)
2585 * before requesting another scan.
2586 */
2587 u8 data[0];
2588} __packed;
2589
2590/* Can abort will notify by complete notification with abort status. */
2591#define CAN_ABORT_STATUS cpu_to_le32(0x1)
2592/* complete notification statuses */
2593#define ABORT_STATUS 0x2
2594
2595/*
2596 * C_SCAN = 0x80 (response)
2597 */
2598struct il_scanreq_notification {
2599 __le32 status; /* 1: okay, 2: cannot fulfill request */
2600} __packed;
2601
2602/*
2603 * N_SCAN_START = 0x82 (notification only, not a command)
2604 */
2605struct il_scanstart_notification {
2606 __le32 tsf_low;
2607 __le32 tsf_high;
2608 __le32 beacon_timer;
2609 u8 channel;
2610 u8 band;
2611 u8 reserved[2];
2612 __le32 status;
2613} __packed;
2614
2615#define SCAN_OWNER_STATUS 0x1
2616#define MEASURE_OWNER_STATUS 0x2
2617
2618#define IL_PROBE_STATUS_OK 0
2619#define IL_PROBE_STATUS_TX_FAILED BIT(0)
2620/* error statuses combined with TX_FAILED */
2621#define IL_PROBE_STATUS_FAIL_TTL BIT(1)
2622#define IL_PROBE_STATUS_FAIL_BT BIT(2)
2623
2624#define NUMBER_OF_STATS 1 /* first __le32 is good CRC */
2625/*
2626 * N_SCAN_RESULTS = 0x83 (notification only, not a command)
2627 */
2628struct il_scanresults_notification {
2629 u8 channel;
2630 u8 band;
2631 u8 probe_status;
2632 u8 num_probe_not_sent; /* not enough time to send */
2633 __le32 tsf_low;
2634 __le32 tsf_high;
2635 __le32 stats[NUMBER_OF_STATS];
2636} __packed;
2637
2638/*
2639 * N_SCAN_COMPLETE = 0x84 (notification only, not a command)
2640 */
2641struct il_scancomplete_notification {
2642 u8 scanned_channels;
2643 u8 status;
2644 u8 last_channel;
2645 __le32 tsf_low;
2646 __le32 tsf_high;
2647} __packed;
2648
2649
2650/******************************************************************************
2651 * (9)
2652 * IBSS/AP Commands and Notifications:
2653 *
2654 *****************************************************************************/
2655
2656enum il_ibss_manager {
2657 IL_NOT_IBSS_MANAGER = 0,
2658 IL_IBSS_MANAGER = 1,
2659};
2660
2661/*
2662 * N_BEACON = 0x90 (notification only, not a command)
2663 */
2664
2665struct il3945_beacon_notif {
2666 struct il3945_tx_resp beacon_notify_hdr;
2667 __le32 low_tsf;
2668 __le32 high_tsf;
2669 __le32 ibss_mgr_status;
2670} __packed;
2671
2672struct il4965_beacon_notif {
2673 struct il4965_tx_resp beacon_notify_hdr;
2674 __le32 low_tsf;
2675 __le32 high_tsf;
2676 __le32 ibss_mgr_status;
2677} __packed;
2678
2679/*
2680 * C_TX_BEACON= 0x91 (command, has simple generic response)
2681 */
2682
2683struct il3945_tx_beacon_cmd {
2684 struct il3945_tx_cmd tx;
2685 __le16 tim_idx;
2686 u8 tim_size;
2687 u8 reserved1;
2688 struct ieee80211_hdr frame[0]; /* beacon frame */
2689} __packed;
2690
2691struct il_tx_beacon_cmd {
2692 struct il_tx_cmd tx;
2693 __le16 tim_idx;
2694 u8 tim_size;
2695 u8 reserved1;
2696 struct ieee80211_hdr frame[0]; /* beacon frame */
2697} __packed;
2698
2699/******************************************************************************
2700 * (10)
2701 * Statistics Commands and Notifications:
2702 *
2703 *****************************************************************************/
2704
2705#define IL_TEMP_CONVERT 260
2706
2707#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
2708#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
2709#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
2710
2711/* Used for passing to driver number of successes and failures per rate */
2712struct rate_histogram {
2713 union {
2714 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2715 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2716 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2717 } success;
2718 union {
2719 __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
2720 __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
2721 __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
2722 } failed;
2723} __packed;
2724
2725/* stats command response */
2726
2727struct iwl39_stats_rx_phy {
2728 __le32 ina_cnt;
2729 __le32 fina_cnt;
2730 __le32 plcp_err;
2731 __le32 crc32_err;
2732 __le32 overrun_err;
2733 __le32 early_overrun_err;
2734 __le32 crc32_good;
2735 __le32 false_alarm_cnt;
2736 __le32 fina_sync_err_cnt;
2737 __le32 sfd_timeout;
2738 __le32 fina_timeout;
2739 __le32 unresponded_rts;
2740 __le32 rxe_frame_limit_overrun;
2741 __le32 sent_ack_cnt;
2742 __le32 sent_cts_cnt;
2743} __packed;
2744
2745struct iwl39_stats_rx_non_phy {
2746 __le32 bogus_cts; /* CTS received when not expecting CTS */
2747 __le32 bogus_ack; /* ACK received when not expecting ACK */
2748 __le32 non_bssid_frames; /* number of frames with BSSID that
2749 * doesn't belong to the STA BSSID */
2750 __le32 filtered_frames; /* count frames that were dumped in the
2751 * filtering process */
2752 __le32 non_channel_beacons; /* beacons with our bss id but not on
2753 * our serving channel */
2754} __packed;
2755
2756struct iwl39_stats_rx {
2757 struct iwl39_stats_rx_phy ofdm;
2758 struct iwl39_stats_rx_phy cck;
2759 struct iwl39_stats_rx_non_phy general;
2760} __packed;
2761
2762struct iwl39_stats_tx {
2763 __le32 preamble_cnt;
2764 __le32 rx_detected_cnt;
2765 __le32 bt_prio_defer_cnt;
2766 __le32 bt_prio_kill_cnt;
2767 __le32 few_bytes_cnt;
2768 __le32 cts_timeout;
2769 __le32 ack_timeout;
2770 __le32 expected_ack_cnt;
2771 __le32 actual_ack_cnt;
2772} __packed;
2773
2774struct stats_dbg {
2775 __le32 burst_check;
2776 __le32 burst_count;
2777 __le32 wait_for_silence_timeout_cnt;
2778 __le32 reserved[3];
2779} __packed;
2780
2781struct iwl39_stats_div {
2782 __le32 tx_on_a;
2783 __le32 tx_on_b;
2784 __le32 exec_time;
2785 __le32 probe_time;
2786} __packed;
2787
2788struct iwl39_stats_general {
2789 __le32 temperature;
2790 struct stats_dbg dbg;
2791 __le32 sleep_time;
2792 __le32 slots_out;
2793 __le32 slots_idle;
2794 __le32 ttl_timestamp;
2795 struct iwl39_stats_div div;
2796} __packed;
2797
2798struct stats_rx_phy {
2799 __le32 ina_cnt;
2800 __le32 fina_cnt;
2801 __le32 plcp_err;
2802 __le32 crc32_err;
2803 __le32 overrun_err;
2804 __le32 early_overrun_err;
2805 __le32 crc32_good;
2806 __le32 false_alarm_cnt;
2807 __le32 fina_sync_err_cnt;
2808 __le32 sfd_timeout;
2809 __le32 fina_timeout;
2810 __le32 unresponded_rts;
2811 __le32 rxe_frame_limit_overrun;
2812 __le32 sent_ack_cnt;
2813 __le32 sent_cts_cnt;
2814 __le32 sent_ba_rsp_cnt;
2815 __le32 dsp_self_kill;
2816 __le32 mh_format_err;
2817 __le32 re_acq_main_rssi_sum;
2818 __le32 reserved3;
2819} __packed;
2820
2821struct stats_rx_ht_phy {
2822 __le32 plcp_err;
2823 __le32 overrun_err;
2824 __le32 early_overrun_err;
2825 __le32 crc32_good;
2826 __le32 crc32_err;
2827 __le32 mh_format_err;
2828 __le32 agg_crc32_good;
2829 __le32 agg_mpdu_cnt;
2830 __le32 agg_cnt;
2831 __le32 unsupport_mcs;
2832} __packed;
2833
2834#define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
2835
2836struct stats_rx_non_phy {
2837 __le32 bogus_cts; /* CTS received when not expecting CTS */
2838 __le32 bogus_ack; /* ACK received when not expecting ACK */
2839 __le32 non_bssid_frames; /* number of frames with BSSID that
2840 * doesn't belong to the STA BSSID */
2841 __le32 filtered_frames; /* count frames that were dumped in the
2842 * filtering process */
2843 __le32 non_channel_beacons; /* beacons with our bss id but not on
2844 * our serving channel */
2845 __le32 channel_beacons; /* beacons with our bss id and in our
2846 * serving channel */
2847 __le32 num_missed_bcon; /* number of missed beacons */
2848 __le32 adc_rx_saturation_time; /* count in 0.8us units the time the
2849 * ADC was in saturation */
2850 __le32 ina_detection_search_time;/* total time (in 0.8us) searched
2851 * for INA */
2852 __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */
2853 __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */
2854 __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */
2855 __le32 interference_data_flag; /* flag for interference data
2856 * availability. 1 when data is
2857 * available. */
2858 __le32 channel_load; /* counts RX Enable time in uSec */
2859 __le32 dsp_false_alarms; /* DSP false alarm (both OFDM
2860 * and CCK) counter */
2861 __le32 beacon_rssi_a;
2862 __le32 beacon_rssi_b;
2863 __le32 beacon_rssi_c;
2864 __le32 beacon_energy_a;
2865 __le32 beacon_energy_b;
2866 __le32 beacon_energy_c;
2867} __packed;
2868
2869struct stats_rx {
2870 struct stats_rx_phy ofdm;
2871 struct stats_rx_phy cck;
2872 struct stats_rx_non_phy general;
2873 struct stats_rx_ht_phy ofdm_ht;
2874} __packed;
2875
2876/**
2877 * struct stats_tx_power - current tx power
2878 *
2879 * @ant_a: current tx power on chain a in 1/2 dB step
2880 * @ant_b: current tx power on chain b in 1/2 dB step
2881 * @ant_c: current tx power on chain c in 1/2 dB step
2882 */
2883struct stats_tx_power {
2884 u8 ant_a;
2885 u8 ant_b;
2886 u8 ant_c;
2887 u8 reserved;
2888} __packed;
2889
2890struct stats_tx_non_phy_agg {
2891 __le32 ba_timeout;
2892 __le32 ba_reschedule_frames;
2893 __le32 scd_query_agg_frame_cnt;
2894 __le32 scd_query_no_agg;
2895 __le32 scd_query_agg;
2896 __le32 scd_query_mismatch;
2897 __le32 frame_not_ready;
2898 __le32 underrun;
2899 __le32 bt_prio_kill;
2900 __le32 rx_ba_rsp_cnt;
2901} __packed;
2902
2903struct stats_tx {
2904 __le32 preamble_cnt;
2905 __le32 rx_detected_cnt;
2906 __le32 bt_prio_defer_cnt;
2907 __le32 bt_prio_kill_cnt;
2908 __le32 few_bytes_cnt;
2909 __le32 cts_timeout;
2910 __le32 ack_timeout;
2911 __le32 expected_ack_cnt;
2912 __le32 actual_ack_cnt;
2913 __le32 dump_msdu_cnt;
2914 __le32 burst_abort_next_frame_mismatch_cnt;
2915 __le32 burst_abort_missing_next_frame_cnt;
2916 __le32 cts_timeout_collision;
2917 __le32 ack_or_ba_timeout_collision;
2918 struct stats_tx_non_phy_agg agg;
2919
2920 __le32 reserved1;
2921} __packed;
2922
2923
2924struct stats_div {
2925 __le32 tx_on_a;
2926 __le32 tx_on_b;
2927 __le32 exec_time;
2928 __le32 probe_time;
2929 __le32 reserved1;
2930 __le32 reserved2;
2931} __packed;
2932
2933struct stats_general_common {
2934 __le32 temperature; /* radio temperature */
2935 struct stats_dbg dbg;
2936 __le32 sleep_time;
2937 __le32 slots_out;
2938 __le32 slots_idle;
2939 __le32 ttl_timestamp;
2940 struct stats_div div;
2941 __le32 rx_enable_counter;
2942 /*
2943 * num_of_sos_states:
2944 * count the number of times we have to re-tune
2945 * in order to get out of bad PHY status
2946 */
2947 __le32 num_of_sos_states;
2948} __packed;
2949
2950struct stats_general {
2951 struct stats_general_common common;
2952 __le32 reserved2;
2953 __le32 reserved3;
2954} __packed;
2955
2956#define UCODE_STATS_CLEAR_MSK (0x1 << 0)
2957#define UCODE_STATS_FREQUENCY_MSK (0x1 << 1)
2958#define UCODE_STATS_NARROW_BAND_MSK (0x1 << 2)
2959
2960/*
2961 * C_STATS = 0x9c,
2962 * all devices identical.
2963 *
2964 * This command triggers an immediate response containing uCode stats.
2965 * The response is in the same format as N_STATS 0x9d, below.
2966 *
2967 * If the CLEAR_STATS configuration flag is set, uCode will clear its
2968 * internal copy of the stats (counters) after issuing the response.
2969 * This flag does not affect N_STATSs after beacons (see below).
2970 *
2971 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
2972 * N_STATSs after received beacons (see below). This flag
2973 * does not affect the response to the C_STATS 0x9c itself.
2974 */
2975#define IL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
2976#define IL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
2977struct il_stats_cmd {
2978 __le32 configuration_flags; /* IL_STATS_CONF_* */
2979} __packed;
2980
2981/*
2982 * N_STATS = 0x9d (notification only, not a command)
2983 *
2984 * By default, uCode issues this notification after receiving a beacon
2985 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
2986 * C_STATS 0x9c, above.
2987 *
2988 * Statistics counters continue to increment beacon after beacon, but are
2989 * cleared when changing channels or when driver issues C_STATS
2990 * 0x9c with CLEAR_STATS bit set (see above).
2991 *
2992 * uCode also issues this notification during scans. uCode clears stats
2993 * appropriately so that each notification contains stats for only the
2994 * one channel that has just been scanned.
2995 */
2996#define STATS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
2997#define STATS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
2998
2999struct il3945_notif_stats {
3000 __le32 flag;
3001 struct iwl39_stats_rx rx;
3002 struct iwl39_stats_tx tx;
3003 struct iwl39_stats_general general;
3004} __packed;
3005
3006struct il_notif_stats {
3007 __le32 flag;
3008 struct stats_rx rx;
3009 struct stats_tx tx;
3010 struct stats_general general;
3011} __packed;
3012
3013/*
3014 * N_MISSED_BEACONS = 0xa2 (notification only, not a command)
3015 *
3016 * uCode send N_MISSED_BEACONS to driver when detect beacon missed
3017 * in regardless of how many missed beacons, which mean when driver receive the
3018 * notification, inside the command, it can find all the beacons information
3019 * which include number of total missed beacons, number of consecutive missed
3020 * beacons, number of beacons received and number of beacons expected to
3021 * receive.
3022 *
3023 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3024 * in order to bring the radio/PHY back to working state; which has no relation
3025 * to when driver will perform sensitivity calibration.
3026 *
3027 * Driver should set it own missed_beacon_threshold to decide when to perform
3028 * sensitivity calibration based on number of consecutive missed beacons in
3029 * order to improve overall performance, especially in noisy environment.
3030 *
3031 */
3032
3033#define IL_MISSED_BEACON_THRESHOLD_MIN (1)
3034#define IL_MISSED_BEACON_THRESHOLD_DEF (5)
3035#define IL_MISSED_BEACON_THRESHOLD_MAX IL_MISSED_BEACON_THRESHOLD_DEF
3036
3037struct il_missed_beacon_notif {
3038 __le32 consecutive_missed_beacons;
3039 __le32 total_missed_becons;
3040 __le32 num_expected_beacons;
3041 __le32 num_recvd_beacons;
3042} __packed;
3043
3044
3045/******************************************************************************
3046 * (11)
3047 * Rx Calibration Commands:
3048 *
3049 * With the uCode used for open source drivers, most Tx calibration (except
3050 * for Tx Power) and most Rx calibration is done by uCode during the
3051 * "initialize" phase of uCode boot. Driver must calibrate only:
3052 *
3053 * 1) Tx power (depends on temperature), described elsewhere
3054 * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3055 * 3) Receiver sensitivity (to optimize signal detection)
3056 *
3057 *****************************************************************************/
3058
3059/**
3060 * C_SENSITIVITY = 0xa8 (command, has simple generic response)
3061 *
3062 * This command sets up the Rx signal detector for a sensitivity level that
3063 * is high enough to lock onto all signals within the associated network,
3064 * but low enough to ignore signals that are below a certain threshold, so as
3065 * not to have too many "false alarms". False alarms are signals that the
3066 * Rx DSP tries to lock onto, but then discards after determining that they
3067 * are noise.
3068 *
3069 * The optimum number of false alarms is between 5 and 50 per 200 TUs
3070 * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3071 * time listening, not transmitting). Driver must adjust sensitivity so that
3072 * the ratio of actual false alarms to actual Rx time falls within this range.
3073 *
3074 * While associated, uCode delivers N_STATSs after each
3075 * received beacon. These provide information to the driver to analyze the
3076 * sensitivity. Don't analyze stats that come in from scanning, or any
3077 * other non-associated-network source. Pertinent stats include:
3078 *
3079 * From "general" stats (struct stats_rx_non_phy):
3080 *
3081 * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3082 * Measure of energy of desired signal. Used for establishing a level
3083 * below which the device does not detect signals.
3084 *
3085 * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3086 * Measure of background noise in silent period after beacon.
3087 *
3088 * channel_load
3089 * uSecs of actual Rx time during beacon period (varies according to
3090 * how much time was spent transmitting).
3091 *
3092 * From "cck" and "ofdm" stats (struct stats_rx_phy), separately:
3093 *
3094 * false_alarm_cnt
3095 * Signal locks abandoned early (before phy-level header).
3096 *
3097 * plcp_err
3098 * Signal locks abandoned late (during phy-level header).
3099 *
3100 * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
3101 * beacon to beacon, i.e. each value is an accumulation of all errors
3102 * before and including the latest beacon. Values will wrap around to 0
3103 * after counting up to 2^32 - 1. Driver must differentiate vs.
3104 * previous beacon's values to determine # false alarms in the current
3105 * beacon period.
3106 *
3107 * Total number of false alarms = false_alarms + plcp_errs
3108 *
3109 * For OFDM, adjust the following table entries in struct il_sensitivity_cmd
3110 * (notice that the start points for OFDM are at or close to settings for
3111 * maximum sensitivity):
3112 *
3113 * START / MIN / MAX
3114 * HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX 90 / 85 / 120
3115 * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX 170 / 170 / 210
3116 * HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX 105 / 105 / 140
3117 * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX 220 / 220 / 270
3118 *
3119 * If actual rate of OFDM false alarms (+ plcp_errors) is too high
3120 * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3121 * by *adding* 1 to all 4 of the table entries above, up to the max for
3122 * each entry. Conversely, if false alarm rate is too low (less than 5
3123 * for each 204.8 msecs listening), *subtract* 1 from each entry to
3124 * increase sensitivity.
3125 *
3126 * For CCK sensitivity, keep track of the following:
3127 *
3128 * 1). 20-beacon history of maximum background noise, indicated by
3129 * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3130 * 3 receivers. For any given beacon, the "silence reference" is
3131 * the maximum of last 60 samples (20 beacons * 3 receivers).
3132 *
3133 * 2). 10-beacon history of strongest signal level, as indicated
3134 * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3135 * i.e. the strength of the signal through the best receiver at the
3136 * moment. These measurements are "upside down", with lower values
3137 * for stronger signals, so max energy will be *minimum* value.
3138 *
3139 * Then for any given beacon, the driver must determine the *weakest*
3140 * of the strongest signals; this is the minimum level that needs to be
3141 * successfully detected, when using the best receiver at the moment.
3142 * "Max cck energy" is the maximum (higher value means lower energy!)
3143 * of the last 10 minima. Once this is determined, driver must add
3144 * a little margin by adding "6" to it.
3145 *
3146 * 3). Number of consecutive beacon periods with too few false alarms.
3147 * Reset this to 0 at the first beacon period that falls within the
3148 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3149 *
3150 * Then, adjust the following CCK table entries in struct il_sensitivity_cmd
3151 * (notice that the start points for CCK are at maximum sensitivity):
3152 *
3153 * START / MIN / MAX
3154 * HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX 125 / 125 / 200
3155 * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX 200 / 200 / 400
3156 * HD_MIN_ENERGY_CCK_DET_IDX 100 / 0 / 100
3157 *
3158 * If actual rate of CCK false alarms (+ plcp_errors) is too high
3159 * (greater than 50 for each 204.8 msecs listening), method for reducing
3160 * sensitivity is:
3161 *
3162 * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
3163 * up to max 400.
3164 *
3165 * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is < 160,
3166 * sensitivity has been reduced a significant amount; bring it up to
3167 * a moderate 161. Otherwise, *add* 3, up to max 200.
3168 *
3169 * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX is > 160,
3170 * sensitivity has been reduced only a moderate or small amount;
3171 * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_IDX,
3172 * down to min 0. Otherwise (if gain has been significantly reduced),
3173 * don't change the HD_MIN_ENERGY_CCK_DET_IDX value.
3174 *
3175 * b) Save a snapshot of the "silence reference".
3176 *
3177 * If actual rate of CCK false alarms (+ plcp_errors) is too low
3178 * (less than 5 for each 204.8 msecs listening), method for increasing
3179 * sensitivity is used only if:
3180 *
3181 * 1a) Previous beacon did not have too many false alarms
3182 * 1b) AND difference between previous "silence reference" and current
3183 * "silence reference" (prev - current) is 2 or more,
3184 * OR 2) 100 or more consecutive beacon periods have had rate of
3185 * less than 5 false alarms per 204.8 milliseconds rx time.
3186 *
3187 * Method for increasing sensitivity:
3188 *
3189 * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX,
3190 * down to min 125.
3191 *
3192 * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX,
3193 * down to min 200.
3194 *
3195 * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_IDX, up to max 100.
3196 *
3197 * If actual rate of CCK false alarms (+ plcp_errors) is within good range
3198 * (between 5 and 50 for each 204.8 msecs listening):
3199 *
3200 * 1) Save a snapshot of the silence reference.
3201 *
3202 * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
3203 * give some extra margin to energy threshold by *subtracting* 8
3204 * from value in HD_MIN_ENERGY_CCK_DET_IDX.
3205 *
3206 * For all cases (too few, too many, good range), make sure that the CCK
3207 * detection threshold (energy) is below the energy level for robust
3208 * detection over the past 10 beacon periods, the "Max cck energy".
3209 * Lower values mean higher energy; this means making sure that the value
3210 * in HD_MIN_ENERGY_CCK_DET_IDX is at or *above* "Max cck energy".
3211 *
3212 */
3213
3214/*
3215 * Table entries in C_SENSITIVITY (struct il_sensitivity_cmd)
3216 */
3217#define HD_TBL_SIZE (11) /* number of entries */
3218#define HD_MIN_ENERGY_CCK_DET_IDX (0) /* table idxes */
3219#define HD_MIN_ENERGY_OFDM_DET_IDX (1)
3220#define HD_AUTO_CORR32_X1_TH_ADD_MIN_IDX (2)
3221#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_IDX (3)
3222#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_IDX (4)
3223#define HD_AUTO_CORR32_X4_TH_ADD_MIN_IDX (5)
3224#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_IDX (6)
3225#define HD_BARKER_CORR_TH_ADD_MIN_IDX (7)
3226#define HD_BARKER_CORR_TH_ADD_MIN_MRC_IDX (8)
3227#define HD_AUTO_CORR40_X4_TH_ADD_MIN_IDX (9)
3228#define HD_OFDM_ENERGY_TH_IN_IDX (10)
3229
3230/* Control field in struct il_sensitivity_cmd */
3231#define C_SENSITIVITY_CONTROL_DEFAULT_TBL cpu_to_le16(0)
3232#define C_SENSITIVITY_CONTROL_WORK_TBL cpu_to_le16(1)
3233
3234/**
3235 * struct il_sensitivity_cmd
3236 * @control: (1) updates working table, (0) updates default table
3237 * @table: energy threshold values, use HD_* as idx into table
3238 *
3239 * Always use "1" in "control" to update uCode's working table and DSP.
3240 */
3241struct il_sensitivity_cmd {
3242 __le16 control; /* always use "1" */
3243 __le16 table[HD_TBL_SIZE]; /* use HD_* as idx */
3244} __packed;
3245
3246
3247/**
3248 * C_PHY_CALIBRATION = 0xb0 (command, has simple generic response)
3249 *
3250 * This command sets the relative gains of 4965 device's 3 radio receiver chains.
3251 *
3252 * After the first association, driver should accumulate signal and noise
3253 * stats from the N_STATSs that follow the first 20
3254 * beacons from the associated network (don't collect stats that come
3255 * in from scanning, or any other non-network source).
3256 *
3257 * DISCONNECTED ANTENNA:
3258 *
3259 * Driver should determine which antennas are actually connected, by comparing
3260 * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
3261 * following values over 20 beacons, one accumulator for each of the chains
3262 * a/b/c, from struct stats_rx_non_phy:
3263 *
3264 * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3265 *
3266 * Find the strongest signal from among a/b/c. Compare the other two to the
3267 * strongest. If any signal is more than 15 dB (times 20, unless you
3268 * divide the accumulated values by 20) below the strongest, the driver
3269 * considers that antenna to be disconnected, and should not try to use that
3270 * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
3271 * driver should declare the stronger one as connected, and attempt to use it
3272 * (A and B are the only 2 Tx chains!).
3273 *
3274 *
3275 * RX BALANCE:
3276 *
3277 * Driver should balance the 3 receivers (but just the ones that are connected
3278 * to antennas, see above) for gain, by comparing the average signal levels
3279 * detected during the silence after each beacon (background noise).
3280 * Accumulate (add) the following values over 20 beacons, one accumulator for
3281 * each of the chains a/b/c, from struct stats_rx_non_phy:
3282 *
3283 * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3284 *
3285 * Find the weakest background noise level from among a/b/c. This Rx chain
3286 * will be the reference, with 0 gain adjustment. Attenuate other channels by
3287 * finding noise difference:
3288 *
3289 * (accum_noise[i] - accum_noise[reference]) / 30
3290 *
3291 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3292 * For use in diff_gain_[abc] fields of struct il_calibration_cmd, the
3293 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3294 * and set bit 2 to indicate "reduce gain". The value for the reference
3295 * (weakest) chain should be "0".
3296 *
3297 * diff_gain_[abc] bit fields:
3298 * 2: (1) reduce gain, (0) increase gain
3299 * 1-0: amount of gain, units of 1.5 dB
3300 */
3301
3302/* Phy calibration command for series */
3303/* The default calibrate table size if not specified by firmware */
3304#define IL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
3305enum {
3306 IL_PHY_CALIBRATE_DIFF_GAIN_CMD = 7,
3307 IL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE = 19,
3308};
3309
3310#define IL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
3311
3312struct il_calib_hdr {
3313 u8 op_code;
3314 u8 first_group;
3315 u8 groups_num;
3316 u8 data_valid;
3317} __packed;
3318
3319/* IL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3320struct il_calib_diff_gain_cmd {
3321 struct il_calib_hdr hdr;
3322 s8 diff_gain_a; /* see above */
3323 s8 diff_gain_b;
3324 s8 diff_gain_c;
3325 u8 reserved1;
3326} __packed;
3327
3328/******************************************************************************
3329 * (12)
3330 * Miscellaneous Commands:
3331 *
3332 *****************************************************************************/
3333
3334/*
3335 * LEDs Command & Response
3336 * C_LEDS = 0x48 (command, has simple generic response)
3337 *
3338 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3339 * this command turns it on or off, or sets up a periodic blinking cycle.
3340 */
3341struct il_led_cmd {
3342 __le32 interval; /* "interval" in uSec */
3343 u8 id; /* 1: Activity, 2: Link, 3: Tech */
3344 u8 off; /* # intervals off while blinking;
3345 * "0", with >0 "on" value, turns LED on */
3346 u8 on; /* # intervals on while blinking;
3347 * "0", regardless of "off", turns LED off */
3348 u8 reserved;
3349} __packed;
3350
3351
3352/******************************************************************************
3353 * (13)
3354 * Union of all expected notifications/responses:
3355 *
3356 *****************************************************************************/
3357
3358struct il_rx_pkt {
3359 /*
3360 * The first 4 bytes of the RX frame header contain both the RX frame
3361 * size and some flags.
3362 * Bit fields:
3363 * 31: flag flush RB request
3364 * 30: flag ignore TC (terminal counter) request
3365 * 29: flag fast IRQ request
3366 * 28-14: Reserved
3367 * 13-00: RX frame size
3368 */
3369 __le32 len_n_flags;
3370 struct il_cmd_header hdr;
3371 union {
3372 struct il3945_rx_frame rx_frame;
3373 struct il3945_tx_resp tx_resp;
3374 struct il3945_beacon_notif beacon_status;
3375
3376 struct il_alive_resp alive_frame;
3377 struct il_spectrum_notification spectrum_notif;
3378 struct il_csa_notification csa_notif;
3379 struct il_error_resp err_resp;
3380 struct il_card_state_notif card_state_notif;
3381 struct il_add_sta_resp add_sta;
3382 struct il_rem_sta_resp rem_sta;
3383 struct il_sleep_notification sleep_notif;
3384 struct il_spectrum_resp spectrum;
3385 struct il_notif_stats stats;
3386 struct il_compressed_ba_resp compressed_ba;
3387 struct il_missed_beacon_notif missed_beacon;
3388 __le32 status;
3389 u8 raw[0];
3390 } u;
3391} __packed;
3392
3393#endif /* __il_commands_h__ */