]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
iwlwifi: fix host command header according the HW spec
authorTomas Winkler <tomas.winkler@intel.com>
Wed, 3 Sep 2008 03:26:52 +0000 (11:26 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 8 Sep 2008 18:23:20 +0000 (14:23 -0400)
This patch aligns definition of host command with the spec. The
inaccuracies weren't critical though.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-tx.c

index fbd8cc1f51df6c30b63db2bf21b0facf27c2278b..8d04e966ad48fe31bc3cad9fbc0d5e010895e54b 100644 (file)
@@ -163,6 +163,13 @@ enum {
 /* iwl_cmd_header flags value */
 #define IWL_CMD_FAILED_MSK 0x40
 
+#define SEQ_TO_QUEUE(s)        (((s) >> 8) & 0x1f)
+#define QUEUE_TO_SEQ(q)        (((q) & 0x1f) << 8)
+#define SEQ_TO_INDEX(s)        ((s) & 0xff)
+#define INDEX_TO_SEQ(i)        ((i) & 0xff)
+#define SEQ_HUGE_FRAME __constant_cpu_to_le16(0x4000)
+#define SEQ_RX_FRAME   __constant_cpu_to_le16(0x8000)
+
 /**
  * struct iwl_cmd_header
  *
@@ -171,7 +178,7 @@ enum {
  */
 struct iwl_cmd_header {
        u8 cmd;         /* Command ID:  REPLY_RXON, etc. */
-       u8 flags;       /* IWL_CMD_* */
+       u8 flags;       /* 0:5 reserved, 6 abort, 7 internal */
        /*
         * The driver sets up the sequence number to values of its chosing.
         * uCode does not use this value, but passes it back to the driver
@@ -187,11 +194,12 @@ struct iwl_cmd_header {
         *
         * The Linux driver uses the following format:
         *
-        *  0:7    index/position within Tx queue
-        *  8:13   Tx queue selection
-        * 14:14   driver sets this to indicate command is in the 'huge'
-        *         storage at the end of the command buffers, i.e. scan cmd
-        * 15:15   uCode sets this in uCode-originated response/notification
+        *  0:7         tfd index - position within TX queue
+        *  8:12        TX queue id
+        *  13          reserved
+        *  14          huge - driver sets this to indicate command is in the
+        *              'huge' storage at the end of the command buffers
+        *  15          unsolicited RX or uCode-originated notification
         */
        __le16 sequence;
 
index edf3d0f3f9c74328e7e1c761a748b110b5f3649f..1943de3f764980392a64f5d96809a28ae851b56e 100644 (file)
@@ -225,12 +225,6 @@ struct iwl_frame {
        struct list_head list;
 };
 
-#define SEQ_TO_QUEUE(x)  ((x >> 8) & 0xbf)
-#define QUEUE_TO_SEQ(x)  ((x & 0xbf) << 8)
-#define SEQ_TO_INDEX(x) ((u8)(x & 0xff))
-#define INDEX_TO_SEQ(x) ((u8)(x & 0xff))
-#define SEQ_HUGE_FRAME  (0x4000)
-#define SEQ_RX_FRAME    __constant_cpu_to_le16(0x8000)
 #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
 #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
 #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
index 6cba5e9c54ecf932db0911fbb702c82cd0ecbb68..a004cc8ab8f572d75f718029fed8c095c1a03aa7 100644 (file)
@@ -1057,7 +1057,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
                        INDEX_TO_SEQ(q->write_ptr));
        if (out_cmd->meta.flags & CMD_SIZE_HUGE)
-               out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
+               out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
        len = (idx == TFD_CMD_SLOTS) ?
                        IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
        phys_addr = pci_map_single(priv->pci_dev, out_cmd, len,
@@ -1192,8 +1192,8 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
-       int huge = sequence & SEQ_HUGE_FRAME;
        int cmd_index;
+       bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
        struct iwl_cmd *cmd;
 
        /* If a Tx command is being handled and it isn't in the actual