aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-12-18 21:37:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:58:54 -0500
commit3d24a9f790c0e39cfdef1446c7100e89c542805c (patch)
treec439ca8d5141ae62fedb5437a5382a649d9ebe5e
parent28afaf9139ce9f1c26452f34808e322e8e868850 (diff)
iwlwifi: 3945 remove iwl-3945-commands.h
This patch remove iwl-3945-commands.h eliminating duplicated and moving all definitions to iwl-commands.h Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-commands.h769
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-led.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c15
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h448
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c64
7 files changed, 468 insertions, 835 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
deleted file mode 100644
index 42ef51f4d126..000000000000
--- a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
+++ /dev/null
@@ -1,769 +0,0 @@
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 - 2008 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 - 2008 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-3945-commands.h) only for uCode API definitions.
65 * Please use iwl-3945-hw.h for hardware-related definitions.
66 * Please use iwl-3945.h for driver implementation definitions.
67 */
68
69#ifndef __iwl_3945_commands_h__
70#define __iwl_3945_commands_h__
71
72/******************************************************************************
73 * (0)
74 * Commonly used structures and definitions:
75 * Command header, txpower
76 *
77 *****************************************************************************/
78/**
79 * struct iwl3945_tx_power
80 *
81 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
82 *
83 * Each entry contains two values:
84 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
85 * linear value that multiplies the output of the digital signal processor,
86 * before being sent to the analog radio.
87 * 2) Radio gain. This sets the analog gain of the radio Tx path.
88 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
89 *
90 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
91 */
92struct iwl3945_tx_power {
93 u8 tx_gain; /* gain for analog radio */
94 u8 dsp_atten; /* gain for DSP */
95} __attribute__ ((packed));
96
97/**
98 * struct iwl3945_power_per_rate
99 *
100 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
101 */
102struct iwl3945_power_per_rate {
103 u8 rate; /* plcp */
104 struct iwl3945_tx_power tpc;
105 u8 reserved;
106} __attribute__ ((packed));
107
108/******************************************************************************
109 * (0a)
110 * Alive and Error Commands & Responses:
111 *
112 *****************************************************************************/
113
114
115/*
116 * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
117 *
118 * uCode issues this "initialize alive" notification once the initialization
119 * uCode image has completed its work, and is ready to load the runtime image.
120 * This is the *first* "alive" notification that the driver will receive after
121 * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
122 *
123 * See comments documenting "BSM" (bootstrap state machine).
124 */
125struct iwl3945_init_alive_resp {
126 u8 ucode_minor;
127 u8 ucode_major;
128 __le16 reserved1;
129 u8 sw_rev[8];
130 u8 ver_type;
131 u8 ver_subtype; /* "9" for initialize alive */
132 __le16 reserved2;
133 __le32 log_event_table_ptr;
134 __le32 error_event_table_ptr;
135 __le32 timestamp;
136 __le32 is_valid;
137} __attribute__ ((packed));
138
139
140/**
141 * REPLY_ALIVE = 0x1 (response only, not a command)
142 *
143 * uCode issues this "alive" notification once the runtime image is ready
144 * to receive commands from the driver. This is the *second* "alive"
145 * notification that the driver will receive after rebooting uCode;
146 * this "alive" is indicated by subtype field != 9.
147 *
148 * See comments documenting "BSM" (bootstrap state machine).
149 *
150 * This response includes two pointers to structures within the device's
151 * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
152 *
153 * 1) log_event_table_ptr indicates base of the event log. This traces
154 * a 256-entry history of uCode execution within a circular buffer.
155 *
156 * 2) error_event_table_ptr indicates base of the error log. This contains
157 * information about any uCode error that occurs.
158 *
159 * The Linux driver can print both logs to the system log when a uCode error
160 * occurs.
161 */
162struct iwl3945_alive_resp {
163 u8 ucode_minor;
164 u8 ucode_major;
165 __le16 reserved1;
166 u8 sw_rev[8];
167 u8 ver_type;
168 u8 ver_subtype; /* not "9" for runtime alive */
169 __le16 reserved2;
170 __le32 log_event_table_ptr; /* SRAM address for event log */
171 __le32 error_event_table_ptr; /* SRAM address for error log */
172 __le32 timestamp;
173 __le32 is_valid;
174} __attribute__ ((packed));
175
176/******************************************************************************
177 * (1)
178 * RXON Commands & Responses:
179 *
180 *****************************************************************************/
181
182/**
183 * REPLY_RXON = 0x10 (command, has simple generic response)
184 *
185 * RXON tunes the radio tuner to a service channel, and sets up a number
186 * of parameters that are used primarily for Rx, but also for Tx operations.
187 *
188 * NOTE: When tuning to a new channel, driver must set the
189 * RXON_FILTER_ASSOC_MSK to 0. This will clear station-dependent
190 * info within the device, including the station tables, tx retry
191 * rate tables, and txpower tables. Driver must build a new station
192 * table and txpower table before transmitting anything on the RXON
193 * channel.
194 *
195 * NOTE: All RXONs wipe clean the internal txpower table. Driver must
196 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
197 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
198 */
199struct iwl3945_rxon_cmd {
200 u8 node_addr[6];
201 __le16 reserved1;
202 u8 bssid_addr[6];
203 __le16 reserved2;
204 u8 wlap_bssid_addr[6];
205 __le16 reserved3;
206 u8 dev_type;
207 u8 air_propagation;
208 __le16 reserved4;
209 u8 ofdm_basic_rates;
210 u8 cck_basic_rates;
211 __le16 assoc_id;
212 __le32 flags;
213 __le32 filter_flags;
214 __le16 channel;
215 __le16 reserved5;
216} __attribute__ ((packed));
217
218/*
219 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
220 */
221struct iwl3945_rxon_assoc_cmd {
222 __le32 flags;
223 __le32 filter_flags;
224 u8 ofdm_basic_rates;
225 u8 cck_basic_rates;
226 __le16 reserved;
227} __attribute__ ((packed));
228
229/*
230 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
231 */
232struct iwl3945_channel_switch_cmd {
233 u8 band;
234 u8 expect_beacon;
235 __le16 channel;
236 __le32 rxon_flags;
237 __le32 rxon_filter_flags;
238 __le32 switch_time;
239 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
240} __attribute__ ((packed));
241
242/******************************************************************************
243 * (3)
244 * Add/Modify Stations Commands & Responses:
245 *
246 *****************************************************************************/
247/*
248 * REPLY_ADD_STA = 0x18 (command)
249 *
250 * The device contains an internal table of per-station information,
251 * with info on security keys, aggregation parameters, and Tx rates for
252 * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
253 * 3945 uses REPLY_RATE_SCALE to set up rate tables).
254 *
255 * REPLY_ADD_STA sets up the table entry for one station, either creating
256 * a new entry, or modifying a pre-existing one.
257 *
258 * NOTE: RXON command (without "associated" bit set) wipes the station table
259 * clean. Moving into RF_KILL state does this also. Driver must set up
260 * new station table before transmitting anything on the RXON channel
261 * (except active scans or active measurements; those commands carry
262 * their own txpower/rate setup data).
263 *
264 * When getting started on a new channel, driver must set up the
265 * IWL_BROADCAST_ID entry (last entry in the table). For a client
266 * station in a BSS, once an AP is selected, driver sets up the AP STA
267 * in the IWL_AP_ID entry (1st entry in the table). BROADCAST and AP
268 * are all that are needed for a BSS client station. If the device is
269 * used as AP, or in an IBSS network, driver must set up station table
270 * entries for all STAs in network, starting with index IWL_STA_ID.
271 */
272struct iwl3945_addsta_cmd {
273 u8 mode; /* 1: modify existing, 0: add new station */
274 u8 reserved[3];
275 struct sta_id_modify sta;
276 struct iwl4965_keyinfo key;
277 __le32 station_flags; /* STA_FLG_* */
278 __le32 station_flags_msk; /* STA_FLG_* */
279
280 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
281 * corresponding to bit (e.g. bit 5 controls TID 5).
282 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
283 __le16 tid_disable_tx;
284
285 __le16 rate_n_flags;
286
287 /* TID for which to add block-ack support.
288 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
289 u8 add_immediate_ba_tid;
290
291 /* TID for which to remove block-ack support.
292 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
293 u8 remove_immediate_ba_tid;
294
295 /* Starting Sequence Number for added block-ack support.
296 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
297 __le16 add_immediate_ba_ssn;
298} __attribute__ ((packed));
299
300
301/******************************************************************************
302 * (4)
303 * Rx Responses:
304 *
305 *****************************************************************************/
306
307struct iwl3945_rx_frame_stats {
308 u8 phy_count;
309 u8 id;
310 u8 rssi;
311 u8 agc;
312 __le16 sig_avg;
313 __le16 noise_diff;
314 u8 payload[0];
315} __attribute__ ((packed));
316
317struct iwl3945_rx_frame_hdr {
318 __le16 channel;
319 __le16 phy_flags;
320 u8 reserved1;
321 u8 rate;
322 __le16 len;
323 u8 payload[0];
324} __attribute__ ((packed));
325
326
327
328struct iwl3945_rx_frame_end {
329 __le32 status;
330 __le64 timestamp;
331 __le32 beacon_timestamp;
332} __attribute__ ((packed));
333
334/*
335 * REPLY_3945_RX = 0x1b (response only, not a command)
336 *
337 * NOTE: DO NOT dereference from casts to this structure
338 * It is provided only for calculating minimum data set size.
339 * The actual offsets of the hdr and end are dynamic based on
340 * stats.phy_count
341 */
342struct iwl3945_rx_frame {
343 struct iwl3945_rx_frame_stats stats;
344 struct iwl3945_rx_frame_hdr hdr;
345 struct iwl3945_rx_frame_end end;
346} __attribute__ ((packed));
347
348/******************************************************************************
349 * (5)
350 * Tx Commands & Responses:
351 *
352 * Driver must place each REPLY_TX command into one of the prioritized Tx
353 * queues in host DRAM, shared between driver and device. When the device's
354 * Tx scheduler and uCode are preparing to transmit, the device pulls the
355 * Tx command over the PCI bus via one of the device's Tx DMA channels,
356 * to fill an internal FIFO from which data will be transmitted.
357 *
358 * uCode handles all timing and protocol related to control frames
359 * (RTS/CTS/ACK), based on flags in the Tx command.
360 *
361 * uCode handles retrying Tx when an ACK is expected but not received.
362 * This includes trying lower data rates than the one requested in the Tx
363 * command, as set up by the REPLY_RATE_SCALE (for 3945) or
364 * REPLY_TX_LINK_QUALITY_CMD (4965).
365 *
366 * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
367 * This command must be executed after every RXON command, before Tx can occur.
368 *****************************************************************************/
369
370/*
371 * REPLY_TX = 0x1c (command)
372 */
373struct iwl3945_tx_cmd {
374 /*
375 * MPDU byte count:
376 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
377 * + 8 byte IV for CCM or TKIP (not used for WEP)
378 * + Data payload
379 * + 8-byte MIC (not used for CCM/WEP)
380 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
381 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
382 * Range: 14-2342 bytes.
383 */
384 __le16 len;
385
386 /*
387 * MPDU or MSDU byte count for next frame.
388 * Used for fragmentation and bursting, but not 11n aggregation.
389 * Same as "len", but for next frame. Set to 0 if not applicable.
390 */
391 __le16 next_frame_len;
392
393 __le32 tx_flags; /* TX_CMD_FLG_* */
394
395 u8 rate;
396
397 /* Index of recipient station in uCode's station table */
398 u8 sta_id;
399 u8 tid_tspec;
400 u8 sec_ctl;
401 u8 key[16];
402 union {
403 u8 byte[8];
404 __le16 word[4];
405 __le32 dw[2];
406 } tkip_mic;
407 __le32 next_frame_info;
408 union {
409 __le32 life_time;
410 __le32 attempt;
411 } stop_time;
412 u8 supp_rates[2];
413 u8 rts_retry_limit; /*byte 50 */
414 u8 data_retry_limit; /*byte 51 */
415 union {
416 __le16 pm_frame_timeout;
417 __le16 attempt_duration;
418 } timeout;
419
420 /*
421 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
422 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
423 */
424 __le16 driver_txop;
425
426 /*
427 * MAC header goes here, followed by 2 bytes padding if MAC header
428 * length is 26 or 30 bytes, followed by payload data
429 */
430 u8 payload[0];
431 struct ieee80211_hdr hdr[0];
432} __attribute__ ((packed));
433
434/*
435 * REPLY_TX = 0x1c (response)
436 */
437struct iwl3945_tx_resp {
438 u8 failure_rts;
439 u8 failure_frame;
440 u8 bt_kill_count;
441 u8 rate;
442 __le32 wireless_media_time;
443 __le32 status; /* TX status */
444} __attribute__ ((packed));
445
446/*
447 * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
448 */
449struct iwl3945_txpowertable_cmd {
450 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
451 u8 reserved;
452 __le16 channel;
453 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
454} __attribute__ ((packed));
455
456struct iwl3945_rate_scaling_info {
457 __le16 rate_n_flags;
458 u8 try_cnt;
459 u8 next_rate_index;
460} __attribute__ ((packed));
461
462/**
463 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
464 *
465 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
466 *
467 * NOTE: The table of rates passed to the uCode via the
468 * RATE_SCALE command sets up the corresponding order of
469 * rates used for all related commands, including rate
470 * masks, etc.
471 *
472 * For example, if you set 9MB (PLCP 0x0f) as the first
473 * rate in the rate table, the bit mask for that rate
474 * when passed through ofdm_basic_rates on the REPLY_RXON
475 * command would be bit 0 (1 << 0)
476 */
477struct iwl3945_rate_scaling_cmd {
478 u8 table_id;
479 u8 reserved[3];
480 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
481} __attribute__ ((packed));
482
483/******************************************************************************
484 * (8)
485 * Scan Commands, Responses, Notifications:
486 *
487 *****************************************************************************/
488
489/**
490 * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
491 *
492 * One for each channel in the scan list.
493 * Each channel can independently select:
494 * 1) SSID for directed active scans
495 * 2) Txpower setting (for rate specified within Tx command)
496 * 3) How long to stay on-channel (behavior may be modified by quiet_time,
497 * quiet_plcp_th, good_CRC_th)
498 *
499 * To avoid uCode errors, make sure the following are true (see comments
500 * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
501 * 1) If using passive_dwell (i.e. passive_dwell != 0):
502 * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
503 * 2) quiet_time <= active_dwell
504 * 3) If restricting off-channel time (i.e. max_out_time !=0):
505 * passive_dwell < max_out_time
506 * active_dwell < max_out_time
507 */
508struct iwl3945_scan_channel {
509 /*
510 * type is defined as:
511 * 0:0 1 = active, 0 = passive
512 * 1:4 SSID direct bit map; if a bit is set, then corresponding
513 * SSID IE is transmitted in probe request.
514 * 5:7 reserved
515 */
516 u8 type;
517 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
518 struct iwl3945_tx_power tpc;
519 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
520 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
521} __attribute__ ((packed));
522
523
524/*
525 * REPLY_SCAN_CMD = 0x80 (command)
526 *
527 * The hardware scan command is very powerful; the driver can set it up to
528 * maintain (relatively) normal network traffic while doing a scan in the
529 * background. The max_out_time and suspend_time control the ratio of how
530 * long the device stays on an associated network channel ("service channel")
531 * vs. how long it's away from the service channel, tuned to other channels
532 * for scanning.
533 *
534 * max_out_time is the max time off-channel (in usec), and suspend_time
535 * is how long (in "extended beacon" format) that the scan is "suspended"
536 * after returning to the service channel. That is, suspend_time is the
537 * time that we stay on the service channel, doing normal work, between
538 * scan segments. The driver may set these parameters differently to support
539 * scanning when associated vs. not associated, and light vs. heavy traffic
540 * loads when associated.
541 *
542 * After receiving this command, the device's scan engine does the following;
543 *
544 * 1) Sends SCAN_START notification to driver
545 * 2) Checks to see if it has time to do scan for one channel
546 * 3) Sends NULL packet, with power-save (PS) bit set to 1,
547 * to tell AP that we're going off-channel
548 * 4) Tunes to first channel in scan list, does active or passive scan
549 * 5) Sends SCAN_RESULT notification to driver
550 * 6) Checks to see if it has time to do scan on *next* channel in list
551 * 7) Repeats 4-6 until it no longer has time to scan the next channel
552 * before max_out_time expires
553 * 8) Returns to service channel
554 * 9) Sends NULL packet with PS=0 to tell AP that we're back
555 * 10) Stays on service channel until suspend_time expires
556 * 11) Repeats entire process 2-10 until list is complete
557 * 12) Sends SCAN_COMPLETE notification
558 *
559 * For fast, efficient scans, the scan command also has support for staying on
560 * a channel for just a short time, if doing active scanning and getting no
561 * responses to the transmitted probe request. This time is controlled by
562 * quiet_time, and the number of received packets below which a channel is
563 * considered "quiet" is controlled by quiet_plcp_threshold.
564 *
565 * For active scanning on channels that have regulatory restrictions against
566 * blindly transmitting, the scan can listen before transmitting, to make sure
567 * that there is already legitimate activity on the channel. If enough
568 * packets are cleanly received on the channel (controlled by good_CRC_th,
569 * typical value 1), the scan engine starts transmitting probe requests.
570 *
571 * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
572 *
573 * To avoid uCode errors, see timing restrictions described under
574 * struct iwl3945_scan_channel.
575 */
576struct iwl3945_scan_cmd {
577 __le16 len;
578 u8 reserved0;
579 u8 channel_count; /* # channels in channel list */
580 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
581 * (only for active scan) */
582 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
583 __le16 good_CRC_th; /* passive -> active promotion threshold */
584 __le16 reserved1;
585 __le32 max_out_time; /* max usec to be away from associated (service)
586 * channel */
587 __le32 suspend_time; /* pause scan this long (in "extended beacon
588 * format") when returning to service channel:
589 * 3945; 31:24 # beacons, 19:0 additional usec,
590 * 4965; 31:22 # beacons, 21:0 additional usec.
591 */
592 __le32 flags; /* RXON_FLG_* */
593 __le32 filter_flags; /* RXON_FILTER_* */
594
595 /* For active scans (set to all-0s for passive scans).
596 * Does not include payload. Must specify Tx rate; no rate scaling. */
597 struct iwl3945_tx_cmd tx_cmd;
598
599 /* For directed active scans (set to all-0s otherwise) */
600 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
601
602 /*
603 * Probe request frame, followed by channel list.
604 *
605 * Size of probe request frame is specified by byte count in tx_cmd.
606 * Channel list follows immediately after probe request frame.
607 * Number of channels in list is specified by channel_count.
608 * Each channel in list is of type:
609 *
610 * struct iwl3945_scan_channel channels[0];
611 *
612 * NOTE: Only one band of channels can be scanned per pass. You
613 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
614 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
615 * before requesting another scan.
616 */
617 u8 data[0];
618} __attribute__ ((packed));
619
620/******************************************************************************
621 * (9)
622 * IBSS/AP Commands and Notifications:
623 *
624 *****************************************************************************/
625
626/*
627 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
628 */
629struct iwl3945_beacon_notif {
630 struct iwl3945_tx_resp beacon_notify_hdr;
631 __le32 low_tsf;
632 __le32 high_tsf;
633 __le32 ibss_mgr_status;
634} __attribute__ ((packed));
635
636/*
637 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
638 */
639struct iwl3945_tx_beacon_cmd {
640 struct iwl3945_tx_cmd tx;
641 __le16 tim_idx;
642 u8 tim_size;
643 u8 reserved1;
644 struct ieee80211_hdr frame[0]; /* beacon frame */
645} __attribute__ ((packed));
646
647/******************************************************************************
648 * (10)
649 * Statistics Commands and Notifications:
650 *
651 *****************************************************************************/
652
653struct iwl39_statistics_rx_phy {
654 __le32 ina_cnt;
655 __le32 fina_cnt;
656 __le32 plcp_err;
657 __le32 crc32_err;
658 __le32 overrun_err;
659 __le32 early_overrun_err;
660 __le32 crc32_good;
661 __le32 false_alarm_cnt;
662 __le32 fina_sync_err_cnt;
663 __le32 sfd_timeout;
664 __le32 fina_timeout;
665 __le32 unresponded_rts;
666 __le32 rxe_frame_limit_overrun;
667 __le32 sent_ack_cnt;
668 __le32 sent_cts_cnt;
669} __attribute__ ((packed));
670
671struct iwl39_statistics_rx_non_phy {
672 __le32 bogus_cts; /* CTS received when not expecting CTS */
673 __le32 bogus_ack; /* ACK received when not expecting ACK */
674 __le32 non_bssid_frames; /* number of frames with BSSID that
675 * doesn't belong to the STA BSSID */
676 __le32 filtered_frames; /* count frames that were dumped in the
677 * filtering process */
678 __le32 non_channel_beacons; /* beacons with our bss id but not on
679 * our serving channel */
680} __attribute__ ((packed));
681
682struct iwl39_statistics_rx {
683 struct iwl39_statistics_rx_phy ofdm;
684 struct iwl39_statistics_rx_phy cck;
685 struct iwl39_statistics_rx_non_phy general;
686} __attribute__ ((packed));
687
688struct iwl39_statistics_tx {
689 __le32 preamble_cnt;
690 __le32 rx_detected_cnt;
691 __le32 bt_prio_defer_cnt;
692 __le32 bt_prio_kill_cnt;
693 __le32 few_bytes_cnt;
694 __le32 cts_timeout;
695 __le32 ack_timeout;
696 __le32 expected_ack_cnt;
697 __le32 actual_ack_cnt;
698} __attribute__ ((packed));
699
700struct iwl39_statistics_div {
701 __le32 tx_on_a;
702 __le32 tx_on_b;
703 __le32 exec_time;
704 __le32 probe_time;
705} __attribute__ ((packed));
706
707struct iwl39_statistics_general {
708 __le32 temperature;
709 struct statistics_dbg dbg;
710 __le32 sleep_time;
711 __le32 slots_out;
712 __le32 slots_idle;
713 __le32 ttl_timestamp;
714 struct iwl39_statistics_div div;
715} __attribute__ ((packed));
716
717/*
718 * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
719 *
720 * By default, uCode issues this notification after receiving a beacon
721 * while associated. To disable this behavior, set DISABLE_NOTIF flag in the
722 * REPLY_STATISTICS_CMD 0x9c, above.
723 *
724 * Statistics counters continue to increment beacon after beacon, but are
725 * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
726 * 0x9c with CLEAR_STATS bit set (see above).
727 *
728 * uCode also issues this notification during scans. uCode clears statistics
729 * appropriately so that each notification contains statistics for only the
730 * one channel that has just been scanned.
731 */
732struct iwl3945_notif_statistics {
733 __le32 flag;
734 struct statistics_rx rx;
735 struct statistics_tx tx;
736 struct statistics_general general;
737} __attribute__ ((packed));
738
739
740/******************************************************************************
741 * (13)
742 * Union of all expected notifications/responses:
743 *
744 *****************************************************************************/
745
746struct iwl3945_rx_packet {
747 __le32 len;
748 struct iwl_cmd_header hdr;
749 union {
750 struct iwl3945_alive_resp alive_frame;
751 struct iwl3945_rx_frame rx_frame;
752 struct iwl3945_tx_resp tx_resp;
753 struct iwl_spectrum_notification spectrum_notif;
754 struct iwl_csa_notification csa_notif;
755 struct iwl_error_resp err_resp;
756 struct iwl_card_state_notif card_state_notif;
757 struct iwl3945_beacon_notif beacon_status;
758 struct iwl_add_sta_resp add_sta;
759 struct iwl_sleep_notification sleep_notif;
760 struct iwl_spectrum_resp spectrum;
761 struct iwl3945_notif_statistics stats;
762 __le32 status;
763 u8 raw[0];
764 } u;
765} __attribute__ ((packed));
766
767#define IWL_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
768
769#endif /* __iwl3945_3945_commands_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-led.c b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
index b34bef4891b8..32d09ba3e694 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-led.c
@@ -39,7 +39,6 @@
39#include <asm/unaligned.h> 39#include <asm/unaligned.h>
40 40
41#include "iwl-commands.h" 41#include "iwl-commands.h"
42#include "iwl-3945-commands.h"
43#include "iwl-3945.h" 42#include "iwl-3945.h"
44 43
45 44
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 2da42b89540a..9d63cdb5ea0f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -37,7 +37,6 @@
37#include <linux/workqueue.h> 37#include <linux/workqueue.h>
38 38
39#include "iwl-commands.h" 39#include "iwl-commands.h"
40#include "iwl-3945-commands.h"
41#include "iwl-3945.h" 40#include "iwl-3945.h"
42 41
43#define RS_NAME "iwl-3945-rs" 42#define RS_NAME "iwl-3945-rs"
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 11e047de6cc9..080f1a856325 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -41,7 +41,6 @@
41#include "iwl-3945-core.h" 41#include "iwl-3945-core.h"
42#include "iwl-3945-fh.h" 42#include "iwl-3945-fh.h"
43#include "iwl-commands.h" 43#include "iwl-commands.h"
44#include "iwl-3945-commands.h"
45#include "iwl-3945.h" 44#include "iwl-3945.h"
46#include "iwl-helpers.h" 45#include "iwl-helpers.h"
47#include "iwl-3945-rs.h" 46#include "iwl-3945-rs.h"
@@ -333,7 +332,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv,
333static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv, 332static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
334 struct iwl3945_rx_mem_buffer *rxb) 333 struct iwl3945_rx_mem_buffer *rxb)
335{ 334{
336 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 335 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
337 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 336 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
338 int txq_id = SEQ_TO_QUEUE(sequence); 337 int txq_id = SEQ_TO_QUEUE(sequence);
339 int index = SEQ_TO_INDEX(sequence); 338 int index = SEQ_TO_INDEX(sequence);
@@ -392,7 +391,7 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
392 391
393void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) 392void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
394{ 393{
395 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 394 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
396 IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n", 395 IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n",
397 (int)sizeof(struct iwl3945_notif_statistics), 396 (int)sizeof(struct iwl3945_notif_statistics),
398 le32_to_cpu(pkt->len)); 397 le32_to_cpu(pkt->len));
@@ -419,7 +418,7 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b
419 * group100 parameter selects whether to show 1 out of 100 good frames. 418 * group100 parameter selects whether to show 1 out of 100 good frames.
420 */ 419 */
421static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, 420static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
422 struct iwl3945_rx_packet *pkt, 421 struct iwl_rx_packet *pkt,
423 struct ieee80211_hdr *header, int group100) 422 struct ieee80211_hdr *header, int group100)
424{ 423{
425 u32 to_us; 424 u32 to_us;
@@ -547,7 +546,7 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
547} 546}
548#else 547#else
549static inline void iwl3945_dbg_report_frame(struct iwl3945_priv *priv, 548static inline void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
550 struct iwl3945_rx_packet *pkt, 549 struct iwl_rx_packet *pkt,
551 struct ieee80211_hdr *header, int group100) 550 struct ieee80211_hdr *header, int group100)
552{ 551{
553} 552}
@@ -575,7 +574,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
575 struct iwl3945_rx_mem_buffer *rxb, 574 struct iwl3945_rx_mem_buffer *rxb,
576 struct ieee80211_rx_status *stats) 575 struct ieee80211_rx_status *stats)
577{ 576{
578 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; 577 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
579#ifdef CONFIG_IWL3945_LEDS 578#ifdef CONFIG_IWL3945_LEDS
580 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt); 579 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
581#endif 580#endif
@@ -584,7 +583,7 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
584 short len = le16_to_cpu(rx_hdr->len); 583 short len = le16_to_cpu(rx_hdr->len);
585 584
586 /* We received data from the HW, so stop the watchdog */ 585 /* We received data from the HW, so stop the watchdog */
587 if (unlikely((len + IWL_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) { 586 if (unlikely((len + IWL39_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) {
588 IWL_DEBUG_DROP("Corruption detected!\n"); 587 IWL_DEBUG_DROP("Corruption detected!\n");
589 return; 588 return;
590 } 589 }
@@ -619,7 +618,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
619{ 618{
620 struct ieee80211_hdr *header; 619 struct ieee80211_hdr *header;
621 struct ieee80211_rx_status rx_status; 620 struct ieee80211_rx_status rx_status;
622 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 621 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
623 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt); 622 struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
624 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt); 623 struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
625 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt); 624 struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 12ead3887020..5d5176a62562 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -768,8 +768,9 @@ struct iwl3945_priv {
768 768
769 /* 1st responses from initialize and runtime uCode images. 769 /* 1st responses from initialize and runtime uCode images.
770 * 4965's initialize alive response contains some calibration data. */ 770 * 4965's initialize alive response contains some calibration data. */
771 struct iwl3945_init_alive_resp card_alive_init; 771 /* FIXME: 4965 uses bigger structure for init */
772 struct iwl3945_alive_resp card_alive; 772 struct iwl_alive_resp card_alive_init;
773 struct iwl_alive_resp card_alive;
773 774
774#ifdef CONFIG_IWL3945_RFKILL 775#ifdef CONFIG_IWL3945_RFKILL
775 struct rfkill *rfkill; 776 struct rfkill *rfkill;
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index 8b2d7012a2a0..958c4a70d515 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -225,6 +225,37 @@ struct iwl_cmd_header {
225 u8 data[0]; 225 u8 data[0];
226} __attribute__ ((packed)); 226} __attribute__ ((packed));
227 227
228
229/**
230 * struct iwl3945_tx_power
231 *
232 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
233 *
234 * Each entry contains two values:
235 * 1) DSP gain (or sometimes called DSP attenuation). This is a fine-grained
236 * linear value that multiplies the output of the digital signal processor,
237 * before being sent to the analog radio.
238 * 2) Radio gain. This sets the analog gain of the radio Tx path.
239 * It is a coarser setting, and behaves in a logarithmic (dB) fashion.
240 *
241 * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
242 */
243struct iwl3945_tx_power {
244 u8 tx_gain; /* gain for analog radio */
245 u8 dsp_atten; /* gain for DSP */
246} __attribute__ ((packed));
247
248/**
249 * struct iwl3945_power_per_rate
250 *
251 * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
252 */
253struct iwl3945_power_per_rate {
254 u8 rate; /* plcp */
255 struct iwl3945_tx_power tpc;
256 u8 reserved;
257} __attribute__ ((packed));
258
228/** 259/**
229 * iwlagn rate_n_flags bit fields 260 * iwlagn rate_n_flags bit fields
230 * 261 *
@@ -499,8 +530,6 @@ struct iwl_alive_resp {
499 __le32 is_valid; 530 __le32 is_valid;
500} __attribute__ ((packed)); 531} __attribute__ ((packed));
501 532
502
503
504/* 533/*
505 * REPLY_ERROR = 0x2 (response only, not a command) 534 * REPLY_ERROR = 0x2 (response only, not a command)
506 */ 535 */
@@ -618,6 +647,26 @@ enum {
618 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10), 647 * issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
619 * regardless of whether RXON_FILTER_ASSOC_MSK is set. 648 * regardless of whether RXON_FILTER_ASSOC_MSK is set.
620 */ 649 */
650
651struct iwl3945_rxon_cmd {
652 u8 node_addr[6];
653 __le16 reserved1;
654 u8 bssid_addr[6];
655 __le16 reserved2;
656 u8 wlap_bssid_addr[6];
657 __le16 reserved3;
658 u8 dev_type;
659 u8 air_propagation;
660 __le16 reserved4;
661 u8 ofdm_basic_rates;
662 u8 cck_basic_rates;
663 __le16 assoc_id;
664 __le32 flags;
665 __le32 filter_flags;
666 __le16 channel;
667 __le16 reserved5;
668} __attribute__ ((packed));
669
621struct iwl4965_rxon_cmd { 670struct iwl4965_rxon_cmd {
622 u8 node_addr[6]; 671 u8 node_addr[6];
623 __le16 reserved1; 672 __le16 reserved1;
@@ -663,33 +712,41 @@ struct iwl_rxon_cmd {
663 __le16 reserved6; 712 __le16 reserved6;
664} __attribute__ ((packed)); 713} __attribute__ ((packed));
665 714
666struct iwl5000_rxon_assoc_cmd { 715/*
716 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
717 */
718struct iwl3945_rxon_assoc_cmd {
719 __le32 flags;
720 __le32 filter_flags;
721 u8 ofdm_basic_rates;
722 u8 cck_basic_rates;
723 __le16 reserved;
724} __attribute__ ((packed));
725
726struct iwl4965_rxon_assoc_cmd {
667 __le32 flags; 727 __le32 flags;
668 __le32 filter_flags; 728 __le32 filter_flags;
669 u8 ofdm_basic_rates; 729 u8 ofdm_basic_rates;
670 u8 cck_basic_rates; 730 u8 cck_basic_rates;
671 __le16 reserved1;
672 u8 ofdm_ht_single_stream_basic_rates; 731 u8 ofdm_ht_single_stream_basic_rates;
673 u8 ofdm_ht_dual_stream_basic_rates; 732 u8 ofdm_ht_dual_stream_basic_rates;
674 u8 ofdm_ht_triple_stream_basic_rates;
675 u8 reserved2;
676 __le16 rx_chain_select_flags; 733 __le16 rx_chain_select_flags;
677 __le16 acquisition_data; 734 __le16 reserved;
678 __le32 reserved3;
679} __attribute__ ((packed)); 735} __attribute__ ((packed));
680 736
681/* 737struct iwl5000_rxon_assoc_cmd {
682 * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
683 */
684struct iwl4965_rxon_assoc_cmd {
685 __le32 flags; 738 __le32 flags;
686 __le32 filter_flags; 739 __le32 filter_flags;
687 u8 ofdm_basic_rates; 740 u8 ofdm_basic_rates;
688 u8 cck_basic_rates; 741 u8 cck_basic_rates;
742 __le16 reserved1;
689 u8 ofdm_ht_single_stream_basic_rates; 743 u8 ofdm_ht_single_stream_basic_rates;
690 u8 ofdm_ht_dual_stream_basic_rates; 744 u8 ofdm_ht_dual_stream_basic_rates;
745 u8 ofdm_ht_triple_stream_basic_rates;
746 u8 reserved2;
691 __le16 rx_chain_select_flags; 747 __le16 rx_chain_select_flags;
692 __le16 reserved; 748 __le16 acquisition_data;
749 __le32 reserved3;
693} __attribute__ ((packed)); 750} __attribute__ ((packed));
694 751
695#define IWL_CONN_MAX_LISTEN_INTERVAL 10 752#define IWL_CONN_MAX_LISTEN_INTERVAL 10
@@ -709,6 +766,16 @@ struct iwl_rxon_time_cmd {
709/* 766/*
710 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response) 767 * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
711 */ 768 */
769struct iwl3945_channel_switch_cmd {
770 u8 band;
771 u8 expect_beacon;
772 __le16 channel;
773 __le32 rxon_flags;
774 __le32 rxon_filter_flags;
775 __le32 switch_time;
776 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
777} __attribute__ ((packed));
778
712struct iwl_channel_switch_cmd { 779struct iwl_channel_switch_cmd {
713 u8 band; 780 u8 band;
714 u8 expect_beacon; 781 u8 expect_beacon;
@@ -912,6 +979,35 @@ struct sta_id_modify {
912 * used as AP, or in an IBSS network, driver must set up station table 979 * used as AP, or in an IBSS network, driver must set up station table
913 * entries for all STAs in network, starting with index IWL_STA_ID. 980 * entries for all STAs in network, starting with index IWL_STA_ID.
914 */ 981 */
982
983struct iwl3945_addsta_cmd {
984 u8 mode; /* 1: modify existing, 0: add new station */
985 u8 reserved[3];
986 struct sta_id_modify sta;
987 struct iwl4965_keyinfo key;
988 __le32 station_flags; /* STA_FLG_* */
989 __le32 station_flags_msk; /* STA_FLG_* */
990
991 /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
992 * corresponding to bit (e.g. bit 5 controls TID 5).
993 * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
994 __le16 tid_disable_tx;
995
996 __le16 rate_n_flags;
997
998 /* TID for which to add block-ack support.
999 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1000 u8 add_immediate_ba_tid;
1001
1002 /* TID for which to remove block-ack support.
1003 * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
1004 u8 remove_immediate_ba_tid;
1005
1006 /* Starting Sequence Number for added block-ack support.
1007 * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
1008 __le16 add_immediate_ba_ssn;
1009} __attribute__ ((packed));
1010
915struct iwl4965_addsta_cmd { 1011struct iwl4965_addsta_cmd {
916 u8 mode; /* 1: modify existing, 0: add new station */ 1012 u8 mode; /* 1: modify existing, 0: add new station */
917 u8 reserved[3]; 1013 u8 reserved[3];
@@ -1065,6 +1161,48 @@ struct iwl_wep_cmd {
1065#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7) 1161#define RX_MPDU_RES_STATUS_TTAK_OK (1 << 7)
1066#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800) 1162#define RX_MPDU_RES_STATUS_DEC_DONE_MSK (0x800)
1067 1163
1164
1165struct iwl3945_rx_frame_stats {
1166 u8 phy_count;
1167 u8 id;
1168 u8 rssi;
1169 u8 agc;
1170 __le16 sig_avg;
1171 __le16 noise_diff;
1172 u8 payload[0];
1173} __attribute__ ((packed));
1174
1175struct iwl3945_rx_frame_hdr {
1176 __le16 channel;
1177 __le16 phy_flags;
1178 u8 reserved1;
1179 u8 rate;
1180 __le16 len;
1181 u8 payload[0];
1182} __attribute__ ((packed));
1183
1184struct iwl3945_rx_frame_end {
1185 __le32 status;
1186 __le64 timestamp;
1187 __le32 beacon_timestamp;
1188} __attribute__ ((packed));
1189
1190/*
1191 * REPLY_3945_RX = 0x1b (response only, not a command)
1192 *
1193 * NOTE: DO NOT dereference from casts to this structure
1194 * It is provided only for calculating minimum data set size.
1195 * The actual offsets of the hdr and end are dynamic based on
1196 * stats.phy_count
1197 */
1198struct iwl3945_rx_frame {
1199 struct iwl3945_rx_frame_stats stats;
1200 struct iwl3945_rx_frame_hdr hdr;
1201 struct iwl3945_rx_frame_end end;
1202} __attribute__ ((packed));
1203
1204#define IWL39_RX_FRAME_SIZE (4 + sizeof(struct iwl3945_rx_frame))
1205
1068/* Fixed (non-configurable) rx data from phy */ 1206/* Fixed (non-configurable) rx data from phy */
1069 1207
1070#define IWL49_RX_RES_PHY_CNT 14 1208#define IWL49_RX_RES_PHY_CNT 14
@@ -1245,6 +1383,84 @@ struct iwl4965_rx_mpdu_res_start {
1245#define TKIP_ICV_LEN 4 1383#define TKIP_ICV_LEN 4
1246 1384
1247/* 1385/*
1386 * REPLY_TX = 0x1c (command)
1387 */
1388
1389struct iwl3945_tx_cmd {
1390 /*
1391 * MPDU byte count:
1392 * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
1393 * + 8 byte IV for CCM or TKIP (not used for WEP)
1394 * + Data payload
1395 * + 8-byte MIC (not used for CCM/WEP)
1396 * NOTE: Does not include Tx command bytes, post-MAC pad bytes,
1397 * MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
1398 * Range: 14-2342 bytes.
1399 */
1400 __le16 len;
1401
1402 /*
1403 * MPDU or MSDU byte count for next frame.
1404 * Used for fragmentation and bursting, but not 11n aggregation.
1405 * Same as "len", but for next frame. Set to 0 if not applicable.
1406 */
1407 __le16 next_frame_len;
1408
1409 __le32 tx_flags; /* TX_CMD_FLG_* */
1410
1411 u8 rate;
1412
1413 /* Index of recipient station in uCode's station table */
1414 u8 sta_id;
1415 u8 tid_tspec;
1416 u8 sec_ctl;
1417 u8 key[16];
1418 union {
1419 u8 byte[8];
1420 __le16 word[4];
1421 __le32 dw[2];
1422 } tkip_mic;
1423 __le32 next_frame_info;
1424 union {
1425 __le32 life_time;
1426 __le32 attempt;
1427 } stop_time;
1428 u8 supp_rates[2];
1429 u8 rts_retry_limit; /*byte 50 */
1430 u8 data_retry_limit; /*byte 51 */
1431 union {
1432 __le16 pm_frame_timeout;
1433 __le16 attempt_duration;
1434 } timeout;
1435
1436 /*
1437 * Duration of EDCA burst Tx Opportunity, in 32-usec units.
1438 * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
1439 */
1440 __le16 driver_txop;
1441
1442 /*
1443 * MAC header goes here, followed by 2 bytes padding if MAC header
1444 * length is 26 or 30 bytes, followed by payload data
1445 */
1446 u8 payload[0];
1447 struct ieee80211_hdr hdr[0];
1448} __attribute__ ((packed));
1449
1450/*
1451 * REPLY_TX = 0x1c (response)
1452 */
1453struct iwl3945_tx_resp {
1454 u8 failure_rts;
1455 u8 failure_frame;
1456 u8 bt_kill_count;
1457 u8 rate;
1458 __le32 wireless_media_time;
1459 __le32 status; /* TX status */
1460} __attribute__ ((packed));
1461
1462
1463/*
1248 * 4965 uCode updates these Tx attempt count values in host DRAM. 1464 * 4965 uCode updates these Tx attempt count values in host DRAM.
1249 * Used for managing Tx retries when expecting block-acks. 1465 * Used for managing Tx retries when expecting block-acks.
1250 * Driver should set these fields to 0. 1466 * Driver should set these fields to 0.
@@ -1255,9 +1471,6 @@ struct iwl_dram_scratch {
1255 __le16 reserved; 1471 __le16 reserved;
1256} __attribute__ ((packed)); 1472} __attribute__ ((packed));
1257 1473
1258/*
1259 * REPLY_TX = 0x1c (command)
1260 */
1261struct iwl_tx_cmd { 1474struct iwl_tx_cmd {
1262 /* 1475 /*
1263 * MPDU byte count: 1476 * MPDU byte count:
@@ -1595,6 +1808,14 @@ struct iwl_compressed_ba_resp {
1595 * 1808 *
1596 * See details under "TXPOWER" in iwl-4965-hw.h. 1809 * See details under "TXPOWER" in iwl-4965-hw.h.
1597 */ 1810 */
1811
1812struct iwl3945_txpowertable_cmd {
1813 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1814 u8 reserved;
1815 __le16 channel;
1816 struct iwl3945_power_per_rate power[IWL_MAX_RATES];
1817} __attribute__ ((packed));
1818
1598struct iwl4965_txpowertable_cmd { 1819struct iwl4965_txpowertable_cmd {
1599 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */ 1820 u8 band; /* 0: 5 GHz, 1: 2.4 GHz */
1600 u8 reserved; 1821 u8 reserved;
@@ -1602,6 +1823,35 @@ struct iwl4965_txpowertable_cmd {
1602 struct iwl4965_tx_power_db tx_power; 1823 struct iwl4965_tx_power_db tx_power;
1603} __attribute__ ((packed)); 1824} __attribute__ ((packed));
1604 1825
1826
1827/**
1828 * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
1829 *
1830 * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
1831 *
1832 * NOTE: The table of rates passed to the uCode via the
1833 * RATE_SCALE command sets up the corresponding order of
1834 * rates used for all related commands, including rate
1835 * masks, etc.
1836 *
1837 * For example, if you set 9MB (PLCP 0x0f) as the first
1838 * rate in the rate table, the bit mask for that rate
1839 * when passed through ofdm_basic_rates on the REPLY_RXON
1840 * command would be bit 0 (1 << 0)
1841 */
1842struct iwl3945_rate_scaling_info {
1843 __le16 rate_n_flags;
1844 u8 try_cnt;
1845 u8 next_rate_index;
1846} __attribute__ ((packed));
1847
1848struct iwl3945_rate_scaling_cmd {
1849 u8 table_id;
1850 u8 reserved[3];
1851 struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
1852} __attribute__ ((packed));
1853
1854
1605/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */ 1855/*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
1606#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0) 1856#define LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK (1 << 0)
1607 1857
@@ -2162,6 +2412,23 @@ struct iwl_ct_kill_config {
2162 * passive_dwell < max_out_time 2412 * passive_dwell < max_out_time
2163 * active_dwell < max_out_time 2413 * active_dwell < max_out_time
2164 */ 2414 */
2415
2416/* FIXME: rename to AP1, remove tpc */
2417struct iwl3945_scan_channel {
2418 /*
2419 * type is defined as:
2420 * 0:0 1 = active, 0 = passive
2421 * 1:4 SSID direct bit map; if a bit is set, then corresponding
2422 * SSID IE is transmitted in probe request.
2423 * 5:7 reserved
2424 */
2425 u8 type;
2426 u8 channel; /* band is selected by iwl3945_scan_cmd "flags" field */
2427 struct iwl3945_tx_power tpc;
2428 __le16 active_dwell; /* in 1024-uSec TU (time units), typ 5-50 */
2429 __le16 passive_dwell; /* in 1024-uSec TU (time units), typ 20-500 */
2430} __attribute__ ((packed));
2431
2165struct iwl_scan_channel { 2432struct iwl_scan_channel {
2166 /* 2433 /*
2167 * type is defined as: 2434 * type is defined as:
@@ -2249,6 +2516,51 @@ struct iwl_ssid_ie {
2249 * To avoid uCode errors, see timing restrictions described under 2516 * To avoid uCode errors, see timing restrictions described under
2250 * struct iwl_scan_channel. 2517 * struct iwl_scan_channel.
2251 */ 2518 */
2519
2520struct iwl3945_scan_cmd {
2521 __le16 len;
2522 u8 reserved0;
2523 u8 channel_count; /* # channels in channel list */
2524 __le16 quiet_time; /* dwell only this # millisecs on quiet channel
2525 * (only for active scan) */
2526 __le16 quiet_plcp_th; /* quiet chnl is < this # pkts (typ. 1) */
2527 __le16 good_CRC_th; /* passive -> active promotion threshold */
2528 __le16 reserved1;
2529 __le32 max_out_time; /* max usec to be away from associated (service)
2530 * channel */
2531 __le32 suspend_time; /* pause scan this long (in "extended beacon
2532 * format") when returning to service channel:
2533 * 3945; 31:24 # beacons, 19:0 additional usec,
2534 * 4965; 31:22 # beacons, 21:0 additional usec.
2535 */
2536 __le32 flags; /* RXON_FLG_* */
2537 __le32 filter_flags; /* RXON_FILTER_* */
2538
2539 /* For active scans (set to all-0s for passive scans).
2540 * Does not include payload. Must specify Tx rate; no rate scaling. */
2541 struct iwl3945_tx_cmd tx_cmd;
2542
2543 /* For directed active scans (set to all-0s otherwise) */
2544 struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
2545
2546 /*
2547 * Probe request frame, followed by channel list.
2548 *
2549 * Size of probe request frame is specified by byte count in tx_cmd.
2550 * Channel list follows immediately after probe request frame.
2551 * Number of channels in list is specified by channel_count.
2552 * Each channel in list is of type:
2553 *
2554 * struct iwl3945_scan_channel channels[0];
2555 *
2556 * NOTE: Only one band of channels can be scanned per pass. You
2557 * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
2558 * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
2559 * before requesting another scan.
2560 */
2561 u8 data[0];
2562} __attribute__ ((packed));
2563
2252struct iwl_scan_cmd { 2564struct iwl_scan_cmd {
2253 __le16 len; 2565 __le16 len;
2254 u8 reserved0; 2566 u8 reserved0;
@@ -2356,6 +2668,14 @@ struct iwl_scancomplete_notification {
2356/* 2668/*
2357 * BEACON_NOTIFICATION = 0x90 (notification only, not a command) 2669 * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
2358 */ 2670 */
2671
2672struct iwl3945_beacon_notif {
2673 struct iwl3945_tx_resp beacon_notify_hdr;
2674 __le32 low_tsf;
2675 __le32 high_tsf;
2676 __le32 ibss_mgr_status;
2677} __attribute__ ((packed));
2678
2359struct iwl4965_beacon_notif { 2679struct iwl4965_beacon_notif {
2360 struct iwl4965_tx_resp beacon_notify_hdr; 2680 struct iwl4965_tx_resp beacon_notify_hdr;
2361 __le32 low_tsf; 2681 __le32 low_tsf;
@@ -2366,6 +2686,15 @@ struct iwl4965_beacon_notif {
2366/* 2686/*
2367 * REPLY_TX_BEACON = 0x91 (command, has simple generic response) 2687 * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
2368 */ 2688 */
2689
2690struct iwl3945_tx_beacon_cmd {
2691 struct iwl3945_tx_cmd tx;
2692 __le16 tim_idx;
2693 u8 tim_size;
2694 u8 reserved1;
2695 struct ieee80211_hdr frame[0]; /* beacon frame */
2696} __attribute__ ((packed));
2697
2369struct iwl_tx_beacon_cmd { 2698struct iwl_tx_beacon_cmd {
2370 struct iwl_tx_cmd tx; 2699 struct iwl_tx_cmd tx;
2371 __le16 tim_idx; 2700 __le16 tim_idx;
@@ -2402,6 +2731,76 @@ struct rate_histogram {
2402 2731
2403/* statistics command response */ 2732/* statistics command response */
2404 2733
2734struct iwl39_statistics_rx_phy {
2735 __le32 ina_cnt;
2736 __le32 fina_cnt;
2737 __le32 plcp_err;
2738 __le32 crc32_err;
2739 __le32 overrun_err;
2740 __le32 early_overrun_err;
2741 __le32 crc32_good;
2742 __le32 false_alarm_cnt;
2743 __le32 fina_sync_err_cnt;
2744 __le32 sfd_timeout;
2745 __le32 fina_timeout;
2746 __le32 unresponded_rts;
2747 __le32 rxe_frame_limit_overrun;
2748 __le32 sent_ack_cnt;
2749 __le32 sent_cts_cnt;
2750} __attribute__ ((packed));
2751
2752struct iwl39_statistics_rx_non_phy {
2753 __le32 bogus_cts; /* CTS received when not expecting CTS */
2754 __le32 bogus_ack; /* ACK received when not expecting ACK */
2755 __le32 non_bssid_frames; /* number of frames with BSSID that
2756 * doesn't belong to the STA BSSID */
2757 __le32 filtered_frames; /* count frames that were dumped in the
2758 * filtering process */
2759 __le32 non_channel_beacons; /* beacons with our bss id but not on
2760 * our serving channel */
2761} __attribute__ ((packed));
2762
2763struct iwl39_statistics_rx {
2764 struct iwl39_statistics_rx_phy ofdm;
2765 struct iwl39_statistics_rx_phy cck;
2766 struct iwl39_statistics_rx_non_phy general;
2767} __attribute__ ((packed));
2768
2769struct iwl39_statistics_tx {
2770 __le32 preamble_cnt;
2771 __le32 rx_detected_cnt;
2772 __le32 bt_prio_defer_cnt;
2773 __le32 bt_prio_kill_cnt;
2774 __le32 few_bytes_cnt;
2775 __le32 cts_timeout;
2776 __le32 ack_timeout;
2777 __le32 expected_ack_cnt;
2778 __le32 actual_ack_cnt;
2779} __attribute__ ((packed));
2780
2781struct statistics_dbg {
2782 __le32 burst_check;
2783 __le32 burst_count;
2784 __le32 reserved[4];
2785} __attribute__ ((packed));
2786
2787struct iwl39_statistics_div {
2788 __le32 tx_on_a;
2789 __le32 tx_on_b;
2790 __le32 exec_time;
2791 __le32 probe_time;
2792} __attribute__ ((packed));
2793
2794struct iwl39_statistics_general {
2795 __le32 temperature;
2796 struct statistics_dbg dbg;
2797 __le32 sleep_time;
2798 __le32 slots_out;
2799 __le32 slots_idle;
2800 __le32 ttl_timestamp;
2801 struct iwl39_statistics_div div;
2802} __attribute__ ((packed));
2803
2405struct statistics_rx_phy { 2804struct statistics_rx_phy {
2406 __le32 ina_cnt; 2805 __le32 ina_cnt;
2407 __le32 fina_cnt; 2806 __le32 fina_cnt;
@@ -2513,11 +2912,6 @@ struct statistics_tx {
2513 struct statistics_tx_non_phy_agg agg; 2912 struct statistics_tx_non_phy_agg agg;
2514} __attribute__ ((packed)); 2913} __attribute__ ((packed));
2515 2914
2516struct statistics_dbg {
2517 __le32 burst_check;
2518 __le32 burst_count;
2519 __le32 reserved[4];
2520} __attribute__ ((packed));
2521 2915
2522struct statistics_div { 2916struct statistics_div {
2523 __le32 tx_on_a; 2917 __le32 tx_on_a;
@@ -2581,6 +2975,14 @@ struct iwl_statistics_cmd {
2581 */ 2975 */
2582#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2) 2976#define STATISTICS_REPLY_FLG_BAND_24G_MSK cpu_to_le32(0x2)
2583#define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8) 2977#define STATISTICS_REPLY_FLG_FAT_MODE_MSK cpu_to_le32(0x8)
2978
2979struct iwl3945_notif_statistics {
2980 __le32 flag;
2981 struct iwl39_statistics_rx rx;
2982 struct iwl39_statistics_tx tx;
2983 struct iwl39_statistics_general general;
2984} __attribute__ ((packed));
2985
2584struct iwl_notif_statistics { 2986struct iwl_notif_statistics {
2585 __le32 flag; 2987 __le32 flag;
2586 struct statistics_rx rx; 2988 struct statistics_rx rx;
@@ -3032,6 +3434,10 @@ struct iwl_rx_packet {
3032 __le32 len; 3434 __le32 len;
3033 struct iwl_cmd_header hdr; 3435 struct iwl_cmd_header hdr;
3034 union { 3436 union {
3437 struct iwl3945_rx_frame rx_frame;
3438 struct iwl3945_tx_resp tx_resp;
3439 struct iwl3945_beacon_notif beacon_status;
3440
3035 struct iwl_alive_resp alive_frame; 3441 struct iwl_alive_resp alive_frame;
3036 struct iwl_spectrum_notification spectrum_notif; 3442 struct iwl_spectrum_notification spectrum_notif;
3037 struct iwl_csa_notification csa_notif; 3443 struct iwl_csa_notification csa_notif;
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 621e0877ca28..3d8669c6cc83 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -48,7 +48,6 @@
48 48
49#include "iwl-3945-core.h" 49#include "iwl-3945-core.h"
50#include "iwl-commands.h" 50#include "iwl-commands.h"
51#include "iwl-3945-commands.h"
52#include "iwl-3945.h" 51#include "iwl-3945.h"
53#include "iwl-3945-fh.h" 52#include "iwl-3945-fh.h"
54#include "iwl-helpers.h" 53#include "iwl-helpers.h"
@@ -970,7 +969,7 @@ static int iwl3945_full_rxon_required(struct iwl3945_priv *priv)
970static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv) 969static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
971{ 970{
972 int rc = 0; 971 int rc = 0;
973 struct iwl3945_rx_packet *res = NULL; 972 struct iwl_rx_packet *res = NULL;
974 struct iwl3945_rxon_assoc_cmd rxon_assoc; 973 struct iwl3945_rxon_assoc_cmd rxon_assoc;
975 struct iwl3945_host_cmd cmd = { 974 struct iwl3945_host_cmd cmd = {
976 .id = REPLY_RXON_ASSOC, 975 .id = REPLY_RXON_ASSOC,
@@ -999,7 +998,7 @@ static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
999 if (rc) 998 if (rc)
1000 return rc; 999 return rc;
1001 1000
1002 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; 1001 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
1003 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1002 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1004 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n"); 1003 IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
1005 rc = -EIO; 1004 rc = -EIO;
@@ -1154,7 +1153,7 @@ static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
1154static int iwl3945_send_scan_abort(struct iwl3945_priv *priv) 1153static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
1155{ 1154{
1156 int rc = 0; 1155 int rc = 0;
1157 struct iwl3945_rx_packet *res; 1156 struct iwl_rx_packet *res;
1158 struct iwl3945_host_cmd cmd = { 1157 struct iwl3945_host_cmd cmd = {
1159 .id = REPLY_SCAN_ABORT_CMD, 1158 .id = REPLY_SCAN_ABORT_CMD,
1160 .meta.flags = CMD_WANT_SKB, 1159 .meta.flags = CMD_WANT_SKB,
@@ -1174,7 +1173,7 @@ static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
1174 return rc; 1173 return rc;
1175 } 1174 }
1176 1175
1177 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; 1176 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
1178 if (res->u.status != CAN_ABORT_STATUS) { 1177 if (res->u.status != CAN_ABORT_STATUS) {
1179 /* The scan abort will return 1 for success or 1178 /* The scan abort will return 1 for success or
1180 * 2 for "failure". A failure condition can be 1179 * 2 for "failure". A failure condition can be
@@ -1227,14 +1226,14 @@ static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta
1227static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv, 1226static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
1228 struct iwl3945_cmd *cmd, struct sk_buff *skb) 1227 struct iwl3945_cmd *cmd, struct sk_buff *skb)
1229{ 1228{
1230 struct iwl3945_rx_packet *res = NULL; 1229 struct iwl_rx_packet *res = NULL;
1231 1230
1232 if (!skb) { 1231 if (!skb) {
1233 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n"); 1232 IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
1234 return 1; 1233 return 1;
1235 } 1234 }
1236 1235
1237 res = (struct iwl3945_rx_packet *)skb->data; 1236 res = (struct iwl_rx_packet *)skb->data;
1238 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1237 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1239 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1238 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1240 res->hdr.flags); 1239 res->hdr.flags);
@@ -1255,7 +1254,7 @@ static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
1255int iwl3945_send_add_station(struct iwl3945_priv *priv, 1254int iwl3945_send_add_station(struct iwl3945_priv *priv,
1256 struct iwl3945_addsta_cmd *sta, u8 flags) 1255 struct iwl3945_addsta_cmd *sta, u8 flags)
1257{ 1256{
1258 struct iwl3945_rx_packet *res = NULL; 1257 struct iwl_rx_packet *res = NULL;
1259 int rc = 0; 1258 int rc = 0;
1260 struct iwl3945_host_cmd cmd = { 1259 struct iwl3945_host_cmd cmd = {
1261 .id = REPLY_ADD_STA, 1260 .id = REPLY_ADD_STA,
@@ -1274,7 +1273,7 @@ int iwl3945_send_add_station(struct iwl3945_priv *priv,
1274 if (rc || (flags & CMD_ASYNC)) 1273 if (rc || (flags & CMD_ASYNC))
1275 return rc; 1274 return rc;
1276 1275
1277 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; 1276 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
1278 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 1277 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
1279 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n", 1278 IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
1280 res->hdr.flags); 1279 res->hdr.flags);
@@ -2869,7 +2868,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
2869 u8 type) 2868 u8 type)
2870{ 2869{
2871 struct iwl_spectrum_cmd spectrum; 2870 struct iwl_spectrum_cmd spectrum;
2872 struct iwl3945_rx_packet *res; 2871 struct iwl_rx_packet *res;
2873 struct iwl3945_host_cmd cmd = { 2872 struct iwl3945_host_cmd cmd = {
2874 .id = REPLY_SPECTRUM_MEASUREMENT_CMD, 2873 .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
2875 .data = (void *)&spectrum, 2874 .data = (void *)&spectrum,
@@ -2914,7 +2913,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
2914 if (rc) 2913 if (rc)
2915 return rc; 2914 return rc;
2916 2915
2917 res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data; 2916 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
2918 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 2917 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
2919 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n"); 2918 IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
2920 rc = -EIO; 2919 rc = -EIO;
@@ -2946,8 +2945,8 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
2946static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv, 2945static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
2947 struct iwl3945_rx_mem_buffer *rxb) 2946 struct iwl3945_rx_mem_buffer *rxb)
2948{ 2947{
2949 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 2948 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
2950 struct iwl3945_alive_resp *palive; 2949 struct iwl_alive_resp *palive;
2951 struct delayed_work *pwork; 2950 struct delayed_work *pwork;
2952 2951
2953 palive = &pkt->u.alive_frame; 2952 palive = &pkt->u.alive_frame;
@@ -2959,14 +2958,13 @@ static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
2959 2958
2960 if (palive->ver_subtype == INITIALIZE_SUBTYPE) { 2959 if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
2961 IWL_DEBUG_INFO("Initialization Alive received.\n"); 2960 IWL_DEBUG_INFO("Initialization Alive received.\n");
2962 memcpy(&priv->card_alive_init, 2961 memcpy(&priv->card_alive_init, &pkt->u.alive_frame,
2963 &pkt->u.alive_frame, 2962 sizeof(struct iwl_alive_resp));
2964 sizeof(struct iwl3945_init_alive_resp));
2965 pwork = &priv->init_alive_start; 2963 pwork = &priv->init_alive_start;
2966 } else { 2964 } else {
2967 IWL_DEBUG_INFO("Runtime Alive received.\n"); 2965 IWL_DEBUG_INFO("Runtime Alive received.\n");
2968 memcpy(&priv->card_alive, &pkt->u.alive_frame, 2966 memcpy(&priv->card_alive, &pkt->u.alive_frame,
2969 sizeof(struct iwl3945_alive_resp)); 2967 sizeof(struct iwl_alive_resp));
2970 pwork = &priv->alive_start; 2968 pwork = &priv->alive_start;
2971 iwl3945_disable_events(priv); 2969 iwl3945_disable_events(priv);
2972 } 2970 }
@@ -2983,7 +2981,7 @@ static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
2983static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv, 2981static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
2984 struct iwl3945_rx_mem_buffer *rxb) 2982 struct iwl3945_rx_mem_buffer *rxb)
2985{ 2983{
2986 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 2984 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
2987 2985
2988 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status); 2986 IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
2989 return; 2987 return;
@@ -2992,7 +2990,7 @@ static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
2992static void iwl3945_rx_reply_error(struct iwl3945_priv *priv, 2990static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
2993 struct iwl3945_rx_mem_buffer *rxb) 2991 struct iwl3945_rx_mem_buffer *rxb)
2994{ 2992{
2995 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 2993 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
2996 2994
2997 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) " 2995 IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
2998 "seq 0x%04X ser 0x%08X\n", 2996 "seq 0x%04X ser 0x%08X\n",
@@ -3007,7 +3005,7 @@ static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
3007 3005
3008static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb) 3006static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
3009{ 3007{
3010 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3008 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3011 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon; 3009 struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
3012 struct iwl_csa_notification *csa = &(pkt->u.csa_notif); 3010 struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
3013 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n", 3011 IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
@@ -3020,7 +3018,7 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
3020 struct iwl3945_rx_mem_buffer *rxb) 3018 struct iwl3945_rx_mem_buffer *rxb)
3021{ 3019{
3022#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT 3020#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
3023 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3021 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3024 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); 3022 struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
3025 3023
3026 if (!report->state) { 3024 if (!report->state) {
@@ -3038,7 +3036,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
3038 struct iwl3945_rx_mem_buffer *rxb) 3036 struct iwl3945_rx_mem_buffer *rxb)
3039{ 3037{
3040#ifdef CONFIG_IWL3945_DEBUG 3038#ifdef CONFIG_IWL3945_DEBUG
3041 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3039 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3042 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif); 3040 struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
3043 IWL_DEBUG_RX("sleep mode: %d, src: %d\n", 3041 IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
3044 sleep->pm_sleep_mode, sleep->pm_wakeup_src); 3042 sleep->pm_sleep_mode, sleep->pm_wakeup_src);
@@ -3048,7 +3046,7 @@ static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
3048static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv, 3046static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
3049 struct iwl3945_rx_mem_buffer *rxb) 3047 struct iwl3945_rx_mem_buffer *rxb)
3050{ 3048{
3051 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3049 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3052 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled " 3050 IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
3053 "notification for %s:\n", 3051 "notification for %s:\n",
3054 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd)); 3052 le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
@@ -3084,7 +3082,7 @@ static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
3084 struct iwl3945_rx_mem_buffer *rxb) 3082 struct iwl3945_rx_mem_buffer *rxb)
3085{ 3083{
3086#ifdef CONFIG_IWL3945_DEBUG 3084#ifdef CONFIG_IWL3945_DEBUG
3087 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3085 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3088 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status); 3086 struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
3089 u8 rate = beacon->beacon_notify_hdr.rate; 3087 u8 rate = beacon->beacon_notify_hdr.rate;
3090 3088
@@ -3107,7 +3105,7 @@ static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
3107 struct iwl3945_rx_mem_buffer *rxb) 3105 struct iwl3945_rx_mem_buffer *rxb)
3108{ 3106{
3109#ifdef CONFIG_IWL3945_DEBUG 3107#ifdef CONFIG_IWL3945_DEBUG
3110 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3108 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3111 struct iwl_scanreq_notification *notif = 3109 struct iwl_scanreq_notification *notif =
3112 (struct iwl_scanreq_notification *)pkt->u.raw; 3110 (struct iwl_scanreq_notification *)pkt->u.raw;
3113 3111
@@ -3119,7 +3117,7 @@ static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
3119static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv, 3117static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
3120 struct iwl3945_rx_mem_buffer *rxb) 3118 struct iwl3945_rx_mem_buffer *rxb)
3121{ 3119{
3122 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3120 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3123 struct iwl_scanstart_notification *notif = 3121 struct iwl_scanstart_notification *notif =
3124 (struct iwl_scanstart_notification *)pkt->u.raw; 3122 (struct iwl_scanstart_notification *)pkt->u.raw;
3125 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low); 3123 priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
@@ -3136,7 +3134,7 @@ static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
3136static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv, 3134static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
3137 struct iwl3945_rx_mem_buffer *rxb) 3135 struct iwl3945_rx_mem_buffer *rxb)
3138{ 3136{
3139 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3137 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3140 struct iwl_scanresults_notification *notif = 3138 struct iwl_scanresults_notification *notif =
3141 (struct iwl_scanresults_notification *)pkt->u.raw; 3139 (struct iwl_scanresults_notification *)pkt->u.raw;
3142 3140
@@ -3161,7 +3159,7 @@ static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
3161static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv, 3159static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3162 struct iwl3945_rx_mem_buffer *rxb) 3160 struct iwl3945_rx_mem_buffer *rxb)
3163{ 3161{
3164 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3162 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3165 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw; 3163 struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
3166 3164
3167 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n", 3165 IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
@@ -3224,7 +3222,7 @@ reschedule:
3224static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv, 3222static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
3225 struct iwl3945_rx_mem_buffer *rxb) 3223 struct iwl3945_rx_mem_buffer *rxb)
3226{ 3224{
3227 struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data; 3225 struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
3228 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags); 3226 u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
3229 unsigned long status = priv->status; 3227 unsigned long status = priv->status;
3230 3228
@@ -3342,7 +3340,7 @@ static void iwl3945_cmd_queue_reclaim(struct iwl3945_priv *priv,
3342static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv, 3340static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
3343 struct iwl3945_rx_mem_buffer *rxb) 3341 struct iwl3945_rx_mem_buffer *rxb)
3344{ 3342{
3345 struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data; 3343 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
3346 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 3344 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
3347 int txq_id = SEQ_TO_QUEUE(sequence); 3345 int txq_id = SEQ_TO_QUEUE(sequence);
3348 int index = SEQ_TO_INDEX(sequence); 3346 int index = SEQ_TO_INDEX(sequence);
@@ -3804,7 +3802,7 @@ int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
3804static void iwl3945_rx_handle(struct iwl3945_priv *priv) 3802static void iwl3945_rx_handle(struct iwl3945_priv *priv)
3805{ 3803{
3806 struct iwl3945_rx_mem_buffer *rxb; 3804 struct iwl3945_rx_mem_buffer *rxb;
3807 struct iwl3945_rx_packet *pkt; 3805 struct iwl_rx_packet *pkt;
3808 struct iwl3945_rx_queue *rxq = &priv->rxq; 3806 struct iwl3945_rx_queue *rxq = &priv->rxq;
3809 u32 r, i; 3807 u32 r, i;
3810 int reclaim; 3808 int reclaim;
@@ -3836,7 +3834,7 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
3836 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr, 3834 pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
3837 IWL_RX_BUF_SIZE, 3835 IWL_RX_BUF_SIZE,
3838 PCI_DMA_FROMDEVICE); 3836 PCI_DMA_FROMDEVICE);
3839 pkt = (struct iwl3945_rx_packet *)rxb->skb->data; 3837 pkt = (struct iwl_rx_packet *)rxb->skb->data;
3840 3838
3841 /* Reclaim a command buffer only if this packet is a response 3839 /* Reclaim a command buffer only if this packet is a response
3842 * to a (driver-originated) command. 3840 * to a (driver-originated) command.
@@ -5837,7 +5835,7 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
5837 iwl3945_hw_nic_reset(priv); 5835 iwl3945_hw_nic_reset(priv);
5838 5836
5839 exit: 5837 exit:
5840 memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp)); 5838 memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));
5841 5839
5842 if (priv->ibss_beacon) 5840 if (priv->ibss_beacon)
5843 dev_kfree_skb(priv->ibss_beacon); 5841 dev_kfree_skb(priv->ibss_beacon);