aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-09-02 23:26:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-08 14:23:20 -0400
commit9734cb23a02f8de5fa99225ca61c7019ca9f232f (patch)
treed5556d4c8f905276e76ac2bc939a8f68e75211f0 /drivers/net/wireless
parentc90a74bae10dc2a4677d1bd06b6400db229d3e1e (diff)
iwlwifi: fix host command header according the HW spec
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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-commands.h20
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c4
3 files changed, 16 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
index fbd8cc1f51df..8d04e966ad48 100644
--- a/drivers/net/wireless/iwlwifi/iwl-commands.h
+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
@@ -163,6 +163,13 @@ enum {
163/* iwl_cmd_header flags value */ 163/* iwl_cmd_header flags value */
164#define IWL_CMD_FAILED_MSK 0x40 164#define IWL_CMD_FAILED_MSK 0x40
165 165
166#define SEQ_TO_QUEUE(s) (((s) >> 8) & 0x1f)
167#define QUEUE_TO_SEQ(q) (((q) & 0x1f) << 8)
168#define SEQ_TO_INDEX(s) ((s) & 0xff)
169#define INDEX_TO_SEQ(i) ((i) & 0xff)
170#define SEQ_HUGE_FRAME __constant_cpu_to_le16(0x4000)
171#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000)
172
166/** 173/**
167 * struct iwl_cmd_header 174 * struct iwl_cmd_header
168 * 175 *
@@ -171,7 +178,7 @@ enum {
171 */ 178 */
172struct iwl_cmd_header { 179struct iwl_cmd_header {
173 u8 cmd; /* Command ID: REPLY_RXON, etc. */ 180 u8 cmd; /* Command ID: REPLY_RXON, etc. */
174 u8 flags; /* IWL_CMD_* */ 181 u8 flags; /* 0:5 reserved, 6 abort, 7 internal */
175 /* 182 /*
176 * The driver sets up the sequence number to values of its chosing. 183 * The driver sets up the sequence number to values of its chosing.
177 * uCode does not use this value, but passes it back to the driver 184 * uCode does not use this value, but passes it back to the driver
@@ -187,11 +194,12 @@ struct iwl_cmd_header {
187 * 194 *
188 * The Linux driver uses the following format: 195 * The Linux driver uses the following format:
189 * 196 *
190 * 0:7 index/position within Tx queue 197 * 0:7 tfd index - position within TX queue
191 * 8:13 Tx queue selection 198 * 8:12 TX queue id
192 * 14:14 driver sets this to indicate command is in the 'huge' 199 * 13 reserved
193 * storage at the end of the command buffers, i.e. scan cmd 200 * 14 huge - driver sets this to indicate command is in the
194 * 15:15 uCode sets this in uCode-originated response/notification 201 * 'huge' storage at the end of the command buffers
202 * 15 unsolicited RX or uCode-originated notification
195 */ 203 */
196 __le16 sequence; 204 __le16 sequence;
197 205
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index edf3d0f3f9c7..1943de3f7649 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -225,12 +225,6 @@ struct iwl_frame {
225 struct list_head list; 225 struct list_head list;
226}; 226};
227 227
228#define SEQ_TO_QUEUE(x) ((x >> 8) & 0xbf)
229#define QUEUE_TO_SEQ(x) ((x & 0xbf) << 8)
230#define SEQ_TO_INDEX(x) ((u8)(x & 0xff))
231#define INDEX_TO_SEQ(x) ((u8)(x & 0xff))
232#define SEQ_HUGE_FRAME (0x4000)
233#define SEQ_RX_FRAME __constant_cpu_to_le16(0x8000)
234#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4) 228#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
235#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ) 229#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
236#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) 230#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 6cba5e9c54ec..a004cc8ab8f5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -1057,7 +1057,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
1057 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | 1057 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
1058 INDEX_TO_SEQ(q->write_ptr)); 1058 INDEX_TO_SEQ(q->write_ptr));
1059 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 1059 if (out_cmd->meta.flags & CMD_SIZE_HUGE)
1060 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 1060 out_cmd->hdr.sequence |= SEQ_HUGE_FRAME;
1061 len = (idx == TFD_CMD_SLOTS) ? 1061 len = (idx == TFD_CMD_SLOTS) ?
1062 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd); 1062 IWL_MAX_SCAN_SIZE : sizeof(struct iwl_cmd);
1063 phys_addr = pci_map_single(priv->pci_dev, out_cmd, len, 1063 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)
1192 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 1192 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
1193 int txq_id = SEQ_TO_QUEUE(sequence); 1193 int txq_id = SEQ_TO_QUEUE(sequence);
1194 int index = SEQ_TO_INDEX(sequence); 1194 int index = SEQ_TO_INDEX(sequence);
1195 int huge = sequence & SEQ_HUGE_FRAME;
1196 int cmd_index; 1195 int cmd_index;
1196 bool huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
1197 struct iwl_cmd *cmd; 1197 struct iwl_cmd *cmd;
1198 1198
1199 /* If a Tx command is being handled and it isn't in the actual 1199 /* If a Tx command is being handled and it isn't in the actual