iwlwifi: 3945 drop usage of union tsf
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / iwlwifi / iwl-3945-commands.h
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  */
92 struct 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  */
102 struct 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  */
125 struct 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  */
162 struct 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  */
199 struct 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  */
221 struct 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  */
232 struct 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  */
272 struct 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
307 struct 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
317 struct 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
328 struct 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  */
342 struct 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  */
373 struct 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  */
437 struct 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  */
449 struct 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
456 struct 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  */
477 struct 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  */
508 struct 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  */
576 struct 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  */
629 struct 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  */
639 struct 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
653 struct 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
671 struct 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
682 struct 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
688 struct 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
700 struct 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
707 struct 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  */
732 struct 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
746 struct 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__ */