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