diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-24 14:13:05 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-27 15:24:21 -0400 |
commit | c2acea8e9b86ba5a5469ff477445676a223af4e2 (patch) | |
tree | 3c4705b13dd5c85817a1132a17743757135b7047 /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | fbf3a2af3834e8e93e9c2876de62c5b49988e352 (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/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 2cc7e30d7743..5ded8983b915 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -363,7 +363,7 @@ static void iwl3945_unset_hw_params(struct iwl_priv *priv) | |||
363 | 363 | ||
364 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 364 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
365 | struct ieee80211_tx_info *info, | 365 | struct ieee80211_tx_info *info, |
366 | struct iwl_cmd *cmd, | 366 | struct iwl_device_cmd *cmd, |
367 | struct sk_buff *skb_frag, | 367 | struct sk_buff *skb_frag, |
368 | int sta_id) | 368 | int sta_id) |
369 | { | 369 | { |
@@ -403,7 +403,7 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | |||
403 | * handle build REPLY_TX command notification. | 403 | * handle build REPLY_TX command notification. |
404 | */ | 404 | */ |
405 | static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, | 405 | static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv, |
406 | struct iwl_cmd *cmd, | 406 | struct iwl_device_cmd *cmd, |
407 | struct ieee80211_tx_info *info, | 407 | struct ieee80211_tx_info *info, |
408 | struct ieee80211_hdr *hdr, u8 std_id) | 408 | struct ieee80211_hdr *hdr, u8 std_id) |
409 | { | 409 | { |
@@ -476,7 +476,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
476 | struct iwl3945_tx_cmd *tx; | 476 | struct iwl3945_tx_cmd *tx; |
477 | struct iwl_tx_queue *txq = NULL; | 477 | struct iwl_tx_queue *txq = NULL; |
478 | struct iwl_queue *q = NULL; | 478 | struct iwl_queue *q = NULL; |
479 | struct iwl_cmd *out_cmd = NULL; | 479 | struct iwl_device_cmd *out_cmd; |
480 | struct iwl_cmd_meta *out_meta; | ||
480 | dma_addr_t phys_addr; | 481 | dma_addr_t phys_addr; |
481 | dma_addr_t txcmd_phys; | 482 | dma_addr_t txcmd_phys; |
482 | int txq_id = skb_get_queue_mapping(skb); | 483 | int txq_id = skb_get_queue_mapping(skb); |
@@ -565,6 +566,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
565 | 566 | ||
566 | /* Init first empty entry in queue's array of Tx/cmd buffers */ | 567 | /* Init first empty entry in queue's array of Tx/cmd buffers */ |
567 | out_cmd = txq->cmd[idx]; | 568 | out_cmd = txq->cmd[idx]; |
569 | out_meta = &txq->meta[idx]; | ||
568 | tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; | 570 | tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload; |
569 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); | 571 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); |
570 | memset(tx, 0, sizeof(*tx)); | 572 | memset(tx, 0, sizeof(*tx)); |
@@ -642,8 +644,8 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb) | |||
642 | len, PCI_DMA_TODEVICE); | 644 | len, PCI_DMA_TODEVICE); |
643 | /* we do not map meta data ... so we can safely access address to | 645 | /* we do not map meta data ... so we can safely access address to |
644 | * provide to unmap command*/ | 646 | * provide to unmap command*/ |
645 | pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys); | 647 | pci_unmap_addr_set(out_meta, mapping, txcmd_phys); |
646 | pci_unmap_len_set(&out_cmd->meta, len, len); | 648 | pci_unmap_len_set(out_meta, len, len); |
647 | 649 | ||
648 | /* Add buffer containing Tx command and MAC(!) header to TFD's | 650 | /* Add buffer containing Tx command and MAC(!) header to TFD's |
649 | * first entry */ | 651 | * first entry */ |
@@ -753,7 +755,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
753 | struct iwl_host_cmd cmd = { | 755 | struct iwl_host_cmd cmd = { |
754 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, | 756 | .id = REPLY_SPECTRUM_MEASUREMENT_CMD, |
755 | .data = (void *)&spectrum, | 757 | .data = (void *)&spectrum, |
756 | .meta.flags = CMD_WANT_SKB, | 758 | .flags = CMD_WANT_SKB, |
757 | }; | 759 | }; |
758 | u32 add_time = le64_to_cpu(params->start_time); | 760 | u32 add_time = le64_to_cpu(params->start_time); |
759 | int rc; | 761 | int rc; |
@@ -794,7 +796,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
794 | if (rc) | 796 | if (rc) |
795 | return rc; | 797 | return rc; |
796 | 798 | ||
797 | res = (struct iwl_rx_packet *)cmd.meta.u.skb->data; | 799 | res = (struct iwl_rx_packet *)cmd.reply_skb->data; |
798 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { | 800 | if (res->hdr.flags & IWL_CMD_FAILED_MSK) { |
799 | IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); | 801 | IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n"); |
800 | rc = -EIO; | 802 | rc = -EIO; |
@@ -817,7 +819,7 @@ static int iwl3945_get_measurement(struct iwl_priv *priv, | |||
817 | break; | 819 | break; |
818 | } | 820 | } |
819 | 821 | ||
820 | dev_kfree_skb_any(cmd.meta.u.skb); | 822 | dev_kfree_skb_any(cmd.reply_skb); |
821 | 823 | ||
822 | return rc; | 824 | return rc; |
823 | } | 825 | } |
@@ -2717,7 +2719,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data) | |||
2717 | struct iwl_host_cmd cmd = { | 2719 | struct iwl_host_cmd cmd = { |
2718 | .id = REPLY_SCAN_CMD, | 2720 | .id = REPLY_SCAN_CMD, |
2719 | .len = sizeof(struct iwl3945_scan_cmd), | 2721 | .len = sizeof(struct iwl3945_scan_cmd), |
2720 | .meta.flags = CMD_SIZE_HUGE, | 2722 | .flags = CMD_SIZE_HUGE, |
2721 | }; | 2723 | }; |
2722 | int rc = 0; | 2724 | int rc = 0; |
2723 | struct iwl3945_scan_cmd *scan; | 2725 | struct iwl3945_scan_cmd *scan; |