aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-tx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-06-27 10:54:49 -0400
committerWey-Yi Guy <wey-yi.w.guy@intel.com>2011-06-27 10:56:41 -0400
commite815407d395e0b7fd1aa9145d9d0c391191b833c (patch)
treee46cda1a72379a3c4bc9c02bf7d01876584d90e8 /drivers/net/wireless/iwlwifi/iwl-tx.c
parent1107a08a1a3e0f54d535d37ee0c4192acce6a7f3 (diff)
iwlagn: map command buffers BIDI
Evidently, the device sometimes wants to write back to command buffers, even if I see no reason why it should. Allow it to do that. Tested-by: Andy Lutomirski <luto@mit.edu> Tested-by: Kyle McMartin <kyle@redhat.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-tx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 8f20065e6dac..47074315903e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -126,7 +126,7 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
126} 126}
127 127
128static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta, 128static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
129 struct iwl_tfd *tfd) 129 struct iwl_tfd *tfd, enum dma_data_direction dma_dir)
130{ 130{
131 struct pci_dev *dev = priv->pci_dev; 131 struct pci_dev *dev = priv->pci_dev;
132 int i; 132 int i;
@@ -151,7 +151,7 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
151 /* Unmap chunks, if any. */ 151 /* Unmap chunks, if any. */
152 for (i = 1; i < num_tbs; i++) 152 for (i = 1; i < num_tbs; i++)
153 pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i), 153 pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i),
154 iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE); 154 iwl_tfd_tb_get_len(tfd, i), dma_dir);
155} 155}
156 156
157/** 157/**
@@ -167,7 +167,8 @@ void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
167 struct iwl_tfd *tfd_tmp = txq->tfds; 167 struct iwl_tfd *tfd_tmp = txq->tfds;
168 int index = txq->q.read_ptr; 168 int index = txq->q.read_ptr;
169 169
170 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index]); 170 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index],
171 DMA_TO_DEVICE);
171 172
172 /* free SKB */ 173 /* free SKB */
173 if (txq->txb) { 174 if (txq->txb) {
@@ -310,7 +311,8 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
310 i = get_cmd_index(q, q->read_ptr); 311 i = get_cmd_index(q, q->read_ptr);
311 312
312 if (txq->meta[i].flags & CMD_MAPPED) { 313 if (txq->meta[i].flags & CMD_MAPPED) {
313 iwlagn_unmap_tfd(priv, &txq->meta[i], &txq->tfds[i]); 314 iwlagn_unmap_tfd(priv, &txq->meta[i], &txq->tfds[i],
315 DMA_BIDIRECTIONAL);
314 txq->meta[i].flags = 0; 316 txq->meta[i].flags = 0;
315 } 317 }
316 318
@@ -692,10 +694,11 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
692 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) 694 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
693 continue; 695 continue;
694 phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i], 696 phys_addr = pci_map_single(priv->pci_dev, (void *)cmd->data[i],
695 cmd->len[i], PCI_DMA_TODEVICE); 697 cmd->len[i], DMA_BIDIRECTIONAL);
696 if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) { 698 if (pci_dma_mapping_error(priv->pci_dev, phys_addr)) {
697 iwlagn_unmap_tfd(priv, out_meta, 699 iwlagn_unmap_tfd(priv, out_meta,
698 &txq->tfds[q->write_ptr]); 700 &txq->tfds[q->write_ptr],
701 DMA_BIDIRECTIONAL);
699 idx = -ENOMEM; 702 idx = -ENOMEM;
700 goto out; 703 goto out;
701 } 704 }
@@ -799,7 +802,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
799 cmd = txq->cmd[cmd_index]; 802 cmd = txq->cmd[cmd_index];
800 meta = &txq->meta[cmd_index]; 803 meta = &txq->meta[cmd_index];
801 804
802 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index]); 805 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], DMA_BIDIRECTIONAL);
803 806
804 /* Input error checking is done when commands are added to queue. */ 807 /* Input error checking is done when commands are added to queue. */
805 if (meta->flags & CMD_WANT_SKB) { 808 if (meta->flags & CMD_WANT_SKB) {