Skip to content

Commit

Permalink
iwlagn: fix DMA sync
Browse files Browse the repository at this point in the history
For the RX DMA fix for iwlwifi ("iwlagn: fix RX skb alignment") Luis
pointed out:

> aligned_dma_addr can obviously be > real_dma_addr at this point, what
> guarantees we can use it on our own whim?

I asked around, and he's right, there may be platforms that do not allow
passing such such an address to the DMA API functions. This patch
changes it by using the proper dma_sync_single_range_for_cpu API
invented for this purpose.

Cc: Luis R. Rodriguez <mcgrof@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Johannes Berg authored and John W. Linville committed Nov 25, 2008
1 parent 7e56b5d commit e91af0a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,9 +1384,11 @@ void iwl_rx_handle(struct iwl_priv *priv)

rxq->queue[i] = NULL;

pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->aligned_dma_addr,
priv->hw_params.rx_buf_size,
PCI_DMA_FROMDEVICE);
dma_sync_single_range_for_cpu(
&priv->pci_dev->dev, rxb->real_dma_addr,
rxb->aligned_dma_addr - rxb->real_dma_addr,
priv->hw_params.rx_buf_size,
PCI_DMA_FROMDEVICE);
pkt = (struct iwl_rx_packet *)rxb->skb->data;

/* Reclaim a command buffer only if this packet is a response
Expand Down

0 comments on commit e91af0a

Please sign in to comment.