@@ -126,7 +126,7 @@ static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
126126}
127127
128128static void iwlagn_unmap_tfd (struct iwl_priv * priv , struct iwl_cmd_meta * meta ,
129- struct iwl_tfd * tfd )
129+ struct iwl_tfd * tfd , int dma_dir )
130130{
131131 struct pci_dev * dev = priv -> pci_dev ;
132132 int i ;
@@ -151,7 +151,7 @@ static void iwlagn_unmap_tfd(struct iwl_priv *priv, struct iwl_cmd_meta *meta,
151151 /* Unmap chunks, if any. */
152152 for (i = 1 ; i < num_tbs ; i ++ )
153153 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 );
155155}
156156
157157/**
@@ -167,7 +167,8 @@ void iwlagn_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
167167 struct iwl_tfd * tfd_tmp = txq -> tfds ;
168168 int index = txq -> q .read_ptr ;
169169
170- iwlagn_unmap_tfd (priv , & txq -> meta [index ], & tfd_tmp [index ]);
170+ iwlagn_unmap_tfd (priv , & txq -> meta [index ], & tfd_tmp [index ],
171+ PCI_DMA_TODEVICE );
171172
172173 /* free SKB */
173174 if (txq -> txb ) {
@@ -310,9 +311,7 @@ void iwl_cmd_queue_unmap(struct iwl_priv *priv)
310311 i = get_cmd_index (q , q -> read_ptr );
311312
312313 if (txq -> meta [i ].flags & CMD_MAPPED ) {
313- pci_unmap_single (priv -> pci_dev ,
314- dma_unmap_addr (& txq -> meta [i ], mapping ),
315- dma_unmap_len (& txq -> meta [i ], len ),
314+ iwlagn_unmap_tfd (priv , & txq -> meta [i ], & txq -> tfds [i ],
316315 PCI_DMA_BIDIRECTIONAL );
317316 txq -> meta [i ].flags = 0 ;
318317 }
@@ -535,12 +534,7 @@ int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
535534void iwl_tx_queue_reset (struct iwl_priv * priv , struct iwl_tx_queue * txq ,
536535 int slots_num , u32 txq_id )
537536{
538- int actual_slots = slots_num ;
539-
540- if (txq_id == priv -> cmd_queue )
541- actual_slots ++ ;
542-
543- memset (txq -> meta , 0 , sizeof (struct iwl_cmd_meta ) * actual_slots );
537+ memset (txq -> meta , 0 , sizeof (struct iwl_cmd_meta ) * slots_num );
544538
545539 txq -> need_update = 0 ;
546540
@@ -700,10 +694,11 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
700694 if (!(cmd -> dataflags [i ] & IWL_HCMD_DFL_NOCOPY ))
701695 continue ;
702696 phys_addr = pci_map_single (priv -> pci_dev , (void * )cmd -> data [i ],
703- cmd -> len [i ], PCI_DMA_TODEVICE );
697+ cmd -> len [i ], PCI_DMA_BIDIRECTIONAL );
704698 if (pci_dma_mapping_error (priv -> pci_dev , phys_addr )) {
705699 iwlagn_unmap_tfd (priv , out_meta ,
706- & txq -> tfds [q -> write_ptr ]);
700+ & txq -> tfds [q -> write_ptr ],
701+ PCI_DMA_BIDIRECTIONAL );
707702 idx = - ENOMEM ;
708703 goto out ;
709704 }
@@ -807,7 +802,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
807802 cmd = txq -> cmd [cmd_index ];
808803 meta = & txq -> meta [cmd_index ];
809804
810- iwlagn_unmap_tfd (priv , meta , & txq -> tfds [index ]);
805+ iwlagn_unmap_tfd (priv , meta , & txq -> tfds [index ], PCI_DMA_BIDIRECTIONAL );
811806
812807 /* Input error checking is done when commands are added to queue. */
813808 if (meta -> flags & CMD_WANT_SKB ) {
0 commit comments