]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/iwlwifi/iwl-4965-commands.h
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[linux-2.6] / drivers / net / wireless / iwlwifi / iwl-4965-commands.h
index 7988c752a6691fa54a3514bea69936d3b99b964c..3bcd107e2d71bf441c2b3840043ceffe0048525f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2007 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -84,6 +84,9 @@ enum {
        REPLY_REMOVE_STA = 0x19,        /* not used */
        REPLY_REMOVE_ALL_STA = 0x1a,    /* not used */
 
+       /* Security */
+       REPLY_WEPKEY = 0x20,
+
        /* RX, TX, LEDs */
        REPLY_TX = 0x1c,
        REPLY_RATE_SCALE = 0x47,        /* 3945 only */
@@ -139,7 +142,7 @@ enum {
        REPLY_PHY_CALIBRATION_CMD = 0xb0,
        REPLY_RX_PHY_CMD = 0xc0,
        REPLY_RX_MPDU_CMD = 0xc1,
-       REPLY_4965_RX = 0xc3,
+       REPLY_RX = 0xc3,
        REPLY_COMPRESSED_BA = 0xc5,
        REPLY_MAX = 0xff
 };
@@ -151,16 +154,16 @@ enum {
  *
  *****************************************************************************/
 
-/* iwl4965_cmd_header flags value */
+/* iwl_cmd_header flags value */
 #define IWL_CMD_FAILED_MSK 0x40
 
 /**
- * struct iwl4965_cmd_header
+ * struct iwl_cmd_header
  *
  * This header format appears in the beginning of each command sent from the
  * driver, and each response/notification received from uCode.
  */
-struct iwl4965_cmd_header {
+struct iwl_cmd_header {
        u8 cmd;         /* Command ID:  REPLY_RXON, etc. */
        u8 flags;       /* IWL_CMD_* */
        /*
@@ -194,7 +197,7 @@ struct iwl4965_cmd_header {
  * 4965 rate_n_flags bit fields
  *
  * rate_n_flags format is used in following 4965 commands:
- *  REPLY_4965_RX (response only)
+ *  REPLY_RX (response only)
  *  REPLY_TX (both command and response)
  *  REPLY_TX_LINK_QUALITY_CMD
  *
@@ -266,11 +269,10 @@ struct iwl4965_cmd_header {
  *          10 B active, A inactive
  *          11 Both active
  */
-#define RATE_MCS_ANT_A_POS     14
-#define RATE_MCS_ANT_B_POS     15
-#define RATE_MCS_ANT_A_MSK     0x4000
-#define RATE_MCS_ANT_B_MSK     0x8000
-#define RATE_MCS_ANT_AB_MSK    0xc000
+#define RATE_MCS_ANT_POS       14
+#define RATE_MCS_ANT_A_MSK     0x04000
+#define RATE_MCS_ANT_B_MSK     0x08000
+#define RATE_MCS_ANT_AB_MSK    0x0C000
 
 
 /**
@@ -492,18 +494,18 @@ enum {
 };
 
 
-#define RXON_RX_CHAIN_DRIVER_FORCE_MSK         __constant_cpu_to_le16(0x1<<0)
-#define RXON_RX_CHAIN_VALID_MSK                        __constant_cpu_to_le16(0x7<<1)
+#define RXON_RX_CHAIN_DRIVER_FORCE_MSK         __constant_cpu_to_le16(0x1 << 0)
+#define RXON_RX_CHAIN_VALID_MSK                        __constant_cpu_to_le16(0x7 << 1)
 #define RXON_RX_CHAIN_VALID_POS                        (1)
-#define RXON_RX_CHAIN_FORCE_SEL_MSK            __constant_cpu_to_le16(0x7<<4)
+#define RXON_RX_CHAIN_FORCE_SEL_MSK            __constant_cpu_to_le16(0x7 << 4)
 #define RXON_RX_CHAIN_FORCE_SEL_POS            (4)
-#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK       __constant_cpu_to_le16(0x7<<7)
+#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK       __constant_cpu_to_le16(0x7 << 7)
 #define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS       (7)
-#define RXON_RX_CHAIN_CNT_MSK                  __constant_cpu_to_le16(0x3<<10)
+#define RXON_RX_CHAIN_CNT_MSK                  __constant_cpu_to_le16(0x3 << 10)
 #define RXON_RX_CHAIN_CNT_POS                  (10)
-#define RXON_RX_CHAIN_MIMO_CNT_MSK             __constant_cpu_to_le16(0x3<<12)
+#define RXON_RX_CHAIN_MIMO_CNT_MSK             __constant_cpu_to_le16(0x3 << 12)
 #define RXON_RX_CHAIN_MIMO_CNT_POS             (12)
-#define RXON_RX_CHAIN_MIMO_FORCE_MSK           __constant_cpu_to_le16(0x1<<14)
+#define RXON_RX_CHAIN_MIMO_FORCE_MSK           __constant_cpu_to_le16(0x1 << 14)
 #define RXON_RX_CHAIN_MIMO_FORCE_POS           (14)
 
 /* rx_config flags */
@@ -532,17 +534,17 @@ enum {
 
 /* HT flags */
 #define RXON_FLG_CTRL_CHANNEL_LOC_POS          (22)
-#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK       __constant_cpu_to_le32(0x1<<22)
+#define RXON_FLG_CTRL_CHANNEL_LOC_HI_MSK       __constant_cpu_to_le32(0x1 << 22)
 
 #define RXON_FLG_HT_OPERATING_MODE_POS         (23)
 
-#define RXON_FLG_HT_PROT_MSK                   __constant_cpu_to_le32(0x1<<23)
-#define RXON_FLG_FAT_PROT_MSK                  __constant_cpu_to_le32(0x2<<23)
+#define RXON_FLG_HT_PROT_MSK                   __constant_cpu_to_le32(0x1 << 23)
+#define RXON_FLG_FAT_PROT_MSK                  __constant_cpu_to_le32(0x2 << 23)
 
 #define RXON_FLG_CHANNEL_MODE_POS              (25)
-#define RXON_FLG_CHANNEL_MODE_MSK              __constant_cpu_to_le32(0x3<<25)
-#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK      __constant_cpu_to_le32(0x1<<25)
-#define RXON_FLG_CHANNEL_MODE_MIXED_MSK                __constant_cpu_to_le32(0x2<<25)
+#define RXON_FLG_CHANNEL_MODE_MSK              __constant_cpu_to_le32(0x3 << 25)
+#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK      __constant_cpu_to_le32(0x1 << 25)
+#define RXON_FLG_CHANNEL_MODE_MIXED_MSK                __constant_cpu_to_le32(0x2 << 25)
 
 /* rx_config filter flags */
 /* accept all data frames */
@@ -713,7 +715,7 @@ struct iwl4965_qosparam_cmd {
 #define        IWL_STATION_COUNT       32      /* MAX(3945,4965)*/
 #define        IWL_INVALID_STATION     255
 
-#define STA_FLG_PWR_SAVE_MSK           __constant_cpu_to_le32(1<<8);
+#define STA_FLG_PWR_SAVE_MSK           __constant_cpu_to_le32(1 << 8);
 #define STA_FLG_RTS_MIMO_PROT_MSK      __constant_cpu_to_le32(1 << 17)
 #define STA_FLG_AGG_MPDU_8US_MSK       __constant_cpu_to_le32(1 << 18)
 #define STA_FLG_MAX_AGG_SIZE_POS       (19)
@@ -727,14 +729,21 @@ struct iwl4965_qosparam_cmd {
 #define STA_CONTROL_MODIFY_MSK         0x01
 
 /* key flags __le16*/
-#define STA_KEY_FLG_ENCRYPT_MSK        __constant_cpu_to_le16(0x7)
-#define STA_KEY_FLG_NO_ENC     __constant_cpu_to_le16(0x0)
-#define STA_KEY_FLG_WEP                __constant_cpu_to_le16(0x1)
-#define STA_KEY_FLG_CCMP       __constant_cpu_to_le16(0x2)
-#define STA_KEY_FLG_TKIP       __constant_cpu_to_le16(0x3)
+#define STA_KEY_FLG_ENCRYPT_MSK        __constant_cpu_to_le16(0x0007)
+#define STA_KEY_FLG_NO_ENC     __constant_cpu_to_le16(0x0000)
+#define STA_KEY_FLG_WEP                __constant_cpu_to_le16(0x0001)
+#define STA_KEY_FLG_CCMP       __constant_cpu_to_le16(0x0002)
+#define STA_KEY_FLG_TKIP       __constant_cpu_to_le16(0x0003)
 
 #define STA_KEY_FLG_KEYID_POS  8
 #define STA_KEY_FLG_INVALID    __constant_cpu_to_le16(0x0800)
+/* wep key is either from global key (0) or from station info array (1) */
+#define STA_KEY_FLG_MAP_KEY_MSK        __constant_cpu_to_le16(0x0008)
+
+/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
+#define STA_KEY_FLG_KEY_SIZE_MSK     __constant_cpu_to_le16(0x1000)
+#define STA_KEY_MULTICAST_MSK        __constant_cpu_to_le16(0x4000)
+#define STA_KEY_MAX_NUM                8
 
 /* Flags indicate whether to modify vs. don't change various station params */
 #define        STA_MODIFY_KEY_MASK             0x01
@@ -752,7 +761,8 @@ struct iwl4965_keyinfo {
        u8 tkip_rx_tsc_byte2;   /* TSC[2] for key mix ph1 detection */
        u8 reserved1;
        __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
-       __le16 reserved2;
+       u8 key_offset;
+       u8 reserved2;
        u8 key[16];             /* 16-byte unicast decryption key */
 } __attribute__ ((packed));
 
@@ -842,6 +852,30 @@ struct iwl4965_add_sta_resp {
        u8 status;      /* ADD_STA_* */
 } __attribute__ ((packed));
 
+/*
+ * REPLY_WEP_KEY = 0x20
+ */
+struct iwl_wep_key {
+       u8 key_index;
+       u8 key_offset;
+       u8 reserved1[2];
+       u8 key_size;
+       u8 reserved2[3];
+       u8 key[16];
+} __attribute__ ((packed));
+
+struct iwl_wep_cmd {
+       u8 num_keys;
+       u8 global_key_type;
+       u8 flags;
+       u8 reserved;
+       struct iwl_wep_key key[0];
+} __attribute__ ((packed));
+
+#define WEP_KEY_WEP_TYPE 1
+#define WEP_KEYS_MAX 4
+#define WEP_INVALID_OFFSET 0xff
+#define WEP_KEY_LEN_128 13
 
 /******************************************************************************
  * (4)
@@ -868,26 +902,35 @@ struct iwl4965_rx_frame_hdr {
        u8 payload[0];
 } __attribute__ ((packed));
 
-#define        RX_RES_STATUS_NO_CRC32_ERROR    __constant_cpu_to_le32(1 << 0)
-#define        RX_RES_STATUS_NO_RXE_OVERFLOW   __constant_cpu_to_le32(1 << 1)
+#define RX_RES_STATUS_NO_CRC32_ERROR   __constant_cpu_to_le32(1 << 0)
+#define RX_RES_STATUS_NO_RXE_OVERFLOW  __constant_cpu_to_le32(1 << 1)
+
+#define RX_RES_PHY_FLAGS_BAND_24_MSK   __constant_cpu_to_le16(1 << 0)
+#define RX_RES_PHY_FLAGS_MOD_CCK_MSK           __constant_cpu_to_le16(1 << 1)
+#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK    __constant_cpu_to_le16(1 << 2)
+#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK       __constant_cpu_to_le16(1 << 3)
+#define RX_RES_PHY_FLAGS_ANTENNA_MSK           __constant_cpu_to_le16(0xf0)
 
-#define        RX_RES_PHY_FLAGS_BAND_24_MSK    __constant_cpu_to_le16(1 << 0)
-#define        RX_RES_PHY_FLAGS_MOD_CCK_MSK            __constant_cpu_to_le16(1 << 1)
-#define        RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK     __constant_cpu_to_le16(1 << 2)
-#define        RX_RES_PHY_FLAGS_NARROW_BAND_MSK        __constant_cpu_to_le16(1 << 3)
-#define        RX_RES_PHY_FLAGS_ANTENNA_MSK            __constant_cpu_to_le16(0xf0)
+#define RX_RES_STATUS_SEC_TYPE_MSK     (0x7 << 8)
+#define RX_RES_STATUS_SEC_TYPE_NONE    (0x0 << 8)
+#define RX_RES_STATUS_SEC_TYPE_WEP     (0x1 << 8)
+#define RX_RES_STATUS_SEC_TYPE_CCMP    (0x2 << 8)
+#define RX_RES_STATUS_SEC_TYPE_TKIP    (0x3 << 8)
+#define        RX_RES_STATUS_SEC_TYPE_ERR      (0x7 << 8)
 
-#define        RX_RES_STATUS_SEC_TYPE_MSK      (0x7 << 8)
-#define        RX_RES_STATUS_SEC_TYPE_NONE     (0x0 << 8)
-#define        RX_RES_STATUS_SEC_TYPE_WEP      (0x1 << 8)
-#define        RX_RES_STATUS_SEC_TYPE_CCMP     (0x2 << 8)
-#define        RX_RES_STATUS_SEC_TYPE_TKIP     (0x3 << 8)
+#define RX_RES_STATUS_STATION_FOUND    (1<<6)
+#define RX_RES_STATUS_NO_STATION_INFO_MISMATCH (1<<7)
 
-#define        RX_RES_STATUS_DECRYPT_TYPE_MSK  (0x3 << 11)
-#define        RX_RES_STATUS_NOT_DECRYPT       (0x0 << 11)
-#define        RX_RES_STATUS_DECRYPT_OK        (0x3 << 11)
-#define        RX_RES_STATUS_BAD_ICV_MIC       (0x1 << 11)
-#define        RX_RES_STATUS_BAD_KEY_TTAK      (0x2 << 11)
+#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
+#define RX_RES_STATUS_NOT_DECRYPT      (0x0 << 11)
+#define RX_RES_STATUS_DECRYPT_OK       (0x3 << 11)
+#define RX_RES_STATUS_BAD_ICV_MIC      (0x1 << 11)
+#define RX_RES_STATUS_BAD_KEY_TTAK     (0x2 << 11)
+
+#define RX_MPDU_RES_STATUS_ICV_OK      (0x20)
+#define RX_MPDU_RES_STATUS_MIC_OK      (0x40)
+#define RX_MPDU_RES_STATUS_TTAK_OK     (1 << 7)
+#define RX_MPDU_RES_STATUS_DEC_DONE_MSK        (0x800)
 
 struct iwl4965_rx_frame_end {
        __le32 status;
@@ -922,7 +965,7 @@ struct iwl4965_rx_non_cfg_phy {
 } __attribute__ ((packed));
 
 /*
- * REPLY_4965_RX = 0xc3 (response only, not a command)
+ * REPLY_RX = 0xc3 (response only, not a command)
  * Used only for legacy (non 11n) frames.
  */
 #define RX_RES_PHY_CNT 14
@@ -1038,6 +1081,10 @@ struct iwl4965_rx_mpdu_res_start {
  * MAC header) to DWORD boundary. */
 #define TX_CMD_FLG_MH_PAD_MSK __constant_cpu_to_le32(1 << 20)
 
+/* accelerate aggregation support
+ * 0 - no CCMP encryption; 1 - CCMP encryption */
+#define TX_CMD_FLG_AGG_CCMP_MSK __constant_cpu_to_le32(1 << 22)
+
 /* HCCA-AP - disable duration overwriting. */
 #define TX_CMD_FLG_DUR_MSK __constant_cpu_to_le32(1 << 25)
 
@@ -1300,6 +1347,25 @@ struct iwl4965_tx_resp {
        __le32 status;  /* TX status (for aggregation status of 1st frame) */
 } __attribute__ ((packed));
 
+struct agg_tx_status {
+       __le16 status;
+       __le16 sequence;
+} __attribute__ ((packed));
+
+struct iwl4965_tx_resp_agg {
+       u8 frame_count;         /* 1 no aggregation, >1 aggregation */
+       u8 reserved1;
+       u8 failure_rts;
+       u8 failure_frame;
+       __le32 rate_n_flags;
+       __le16 wireless_media_time;
+       __le16 reserved3;
+       __le32 pa_power1;
+       __le32 pa_power2;
+       struct agg_tx_status status;    /* TX status (for aggregation status */
+                                       /* of 1st frame) */
+} __attribute__ ((packed));
+
 /*
  * REPLY_COMPRESSED_BA = 0xc5 (response only, not a command)
  *
@@ -1313,9 +1379,8 @@ struct iwl4965_compressed_ba_resp {
        /* Index of recipient (BA-sending) station in uCode's station table */
        u8 sta_id;
        u8 tid;
-       __le16 ba_seq_ctl;
-       __le32 ba_bitmap0;
-       __le32 ba_bitmap1;
+       __le16 seq_ctl;
+       __le64 bitmap;
        __le16 scd_flow;
        __le16 scd_ssn;
 } __attribute__ ((packed));
@@ -1333,7 +1398,7 @@ struct iwl4965_txpowertable_cmd {
 } __attribute__ ((packed));
 
 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
-#define  LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK   (1<<0)
+#define  LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK   (1 << 0)
 
 /* # of EDCA prioritized tx fifos */
 #define  LINK_QUAL_AC_NUM AC_NUM
@@ -1342,17 +1407,17 @@ struct iwl4965_txpowertable_cmd {
 #define  LINK_QUAL_MAX_RETRY_NUM 16
 
 /* Tx antenna selection values */
-#define  LINK_QUAL_ANT_A_MSK (1<<0)
-#define  LINK_QUAL_ANT_B_MSK (1<<1)
+#define  LINK_QUAL_ANT_A_MSK (1 << 0)
+#define  LINK_QUAL_ANT_B_MSK (1 << 1)
 #define  LINK_QUAL_ANT_MSK   (LINK_QUAL_ANT_A_MSK|LINK_QUAL_ANT_B_MSK)
 
 
 /**
- * struct iwl4965_link_qual_general_params
+ * struct iwl_link_qual_general_params
  *
  * Used in REPLY_TX_LINK_QUALITY_CMD
  */
-struct iwl4965_link_qual_general_params {
+struct iwl_link_qual_general_params {
        u8 flags;
 
        /* No entries at or above this (driver chosen) index contain MIMO */
@@ -1379,11 +1444,11 @@ struct iwl4965_link_qual_general_params {
 } __attribute__ ((packed));
 
 /**
- * struct iwl4965_link_qual_agg_params
+ * struct iwl_link_qual_agg_params
  *
  * Used in REPLY_TX_LINK_QUALITY_CMD
  */
-struct iwl4965_link_qual_agg_params {
+struct iwl_link_qual_agg_params {
 
        /* Maximum number of uSec in aggregation.
         * Driver should set this to 4000 (4 milliseconds). */
@@ -1593,14 +1658,14 @@ struct iwl4965_link_qual_agg_params {
  * legacy), and then repeat the search process.
  *
  */
-struct iwl4965_link_quality_cmd {
+struct iwl_link_quality_cmd {
 
        /* Index of destination/recipient station in uCode's station table */
        u8 sta_id;
        u8 reserved1;
        __le16 control;         /* not used */
-       struct iwl4965_link_qual_general_params general_params;
-       struct iwl4965_link_qual_agg_params agg_params;
+       struct iwl_link_qual_general_params general_params;
+       struct iwl_link_qual_agg_params agg_params;
 
        /*
         * Rate info; when using rate-scaling, Tx command's initial_rate_index
@@ -1615,6 +1680,10 @@ struct iwl4965_link_quality_cmd {
 
 /*
  * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
+ *
+ * 3945 and 4965 support hardware handshake with Bluetooth device on
+ * same platform.  Bluetooth device alerts wireless device when it will Tx;
+ * wireless device can delay or kill its own Tx to accomodate.
  */
 struct iwl4965_bt_cmd {
        u8 flags;
@@ -1781,9 +1850,9 @@ struct iwl4965_spectrum_notification {
  */
 #define IWL_POWER_VEC_SIZE 5
 
-#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK       __constant_cpu_to_le16(1<<0)
-#define IWL_POWER_SLEEP_OVER_DTIM_MSK          __constant_cpu_to_le16(1<<2)
-#define IWL_POWER_PCI_PM_MSK                   __constant_cpu_to_le16(1<<3)
+#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK       __constant_cpu_to_le16(1 << 0)
+#define IWL_POWER_SLEEP_OVER_DTIM_MSK          __constant_cpu_to_le16(1 << 2)
+#define IWL_POWER_PCI_PM_MSK                   __constant_cpu_to_le16(1 << 3)
 
 struct iwl4965_powertable_cmd {
        __le16 flags;
@@ -1857,20 +1926,47 @@ struct iwl4965_ct_kill_config {
  *
  *****************************************************************************/
 
+/**
+ * struct iwl4965_scan_channel - entry in REPLY_SCAN_CMD channel table
+ *
+ * One for each channel in the scan list.
+ * Each channel can independently select:
+ * 1)  SSID for directed active scans
+ * 2)  Txpower setting (for rate specified within Tx command)
+ * 3)  How long to stay on-channel (behavior may be modified by quiet_time,
+ *     quiet_plcp_th, good_CRC_th)
+ *
+ * To avoid uCode errors, make sure the following are true (see comments
+ * under struct iwl4965_scan_cmd about max_out_time and quiet_time):
+ * 1)  If using passive_dwell (i.e. passive_dwell != 0):
+ *     active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
+ * 2)  quiet_time <= active_dwell
+ * 3)  If restricting off-channel time (i.e. max_out_time !=0):
+ *     passive_dwell < max_out_time
+ *     active_dwell < max_out_time
+ */
 struct iwl4965_scan_channel {
-       /* type is defined as:
-        * 0:0 active (0 - passive)
-        * 1:4 SSID direct
-        *     If 1 is set then corresponding SSID IE is transmitted in probe
+       /*
+        * type is defined as:
+        * 0:0 1 = active, 0 = passive
+        * 1:4 SSID direct bit map; if a bit is set, then corresponding
+        *     SSID IE is transmitted in probe request.
         * 5:7 reserved
         */
        u8 type;
-       u8 channel;
+       u8 channel;     /* band is selected by iwl4965_scan_cmd "flags" field */
        struct iwl4965_tx_power tpc;
-       __le16 active_dwell;
-       __le16 passive_dwell;
+       __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
+       __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 } __attribute__ ((packed));
 
+/**
+ * struct iwl4965_ssid_ie - directed scan network information element
+ *
+ * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
+ * in struct iwl4965_scan_channel; each channel may select different ssids from
+ * among the 4 entries.  SSID IEs get transmitted in reverse order of entry.
+ */
 struct iwl4965_ssid_ie {
        u8 id;
        u8 len;
@@ -1884,40 +1980,98 @@ struct iwl4965_ssid_ie {
 
 /*
  * REPLY_SCAN_CMD = 0x80 (command)
+ *
+ * The hardware scan command is very powerful; the driver can set it up to
+ * maintain (relatively) normal network traffic while doing a scan in the
+ * background.  The max_out_time and suspend_time control the ratio of how
+ * long the device stays on an associated network channel ("service channel")
+ * vs. how long it's away from the service channel, i.e. tuned to other channels
+ * for scanning.
+ *
+ * max_out_time is the max time off-channel (in usec), and suspend_time
+ * is how long (in "extended beacon" format) that the scan is "suspended"
+ * after returning to the service channel.  That is, suspend_time is the
+ * time that we stay on the service channel, doing normal work, between
+ * scan segments.  The driver may set these parameters differently to support
+ * scanning when associated vs. not associated, and light vs. heavy traffic
+ * loads when associated.
+ *
+ * After receiving this command, the device's scan engine does the following;
+ *
+ * 1)  Sends SCAN_START notification to driver
+ * 2)  Checks to see if it has time to do scan for one channel
+ * 3)  Sends NULL packet, with power-save (PS) bit set to 1,
+ *     to tell AP that we're going off-channel
+ * 4)  Tunes to first channel in scan list, does active or passive scan
+ * 5)  Sends SCAN_RESULT notification to driver
+ * 6)  Checks to see if it has time to do scan on *next* channel in list
+ * 7)  Repeats 4-6 until it no longer has time to scan the next channel
+ *     before max_out_time expires
+ * 8)  Returns to service channel
+ * 9)  Sends NULL packet with PS=0 to tell AP that we're back
+ * 10) Stays on service channel until suspend_time expires
+ * 11) Repeats entire process 2-10 until list is complete
+ * 12) Sends SCAN_COMPLETE notification
+ *
+ * For fast, efficient scans, the scan command also has support for staying on
+ * a channel for just a short time, if doing active scanning and getting no
+ * responses to the transmitted probe request.  This time is controlled by
+ * quiet_time, and the number of received packets below which a channel is
+ * considered "quiet" is controlled by quiet_plcp_threshold.
+ *
+ * For active scanning on channels that have regulatory restrictions against
+ * blindly transmitting, the scan can listen before transmitting, to make sure
+ * that there is already legitimate activity on the channel.  If enough
+ * packets are cleanly received on the channel (controlled by good_CRC_th,
+ * typical value 1), the scan engine starts transmitting probe requests.
+ *
+ * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
+ *
+ * To avoid uCode errors, see timing restrictions described under
+ * struct iwl4965_scan_channel.
  */
 struct iwl4965_scan_cmd {
        __le16 len;
        u8 reserved0;
-       u8 channel_count;
-       __le16 quiet_time;     /* dwell only this long on quiet chnl
-                               * (active scan) */
-       __le16 quiet_plcp_th;  /* quiet chnl is < this # pkts (typ. 1) */
-       __le16 good_CRC_th;    /* passive -> active promotion threshold */
-       __le16 rx_chain;
-       __le32 max_out_time;   /* max usec to be out of associated (service)
-                               * chnl */
-       __le32 suspend_time;   /* pause scan this long when returning to svc
-                               * chnl.
-                               * 3945 -- 31:24 # beacons, 19:0 additional usec,
-                               * 4965 -- 31:22 # beacons, 21:0 additional usec.
-                               */
-       __le32 flags;
-       __le32 filter_flags;
-
+       u8 channel_count;       /* # channels in channel list */
+       __le16 quiet_time;      /* dwell only this # millisecs on quiet channel
+                                * (only for active scan) */
+       __le16 quiet_plcp_th;   /* quiet chnl is < this # pkts (typ. 1) */
+       __le16 good_CRC_th;     /* passive -> active promotion threshold */
+       __le16 rx_chain;        /* RXON_RX_CHAIN_* */
+       __le32 max_out_time;    /* max usec to be away from associated (service)
+                                * channel */
+       __le32 suspend_time;    /* pause scan this long (in "extended beacon
+                                * format") when returning to service chnl:
+                                * 3945; 31:24 # beacons, 19:0 additional usec,
+                                * 4965; 31:22 # beacons, 21:0 additional usec.
+                                */
+       __le32 flags;           /* RXON_FLG_* */
+       __le32 filter_flags;    /* RXON_FILTER_* */
+
+       /* For active scans (set to all-0s for passive scans).
+        * Does not include payload.  Must specify Tx rate; no rate scaling. */
        struct iwl4965_tx_cmd tx_cmd;
+
+       /* For directed active scans (set to all-0s otherwise) */
        struct iwl4965_ssid_ie direct_scan[PROBE_OPTION_MAX];
 
-       u8 data[0];
        /*
-        * The channels start after the probe request payload and are of type:
+        * Probe request frame, followed by channel list.
+        *
+        * Size of probe request frame is specified by byte count in tx_cmd.
+        * Channel list follows immediately after probe request frame.
+        * Number of channels in list is specified by channel_count.
+        * Each channel in list is of type:
         *
         * struct iwl4965_scan_channel channels[0];
         *
         * NOTE:  Only one band of channels can be scanned per pass.  You
-        * can not mix 2.4GHz channels and 5.2GHz channels and must
-        * request a scan multiple times (not concurrently)
-        *
+        * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+        * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
+        * before requesting another scan.
         */
+       u8 data[0];
 } __attribute__ ((packed));
 
 /* Can abort will notify by complete notification with abort status. */
@@ -2087,7 +2241,7 @@ struct statistics_rx_non_phy {
        __le32 interference_data_flag;  /* flag for interference data
                                         * availability. 1 when data is
                                         * available. */
-       __le32 channel_load;    /* counts RX Enable time */
+       __le32 channel_load;            /* counts RX Enable time in uSec */
        __le32 dsp_false_alarms;        /* DSP false alarm (both OFDM
                                         * and CCK) counter */
        __le32 beacon_rssi_a;
@@ -2536,7 +2690,7 @@ struct iwl4965_led_cmd {
 
 struct iwl4965_rx_packet {
        __le32 len;
-       struct iwl4965_cmd_header hdr;
+       struct iwl_cmd_header hdr;
        union {
                struct iwl4965_alive_resp alive_frame;
                struct iwl4965_rx_frame rx_frame;