1 /******************************************************************************
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.
8 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
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.
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.
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,
24 * The full GNU General Public License is included in this distribution
25 * in the file called LICENSE.GPL.
27 * Contact Information:
28 * Intel Linux Wireless <ilw@linux.intel.com>
29 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
33 * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
34 * All rights reserved.
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
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
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.
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.
62 *****************************************************************************/
64 * Please use this file (iwl-commands.h) only for uCode API definitions.
65 * Please use iwl-xxxx-hw.h for hardware-related definitions.
66 * Please use iwl-dev.h for driver implementation definitions.
69 #ifndef __iwl_legacy_commands_h__
70 #define __iwl_legacy_commands_h__
74 /* uCode version contains 4 values: Major/Minor/API/Serial */
75 #define IWL_UCODE_MAJOR(ver) (((ver) & 0xFF000000) >> 24)
76 #define IWL_UCODE_MINOR(ver) (((ver) & 0x00FF0000) >> 16)
77 #define IWL_UCODE_API(ver) (((ver) & 0x0000FF00) >> 8)
78 #define IWL_UCODE_SERIAL(ver) ((ver) & 0x000000FF)
82 #define IWL_CCK_RATES 4
83 #define IWL_OFDM_RATES 8
84 #define IWL_MAX_RATES (IWL_CCK_RATES + IWL_OFDM_RATES)
90 /* RXON and QOS commands */
92 REPLY_RXON_ASSOC
= 0x11,
93 REPLY_QOS_PARAM
= 0x13,
94 REPLY_RXON_TIMING
= 0x14,
96 /* Multi-Station support */
98 REPLY_REMOVE_STA
= 0x19,
104 REPLY_3945_RX
= 0x1b, /* 3945 only */
106 REPLY_RATE_SCALE
= 0x47, /* 3945 only */
107 REPLY_LEDS_CMD
= 0x48,
108 REPLY_TX_LINK_QUALITY_CMD
= 0x4e, /* for 4965 and up */
110 /* 802.11h related */
111 REPLY_CHANNEL_SWITCH
= 0x72,
112 CHANNEL_SWITCH_NOTIFICATION
= 0x73,
113 REPLY_SPECTRUM_MEASUREMENT_CMD
= 0x74,
114 SPECTRUM_MEASURE_NOTIFICATION
= 0x75,
116 /* Power Management */
117 POWER_TABLE_CMD
= 0x77,
118 PM_SLEEP_NOTIFICATION
= 0x7A,
119 PM_DEBUG_STATISTIC_NOTIFIC
= 0x7B,
121 /* Scan commands and notifications */
122 REPLY_SCAN_CMD
= 0x80,
123 REPLY_SCAN_ABORT_CMD
= 0x81,
124 SCAN_START_NOTIFICATION
= 0x82,
125 SCAN_RESULTS_NOTIFICATION
= 0x83,
126 SCAN_COMPLETE_NOTIFICATION
= 0x84,
128 /* IBSS/AP commands */
129 BEACON_NOTIFICATION
= 0x90,
130 REPLY_TX_BEACON
= 0x91,
132 /* Miscellaneous commands */
133 REPLY_TX_PWR_TABLE_CMD
= 0x97,
135 /* Bluetooth device coexistence config command */
136 REPLY_BT_CONFIG
= 0x9b,
139 REPLY_STATISTICS_CMD
= 0x9c,
140 STATISTICS_NOTIFICATION
= 0x9d,
142 /* RF-KILL commands and notifications */
143 CARD_STATE_NOTIFICATION
= 0xa1,
145 /* Missed beacons notification */
146 MISSED_BEACONS_NOTIFICATION
= 0xa2,
148 REPLY_CT_KILL_CONFIG_CMD
= 0xa4,
149 SENSITIVITY_CMD
= 0xa8,
150 REPLY_PHY_CALIBRATION_CMD
= 0xb0,
151 REPLY_RX_PHY_CMD
= 0xc0,
152 REPLY_RX_MPDU_CMD
= 0xc1,
154 REPLY_COMPRESSED_BA
= 0xc5,
159 /******************************************************************************
161 * Commonly used structures and definitions:
162 * Command header, rate_n_flags, txpower
164 *****************************************************************************/
166 /* iwl_cmd_header flags value */
167 #define IWL_CMD_FAILED_MSK 0x40
169 #define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
170 #define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
171 #define SEQ_TO_INDEX(s) ((s) & 0xff)
172 #define INDEX_TO_SEQ(i) ((i) & 0xff)
173 #define SEQ_HUGE_FRAME cpu_to_le16(0x4000)
174 #define SEQ_RX_FRAME cpu_to_le16(0x8000)
177 * struct iwl_cmd_header
179 * This header format appears in the beginning of each command sent from the
180 * driver, and each response/notification received from uCode.
182 struct iwl_cmd_header
{
183 u8 cmd
; /* Command ID: REPLY_RXON, etc. */
184 u8 flags
; /* 0:5 reserved, 6 abort, 7 internal */
186 * The driver sets up the sequence number to values of its choosing.
187 * uCode does not use this value, but passes it back to the driver
188 * when sending the response to each driver-originated command, so
189 * the driver can match the response to the command. Since the values
190 * don't get used by uCode, the driver may set up an arbitrary format.
192 * There is one exception: uCode sets bit 15 when it originates
193 * the response/notification, i.e. when the response/notification
194 * is not a direct response to a command sent by the driver. For
195 * example, uCode issues REPLY_3945_RX when it sends a received frame
196 * to the driver; it is not a direct response to any driver command.
198 * The Linux driver uses the following format:
200 * 0:7 tfd index - position within TX queue
203 * 14 huge - driver sets this to indicate command is in the
204 * 'huge' storage at the end of the command buffers
205 * 15 unsolicited RX or uCode-originated notification
209 /* command or response/notification data follows immediately */
215 * struct iwl3945_tx_power
217 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
219 * Each entry contains two values:
220 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
221 * linear value that multiplies the output of the digital signal processor,
222 * before being sent to the analog radio.
223 * 2) Radio gain. This sets the analog gain of the radio Tx path.
224 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
226 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
228 struct iwl3945_tx_power
{
229 u8 tx_gain
; /* gain for analog radio */
230 u8 dsp_atten
; /* gain for DSP */
234 * struct iwl3945_power_per_rate
236 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
238 struct iwl3945_power_per_rate
{
240 struct iwl3945_tx_power tpc
;
245 * iwl4965 rate_n_flags bit fields
247 * rate_n_flags format is used in following iwl4965 commands:
248 * REPLY_RX (response only)
249 * REPLY_RX_MPDU (response only)
250 * REPLY_TX (both command and response)
251 * REPLY_TX_LINK_QUALITY_CMD
253 * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"):
263 * 4-3: 0) Single stream (SISO)
264 * 1) Dual stream (MIMO)
265 * 2) Triple stream (MIMO)
267 * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps HT40 duplicate data
269 * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"):
279 * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"):
285 #define RATE_MCS_CODE_MSK 0x7
286 #define RATE_MCS_SPATIAL_POS 3
287 #define RATE_MCS_SPATIAL_MSK 0x18
288 #define RATE_MCS_HT_DUP_POS 5
289 #define RATE_MCS_HT_DUP_MSK 0x20
291 /* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */
292 #define RATE_MCS_FLAGS_POS 8
293 #define RATE_MCS_HT_POS 8
294 #define RATE_MCS_HT_MSK 0x100
296 /* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */
297 #define RATE_MCS_CCK_POS 9
298 #define RATE_MCS_CCK_MSK 0x200
300 /* Bit 10: (1) Use Green Field preamble */
301 #define RATE_MCS_GF_POS 10
302 #define RATE_MCS_GF_MSK 0x400
304 /* Bit 11: (1) Use 40Mhz HT40 chnl width, (0) use 20 MHz legacy chnl width */
305 #define RATE_MCS_HT40_POS 11
306 #define RATE_MCS_HT40_MSK 0x800
308 /* Bit 12: (1) Duplicate data on both 20MHz chnls. HT40 (bit 11) must be set. */
309 #define RATE_MCS_DUP_POS 12
310 #define RATE_MCS_DUP_MSK 0x1000
312 /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */
313 #define RATE_MCS_SGI_POS 13
314 #define RATE_MCS_SGI_MSK 0x2000
317 * rate_n_flags Tx antenna masks
318 * 4965 has 2 transmitters
321 #define RATE_MCS_ANT_POS 14
322 #define RATE_MCS_ANT_A_MSK 0x04000
323 #define RATE_MCS_ANT_B_MSK 0x08000
324 #define RATE_MCS_ANT_C_MSK 0x10000
325 #define RATE_MCS_ANT_AB_MSK (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
326 #define RATE_MCS_ANT_ABC_MSK (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
327 #define RATE_ANT_NUM 3
329 #define POWER_TABLE_NUM_ENTRIES 33
330 #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32
331 #define POWER_TABLE_CCK_ENTRY 32
333 #define IWL_PWR_NUM_HT_OFDM_ENTRIES 24
334 #define IWL_PWR_CCK_ENTRIES 2
337 * union iwl4965_tx_power_dual_stream
339 * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
340 * Use __le32 version (struct tx_power_dual_stream) when building command.
342 * Driver provides radio gain and DSP attenuation settings to device in pairs,
343 * one value for each transmitter chain. The first value is for transmitter A,
344 * second for transmitter B.
346 * For SISO bit rates, both values in a pair should be identical.
347 * For MIMO rates, one value may be different from the other,
348 * in order to balance the Tx output between the two transmitters.
350 * See more details in doc for TXPOWER in iwl-4965-hw.h.
352 union iwl4965_tx_power_dual_stream
{
355 u8 dsp_predis_atten
[2];
361 * struct tx_power_dual_stream
363 * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
365 * Same format as iwl_tx_power_dual_stream, but __le32
367 struct tx_power_dual_stream
{
372 * struct iwl4965_tx_power_db
374 * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
376 struct iwl4965_tx_power_db
{
377 struct tx_power_dual_stream power_tbl
[POWER_TABLE_NUM_ENTRIES
];
380 /******************************************************************************
382 * Alive and Error Commands & Responses:
384 *****************************************************************************/
386 #define UCODE_VALID_OK cpu_to_le32(0x1)
387 #define INITIALIZE_SUBTYPE (9)
390 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
392 * uCode issues this "initialize alive" notification once the initialization
393 * uCode image has completed its work, and is ready to load the runtime image.
394 * This is the *first* "alive" notification that the driver will receive after
395 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
397 * See comments documenting "BSM" (bootstrap state machine).
399 * For 4965, this notification contains important calibration data for
400 * calculating txpower settings:
402 * 1) Power supply voltage indication. The voltage sensor outputs higher
403 * values for lower voltage, and vice verse.
405 * 2) Temperature measurement parameters, for each of two channel widths
406 * (20 MHz and 40 MHz) supported by the radios. Temperature sensing
407 * is done via one of the receiver chains, and channel width influences
410 * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation,
411 * for each of 5 frequency ranges.
413 struct iwl_init_alive_resp
{
419 u8 ver_subtype
; /* "9" for initialize alive */
421 __le32 log_event_table_ptr
;
422 __le32 error_event_table_ptr
;
426 /* calibration values from "initialize" uCode */
427 __le32 voltage
; /* signed, higher value is lower voltage */
428 __le32 therm_r1
[2]; /* signed, 1st for normal, 2nd for HT40 */
429 __le32 therm_r2
[2]; /* signed */
430 __le32 therm_r3
[2]; /* signed */
431 __le32 therm_r4
[2]; /* signed */
432 __le32 tx_atten
[5][2]; /* signed MIMO gain comp, 5 freq groups,
438 * REPLY_ALIVE = 0x1 (response only, not a command)
440 * uCode issues this "alive" notification once the runtime image is ready
441 * to receive commands from the driver. This is the *second* "alive"
442 * notification that the driver will receive after rebooting uCode;
443 * this "alive" is indicated by subtype field != 9.
445 * See comments documenting "BSM" (bootstrap state machine).
447 * This response includes two pointers to structures within the device's
448 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
450 * 1) log_event_table_ptr indicates base of the event log. This traces
451 * a 256-entry history of uCode execution within a circular buffer.
452 * Its header format is:
454 * __le32 log_size; log capacity (in number of entries)
455 * __le32 type; (1) timestamp with each entry, (0) no timestamp
456 * __le32 wraps; # times uCode has wrapped to top of circular buffer
457 * __le32 write_index; next circular buffer entry that uCode would fill
459 * The header is followed by the circular buffer of log entries. Entries
460 * with timestamps have the following format:
462 * __le32 event_id; range 0 - 1500
463 * __le32 timestamp; low 32 bits of TSF (of network, if associated)
464 * __le32 data; event_id-specific data value
466 * Entries without timestamps contain only event_id and data.
469 * 2) error_event_table_ptr indicates base of the error log. This contains
470 * information about any uCode error that occurs. For 4965, the format
471 * of the error log is:
473 * __le32 valid; (nonzero) valid, (0) log is empty
474 * __le32 error_id; type of error
475 * __le32 pc; program counter
476 * __le32 blink1; branch link
477 * __le32 blink2; branch link
478 * __le32 ilink1; interrupt link
479 * __le32 ilink2; interrupt link
480 * __le32 data1; error-specific data
481 * __le32 data2; error-specific data
482 * __le32 line; source code line of error
483 * __le32 bcon_time; beacon timer
484 * __le32 tsf_low; network timestamp function timer
485 * __le32 tsf_hi; network timestamp function timer
486 * __le32 gp1; GP1 timer register
487 * __le32 gp2; GP2 timer register
488 * __le32 gp3; GP3 timer register
489 * __le32 ucode_ver; uCode version
490 * __le32 hw_ver; HW Silicon version
491 * __le32 brd_ver; HW board version
492 * __le32 log_pc; log program counter
493 * __le32 frame_ptr; frame pointer
494 * __le32 stack_ptr; stack pointer
495 * __le32 hcmd; last host command
496 * __le32 isr0; isr status register LMPM_NIC_ISR0: rxtx_flag
497 * __le32 isr1; isr status register LMPM_NIC_ISR1: host_flag
498 * __le32 isr2; isr status register LMPM_NIC_ISR2: enc_flag
499 * __le32 isr3; isr status register LMPM_NIC_ISR3: time_flag
500 * __le32 isr4; isr status register LMPM_NIC_ISR4: wico interrupt
501 * __le32 isr_pref; isr status register LMPM_NIC_PREF_STAT
502 * __le32 wait_event; wait event() caller address
503 * __le32 l2p_control; L2pControlField
504 * __le32 l2p_duration; L2pDurationField
505 * __le32 l2p_mhvalid; L2pMhValidBits
506 * __le32 l2p_addr_match; L2pAddrMatchStat
507 * __le32 lmpm_pmg_sel; indicate which clocks are turned on (LMPM_PMG_SEL)
508 * __le32 u_timestamp; indicate when the date and time of the compilation
511 * The Linux driver can print both logs to the system log when a uCode error
514 struct iwl_alive_resp
{
520 u8 ver_subtype
; /* not "9" for runtime alive */
522 __le32 log_event_table_ptr
; /* SRAM address for event log */
523 __le32 error_event_table_ptr
; /* SRAM address for error log */
529 * REPLY_ERROR = 0x2 (response only, not a command)
531 struct iwl_error_resp
{
535 __le16 bad_cmd_seq_num
;
540 /******************************************************************************
542 * RXON Commands & Responses:
544 *****************************************************************************/
547 * Rx config defines & structure
549 /* rx_config device types */
551 RXON_DEV_TYPE_AP
= 1,
552 RXON_DEV_TYPE_ESS
= 3,
553 RXON_DEV_TYPE_IBSS
= 4,
554 RXON_DEV_TYPE_SNIFFER
= 6,
558 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK cpu_to_le16(0x1 << 0)
559 #define RXON_RX_CHAIN_DRIVER_FORCE_POS (0)
560 #define RXON_RX_CHAIN_VALID_MSK cpu_to_le16(0x7 << 1)
561 #define RXON_RX_CHAIN_VALID_POS (1)
562 #define RXON_RX_CHAIN_FORCE_SEL_MSK cpu_to_le16(0x7 << 4)
563 #define RXON_RX_CHAIN_FORCE_SEL_POS (4)
564 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK cpu_to_le16(0x7 << 7)
565 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7)
566 #define RXON_RX_CHAIN_CNT_MSK cpu_to_le16(0x3 << 10)
567 #define RXON_RX_CHAIN_CNT_POS (10)
568 #define RXON_RX_CHAIN_MIMO_CNT_MSK cpu_to_le16(0x3 << 12)
569 #define RXON_RX_CHAIN_MIMO_CNT_POS (12)
570 #define RXON_RX_CHAIN_MIMO_FORCE_MSK cpu_to_le16(0x1 << 14)
571 #define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
573 /* rx_config flags */
574 /* band & modulation selection */
575 #define RXON_FLG_BAND_24G_MSK cpu_to_le32(1 << 0)
576 #define RXON_FLG_CCK_MSK cpu_to_le32(1 << 1)
577 /* auto detection enable */
578 #define RXON_FLG_AUTO_DETECT_MSK cpu_to_le32(1 << 2)
579 /* TGg protection when tx */
580 #define RXON_FLG_TGG_PROTECT_MSK cpu_to_le32(1 << 3)
581 /* cck short slot & preamble */
582 #define RXON_FLG_SHORT_SLOT_MSK cpu_to_le32(1 << 4)
583 #define RXON_FLG_SHORT_PREAMBLE_MSK cpu_to_le32(1 << 5)
584 /* antenna selection */
585 #define RXON_FLG_DIS_DIV_MSK cpu_to_le32(1 << 7)
586 #define RXON_FLG_ANT_SEL_MSK cpu_to_le32(0x0f00)
587 #define RXON_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
588 #define RXON_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
589 /* radar detection enable */
590 #define RXON_FLG_RADAR_DETECT_MSK cpu_to_le32(1 << 12)
591 #define RXON_FLG_TGJ_NARROW_BAND_MSK cpu_to_le32(1 << 13)
592 /* rx response to host with 8-byte TSF
593 * (according to ON_AIR deassertion) */
594 #define RXON_FLG_TSF2HOST_MSK cpu_to_le32(1 << 15)
598 #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22)
599 #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK cpu_to_le32(0x1 << 22)
601 #define RXON_FLG_HT_OPERATING_MODE_POS (23)
603 #define RXON_FLG_HT_PROT_MSK cpu_to_le32(0x1 << 23)
604 #define RXON_FLG_HT40_PROT_MSK cpu_to_le32(0x2 << 23)
606 #define RXON_FLG_CHANNEL_MODE_POS (25)
607 #define RXON_FLG_CHANNEL_MODE_MSK cpu_to_le32(0x3 << 25)
611 CHANNEL_MODE_LEGACY
= 0,
612 CHANNEL_MODE_PURE_40
= 1,
613 CHANNEL_MODE_MIXED
= 2,
614 CHANNEL_MODE_RESERVED
= 3,
616 #define RXON_FLG_CHANNEL_MODE_LEGACY \
617 cpu_to_le32(CHANNEL_MODE_LEGACY << RXON_FLG_CHANNEL_MODE_POS)
618 #define RXON_FLG_CHANNEL_MODE_PURE_40 \
619 cpu_to_le32(CHANNEL_MODE_PURE_40 << RXON_FLG_CHANNEL_MODE_POS)
620 #define RXON_FLG_CHANNEL_MODE_MIXED \
621 cpu_to_le32(CHANNEL_MODE_MIXED << RXON_FLG_CHANNEL_MODE_POS)
623 /* CTS to self (if spec allows) flag */
624 #define RXON_FLG_SELF_CTS_EN cpu_to_le32(0x1<<30)
626 /* rx_config filter flags */
627 /* accept all data frames */
628 #define RXON_FILTER_PROMISC_MSK cpu_to_le32(1 << 0)
629 /* pass control & management to host */
630 #define RXON_FILTER_CTL2HOST_MSK cpu_to_le32(1 << 1)
631 /* accept multi-cast */
632 #define RXON_FILTER_ACCEPT_GRP_MSK cpu_to_le32(1 << 2)
633 /* don't decrypt uni-cast frames */
634 #define RXON_FILTER_DIS_DECRYPT_MSK cpu_to_le32(1 << 3)
635 /* don't decrypt multi-cast frames */
636 #define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
637 /* STA is associated */
638 #define RXON_FILTER_ASSOC_MSK cpu_to_le32(1 << 5)
639 /* transfer to host non bssid beacons in associated state */
640 #define RXON_FILTER_BCON_AWARE_MSK cpu_to_le32(1 << 6)
643 * REPLY_RXON = 0x10 (command, has simple generic response)
645 * RXON tunes the radio tuner to a service channel, and sets up a number
646 * of parameters that are used primarily for Rx, but also for Tx operations.
648 * NOTE: When tuning to a new channel, driver must set the
649 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
650 * info within the device, including the station tables, tx retry
651 * rate tables, and txpower tables. Driver must build a new station
652 * table and txpower table before transmitting anything on the RXON
655 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
656 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
657 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
660 struct iwl3945_rxon_cmd
{
665 u8 wlap_bssid_addr
[6];
679 struct iwl4965_rxon_cmd
{
684 u8 wlap_bssid_addr
[6];
695 u8 ofdm_ht_single_stream_basic_rates
;
696 u8 ofdm_ht_dual_stream_basic_rates
;
699 /* Create a common rxon cmd which will be typecast into the 3945 or 4965
700 * specific rxon cmd, depending on where it is called from.
702 struct iwl_legacy_rxon_cmd
{
707 u8 wlap_bssid_addr
[6];
718 u8 ofdm_ht_single_stream_basic_rates
;
719 u8 ofdm_ht_dual_stream_basic_rates
;
726 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
728 struct iwl3945_rxon_assoc_cmd
{
736 struct iwl4965_rxon_assoc_cmd
{
741 u8 ofdm_ht_single_stream_basic_rates
;
742 u8 ofdm_ht_dual_stream_basic_rates
;
743 __le16 rx_chain_select_flags
;
747 #define IWL_CONN_MAX_LISTEN_INTERVAL 10
748 #define IWL_MAX_UCODE_BEACON_INTERVAL 4 /* 4096 */
749 #define IWL39_MAX_UCODE_BEACON_INTERVAL 1 /* 1024 */
752 * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
754 struct iwl_rxon_time_cmd
{
756 __le16 beacon_interval
;
758 __le32 beacon_init_val
;
759 __le16 listen_interval
;
761 u8 delta_cp_bss_tbtts
;
765 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
767 struct iwl3945_channel_switch_cmd
{
772 __le32 rxon_filter_flags
;
774 struct iwl3945_power_per_rate power
[IWL_MAX_RATES
];
777 struct iwl4965_channel_switch_cmd
{
782 __le32 rxon_filter_flags
;
784 struct iwl4965_tx_power_db tx_power
;
788 * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
790 struct iwl_csa_notification
{
793 __le32 status
; /* 0 - OK, 1 - fail */
796 /******************************************************************************
798 * Quality-of-Service (QOS) Commands & Responses:
800 *****************************************************************************/
803 * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
804 * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
806 * @cw_min: Contention window, start value in numbers of slots.
807 * Should be a power-of-2, minus 1. Device's default is 0x0f.
808 * @cw_max: Contention window, max value in numbers of slots.
809 * Should be a power-of-2, minus 1. Device's default is 0x3f.
810 * @aifsn: Number of slots in Arbitration Interframe Space (before
811 * performing random backoff timing prior to Tx). Device default 1.
812 * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0.
814 * Device will automatically increase contention window by (2*CW) + 1 for each
815 * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW
816 * value, to cap the CW value.
826 /* QoS flags defines */
827 #define QOS_PARAM_FLG_UPDATE_EDCA_MSK cpu_to_le32(0x01)
828 #define QOS_PARAM_FLG_TGN_MSK cpu_to_le32(0x02)
829 #define QOS_PARAM_FLG_TXOP_TYPE_MSK cpu_to_le32(0x10)
831 /* Number of Access Categories (AC) (EDCA), queues 0..3 */
835 * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
837 * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
838 * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
840 struct iwl_qosparam_cmd
{
842 struct iwl_ac_qos ac
[AC_NUM
];
845 /******************************************************************************
847 * Add/Modify Stations Commands & Responses:
849 *****************************************************************************/
851 * Multi station support
854 /* Special, dedicated locations within device's station table */
857 #define IWL3945_BROADCAST_ID 24
858 #define IWL3945_STATION_COUNT 25
859 #define IWL4965_BROADCAST_ID 31
860 #define IWL4965_STATION_COUNT 32
862 #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/
863 #define IWL_INVALID_STATION 255
865 #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
866 #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
867 #define STA_FLG_RTS_MIMO_PROT_MSK cpu_to_le32(1 << 17)
868 #define STA_FLG_AGG_MPDU_8US_MSK cpu_to_le32(1 << 18)
869 #define STA_FLG_MAX_AGG_SIZE_POS (19)
870 #define STA_FLG_MAX_AGG_SIZE_MSK cpu_to_le32(3 << 19)
871 #define STA_FLG_HT40_EN_MSK cpu_to_le32(1 << 21)
872 #define STA_FLG_MIMO_DIS_MSK cpu_to_le32(1 << 22)
873 #define STA_FLG_AGG_MPDU_DENSITY_POS (23)
874 #define STA_FLG_AGG_MPDU_DENSITY_MSK cpu_to_le32(7 << 23)
876 /* Use in mode field. 1: modify existing entry, 0: add new station entry */
877 #define STA_CONTROL_MODIFY_MSK 0x01
879 /* key flags __le16*/
880 #define STA_KEY_FLG_ENCRYPT_MSK cpu_to_le16(0x0007)
881 #define STA_KEY_FLG_NO_ENC cpu_to_le16(0x0000)
882 #define STA_KEY_FLG_WEP cpu_to_le16(0x0001)
883 #define STA_KEY_FLG_CCMP cpu_to_le16(0x0002)
884 #define STA_KEY_FLG_TKIP cpu_to_le16(0x0003)
886 #define STA_KEY_FLG_KEYID_POS 8
887 #define STA_KEY_FLG_INVALID cpu_to_le16(0x0800)
888 /* wep key is either from global key (0) or from station info array (1) */
889 #define STA_KEY_FLG_MAP_KEY_MSK cpu_to_le16(0x0008)
891 /* wep key in STA: 5-bytes (0) or 13-bytes (1) */
892 #define STA_KEY_FLG_KEY_SIZE_MSK cpu_to_le16(0x1000)
893 #define STA_KEY_MULTICAST_MSK cpu_to_le16(0x4000)
894 #define STA_KEY_MAX_NUM 8
896 /* Flags indicate whether to modify vs. don't change various station params */
897 #define STA_MODIFY_KEY_MASK 0x01
898 #define STA_MODIFY_TID_DISABLE_TX 0x02
899 #define STA_MODIFY_TX_RATE_MSK 0x04
900 #define STA_MODIFY_ADDBA_TID_MSK 0x08
901 #define STA_MODIFY_DELBA_TID_MSK 0x10
902 #define STA_MODIFY_SLEEP_TX_COUNT_MSK 0x20
904 /* Receiver address (actually, Rx station's index into station table),
905 * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */
906 #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid))
908 struct iwl4965_keyinfo
{
910 u8 tkip_rx_tsc_byte2
; /* TSC[2] for key mix ph1 detection */
912 __le16 tkip_rx_ttak
[5]; /* 10-byte unicast TKIP TTAK */
915 u8 key
[16]; /* 16-byte unicast decryption key */
919 * struct sta_id_modify
920 * @addr[ETH_ALEN]: station's MAC address
921 * @sta_id: index of station in uCode's station table
922 * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
924 * Driver selects unused table index when adding new station,
925 * or the index to a pre-existing station entry when modifying that station.
926 * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
928 * modify_mask flags select which parameters to modify vs. leave alone.
930 struct sta_id_modify
{
939 * REPLY_ADD_STA = 0x18 (command)
941 * The device contains an internal table of per-station information,
942 * with info on security keys, aggregation parameters, and Tx rates for
943 * initial Tx attempt and any retries (4965 devices uses
944 * REPLY_TX_LINK_QUALITY_CMD,
945 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
947 * REPLY_ADD_STA sets up the table entry for one station, either creating
948 * a new entry, or modifying a pre-existing one.
950 * NOTE: RXON command (without "associated" bit set) wipes the station table
951 * clean. Moving into RF_KILL state does this also. Driver must set up
952 * new station table before transmitting anything on the RXON channel
953 * (except active scans or active measurements; those commands carry
954 * their own txpower/rate setup data).
956 * When getting started on a new channel, driver must set up the
957 * IWL_BROADCAST_ID entry (last entry in the table). For a client
958 * station in a BSS, once an AP is selected, driver sets up the AP STA
959 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
960 * are all that are needed for a BSS client station. If the device is
961 * used as AP, or in an IBSS network, driver must set up station table
962 * entries for all STAs in network, starting with index IWL_STA_ID.
965 struct iwl3945_addsta_cmd
{
966 u8 mode
; /* 1: modify existing, 0: add new station */
968 struct sta_id_modify sta
;
969 struct iwl4965_keyinfo key
;
970 __le32 station_flags
; /* STA_FLG_* */
971 __le32 station_flags_msk
; /* STA_FLG_* */
973 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
974 * corresponding to bit (e.g. bit 5 controls TID 5).
975 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
976 __le16 tid_disable_tx
;
980 /* TID for which to add block-ack support.
981 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
982 u8 add_immediate_ba_tid
;
984 /* TID for which to remove block-ack support.
985 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
986 u8 remove_immediate_ba_tid
;
988 /* Starting Sequence Number for added block-ack support.
989 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
990 __le16 add_immediate_ba_ssn
;
993 struct iwl4965_addsta_cmd
{
994 u8 mode
; /* 1: modify existing, 0: add new station */
996 struct sta_id_modify sta
;
997 struct iwl4965_keyinfo key
;
998 __le32 station_flags
; /* STA_FLG_* */
999 __le32 station_flags_msk
; /* STA_FLG_* */
1001 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1002 * corresponding to bit (e.g. bit 5 controls TID 5).
1003 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1004 __le16 tid_disable_tx
;
1008 /* TID for which to add block-ack support.
1009 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1010 u8 add_immediate_ba_tid
;
1012 /* TID for which to remove block-ack support.
1013 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1014 u8 remove_immediate_ba_tid
;
1016 /* Starting Sequence Number for added block-ack support.
1017 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1018 __le16 add_immediate_ba_ssn
;
1021 * Number of packets OK to transmit to station even though
1022 * it is asleep -- used to synchronise PS-poll and u-APSD
1023 * responses while ucode keeps track of STA sleep state.
1025 __le16 sleep_tx_count
;
1030 /* Wrapper struct for 3945 and 4965 addsta_cmd structures */
1031 struct iwl_legacy_addsta_cmd
{
1032 u8 mode
; /* 1: modify existing, 0: add new station */
1034 struct sta_id_modify sta
;
1035 struct iwl4965_keyinfo key
;
1036 __le32 station_flags
; /* STA_FLG_* */
1037 __le32 station_flags_msk
; /* STA_FLG_* */
1039 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
1040 * corresponding to bit (e.g. bit 5 controls TID 5).
1041 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
1042 __le16 tid_disable_tx
;
1044 __le16 rate_n_flags
; /* 3945 only */
1046 /* TID for which to add block-ack support.
1047 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1048 u8 add_immediate_ba_tid
;
1050 /* TID for which to remove block-ack support.
1051 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1052 u8 remove_immediate_ba_tid
;
1054 /* Starting Sequence Number for added block-ack support.
1055 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1056 __le16 add_immediate_ba_ssn
;
1059 * Number of packets OK to transmit to station even though
1060 * it is asleep -- used to synchronise PS-poll and u-APSD
1061 * responses while ucode keeps track of STA sleep state.
1063 __le16 sleep_tx_count
;
1069 #define ADD_STA_SUCCESS_MSK 0x1
1070 #define ADD_STA_NO_ROOM_IN_TABLE 0x2
1071 #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4
1072 #define ADD_STA_MODIFY_NON_EXIST_STA 0x8
1074 * REPLY_ADD_STA = 0x18 (response)
1076 struct iwl_add_sta_resp
{
1077 u8 status
; /* ADD_STA_* */
1080 #define REM_STA_SUCCESS_MSK 0x1
1082 * REPLY_REM_STA = 0x19 (response)
1084 struct iwl_rem_sta_resp
{
1089 * REPLY_REM_STA = 0x19 (command)
1091 struct iwl_rem_sta_cmd
{
1092 u8 num_sta
; /* number of removed stations */
1094 u8 addr
[ETH_ALEN
]; /* MAC addr of the first station */
1098 #define IWL_TX_FIFO_BK_MSK cpu_to_le32(BIT(0))
1099 #define IWL_TX_FIFO_BE_MSK cpu_to_le32(BIT(1))
1100 #define IWL_TX_FIFO_VI_MSK cpu_to_le32(BIT(2))
1101 #define IWL_TX_FIFO_VO_MSK cpu_to_le32(BIT(3))
1102 #define IWL_AGG_TX_QUEUE_MSK cpu_to_le32(0xffc00)
1104 #define IWL_DROP_SINGLE 0
1105 #define IWL_DROP_SELECTED 1
1106 #define IWL_DROP_ALL 2
1109 * REPLY_WEP_KEY = 0x20
1111 struct iwl_wep_key
{
1120 struct iwl_wep_cmd
{
1125 struct iwl_wep_key key
[0];
1128 #define WEP_KEY_WEP_TYPE 1
1129 #define WEP_KEYS_MAX 4
1130 #define WEP_INVALID_OFFSET 0xff
1131 #define WEP_KEY_LEN_64 5
1132 #define WEP_KEY_LEN_128 13
1134 /******************************************************************************
1138 *****************************************************************************/
1140 #define RX_RES_STATUS_NO_CRC32_ERROR cpu_to_le32(1 << 0)
1141 #define RX_RES_STATUS_NO_RXE_OVERFLOW cpu_to_le32(1 << 1)
1143 #define RX_RES_PHY_FLAGS_BAND_24_MSK cpu_to_le16(1 << 0)
1144 #define RX_RES_PHY_FLAGS_MOD_CCK_MSK cpu_to_le16(1 << 1)
1145 #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK cpu_to_le16(1 << 2)
1146 #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK cpu_to_le16(1 << 3)
1147 #define RX_RES_PHY_FLAGS_ANTENNA_MSK 0xf0
1148 #define RX_RES_PHY_FLAGS_ANTENNA_POS 4
1150 #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8)
1151 #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8)
1152 #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8)
1153 #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8)
1154 #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8)
1155 #define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8)
1157 #define RX_RES_STATUS_STATION_FOUND (1<<6)
1158 #define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
1160 #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
1161 #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11)
1162 #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11)
1163 #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11)
1164 #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11)
1166 #define RX_MPDU_RES_STATUS_ICV_OK (0x20)
1167 #define RX_MPDU_RES_STATUS_MIC_OK (0x40)
1168 #define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1169 #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1172 struct iwl3945_rx_frame_stats
{
1182 struct iwl3945_rx_frame_hdr
{
1191 struct iwl3945_rx_frame_end
{
1194 __le32 beacon_timestamp
;
1198 * REPLY_3945_RX = 0x1b (response only, not a command)
1200 * NOTE: DO NOT dereference from casts to this structure
1201 * It is provided only for calculating minimum data set size.
1202 * The actual offsets of the hdr and end are dynamic based on
1205 struct iwl3945_rx_frame
{
1206 struct iwl3945_rx_frame_stats stats
;
1207 struct iwl3945_rx_frame_hdr hdr
;
1208 struct iwl3945_rx_frame_end end
;
1211 #define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1213 /* Fixed (non-configurable) rx data from phy */
1215 #define IWL49_RX_RES_PHY_CNT 14
1216 #define IWL49_RX_PHY_FLAGS_ANTENNAE_OFFSET (4)
1217 #define IWL49_RX_PHY_FLAGS_ANTENNAE_MASK (0x70)
1218 #define IWL49_AGC_DB_MASK (0x3f80) /* MASK(7,13) */
1219 #define IWL49_AGC_DB_POS (7)
1220 struct iwl4965_rx_non_cfg_phy
{
1221 __le16 ant_selection
; /* ant A bit 4, ant B bit 5, ant C bit 6 */
1222 __le16 agc_info
; /* agc code 0:6, agc dB 7:13, reserved 14:15 */
1223 u8 rssi_info
[6]; /* we use even entries, 0/2/4 for A/B/C rssi */
1229 * REPLY_RX = 0xc3 (response only, not a command)
1230 * Used only for legacy (non 11n) frames.
1232 struct iwl_rx_phy_res
{
1233 u8 non_cfg_phy_cnt
; /* non configurable DSP phy data byte count */
1234 u8 cfg_phy_cnt
; /* configurable DSP phy data byte count */
1235 u8 stat_id
; /* configurable DSP phy data set ID */
1237 __le64 timestamp
; /* TSF at on air rise */
1238 __le32 beacon_time_stamp
; /* beacon at on-air rise */
1239 __le16 phy_flags
; /* general phy flags: band, modulation, ... */
1240 __le16 channel
; /* channel number */
1241 u8 non_cfg_phy_buf
[32]; /* for various implementations of non_cfg_phy */
1242 __le32 rate_n_flags
; /* RATE_MCS_* */
1243 __le16 byte_count
; /* frame's byte-count */
1244 __le16 frame_time
; /* frame's time on the air */
1247 struct iwl_rx_mpdu_res_start
{
1253 /******************************************************************************
1255 * Tx Commands & Responses:
1257 * Driver must place each REPLY_TX command into one of the prioritized Tx
1258 * queues in host DRAM, shared between driver and device (see comments for
1259 * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode
1260 * are preparing to transmit, the device pulls the Tx command over the PCI
1261 * bus via one of the device's Tx DMA channels, to fill an internal FIFO
1262 * from which data will be transmitted.
1264 * uCode handles all timing and protocol related to control frames
1265 * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler
1266 * handle reception of block-acks; uCode updates the host driver via
1267 * REPLY_COMPRESSED_BA.
1269 * uCode handles retrying Tx when an ACK is expected but not received.
1270 * This includes trying lower data rates than the one requested in the Tx
1271 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
1272 * REPLY_TX_LINK_QUALITY_CMD (4965).
1274 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
1275 * This command must be executed after every RXON command, before Tx can occur.
1276 *****************************************************************************/
1278 /* REPLY_TX Tx flags field */
1281 * 1: Use Request-To-Send protocol before this frame.
1282 * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK.
1284 #define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
1287 * 1: Transmit Clear-To-Send to self before this frame.
1288 * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
1289 * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK.
1291 #define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
1293 /* 1: Expect ACK from receiving station
1294 * 0: Don't expect ACK (MAC header's duration field s/b 0)
1295 * Set this for unicast frames, but not broadcast/multicast. */
1296 #define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
1298 /* For 4965 devices:
1299 * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
1300 * Tx command's initial_rate_index indicates first rate to try;
1301 * uCode walks through table for additional Tx attempts.
1302 * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
1303 * This rate will be used for all Tx attempts; it will not be scaled. */
1304 #define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
1306 /* 1: Expect immediate block-ack.
1307 * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */
1308 #define TX_CMD_FLG_IMM_BA_RSP_MASK cpu_to_le32(1 << 6)
1311 * 1: Frame requires full Tx-Op protection.
1312 * Set this if either RTS or CTS Tx Flag gets set.
1314 #define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
1316 /* Tx antenna selection field; used only for 3945, reserved (0) for 4965 devices.
1317 * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
1318 #define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
1319 #define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
1320 #define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
1322 /* 1: uCode overrides sequence control field in MAC header.
1323 * 0: Driver provides sequence control field in MAC header.
1324 * Set this for management frames, non-QOS data frames, non-unicast frames,
1325 * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
1326 #define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
1328 /* 1: This frame is non-last MPDU; more fragments are coming.
1329 * 0: Last fragment, or not using fragmentation. */
1330 #define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
1332 /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
1333 * 0: No TSF required in outgoing frame.
1334 * Set this for transmitting beacons and probe responses. */
1335 #define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
1337 /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
1338 * alignment of frame's payload data field.
1340 * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
1341 * field (but not both). Driver must align frame data (i.e. data following
1342 * MAC header) to DWORD boundary. */
1343 #define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
1345 /* accelerate aggregation support
1346 * 0 - no CCMP encryption; 1 - CCMP encryption */
1347 #define TX_CMD_FLG_AGG_CCMP_MSK cpu_to_le32(1 << 22)
1349 /* HCCA-AP - disable duration overwriting. */
1350 #define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
1354 * TX command security control
1356 #define TX_CMD_SEC_WEP 0x01
1357 #define TX_CMD_SEC_CCM 0x02
1358 #define TX_CMD_SEC_TKIP 0x03
1359 #define TX_CMD_SEC_MSK 0x03
1360 #define TX_CMD_SEC_SHIFT 6
1361 #define TX_CMD_SEC_KEY128 0x08
1364 * security overhead sizes
1366 #define WEP_IV_LEN 4
1367 #define WEP_ICV_LEN 4
1368 #define CCMP_MIC_LEN 8
1369 #define TKIP_ICV_LEN 4
1372 * REPLY_TX = 0x1c (command)
1375 struct iwl3945_tx_cmd
{
1378 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1379 * + 8 byte IV for CCM or TKIP (not used for WEP)
1381 * + 8-byte MIC (not used for CCM/WEP)
1382 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1383 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1384 * Range: 14-2342 bytes.
1389 * MPDU or MSDU byte count for next frame.
1390 * Used for fragmentation and bursting, but not 11n aggregation.
1391 * Same as "len", but for next frame. Set to 0 if not applicable.
1393 __le16 next_frame_len
;
1395 __le32 tx_flags
; /* TX_CMD_FLG_* */
1399 /* Index of recipient station in uCode's station table */
1409 __le32 next_frame_info
;
1415 u8 rts_retry_limit
; /*byte 50 */
1416 u8 data_retry_limit
; /*byte 51 */
1418 __le16 pm_frame_timeout
;
1419 __le16 attempt_duration
;
1423 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1424 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1429 * MAC header goes here, followed by 2 bytes padding if MAC header
1430 * length is 26 or 30 bytes, followed by payload data
1433 struct ieee80211_hdr hdr
[0];
1437 * REPLY_TX = 0x1c (response)
1439 struct iwl3945_tx_resp
{
1444 __le32 wireless_media_time
;
1445 __le32 status
; /* TX status */
1450 * 4965 uCode updates these Tx attempt count values in host DRAM.
1451 * Used for managing Tx retries when expecting block-acks.
1452 * Driver should set these fields to 0.
1454 struct iwl_dram_scratch
{
1455 u8 try_cnt
; /* Tx attempts */
1456 u8 bt_kill_cnt
; /* Tx attempts blocked by Bluetooth device */
1463 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1464 * + 8 byte IV for CCM or TKIP (not used for WEP)
1466 * + 8-byte MIC (not used for CCM/WEP)
1467 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1468 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1469 * Range: 14-2342 bytes.
1474 * MPDU or MSDU byte count for next frame.
1475 * Used for fragmentation and bursting, but not 11n aggregation.
1476 * Same as "len", but for next frame. Set to 0 if not applicable.
1478 __le16 next_frame_len
;
1480 __le32 tx_flags
; /* TX_CMD_FLG_* */
1482 /* uCode may modify this field of the Tx command (in host DRAM!).
1483 * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */
1484 struct iwl_dram_scratch scratch
;
1486 /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */
1487 __le32 rate_n_flags
; /* RATE_MCS_* */
1489 /* Index of destination station in uCode's station table */
1492 /* Type of security encryption: CCM or TKIP */
1493 u8 sec_ctl
; /* TX_CMD_SEC_* */
1496 * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial
1497 * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for
1498 * data frames, this field may be used to selectively reduce initial
1499 * rate (via non-0 value) for special frames (e.g. management), while
1500 * still supporting rate scaling for all frames.
1502 u8 initial_rate_index
;
1505 __le16 next_frame_flags
;
1512 /* Host DRAM physical address pointer to "scratch" in this command.
1513 * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */
1514 __le32 dram_lsb_ptr
;
1517 u8 rts_retry_limit
; /*byte 50 */
1518 u8 data_retry_limit
; /*byte 51 */
1521 __le16 pm_frame_timeout
;
1522 __le16 attempt_duration
;
1526 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1527 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1532 * MAC header goes here, followed by 2 bytes padding if MAC header
1533 * length is 26 or 30 bytes, followed by payload data
1536 struct ieee80211_hdr hdr
[0];
1539 /* TX command response is sent after *3945* transmission attempts.
1543 * TX_STATUS_FAIL_NEXT_FRAG
1545 * If the fragment flag in the MAC header for the frame being transmitted
1546 * is set and there is insufficient time to transmit the next frame, the
1547 * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
1549 * TX_STATUS_FIFO_UNDERRUN
1551 * Indicates the host did not provide bytes to the FIFO fast enough while
1552 * a TX was in progress.
1554 * TX_STATUS_FAIL_MGMNT_ABORT
1556 * This status is only possible if the ABORT ON MGMT RX parameter was
1557 * set to true with the TX command.
1559 * If the MSB of the status parameter is set then an abort sequence is
1560 * required. This sequence consists of the host activating the TX Abort
1561 * control line, and then waiting for the TX Abort command response. This
1562 * indicates that a the device is no longer in a transmit state, and that the
1563 * command FIFO has been cleared. The host must then deactivate the TX Abort
1564 * control line. Receiving is still allowed in this case.
1567 TX_3945_STATUS_SUCCESS
= 0x01,
1568 TX_3945_STATUS_DIRECT_DONE
= 0x02,
1569 TX_3945_STATUS_FAIL_SHORT_LIMIT
= 0x82,
1570 TX_3945_STATUS_FAIL_LONG_LIMIT
= 0x83,
1571 TX_3945_STATUS_FAIL_FIFO_UNDERRUN
= 0x84,
1572 TX_3945_STATUS_FAIL_MGMNT_ABORT
= 0x85,
1573 TX_3945_STATUS_FAIL_NEXT_FRAG
= 0x86,
1574 TX_3945_STATUS_FAIL_LIFE_EXPIRE
= 0x87,
1575 TX_3945_STATUS_FAIL_DEST_PS
= 0x88,
1576 TX_3945_STATUS_FAIL_ABORTED
= 0x89,
1577 TX_3945_STATUS_FAIL_BT_RETRY
= 0x8a,
1578 TX_3945_STATUS_FAIL_STA_INVALID
= 0x8b,
1579 TX_3945_STATUS_FAIL_FRAG_DROPPED
= 0x8c,
1580 TX_3945_STATUS_FAIL_TID_DISABLE
= 0x8d,
1581 TX_3945_STATUS_FAIL_FRAME_FLUSHED
= 0x8e,
1582 TX_3945_STATUS_FAIL_INSUFFICIENT_CF_POLL
= 0x8f,
1583 TX_3945_STATUS_FAIL_TX_LOCKED
= 0x90,
1584 TX_3945_STATUS_FAIL_NO_BEACON_ON_RADAR
= 0x91,
1588 * TX command response is sent after *4965* transmission attempts.
1590 * both postpone and abort status are expected behavior from uCode. there is
1591 * no special operation required from driver; except for RFKILL_FLUSH,
1592 * which required tx flush host command to flush all the tx frames in queues
1595 TX_STATUS_SUCCESS
= 0x01,
1596 TX_STATUS_DIRECT_DONE
= 0x02,
1598 TX_STATUS_POSTPONE_DELAY
= 0x40,
1599 TX_STATUS_POSTPONE_FEW_BYTES
= 0x41,
1600 TX_STATUS_POSTPONE_QUIET_PERIOD
= 0x43,
1601 TX_STATUS_POSTPONE_CALC_TTAK
= 0x44,
1603 TX_STATUS_FAIL_INTERNAL_CROSSED_RETRY
= 0x81,
1604 TX_STATUS_FAIL_SHORT_LIMIT
= 0x82,
1605 TX_STATUS_FAIL_LONG_LIMIT
= 0x83,
1606 TX_STATUS_FAIL_FIFO_UNDERRUN
= 0x84,
1607 TX_STATUS_FAIL_DRAIN_FLOW
= 0x85,
1608 TX_STATUS_FAIL_RFKILL_FLUSH
= 0x86,
1609 TX_STATUS_FAIL_LIFE_EXPIRE
= 0x87,
1610 TX_STATUS_FAIL_DEST_PS
= 0x88,
1611 TX_STATUS_FAIL_HOST_ABORTED
= 0x89,
1612 TX_STATUS_FAIL_BT_RETRY
= 0x8a,
1613 TX_STATUS_FAIL_STA_INVALID
= 0x8b,
1614 TX_STATUS_FAIL_FRAG_DROPPED
= 0x8c,
1615 TX_STATUS_FAIL_TID_DISABLE
= 0x8d,
1616 TX_STATUS_FAIL_FIFO_FLUSHED
= 0x8e,
1617 TX_STATUS_FAIL_INSUFFICIENT_CF_POLL
= 0x8f,
1618 TX_STATUS_FAIL_PASSIVE_NO_RX
= 0x90,
1619 TX_STATUS_FAIL_NO_BEACON_ON_RADAR
= 0x91,
1622 #define TX_PACKET_MODE_REGULAR 0x0000
1623 #define TX_PACKET_MODE_BURST_SEQ 0x0100
1624 #define TX_PACKET_MODE_BURST_FIRST 0x0200
1627 TX_POWER_PA_NOT_ACTIVE
= 0x0,
1631 TX_STATUS_MSK
= 0x000000ff, /* bits 0:7 */
1632 TX_STATUS_DELAY_MSK
= 0x00000040,
1633 TX_STATUS_ABORT_MSK
= 0x00000080,
1634 TX_PACKET_MODE_MSK
= 0x0000ff00, /* bits 8:15 */
1635 TX_FIFO_NUMBER_MSK
= 0x00070000, /* bits 16:18 */
1636 TX_RESERVED
= 0x00780000, /* bits 19:22 */
1637 TX_POWER_PA_DETECT_MSK
= 0x7f800000, /* bits 23:30 */
1638 TX_ABORT_REQUIRED_MSK
= 0x80000000, /* bits 31:31 */
1641 /* *******************************
1642 * TX aggregation status
1643 ******************************* */
1646 AGG_TX_STATE_TRANSMITTED
= 0x00,
1647 AGG_TX_STATE_UNDERRUN_MSK
= 0x01,
1648 AGG_TX_STATE_FEW_BYTES_MSK
= 0x04,
1649 AGG_TX_STATE_ABORT_MSK
= 0x08,
1650 AGG_TX_STATE_LAST_SENT_TTL_MSK
= 0x10,
1651 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK
= 0x20,
1652 AGG_TX_STATE_SCD_QUERY_MSK
= 0x80,
1653 AGG_TX_STATE_TEST_BAD_CRC32_MSK
= 0x100,
1654 AGG_TX_STATE_RESPONSE_MSK
= 0x1ff,
1655 AGG_TX_STATE_DUMP_TX_MSK
= 0x200,
1656 AGG_TX_STATE_DELAY_TX_MSK
= 0x400
1659 #define AGG_TX_STATUS_MSK 0x00000fff /* bits 0:11 */
1660 #define AGG_TX_TRY_MSK 0x0000f000 /* bits 12:15 */
1662 #define AGG_TX_STATE_LAST_SENT_MSK (AGG_TX_STATE_LAST_SENT_TTL_MSK | \
1663 AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK)
1665 /* # tx attempts for first frame in aggregation */
1666 #define AGG_TX_STATE_TRY_CNT_POS 12
1667 #define AGG_TX_STATE_TRY_CNT_MSK 0xf000
1669 /* Command ID and sequence number of Tx command for this frame */
1670 #define AGG_TX_STATE_SEQ_NUM_POS 16
1671 #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000
1674 * REPLY_TX = 0x1c (response)
1676 * This response may be in one of two slightly different formats, indicated
1677 * by the frame_count field:
1679 * 1) No aggregation (frame_count == 1). This reports Tx results for
1680 * a single frame. Multiple attempts, at various bit rates, may have
1681 * been made for this frame.
1683 * 2) Aggregation (frame_count > 1). This reports Tx results for
1684 * 2 or more frames that used block-acknowledge. All frames were
1685 * transmitted at same rate. Rate scaling may have been used if first
1686 * frame in this new agg block failed in previous agg block(s).
1688 * Note that, for aggregation, ACK (block-ack) status is not delivered here;
1689 * block-ack has not been received by the time the 4965 device records
1691 * This status relates to reasons the tx might have been blocked or aborted
1692 * within the sending station (this 4965 device), rather than whether it was
1693 * received successfully by the destination station.
1695 struct agg_tx_status
{
1700 struct iwl4965_tx_resp
{
1701 u8 frame_count
; /* 1 no aggregation, >1 aggregation */
1702 u8 bt_kill_count
; /* # blocked by bluetooth (unused for agg) */
1703 u8 failure_rts
; /* # failures due to unsuccessful RTS */
1704 u8 failure_frame
; /* # failures due to no ACK (unused for agg) */
1706 /* For non-agg: Rate at which frame was successful.
1707 * For agg: Rate at which all frames were transmitted. */
1708 __le32 rate_n_flags
; /* RATE_MCS_* */
1710 /* For non-agg: RTS + CTS + frame tx attempts time + ACK.
1711 * For agg: RTS + CTS + aggregation tx time + block-ack time. */
1712 __le16 wireless_media_time
; /* uSecs */
1715 __le32 pa_power1
; /* RF power amplifier measurement (not used) */
1719 * For non-agg: frame status TX_STATUS_*
1720 * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status
1721 * fields follow this one, up to frame_count.
1723 * 11- 0: AGG_TX_STATE_* status code
1724 * 15-12: Retry count for 1st frame in aggregation (retries
1725 * occur if tx failed for this frame when it was a
1726 * member of a previous aggregation block). If rate
1727 * scaling is used, retry count indicates the rate
1728 * table entry used for all frames in the new agg.
1729 * 31-16: Sequence # for this frame's Tx cmd (not SSN!)
1733 struct agg_tx_status agg_status
[0]; /* for each agg frame */
1738 * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
1740 * Reports Block-Acknowledge from recipient station
1742 struct iwl_compressed_ba_resp
{
1743 __le32 sta_addr_lo32
;
1744 __le16 sta_addr_hi16
;
1747 /* Index of recipient (BA-sending) station in uCode's station table */
1757 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
1759 * See details under "TXPOWER" in iwl-4965-hw.h.
1762 struct iwl3945_txpowertable_cmd
{
1763 u8 band
; /* 0: 5 GHz, 1: 2.4 GHz */
1766 struct iwl3945_power_per_rate power
[IWL_MAX_RATES
];
1769 struct iwl4965_txpowertable_cmd
{
1770 u8 band
; /* 0: 5 GHz, 1: 2.4 GHz */
1773 struct iwl4965_tx_power_db tx_power
;
1778 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
1780 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
1782 * NOTE: The table of rates passed to the uCode via the
1783 * RATE_SCALE command sets up the corresponding order of
1784 * rates used for all related commands, including rate
1787 * For example, if you set 9MB (PLCP 0x0f) as the first
1788 * rate in the rate table, the bit mask for that rate
1789 * when passed through ofdm_basic_rates on the REPLY_RXON
1790 * command would be bit 0 (1 << 0)
1792 struct iwl3945_rate_scaling_info
{
1793 __le16 rate_n_flags
;
1798 struct iwl3945_rate_scaling_cmd
{
1801 struct iwl3945_rate_scaling_info table
[IWL_MAX_RATES
];
1805 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
1806 #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
1808 /* # of EDCA prioritized tx fifos */
1809 #define LINK_QUAL_AC_NUM AC_NUM
1811 /* # entries in rate scale table to support Tx retries */
1812 #define LINK_QUAL_MAX_RETRY_NUM 16
1814 /* Tx antenna selection values */
1815 #define LINK_QUAL_ANT_A_MSK (1 << 0)
1816 #define LINK_QUAL_ANT_B_MSK (1 << 1)
1817 #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
1821 * struct iwl_link_qual_general_params
1823 * Used in REPLY_TX_LINK_QUALITY_CMD
1825 struct iwl_link_qual_general_params
{
1828 /* No entries at or above this (driver chosen) index contain MIMO */
1831 /* Best single antenna to use for single stream (legacy, SISO). */
1832 u8 single_stream_ant_msk
; /* LINK_QUAL_ANT_* */
1834 /* Best antennas to use for MIMO (unused for 4965, assumes both). */
1835 u8 dual_stream_ant_msk
; /* LINK_QUAL_ANT_* */
1838 * If driver needs to use different initial rates for different
1839 * EDCA QOS access categories (as implemented by tx fifos 0-3),
1840 * this table will set that up, by indicating the indexes in the
1841 * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start.
1842 * Otherwise, driver should set all entries to 0.
1845 * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice
1846 * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3.
1848 u8 start_rate_index
[LINK_QUAL_AC_NUM
];
1851 #define LINK_QUAL_AGG_TIME_LIMIT_DEF (4000) /* 4 milliseconds */
1852 #define LINK_QUAL_AGG_TIME_LIMIT_MAX (8000)
1853 #define LINK_QUAL_AGG_TIME_LIMIT_MIN (100)
1855 #define LINK_QUAL_AGG_DISABLE_START_DEF (3)
1856 #define LINK_QUAL_AGG_DISABLE_START_MAX (255)
1857 #define LINK_QUAL_AGG_DISABLE_START_MIN (0)
1859 #define LINK_QUAL_AGG_FRAME_LIMIT_DEF (31)
1860 #define LINK_QUAL_AGG_FRAME_LIMIT_MAX (63)
1861 #define LINK_QUAL_AGG_FRAME_LIMIT_MIN (0)
1864 * struct iwl_link_qual_agg_params
1866 * Used in REPLY_TX_LINK_QUALITY_CMD
1868 struct iwl_link_qual_agg_params
{
1871 *Maximum number of uSec in aggregation.
1872 * default set to 4000 (4 milliseconds) if not configured in .cfg
1874 __le16 agg_time_limit
;
1877 * Number of Tx retries allowed for a frame, before that frame will
1878 * no longer be considered for the start of an aggregation sequence
1879 * (scheduler will then try to tx it as single frame).
1880 * Driver should set this to 3.
1882 u8 agg_dis_start_th
;
1885 * Maximum number of frames in aggregation.
1886 * 0 = no limit (default). 1 = no aggregation.
1887 * Other values = max # frames in aggregation.
1889 u8 agg_frame_cnt_limit
;
1895 * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response)
1897 * For 4965 devices only; 3945 uses REPLY_RATE_SCALE.
1899 * Each station in the 4965 device's internal station table has its own table
1901 * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when
1902 * an ACK is not received. This command replaces the entire table for
1905 * NOTE: Station must already be in 4965 device's station table.
1906 * Use REPLY_ADD_STA.
1908 * The rate scaling procedures described below work well. Of course, other
1909 * procedures are possible, and may work better for particular environments.
1912 * FILLING THE RATE TABLE
1914 * Given a particular initial rate and mode, as determined by the rate
1915 * scaling algorithm described below, the Linux driver uses the following
1916 * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the
1917 * Link Quality command:
1920 * 1) If using High-throughput (HT) (SISO or MIMO) initial rate:
1921 * a) Use this same initial rate for first 3 entries.
1922 * b) Find next lower available rate using same mode (SISO or MIMO),
1923 * use for next 3 entries. If no lower rate available, switch to
1924 * legacy mode (no HT40 channel, no MIMO, no short guard interval).
1925 * c) If using MIMO, set command's mimo_delimiter to number of entries
1926 * using MIMO (3 or 6).
1927 * d) After trying 2 HT rates, switch to legacy mode (no HT40 channel,
1928 * no MIMO, no short guard interval), at the next lower bit rate
1929 * (e.g. if second HT bit rate was 54, try 48 legacy), and follow
1930 * legacy procedure for remaining table entries.
1932 * 2) If using legacy initial rate:
1933 * a) Use the initial rate for only one entry.
1934 * b) For each following entry, reduce the rate to next lower available
1935 * rate, until reaching the lowest available rate.
1936 * c) When reducing rate, also switch antenna selection.
1937 * d) Once lowest available rate is reached, repeat this rate until
1938 * rate table is filled (16 entries), switching antenna each entry.
1941 * ACCUMULATING HISTORY
1943 * The rate scaling algorithm for 4965 devices, as implemented in Linux driver,
1944 * uses two sets of frame Tx success history: One for the current/active
1945 * modulation mode, and one for a speculative/search mode that is being
1946 * attempted. If the speculative mode turns out to be more effective (i.e.
1947 * actual transfer rate is better), then the driver continues to use the
1948 * speculative mode as the new current active mode.
1950 * Each history set contains, separately for each possible rate, data for a
1951 * sliding window of the 62 most recent tx attempts at that rate. The data
1952 * includes a shifting bitmap of success(1)/failure(0), and sums of successful
1953 * and attempted frames, from which the driver can additionally calculate a
1954 * success ratio (success / attempted) and number of failures
1955 * (attempted - success), and control the size of the window (attempted).
1956 * The driver uses the bit map to remove successes from the success sum, as
1957 * the oldest tx attempts fall out of the window.
1959 * When the 4965 device makes multiple tx attempts for a given frame, each
1960 * attempt might be at a different rate, and have different modulation
1961 * characteristics (e.g. antenna, fat channel, short guard interval), as set
1962 * up in the rate scaling table in the Link Quality command. The driver must
1963 * determine which rate table entry was used for each tx attempt, to determine
1964 * which rate-specific history to update, and record only those attempts that
1965 * match the modulation characteristics of the history set.
1967 * When using block-ack (aggregation), all frames are transmitted at the same
1968 * rate, since there is no per-attempt acknowledgment from the destination
1969 * station. The Tx response struct iwl_tx_resp indicates the Tx rate in
1970 * rate_n_flags field. After receiving a block-ack, the driver can update
1971 * history for the entire block all at once.
1974 * FINDING BEST STARTING RATE:
1976 * When working with a selected initial modulation mode (see below), the
1977 * driver attempts to find a best initial rate. The initial rate is the
1978 * first entry in the Link Quality command's rate table.
1980 * 1) Calculate actual throughput (success ratio * expected throughput, see
1981 * table below) for current initial rate. Do this only if enough frames
1982 * have been attempted to make the value meaningful: at least 6 failed
1983 * tx attempts, or at least 8 successes. If not enough, don't try rate
1986 * 2) Find available rates adjacent to current initial rate. Available means:
1987 * a) supported by hardware &&
1988 * b) supported by association &&
1989 * c) within any constraints selected by user
1991 * 3) Gather measured throughputs for adjacent rates. These might not have
1992 * enough history to calculate a throughput. That's okay, we might try
1993 * using one of them anyway!
1995 * 4) Try decreasing rate if, for current rate:
1996 * a) success ratio is < 15% ||
1997 * b) lower adjacent rate has better measured throughput ||
1998 * c) higher adjacent rate has worse throughput, and lower is unmeasured
2000 * As a sanity check, if decrease was determined above, leave rate
2002 * a) lower rate unavailable
2003 * b) success ratio at current rate > 85% (very good)
2004 * c) current measured throughput is better than expected throughput
2005 * of lower rate (under perfect 100% tx conditions, see table below)
2007 * 5) Try increasing rate if, for current rate:
2008 * a) success ratio is < 15% ||
2009 * b) both adjacent rates' throughputs are unmeasured (try it!) ||
2010 * b) higher adjacent rate has better measured throughput ||
2011 * c) lower adjacent rate has worse throughput, and higher is unmeasured
2013 * As a sanity check, if increase was determined above, leave rate
2015 * a) success ratio at current rate < 70%. This is not particularly
2016 * good performance; higher rate is sure to have poorer success.
2018 * 6) Re-evaluate the rate after each tx frame. If working with block-
2019 * acknowledge, history and statistics may be calculated for the entire
2020 * block (including prior history that fits within the history windows),
2021 * before re-evaluation.
2023 * FINDING BEST STARTING MODULATION MODE:
2025 * After working with a modulation mode for a "while" (and doing rate scaling),
2026 * the driver searches for a new initial mode in an attempt to improve
2027 * throughput. The "while" is measured by numbers of attempted frames:
2029 * For legacy mode, search for new mode after:
2030 * 480 successful frames, or 160 failed frames
2031 * For high-throughput modes (SISO or MIMO), search for new mode after:
2032 * 4500 successful frames, or 400 failed frames
2034 * Mode switch possibilities are (3 for each mode):
2037 * Change antenna, try SISO (if HT association), try MIMO (if HT association)
2039 * Change antenna, try MIMO, try shortened guard interval (SGI)
2041 * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI)
2043 * When trying a new mode, use the same bit rate as the old/current mode when
2044 * trying antenna switches and shortened guard interval. When switching to
2045 * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate
2046 * for which the expected throughput (under perfect conditions) is about the
2047 * same or slightly better than the actual measured throughput delivered by
2048 * the old/current mode.
2050 * Actual throughput can be estimated by multiplying the expected throughput
2051 * by the success ratio (successful / attempted tx frames). Frame size is
2052 * not considered in this calculation; it assumes that frame size will average
2053 * out to be fairly consistent over several samples. The following are
2054 * metric values for expected throughput assuming 100% success ratio.
2055 * Only G band has support for CCK rates:
2057 * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60
2059 * G: 7 13 35 58 40 57 72 98 121 154 177 186 186
2060 * A: 0 0 0 0 40 57 72 98 121 154 177 186 186
2061 * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202
2062 * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211
2063 * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251
2064 * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257
2065 * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257
2066 * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264
2067 * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289
2068 * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293
2070 * After the new mode has been tried for a short while (minimum of 6 failed
2071 * frames or 8 successful frames), compare success ratio and actual throughput
2072 * estimate of the new mode with the old. If either is better with the new
2073 * mode, continue to use the new mode.
2075 * Continue comparing modes until all 3 possibilities have been tried.
2076 * If moving from legacy to HT, try all 3 possibilities from the new HT
2077 * mode. After trying all 3, a best mode is found. Continue to use this mode
2078 * for the longer "while" described above (e.g. 480 successful frames for
2079 * legacy), and then repeat the search process.
2082 struct iwl_link_quality_cmd
{
2084 /* Index of destination/recipient station in uCode's station table */
2087 __le16 control
; /* not used */
2088 struct iwl_link_qual_general_params general_params
;
2089 struct iwl_link_qual_agg_params agg_params
;
2092 * Rate info; when using rate-scaling, Tx command's initial_rate_index
2093 * specifies 1st Tx rate attempted, via index into this table.
2094 * 4965 devices works its way through table when retrying Tx.
2097 __le32 rate_n_flags
; /* RATE_MCS_*, IWL_RATE_* */
2098 } rs_table
[LINK_QUAL_MAX_RETRY_NUM
];
2103 * BT configuration enable flags:
2104 * bit 0 - 1: BT channel announcement enabled
2106 * bit 1 - 1: priority of BT device enabled
2109 #define BT_COEX_DISABLE (0x0)
2110 #define BT_ENABLE_CHANNEL_ANNOUNCE BIT(0)
2111 #define BT_ENABLE_PRIORITY BIT(1)
2113 #define BT_COEX_ENABLE (BT_ENABLE_CHANNEL_ANNOUNCE | BT_ENABLE_PRIORITY)
2115 #define BT_LEAD_TIME_DEF (0x1E)
2117 #define BT_MAX_KILL_DEF (0x5)
2120 * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
2122 * 3945 and 4965 devices support hardware handshake with Bluetooth device on
2123 * same platform. Bluetooth device alerts wireless device when it will Tx;
2124 * wireless device can delay or kill its own Tx to accommodate.
2131 __le32 kill_ack_mask
;
2132 __le32 kill_cts_mask
;
2136 /******************************************************************************
2138 * Spectrum Management (802.11h) Commands, Responses, Notifications:
2140 *****************************************************************************/
2143 * Spectrum Management
2145 #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \
2146 RXON_FILTER_CTL2HOST_MSK | \
2147 RXON_FILTER_ACCEPT_GRP_MSK | \
2148 RXON_FILTER_DIS_DECRYPT_MSK | \
2149 RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
2150 RXON_FILTER_ASSOC_MSK | \
2151 RXON_FILTER_BCON_AWARE_MSK)
2153 struct iwl_measure_channel
{
2154 __le32 duration
; /* measurement duration in extended beacon
2156 u8 channel
; /* channel to measure */
2157 u8 type
; /* see enum iwl_measure_type */
2162 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
2164 struct iwl_spectrum_cmd
{
2165 __le16 len
; /* number of bytes starting from token */
2166 u8 token
; /* token id */
2167 u8 id
; /* measurement id -- 0 or 1 */
2168 u8 origin
; /* 0 = TGh, 1 = other, 2 = TGk */
2169 u8 periodic
; /* 1 = periodic */
2170 __le16 path_loss_timeout
;
2171 __le32 start_time
; /* start time in extended beacon format */
2173 __le32 flags
; /* rxon flags */
2174 __le32 filter_flags
; /* rxon filter flags */
2175 __le16 channel_count
; /* minimum 1, maximum 10 */
2177 struct iwl_measure_channel channels
[10];
2181 * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
2183 struct iwl_spectrum_resp
{
2185 u8 id
; /* id of the prior command replaced, or 0xff */
2186 __le16 status
; /* 0 - command will be handled
2187 * 1 - cannot handle (conflicts with another
2191 enum iwl_measurement_state
{
2192 IWL_MEASUREMENT_START
= 0,
2193 IWL_MEASUREMENT_STOP
= 1,
2196 enum iwl_measurement_status
{
2197 IWL_MEASUREMENT_OK
= 0,
2198 IWL_MEASUREMENT_CONCURRENT
= 1,
2199 IWL_MEASUREMENT_CSA_CONFLICT
= 2,
2200 IWL_MEASUREMENT_TGH_CONFLICT
= 3,
2202 IWL_MEASUREMENT_STOPPED
= 6,
2203 IWL_MEASUREMENT_TIMEOUT
= 7,
2204 IWL_MEASUREMENT_PERIODIC_FAILED
= 8,
2207 #define NUM_ELEMENTS_IN_HISTOGRAM 8
2209 struct iwl_measurement_histogram
{
2210 __le32 ofdm
[NUM_ELEMENTS_IN_HISTOGRAM
]; /* in 0.8usec counts */
2211 __le32 cck
[NUM_ELEMENTS_IN_HISTOGRAM
]; /* in 1usec counts */
2214 /* clear channel availability counters */
2215 struct iwl_measurement_cca_counters
{
2220 enum iwl_measure_type
{
2221 IWL_MEASURE_BASIC
= (1 << 0),
2222 IWL_MEASURE_CHANNEL_LOAD
= (1 << 1),
2223 IWL_MEASURE_HISTOGRAM_RPI
= (1 << 2),
2224 IWL_MEASURE_HISTOGRAM_NOISE
= (1 << 3),
2225 IWL_MEASURE_FRAME
= (1 << 4),
2226 /* bits 5:6 are reserved */
2227 IWL_MEASURE_IDLE
= (1 << 7),
2231 * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
2233 struct iwl_spectrum_notification
{
2234 u8 id
; /* measurement id -- 0 or 1 */
2236 u8 channel_index
; /* index in measurement channel list */
2237 u8 state
; /* 0 - start, 1 - stop */
2238 __le32 start_time
; /* lower 32-bits of TSF */
2239 u8 band
; /* 0 - 5.2GHz, 1 - 2.4GHz */
2241 u8 type
; /* see enum iwl_measurement_type */
2243 /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only
2244 * valid if applicable for measurement type requested. */
2245 __le32 cca_ofdm
; /* cca fraction time in 40Mhz clock periods */
2246 __le32 cca_cck
; /* cca fraction time in 44Mhz clock periods */
2247 __le32 cca_time
; /* channel load time in usecs */
2248 u8 basic_type
; /* 0 - bss, 1 - ofdm preamble, 2 -
2251 struct iwl_measurement_histogram histogram
;
2252 __le32 stop_time
; /* lower 32-bits of TSF */
2253 __le32 status
; /* see iwl_measurement_status */
2256 /******************************************************************************
2258 * Power Management Commands, Responses, Notifications:
2260 *****************************************************************************/
2263 * struct iwl_powertable_cmd - Power Table Command
2264 * @flags: See below:
2266 * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
2269 * bit 0 - '0' Driver not allow power management
2270 * '1' Driver allow PM (use rest of parameters)
2272 * uCode send sleep notifications:
2273 * bit 1 - '0' Don't send sleep notification
2274 * '1' send sleep notification (SEND_PM_NOTIFICATION)
2277 * bit 2 - '0' PM have to walk up every DTIM
2278 * '1' PM could sleep over DTIM till listen Interval.
2281 * bit 3 - '0' (PCI_CFG_LINK_CTRL & 0x1)
2282 * '1' !(PCI_CFG_LINK_CTRL & 0x1)
2285 * bit 4 - '1' Put radio to sleep when receiving frame for others
2288 * bit 31/30- '00' use both mac/xtal sleeps
2289 * '01' force Mac sleep
2290 * '10' force xtal sleep
2293 * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
2294 * ucode assume sleep over DTIM is allowed and we don't need to wake up
2297 #define IWL_POWER_VEC_SIZE 5
2299 #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK cpu_to_le16(BIT(0))
2300 #define IWL_POWER_POWER_SAVE_ENA_MSK cpu_to_le16(BIT(0))
2301 #define IWL_POWER_POWER_MANAGEMENT_ENA_MSK cpu_to_le16(BIT(1))
2302 #define IWL_POWER_SLEEP_OVER_DTIM_MSK cpu_to_le16(BIT(2))
2303 #define IWL_POWER_PCI_PM_MSK cpu_to_le16(BIT(3))
2304 #define IWL_POWER_FAST_PD cpu_to_le16(BIT(4))
2305 #define IWL_POWER_BEACON_FILTERING cpu_to_le16(BIT(5))
2306 #define IWL_POWER_SHADOW_REG_ENA cpu_to_le16(BIT(6))
2307 #define IWL_POWER_CT_KILL_SET cpu_to_le16(BIT(7))
2309 struct iwl3945_powertable_cmd
{
2312 __le32 rx_data_timeout
;
2313 __le32 tx_data_timeout
;
2314 __le32 sleep_interval
[IWL_POWER_VEC_SIZE
];
2317 struct iwl_powertable_cmd
{
2319 u8 keep_alive_seconds
; /* 3945 reserved */
2320 u8 debug_flags
; /* 3945 reserved */
2321 __le32 rx_data_timeout
;
2322 __le32 tx_data_timeout
;
2323 __le32 sleep_interval
[IWL_POWER_VEC_SIZE
];
2324 __le32 keep_alive_beacons
;
2328 * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
2329 * all devices identical.
2331 struct iwl_sleep_notification
{
2340 /* Sleep states. all devices identical. */
2342 IWL_PM_NO_SLEEP
= 0,
2344 IWL_PM_SLP_FULL_MAC_UNASSOCIATE
= 2,
2345 IWL_PM_SLP_FULL_MAC_CARD_STATE
= 3,
2347 IWL_PM_SLP_REPENT
= 5,
2348 IWL_PM_WAKEUP_BY_TIMER
= 6,
2349 IWL_PM_WAKEUP_BY_DRIVER
= 7,
2350 IWL_PM_WAKEUP_BY_RFKILL
= 8,
2352 IWL_PM_NUM_OF_MODES
= 12,
2356 * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
2358 struct iwl_card_state_notif
{
2362 #define HW_CARD_DISABLED 0x01
2363 #define SW_CARD_DISABLED 0x02
2364 #define CT_CARD_DISABLED 0x04
2365 #define RXON_CARD_DISABLED 0x10
2367 struct iwl_ct_kill_config
{
2369 __le32 critical_temperature_M
;
2370 __le32 critical_temperature_R
;
2373 /******************************************************************************
2375 * Scan Commands, Responses, Notifications:
2377 *****************************************************************************/
2379 #define SCAN_CHANNEL_TYPE_PASSIVE cpu_to_le32(0)
2380 #define SCAN_CHANNEL_TYPE_ACTIVE cpu_to_le32(1)
2383 * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table
2385 * One for each channel in the scan list.
2386 * Each channel can independently select:
2387 * 1) SSID for directed active scans
2388 * 2) Txpower setting (for rate specified within Tx command)
2389 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
2390 * quiet_plcp_th, good_CRC_th)
2392 * To avoid uCode errors, make sure the following are true (see comments
2393 * under struct iwl_scan_cmd about max_out_time and quiet_time):
2394 * 1) If using passive_dwell (i.e. passive_dwell != 0):
2395 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
2396 * 2) quiet_time <= active_dwell
2397 * 3) If restricting off-channel time (i.e. max_out_time !=0):
2398 * passive_dwell < max_out_time
2399 * active_dwell < max_out_time
2401 struct iwl3945_scan_channel
{
2403 * type is defined as:
2404 * 0:0 1 = active, 0 = passive
2405 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2406 * SSID IE is transmitted in probe request.
2410 u8 channel
; /* band is selected by iwl3945_scan_cmd "flags" field */
2411 struct iwl3945_tx_power tpc
;
2412 __le16 active_dwell
; /* in 1024-uSec TU (time units), typ 5-50 */
2413 __le16 passive_dwell
; /* in 1024-uSec TU (time units), typ 20-500 */
2416 /* set number of direct probes u8 type */
2417 #define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
2419 struct iwl_scan_channel
{
2421 * type is defined as:
2422 * 0:0 1 = active, 0 = passive
2423 * 1:20 SSID direct bit map; if a bit is set, then corresponding
2424 * SSID IE is transmitted in probe request.
2428 __le16 channel
; /* band is selected by iwl_scan_cmd "flags" field */
2429 u8 tx_gain
; /* gain for analog radio */
2430 u8 dsp_atten
; /* gain for DSP */
2431 __le16 active_dwell
; /* in 1024-uSec TU (time units), typ 5-50 */
2432 __le16 passive_dwell
; /* in 1024-uSec TU (time units), typ 20-500 */
2435 /* set number of direct probes __le32 type */
2436 #define IWL_SCAN_PROBE_MASK(n) cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
2439 * struct iwl_ssid_ie - directed scan network information element
2441 * Up to 20 of these may appear in REPLY_SCAN_CMD (Note: Only 4 are in
2442 * 3945 SCAN api), selected by "type" bit field in struct iwl_scan_channel;
2443 * each channel may select different ssids from among the 20 (4) entries.
2444 * SSID IEs get transmitted in reverse order of entry.
2446 struct iwl_ssid_ie
{
2452 #define PROBE_OPTION_MAX_3945 4
2453 #define PROBE_OPTION_MAX 20
2454 #define TX_CMD_LIFE_TIME_INFINITE cpu_to_le32(0xFFFFFFFF)
2455 #define IWL_GOOD_CRC_TH_DISABLED 0
2456 #define IWL_GOOD_CRC_TH_DEFAULT cpu_to_le16(1)
2457 #define IWL_GOOD_CRC_TH_NEVER cpu_to_le16(0xffff)
2458 #define IWL_MAX_SCAN_SIZE 1024
2459 #define IWL_MAX_CMD_SIZE 4096
2462 * REPLY_SCAN_CMD = 0x80 (command)
2464 * The hardware scan command is very powerful; the driver can set it up to
2465 * maintain (relatively) normal network traffic while doing a scan in the
2466 * background. The max_out_time and suspend_time control the ratio of how
2467 * long the device stays on an associated network channel ("service channel")
2468 * vs. how long it's away from the service channel, i.e. tuned to other channels
2471 * max_out_time is the max time off-channel (in usec), and suspend_time
2472 * is how long (in "extended beacon" format) that the scan is "suspended"
2473 * after returning to the service channel. That is, suspend_time is the
2474 * time that we stay on the service channel, doing normal work, between
2475 * scan segments. The driver may set these parameters differently to support
2476 * scanning when associated vs. not associated, and light vs. heavy traffic
2477 * loads when associated.
2479 * After receiving this command, the device's scan engine does the following;
2481 * 1) Sends SCAN_START notification to driver
2482 * 2) Checks to see if it has time to do scan for one channel
2483 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
2484 * to tell AP that we're going off-channel
2485 * 4) Tunes to first channel in scan list, does active or passive scan
2486 * 5) Sends SCAN_RESULT notification to driver
2487 * 6) Checks to see if it has time to do scan on *next* channel in list
2488 * 7) Repeats 4-6 until it no longer has time to scan the next channel
2489 * before max_out_time expires
2490 * 8) Returns to service channel
2491 * 9) Sends NULL packet with PS=0 to tell AP that we're back
2492 * 10) Stays on service channel until suspend_time expires
2493 * 11) Repeats entire process 2-10 until list is complete
2494 * 12) Sends SCAN_COMPLETE notification
2496 * For fast, efficient scans, the scan command also has support for staying on
2497 * a channel for just a short time, if doing active scanning and getting no
2498 * responses to the transmitted probe request. This time is controlled by
2499 * quiet_time, and the number of received packets below which a channel is
2500 * considered "quiet" is controlled by quiet_plcp_threshold.
2502 * For active scanning on channels that have regulatory restrictions against
2503 * blindly transmitting, the scan can listen before transmitting, to make sure
2504 * that there is already legitimate activity on the channel. If enough
2505 * packets are cleanly received on the channel (controlled by good_CRC_th,
2506 * typical value 1), the scan engine starts transmitting probe requests.
2508 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
2510 * To avoid uCode errors, see timing restrictions described under
2511 * struct iwl_scan_channel.
2514 struct iwl3945_scan_cmd
{
2517 u8 channel_count
; /* # channels in channel list */
2518 __le16 quiet_time
; /* dwell only this # millisecs on quiet channel
2519 * (only for active scan) */
2520 __le16 quiet_plcp_th
; /* quiet chnl is < this # pkts (typ. 1) */
2521 __le16 good_CRC_th
; /* passive -> active promotion threshold */
2523 __le32 max_out_time
; /* max usec to be away from associated (service)
2525 __le32 suspend_time
; /* pause scan this long (in "extended beacon
2526 * format") when returning to service channel:
2527 * 3945; 31:24 # beacons, 19:0 additional usec,
2528 * 4965; 31:22 # beacons, 21:0 additional usec.
2530 __le32 flags
; /* RXON_FLG_* */
2531 __le32 filter_flags
; /* RXON_FILTER_* */
2533 /* For active scans (set to all-0s for passive scans).
2534 * Does not include payload. Must specify Tx rate; no rate scaling. */
2535 struct iwl3945_tx_cmd tx_cmd
;
2537 /* For directed active scans (set to all-0s otherwise) */
2538 struct iwl_ssid_ie direct_scan
[PROBE_OPTION_MAX_3945
];
2541 * Probe request frame, followed by channel list.
2543 * Size of probe request frame is specified by byte count in tx_cmd.
2544 * Channel list follows immediately after probe request frame.
2545 * Number of channels in list is specified by channel_count.
2546 * Each channel in list is of type:
2548 * struct iwl3945_scan_channel channels[0];
2550 * NOTE: Only one band of channels can be scanned per pass. You
2551 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2552 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2553 * before requesting another scan.
2558 struct iwl_scan_cmd
{
2561 u8 channel_count
; /* # channels in channel list */
2562 __le16 quiet_time
; /* dwell only this # millisecs on quiet channel
2563 * (only for active scan) */
2564 __le16 quiet_plcp_th
; /* quiet chnl is < this # pkts (typ. 1) */
2565 __le16 good_CRC_th
; /* passive -> active promotion threshold */
2566 __le16 rx_chain
; /* RXON_RX_CHAIN_* */
2567 __le32 max_out_time
; /* max usec to be away from associated (service)
2569 __le32 suspend_time
; /* pause scan this long (in "extended beacon
2570 * format") when returning to service chnl:
2571 * 3945; 31:24 # beacons, 19:0 additional usec,
2572 * 4965; 31:22 # beacons, 21:0 additional usec.
2574 __le32 flags
; /* RXON_FLG_* */
2575 __le32 filter_flags
; /* RXON_FILTER_* */
2577 /* For active scans (set to all-0s for passive scans).
2578 * Does not include payload. Must specify Tx rate; no rate scaling. */
2579 struct iwl_tx_cmd tx_cmd
;
2581 /* For directed active scans (set to all-0s otherwise) */
2582 struct iwl_ssid_ie direct_scan
[PROBE_OPTION_MAX
];
2585 * Probe request frame, followed by channel list.
2587 * Size of probe request frame is specified by byte count in tx_cmd.
2588 * Channel list follows immediately after probe request frame.
2589 * Number of channels in list is specified by channel_count.
2590 * Each channel in list is of type:
2592 * struct iwl_scan_channel channels[0];
2594 * NOTE: Only one band of channels can be scanned per pass. You
2595 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2596 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2597 * before requesting another scan.
2602 /* Can abort will notify by complete notification with abort status. */
2603 #define CAN_ABORT_STATUS cpu_to_le32(0x1)
2604 /* complete notification statuses */
2605 #define ABORT_STATUS 0x2
2608 * REPLY_SCAN_CMD = 0x80 (response)
2610 struct iwl_scanreq_notification
{
2611 __le32 status
; /* 1: okay, 2: cannot fulfill request */
2615 * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
2617 struct iwl_scanstart_notification
{
2620 __le32 beacon_timer
;
2627 #define SCAN_OWNER_STATUS 0x1;
2628 #define MEASURE_OWNER_STATUS 0x2;
2630 #define IWL_PROBE_STATUS_OK 0
2631 #define IWL_PROBE_STATUS_TX_FAILED BIT(0)
2632 /* error statuses combined with TX_FAILED */
2633 #define IWL_PROBE_STATUS_FAIL_TTL BIT(1)
2634 #define IWL_PROBE_STATUS_FAIL_BT BIT(2)
2636 #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
2638 * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
2640 struct iwl_scanresults_notification
{
2644 u8 num_probe_not_sent
; /* not enough time to send */
2647 __le32 statistics
[NUMBER_OF_STATISTICS
];
2651 * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
2653 struct iwl_scancomplete_notification
{
2654 u8 scanned_channels
;
2662 /******************************************************************************
2664 * IBSS/AP Commands and Notifications:
2666 *****************************************************************************/
2668 enum iwl_ibss_manager
{
2669 IWL_NOT_IBSS_MANAGER
= 0,
2670 IWL_IBSS_MANAGER
= 1,
2674 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
2677 struct iwl3945_beacon_notif
{
2678 struct iwl3945_tx_resp beacon_notify_hdr
;
2681 __le32 ibss_mgr_status
;
2684 struct iwl4965_beacon_notif
{
2685 struct iwl4965_tx_resp beacon_notify_hdr
;
2688 __le32 ibss_mgr_status
;
2692 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
2695 struct iwl3945_tx_beacon_cmd
{
2696 struct iwl3945_tx_cmd tx
;
2700 struct ieee80211_hdr frame
[0]; /* beacon frame */
2703 struct iwl_tx_beacon_cmd
{
2704 struct iwl_tx_cmd tx
;
2708 struct ieee80211_hdr frame
[0]; /* beacon frame */
2711 /******************************************************************************
2713 * Statistics Commands and Notifications:
2715 *****************************************************************************/
2717 #define IWL_TEMP_CONVERT 260
2719 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
2720 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
2721 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
2723 /* Used for passing to driver number of successes and failures per rate */
2724 struct rate_histogram
{
2726 __le32 a
[SUP_RATE_11A_MAX_NUM_CHANNELS
];
2727 __le32 b
[SUP_RATE_11B_MAX_NUM_CHANNELS
];
2728 __le32 g
[SUP_RATE_11G_MAX_NUM_CHANNELS
];
2731 __le32 a
[SUP_RATE_11A_MAX_NUM_CHANNELS
];
2732 __le32 b
[SUP_RATE_11B_MAX_NUM_CHANNELS
];
2733 __le32 g
[SUP_RATE_11G_MAX_NUM_CHANNELS
];
2737 /* statistics command response */
2739 struct iwl39_statistics_rx_phy
{
2745 __le32 early_overrun_err
;
2747 __le32 false_alarm_cnt
;
2748 __le32 fina_sync_err_cnt
;
2750 __le32 fina_timeout
;
2751 __le32 unresponded_rts
;
2752 __le32 rxe_frame_limit_overrun
;
2753 __le32 sent_ack_cnt
;
2754 __le32 sent_cts_cnt
;
2757 struct iwl39_statistics_rx_non_phy
{
2758 __le32 bogus_cts
; /* CTS received when not expecting CTS */
2759 __le32 bogus_ack
; /* ACK received when not expecting ACK */
2760 __le32 non_bssid_frames
; /* number of frames with BSSID that
2761 * doesn't belong to the STA BSSID */
2762 __le32 filtered_frames
; /* count frames that were dumped in the
2763 * filtering process */
2764 __le32 non_channel_beacons
; /* beacons with our bss id but not on
2765 * our serving channel */
2768 struct iwl39_statistics_rx
{
2769 struct iwl39_statistics_rx_phy ofdm
;
2770 struct iwl39_statistics_rx_phy cck
;
2771 struct iwl39_statistics_rx_non_phy general
;
2774 struct iwl39_statistics_tx
{
2775 __le32 preamble_cnt
;
2776 __le32 rx_detected_cnt
;
2777 __le32 bt_prio_defer_cnt
;
2778 __le32 bt_prio_kill_cnt
;
2779 __le32 few_bytes_cnt
;
2782 __le32 expected_ack_cnt
;
2783 __le32 actual_ack_cnt
;
2786 struct statistics_dbg
{
2789 __le32 wait_for_silence_timeout_cnt
;
2793 struct iwl39_statistics_div
{
2800 struct iwl39_statistics_general
{
2802 struct statistics_dbg dbg
;
2806 __le32 ttl_timestamp
;
2807 struct iwl39_statistics_div div
;
2810 struct statistics_rx_phy
{
2816 __le32 early_overrun_err
;
2818 __le32 false_alarm_cnt
;
2819 __le32 fina_sync_err_cnt
;
2821 __le32 fina_timeout
;
2822 __le32 unresponded_rts
;
2823 __le32 rxe_frame_limit_overrun
;
2824 __le32 sent_ack_cnt
;
2825 __le32 sent_cts_cnt
;
2826 __le32 sent_ba_rsp_cnt
;
2827 __le32 dsp_self_kill
;
2828 __le32 mh_format_err
;
2829 __le32 re_acq_main_rssi_sum
;
2833 struct statistics_rx_ht_phy
{
2836 __le32 early_overrun_err
;
2839 __le32 mh_format_err
;
2840 __le32 agg_crc32_good
;
2841 __le32 agg_mpdu_cnt
;
2843 __le32 unsupport_mcs
;
2846 #define INTERFERENCE_DATA_AVAILABLE cpu_to_le32(1)
2848 struct statistics_rx_non_phy
{
2849 __le32 bogus_cts
; /* CTS received when not expecting CTS */
2850 __le32 bogus_ack
; /* ACK received when not expecting ACK */
2851 __le32 non_bssid_frames
; /* number of frames with BSSID that
2852 * doesn't belong to the STA BSSID */
2853 __le32 filtered_frames
; /* count frames that were dumped in the
2854 * filtering process */
2855 __le32 non_channel_beacons
; /* beacons with our bss id but not on
2856 * our serving channel */
2857 __le32 channel_beacons
; /* beacons with our bss id and in our
2858 * serving channel */
2859 __le32 num_missed_bcon
; /* number of missed beacons */
2860 __le32 adc_rx_saturation_time
; /* count in 0.8us units the time the
2861 * ADC was in saturation */
2862 __le32 ina_detection_search_time
;/* total time (in 0.8us) searched
2864 __le32 beacon_silence_rssi_a
; /* RSSI silence after beacon frame */
2865 __le32 beacon_silence_rssi_b
; /* RSSI silence after beacon frame */
2866 __le32 beacon_silence_rssi_c
; /* RSSI silence after beacon frame */
2867 __le32 interference_data_flag
; /* flag for interference data
2868 * availability. 1 when data is
2870 __le32 channel_load
; /* counts RX Enable time in uSec */
2871 __le32 dsp_false_alarms
; /* DSP false alarm (both OFDM
2872 * and CCK) counter */
2873 __le32 beacon_rssi_a
;
2874 __le32 beacon_rssi_b
;
2875 __le32 beacon_rssi_c
;
2876 __le32 beacon_energy_a
;
2877 __le32 beacon_energy_b
;
2878 __le32 beacon_energy_c
;
2881 struct statistics_rx
{
2882 struct statistics_rx_phy ofdm
;
2883 struct statistics_rx_phy cck
;
2884 struct statistics_rx_non_phy general
;
2885 struct statistics_rx_ht_phy ofdm_ht
;
2889 * struct statistics_tx_power - current tx power
2891 * @ant_a: current tx power on chain a in 1/2 dB step
2892 * @ant_b: current tx power on chain b in 1/2 dB step
2893 * @ant_c: current tx power on chain c in 1/2 dB step
2895 struct statistics_tx_power
{
2902 struct statistics_tx_non_phy_agg
{
2904 __le32 ba_reschedule_frames
;
2905 __le32 scd_query_agg_frame_cnt
;
2906 __le32 scd_query_no_agg
;
2907 __le32 scd_query_agg
;
2908 __le32 scd_query_mismatch
;
2909 __le32 frame_not_ready
;
2911 __le32 bt_prio_kill
;
2912 __le32 rx_ba_rsp_cnt
;
2915 struct statistics_tx
{
2916 __le32 preamble_cnt
;
2917 __le32 rx_detected_cnt
;
2918 __le32 bt_prio_defer_cnt
;
2919 __le32 bt_prio_kill_cnt
;
2920 __le32 few_bytes_cnt
;
2923 __le32 expected_ack_cnt
;
2924 __le32 actual_ack_cnt
;
2925 __le32 dump_msdu_cnt
;
2926 __le32 burst_abort_next_frame_mismatch_cnt
;
2927 __le32 burst_abort_missing_next_frame_cnt
;
2928 __le32 cts_timeout_collision
;
2929 __le32 ack_or_ba_timeout_collision
;
2930 struct statistics_tx_non_phy_agg agg
;
2936 struct statistics_div
{
2945 struct statistics_general_common
{
2946 __le32 temperature
; /* radio temperature */
2947 struct statistics_dbg dbg
;
2951 __le32 ttl_timestamp
;
2952 struct statistics_div div
;
2953 __le32 rx_enable_counter
;
2955 * num_of_sos_states:
2956 * count the number of times we have to re-tune
2957 * in order to get out of bad PHY status
2959 __le32 num_of_sos_states
;
2962 struct statistics_general
{
2963 struct statistics_general_common common
;
2968 #define UCODE_STATISTICS_CLEAR_MSK (0x1 << 0)
2969 #define UCODE_STATISTICS_FREQUENCY_MSK (0x1 << 1)
2970 #define UCODE_STATISTICS_NARROW_BAND_MSK (0x1 << 2)
2973 * REPLY_STATISTICS_CMD = 0x9c,
2974 * all devices identical.
2976 * This command triggers an immediate response containing uCode statistics.
2977 * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
2979 * If the CLEAR_STATS configuration flag is set, uCode will clear its
2980 * internal copy of the statistics (counters) after issuing the response.
2981 * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
2983 * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
2984 * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag
2985 * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
2987 #define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1) /* see above */
2988 #define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
2989 struct iwl_statistics_cmd
{
2990 __le32 configuration_flags
; /* IWL_STATS_CONF_* */
2994 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
2996 * By default, uCode issues this notification after receiving a beacon
2997 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
2998 * REPLY_STATISTICS_CMD 0x9c, above.
3000 * Statistics counters continue to increment beacon after beacon, but are
3001 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
3002 * 0x9c with CLEAR_STATS bit set (see above).
3004 * uCode also issues this notification during scans. uCode clears statistics
3005 * appropriately so that each notification contains statistics for only the
3006 * one channel that has just been scanned.
3008 #define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
3009 #define STATISTICS_REPLY_FLG_HT40_MODE_MSK cpu_to_le32(0x8)
3011 struct iwl3945_notif_statistics
{
3013 struct iwl39_statistics_rx rx
;
3014 struct iwl39_statistics_tx tx
;
3015 struct iwl39_statistics_general general
;
3018 struct iwl_notif_statistics
{
3020 struct statistics_rx rx
;
3021 struct statistics_tx tx
;
3022 struct statistics_general general
;
3026 * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
3028 * uCode send MISSED_BEACONS_NOTIFICATION to driver when detect beacon missed
3029 * in regardless of how many missed beacons, which mean when driver receive the
3030 * notification, inside the command, it can find all the beacons information
3031 * which include number of total missed beacons, number of consecutive missed
3032 * beacons, number of beacons received and number of beacons expected to
3035 * If uCode detected consecutive_missed_beacons > 5, it will reset the radio
3036 * in order to bring the radio/PHY back to working state; which has no relation
3037 * to when driver will perform sensitivity calibration.
3039 * Driver should set it own missed_beacon_threshold to decide when to perform
3040 * sensitivity calibration based on number of consecutive missed beacons in
3041 * order to improve overall performance, especially in noisy environment.
3045 #define IWL_MISSED_BEACON_THRESHOLD_MIN (1)
3046 #define IWL_MISSED_BEACON_THRESHOLD_DEF (5)
3047 #define IWL_MISSED_BEACON_THRESHOLD_MAX IWL_MISSED_BEACON_THRESHOLD_DEF
3049 struct iwl_missed_beacon_notif
{
3050 __le32 consecutive_missed_beacons
;
3051 __le32 total_missed_becons
;
3052 __le32 num_expected_beacons
;
3053 __le32 num_recvd_beacons
;
3057 /******************************************************************************
3059 * Rx Calibration Commands:
3061 * With the uCode used for open source drivers, most Tx calibration (except
3062 * for Tx Power) and most Rx calibration is done by uCode during the
3063 * "initialize" phase of uCode boot. Driver must calibrate only:
3065 * 1) Tx power (depends on temperature), described elsewhere
3066 * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas)
3067 * 3) Receiver sensitivity (to optimize signal detection)
3069 *****************************************************************************/
3072 * SENSITIVITY_CMD = 0xa8 (command, has simple generic response)
3074 * This command sets up the Rx signal detector for a sensitivity level that
3075 * is high enough to lock onto all signals within the associated network,
3076 * but low enough to ignore signals that are below a certain threshold, so as
3077 * not to have too many "false alarms". False alarms are signals that the
3078 * Rx DSP tries to lock onto, but then discards after determining that they
3081 * The optimum number of false alarms is between 5 and 50 per 200 TUs
3082 * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e.
3083 * time listening, not transmitting). Driver must adjust sensitivity so that
3084 * the ratio of actual false alarms to actual Rx time falls within this range.
3086 * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each
3087 * received beacon. These provide information to the driver to analyze the
3088 * sensitivity. Don't analyze statistics that come in from scanning, or any
3089 * other non-associated-network source. Pertinent statistics include:
3091 * From "general" statistics (struct statistics_rx_non_phy):
3093 * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level)
3094 * Measure of energy of desired signal. Used for establishing a level
3095 * below which the device does not detect signals.
3097 * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB)
3098 * Measure of background noise in silent period after beacon.
3101 * uSecs of actual Rx time during beacon period (varies according to
3102 * how much time was spent transmitting).
3104 * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately:
3107 * Signal locks abandoned early (before phy-level header).
3110 * Signal locks abandoned late (during phy-level header).
3112 * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from
3113 * beacon to beacon, i.e. each value is an accumulation of all errors
3114 * before and including the latest beacon. Values will wrap around to 0
3115 * after counting up to 2^32 - 1. Driver must differentiate vs.
3116 * previous beacon's values to determine # false alarms in the current
3119 * Total number of false alarms = false_alarms + plcp_errs
3121 * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd
3122 * (notice that the start points for OFDM are at or close to settings for
3123 * maximum sensitivity):
3126 * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120
3127 * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210
3128 * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140
3129 * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270
3131 * If actual rate of OFDM false alarms (+ plcp_errors) is too high
3132 * (greater than 50 for each 204.8 msecs listening), reduce sensitivity
3133 * by *adding* 1 to all 4 of the table entries above, up to the max for
3134 * each entry. Conversely, if false alarm rate is too low (less than 5
3135 * for each 204.8 msecs listening), *subtract* 1 from each entry to
3136 * increase sensitivity.
3138 * For CCK sensitivity, keep track of the following:
3140 * 1). 20-beacon history of maximum background noise, indicated by
3141 * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the
3142 * 3 receivers. For any given beacon, the "silence reference" is
3143 * the maximum of last 60 samples (20 beacons * 3 receivers).
3145 * 2). 10-beacon history of strongest signal level, as indicated
3146 * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers,
3147 * i.e. the strength of the signal through the best receiver at the
3148 * moment. These measurements are "upside down", with lower values
3149 * for stronger signals, so max energy will be *minimum* value.
3151 * Then for any given beacon, the driver must determine the *weakest*
3152 * of the strongest signals; this is the minimum level that needs to be
3153 * successfully detected, when using the best receiver at the moment.
3154 * "Max cck energy" is the maximum (higher value means lower energy!)
3155 * of the last 10 minima. Once this is determined, driver must add
3156 * a little margin by adding "6" to it.
3158 * 3). Number of consecutive beacon periods with too few false alarms.
3159 * Reset this to 0 at the first beacon period that falls within the
3160 * "good" range (5 to 50 false alarms per 204.8 milliseconds rx).
3162 * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd
3163 * (notice that the start points for CCK are at maximum sensitivity):
3166 * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200
3167 * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400
3168 * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100
3170 * If actual rate of CCK false alarms (+ plcp_errors) is too high
3171 * (greater than 50 for each 204.8 msecs listening), method for reducing
3174 * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3177 * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160,
3178 * sensitivity has been reduced a significant amount; bring it up to
3179 * a moderate 161. Otherwise, *add* 3, up to max 200.
3181 * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160,
3182 * sensitivity has been reduced only a moderate or small amount;
3183 * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX,
3184 * down to min 0. Otherwise (if gain has been significantly reduced),
3185 * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value.
3187 * b) Save a snapshot of the "silence reference".
3189 * If actual rate of CCK false alarms (+ plcp_errors) is too low
3190 * (less than 5 for each 204.8 msecs listening), method for increasing
3191 * sensitivity is used only if:
3193 * 1a) Previous beacon did not have too many false alarms
3194 * 1b) AND difference between previous "silence reference" and current
3195 * "silence reference" (prev - current) is 2 or more,
3196 * OR 2) 100 or more consecutive beacon periods have had rate of
3197 * less than 5 false alarms per 204.8 milliseconds rx time.
3199 * Method for increasing sensitivity:
3201 * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX,
3204 * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX,
3207 * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100.
3209 * If actual rate of CCK false alarms (+ plcp_errors) is within good range
3210 * (between 5 and 50 for each 204.8 msecs listening):
3212 * 1) Save a snapshot of the silence reference.
3214 * 2) If previous beacon had too many CCK false alarms (+ plcp_errors),
3215 * give some extra margin to energy threshold by *subtracting* 8
3216 * from value in HD_MIN_ENERGY_CCK_DET_INDEX.
3218 * For all cases (too few, too many, good range), make sure that the CCK
3219 * detection threshold (energy) is below the energy level for robust
3220 * detection over the past 10 beacon periods, the "Max cck energy".
3221 * Lower values mean higher energy; this means making sure that the value
3222 * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy".
3227 * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd)
3229 #define HD_TABLE_SIZE (11) /* number of entries */
3230 #define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */
3231 #define HD_MIN_ENERGY_OFDM_DET_INDEX (1)
3232 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2)
3233 #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3)
3234 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4)
3235 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5)
3236 #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6)
3237 #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7)
3238 #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8)
3239 #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9)
3240 #define HD_OFDM_ENERGY_TH_IN_INDEX (10)
3242 /* Control field in struct iwl_sensitivity_cmd */
3243 #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE cpu_to_le16(0)
3244 #define SENSITIVITY_CMD_CONTROL_WORK_TABLE cpu_to_le16(1)
3247 * struct iwl_sensitivity_cmd
3248 * @control: (1) updates working table, (0) updates default table
3249 * @table: energy threshold values, use HD_* as index into table
3251 * Always use "1" in "control" to update uCode's working table and DSP.
3253 struct iwl_sensitivity_cmd
{
3254 __le16 control
; /* always use "1" */
3255 __le16 table
[HD_TABLE_SIZE
]; /* use HD_* as index */
3260 * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response)
3262 * This command sets the relative gains of 4965 device's 3 radio receiver chains.
3264 * After the first association, driver should accumulate signal and noise
3265 * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20
3266 * beacons from the associated network (don't collect statistics that come
3267 * in from scanning, or any other non-network source).
3269 * DISCONNECTED ANTENNA:
3271 * Driver should determine which antennas are actually connected, by comparing
3272 * average beacon signal levels for the 3 Rx chains. Accumulate (add) the
3273 * following values over 20 beacons, one accumulator for each of the chains
3274 * a/b/c, from struct statistics_rx_non_phy:
3276 * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB)
3278 * Find the strongest signal from among a/b/c. Compare the other two to the
3279 * strongest. If any signal is more than 15 dB (times 20, unless you
3280 * divide the accumulated values by 20) below the strongest, the driver
3281 * considers that antenna to be disconnected, and should not try to use that
3282 * antenna/chain for Rx or Tx. If both A and B seem to be disconnected,
3283 * driver should declare the stronger one as connected, and attempt to use it
3284 * (A and B are the only 2 Tx chains!).
3289 * Driver should balance the 3 receivers (but just the ones that are connected
3290 * to antennas, see above) for gain, by comparing the average signal levels
3291 * detected during the silence after each beacon (background noise).
3292 * Accumulate (add) the following values over 20 beacons, one accumulator for
3293 * each of the chains a/b/c, from struct statistics_rx_non_phy:
3295 * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB)
3297 * Find the weakest background noise level from among a/b/c. This Rx chain
3298 * will be the reference, with 0 gain adjustment. Attenuate other channels by
3299 * finding noise difference:
3301 * (accum_noise[i] - accum_noise[reference]) / 30
3303 * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB.
3304 * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the
3305 * driver should limit the difference results to a range of 0-3 (0-4.5 dB),
3306 * and set bit 2 to indicate "reduce gain". The value for the reference
3307 * (weakest) chain should be "0".
3309 * diff_gain_[abc] bit fields:
3310 * 2: (1) reduce gain, (0) increase gain
3311 * 1-0: amount of gain, units of 1.5 dB
3314 /* Phy calibration command for series */
3315 /* The default calibrate table size if not specified by firmware */
3316 #define IWL_DEFAULT_STANDARD_PHY_CALIBRATE_TBL_SIZE 18
3318 IWL_PHY_CALIBRATE_DIFF_GAIN_CMD
= 7,
3319 IWL_MAX_STANDARD_PHY_CALIBRATE_TBL_SIZE
= 19,
3322 #define IWL_MAX_PHY_CALIBRATE_TBL_SIZE (253)
3324 struct iwl_calib_hdr
{
3331 /* IWL_PHY_CALIBRATE_DIFF_GAIN_CMD (7) */
3332 struct iwl_calib_diff_gain_cmd
{
3333 struct iwl_calib_hdr hdr
;
3334 s8 diff_gain_a
; /* see above */
3340 /******************************************************************************
3342 * Miscellaneous Commands:
3344 *****************************************************************************/
3347 * LEDs Command & Response
3348 * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
3350 * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
3351 * this command turns it on or off, or sets up a periodic blinking cycle.
3353 struct iwl_led_cmd
{
3354 __le32 interval
; /* "interval" in uSec */
3355 u8 id
; /* 1: Activity, 2: Link, 3: Tech */
3356 u8 off
; /* # intervals off while blinking;
3357 * "0", with >0 "on" value, turns LED on */
3358 u8 on
; /* # intervals on while blinking;
3359 * "0", regardless of "off", turns LED off */
3364 /******************************************************************************
3366 * Union of all expected notifications/responses:
3368 *****************************************************************************/
3370 struct iwl_rx_packet
{
3372 * The first 4 bytes of the RX frame header contain both the RX frame
3373 * size and some flags.
3375 * 31: flag flush RB request
3376 * 30: flag ignore TC (terminal counter) request
3377 * 29: flag fast IRQ request
3379 * 13-00: RX frame size
3382 struct iwl_cmd_header hdr
;
3384 struct iwl3945_rx_frame rx_frame
;
3385 struct iwl3945_tx_resp tx_resp
;
3386 struct iwl3945_beacon_notif beacon_status
;
3388 struct iwl_alive_resp alive_frame
;
3389 struct iwl_spectrum_notification spectrum_notif
;
3390 struct iwl_csa_notification csa_notif
;
3391 struct iwl_error_resp err_resp
;
3392 struct iwl_card_state_notif card_state_notif
;
3393 struct iwl_add_sta_resp add_sta
;
3394 struct iwl_rem_sta_resp rem_sta
;
3395 struct iwl_sleep_notification sleep_notif
;
3396 struct iwl_spectrum_resp spectrum
;
3397 struct iwl_notif_statistics stats
;
3398 struct iwl_compressed_ba_resp compressed_ba
;
3399 struct iwl_missed_beacon_notif missed_beacon
;
3405 #endif /* __iwl_legacy_commands_h__ */