aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-sta.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-24 14:13:05 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-27 15:24:21 -0400
commitc2acea8e9b86ba5a5469ff477445676a223af4e2 (patch)
tree3c4705b13dd5c85817a1132a17743757135b7047 /drivers/net/wireless/iwlwifi/iwl-sta.c
parentfbf3a2af3834e8e93e9c2876de62c5b49988e352 (diff)
iwlwifi: fix up command sending
The current command sending in iwlwifi is a bit of a mess: 1) there is a struct, iwl_cmd, that contains both driver and device data in a single packed structure -- this is very confusing 2) the on-stack data and the command metadata share a structure by embedding the latter in the former, which is also rather confusing because it leads to weird unions and similarly odd constructs 3) each txq always has enough space for 256 commands, even if only 32 end up being used This patch fixes these things: 1) rename iwl_cmd to iwl_device_cmd and keep track of command metadata and device command separately, in two arrays in each tx queue 2) remove the 'meta' member from iwl_host_cmd and only put in the required members 3) allocate the cmd/meta arrays separately instead of embedding them into the txq structure Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-sta.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index cbe4e26d053f..1571ace05dde 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -98,7 +98,8 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
98} 98}
99 99
100static int iwl_add_sta_callback(struct iwl_priv *priv, 100static int iwl_add_sta_callback(struct iwl_priv *priv,
101 struct iwl_cmd *cmd, struct sk_buff *skb) 101 struct iwl_device_cmd *cmd,
102 struct sk_buff *skb)
102{ 103{
103 struct iwl_rx_packet *res = NULL; 104 struct iwl_rx_packet *res = NULL;
104 struct iwl_addsta_cmd *addsta = 105 struct iwl_addsta_cmd *addsta =
@@ -139,14 +140,14 @@ int iwl_send_add_sta(struct iwl_priv *priv,
139 u8 data[sizeof(*sta)]; 140 u8 data[sizeof(*sta)];
140 struct iwl_host_cmd cmd = { 141 struct iwl_host_cmd cmd = {
141 .id = REPLY_ADD_STA, 142 .id = REPLY_ADD_STA,
142 .meta.flags = flags, 143 .flags = flags,
143 .data = data, 144 .data = data,
144 }; 145 };
145 146
146 if (flags & CMD_ASYNC) 147 if (flags & CMD_ASYNC)
147 cmd.meta.u.callback = iwl_add_sta_callback; 148 cmd.callback = iwl_add_sta_callback;
148 else 149 else
149 cmd.meta.flags |= CMD_WANT_SKB; 150 cmd.flags |= CMD_WANT_SKB;
150 151
151 cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data); 152 cmd.len = priv->cfg->ops->utils->build_addsta_hcmd(sta, data);
152 ret = iwl_send_cmd(priv, &cmd); 153 ret = iwl_send_cmd(priv, &cmd);
@@ -154,7 +155,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
154 if (ret || (flags & CMD_ASYNC)) 155 if (ret || (flags & CMD_ASYNC))
155 return ret; 156 return ret;
156 157
157 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 158 res = (struct iwl_rx_packet *)cmd.reply_skb->data;
158 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 159 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
159 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n", 160 IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
160 res->hdr.flags); 161 res->hdr.flags);
@@ -175,7 +176,7 @@ int iwl_send_add_sta(struct iwl_priv *priv,
175 } 176 }
176 177
177 priv->alloc_rxb_skb--; 178 priv->alloc_rxb_skb--;
178 dev_kfree_skb_any(cmd.meta.u.skb); 179 dev_kfree_skb_any(cmd.reply_skb);
179 180
180 return ret; 181 return ret;
181} 182}
@@ -325,7 +326,8 @@ static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
325} 326}
326 327
327static int iwl_remove_sta_callback(struct iwl_priv *priv, 328static int iwl_remove_sta_callback(struct iwl_priv *priv,
328 struct iwl_cmd *cmd, struct sk_buff *skb) 329 struct iwl_device_cmd *cmd,
330 struct sk_buff *skb)
329{ 331{
330 struct iwl_rx_packet *res = NULL; 332 struct iwl_rx_packet *res = NULL;
331 struct iwl_rem_sta_cmd *rm_sta = 333 struct iwl_rem_sta_cmd *rm_sta =
@@ -368,7 +370,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
368 struct iwl_host_cmd cmd = { 370 struct iwl_host_cmd cmd = {
369 .id = REPLY_REMOVE_STA, 371 .id = REPLY_REMOVE_STA,
370 .len = sizeof(struct iwl_rem_sta_cmd), 372 .len = sizeof(struct iwl_rem_sta_cmd),
371 .meta.flags = flags, 373 .flags = flags,
372 .data = &rm_sta_cmd, 374 .data = &rm_sta_cmd,
373 }; 375 };
374 376
@@ -377,15 +379,15 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
377 memcpy(&rm_sta_cmd.addr, addr , ETH_ALEN); 379 memcpy(&rm_sta_cmd.addr, addr , ETH_ALEN);
378 380
379 if (flags & CMD_ASYNC) 381 if (flags & CMD_ASYNC)
380 cmd.meta.u.callback = iwl_remove_sta_callback; 382 cmd.callback = iwl_remove_sta_callback;
381 else 383 else
382 cmd.meta.flags |= CMD_WANT_SKB; 384 cmd.flags |= CMD_WANT_SKB;
383 ret = iwl_send_cmd(priv, &cmd); 385 ret = iwl_send_cmd(priv, &cmd);
384 386
385 if (ret || (flags & CMD_ASYNC)) 387 if (ret || (flags & CMD_ASYNC))
386 return ret; 388 return ret;
387 389
388 res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; 390 res = (struct iwl_rx_packet *)cmd.reply_skb->data;
389 if (res->hdr.flags & IWL_CMD_FAILED_MSK) { 391 if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
390 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n", 392 IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
391 res->hdr.flags); 393 res->hdr.flags);
@@ -406,7 +408,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
406 } 408 }
407 409
408 priv->alloc_rxb_skb--; 410 priv->alloc_rxb_skb--;
409 dev_kfree_skb_any(cmd.meta.u.skb); 411 dev_kfree_skb_any(cmd.reply_skb);
410 412
411 return ret; 413 return ret;
412} 414}
@@ -525,7 +527,7 @@ int iwl_send_static_wepkey_cmd(struct iwl_priv *priv, u8 send_if_empty)
525 struct iwl_host_cmd cmd = { 527 struct iwl_host_cmd cmd = {
526 .id = REPLY_WEPKEY, 528 .id = REPLY_WEPKEY,
527 .data = wep_cmd, 529 .data = wep_cmd,
528 .meta.flags = CMD_ASYNC, 530 .flags = CMD_ASYNC,
529 }; 531 };
530 532
531 memset(wep_cmd, 0, cmd_size + 533 memset(wep_cmd, 0, cmd_size +
@@ -930,7 +932,7 @@ int iwl_send_lq_cmd(struct iwl_priv *priv,
930 struct iwl_host_cmd cmd = { 932 struct iwl_host_cmd cmd = {
931 .id = REPLY_TX_LINK_QUALITY_CMD, 933 .id = REPLY_TX_LINK_QUALITY_CMD,
932 .len = sizeof(struct iwl_link_quality_cmd), 934 .len = sizeof(struct iwl_link_quality_cmd),
933 .meta.flags = flags, 935 .flags = flags,
934 .data = lq, 936 .data = lq,
935 }; 937 };
936 938