aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-tx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index fd8aee9972c1..e72d2279fc5d 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 int i; 131 int i;
132 int num_tbs; 132 int num_tbs;
@@ -150,7 +150,7 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
150 /* Unmap chunks, if any. */ 150 /* Unmap chunks, if any. */
151 for (i = 1; i < num_tbs; i++) 151 for (i = 1; i < num_tbs; i++)
152 dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i), 152 dma_unmap_single(priv->bus.dev, iwl_tfd_tb_get_addr(tfd, i),
153 iwl_tfd_tb_get_len(tfd, i), DMA_TO_DEVICE); 153 iwl_tfd_tb_get_len(tfd, i), dma_dir);
154} 154}
155 155
156/** 156/**
@@ -166,7 +166,8 @@ void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
166 struct iwl_tfd *tfd_tmp = txq->tfds; 166 struct iwl_tfd *tfd_tmp = txq->tfds;
167 int index = txq->q.read_ptr; 167 int index = txq->q.read_ptr;
168 168
169 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index]); 169 iwlagn_unmap_tfd(priv, &txq->meta[index], &tfd_tmp[index],
170 DMA_TO_DEVICE);
170 171
171 /* free SKB */ 172 /* free SKB */
172 if (txq->txb) { 173 if (txq->txb) {
@@ -309,9 +310,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
309 i = get_cmd_index(q, q->read_ptr); 310 i = get_cmd_index(q, q->read_ptr);
310 311
311 if (txq->meta[i].flags & CMD_MAPPED) { 312 if (txq->meta[i].flags & CMD_MAPPED) {
312 dma_unmap_single(priv->bus.dev, 313 iwlagn_unmap_tfd(priv, &txq->meta[i], &txq->tfds[i],
313 dma_unmap_addr(&txq->meta[i], mapping),
314 dma_unmap_len(&txq->meta[i], len),
315 DMA_BIDIRECTIONAL); 314 DMA_BIDIRECTIONAL);
316 txq->meta[i].flags = 0; 315 txq->meta[i].flags = 0;
317 } 316 }
@@ -534,12 +533,7 @@ out_free_arrays:
534void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq, 533void iwl_tx_queue_reset(struct iwl_priv *priv, struct iwl_tx_queue *txq,
535 int slots_num, u32 txq_id) 534 int slots_num, u32 txq_id)
536{ 535{
537 int actual_slots = slots_num; 536 memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * slots_num);
538
539 if (txq_id == priv->cmd_queue)
540 actual_slots++;
541
542 memset(txq->meta, 0, sizeof(struct iwl_cmd_meta) * actual_slots);
543 537
544 txq->need_update = 0; 538 txq->need_update = 0;
545 539
@@ -699,10 +693,11 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
699 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY)) 693 if (!(cmd->dataflags[i] & IWL_HCMD_DFL_NOCOPY))
700 continue; 694 continue;
701 phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i], 695 phys_addr = dma_map_single(priv->bus.dev, (void *)cmd->data[i],
702 cmd->len[i], DMA_TO_DEVICE); 696 cmd->len[i], DMA_BIDIRECTIONAL);
703 if (dma_mapping_error(priv->bus.dev, phys_addr)) { 697 if (dma_mapping_error(priv->bus.dev, phys_addr)) {
704 iwlagn_unmap_tfd(priv, out_meta, 698 iwlagn_unmap_tfd(priv, out_meta,
705 &txq->tfds[q->write_ptr]); 699 &txq->tfds[q->write_ptr],
700 DMA_BIDIRECTIONAL);
706 idx = -ENOMEM; 701 idx = -ENOMEM;
707 goto out; 702 goto out;
708 } 703 }
@@ -806,7 +801,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
806 cmd = txq->cmd[cmd_index]; 801 cmd = txq->cmd[cmd_index];
807 meta = &txq->meta[cmd_index]; 802 meta = &txq->meta[cmd_index];
808 803
809 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index]); 804 iwlagn_unmap_tfd(priv, meta, &txq->tfds[index], DMA_BIDIRECTIONAL);
810 805
811 /* Input error checking is done when commands are added to queue. */ 806 /* Input error checking is done when commands are added to queue. */
812 if (meta->flags & CMD_WANT_SKB) { 807 if (meta->flags & CMD_WANT_SKB) {