Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
| 6 | * GPL LICENSE SUMMARY |
| 7 | * |
Reinette Chatre | eb7ae89 | 2008-03-11 16:17:17 -0700 | [diff] [blame] | 8 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
Ian Schram | 01ebd06 | 2007-10-25 17:15:22 +0800 | [diff] [blame] | 11 | * it under the terms of version 2 of the GNU General Public License as |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, |
| 22 | * USA |
| 23 | * |
| 24 | * The full GNU General Public License is included in this distribution |
| 25 | * in the file called LICENSE.GPL. |
| 26 | * |
| 27 | * Contact Information: |
| 28 | * James P. Ketrenos <ipw2100-admin@linux.intel.com> |
| 29 | * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 |
| 30 | * |
| 31 | * BSD LICENSE |
| 32 | * |
Reinette Chatre | eb7ae89 | 2008-03-11 16:17:17 -0700 | [diff] [blame] | 33 | * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 34 | * All rights reserved. |
| 35 | * |
| 36 | * Redistribution and use in source and binary forms, with or without |
| 37 | * modification, are permitted provided that the following conditions |
| 38 | * are met: |
| 39 | * |
| 40 | * * Redistributions of source code must retain the above copyright |
| 41 | * notice, this list of conditions and the following disclaimer. |
| 42 | * * Redistributions in binary form must reproduce the above copyright |
| 43 | * notice, this list of conditions and the following disclaimer in |
| 44 | * the documentation and/or other materials provided with the |
| 45 | * distribution. |
| 46 | * * Neither the name Intel Corporation nor the names of its |
| 47 | * contributors may be used to endorse or promote products derived |
| 48 | * from this software without specific prior written permission. |
| 49 | * |
| 50 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 51 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 52 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 53 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 54 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 56 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 57 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 58 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 59 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 60 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 61 | * |
| 62 | *****************************************************************************/ |
Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 63 | /* |
Tomas Winkler | 5a36ba0 | 2008-04-24 11:55:37 -0700 | [diff] [blame] | 64 | * Please use this file (iwl-commands.h) only for uCode API definitions. |
Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 65 | * Please use iwl-4965-hw.h for hardware-related definitions. |
Tomas Winkler | 3e0d4cb | 2008-04-24 11:55:38 -0700 | [diff] [blame] | 66 | * Please use iwl-dev.h for driver implementation definitions. |
Ben Cahill | fcd427b | 2007-11-29 11:10:00 +0800 | [diff] [blame] | 67 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 68 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 69 | #ifndef __iwl4965_commands_h__ |
| 70 | #define __iwl4965_commands_h__ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 71 | |
| 72 | enum { |
| 73 | REPLY_ALIVE = 0x1, |
| 74 | REPLY_ERROR = 0x2, |
| 75 | |
| 76 | /* RXON and QOS commands */ |
| 77 | REPLY_RXON = 0x10, |
| 78 | REPLY_RXON_ASSOC = 0x11, |
| 79 | REPLY_QOS_PARAM = 0x13, |
| 80 | REPLY_RXON_TIMING = 0x14, |
| 81 | |
| 82 | /* Multi-Station support */ |
| 83 | REPLY_ADD_STA = 0x18, |
| 84 | REPLY_REMOVE_STA = 0x19, /* not used */ |
| 85 | REPLY_REMOVE_ALL_STA = 0x1a, /* not used */ |
| 86 | |
Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 87 | /* Security */ |
| 88 | REPLY_WEPKEY = 0x20, |
| 89 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 90 | /* RX, TX, LEDs */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 91 | REPLY_TX = 0x1c, |
| 92 | REPLY_RATE_SCALE = 0x47, /* 3945 only */ |
| 93 | REPLY_LEDS_CMD = 0x48, |
| 94 | REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */ |
| 95 | |
Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 96 | /* WiMAX coexistence */ |
| 97 | COEX_PRIORITY_TABLE_CMD = 0x5a, /*5000 only */ |
| 98 | COEX_MEDIUM_NOTIFICATION = 0x5b, |
| 99 | COEX_EVENT_CMD = 0x5c, |
| 100 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 101 | /* 802.11h related */ |
| 102 | RADAR_NOTIFICATION = 0x70, /* not used */ |
| 103 | REPLY_QUIET_CMD = 0x71, /* not used */ |
| 104 | REPLY_CHANNEL_SWITCH = 0x72, |
| 105 | CHANNEL_SWITCH_NOTIFICATION = 0x73, |
| 106 | REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74, |
| 107 | SPECTRUM_MEASURE_NOTIFICATION = 0x75, |
| 108 | |
| 109 | /* Power Management */ |
| 110 | POWER_TABLE_CMD = 0x77, |
| 111 | PM_SLEEP_NOTIFICATION = 0x7A, |
| 112 | PM_DEBUG_STATISTIC_NOTIFIC = 0x7B, |
| 113 | |
| 114 | /* Scan commands and notifications */ |
| 115 | REPLY_SCAN_CMD = 0x80, |
| 116 | REPLY_SCAN_ABORT_CMD = 0x81, |
| 117 | SCAN_START_NOTIFICATION = 0x82, |
| 118 | SCAN_RESULTS_NOTIFICATION = 0x83, |
| 119 | SCAN_COMPLETE_NOTIFICATION = 0x84, |
| 120 | |
| 121 | /* IBSS/AP commands */ |
| 122 | BEACON_NOTIFICATION = 0x90, |
| 123 | REPLY_TX_BEACON = 0x91, |
| 124 | WHO_IS_AWAKE_NOTIFICATION = 0x94, /* not used */ |
| 125 | |
| 126 | /* Miscellaneous commands */ |
| 127 | QUIET_NOTIFICATION = 0x96, /* not used */ |
| 128 | REPLY_TX_PWR_TABLE_CMD = 0x97, |
Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 129 | REPLY_TX_POWER_DBM_CMD = 0x98, |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 130 | MEASURE_ABORT_NOTIFICATION = 0x99, /* not used */ |
| 131 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 132 | /* Bluetooth device coexistance config command */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 133 | REPLY_BT_CONFIG = 0x9b, |
| 134 | |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 135 | /* Statistics */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 136 | REPLY_STATISTICS_CMD = 0x9c, |
| 137 | STATISTICS_NOTIFICATION = 0x9d, |
| 138 | |
| 139 | /* RF-KILL commands and notifications */ |
| 140 | REPLY_CARD_STATE_CMD = 0xa0, |
| 141 | CARD_STATE_NOTIFICATION = 0xa1, |
| 142 | |
| 143 | /* Missed beacons notification */ |
| 144 | MISSED_BEACONS_NOTIFICATION = 0xa2, |
| 145 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 146 | REPLY_CT_KILL_CONFIG_CMD = 0xa4, |
| 147 | SENSITIVITY_CMD = 0xa8, |
| 148 | REPLY_PHY_CALIBRATION_CMD = 0xb0, |
| 149 | REPLY_RX_PHY_CMD = 0xc0, |
| 150 | REPLY_RX_MPDU_CMD = 0xc1, |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 151 | REPLY_RX = 0xc3, |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 152 | REPLY_COMPRESSED_BA = 0xc5, |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 153 | REPLY_MAX = 0xff |
| 154 | }; |
| 155 | |
| 156 | /****************************************************************************** |
| 157 | * (0) |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 158 | * Commonly used structures and definitions: |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 159 | * Command header, rate_n_flags, txpower |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 160 | * |
| 161 | *****************************************************************************/ |
| 162 | |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 163 | /* iwl_cmd_header flags value */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 164 | #define IWL_CMD_FAILED_MSK 0x40 |
| 165 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 166 | /** |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 167 | * struct iwl_cmd_header |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 168 | * |
| 169 | * This header format appears in the beginning of each command sent from the |
| 170 | * driver, and each response/notification received from uCode. |
| 171 | */ |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 172 | struct iwl_cmd_header { |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 173 | u8 cmd; /* Command ID: REPLY_RXON, etc. */ |
| 174 | u8 flags; /* IWL_CMD_* */ |
| 175 | /* |
| 176 | * The driver sets up the sequence number to values of its chosing. |
| 177 | * uCode does not use this value, but passes it back to the driver |
| 178 | * when sending the response to each driver-originated command, so |
| 179 | * the driver can match the response to the command. Since the values |
| 180 | * don't get used by uCode, the driver may set up an arbitrary format. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 181 | * |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 182 | * There is one exception: uCode sets bit 15 when it originates |
| 183 | * the response/notification, i.e. when the response/notification |
| 184 | * is not a direct response to a command sent by the driver. For |
| 185 | * example, uCode issues REPLY_3945_RX when it sends a received frame |
| 186 | * to the driver; it is not a direct response to any driver command. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 187 | * |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 188 | * The Linux driver uses the following format: |
| 189 | * |
| 190 | * 0:7 index/position within Tx queue |
| 191 | * 8:13 Tx queue selection |
| 192 | * 14:14 driver sets this to indicate command is in the 'huge' |
| 193 | * storage at the end of the command buffers, i.e. scan cmd |
| 194 | * 15:15 uCode sets this in uCode-originated response/notification |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 195 | */ |
| 196 | __le16 sequence; |
| 197 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 198 | /* command or response/notification data follows immediately */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 199 | u8 data[0]; |
| 200 | } __attribute__ ((packed)); |
| 201 | |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 202 | /** |
| 203 | * 4965 rate_n_flags bit fields |
| 204 | * |
| 205 | * rate_n_flags format is used in following 4965 commands: |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 206 | * REPLY_RX (response only) |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 207 | * REPLY_TX (both command and response) |
| 208 | * REPLY_TX_LINK_QUALITY_CMD |
| 209 | * |
| 210 | * High-throughput (HT) rate format for bits 7:0 (bit 8 must be "1"): |
| 211 | * 2-0: 0) 6 Mbps |
| 212 | * 1) 12 Mbps |
| 213 | * 2) 18 Mbps |
| 214 | * 3) 24 Mbps |
| 215 | * 4) 36 Mbps |
| 216 | * 5) 48 Mbps |
| 217 | * 6) 54 Mbps |
| 218 | * 7) 60 Mbps |
| 219 | * |
| 220 | * 3: 0) Single stream (SISO) |
| 221 | * 1) Dual stream (MIMO) |
| 222 | * |
| 223 | * 5: Value of 0x20 in bits 7:0 indicates 6 Mbps FAT duplicate data |
| 224 | * |
| 225 | * Legacy OFDM rate format for bits 7:0 (bit 8 must be "0", bit 9 "0"): |
| 226 | * 3-0: 0xD) 6 Mbps |
| 227 | * 0xF) 9 Mbps |
| 228 | * 0x5) 12 Mbps |
| 229 | * 0x7) 18 Mbps |
| 230 | * 0x9) 24 Mbps |
| 231 | * 0xB) 36 Mbps |
| 232 | * 0x1) 48 Mbps |
| 233 | * 0x3) 54 Mbps |
| 234 | * |
| 235 | * Legacy CCK rate format for bits 7:0 (bit 8 must be "0", bit 9 "1"): |
| 236 | * 3-0: 10) 1 Mbps |
| 237 | * 20) 2 Mbps |
| 238 | * 55) 5.5 Mbps |
| 239 | * 110) 11 Mbps |
| 240 | */ |
| 241 | #define RATE_MCS_CODE_MSK 0x7 |
| 242 | #define RATE_MCS_MIMO_POS 3 |
| 243 | #define RATE_MCS_MIMO_MSK 0x8 |
| 244 | #define RATE_MCS_HT_DUP_POS 5 |
| 245 | #define RATE_MCS_HT_DUP_MSK 0x20 |
| 246 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 247 | /* Bit 8: (1) HT format, (0) legacy format in bits 7:0 */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 248 | #define RATE_MCS_FLAGS_POS 8 |
| 249 | #define RATE_MCS_HT_POS 8 |
| 250 | #define RATE_MCS_HT_MSK 0x100 |
| 251 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 252 | /* Bit 9: (1) CCK, (0) OFDM. HT (bit 8) must be "0" for this bit to be valid */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 253 | #define RATE_MCS_CCK_POS 9 |
| 254 | #define RATE_MCS_CCK_MSK 0x200 |
| 255 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 256 | /* Bit 10: (1) Use Green Field preamble */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 257 | #define RATE_MCS_GF_POS 10 |
| 258 | #define RATE_MCS_GF_MSK 0x400 |
| 259 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 260 | /* Bit 11: (1) Use 40Mhz FAT chnl width, (0) use 20 MHz legacy chnl width */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 261 | #define RATE_MCS_FAT_POS 11 |
| 262 | #define RATE_MCS_FAT_MSK 0x800 |
| 263 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 264 | /* Bit 12: (1) Duplicate data on both 20MHz chnls. FAT (bit 11) must be set. */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 265 | #define RATE_MCS_DUP_POS 12 |
| 266 | #define RATE_MCS_DUP_MSK 0x1000 |
| 267 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 268 | /* Bit 13: (1) Short guard interval (0.4 usec), (0) normal GI (0.8 usec) */ |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 269 | #define RATE_MCS_SGI_POS 13 |
| 270 | #define RATE_MCS_SGI_MSK 0x2000 |
| 271 | |
| 272 | /** |
| 273 | * rate_n_flags Tx antenna masks (4965 has 2 transmitters): |
| 274 | * bit14:15 01 B inactive, A active |
| 275 | * 10 B active, A inactive |
| 276 | * 11 Both active |
| 277 | */ |
Guy Cohen | fde0db3 | 2008-04-21 15:42:01 -0700 | [diff] [blame] | 278 | #define RATE_MCS_ANT_POS 14 |
| 279 | #define RATE_MCS_ANT_A_MSK 0x04000 |
| 280 | #define RATE_MCS_ANT_B_MSK 0x08000 |
| 281 | #define RATE_MCS_ANT_C_MSK 0x10000 |
| 282 | #define RATE_MCS_ANT_ABC_MSK 0x1C000 |
Ben Cahill | abceddb | 2007-11-29 11:09:50 +0800 | [diff] [blame] | 283 | |
Tomas Winkler | f53696d | 2008-06-12 09:47:12 +0800 | [diff] [blame^] | 284 | #define RATE_MCS_ANT_INIT_IND 1 |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 285 | |
| 286 | #define POWER_TABLE_NUM_ENTRIES 33 |
| 287 | #define POWER_TABLE_NUM_HT_OFDM_ENTRIES 32 |
| 288 | #define POWER_TABLE_CCK_ENTRY 32 |
| 289 | |
| 290 | /** |
| 291 | * union iwl4965_tx_power_dual_stream |
| 292 | * |
| 293 | * Host format used for REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH |
| 294 | * Use __le32 version (struct tx_power_dual_stream) when building command. |
| 295 | * |
| 296 | * Driver provides radio gain and DSP attenuation settings to device in pairs, |
| 297 | * one value for each transmitter chain. The first value is for transmitter A, |
| 298 | * second for transmitter B. |
| 299 | * |
| 300 | * For SISO bit rates, both values in a pair should be identical. |
| 301 | * For MIMO rates, one value may be different from the other, |
| 302 | * in order to balance the Tx output between the two transmitters. |
| 303 | * |
| 304 | * See more details in doc for TXPOWER in iwl-4965-hw.h. |
| 305 | */ |
| 306 | union iwl4965_tx_power_dual_stream { |
| 307 | struct { |
| 308 | u8 radio_tx_gain[2]; |
| 309 | u8 dsp_predis_atten[2]; |
| 310 | } s; |
| 311 | u32 dw; |
| 312 | }; |
| 313 | |
| 314 | /** |
| 315 | * struct tx_power_dual_stream |
| 316 | * |
| 317 | * Table entries in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH |
| 318 | * |
| 319 | * Same format as iwl_tx_power_dual_stream, but __le32 |
| 320 | */ |
| 321 | struct tx_power_dual_stream { |
| 322 | __le32 dw; |
| 323 | } __attribute__ ((packed)); |
| 324 | |
| 325 | /** |
| 326 | * struct iwl4965_tx_power_db |
| 327 | * |
| 328 | * Entire table within REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH |
| 329 | */ |
| 330 | struct iwl4965_tx_power_db { |
| 331 | struct tx_power_dual_stream power_tbl[POWER_TABLE_NUM_ENTRIES]; |
| 332 | } __attribute__ ((packed)); |
| 333 | |
Tomas Winkler | 630fe9b | 2008-06-12 09:47:08 +0800 | [diff] [blame] | 334 | /** |
| 335 | * Commad REPLY_TX_POWER_DBM_CMD = 0x98 |
| 336 | * struct iwl5000_tx_power_dbm_cmd |
| 337 | */ |
| 338 | #define IWL50_TX_POWER_AUTO 0x7f |
| 339 | struct iwl5000_tx_power_dbm_cmd { |
| 340 | s8 global_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ |
| 341 | u8 flags; |
| 342 | s8 srv_chan_lmt; /*in half-dBm (e.g. 30 = 15 dBm) */ |
| 343 | u8 reserved; |
| 344 | } __attribute__ ((packed)); |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 345 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 346 | /****************************************************************************** |
| 347 | * (0a) |
| 348 | * Alive and Error Commands & Responses: |
| 349 | * |
| 350 | *****************************************************************************/ |
| 351 | |
| 352 | #define UCODE_VALID_OK __constant_cpu_to_le32(0x1) |
| 353 | #define INITIALIZE_SUBTYPE (9) |
| 354 | |
| 355 | /* |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 356 | * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command) |
| 357 | * |
| 358 | * uCode issues this "initialize alive" notification once the initialization |
| 359 | * uCode image has completed its work, and is ready to load the runtime image. |
| 360 | * This is the *first* "alive" notification that the driver will receive after |
| 361 | * rebooting uCode; the "initialize" alive is indicated by subtype field == 9. |
| 362 | * |
| 363 | * See comments documenting "BSM" (bootstrap state machine). |
| 364 | * |
| 365 | * For 4965, this notification contains important calibration data for |
| 366 | * calculating txpower settings: |
| 367 | * |
| 368 | * 1) Power supply voltage indication. The voltage sensor outputs higher |
| 369 | * values for lower voltage, and vice versa. |
| 370 | * |
| 371 | * 2) Temperature measurement parameters, for each of two channel widths |
| 372 | * (20 MHz and 40 MHz) supported by the radios. Temperature sensing |
| 373 | * is done via one of the receiver chains, and channel width influences |
| 374 | * the results. |
| 375 | * |
| 376 | * 3) Tx gain compensation to balance 4965's 2 Tx chains for MIMO operation, |
| 377 | * for each of 5 frequency ranges. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 378 | */ |
Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 379 | struct iwl_init_alive_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 380 | u8 ucode_minor; |
| 381 | u8 ucode_major; |
| 382 | __le16 reserved1; |
| 383 | u8 sw_rev[8]; |
| 384 | u8 ver_type; |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 385 | u8 ver_subtype; /* "9" for initialize alive */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 386 | __le16 reserved2; |
| 387 | __le32 log_event_table_ptr; |
| 388 | __le32 error_event_table_ptr; |
| 389 | __le32 timestamp; |
| 390 | __le32 is_valid; |
| 391 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 392 | /* calibration values from "initialize" uCode */ |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 393 | __le32 voltage; /* signed, higher value is lower voltage */ |
| 394 | __le32 therm_r1[2]; /* signed, 1st for normal, 2nd for FAT channel*/ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 395 | __le32 therm_r2[2]; /* signed */ |
| 396 | __le32 therm_r3[2]; /* signed */ |
| 397 | __le32 therm_r4[2]; /* signed */ |
| 398 | __le32 tx_atten[5][2]; /* signed MIMO gain comp, 5 freq groups, |
| 399 | * 2 Tx chains */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 400 | } __attribute__ ((packed)); |
| 401 | |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 402 | |
| 403 | /** |
| 404 | * REPLY_ALIVE = 0x1 (response only, not a command) |
| 405 | * |
| 406 | * uCode issues this "alive" notification once the runtime image is ready |
| 407 | * to receive commands from the driver. This is the *second* "alive" |
| 408 | * notification that the driver will receive after rebooting uCode; |
| 409 | * this "alive" is indicated by subtype field != 9. |
| 410 | * |
| 411 | * See comments documenting "BSM" (bootstrap state machine). |
| 412 | * |
| 413 | * This response includes two pointers to structures within the device's |
| 414 | * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging: |
| 415 | * |
| 416 | * 1) log_event_table_ptr indicates base of the event log. This traces |
| 417 | * a 256-entry history of uCode execution within a circular buffer. |
| 418 | * Its header format is: |
| 419 | * |
| 420 | * __le32 log_size; log capacity (in number of entries) |
| 421 | * __le32 type; (1) timestamp with each entry, (0) no timestamp |
| 422 | * __le32 wraps; # times uCode has wrapped to top of circular buffer |
| 423 | * __le32 write_index; next circular buffer entry that uCode would fill |
| 424 | * |
| 425 | * The header is followed by the circular buffer of log entries. Entries |
| 426 | * with timestamps have the following format: |
| 427 | * |
| 428 | * __le32 event_id; range 0 - 1500 |
| 429 | * __le32 timestamp; low 32 bits of TSF (of network, if associated) |
| 430 | * __le32 data; event_id-specific data value |
| 431 | * |
| 432 | * Entries without timestamps contain only event_id and data. |
| 433 | * |
| 434 | * 2) error_event_table_ptr indicates base of the error log. This contains |
| 435 | * information about any uCode error that occurs. For 4965, the format |
| 436 | * of the error log is: |
| 437 | * |
| 438 | * __le32 valid; (nonzero) valid, (0) log is empty |
| 439 | * __le32 error_id; type of error |
| 440 | * __le32 pc; program counter |
| 441 | * __le32 blink1; branch link |
| 442 | * __le32 blink2; branch link |
| 443 | * __le32 ilink1; interrupt link |
| 444 | * __le32 ilink2; interrupt link |
| 445 | * __le32 data1; error-specific data |
| 446 | * __le32 data2; error-specific data |
| 447 | * __le32 line; source code line of error |
| 448 | * __le32 bcon_time; beacon timer |
| 449 | * __le32 tsf_low; network timestamp function timer |
| 450 | * __le32 tsf_hi; network timestamp function timer |
| 451 | * |
| 452 | * The Linux driver can print both logs to the system log when a uCode error |
| 453 | * occurs. |
| 454 | */ |
Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 455 | struct iwl_alive_resp { |
Ben Cahill | 075416c | 2007-11-29 11:10:08 +0800 | [diff] [blame] | 456 | u8 ucode_minor; |
| 457 | u8 ucode_major; |
| 458 | __le16 reserved1; |
| 459 | u8 sw_rev[8]; |
| 460 | u8 ver_type; |
| 461 | u8 ver_subtype; /* not "9" for runtime alive */ |
| 462 | __le16 reserved2; |
| 463 | __le32 log_event_table_ptr; /* SRAM address for event log */ |
| 464 | __le32 error_event_table_ptr; /* SRAM address for error log */ |
| 465 | __le32 timestamp; |
| 466 | __le32 is_valid; |
| 467 | } __attribute__ ((packed)); |
| 468 | |
| 469 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 470 | union tsf { |
| 471 | u8 byte[8]; |
| 472 | __le16 word[4]; |
| 473 | __le32 dw[2]; |
| 474 | }; |
| 475 | |
| 476 | /* |
| 477 | * REPLY_ERROR = 0x2 (response only, not a command) |
| 478 | */ |
Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 479 | struct iwl_error_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 480 | __le32 error_type; |
| 481 | u8 cmd_id; |
| 482 | u8 reserved1; |
| 483 | __le16 bad_cmd_seq_num; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 484 | __le32 error_info; |
| 485 | union tsf timestamp; |
| 486 | } __attribute__ ((packed)); |
| 487 | |
| 488 | /****************************************************************************** |
| 489 | * (1) |
| 490 | * RXON Commands & Responses: |
| 491 | * |
| 492 | *****************************************************************************/ |
| 493 | |
| 494 | /* |
| 495 | * Rx config defines & structure |
| 496 | */ |
| 497 | /* rx_config device types */ |
| 498 | enum { |
| 499 | RXON_DEV_TYPE_AP = 1, |
| 500 | RXON_DEV_TYPE_ESS = 3, |
| 501 | RXON_DEV_TYPE_IBSS = 4, |
| 502 | RXON_DEV_TYPE_SNIFFER = 6, |
| 503 | }; |
| 504 | |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 505 | |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 506 | #define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1 << 0) |
| 507 | #define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7 << 1) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 508 | #define RXON_RX_CHAIN_VALID_POS (1) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 509 | #define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7 << 4) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 510 | #define RXON_RX_CHAIN_FORCE_SEL_POS (4) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 511 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7 << 7) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 512 | #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 513 | #define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3 << 10) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 514 | #define RXON_RX_CHAIN_CNT_POS (10) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 515 | #define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3 << 12) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 516 | #define RXON_RX_CHAIN_MIMO_CNT_POS (12) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 517 | #define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1 << 14) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 518 | #define RXON_RX_CHAIN_MIMO_FORCE_POS (14) |
| 519 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 520 | /* rx_config flags */ |
| 521 | /* band & modulation selection */ |
| 522 | #define RXON_FLG_BAND_24G_MSK __constant_cpu_to_le32(1 << 0) |
| 523 | #define RXON_FLG_CCK_MSK __constant_cpu_to_le32(1 << 1) |
| 524 | /* auto detection enable */ |
| 525 | #define RXON_FLG_AUTO_DETECT_MSK __constant_cpu_to_le32(1 << 2) |
| 526 | /* TGg protection when tx */ |
| 527 | #define RXON_FLG_TGG_PROTECT_MSK __constant_cpu_to_le32(1 << 3) |
| 528 | /* cck short slot & preamble */ |
| 529 | #define RXON_FLG_SHORT_SLOT_MSK __constant_cpu_to_le32(1 << 4) |
| 530 | #define RXON_FLG_SHORT_PREAMBLE_MSK __constant_cpu_to_le32(1 << 5) |
| 531 | /* antenna selection */ |
| 532 | #define RXON_FLG_DIS_DIV_MSK __constant_cpu_to_le32(1 << 7) |
| 533 | #define RXON_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0x0f00) |
| 534 | #define RXON_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) |
| 535 | #define RXON_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) |
| 536 | /* radar detection enable */ |
| 537 | #define RXON_FLG_RADAR_DETECT_MSK __constant_cpu_to_le32(1 << 12) |
| 538 | #define RXON_FLG_TGJ_NARROW_BAND_MSK __constant_cpu_to_le32(1 << 13) |
| 539 | /* rx response to host with 8-byte TSF |
| 540 | * (according to ON_AIR deassertion) */ |
| 541 | #define RXON_FLG_TSF2HOST_MSK __constant_cpu_to_le32(1 << 15) |
| 542 | |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 543 | |
| 544 | /* HT flags */ |
| 545 | #define RXON_FLG_CTRL_CHANNEL_LOC_POS (22) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 546 | #define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK __constant_cpu_to_le32(0x1 << 22) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 547 | |
| 548 | #define RXON_FLG_HT_OPERATING_MODE_POS (23) |
| 549 | |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 550 | #define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1 << 23) |
| 551 | #define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2 << 23) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 552 | |
| 553 | #define RXON_FLG_CHANNEL_MODE_POS (25) |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 554 | #define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3 << 25) |
| 555 | #define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1 << 25) |
| 556 | #define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2 << 25) |
Ben Cahill | 14519a0 | 2007-11-29 11:09:59 +0800 | [diff] [blame] | 557 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 558 | /* rx_config filter flags */ |
| 559 | /* accept all data frames */ |
| 560 | #define RXON_FILTER_PROMISC_MSK __constant_cpu_to_le32(1 << 0) |
| 561 | /* pass control & management to host */ |
| 562 | #define RXON_FILTER_CTL2HOST_MSK __constant_cpu_to_le32(1 << 1) |
| 563 | /* accept multi-cast */ |
| 564 | #define RXON_FILTER_ACCEPT_GRP_MSK __constant_cpu_to_le32(1 << 2) |
| 565 | /* don't decrypt uni-cast frames */ |
| 566 | #define RXON_FILTER_DIS_DECRYPT_MSK __constant_cpu_to_le32(1 << 3) |
| 567 | /* don't decrypt multi-cast frames */ |
| 568 | #define RXON_FILTER_DIS_GRP_DECRYPT_MSK __constant_cpu_to_le32(1 << 4) |
| 569 | /* STA is associated */ |
| 570 | #define RXON_FILTER_ASSOC_MSK __constant_cpu_to_le32(1 << 5) |
| 571 | /* transfer to host non bssid beacons in associated state */ |
| 572 | #define RXON_FILTER_BCON_AWARE_MSK __constant_cpu_to_le32(1 << 6) |
| 573 | |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 574 | /** |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 575 | * REPLY_RXON = 0x10 (command, has simple generic response) |
Ben Cahill | 80cc0c3 | 2007-11-29 11:10:09 +0800 | [diff] [blame] | 576 | * |
| 577 | * RXON tunes the radio tuner to a service channel, and sets up a number |
| 578 | * of parameters that are used primarily for Rx, but also for Tx operations. |
| 579 | * |
| 580 | * NOTE: When tuning to a new channel, driver must set the |
| 581 | * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent |
| 582 | * info within the device, including the station tables, tx retry |
| 583 | * rate tables, and txpower tables. Driver must build a new station |
| 584 | * table and txpower table before transmitting anything on the RXON |
| 585 | * channel. |
| 586 | * |
| 587 | * NOTE: All RXONs wipe clean the internal txpower table. Driver must |
| 588 | * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), |
| 589 | * regardless of whether RXON_FILTER_ASSOC_MSK is set. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 590 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 591 | struct iwl4965_rxon_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 592 | u8 node_addr[6]; |
| 593 | __le16 reserved1; |
| 594 | u8 bssid_addr[6]; |
| 595 | __le16 reserved2; |
| 596 | u8 wlap_bssid_addr[6]; |
| 597 | __le16 reserved3; |
| 598 | u8 dev_type; |
| 599 | u8 air_propagation; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 600 | __le16 rx_chain; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 601 | u8 ofdm_basic_rates; |
| 602 | u8 cck_basic_rates; |
| 603 | __le16 assoc_id; |
| 604 | __le32 flags; |
| 605 | __le32 filter_flags; |
| 606 | __le16 channel; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 607 | u8 ofdm_ht_single_stream_basic_rates; |
| 608 | u8 ofdm_ht_dual_stream_basic_rates; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 609 | } __attribute__ ((packed)); |
| 610 | |
Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 611 | /* 5000 HW just extend this cmmand */ |
| 612 | struct iwl_rxon_cmd { |
| 613 | u8 node_addr[6]; |
| 614 | __le16 reserved1; |
| 615 | u8 bssid_addr[6]; |
| 616 | __le16 reserved2; |
| 617 | u8 wlap_bssid_addr[6]; |
| 618 | __le16 reserved3; |
| 619 | u8 dev_type; |
| 620 | u8 air_propagation; |
| 621 | __le16 rx_chain; |
| 622 | u8 ofdm_basic_rates; |
| 623 | u8 cck_basic_rates; |
| 624 | __le16 assoc_id; |
| 625 | __le32 flags; |
| 626 | __le32 filter_flags; |
| 627 | __le16 channel; |
| 628 | u8 ofdm_ht_single_stream_basic_rates; |
| 629 | u8 ofdm_ht_dual_stream_basic_rates; |
| 630 | u8 ofdm_ht_triple_stream_basic_rates; |
| 631 | u8 reserved5; |
| 632 | __le16 acquisition_data; |
| 633 | __le16 reserved6; |
| 634 | } __attribute__ ((packed)); |
| 635 | |
Ron Rindjunsky | fe7a90c | 2008-05-29 16:35:14 +0800 | [diff] [blame] | 636 | struct iwl5000_rxon_assoc_cmd { |
| 637 | __le32 flags; |
| 638 | __le32 filter_flags; |
| 639 | u8 ofdm_basic_rates; |
| 640 | u8 cck_basic_rates; |
| 641 | __le16 reserved1; |
| 642 | u8 ofdm_ht_single_stream_basic_rates; |
| 643 | u8 ofdm_ht_dual_stream_basic_rates; |
| 644 | u8 ofdm_ht_triple_stream_basic_rates; |
| 645 | u8 reserved2; |
| 646 | __le16 rx_chain_select_flags; |
| 647 | __le16 acquisition_data; |
| 648 | __le32 reserved3; |
| 649 | } __attribute__ ((packed)); |
Gregory Greenman | c1adf9f | 2008-05-15 13:53:59 +0800 | [diff] [blame] | 650 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 651 | /* |
| 652 | * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response) |
| 653 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 654 | struct iwl4965_rxon_assoc_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 655 | __le32 flags; |
| 656 | __le32 filter_flags; |
| 657 | u8 ofdm_basic_rates; |
| 658 | u8 cck_basic_rates; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 659 | u8 ofdm_ht_single_stream_basic_rates; |
| 660 | u8 ofdm_ht_dual_stream_basic_rates; |
| 661 | __le16 rx_chain_select_flags; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 662 | __le16 reserved; |
| 663 | } __attribute__ ((packed)); |
| 664 | |
Ron Rindjunsky | fe7a90c | 2008-05-29 16:35:14 +0800 | [diff] [blame] | 665 | |
| 666 | |
| 667 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 668 | /* |
| 669 | * REPLY_RXON_TIMING = 0x14 (command, has simple generic response) |
| 670 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 671 | struct iwl4965_rxon_time_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 672 | union tsf timestamp; |
| 673 | __le16 beacon_interval; |
| 674 | __le16 atim_window; |
| 675 | __le32 beacon_init_val; |
| 676 | __le16 listen_interval; |
| 677 | __le16 reserved; |
| 678 | } __attribute__ ((packed)); |
| 679 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 680 | /* |
| 681 | * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) |
| 682 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 683 | struct iwl4965_channel_switch_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 684 | u8 band; |
| 685 | u8 expect_beacon; |
| 686 | __le16 channel; |
| 687 | __le32 rxon_flags; |
| 688 | __le32 rxon_filter_flags; |
| 689 | __le32 switch_time; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 690 | struct iwl4965_tx_power_db tx_power; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 691 | } __attribute__ ((packed)); |
| 692 | |
| 693 | /* |
| 694 | * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command) |
| 695 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 696 | struct iwl4965_csa_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 697 | __le16 band; |
| 698 | __le16 channel; |
| 699 | __le32 status; /* 0 - OK, 1 - fail */ |
| 700 | } __attribute__ ((packed)); |
| 701 | |
| 702 | /****************************************************************************** |
| 703 | * (2) |
| 704 | * Quality-of-Service (QOS) Commands & Responses: |
| 705 | * |
| 706 | *****************************************************************************/ |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 707 | |
| 708 | /** |
| 709 | * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM |
| 710 | * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd |
| 711 | * |
| 712 | * @cw_min: Contention window, start value in numbers of slots. |
| 713 | * Should be a power-of-2, minus 1. Device's default is 0x0f. |
| 714 | * @cw_max: Contention window, max value in numbers of slots. |
| 715 | * Should be a power-of-2, minus 1. Device's default is 0x3f. |
| 716 | * @aifsn: Number of slots in Arbitration Interframe Space (before |
| 717 | * performing random backoff timing prior to Tx). Device default 1. |
| 718 | * @edca_txop: Length of Tx opportunity, in uSecs. Device default is 0. |
| 719 | * |
| 720 | * Device will automatically increase contention window by (2*CW) + 1 for each |
| 721 | * transmission retry. Device uses cw_max as a bit mask, ANDed with new CW |
| 722 | * value, to cap the CW value. |
| 723 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 724 | struct iwl4965_ac_qos { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 725 | __le16 cw_min; |
| 726 | __le16 cw_max; |
| 727 | u8 aifsn; |
| 728 | u8 reserved1; |
| 729 | __le16 edca_txop; |
| 730 | } __attribute__ ((packed)); |
| 731 | |
| 732 | /* QoS flags defines */ |
| 733 | #define QOS_PARAM_FLG_UPDATE_EDCA_MSK __constant_cpu_to_le32(0x01) |
| 734 | #define QOS_PARAM_FLG_TGN_MSK __constant_cpu_to_le32(0x02) |
| 735 | #define QOS_PARAM_FLG_TXOP_TYPE_MSK __constant_cpu_to_le32(0x10) |
| 736 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 737 | /* Number of Access Categories (AC) (EDCA), queues 0..3 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 738 | #define AC_NUM 4 |
| 739 | |
| 740 | /* |
| 741 | * REPLY_QOS_PARAM = 0x13 (command, has simple generic response) |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 742 | * |
| 743 | * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs |
| 744 | * 0: Background, 1: Best Effort, 2: Video, 3: Voice. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 745 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 746 | struct iwl4965_qosparam_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 747 | __le32 qos_flags; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 748 | struct iwl4965_ac_qos ac[AC_NUM]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 749 | } __attribute__ ((packed)); |
| 750 | |
| 751 | /****************************************************************************** |
| 752 | * (3) |
| 753 | * Add/Modify Stations Commands & Responses: |
| 754 | * |
| 755 | *****************************************************************************/ |
| 756 | /* |
| 757 | * Multi station support |
| 758 | */ |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 759 | |
| 760 | /* Special, dedicated locations within device's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 761 | #define IWL_AP_ID 0 |
| 762 | #define IWL_MULTICAST_ID 1 |
| 763 | #define IWL_STA_ID 2 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 764 | #define IWL4965_BROADCAST_ID 31 |
| 765 | #define IWL4965_STATION_COUNT 32 |
Tomas Winkler | fdd3e8a | 2008-04-24 11:55:28 -0700 | [diff] [blame] | 766 | #define IWL5000_BROADCAST_ID 15 |
| 767 | #define IWL5000_STATION_COUNT 16 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 768 | |
| 769 | #define IWL_STATION_COUNT 32 /* MAX(3945,4965)*/ |
| 770 | #define IWL_INVALID_STATION 255 |
| 771 | |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 772 | #define STA_FLG_PWR_SAVE_MSK __constant_cpu_to_le32(1 << 8); |
Ben Cahill | 74093dd | 2007-11-29 11:09:53 +0800 | [diff] [blame] | 773 | #define STA_FLG_RTS_MIMO_PROT_MSK __constant_cpu_to_le32(1 << 17) |
| 774 | #define STA_FLG_AGG_MPDU_8US_MSK __constant_cpu_to_le32(1 << 18) |
| 775 | #define STA_FLG_MAX_AGG_SIZE_POS (19) |
| 776 | #define STA_FLG_MAX_AGG_SIZE_MSK __constant_cpu_to_le32(3 << 19) |
| 777 | #define STA_FLG_FAT_EN_MSK __constant_cpu_to_le32(1 << 21) |
| 778 | #define STA_FLG_MIMO_DIS_MSK __constant_cpu_to_le32(1 << 22) |
| 779 | #define STA_FLG_AGG_MPDU_DENSITY_POS (23) |
| 780 | #define STA_FLG_AGG_MPDU_DENSITY_MSK __constant_cpu_to_le32(7 << 23) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 781 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 782 | /* Use in mode field. 1: modify existing entry, 0: add new station entry */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 783 | #define STA_CONTROL_MODIFY_MSK 0x01 |
| 784 | |
| 785 | /* key flags __le16*/ |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 786 | #define STA_KEY_FLG_ENCRYPT_MSK __constant_cpu_to_le16(0x0007) |
| 787 | #define STA_KEY_FLG_NO_ENC __constant_cpu_to_le16(0x0000) |
| 788 | #define STA_KEY_FLG_WEP __constant_cpu_to_le16(0x0001) |
| 789 | #define STA_KEY_FLG_CCMP __constant_cpu_to_le16(0x0002) |
| 790 | #define STA_KEY_FLG_TKIP __constant_cpu_to_le16(0x0003) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 791 | |
| 792 | #define STA_KEY_FLG_KEYID_POS 8 |
| 793 | #define STA_KEY_FLG_INVALID __constant_cpu_to_le16(0x0800) |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 794 | /* wep key is either from global key (0) or from station info array (1) */ |
| 795 | #define STA_KEY_FLG_MAP_KEY_MSK __constant_cpu_to_le16(0x0008) |
| 796 | |
| 797 | /* wep key in STA: 5-bytes (0) or 13-bytes (1) */ |
| 798 | #define STA_KEY_FLG_KEY_SIZE_MSK __constant_cpu_to_le16(0x1000) |
| 799 | #define STA_KEY_MULTICAST_MSK __constant_cpu_to_le16(0x4000) |
Emmanuel Grumbach | deb09c4 | 2008-03-19 16:41:41 -0700 | [diff] [blame] | 800 | #define STA_KEY_MAX_NUM 8 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 801 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 802 | /* Flags indicate whether to modify vs. don't change various station params */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 803 | #define STA_MODIFY_KEY_MASK 0x01 |
| 804 | #define STA_MODIFY_TID_DISABLE_TX 0x02 |
| 805 | #define STA_MODIFY_TX_RATE_MSK 0x04 |
| 806 | #define STA_MODIFY_ADDBA_TID_MSK 0x08 |
| 807 | #define STA_MODIFY_DELBA_TID_MSK 0x10 |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 808 | |
| 809 | /* Receiver address (actually, Rx station's index into station table), |
| 810 | * combined with Traffic ID (QOS priority), in format used by Tx Scheduler */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 811 | #define BUILD_RAxTID(sta_id, tid) (((sta_id) << 4) + (tid)) |
| 812 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 813 | struct iwl4965_keyinfo { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 814 | __le16 key_flags; |
| 815 | u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ |
| 816 | u8 reserved1; |
| 817 | __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ |
Emmanuel Grumbach | eaaf789 | 2008-02-13 11:32:29 -0800 | [diff] [blame] | 818 | u8 key_offset; |
| 819 | u8 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 820 | u8 key[16]; /* 16-byte unicast decryption key */ |
| 821 | } __attribute__ ((packed)); |
| 822 | |
Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 823 | /* 5000 */ |
| 824 | struct iwl_keyinfo { |
| 825 | __le16 key_flags; |
| 826 | u8 tkip_rx_tsc_byte2; /* TSC[2] for key mix ph1 detection */ |
| 827 | u8 reserved1; |
| 828 | __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */ |
| 829 | u8 key_offset; |
| 830 | u8 reserved2; |
| 831 | u8 key[16]; /* 16-byte unicast decryption key */ |
| 832 | __le64 tx_secur_seq_cnt; |
| 833 | __le64 hw_tkip_mic_rx_key; |
| 834 | __le64 hw_tkip_mic_tx_key; |
| 835 | } __attribute__ ((packed)); |
| 836 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 837 | /** |
| 838 | * struct sta_id_modify |
| 839 | * @addr[ETH_ALEN]: station's MAC address |
| 840 | * @sta_id: index of station in uCode's station table |
| 841 | * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change |
| 842 | * |
| 843 | * Driver selects unused table index when adding new station, |
| 844 | * or the index to a pre-existing station entry when modifying that station. |
| 845 | * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP). |
| 846 | * |
| 847 | * modify_mask flags select which parameters to modify vs. leave alone. |
| 848 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 849 | struct sta_id_modify { |
| 850 | u8 addr[ETH_ALEN]; |
| 851 | __le16 reserved1; |
| 852 | u8 sta_id; |
| 853 | u8 modify_mask; |
| 854 | __le16 reserved2; |
| 855 | } __attribute__ ((packed)); |
| 856 | |
| 857 | /* |
| 858 | * REPLY_ADD_STA = 0x18 (command) |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 859 | * |
| 860 | * The device contains an internal table of per-station information, |
| 861 | * with info on security keys, aggregation parameters, and Tx rates for |
| 862 | * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD, |
| 863 | * 3945 uses REPLY_RATE_SCALE to set up rate tables). |
| 864 | * |
| 865 | * REPLY_ADD_STA sets up the table entry for one station, either creating |
| 866 | * a new entry, or modifying a pre-existing one. |
| 867 | * |
| 868 | * NOTE: RXON command (without "associated" bit set) wipes the station table |
| 869 | * clean. Moving into RF_KILL state does this also. Driver must set up |
| 870 | * new station table before transmitting anything on the RXON channel |
| 871 | * (except active scans or active measurements; those commands carry |
| 872 | * their own txpower/rate setup data). |
| 873 | * |
| 874 | * When getting started on a new channel, driver must set up the |
| 875 | * IWL_BROADCAST_ID entry (last entry in the table). For a client |
| 876 | * station in a BSS, once an AP is selected, driver sets up the AP STA |
| 877 | * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP |
| 878 | * are all that are needed for a BSS client station. If the device is |
| 879 | * used as AP, or in an IBSS network, driver must set up station table |
| 880 | * entries for all STAs in network, starting with index IWL_STA_ID. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 881 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 882 | struct iwl4965_addsta_cmd { |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 883 | u8 mode; /* 1: modify existing, 0: add new station */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 884 | u8 reserved[3]; |
| 885 | struct sta_id_modify sta; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 886 | struct iwl4965_keyinfo key; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 887 | __le32 station_flags; /* STA_FLG_* */ |
| 888 | __le32 station_flags_msk; /* STA_FLG_* */ |
| 889 | |
| 890 | /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) |
| 891 | * corresponding to bit (e.g. bit 5 controls TID 5). |
| 892 | * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 893 | __le16 tid_disable_tx; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 894 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 895 | __le16 reserved1; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 896 | |
| 897 | /* TID for which to add block-ack support. |
| 898 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 899 | u8 add_immediate_ba_tid; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 900 | |
| 901 | /* TID for which to remove block-ack support. |
| 902 | * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 903 | u8 remove_immediate_ba_tid; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 904 | |
| 905 | /* Starting Sequence Number for added block-ack support. |
| 906 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 907 | __le16 add_immediate_ba_ssn; |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 908 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 909 | __le32 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 910 | } __attribute__ ((packed)); |
| 911 | |
Tomas Winkler | 133636d | 2008-05-05 10:22:34 +0800 | [diff] [blame] | 912 | /* 5000 */ |
| 913 | struct iwl_addsta_cmd { |
| 914 | u8 mode; /* 1: modify existing, 0: add new station */ |
| 915 | u8 reserved[3]; |
| 916 | struct sta_id_modify sta; |
| 917 | struct iwl_keyinfo key; |
| 918 | __le32 station_flags; /* STA_FLG_* */ |
| 919 | __le32 station_flags_msk; /* STA_FLG_* */ |
| 920 | |
| 921 | /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID) |
| 922 | * corresponding to bit (e.g. bit 5 controls TID 5). |
| 923 | * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */ |
| 924 | __le16 tid_disable_tx; |
| 925 | |
| 926 | __le16 reserved1; |
| 927 | |
| 928 | /* TID for which to add block-ack support. |
| 929 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
| 930 | u8 add_immediate_ba_tid; |
| 931 | |
| 932 | /* TID for which to remove block-ack support. |
| 933 | * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */ |
| 934 | u8 remove_immediate_ba_tid; |
| 935 | |
| 936 | /* Starting Sequence Number for added block-ack support. |
| 937 | * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */ |
| 938 | __le16 add_immediate_ba_ssn; |
| 939 | |
| 940 | __le32 reserved2; |
| 941 | } __attribute__ ((packed)); |
| 942 | |
| 943 | |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 944 | #define ADD_STA_SUCCESS_MSK 0x1 |
| 945 | #define ADD_STA_NO_ROOM_IN_TABLE 0x2 |
| 946 | #define ADD_STA_NO_BLOCK_ACK_RESOURCE 0x4 |
| 947 | #define ADD_STA_MODIFY_NON_EXIST_STA 0x8 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 948 | /* |
| 949 | * REPLY_ADD_STA = 0x18 (response) |
| 950 | */ |
Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 951 | struct iwl_add_sta_resp { |
Ben Cahill | 2054a00 | 2007-11-29 11:10:10 +0800 | [diff] [blame] | 952 | u8 status; /* ADD_STA_* */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 953 | } __attribute__ ((packed)); |
| 954 | |
Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 955 | #define REM_STA_SUCCESS_MSK 0x1 |
| 956 | /* |
| 957 | * REPLY_REM_STA = 0x19 (response) |
| 958 | */ |
| 959 | struct iwl_rem_sta_resp { |
| 960 | u8 status; |
| 961 | } __attribute__ ((packed)); |
| 962 | |
| 963 | /* |
| 964 | * REPLY_REM_STA = 0x19 (command) |
| 965 | */ |
| 966 | struct iwl_rem_sta_cmd { |
| 967 | u8 num_sta; /* number of removed stations */ |
| 968 | u8 reserved[3]; |
| 969 | u8 addr[ETH_ALEN]; /* MAC addr of the first station */ |
| 970 | u8 reserved2[2]; |
| 971 | } __attribute__ ((packed)); |
| 972 | |
Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 973 | /* |
| 974 | * REPLY_WEP_KEY = 0x20 |
| 975 | */ |
| 976 | struct iwl_wep_key { |
| 977 | u8 key_index; |
| 978 | u8 key_offset; |
| 979 | u8 reserved1[2]; |
| 980 | u8 key_size; |
| 981 | u8 reserved2[3]; |
| 982 | u8 key[16]; |
| 983 | } __attribute__ ((packed)); |
| 984 | |
| 985 | struct iwl_wep_cmd { |
| 986 | u8 num_keys; |
| 987 | u8 global_key_type; |
| 988 | u8 flags; |
| 989 | u8 reserved; |
| 990 | struct iwl_wep_key key[0]; |
| 991 | } __attribute__ ((packed)); |
| 992 | |
| 993 | #define WEP_KEY_WEP_TYPE 1 |
| 994 | #define WEP_KEYS_MAX 4 |
| 995 | #define WEP_INVALID_OFFSET 0xff |
Emmanuel Grumbach | 4564ce8 | 2008-06-12 09:47:09 +0800 | [diff] [blame] | 996 | #define WEP_KEY_LEN_64 5 |
Emmanuel Grumbach | 0a0bed1 | 2008-04-14 21:16:05 -0700 | [diff] [blame] | 997 | #define WEP_KEY_LEN_128 13 |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 998 | |
| 999 | /****************************************************************************** |
| 1000 | * (4) |
| 1001 | * Rx Responses: |
| 1002 | * |
| 1003 | *****************************************************************************/ |
| 1004 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1005 | struct iwl4965_rx_frame_stats { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1006 | u8 phy_count; |
| 1007 | u8 id; |
| 1008 | u8 rssi; |
| 1009 | u8 agc; |
| 1010 | __le16 sig_avg; |
| 1011 | __le16 noise_diff; |
| 1012 | u8 payload[0]; |
| 1013 | } __attribute__ ((packed)); |
| 1014 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1015 | struct iwl4965_rx_frame_hdr { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1016 | __le16 channel; |
| 1017 | __le16 phy_flags; |
| 1018 | u8 reserved1; |
| 1019 | u8 rate; |
| 1020 | __le16 len; |
| 1021 | u8 payload[0]; |
| 1022 | } __attribute__ ((packed)); |
| 1023 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1024 | #define RX_RES_STATUS_NO_CRC32_ERROR __constant_cpu_to_le32(1 << 0) |
| 1025 | #define RX_RES_STATUS_NO_RXE_OVERFLOW __constant_cpu_to_le32(1 << 1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1026 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1027 | #define RX_RES_PHY_FLAGS_BAND_24_MSK __constant_cpu_to_le16(1 << 0) |
| 1028 | #define RX_RES_PHY_FLAGS_MOD_CCK_MSK __constant_cpu_to_le16(1 << 1) |
| 1029 | #define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK __constant_cpu_to_le16(1 << 2) |
| 1030 | #define RX_RES_PHY_FLAGS_NARROW_BAND_MSK __constant_cpu_to_le16(1 << 3) |
| 1031 | #define RX_RES_PHY_FLAGS_ANTENNA_MSK __constant_cpu_to_le16(0xf0) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1032 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1033 | #define RX_RES_STATUS_SEC_TYPE_MSK (0x7 << 8) |
| 1034 | #define RX_RES_STATUS_SEC_TYPE_NONE (0x0 << 8) |
| 1035 | #define RX_RES_STATUS_SEC_TYPE_WEP (0x1 << 8) |
| 1036 | #define RX_RES_STATUS_SEC_TYPE_CCMP (0x2 << 8) |
| 1037 | #define RX_RES_STATUS_SEC_TYPE_TKIP (0x3 << 8) |
Emmanuel Grumbach | 17e476b | 2008-03-19 16:41:42 -0700 | [diff] [blame] | 1038 | #define RX_RES_STATUS_SEC_TYPE_ERR (0x7 << 8) |
| 1039 | |
| 1040 | #define RX_RES_STATUS_STATION_FOUND (1<<6) |
| 1041 | #define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1042 | |
Tomas Winkler | 8211ef7 | 2008-03-02 01:36:04 +0200 | [diff] [blame] | 1043 | #define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11) |
| 1044 | #define RX_RES_STATUS_NOT_DECRYPT (0x0 << 11) |
| 1045 | #define RX_RES_STATUS_DECRYPT_OK (0x3 << 11) |
| 1046 | #define RX_RES_STATUS_BAD_ICV_MIC (0x1 << 11) |
| 1047 | #define RX_RES_STATUS_BAD_KEY_TTAK (0x2 << 11) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1048 | |
Emmanuel Grumbach | 17e476b | 2008-03-19 16:41:42 -0700 | [diff] [blame] | 1049 | #define RX_MPDU_RES_STATUS_ICV_OK (0x20) |
| 1050 | #define RX_MPDU_RES_STATUS_MIC_OK (0x40) |
| 1051 | #define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) |
| 1052 | #define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) |
| 1053 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1054 | struct iwl4965_rx_frame_end { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1055 | __le32 status; |
| 1056 | __le64 timestamp; |
| 1057 | __le32 beacon_timestamp; |
| 1058 | } __attribute__ ((packed)); |
| 1059 | |
| 1060 | /* |
| 1061 | * REPLY_3945_RX = 0x1b (response only, not a command) |
| 1062 | * |
| 1063 | * NOTE: DO NOT dereference from casts to this structure |
| 1064 | * It is provided only for calculating minimum data set size. |
| 1065 | * The actual offsets of the hdr and end are dynamic based on |
| 1066 | * stats.phy_count |
| 1067 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1068 | struct iwl4965_rx_frame { |
| 1069 | struct iwl4965_rx_frame_stats stats; |
| 1070 | struct iwl4965_rx_frame_hdr hdr; |
| 1071 | struct iwl4965_rx_frame_end end; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1072 | } __attribute__ ((packed)); |
| 1073 | |
| 1074 | /* Fixed (non-configurable) rx data from phy */ |
| 1075 | #define RX_PHY_FLAGS_ANTENNAE_OFFSET (4) |
| 1076 | #define RX_PHY_FLAGS_ANTENNAE_MASK (0x70) |
| 1077 | #define IWL_AGC_DB_MASK (0x3f80) /* MASK(7,13) */ |
| 1078 | #define IWL_AGC_DB_POS (7) |
| 1079 | struct iwl4965_rx_non_cfg_phy { |
| 1080 | __le16 ant_selection; /* ant A bit 4, ant B bit 5, ant C bit 6 */ |
| 1081 | __le16 agc_info; /* agc code 0:6, agc dB 7:13, reserved 14:15 */ |
| 1082 | u8 rssi_info[6]; /* we use even entries, 0/2/4 for A/B/C rssi */ |
| 1083 | u8 pad[0]; |
| 1084 | } __attribute__ ((packed)); |
| 1085 | |
| 1086 | /* |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 1087 | * REPLY_RX = 0xc3 (response only, not a command) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1088 | * Used only for legacy (non 11n) frames. |
| 1089 | */ |
| 1090 | #define RX_RES_PHY_CNT 14 |
| 1091 | struct iwl4965_rx_phy_res { |
| 1092 | u8 non_cfg_phy_cnt; /* non configurable DSP phy data byte count */ |
| 1093 | u8 cfg_phy_cnt; /* configurable DSP phy data byte count */ |
| 1094 | u8 stat_id; /* configurable DSP phy data set ID */ |
| 1095 | u8 reserved1; |
| 1096 | __le64 timestamp; /* TSF at on air rise */ |
| 1097 | __le32 beacon_time_stamp; /* beacon at on-air rise */ |
| 1098 | __le16 phy_flags; /* general phy flags: band, modulation, ... */ |
| 1099 | __le16 channel; /* channel number */ |
| 1100 | __le16 non_cfg_phy[RX_RES_PHY_CNT]; /* upto 14 phy entries */ |
| 1101 | __le32 reserved2; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1102 | __le32 rate_n_flags; /* RATE_MCS_* */ |
| 1103 | __le16 byte_count; /* frame's byte-count */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1104 | __le16 reserved3; |
| 1105 | } __attribute__ ((packed)); |
| 1106 | |
| 1107 | struct iwl4965_rx_mpdu_res_start { |
| 1108 | __le16 byte_count; |
| 1109 | __le16 reserved; |
| 1110 | } __attribute__ ((packed)); |
| 1111 | |
| 1112 | |
| 1113 | /****************************************************************************** |
| 1114 | * (5) |
| 1115 | * Tx Commands & Responses: |
| 1116 | * |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1117 | * Driver must place each REPLY_TX command into one of the prioritized Tx |
| 1118 | * queues in host DRAM, shared between driver and device (see comments for |
| 1119 | * SCD registers and Tx/Rx Queues). When the device's Tx scheduler and uCode |
| 1120 | * are preparing to transmit, the device pulls the Tx command over the PCI |
| 1121 | * bus via one of the device's Tx DMA channels, to fill an internal FIFO |
| 1122 | * from which data will be transmitted. |
| 1123 | * |
| 1124 | * uCode handles all timing and protocol related to control frames |
| 1125 | * (RTS/CTS/ACK), based on flags in the Tx command. uCode and Tx scheduler |
| 1126 | * handle reception of block-acks; uCode updates the host driver via |
| 1127 | * REPLY_COMPRESSED_BA (4965). |
| 1128 | * |
| 1129 | * uCode handles retrying Tx when an ACK is expected but not received. |
| 1130 | * This includes trying lower data rates than the one requested in the Tx |
| 1131 | * command, as set up by the REPLY_RATE_SCALE (for 3945) or |
| 1132 | * REPLY_TX_LINK_QUALITY_CMD (4965). |
| 1133 | * |
| 1134 | * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD. |
| 1135 | * This command must be executed after every RXON command, before Tx can occur. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1136 | *****************************************************************************/ |
| 1137 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1138 | /* REPLY_TX Tx flags field */ |
| 1139 | |
| 1140 | /* 1: Use Request-To-Send protocol before this frame. |
| 1141 | * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1142 | #define TX_CMD_FLG_RTS_MSK __constant_cpu_to_le32(1 << 1) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1143 | |
| 1144 | /* 1: Transmit Clear-To-Send to self before this frame. |
| 1145 | * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames. |
| 1146 | * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1147 | #define TX_CMD_FLG_CTS_MSK __constant_cpu_to_le32(1 << 2) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1148 | |
| 1149 | /* 1: Expect ACK from receiving station |
| 1150 | * 0: Don't expect ACK (MAC header's duration field s/b 0) |
| 1151 | * Set this for unicast frames, but not broadcast/multicast. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1152 | #define TX_CMD_FLG_ACK_MSK __constant_cpu_to_le32(1 << 3) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1153 | |
| 1154 | /* For 4965: |
| 1155 | * 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD). |
| 1156 | * Tx command's initial_rate_index indicates first rate to try; |
| 1157 | * uCode walks through table for additional Tx attempts. |
| 1158 | * 0: Use Tx rate/MCS from Tx command's rate_n_flags field. |
| 1159 | * This rate will be used for all Tx attempts; it will not be scaled. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1160 | #define TX_CMD_FLG_STA_RATE_MSK __constant_cpu_to_le32(1 << 4) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1161 | |
| 1162 | /* 1: Expect immediate block-ack. |
| 1163 | * Set when Txing a block-ack request frame. Also set TX_CMD_FLG_ACK_MSK. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1164 | #define TX_CMD_FLG_IMM_BA_RSP_MASK __constant_cpu_to_le32(1 << 6) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1165 | |
| 1166 | /* 1: Frame requires full Tx-Op protection. |
| 1167 | * Set this if either RTS or CTS Tx Flag gets set. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1168 | #define TX_CMD_FLG_FULL_TXOP_PROT_MSK __constant_cpu_to_le32(1 << 7) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1169 | |
| 1170 | /* Tx antenna selection field; used only for 3945, reserved (0) for 4965. |
| 1171 | * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1172 | #define TX_CMD_FLG_ANT_SEL_MSK __constant_cpu_to_le32(0xf00) |
| 1173 | #define TX_CMD_FLG_ANT_A_MSK __constant_cpu_to_le32(1 << 8) |
| 1174 | #define TX_CMD_FLG_ANT_B_MSK __constant_cpu_to_le32(1 << 9) |
| 1175 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1176 | /* 1: Ignore Bluetooth priority for this frame. |
| 1177 | * 0: Delay Tx until Bluetooth device is done (normal usage). */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1178 | #define TX_CMD_FLG_BT_DIS_MSK __constant_cpu_to_le32(1 << 12) |
| 1179 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1180 | /* 1: uCode overrides sequence control field in MAC header. |
| 1181 | * 0: Driver provides sequence control field in MAC header. |
| 1182 | * Set this for management frames, non-QOS data frames, non-unicast frames, |
| 1183 | * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1184 | #define TX_CMD_FLG_SEQ_CTL_MSK __constant_cpu_to_le32(1 << 13) |
| 1185 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1186 | /* 1: This frame is non-last MPDU; more fragments are coming. |
| 1187 | * 0: Last fragment, or not using fragmentation. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1188 | #define TX_CMD_FLG_MORE_FRAG_MSK __constant_cpu_to_le32(1 << 14) |
| 1189 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1190 | /* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame. |
| 1191 | * 0: No TSF required in outgoing frame. |
| 1192 | * Set this for transmitting beacons and probe responses. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1193 | #define TX_CMD_FLG_TSF_MSK __constant_cpu_to_le32(1 << 16) |
| 1194 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1195 | /* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword |
| 1196 | * alignment of frame's payload data field. |
| 1197 | * 0: No pad |
| 1198 | * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4 |
| 1199 | * field (but not both). Driver must align frame data (i.e. data following |
| 1200 | * MAC header) to DWORD boundary. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1201 | #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20) |
| 1202 | |
Max Stepanov | 8236e18 | 2008-03-12 16:58:48 -0700 | [diff] [blame] | 1203 | /* accelerate aggregation support |
| 1204 | * 0 - no CCMP encryption; 1 - CCMP encryption */ |
| 1205 | #define TX_CMD_FLG_AGG_CCMP_MSK __constant_cpu_to_le32(1 << 22) |
| 1206 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1207 | /* HCCA-AP - disable duration overwriting. */ |
| 1208 | #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25) |
| 1209 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1210 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1211 | /* |
| 1212 | * TX command security control |
| 1213 | */ |
| 1214 | #define TX_CMD_SEC_WEP 0x01 |
| 1215 | #define TX_CMD_SEC_CCM 0x02 |
| 1216 | #define TX_CMD_SEC_TKIP 0x03 |
| 1217 | #define TX_CMD_SEC_MSK 0x03 |
| 1218 | #define TX_CMD_SEC_SHIFT 6 |
| 1219 | #define TX_CMD_SEC_KEY128 0x08 |
| 1220 | |
| 1221 | /* |
Tomas Winkler | 3195cdb | 2008-04-23 17:15:00 -0700 | [diff] [blame] | 1222 | * security overhead sizes |
| 1223 | */ |
| 1224 | #define WEP_IV_LEN 4 |
| 1225 | #define WEP_ICV_LEN 4 |
| 1226 | #define CCMP_MIC_LEN 8 |
| 1227 | #define TKIP_ICV_LEN 4 |
| 1228 | |
| 1229 | /* |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1230 | * 4965 uCode updates these Tx attempt count values in host DRAM. |
| 1231 | * Used for managing Tx retries when expecting block-acks. |
| 1232 | * Driver should set these fields to 0. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1233 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1234 | struct iwl4965_dram_scratch { |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1235 | u8 try_cnt; /* Tx attempts */ |
| 1236 | u8 bt_kill_cnt; /* Tx attempts blocked by Bluetooth device */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1237 | __le16 reserved; |
| 1238 | } __attribute__ ((packed)); |
| 1239 | |
| 1240 | /* |
| 1241 | * REPLY_TX = 0x1c (command) |
| 1242 | */ |
Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 1243 | struct iwl_tx_cmd { |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1244 | /* |
| 1245 | * MPDU byte count: |
| 1246 | * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size, |
| 1247 | * + 8 byte IV for CCM or TKIP (not used for WEP) |
| 1248 | * + Data payload |
| 1249 | * + 8-byte MIC (not used for CCM/WEP) |
| 1250 | * NOTE: Does not include Tx command bytes, post-MAC pad bytes, |
| 1251 | * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i |
| 1252 | * Range: 14-2342 bytes. |
| 1253 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1254 | __le16 len; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1255 | |
| 1256 | /* |
| 1257 | * MPDU or MSDU byte count for next frame. |
| 1258 | * Used for fragmentation and bursting, but not 11n aggregation. |
| 1259 | * Same as "len", but for next frame. Set to 0 if not applicable. |
| 1260 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1261 | __le16 next_frame_len; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1262 | |
| 1263 | __le32 tx_flags; /* TX_CMD_FLG_* */ |
| 1264 | |
| 1265 | /* 4965's uCode may modify this field of the Tx command (in host DRAM!). |
| 1266 | * Driver must also set dram_lsb_ptr and dram_msb_ptr in this cmd. */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1267 | struct iwl4965_dram_scratch scratch; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1268 | |
| 1269 | /* Rate for *all* Tx attempts, if TX_CMD_FLG_STA_RATE_MSK is cleared. */ |
| 1270 | __le32 rate_n_flags; /* RATE_MCS_* */ |
| 1271 | |
| 1272 | /* Index of destination station in uCode's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1273 | u8 sta_id; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1274 | |
| 1275 | /* Type of security encryption: CCM or TKIP */ |
| 1276 | u8 sec_ctl; /* TX_CMD_SEC_* */ |
| 1277 | |
| 1278 | /* |
| 1279 | * Index into rate table (see REPLY_TX_LINK_QUALITY_CMD) for initial |
| 1280 | * Tx attempt, if TX_CMD_FLG_STA_RATE_MSK is set. Normally "0" for |
| 1281 | * data frames, this field may be used to selectively reduce initial |
| 1282 | * rate (via non-0 value) for special frames (e.g. management), while |
| 1283 | * still supporting rate scaling for all frames. |
| 1284 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1285 | u8 initial_rate_index; |
| 1286 | u8 reserved; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1287 | u8 key[16]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1288 | __le16 next_frame_flags; |
| 1289 | __le16 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1290 | union { |
| 1291 | __le32 life_time; |
| 1292 | __le32 attempt; |
| 1293 | } stop_time; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1294 | |
| 1295 | /* Host DRAM physical address pointer to "scratch" in this command. |
| 1296 | * Must be dword aligned. "0" in dram_lsb_ptr disables usage. */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1297 | __le32 dram_lsb_ptr; |
| 1298 | u8 dram_msb_ptr; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1299 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1300 | u8 rts_retry_limit; /*byte 50 */ |
| 1301 | u8 data_retry_limit; /*byte 51 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1302 | u8 tid_tspec; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1303 | union { |
| 1304 | __le16 pm_frame_timeout; |
| 1305 | __le16 attempt_duration; |
| 1306 | } timeout; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1307 | |
| 1308 | /* |
| 1309 | * Duration of EDCA burst Tx Opportunity, in 32-usec units. |
| 1310 | * Set this if txop time is not specified by HCCA protocol (e.g. by AP). |
| 1311 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1312 | __le16 driver_txop; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1313 | |
| 1314 | /* |
| 1315 | * MAC header goes here, followed by 2 bytes padding if MAC header |
| 1316 | * length is 26 or 30 bytes, followed by payload data |
| 1317 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1318 | u8 payload[0]; |
| 1319 | struct ieee80211_hdr hdr[0]; |
| 1320 | } __attribute__ ((packed)); |
| 1321 | |
| 1322 | /* TX command response is sent after *all* transmission attempts. |
| 1323 | * |
| 1324 | * NOTES: |
| 1325 | * |
| 1326 | * TX_STATUS_FAIL_NEXT_FRAG |
| 1327 | * |
| 1328 | * If the fragment flag in the MAC header for the frame being transmitted |
| 1329 | * is set and there is insufficient time to transmit the next frame, the |
| 1330 | * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'. |
| 1331 | * |
| 1332 | * TX_STATUS_FIFO_UNDERRUN |
| 1333 | * |
| 1334 | * Indicates the host did not provide bytes to the FIFO fast enough while |
| 1335 | * a TX was in progress. |
| 1336 | * |
| 1337 | * TX_STATUS_FAIL_MGMNT_ABORT |
| 1338 | * |
| 1339 | * This status is only possible if the ABORT ON MGMT RX parameter was |
| 1340 | * set to true with the TX command. |
| 1341 | * |
| 1342 | * If the MSB of the status parameter is set then an abort sequence is |
| 1343 | * required. This sequence consists of the host activating the TX Abort |
| 1344 | * control line, and then waiting for the TX Abort command response. This |
| 1345 | * indicates that a the device is no longer in a transmit state, and that the |
| 1346 | * command FIFO has been cleared. The host must then deactivate the TX Abort |
| 1347 | * control line. Receiving is still allowed in this case. |
| 1348 | */ |
| 1349 | enum { |
| 1350 | TX_STATUS_SUCCESS = 0x01, |
| 1351 | TX_STATUS_DIRECT_DONE = 0x02, |
| 1352 | TX_STATUS_FAIL_SHORT_LIMIT = 0x82, |
| 1353 | TX_STATUS_FAIL_LONG_LIMIT = 0x83, |
| 1354 | TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84, |
| 1355 | TX_STATUS_FAIL_MGMNT_ABORT = 0x85, |
| 1356 | TX_STATUS_FAIL_NEXT_FRAG = 0x86, |
| 1357 | TX_STATUS_FAIL_LIFE_EXPIRE = 0x87, |
| 1358 | TX_STATUS_FAIL_DEST_PS = 0x88, |
| 1359 | TX_STATUS_FAIL_ABORTED = 0x89, |
| 1360 | TX_STATUS_FAIL_BT_RETRY = 0x8a, |
| 1361 | TX_STATUS_FAIL_STA_INVALID = 0x8b, |
| 1362 | TX_STATUS_FAIL_FRAG_DROPPED = 0x8c, |
| 1363 | TX_STATUS_FAIL_TID_DISABLE = 0x8d, |
| 1364 | TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e, |
| 1365 | TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f, |
| 1366 | TX_STATUS_FAIL_TX_LOCKED = 0x90, |
| 1367 | TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91, |
| 1368 | }; |
| 1369 | |
| 1370 | #define TX_PACKET_MODE_REGULAR 0x0000 |
| 1371 | #define TX_PACKET_MODE_BURST_SEQ 0x0100 |
| 1372 | #define TX_PACKET_MODE_BURST_FIRST 0x0200 |
| 1373 | |
| 1374 | enum { |
| 1375 | TX_POWER_PA_NOT_ACTIVE = 0x0, |
| 1376 | }; |
| 1377 | |
| 1378 | enum { |
| 1379 | TX_STATUS_MSK = 0x000000ff, /* bits 0:7 */ |
| 1380 | TX_STATUS_DELAY_MSK = 0x00000040, |
| 1381 | TX_STATUS_ABORT_MSK = 0x00000080, |
| 1382 | TX_PACKET_MODE_MSK = 0x0000ff00, /* bits 8:15 */ |
| 1383 | TX_FIFO_NUMBER_MSK = 0x00070000, /* bits 16:18 */ |
| 1384 | TX_RESERVED = 0x00780000, /* bits 19:22 */ |
| 1385 | TX_POWER_PA_DETECT_MSK = 0x7f800000, /* bits 23:30 */ |
| 1386 | TX_ABORT_REQUIRED_MSK = 0x80000000, /* bits 31:31 */ |
| 1387 | }; |
| 1388 | |
Tomas Winkler | a332f8d | 2008-05-29 16:35:08 +0800 | [diff] [blame] | 1389 | static inline int iwl_is_tx_success(u32 status) |
| 1390 | { |
| 1391 | status &= TX_STATUS_MSK; |
| 1392 | return (status == TX_STATUS_SUCCESS) |
| 1393 | || (status == TX_STATUS_DIRECT_DONE); |
| 1394 | } |
| 1395 | |
| 1396 | |
| 1397 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1398 | /* ******************************* |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1399 | * TX aggregation status |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1400 | ******************************* */ |
| 1401 | |
| 1402 | enum { |
| 1403 | AGG_TX_STATE_TRANSMITTED = 0x00, |
| 1404 | AGG_TX_STATE_UNDERRUN_MSK = 0x01, |
| 1405 | AGG_TX_STATE_BT_PRIO_MSK = 0x02, |
| 1406 | AGG_TX_STATE_FEW_BYTES_MSK = 0x04, |
| 1407 | AGG_TX_STATE_ABORT_MSK = 0x08, |
| 1408 | AGG_TX_STATE_LAST_SENT_TTL_MSK = 0x10, |
| 1409 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK = 0x20, |
| 1410 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK = 0x40, |
| 1411 | AGG_TX_STATE_SCD_QUERY_MSK = 0x80, |
| 1412 | AGG_TX_STATE_TEST_BAD_CRC32_MSK = 0x100, |
| 1413 | AGG_TX_STATE_RESPONSE_MSK = 0x1ff, |
| 1414 | AGG_TX_STATE_DUMP_TX_MSK = 0x200, |
| 1415 | AGG_TX_STATE_DELAY_TX_MSK = 0x400 |
| 1416 | }; |
| 1417 | |
| 1418 | #define AGG_TX_STATE_LAST_SENT_MSK \ |
| 1419 | (AGG_TX_STATE_LAST_SENT_TTL_MSK | \ |
| 1420 | AGG_TX_STATE_LAST_SENT_TRY_CNT_MSK | \ |
| 1421 | AGG_TX_STATE_LAST_SENT_BT_KILL_MSK) |
| 1422 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1423 | /* # tx attempts for first frame in aggregation */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1424 | #define AGG_TX_STATE_TRY_CNT_POS 12 |
| 1425 | #define AGG_TX_STATE_TRY_CNT_MSK 0xf000 |
| 1426 | |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1427 | /* Command ID and sequence number of Tx command for this frame */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1428 | #define AGG_TX_STATE_SEQ_NUM_POS 16 |
| 1429 | #define AGG_TX_STATE_SEQ_NUM_MSK 0xffff0000 |
| 1430 | |
| 1431 | /* |
| 1432 | * REPLY_TX = 0x1c (response) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1433 | * |
| 1434 | * This response may be in one of two slightly different formats, indicated |
| 1435 | * by the frame_count field: |
| 1436 | * |
| 1437 | * 1) No aggregation (frame_count == 1). This reports Tx results for |
| 1438 | * a single frame. Multiple attempts, at various bit rates, may have |
| 1439 | * been made for this frame. |
| 1440 | * |
| 1441 | * 2) Aggregation (frame_count > 1). This reports Tx results for |
| 1442 | * 2 or more frames that used block-acknowledge. All frames were |
| 1443 | * transmitted at same rate. Rate scaling may have been used if first |
| 1444 | * frame in this new agg block failed in previous agg block(s). |
| 1445 | * |
| 1446 | * Note that, for aggregation, ACK (block-ack) status is not delivered here; |
| 1447 | * block-ack has not been received by the time the 4965 records this status. |
| 1448 | * This status relates to reasons the tx might have been blocked or aborted |
| 1449 | * within the sending station (this 4965), rather than whether it was |
| 1450 | * received successfully by the destination station. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1451 | */ |
Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1452 | struct agg_tx_status { |
| 1453 | __le16 status; |
| 1454 | __le16 sequence; |
| 1455 | } __attribute__ ((packed)); |
| 1456 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1457 | struct iwl4965_tx_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1458 | u8 frame_count; /* 1 no aggregation, >1 aggregation */ |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1459 | u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ |
| 1460 | u8 failure_rts; /* # failures due to unsuccessful RTS */ |
| 1461 | u8 failure_frame; /* # failures due to no ACK (unused for agg) */ |
| 1462 | |
| 1463 | /* For non-agg: Rate at which frame was successful. |
| 1464 | * For agg: Rate at which all frames were transmitted. */ |
| 1465 | __le32 rate_n_flags; /* RATE_MCS_* */ |
| 1466 | |
| 1467 | /* For non-agg: RTS + CTS + frame tx attempts time + ACK. |
| 1468 | * For agg: RTS + CTS + aggregation tx time + block-ack time. */ |
| 1469 | __le16 wireless_media_time; /* uSecs */ |
| 1470 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1471 | __le16 reserved; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1472 | __le32 pa_power1; /* RF power amplifier measurement (not used) */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1473 | __le32 pa_power2; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1474 | |
| 1475 | /* |
| 1476 | * For non-agg: frame status TX_STATUS_* |
| 1477 | * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status |
| 1478 | * fields follow this one, up to frame_count. |
| 1479 | * Bit fields: |
| 1480 | * 11- 0: AGG_TX_STATE_* status code |
| 1481 | * 15-12: Retry count for 1st frame in aggregation (retries |
| 1482 | * occur if tx failed for this frame when it was a |
| 1483 | * member of a previous aggregation block). If rate |
| 1484 | * scaling is used, retry count indicates the rate |
| 1485 | * table entry used for all frames in the new agg. |
| 1486 | * 31-16: Sequence # for this frame's Tx cmd (not SSN!) |
| 1487 | */ |
Tomas Winkler | 25a6572 | 2008-06-12 09:47:07 +0800 | [diff] [blame] | 1488 | union { |
| 1489 | __le32 status; |
| 1490 | struct agg_tx_status agg_status[0]; /* for each agg frame */ |
| 1491 | } u; |
Ron Rindjunsky | fe01b47 | 2008-01-28 14:07:24 +0200 | [diff] [blame] | 1492 | } __attribute__ ((packed)); |
| 1493 | |
Ron Rindjunsky | 001caff | 2008-05-29 16:35:07 +0800 | [diff] [blame] | 1494 | struct iwl5000_tx_resp { |
| 1495 | u8 frame_count; /* 1 no aggregation, >1 aggregation */ |
| 1496 | u8 bt_kill_count; /* # blocked by bluetooth (unused for agg) */ |
| 1497 | u8 failure_rts; /* # failures due to unsuccessful RTS */ |
| 1498 | u8 failure_frame; /* # failures due to no ACK (unused for agg) */ |
| 1499 | |
| 1500 | /* For non-agg: Rate at which frame was successful. |
| 1501 | * For agg: Rate at which all frames were transmitted. */ |
| 1502 | __le32 rate_n_flags; /* RATE_MCS_* */ |
| 1503 | |
| 1504 | /* For non-agg: RTS + CTS + frame tx attempts time + ACK. |
| 1505 | * For agg: RTS + CTS + aggregation tx time + block-ack time. */ |
| 1506 | __le16 wireless_media_time; /* uSecs */ |
| 1507 | |
| 1508 | __le16 reserved; |
| 1509 | __le32 pa_power1; /* RF power amplifier measurement (not used) */ |
| 1510 | __le32 pa_power2; |
| 1511 | |
| 1512 | __le32 tfd_info; |
| 1513 | __le16 seq_ctl; |
| 1514 | __le16 byte_cnt; |
| 1515 | __le32 tlc_info; |
| 1516 | /* |
| 1517 | * For non-agg: frame status TX_STATUS_* |
| 1518 | * For agg: status of 1st frame, AGG_TX_STATE_*; other frame status |
| 1519 | * fields follow this one, up to frame_count. |
| 1520 | * Bit fields: |
| 1521 | * 11- 0: AGG_TX_STATE_* status code |
| 1522 | * 15-12: Retry count for 1st frame in aggregation (retries |
| 1523 | * occur if tx failed for this frame when it was a |
| 1524 | * member of a previous aggregation block). If rate |
| 1525 | * scaling is used, retry count indicates the rate |
| 1526 | * table entry used for all frames in the new agg. |
| 1527 | * 31-16: Sequence # for this frame's Tx cmd (not SSN!) |
| 1528 | */ |
| 1529 | struct agg_tx_status status; /* TX status (in aggregation - |
| 1530 | * status of 1st frame) */ |
| 1531 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1532 | /* |
| 1533 | * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command) |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1534 | * |
| 1535 | * Reports Block-Acknowledge from recipient station |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1536 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1537 | struct iwl4965_compressed_ba_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1538 | __le32 sta_addr_lo32; |
| 1539 | __le16 sta_addr_hi16; |
| 1540 | __le16 reserved; |
Ben Cahill | 5296998 | 2007-11-29 11:10:11 +0800 | [diff] [blame] | 1541 | |
| 1542 | /* Index of recipient (BA-sending) station in uCode's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1543 | u8 sta_id; |
| 1544 | u8 tid; |
Ron Rindjunsky | fe01b47 | 2008-01-28 14:07:24 +0200 | [diff] [blame] | 1545 | __le16 seq_ctl; |
| 1546 | __le64 bitmap; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1547 | __le16 scd_flow; |
| 1548 | __le16 scd_ssn; |
| 1549 | } __attribute__ ((packed)); |
| 1550 | |
| 1551 | /* |
| 1552 | * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response) |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1553 | * |
| 1554 | * See details under "TXPOWER" in iwl-4965-hw.h. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1555 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1556 | struct iwl4965_txpowertable_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1557 | u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ |
| 1558 | u8 reserved; |
| 1559 | __le16 channel; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1560 | struct iwl4965_tx_power_db tx_power; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1561 | } __attribute__ ((packed)); |
| 1562 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1563 | /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 1564 | #define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1565 | |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1566 | /* # of EDCA prioritized tx fifos */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1567 | #define LINK_QUAL_AC_NUM AC_NUM |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1568 | |
| 1569 | /* # entries in rate scale table to support Tx retries */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1570 | #define LINK_QUAL_MAX_RETRY_NUM 16 |
| 1571 | |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1572 | /* Tx antenna selection values */ |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 1573 | #define LINK_QUAL_ANT_A_MSK (1 << 0) |
| 1574 | #define LINK_QUAL_ANT_B_MSK (1 << 1) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1575 | #define LINK_QUAL_ANT_MSK (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK) |
| 1576 | |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1577 | |
| 1578 | /** |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1579 | * struct iwl_link_qual_general_params |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1580 | * |
| 1581 | * Used in REPLY_TX_LINK_QUALITY_CMD |
| 1582 | */ |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1583 | struct iwl_link_qual_general_params { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1584 | u8 flags; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1585 | |
| 1586 | /* No entries at or above this (driver chosen) index contain MIMO */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1587 | u8 mimo_delimiter; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1588 | |
| 1589 | /* Best single antenna to use for single stream (legacy, SISO). */ |
| 1590 | u8 single_stream_ant_msk; /* LINK_QUAL_ANT_* */ |
| 1591 | |
| 1592 | /* Best antennas to use for MIMO (unused for 4965, assumes both). */ |
| 1593 | u8 dual_stream_ant_msk; /* LINK_QUAL_ANT_* */ |
| 1594 | |
| 1595 | /* |
| 1596 | * If driver needs to use different initial rates for different |
| 1597 | * EDCA QOS access categories (as implemented by tx fifos 0-3), |
| 1598 | * this table will set that up, by indicating the indexes in the |
| 1599 | * rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table at which to start. |
| 1600 | * Otherwise, driver should set all entries to 0. |
| 1601 | * |
| 1602 | * Entry usage: |
| 1603 | * 0 = Background, 1 = Best Effort (normal), 2 = Video, 3 = Voice |
| 1604 | * TX FIFOs above 3 use same value (typically 0) as TX FIFO 3. |
| 1605 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1606 | u8 start_rate_index[LINK_QUAL_AC_NUM]; |
| 1607 | } __attribute__ ((packed)); |
| 1608 | |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1609 | /** |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1610 | * struct iwl_link_qual_agg_params |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1611 | * |
| 1612 | * Used in REPLY_TX_LINK_QUALITY_CMD |
| 1613 | */ |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1614 | struct iwl_link_qual_agg_params { |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1615 | |
| 1616 | /* Maximum number of uSec in aggregation. |
| 1617 | * Driver should set this to 4000 (4 milliseconds). */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1618 | __le16 agg_time_limit; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1619 | |
| 1620 | /* |
| 1621 | * Number of Tx retries allowed for a frame, before that frame will |
| 1622 | * no longer be considered for the start of an aggregation sequence |
| 1623 | * (scheduler will then try to tx it as single frame). |
| 1624 | * Driver should set this to 3. |
| 1625 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1626 | u8 agg_dis_start_th; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1627 | |
| 1628 | /* |
| 1629 | * Maximum number of frames in aggregation. |
| 1630 | * 0 = no limit (default). 1 = no aggregation. |
| 1631 | * Other values = max # frames in aggregation. |
| 1632 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1633 | u8 agg_frame_cnt_limit; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1634 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1635 | __le32 reserved; |
| 1636 | } __attribute__ ((packed)); |
| 1637 | |
| 1638 | /* |
| 1639 | * REPLY_TX_LINK_QUALITY_CMD = 0x4e (command, has simple generic response) |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1640 | * |
| 1641 | * For 4965 only; 3945 uses REPLY_RATE_SCALE. |
| 1642 | * |
| 1643 | * Each station in the 4965's internal station table has its own table of 16 |
| 1644 | * Tx rates and modulation modes (e.g. legacy/SISO/MIMO) for retrying Tx when |
| 1645 | * an ACK is not received. This command replaces the entire table for |
| 1646 | * one station. |
| 1647 | * |
| 1648 | * NOTE: Station must already be in 4965's station table. Use REPLY_ADD_STA. |
| 1649 | * |
| 1650 | * The rate scaling procedures described below work well. Of course, other |
| 1651 | * procedures are possible, and may work better for particular environments. |
| 1652 | * |
| 1653 | * |
| 1654 | * FILLING THE RATE TABLE |
| 1655 | * |
| 1656 | * Given a particular initial rate and mode, as determined by the rate |
| 1657 | * scaling algorithm described below, the Linux driver uses the following |
| 1658 | * formula to fill the rs_table[LINK_QUAL_MAX_RETRY_NUM] rate table in the |
| 1659 | * Link Quality command: |
| 1660 | * |
| 1661 | * |
| 1662 | * 1) If using High-throughput (HT) (SISO or MIMO) initial rate: |
| 1663 | * a) Use this same initial rate for first 3 entries. |
| 1664 | * b) Find next lower available rate using same mode (SISO or MIMO), |
| 1665 | * use for next 3 entries. If no lower rate available, switch to |
| 1666 | * legacy mode (no FAT channel, no MIMO, no short guard interval). |
| 1667 | * c) If using MIMO, set command's mimo_delimiter to number of entries |
| 1668 | * using MIMO (3 or 6). |
| 1669 | * d) After trying 2 HT rates, switch to legacy mode (no FAT channel, |
| 1670 | * no MIMO, no short guard interval), at the next lower bit rate |
| 1671 | * (e.g. if second HT bit rate was 54, try 48 legacy), and follow |
| 1672 | * legacy procedure for remaining table entries. |
| 1673 | * |
| 1674 | * 2) If using legacy initial rate: |
| 1675 | * a) Use the initial rate for only one entry. |
| 1676 | * b) For each following entry, reduce the rate to next lower available |
| 1677 | * rate, until reaching the lowest available rate. |
| 1678 | * c) When reducing rate, also switch antenna selection. |
| 1679 | * d) Once lowest available rate is reached, repeat this rate until |
| 1680 | * rate table is filled (16 entries), switching antenna each entry. |
| 1681 | * |
| 1682 | * |
| 1683 | * ACCUMULATING HISTORY |
| 1684 | * |
| 1685 | * The rate scaling algorithm for 4965, as implemented in Linux driver, uses |
| 1686 | * two sets of frame Tx success history: One for the current/active modulation |
| 1687 | * mode, and one for a speculative/search mode that is being attempted. If the |
| 1688 | * speculative mode turns out to be more effective (i.e. actual transfer |
| 1689 | * rate is better), then the driver continues to use the speculative mode |
| 1690 | * as the new current active mode. |
| 1691 | * |
| 1692 | * Each history set contains, separately for each possible rate, data for a |
| 1693 | * sliding window of the 62 most recent tx attempts at that rate. The data |
| 1694 | * includes a shifting bitmap of success(1)/failure(0), and sums of successful |
| 1695 | * and attempted frames, from which the driver can additionally calculate a |
| 1696 | * success ratio (success / attempted) and number of failures |
| 1697 | * (attempted - success), and control the size of the window (attempted). |
| 1698 | * The driver uses the bit map to remove successes from the success sum, as |
| 1699 | * the oldest tx attempts fall out of the window. |
| 1700 | * |
| 1701 | * When the 4965 makes multiple tx attempts for a given frame, each attempt |
| 1702 | * might be at a different rate, and have different modulation characteristics |
| 1703 | * (e.g. antenna, fat channel, short guard interval), as set up in the rate |
| 1704 | * scaling table in the Link Quality command. The driver must determine |
| 1705 | * which rate table entry was used for each tx attempt, to determine which |
| 1706 | * rate-specific history to update, and record only those attempts that |
| 1707 | * match the modulation characteristics of the history set. |
| 1708 | * |
| 1709 | * When using block-ack (aggregation), all frames are transmitted at the same |
| 1710 | * rate, since there is no per-attempt acknowledgement from the destination |
| 1711 | * station. The Tx response struct iwl_tx_resp indicates the Tx rate in |
| 1712 | * rate_n_flags field. After receiving a block-ack, the driver can update |
| 1713 | * history for the entire block all at once. |
| 1714 | * |
| 1715 | * |
| 1716 | * FINDING BEST STARTING RATE: |
| 1717 | * |
| 1718 | * When working with a selected initial modulation mode (see below), the |
| 1719 | * driver attempts to find a best initial rate. The initial rate is the |
| 1720 | * first entry in the Link Quality command's rate table. |
| 1721 | * |
| 1722 | * 1) Calculate actual throughput (success ratio * expected throughput, see |
| 1723 | * table below) for current initial rate. Do this only if enough frames |
| 1724 | * have been attempted to make the value meaningful: at least 6 failed |
| 1725 | * tx attempts, or at least 8 successes. If not enough, don't try rate |
| 1726 | * scaling yet. |
| 1727 | * |
| 1728 | * 2) Find available rates adjacent to current initial rate. Available means: |
| 1729 | * a) supported by hardware && |
| 1730 | * b) supported by association && |
| 1731 | * c) within any constraints selected by user |
| 1732 | * |
| 1733 | * 3) Gather measured throughputs for adjacent rates. These might not have |
| 1734 | * enough history to calculate a throughput. That's okay, we might try |
| 1735 | * using one of them anyway! |
| 1736 | * |
| 1737 | * 4) Try decreasing rate if, for current rate: |
| 1738 | * a) success ratio is < 15% || |
| 1739 | * b) lower adjacent rate has better measured throughput || |
| 1740 | * c) higher adjacent rate has worse throughput, and lower is unmeasured |
| 1741 | * |
| 1742 | * As a sanity check, if decrease was determined above, leave rate |
| 1743 | * unchanged if: |
| 1744 | * a) lower rate unavailable |
| 1745 | * b) success ratio at current rate > 85% (very good) |
| 1746 | * c) current measured throughput is better than expected throughput |
| 1747 | * of lower rate (under perfect 100% tx conditions, see table below) |
| 1748 | * |
| 1749 | * 5) Try increasing rate if, for current rate: |
| 1750 | * a) success ratio is < 15% || |
| 1751 | * b) both adjacent rates' throughputs are unmeasured (try it!) || |
| 1752 | * b) higher adjacent rate has better measured throughput || |
| 1753 | * c) lower adjacent rate has worse throughput, and higher is unmeasured |
| 1754 | * |
| 1755 | * As a sanity check, if increase was determined above, leave rate |
| 1756 | * unchanged if: |
| 1757 | * a) success ratio at current rate < 70%. This is not particularly |
| 1758 | * good performance; higher rate is sure to have poorer success. |
| 1759 | * |
| 1760 | * 6) Re-evaluate the rate after each tx frame. If working with block- |
| 1761 | * acknowledge, history and statistics may be calculated for the entire |
| 1762 | * block (including prior history that fits within the history windows), |
| 1763 | * before re-evaluation. |
| 1764 | * |
| 1765 | * FINDING BEST STARTING MODULATION MODE: |
| 1766 | * |
| 1767 | * After working with a modulation mode for a "while" (and doing rate scaling), |
| 1768 | * the driver searches for a new initial mode in an attempt to improve |
| 1769 | * throughput. The "while" is measured by numbers of attempted frames: |
| 1770 | * |
| 1771 | * For legacy mode, search for new mode after: |
| 1772 | * 480 successful frames, or 160 failed frames |
| 1773 | * For high-throughput modes (SISO or MIMO), search for new mode after: |
| 1774 | * 4500 successful frames, or 400 failed frames |
| 1775 | * |
| 1776 | * Mode switch possibilities are (3 for each mode): |
| 1777 | * |
| 1778 | * For legacy: |
| 1779 | * Change antenna, try SISO (if HT association), try MIMO (if HT association) |
| 1780 | * For SISO: |
| 1781 | * Change antenna, try MIMO, try shortened guard interval (SGI) |
| 1782 | * For MIMO: |
| 1783 | * Try SISO antenna A, SISO antenna B, try shortened guard interval (SGI) |
| 1784 | * |
| 1785 | * When trying a new mode, use the same bit rate as the old/current mode when |
| 1786 | * trying antenna switches and shortened guard interval. When switching to |
| 1787 | * SISO from MIMO or legacy, or to MIMO from SISO or legacy, use a rate |
| 1788 | * for which the expected throughput (under perfect conditions) is about the |
| 1789 | * same or slightly better than the actual measured throughput delivered by |
| 1790 | * the old/current mode. |
| 1791 | * |
| 1792 | * Actual throughput can be estimated by multiplying the expected throughput |
| 1793 | * by the success ratio (successful / attempted tx frames). Frame size is |
| 1794 | * not considered in this calculation; it assumes that frame size will average |
| 1795 | * out to be fairly consistent over several samples. The following are |
| 1796 | * metric values for expected throughput assuming 100% success ratio. |
| 1797 | * Only G band has support for CCK rates: |
| 1798 | * |
| 1799 | * RATE: 1 2 5 11 6 9 12 18 24 36 48 54 60 |
| 1800 | * |
| 1801 | * G: 7 13 35 58 40 57 72 98 121 154 177 186 186 |
| 1802 | * A: 0 0 0 0 40 57 72 98 121 154 177 186 186 |
| 1803 | * SISO 20MHz: 0 0 0 0 42 42 76 102 124 159 183 193 202 |
| 1804 | * SGI SISO 20MHz: 0 0 0 0 46 46 82 110 132 168 192 202 211 |
| 1805 | * MIMO 20MHz: 0 0 0 0 74 74 123 155 179 214 236 244 251 |
| 1806 | * SGI MIMO 20MHz: 0 0 0 0 81 81 131 164 188 222 243 251 257 |
| 1807 | * SISO 40MHz: 0 0 0 0 77 77 127 160 184 220 242 250 257 |
| 1808 | * SGI SISO 40MHz: 0 0 0 0 83 83 135 169 193 229 250 257 264 |
| 1809 | * MIMO 40MHz: 0 0 0 0 123 123 182 214 235 264 279 285 289 |
| 1810 | * SGI MIMO 40MHz: 0 0 0 0 131 131 191 222 242 270 284 289 293 |
| 1811 | * |
| 1812 | * After the new mode has been tried for a short while (minimum of 6 failed |
| 1813 | * frames or 8 successful frames), compare success ratio and actual throughput |
| 1814 | * estimate of the new mode with the old. If either is better with the new |
| 1815 | * mode, continue to use the new mode. |
| 1816 | * |
| 1817 | * Continue comparing modes until all 3 possibilities have been tried. |
| 1818 | * If moving from legacy to HT, try all 3 possibilities from the new HT |
| 1819 | * mode. After trying all 3, a best mode is found. Continue to use this mode |
| 1820 | * for the longer "while" described above (e.g. 480 successful frames for |
| 1821 | * legacy), and then repeat the search process. |
| 1822 | * |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1823 | */ |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1824 | struct iwl_link_quality_cmd { |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1825 | |
| 1826 | /* Index of destination/recipient station in uCode's station table */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1827 | u8 sta_id; |
| 1828 | u8 reserved1; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1829 | __le16 control; /* not used */ |
Tomas Winkler | 66c73db | 2008-04-15 16:01:40 -0700 | [diff] [blame] | 1830 | struct iwl_link_qual_general_params general_params; |
| 1831 | struct iwl_link_qual_agg_params agg_params; |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1832 | |
| 1833 | /* |
| 1834 | * Rate info; when using rate-scaling, Tx command's initial_rate_index |
| 1835 | * specifies 1st Tx rate attempted, via index into this table. |
| 1836 | * 4965 works its way through table when retrying Tx. |
| 1837 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1838 | struct { |
Ben Cahill | 2bdc703 | 2007-11-29 11:10:12 +0800 | [diff] [blame] | 1839 | __le32 rate_n_flags; /* RATE_MCS_*, IWL_RATE_* */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1840 | } rs_table[LINK_QUAL_MAX_RETRY_NUM]; |
| 1841 | __le32 reserved2; |
| 1842 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1843 | |
| 1844 | /* |
| 1845 | * REPLY_BT_CONFIG = 0x9b (command, has simple generic response) |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 1846 | * |
| 1847 | * 3945 and 4965 support hardware handshake with Bluetooth device on |
| 1848 | * same platform. Bluetooth device alerts wireless device when it will Tx; |
| 1849 | * wireless device can delay or kill its own Tx to accomodate. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1850 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1851 | struct iwl4965_bt_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1852 | u8 flags; |
| 1853 | u8 lead_time; |
| 1854 | u8 max_kill; |
| 1855 | u8 reserved; |
| 1856 | __le32 kill_ack_mask; |
| 1857 | __le32 kill_cts_mask; |
| 1858 | } __attribute__ ((packed)); |
| 1859 | |
| 1860 | /****************************************************************************** |
| 1861 | * (6) |
| 1862 | * Spectrum Management (802.11h) Commands, Responses, Notifications: |
| 1863 | * |
| 1864 | *****************************************************************************/ |
| 1865 | |
| 1866 | /* |
| 1867 | * Spectrum Management |
| 1868 | */ |
| 1869 | #define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK | \ |
| 1870 | RXON_FILTER_CTL2HOST_MSK | \ |
| 1871 | RXON_FILTER_ACCEPT_GRP_MSK | \ |
| 1872 | RXON_FILTER_DIS_DECRYPT_MSK | \ |
| 1873 | RXON_FILTER_DIS_GRP_DECRYPT_MSK | \ |
| 1874 | RXON_FILTER_ASSOC_MSK | \ |
| 1875 | RXON_FILTER_BCON_AWARE_MSK) |
| 1876 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1877 | struct iwl4965_measure_channel { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1878 | __le32 duration; /* measurement duration in extended beacon |
| 1879 | * format */ |
| 1880 | u8 channel; /* channel to measure */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1881 | u8 type; /* see enum iwl4965_measure_type */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1882 | __le16 reserved; |
| 1883 | } __attribute__ ((packed)); |
| 1884 | |
| 1885 | /* |
| 1886 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command) |
| 1887 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1888 | struct iwl4965_spectrum_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1889 | __le16 len; /* number of bytes starting from token */ |
| 1890 | u8 token; /* token id */ |
| 1891 | u8 id; /* measurement id -- 0 or 1 */ |
| 1892 | u8 origin; /* 0 = TGh, 1 = other, 2 = TGk */ |
| 1893 | u8 periodic; /* 1 = periodic */ |
| 1894 | __le16 path_loss_timeout; |
| 1895 | __le32 start_time; /* start time in extended beacon format */ |
| 1896 | __le32 reserved2; |
| 1897 | __le32 flags; /* rxon flags */ |
| 1898 | __le32 filter_flags; /* rxon filter flags */ |
| 1899 | __le16 channel_count; /* minimum 1, maximum 10 */ |
| 1900 | __le16 reserved3; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1901 | struct iwl4965_measure_channel channels[10]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1902 | } __attribute__ ((packed)); |
| 1903 | |
| 1904 | /* |
| 1905 | * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response) |
| 1906 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1907 | struct iwl4965_spectrum_resp { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1908 | u8 token; |
| 1909 | u8 id; /* id of the prior command replaced, or 0xff */ |
| 1910 | __le16 status; /* 0 - command will be handled |
| 1911 | * 1 - cannot handle (conflicts with another |
| 1912 | * measurement) */ |
| 1913 | } __attribute__ ((packed)); |
| 1914 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1915 | enum iwl4965_measurement_state { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1916 | IWL_MEASUREMENT_START = 0, |
| 1917 | IWL_MEASUREMENT_STOP = 1, |
| 1918 | }; |
| 1919 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1920 | enum iwl4965_measurement_status { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1921 | IWL_MEASUREMENT_OK = 0, |
| 1922 | IWL_MEASUREMENT_CONCURRENT = 1, |
| 1923 | IWL_MEASUREMENT_CSA_CONFLICT = 2, |
| 1924 | IWL_MEASUREMENT_TGH_CONFLICT = 3, |
| 1925 | /* 4-5 reserved */ |
| 1926 | IWL_MEASUREMENT_STOPPED = 6, |
| 1927 | IWL_MEASUREMENT_TIMEOUT = 7, |
| 1928 | IWL_MEASUREMENT_PERIODIC_FAILED = 8, |
| 1929 | }; |
| 1930 | |
| 1931 | #define NUM_ELEMENTS_IN_HISTOGRAM 8 |
| 1932 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1933 | struct iwl4965_measurement_histogram { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1934 | __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */ |
| 1935 | __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 1usec counts */ |
| 1936 | } __attribute__ ((packed)); |
| 1937 | |
| 1938 | /* clear channel availability counters */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1939 | struct iwl4965_measurement_cca_counters { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1940 | __le32 ofdm; |
| 1941 | __le32 cck; |
| 1942 | } __attribute__ ((packed)); |
| 1943 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1944 | enum iwl4965_measure_type { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1945 | IWL_MEASURE_BASIC = (1 << 0), |
| 1946 | IWL_MEASURE_CHANNEL_LOAD = (1 << 1), |
| 1947 | IWL_MEASURE_HISTOGRAM_RPI = (1 << 2), |
| 1948 | IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3), |
| 1949 | IWL_MEASURE_FRAME = (1 << 4), |
| 1950 | /* bits 5:6 are reserved */ |
| 1951 | IWL_MEASURE_IDLE = (1 << 7), |
| 1952 | }; |
| 1953 | |
| 1954 | /* |
| 1955 | * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command) |
| 1956 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1957 | struct iwl4965_spectrum_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1958 | u8 id; /* measurement id -- 0 or 1 */ |
| 1959 | u8 token; |
| 1960 | u8 channel_index; /* index in measurement channel list */ |
| 1961 | u8 state; /* 0 - start, 1 - stop */ |
| 1962 | __le32 start_time; /* lower 32-bits of TSF */ |
| 1963 | u8 band; /* 0 - 5.2GHz, 1 - 2.4GHz */ |
| 1964 | u8 channel; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1965 | u8 type; /* see enum iwl4965_measurement_type */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1966 | u8 reserved1; |
| 1967 | /* NOTE: cca_ofdm, cca_cck, basic_type, and histogram are only only |
| 1968 | * valid if applicable for measurement type requested. */ |
| 1969 | __le32 cca_ofdm; /* cca fraction time in 40Mhz clock periods */ |
| 1970 | __le32 cca_cck; /* cca fraction time in 44Mhz clock periods */ |
| 1971 | __le32 cca_time; /* channel load time in usecs */ |
| 1972 | u8 basic_type; /* 0 - bss, 1 - ofdm preamble, 2 - |
| 1973 | * unidentified */ |
| 1974 | u8 reserved2[3]; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1975 | struct iwl4965_measurement_histogram histogram; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1976 | __le32 stop_time; /* lower 32-bits of TSF */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1977 | __le32 status; /* see iwl4965_measurement_status */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1978 | } __attribute__ ((packed)); |
| 1979 | |
| 1980 | /****************************************************************************** |
| 1981 | * (7) |
| 1982 | * Power Management Commands, Responses, Notifications: |
| 1983 | * |
| 1984 | *****************************************************************************/ |
| 1985 | |
| 1986 | /** |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 1987 | * struct iwl4965_powertable_cmd - Power Table Command |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 1988 | * @flags: See below: |
| 1989 | * |
| 1990 | * POWER_TABLE_CMD = 0x77 (command, has simple generic response) |
| 1991 | * |
| 1992 | * PM allow: |
| 1993 | * bit 0 - '0' Driver not allow power management |
| 1994 | * '1' Driver allow PM (use rest of parameters) |
| 1995 | * uCode send sleep notifications: |
| 1996 | * bit 1 - '0' Don't send sleep notification |
| 1997 | * '1' send sleep notification (SEND_PM_NOTIFICATION) |
| 1998 | * Sleep over DTIM |
| 1999 | * bit 2 - '0' PM have to walk up every DTIM |
| 2000 | * '1' PM could sleep over DTIM till listen Interval. |
| 2001 | * PCI power managed |
| 2002 | * bit 3 - '0' (PCI_LINK_CTRL & 0x1) |
| 2003 | * '1' !(PCI_LINK_CTRL & 0x1) |
| 2004 | * Force sleep Modes |
| 2005 | * bit 31/30- '00' use both mac/xtal sleeps |
| 2006 | * '01' force Mac sleep |
| 2007 | * '10' force xtal sleep |
| 2008 | * '11' Illegal set |
| 2009 | * |
| 2010 | * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then |
| 2011 | * ucode assume sleep over DTIM is allowed and we don't need to wakeup |
| 2012 | * for every DTIM. |
| 2013 | */ |
| 2014 | #define IWL_POWER_VEC_SIZE 5 |
| 2015 | |
Reinette Chatre | 8a1b024 | 2008-01-14 17:46:25 -0800 | [diff] [blame] | 2016 | #define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK __constant_cpu_to_le16(1 << 0) |
| 2017 | #define IWL_POWER_SLEEP_OVER_DTIM_MSK __constant_cpu_to_le16(1 << 2) |
| 2018 | #define IWL_POWER_PCI_PM_MSK __constant_cpu_to_le16(1 << 3) |
Mohamed Abbas | 5da4b55f | 2008-04-21 15:41:51 -0700 | [diff] [blame] | 2019 | #define IWL_POWER_FAST_PD __constant_cpu_to_le16(1 << 4) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2020 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2021 | struct iwl4965_powertable_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2022 | __le16 flags; |
| 2023 | u8 keep_alive_seconds; |
| 2024 | u8 debug_flags; |
| 2025 | __le32 rx_data_timeout; |
| 2026 | __le32 tx_data_timeout; |
| 2027 | __le32 sleep_interval[IWL_POWER_VEC_SIZE]; |
| 2028 | __le32 keep_alive_beacons; |
| 2029 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2030 | |
| 2031 | /* |
| 2032 | * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command) |
| 2033 | * 3945 and 4965 identical. |
| 2034 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2035 | struct iwl4965_sleep_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2036 | u8 pm_sleep_mode; |
| 2037 | u8 pm_wakeup_src; |
| 2038 | __le16 reserved; |
| 2039 | __le32 sleep_time; |
| 2040 | __le32 tsf_low; |
| 2041 | __le32 bcon_timer; |
| 2042 | } __attribute__ ((packed)); |
| 2043 | |
| 2044 | /* Sleep states. 3945 and 4965 identical. */ |
| 2045 | enum { |
| 2046 | IWL_PM_NO_SLEEP = 0, |
| 2047 | IWL_PM_SLP_MAC = 1, |
| 2048 | IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2, |
| 2049 | IWL_PM_SLP_FULL_MAC_CARD_STATE = 3, |
| 2050 | IWL_PM_SLP_PHY = 4, |
| 2051 | IWL_PM_SLP_REPENT = 5, |
| 2052 | IWL_PM_WAKEUP_BY_TIMER = 6, |
| 2053 | IWL_PM_WAKEUP_BY_DRIVER = 7, |
| 2054 | IWL_PM_WAKEUP_BY_RFKILL = 8, |
| 2055 | /* 3 reserved */ |
| 2056 | IWL_PM_NUM_OF_MODES = 12, |
| 2057 | }; |
| 2058 | |
| 2059 | /* |
| 2060 | * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response) |
| 2061 | */ |
| 2062 | #define CARD_STATE_CMD_DISABLE 0x00 /* Put card to sleep */ |
| 2063 | #define CARD_STATE_CMD_ENABLE 0x01 /* Wake up card */ |
| 2064 | #define CARD_STATE_CMD_HALT 0x02 /* Power down permanently */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2065 | struct iwl4965_card_state_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2066 | __le32 status; /* CARD_STATE_CMD_* request new power state */ |
| 2067 | } __attribute__ ((packed)); |
| 2068 | |
| 2069 | /* |
| 2070 | * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command) |
| 2071 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2072 | struct iwl4965_card_state_notif { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2073 | __le32 flags; |
| 2074 | } __attribute__ ((packed)); |
| 2075 | |
| 2076 | #define HW_CARD_DISABLED 0x01 |
| 2077 | #define SW_CARD_DISABLED 0x02 |
| 2078 | #define RF_CARD_DISABLED 0x04 |
| 2079 | #define RXON_CARD_DISABLED 0x10 |
| 2080 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2081 | struct iwl4965_ct_kill_config { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2082 | __le32 reserved; |
| 2083 | __le32 critical_temperature_M; |
| 2084 | __le32 critical_temperature_R; |
| 2085 | } __attribute__ ((packed)); |
| 2086 | |
| 2087 | /****************************************************************************** |
| 2088 | * (8) |
| 2089 | * Scan Commands, Responses, Notifications: |
| 2090 | * |
| 2091 | *****************************************************************************/ |
| 2092 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2093 | /** |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2094 | * struct iwl_scan_channel - entry in REPLY_SCAN_CMD channel table |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2095 | * |
| 2096 | * One for each channel in the scan list. |
| 2097 | * Each channel can independently select: |
| 2098 | * 1) SSID for directed active scans |
| 2099 | * 2) Txpower setting (for rate specified within Tx command) |
| 2100 | * 3) How long to stay on-channel (behavior may be modified by quiet_time, |
| 2101 | * quiet_plcp_th, good_CRC_th) |
| 2102 | * |
| 2103 | * To avoid uCode errors, make sure the following are true (see comments |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2104 | * under struct iwl_scan_cmd about max_out_time and quiet_time): |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2105 | * 1) If using passive_dwell (i.e. passive_dwell != 0): |
| 2106 | * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) |
| 2107 | * 2) quiet_time <= active_dwell |
| 2108 | * 3) If restricting off-channel time (i.e. max_out_time !=0): |
| 2109 | * passive_dwell < max_out_time |
| 2110 | * active_dwell < max_out_time |
| 2111 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2112 | struct iwl_scan_channel { |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2113 | /* |
| 2114 | * type is defined as: |
| 2115 | * 0:0 1 = active, 0 = passive |
| 2116 | * 1:4 SSID direct bit map; if a bit is set, then corresponding |
| 2117 | * SSID IE is transmitted in probe request. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2118 | * 5:7 reserved |
| 2119 | */ |
| 2120 | u8 type; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2121 | u8 channel; /* band is selected by iwl4965_scan_cmd "flags" field */ |
Tomas Winkler | f53696d | 2008-06-12 09:47:12 +0800 | [diff] [blame^] | 2122 | u8 tx_gain; /* gain for analog radio */ |
| 2123 | u8 dsp_atten; /* gain for DSP */ |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2124 | __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */ |
| 2125 | __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2126 | } __attribute__ ((packed)); |
| 2127 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2128 | /** |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2129 | * struct iwl_ssid_ie - directed scan network information element |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2130 | * |
| 2131 | * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field |
| 2132 | * in struct iwl4965_scan_channel; each channel may select different ssids from |
| 2133 | * among the 4 entries. SSID IEs get transmitted in reverse order of entry. |
| 2134 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2135 | struct iwl_ssid_ie { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2136 | u8 id; |
| 2137 | u8 len; |
| 2138 | u8 ssid[32]; |
| 2139 | } __attribute__ ((packed)); |
| 2140 | |
| 2141 | #define PROBE_OPTION_MAX 0x4 |
| 2142 | #define TX_CMD_LIFE_TIME_INFINITE __constant_cpu_to_le32(0xFFFFFFFF) |
| 2143 | #define IWL_GOOD_CRC_TH __constant_cpu_to_le16(1) |
| 2144 | #define IWL_MAX_SCAN_SIZE 1024 |
| 2145 | |
| 2146 | /* |
| 2147 | * REPLY_SCAN_CMD = 0x80 (command) |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2148 | * |
| 2149 | * The hardware scan command is very powerful; the driver can set it up to |
| 2150 | * maintain (relatively) normal network traffic while doing a scan in the |
| 2151 | * background. The max_out_time and suspend_time control the ratio of how |
| 2152 | * long the device stays on an associated network channel ("service channel") |
| 2153 | * vs. how long it's away from the service channel, i.e. tuned to other channels |
| 2154 | * for scanning. |
| 2155 | * |
| 2156 | * max_out_time is the max time off-channel (in usec), and suspend_time |
| 2157 | * is how long (in "extended beacon" format) that the scan is "suspended" |
| 2158 | * after returning to the service channel. That is, suspend_time is the |
| 2159 | * time that we stay on the service channel, doing normal work, between |
| 2160 | * scan segments. The driver may set these parameters differently to support |
| 2161 | * scanning when associated vs. not associated, and light vs. heavy traffic |
| 2162 | * loads when associated. |
| 2163 | * |
| 2164 | * After receiving this command, the device's scan engine does the following; |
| 2165 | * |
| 2166 | * 1) Sends SCAN_START notification to driver |
| 2167 | * 2) Checks to see if it has time to do scan for one channel |
| 2168 | * 3) Sends NULL packet, with power-save (PS) bit set to 1, |
| 2169 | * to tell AP that we're going off-channel |
| 2170 | * 4) Tunes to first channel in scan list, does active or passive scan |
| 2171 | * 5) Sends SCAN_RESULT notification to driver |
| 2172 | * 6) Checks to see if it has time to do scan on *next* channel in list |
| 2173 | * 7) Repeats 4-6 until it no longer has time to scan the next channel |
| 2174 | * before max_out_time expires |
| 2175 | * 8) Returns to service channel |
| 2176 | * 9) Sends NULL packet with PS=0 to tell AP that we're back |
| 2177 | * 10) Stays on service channel until suspend_time expires |
| 2178 | * 11) Repeats entire process 2-10 until list is complete |
| 2179 | * 12) Sends SCAN_COMPLETE notification |
| 2180 | * |
| 2181 | * For fast, efficient scans, the scan command also has support for staying on |
| 2182 | * a channel for just a short time, if doing active scanning and getting no |
| 2183 | * responses to the transmitted probe request. This time is controlled by |
| 2184 | * quiet_time, and the number of received packets below which a channel is |
| 2185 | * considered "quiet" is controlled by quiet_plcp_threshold. |
| 2186 | * |
| 2187 | * For active scanning on channels that have regulatory restrictions against |
| 2188 | * blindly transmitting, the scan can listen before transmitting, to make sure |
| 2189 | * that there is already legitimate activity on the channel. If enough |
| 2190 | * packets are cleanly received on the channel (controlled by good_CRC_th, |
| 2191 | * typical value 1), the scan engine starts transmitting probe requests. |
| 2192 | * |
| 2193 | * Driver must use separate scan commands for 2.4 vs. 5 GHz bands. |
| 2194 | * |
| 2195 | * To avoid uCode errors, see timing restrictions described under |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2196 | * struct iwl_scan_channel. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2197 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2198 | struct iwl_scan_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2199 | __le16 len; |
| 2200 | u8 reserved0; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2201 | u8 channel_count; /* # channels in channel list */ |
| 2202 | __le16 quiet_time; /* dwell only this # millisecs on quiet channel |
| 2203 | * (only for active scan) */ |
| 2204 | __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */ |
| 2205 | __le16 good_CRC_th; /* passive -> active promotion threshold */ |
| 2206 | __le16 rx_chain; /* RXON_RX_CHAIN_* */ |
| 2207 | __le32 max_out_time; /* max usec to be away from associated (service) |
| 2208 | * channel */ |
| 2209 | __le32 suspend_time; /* pause scan this long (in "extended beacon |
| 2210 | * format") when returning to service chnl: |
| 2211 | * 3945; 31:24 # beacons, 19:0 additional usec, |
| 2212 | * 4965; 31:22 # beacons, 21:0 additional usec. |
| 2213 | */ |
| 2214 | __le32 flags; /* RXON_FLG_* */ |
| 2215 | __le32 filter_flags; /* RXON_FILTER_* */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2216 | |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2217 | /* For active scans (set to all-0s for passive scans). |
| 2218 | * Does not include payload. Must specify Tx rate; no rate scaling. */ |
Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 2219 | struct iwl_tx_cmd tx_cmd; |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2220 | |
| 2221 | /* For directed active scans (set to all-0s otherwise) */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2222 | struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2223 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2224 | /* |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2225 | * Probe request frame, followed by channel list. |
| 2226 | * |
| 2227 | * Size of probe request frame is specified by byte count in tx_cmd. |
| 2228 | * Channel list follows immediately after probe request frame. |
| 2229 | * Number of channels in list is specified by channel_count. |
| 2230 | * Each channel in list is of type: |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2231 | * |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2232 | * struct iwl4965_scan_channel channels[0]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2233 | * |
| 2234 | * NOTE: Only one band of channels can be scanned per pass. You |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2235 | * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait |
| 2236 | * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION) |
| 2237 | * before requesting another scan. |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2238 | */ |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2239 | u8 data[0]; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2240 | } __attribute__ ((packed)); |
| 2241 | |
| 2242 | /* Can abort will notify by complete notification with abort status. */ |
| 2243 | #define CAN_ABORT_STATUS __constant_cpu_to_le32(0x1) |
| 2244 | /* complete notification statuses */ |
| 2245 | #define ABORT_STATUS 0x2 |
| 2246 | |
| 2247 | /* |
| 2248 | * REPLY_SCAN_CMD = 0x80 (response) |
| 2249 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2250 | struct iwl_scanreq_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2251 | __le32 status; /* 1: okay, 2: cannot fulfill request */ |
| 2252 | } __attribute__ ((packed)); |
| 2253 | |
| 2254 | /* |
| 2255 | * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command) |
| 2256 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2257 | struct iwl_scanstart_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2258 | __le32 tsf_low; |
| 2259 | __le32 tsf_high; |
| 2260 | __le32 beacon_timer; |
| 2261 | u8 channel; |
| 2262 | u8 band; |
| 2263 | u8 reserved[2]; |
| 2264 | __le32 status; |
| 2265 | } __attribute__ ((packed)); |
| 2266 | |
| 2267 | #define SCAN_OWNER_STATUS 0x1; |
| 2268 | #define MEASURE_OWNER_STATUS 0x2; |
| 2269 | |
| 2270 | #define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */ |
| 2271 | /* |
| 2272 | * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command) |
| 2273 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2274 | struct iwl_scanresults_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2275 | u8 channel; |
| 2276 | u8 band; |
| 2277 | u8 reserved[2]; |
| 2278 | __le32 tsf_low; |
| 2279 | __le32 tsf_high; |
| 2280 | __le32 statistics[NUMBER_OF_STATISTICS]; |
| 2281 | } __attribute__ ((packed)); |
| 2282 | |
| 2283 | /* |
| 2284 | * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command) |
| 2285 | */ |
Tomas Winkler | 2a421b9 | 2008-06-12 09:47:10 +0800 | [diff] [blame] | 2286 | struct iwl_scancomplete_notification { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2287 | u8 scanned_channels; |
| 2288 | u8 status; |
| 2289 | u8 reserved; |
| 2290 | u8 last_channel; |
| 2291 | __le32 tsf_low; |
| 2292 | __le32 tsf_high; |
| 2293 | } __attribute__ ((packed)); |
| 2294 | |
| 2295 | |
| 2296 | /****************************************************************************** |
| 2297 | * (9) |
| 2298 | * IBSS/AP Commands and Notifications: |
| 2299 | * |
| 2300 | *****************************************************************************/ |
| 2301 | |
| 2302 | /* |
| 2303 | * BEACON_NOTIFICATION = 0x90 (notification only, not a command) |
| 2304 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2305 | struct iwl4965_beacon_notif { |
| 2306 | struct iwl4965_tx_resp beacon_notify_hdr; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2307 | __le32 low_tsf; |
| 2308 | __le32 high_tsf; |
| 2309 | __le32 ibss_mgr_status; |
| 2310 | } __attribute__ ((packed)); |
| 2311 | |
| 2312 | /* |
| 2313 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) |
| 2314 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2315 | struct iwl4965_tx_beacon_cmd { |
Tomas Winkler | 83d527d | 2008-05-15 13:54:05 +0800 | [diff] [blame] | 2316 | struct iwl_tx_cmd tx; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2317 | __le16 tim_idx; |
| 2318 | u8 tim_size; |
| 2319 | u8 reserved1; |
| 2320 | struct ieee80211_hdr frame[0]; /* beacon frame */ |
| 2321 | } __attribute__ ((packed)); |
| 2322 | |
| 2323 | /****************************************************************************** |
| 2324 | * (10) |
| 2325 | * Statistics Commands and Notifications: |
| 2326 | * |
| 2327 | *****************************************************************************/ |
| 2328 | |
| 2329 | #define IWL_TEMP_CONVERT 260 |
| 2330 | |
| 2331 | #define SUP_RATE_11A_MAX_NUM_CHANNELS 8 |
| 2332 | #define SUP_RATE_11B_MAX_NUM_CHANNELS 4 |
| 2333 | #define SUP_RATE_11G_MAX_NUM_CHANNELS 12 |
| 2334 | |
| 2335 | /* Used for passing to driver number of successes and failures per rate */ |
| 2336 | struct rate_histogram { |
| 2337 | union { |
| 2338 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 2339 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 2340 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 2341 | } success; |
| 2342 | union { |
| 2343 | __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS]; |
| 2344 | __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS]; |
| 2345 | __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS]; |
| 2346 | } failed; |
| 2347 | } __attribute__ ((packed)); |
| 2348 | |
| 2349 | /* statistics command response */ |
| 2350 | |
| 2351 | struct statistics_rx_phy { |
| 2352 | __le32 ina_cnt; |
| 2353 | __le32 fina_cnt; |
| 2354 | __le32 plcp_err; |
| 2355 | __le32 crc32_err; |
| 2356 | __le32 overrun_err; |
| 2357 | __le32 early_overrun_err; |
| 2358 | __le32 crc32_good; |
| 2359 | __le32 false_alarm_cnt; |
| 2360 | __le32 fina_sync_err_cnt; |
| 2361 | __le32 sfd_timeout; |
| 2362 | __le32 fina_timeout; |
| 2363 | __le32 unresponded_rts; |
| 2364 | __le32 rxe_frame_limit_overrun; |
| 2365 | __le32 sent_ack_cnt; |
| 2366 | __le32 sent_cts_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2367 | __le32 sent_ba_rsp_cnt; |
| 2368 | __le32 dsp_self_kill; |
| 2369 | __le32 mh_format_err; |
| 2370 | __le32 re_acq_main_rssi_sum; |
| 2371 | __le32 reserved3; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2372 | } __attribute__ ((packed)); |
| 2373 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2374 | struct statistics_rx_ht_phy { |
| 2375 | __le32 plcp_err; |
| 2376 | __le32 overrun_err; |
| 2377 | __le32 early_overrun_err; |
| 2378 | __le32 crc32_good; |
| 2379 | __le32 crc32_err; |
| 2380 | __le32 mh_format_err; |
| 2381 | __le32 agg_crc32_good; |
| 2382 | __le32 agg_mpdu_cnt; |
| 2383 | __le32 agg_cnt; |
| 2384 | __le32 reserved2; |
| 2385 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2386 | |
| 2387 | struct statistics_rx_non_phy { |
| 2388 | __le32 bogus_cts; /* CTS received when not expecting CTS */ |
| 2389 | __le32 bogus_ack; /* ACK received when not expecting ACK */ |
| 2390 | __le32 non_bssid_frames; /* number of frames with BSSID that |
| 2391 | * doesn't belong to the STA BSSID */ |
| 2392 | __le32 filtered_frames; /* count frames that were dumped in the |
| 2393 | * filtering process */ |
| 2394 | __le32 non_channel_beacons; /* beacons with our bss id but not on |
| 2395 | * our serving channel */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2396 | __le32 channel_beacons; /* beacons with our bss id and in our |
| 2397 | * serving channel */ |
| 2398 | __le32 num_missed_bcon; /* number of missed beacons */ |
| 2399 | __le32 adc_rx_saturation_time; /* count in 0.8us units the time the |
| 2400 | * ADC was in saturation */ |
| 2401 | __le32 ina_detection_search_time;/* total time (in 0.8us) searched |
| 2402 | * for INA */ |
| 2403 | __le32 beacon_silence_rssi_a; /* RSSI silence after beacon frame */ |
| 2404 | __le32 beacon_silence_rssi_b; /* RSSI silence after beacon frame */ |
| 2405 | __le32 beacon_silence_rssi_c; /* RSSI silence after beacon frame */ |
| 2406 | __le32 interference_data_flag; /* flag for interference data |
| 2407 | * availability. 1 when data is |
| 2408 | * available. */ |
Ben Cahill | 3058f02 | 2008-01-14 17:46:17 -0800 | [diff] [blame] | 2409 | __le32 channel_load; /* counts RX Enable time in uSec */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2410 | __le32 dsp_false_alarms; /* DSP false alarm (both OFDM |
| 2411 | * and CCK) counter */ |
| 2412 | __le32 beacon_rssi_a; |
| 2413 | __le32 beacon_rssi_b; |
| 2414 | __le32 beacon_rssi_c; |
| 2415 | __le32 beacon_energy_a; |
| 2416 | __le32 beacon_energy_b; |
| 2417 | __le32 beacon_energy_c; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2418 | } __attribute__ ((packed)); |
| 2419 | |
| 2420 | struct statistics_rx { |
| 2421 | struct statistics_rx_phy ofdm; |
| 2422 | struct statistics_rx_phy cck; |
| 2423 | struct statistics_rx_non_phy general; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2424 | struct statistics_rx_ht_phy ofdm_ht; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2425 | } __attribute__ ((packed)); |
| 2426 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2427 | struct statistics_tx_non_phy_agg { |
| 2428 | __le32 ba_timeout; |
| 2429 | __le32 ba_reschedule_frames; |
| 2430 | __le32 scd_query_agg_frame_cnt; |
| 2431 | __le32 scd_query_no_agg; |
| 2432 | __le32 scd_query_agg; |
| 2433 | __le32 scd_query_mismatch; |
| 2434 | __le32 frame_not_ready; |
| 2435 | __le32 underrun; |
| 2436 | __le32 bt_prio_kill; |
| 2437 | __le32 rx_ba_rsp_cnt; |
| 2438 | __le32 reserved2; |
| 2439 | __le32 reserved3; |
| 2440 | } __attribute__ ((packed)); |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2441 | |
| 2442 | struct statistics_tx { |
| 2443 | __le32 preamble_cnt; |
| 2444 | __le32 rx_detected_cnt; |
| 2445 | __le32 bt_prio_defer_cnt; |
| 2446 | __le32 bt_prio_kill_cnt; |
| 2447 | __le32 few_bytes_cnt; |
| 2448 | __le32 cts_timeout; |
| 2449 | __le32 ack_timeout; |
| 2450 | __le32 expected_ack_cnt; |
| 2451 | __le32 actual_ack_cnt; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2452 | __le32 dump_msdu_cnt; |
| 2453 | __le32 burst_abort_next_frame_mismatch_cnt; |
| 2454 | __le32 burst_abort_missing_next_frame_cnt; |
| 2455 | __le32 cts_timeout_collision; |
| 2456 | __le32 ack_or_ba_timeout_collision; |
| 2457 | struct statistics_tx_non_phy_agg agg; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2458 | } __attribute__ ((packed)); |
| 2459 | |
| 2460 | struct statistics_dbg { |
| 2461 | __le32 burst_check; |
| 2462 | __le32 burst_count; |
| 2463 | __le32 reserved[4]; |
| 2464 | } __attribute__ ((packed)); |
| 2465 | |
| 2466 | struct statistics_div { |
| 2467 | __le32 tx_on_a; |
| 2468 | __le32 tx_on_b; |
| 2469 | __le32 exec_time; |
| 2470 | __le32 probe_time; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2471 | __le32 reserved1; |
| 2472 | __le32 reserved2; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2473 | } __attribute__ ((packed)); |
| 2474 | |
| 2475 | struct statistics_general { |
| 2476 | __le32 temperature; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2477 | __le32 temperature_m; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2478 | struct statistics_dbg dbg; |
| 2479 | __le32 sleep_time; |
| 2480 | __le32 slots_out; |
| 2481 | __le32 slots_idle; |
| 2482 | __le32 ttl_timestamp; |
| 2483 | struct statistics_div div; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2484 | __le32 rx_enable_counter; |
| 2485 | __le32 reserved1; |
| 2486 | __le32 reserved2; |
| 2487 | __le32 reserved3; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2488 | } __attribute__ ((packed)); |
| 2489 | |
| 2490 | /* |
| 2491 | * REPLY_STATISTICS_CMD = 0x9c, |
| 2492 | * 3945 and 4965 identical. |
| 2493 | * |
| 2494 | * This command triggers an immediate response containing uCode statistics. |
| 2495 | * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below. |
| 2496 | * |
| 2497 | * If the CLEAR_STATS configuration flag is set, uCode will clear its |
| 2498 | * internal copy of the statistics (counters) after issuing the response. |
| 2499 | * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below). |
| 2500 | * |
| 2501 | * If the DISABLE_NOTIF configuration flag is set, uCode will not issue |
| 2502 | * STATISTICS_NOTIFICATIONs after received beacons (see below). This flag |
| 2503 | * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself. |
| 2504 | */ |
| 2505 | #define IWL_STATS_CONF_CLEAR_STATS __constant_cpu_to_le32(0x1) /* see above */ |
| 2506 | #define IWL_STATS_CONF_DISABLE_NOTIF __constant_cpu_to_le32(0x2)/* see above */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2507 | struct iwl4965_statistics_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2508 | __le32 configuration_flags; /* IWL_STATS_CONF_* */ |
| 2509 | } __attribute__ ((packed)); |
| 2510 | |
| 2511 | /* |
| 2512 | * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command) |
| 2513 | * |
| 2514 | * By default, uCode issues this notification after receiving a beacon |
| 2515 | * while associated. To disable this behavior, set DISABLE_NOTIF flag in the |
| 2516 | * REPLY_STATISTICS_CMD 0x9c, above. |
| 2517 | * |
| 2518 | * Statistics counters continue to increment beacon after beacon, but are |
| 2519 | * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD |
| 2520 | * 0x9c with CLEAR_STATS bit set (see above). |
| 2521 | * |
| 2522 | * uCode also issues this notification during scans. uCode clears statistics |
| 2523 | * appropriately so that each notification contains statistics for only the |
| 2524 | * one channel that has just been scanned. |
| 2525 | */ |
| 2526 | #define STATISTICS_REPLY_FLG_BAND_24G_MSK __constant_cpu_to_le32(0x2) |
| 2527 | #define STATISTICS_REPLY_FLG_FAT_MODE_MSK __constant_cpu_to_le32(0x8) |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2528 | struct iwl4965_notif_statistics { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2529 | __le32 flag; |
| 2530 | struct statistics_rx rx; |
| 2531 | struct statistics_tx tx; |
| 2532 | struct statistics_general general; |
| 2533 | } __attribute__ ((packed)); |
| 2534 | |
| 2535 | |
| 2536 | /* |
| 2537 | * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command) |
| 2538 | */ |
| 2539 | /* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row, |
| 2540 | * then this notification will be sent. */ |
| 2541 | #define CONSECUTIVE_MISSED_BCONS_TH 20 |
| 2542 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2543 | struct iwl4965_missed_beacon_notif { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2544 | __le32 consequtive_missed_beacons; |
| 2545 | __le32 total_missed_becons; |
| 2546 | __le32 num_expected_beacons; |
| 2547 | __le32 num_recvd_beacons; |
| 2548 | } __attribute__ ((packed)); |
| 2549 | |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2550 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2551 | /****************************************************************************** |
| 2552 | * (11) |
| 2553 | * Rx Calibration Commands: |
| 2554 | * |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2555 | * With the uCode used for open source drivers, most Tx calibration (except |
| 2556 | * for Tx Power) and most Rx calibration is done by uCode during the |
| 2557 | * "initialize" phase of uCode boot. Driver must calibrate only: |
| 2558 | * |
| 2559 | * 1) Tx power (depends on temperature), described elsewhere |
| 2560 | * 2) Receiver gain balance (optimize MIMO, and detect disconnected antennas) |
| 2561 | * 3) Receiver sensitivity (to optimize signal detection) |
| 2562 | * |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2563 | *****************************************************************************/ |
| 2564 | |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2565 | /** |
| 2566 | * SENSITIVITY_CMD = 0xa8 (command, has simple generic response) |
| 2567 | * |
| 2568 | * This command sets up the Rx signal detector for a sensitivity level that |
| 2569 | * is high enough to lock onto all signals within the associated network, |
| 2570 | * but low enough to ignore signals that are below a certain threshold, so as |
| 2571 | * not to have too many "false alarms". False alarms are signals that the |
| 2572 | * Rx DSP tries to lock onto, but then discards after determining that they |
| 2573 | * are noise. |
| 2574 | * |
| 2575 | * The optimum number of false alarms is between 5 and 50 per 200 TUs |
| 2576 | * (200 * 1024 uSecs, i.e. 204.8 milliseconds) of actual Rx time (i.e. |
| 2577 | * time listening, not transmitting). Driver must adjust sensitivity so that |
| 2578 | * the ratio of actual false alarms to actual Rx time falls within this range. |
| 2579 | * |
| 2580 | * While associated, uCode delivers STATISTICS_NOTIFICATIONs after each |
| 2581 | * received beacon. These provide information to the driver to analyze the |
| 2582 | * sensitivity. Don't analyze statistics that come in from scanning, or any |
| 2583 | * other non-associated-network source. Pertinent statistics include: |
| 2584 | * |
| 2585 | * From "general" statistics (struct statistics_rx_non_phy): |
| 2586 | * |
| 2587 | * (beacon_energy_[abc] & 0x0FF00) >> 8 (unsigned, higher value is lower level) |
| 2588 | * Measure of energy of desired signal. Used for establishing a level |
| 2589 | * below which the device does not detect signals. |
| 2590 | * |
| 2591 | * (beacon_silence_rssi_[abc] & 0x0FF00) >> 8 (unsigned, units in dB) |
| 2592 | * Measure of background noise in silent period after beacon. |
| 2593 | * |
| 2594 | * channel_load |
| 2595 | * uSecs of actual Rx time during beacon period (varies according to |
| 2596 | * how much time was spent transmitting). |
| 2597 | * |
| 2598 | * From "cck" and "ofdm" statistics (struct statistics_rx_phy), separately: |
| 2599 | * |
| 2600 | * false_alarm_cnt |
| 2601 | * Signal locks abandoned early (before phy-level header). |
| 2602 | * |
| 2603 | * plcp_err |
| 2604 | * Signal locks abandoned late (during phy-level header). |
| 2605 | * |
| 2606 | * NOTE: Both false_alarm_cnt and plcp_err increment monotonically from |
| 2607 | * beacon to beacon, i.e. each value is an accumulation of all errors |
| 2608 | * before and including the latest beacon. Values will wrap around to 0 |
| 2609 | * after counting up to 2^32 - 1. Driver must differentiate vs. |
| 2610 | * previous beacon's values to determine # false alarms in the current |
| 2611 | * beacon period. |
| 2612 | * |
| 2613 | * Total number of false alarms = false_alarms + plcp_errs |
| 2614 | * |
| 2615 | * For OFDM, adjust the following table entries in struct iwl_sensitivity_cmd |
| 2616 | * (notice that the start points for OFDM are at or close to settings for |
| 2617 | * maximum sensitivity): |
| 2618 | * |
| 2619 | * START / MIN / MAX |
| 2620 | * HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX 90 / 85 / 120 |
| 2621 | * HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX 170 / 170 / 210 |
| 2622 | * HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX 105 / 105 / 140 |
| 2623 | * HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX 220 / 220 / 270 |
| 2624 | * |
| 2625 | * If actual rate of OFDM false alarms (+ plcp_errors) is too high |
| 2626 | * (greater than 50 for each 204.8 msecs listening), reduce sensitivity |
| 2627 | * by *adding* 1 to all 4 of the table entries above, up to the max for |
| 2628 | * each entry. Conversely, if false alarm rate is too low (less than 5 |
| 2629 | * for each 204.8 msecs listening), *subtract* 1 from each entry to |
| 2630 | * increase sensitivity. |
| 2631 | * |
| 2632 | * For CCK sensitivity, keep track of the following: |
| 2633 | * |
| 2634 | * 1). 20-beacon history of maximum background noise, indicated by |
| 2635 | * (beacon_silence_rssi_[abc] & 0x0FF00), units in dB, across the |
| 2636 | * 3 receivers. For any given beacon, the "silence reference" is |
| 2637 | * the maximum of last 60 samples (20 beacons * 3 receivers). |
| 2638 | * |
| 2639 | * 2). 10-beacon history of strongest signal level, as indicated |
| 2640 | * by (beacon_energy_[abc] & 0x0FF00) >> 8, across the 3 receivers, |
| 2641 | * i.e. the strength of the signal through the best receiver at the |
| 2642 | * moment. These measurements are "upside down", with lower values |
| 2643 | * for stronger signals, so max energy will be *minimum* value. |
| 2644 | * |
| 2645 | * Then for any given beacon, the driver must determine the *weakest* |
| 2646 | * of the strongest signals; this is the minimum level that needs to be |
| 2647 | * successfully detected, when using the best receiver at the moment. |
| 2648 | * "Max cck energy" is the maximum (higher value means lower energy!) |
| 2649 | * of the last 10 minima. Once this is determined, driver must add |
| 2650 | * a little margin by adding "6" to it. |
| 2651 | * |
| 2652 | * 3). Number of consecutive beacon periods with too few false alarms. |
| 2653 | * Reset this to 0 at the first beacon period that falls within the |
| 2654 | * "good" range (5 to 50 false alarms per 204.8 milliseconds rx). |
| 2655 | * |
| 2656 | * Then, adjust the following CCK table entries in struct iwl_sensitivity_cmd |
| 2657 | * (notice that the start points for CCK are at maximum sensitivity): |
| 2658 | * |
| 2659 | * START / MIN / MAX |
| 2660 | * HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX 125 / 125 / 200 |
| 2661 | * HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX 200 / 200 / 400 |
| 2662 | * HD_MIN_ENERGY_CCK_DET_INDEX 100 / 0 / 100 |
| 2663 | * |
| 2664 | * If actual rate of CCK false alarms (+ plcp_errors) is too high |
| 2665 | * (greater than 50 for each 204.8 msecs listening), method for reducing |
| 2666 | * sensitivity is: |
| 2667 | * |
| 2668 | * 1) *Add* 3 to value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, |
| 2669 | * up to max 400. |
| 2670 | * |
| 2671 | * 2) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is < 160, |
| 2672 | * sensitivity has been reduced a significant amount; bring it up to |
| 2673 | * a moderate 161. Otherwise, *add* 3, up to max 200. |
| 2674 | * |
| 2675 | * 3) a) If current value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX is > 160, |
| 2676 | * sensitivity has been reduced only a moderate or small amount; |
| 2677 | * *subtract* 2 from value in HD_MIN_ENERGY_CCK_DET_INDEX, |
| 2678 | * down to min 0. Otherwise (if gain has been significantly reduced), |
| 2679 | * don't change the HD_MIN_ENERGY_CCK_DET_INDEX value. |
| 2680 | * |
| 2681 | * b) Save a snapshot of the "silence reference". |
| 2682 | * |
| 2683 | * If actual rate of CCK false alarms (+ plcp_errors) is too low |
| 2684 | * (less than 5 for each 204.8 msecs listening), method for increasing |
| 2685 | * sensitivity is used only if: |
| 2686 | * |
| 2687 | * 1a) Previous beacon did not have too many false alarms |
| 2688 | * 1b) AND difference between previous "silence reference" and current |
| 2689 | * "silence reference" (prev - current) is 2 or more, |
| 2690 | * OR 2) 100 or more consecutive beacon periods have had rate of |
| 2691 | * less than 5 false alarms per 204.8 milliseconds rx time. |
| 2692 | * |
| 2693 | * Method for increasing sensitivity: |
| 2694 | * |
| 2695 | * 1) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX, |
| 2696 | * down to min 125. |
| 2697 | * |
| 2698 | * 2) *Subtract* 3 from value in HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX, |
| 2699 | * down to min 200. |
| 2700 | * |
| 2701 | * 3) *Add* 2 to value in HD_MIN_ENERGY_CCK_DET_INDEX, up to max 100. |
| 2702 | * |
| 2703 | * If actual rate of CCK false alarms (+ plcp_errors) is within good range |
| 2704 | * (between 5 and 50 for each 204.8 msecs listening): |
| 2705 | * |
| 2706 | * 1) Save a snapshot of the silence reference. |
| 2707 | * |
| 2708 | * 2) If previous beacon had too many CCK false alarms (+ plcp_errors), |
| 2709 | * give some extra margin to energy threshold by *subtracting* 8 |
| 2710 | * from value in HD_MIN_ENERGY_CCK_DET_INDEX. |
| 2711 | * |
| 2712 | * For all cases (too few, too many, good range), make sure that the CCK |
| 2713 | * detection threshold (energy) is below the energy level for robust |
| 2714 | * detection over the past 10 beacon periods, the "Max cck energy". |
| 2715 | * Lower values mean higher energy; this means making sure that the value |
| 2716 | * in HD_MIN_ENERGY_CCK_DET_INDEX is at or *above* "Max cck energy". |
| 2717 | * |
| 2718 | * Driver should set the following entries to fixed values: |
| 2719 | * |
| 2720 | * HD_MIN_ENERGY_OFDM_DET_INDEX 100 |
| 2721 | * HD_BARKER_CORR_TH_ADD_MIN_INDEX 190 |
| 2722 | * HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX 390 |
| 2723 | * HD_OFDM_ENERGY_TH_IN_INDEX 62 |
| 2724 | */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2725 | |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2726 | /* |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 2727 | * Table entries in SENSITIVITY_CMD (struct iwl_sensitivity_cmd) |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2728 | */ |
| 2729 | #define HD_TABLE_SIZE (11) /* number of entries */ |
| 2730 | #define HD_MIN_ENERGY_CCK_DET_INDEX (0) /* table indexes */ |
| 2731 | #define HD_MIN_ENERGY_OFDM_DET_INDEX (1) |
| 2732 | #define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX (2) |
| 2733 | #define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX (3) |
| 2734 | #define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX (4) |
| 2735 | #define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX (5) |
| 2736 | #define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX (6) |
| 2737 | #define HD_BARKER_CORR_TH_ADD_MIN_INDEX (7) |
| 2738 | #define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX (8) |
| 2739 | #define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX (9) |
| 2740 | #define HD_OFDM_ENERGY_TH_IN_INDEX (10) |
| 2741 | |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 2742 | /* Control field in struct iwl_sensitivity_cmd */ |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2743 | #define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE __constant_cpu_to_le16(0) |
| 2744 | #define SENSITIVITY_CMD_CONTROL_WORK_TABLE __constant_cpu_to_le16(1) |
| 2745 | |
| 2746 | /** |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 2747 | * struct iwl_sensitivity_cmd |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2748 | * @control: (1) updates working table, (0) updates default table |
| 2749 | * @table: energy threshold values, use HD_* as index into table |
| 2750 | * |
| 2751 | * Always use "1" in "control" to update uCode's working table and DSP. |
| 2752 | */ |
Emmanuel Grumbach | f0832f1 | 2008-04-16 16:34:47 -0700 | [diff] [blame] | 2753 | struct iwl_sensitivity_cmd { |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2754 | __le16 control; /* always use "1" */ |
| 2755 | __le16 table[HD_TABLE_SIZE]; /* use HD_* as index */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2756 | } __attribute__ ((packed)); |
| 2757 | |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2758 | |
| 2759 | /** |
| 2760 | * REPLY_PHY_CALIBRATION_CMD = 0xb0 (command, has simple generic response) |
| 2761 | * |
| 2762 | * This command sets the relative gains of 4965's 3 radio receiver chains. |
| 2763 | * |
| 2764 | * After the first association, driver should accumulate signal and noise |
| 2765 | * statistics from the STATISTICS_NOTIFICATIONs that follow the first 20 |
| 2766 | * beacons from the associated network (don't collect statistics that come |
| 2767 | * in from scanning, or any other non-network source). |
| 2768 | * |
| 2769 | * DISCONNECTED ANTENNA: |
| 2770 | * |
| 2771 | * Driver should determine which antennas are actually connected, by comparing |
| 2772 | * average beacon signal levels for the 3 Rx chains. Accumulate (add) the |
| 2773 | * following values over 20 beacons, one accumulator for each of the chains |
| 2774 | * a/b/c, from struct statistics_rx_non_phy: |
| 2775 | * |
| 2776 | * beacon_rssi_[abc] & 0x0FF (unsigned, units in dB) |
| 2777 | * |
| 2778 | * Find the strongest signal from among a/b/c. Compare the other two to the |
| 2779 | * strongest. If any signal is more than 15 dB (times 20, unless you |
| 2780 | * divide the accumulated values by 20) below the strongest, the driver |
| 2781 | * considers that antenna to be disconnected, and should not try to use that |
| 2782 | * antenna/chain for Rx or Tx. If both A and B seem to be disconnected, |
| 2783 | * driver should declare the stronger one as connected, and attempt to use it |
| 2784 | * (A and B are the only 2 Tx chains!). |
| 2785 | * |
| 2786 | * |
| 2787 | * RX BALANCE: |
| 2788 | * |
| 2789 | * Driver should balance the 3 receivers (but just the ones that are connected |
| 2790 | * to antennas, see above) for gain, by comparing the average signal levels |
| 2791 | * detected during the silence after each beacon (background noise). |
| 2792 | * Accumulate (add) the following values over 20 beacons, one accumulator for |
| 2793 | * each of the chains a/b/c, from struct statistics_rx_non_phy: |
| 2794 | * |
| 2795 | * beacon_silence_rssi_[abc] & 0x0FF (unsigned, units in dB) |
| 2796 | * |
| 2797 | * Find the weakest background noise level from among a/b/c. This Rx chain |
| 2798 | * will be the reference, with 0 gain adjustment. Attenuate other channels by |
| 2799 | * finding noise difference: |
| 2800 | * |
| 2801 | * (accum_noise[i] - accum_noise[reference]) / 30 |
| 2802 | * |
| 2803 | * The "30" adjusts the dB in the 20 accumulated samples to units of 1.5 dB. |
| 2804 | * For use in diff_gain_[abc] fields of struct iwl_calibration_cmd, the |
| 2805 | * driver should limit the difference results to a range of 0-3 (0-4.5 dB), |
| 2806 | * and set bit 2 to indicate "reduce gain". The value for the reference |
| 2807 | * (weakest) chain should be "0". |
| 2808 | * |
| 2809 | * diff_gain_[abc] bit fields: |
| 2810 | * 2: (1) reduce gain, (0) increase gain |
| 2811 | * 1-0: amount of gain, units of 1.5 dB |
| 2812 | */ |
| 2813 | |
| 2814 | /* "Differential Gain" opcode used in REPLY_PHY_CALIBRATION_CMD. */ |
| 2815 | #define PHY_CALIBRATE_DIFF_GAIN_CMD (7) |
| 2816 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2817 | struct iwl4965_calibration_cmd { |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2818 | u8 opCode; /* PHY_CALIBRATE_DIFF_GAIN_CMD (7) */ |
| 2819 | u8 flags; /* not used */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2820 | __le16 reserved; |
Ben Cahill | f7d09d7 | 2007-11-29 11:09:51 +0800 | [diff] [blame] | 2821 | s8 diff_gain_a; /* see above */ |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2822 | s8 diff_gain_b; |
| 2823 | s8 diff_gain_c; |
| 2824 | u8 reserved1; |
| 2825 | } __attribute__ ((packed)); |
| 2826 | |
Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 2827 | /* Phy calibration command for 5000 series */ |
| 2828 | |
| 2829 | enum { |
| 2830 | IWL5000_PHY_CALIBRATE_DC_CMD = 8, |
| 2831 | IWL5000_PHY_CALIBRATE_LO_CMD = 9, |
| 2832 | IWL5000_PHY_CALIBRATE_RX_BB_CMD = 10, |
| 2833 | IWL5000_PHY_CALIBRATE_TX_IQ_CMD = 11, |
| 2834 | IWL5000_PHY_CALIBRATE_RX_IQ_CMD = 12, |
| 2835 | IWL5000_PHY_CALIBRATION_NOISE_CMD = 13, |
| 2836 | IWL5000_PHY_CALIBRATE_AGC_TABLE_CMD = 14, |
| 2837 | IWL5000_PHY_CALIBRATE_CRYSTAL_FRQ_CMD = 15, |
| 2838 | IWL5000_PHY_CALIBRATE_BASE_BAND_CMD = 16, |
Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 2839 | IWL5000_PHY_CALIBRATE_TX_IQ_PERD_CMD = 17, |
Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 2840 | IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD = 18, |
| 2841 | IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD = 19, |
| 2842 | }; |
| 2843 | |
Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 2844 | enum { |
| 2845 | CALIBRATION_CFG_CMD = 0x65, |
| 2846 | CALIBRATION_RES_NOTIFICATION = 0x66, |
| 2847 | CALIBRATION_COMPLETE_NOTIFICATION = 0x67 |
| 2848 | }; |
| 2849 | |
| 2850 | struct iwl_cal_crystal_freq_cmd { |
| 2851 | u8 cap_pin1; |
| 2852 | u8 cap_pin2; |
| 2853 | } __attribute__ ((packed)); |
| 2854 | |
| 2855 | struct iwl5000_calibration { |
| 2856 | u8 op_code; |
| 2857 | u8 first_group; |
| 2858 | u8 num_groups; |
| 2859 | u8 all_data_valid; |
| 2860 | struct iwl_cal_crystal_freq_cmd data; |
| 2861 | } __attribute__ ((packed)); |
| 2862 | |
| 2863 | #define IWL_CALIB_INIT_CFG_ALL __constant_cpu_to_le32(0xffffffff) |
| 2864 | |
| 2865 | struct iwl_calib_cfg_elmnt_s { |
| 2866 | __le32 is_enable; |
| 2867 | __le32 start; |
| 2868 | __le32 send_res; |
| 2869 | __le32 apply_res; |
| 2870 | __le32 reserved; |
| 2871 | } __attribute__ ((packed)); |
| 2872 | |
| 2873 | struct iwl_calib_cfg_status_s { |
| 2874 | struct iwl_calib_cfg_elmnt_s once; |
| 2875 | struct iwl_calib_cfg_elmnt_s perd; |
| 2876 | __le32 flags; |
| 2877 | } __attribute__ ((packed)); |
| 2878 | |
| 2879 | struct iwl5000_calib_cfg_cmd { |
| 2880 | struct iwl_calib_cfg_status_s ucd_calib_cfg; |
| 2881 | struct iwl_calib_cfg_status_s drv_calib_cfg; |
| 2882 | __le32 reserved1; |
| 2883 | } __attribute__ ((packed)); |
| 2884 | |
| 2885 | struct iwl5000_calib_hdr { |
| 2886 | u8 op_code; |
| 2887 | u8 first_group; |
| 2888 | u8 groups_num; |
| 2889 | u8 data_valid; |
| 2890 | } __attribute__ ((packed)); |
| 2891 | |
Emmanuel Grumbach | 33fd503 | 2008-04-24 11:55:30 -0700 | [diff] [blame] | 2892 | struct iwl5000_calibration_chain_noise_reset_cmd { |
| 2893 | u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_RESET_CMD */ |
| 2894 | u8 flags; /* not used */ |
| 2895 | __le16 reserved; |
| 2896 | } __attribute__ ((packed)); |
| 2897 | |
| 2898 | struct iwl5000_calibration_chain_noise_gain_cmd { |
| 2899 | u8 op_code; /* IWL5000_PHY_CALIBRATE_CHAIN_NOISE_GAIN_CMD */ |
| 2900 | u8 flags; /* not used */ |
| 2901 | __le16 reserved; |
| 2902 | u8 delta_gain_1; |
| 2903 | u8 delta_gain_2; |
| 2904 | __le16 reserved1; |
| 2905 | } __attribute__ ((packed)); |
| 2906 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2907 | /****************************************************************************** |
| 2908 | * (12) |
| 2909 | * Miscellaneous Commands: |
| 2910 | * |
| 2911 | *****************************************************************************/ |
| 2912 | |
| 2913 | /* |
| 2914 | * LEDs Command & Response |
| 2915 | * REPLY_LEDS_CMD = 0x48 (command, has simple generic response) |
| 2916 | * |
| 2917 | * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field), |
| 2918 | * this command turns it on or off, or sets up a periodic blinking cycle. |
| 2919 | */ |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2920 | struct iwl4965_led_cmd { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2921 | __le32 interval; /* "interval" in uSec */ |
| 2922 | u8 id; /* 1: Activity, 2: Link, 3: Tech */ |
| 2923 | u8 off; /* # intervals off while blinking; |
| 2924 | * "0", with >0 "on" value, turns LED on */ |
| 2925 | u8 on; /* # intervals on while blinking; |
| 2926 | * "0", regardless of "off", turns LED off */ |
| 2927 | u8 reserved; |
| 2928 | } __attribute__ ((packed)); |
| 2929 | |
Ron Rindjunsky | 9636e58 | 2008-05-15 13:54:14 +0800 | [diff] [blame] | 2930 | /* |
| 2931 | * Coexistence WIFI/WIMAX Command |
| 2932 | * COEX_PRIORITY_TABLE_CMD = 0x5a |
| 2933 | * |
| 2934 | */ |
| 2935 | enum { |
| 2936 | COEX_UNASSOC_IDLE = 0, |
| 2937 | COEX_UNASSOC_MANUAL_SCAN = 1, |
| 2938 | COEX_UNASSOC_AUTO_SCAN = 2, |
| 2939 | COEX_CALIBRATION = 3, |
| 2940 | COEX_PERIODIC_CALIBRATION = 4, |
| 2941 | COEX_CONNECTION_ESTAB = 5, |
| 2942 | COEX_ASSOCIATED_IDLE = 6, |
| 2943 | COEX_ASSOC_MANUAL_SCAN = 7, |
| 2944 | COEX_ASSOC_AUTO_SCAN = 8, |
| 2945 | COEX_ASSOC_ACTIVE_LEVEL = 9, |
| 2946 | COEX_RF_ON = 10, |
| 2947 | COEX_RF_OFF = 11, |
| 2948 | COEX_STAND_ALONE_DEBUG = 12, |
| 2949 | COEX_IPAN_ASSOC_LEVEL = 13, |
| 2950 | COEX_RSRVD1 = 14, |
| 2951 | COEX_RSRVD2 = 15, |
| 2952 | COEX_NUM_OF_EVENTS = 16 |
| 2953 | }; |
| 2954 | |
| 2955 | struct iwl_wimax_coex_event_entry { |
| 2956 | u8 request_prio; |
| 2957 | u8 win_medium_prio; |
| 2958 | u8 reserved; |
| 2959 | u8 flags; |
| 2960 | } __attribute__ ((packed)); |
| 2961 | |
| 2962 | /* COEX flag masks */ |
| 2963 | |
| 2964 | /* Staion table is valid */ |
| 2965 | #define COEX_FLAGS_STA_TABLE_VALID_MSK (0x1) |
| 2966 | /* UnMask wakeup src at unassociated sleep */ |
| 2967 | #define COEX_FLAGS_UNASSOC_WA_UNMASK_MSK (0x4) |
| 2968 | /* UnMask wakeup src at associated sleep */ |
| 2969 | #define COEX_FLAGS_ASSOC_WA_UNMASK_MSK (0x8) |
| 2970 | /* Enable CoEx feature. */ |
| 2971 | #define COEX_FLAGS_COEX_ENABLE_MSK (0x80) |
| 2972 | |
| 2973 | struct iwl_wimax_coex_cmd { |
| 2974 | u8 flags; |
| 2975 | u8 reserved[3]; |
| 2976 | struct iwl_wimax_coex_event_entry sta_prio[COEX_NUM_OF_EVENTS]; |
| 2977 | } __attribute__ ((packed)); |
| 2978 | |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2979 | /****************************************************************************** |
| 2980 | * (13) |
| 2981 | * Union of all expected notifications/responses: |
| 2982 | * |
| 2983 | *****************************************************************************/ |
| 2984 | |
Tomas Winkler | db11d63 | 2008-05-05 10:22:33 +0800 | [diff] [blame] | 2985 | struct iwl_rx_packet { |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2986 | __le32 len; |
Tomas Winkler | 857485c | 2008-03-21 13:53:44 -0700 | [diff] [blame] | 2987 | struct iwl_cmd_header hdr; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 2988 | union { |
Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 2989 | struct iwl_alive_resp alive_frame; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2990 | struct iwl4965_rx_frame rx_frame; |
| 2991 | struct iwl4965_tx_resp tx_resp; |
| 2992 | struct iwl4965_spectrum_notification spectrum_notif; |
| 2993 | struct iwl4965_csa_notification csa_notif; |
Tomas Winkler | 885ba20 | 2008-05-29 16:34:55 +0800 | [diff] [blame] | 2994 | struct iwl_error_resp err_resp; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2995 | struct iwl4965_card_state_notif card_state_notif; |
| 2996 | struct iwl4965_beacon_notif beacon_status; |
Tomas Winkler | 7a999bf | 2008-05-29 16:35:02 +0800 | [diff] [blame] | 2997 | struct iwl_add_sta_resp add_sta; |
| 2998 | struct iwl_rem_sta_resp rem_sta; |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 2999 | struct iwl4965_sleep_notification sleep_notif; |
| 3000 | struct iwl4965_spectrum_resp spectrum; |
| 3001 | struct iwl4965_notif_statistics stats; |
| 3002 | struct iwl4965_compressed_ba_resp compressed_ba; |
| 3003 | struct iwl4965_missed_beacon_notif missed_beacon; |
Tomas Winkler | 7c616cb | 2008-05-29 16:35:05 +0800 | [diff] [blame] | 3004 | struct iwl5000_calibration calib; |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3005 | __le32 status; |
| 3006 | u8 raw[0]; |
| 3007 | } u; |
| 3008 | } __attribute__ ((packed)); |
| 3009 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 3010 | #define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl4965_rx_frame)) |
Zhu Yi | b481de9 | 2007-09-25 17:54:57 -0700 | [diff] [blame] | 3011 | |
Christoph Hellwig | bb8c093 | 2008-01-27 16:41:47 -0800 | [diff] [blame] | 3012 | #endif /* __iwl4965_commands_h__ */ |