瀏覽代碼

ath9k: Synchronize DMA transfer with CPU at right place

This patch does pci_dma_sync_single_for_cpu() before accessing
the header of the frame and queueing the same buffer into h/w.

Signed-off-by: Vasanthakumar Thiagarajan <vasanth@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Vasanthakumar Thiagarajan 16 年之前
父節點
當前提交
9bf9fca8de
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      drivers/net/wireless/ath9k/recv.c

+ 10 - 4
drivers/net/wireless/ath9k/recv.c

@@ -519,6 +519,15 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
 		if (!skb)
 			continue;
 
+		/*
+		 * Synchronize the DMA transfer with CPU before
+		 * 1. accessing the frame
+		 * 2. requeueing the same buffer to h/w
+		 */
+		pci_dma_sync_single_for_cpu(sc->pdev, bf->bf_buf_addr,
+				sc->rx.bufsize,
+				PCI_DMA_FROMDEVICE);
+
 		/*
 		 * If we're asked to flush receive queue, directly
 		 * chain it back at the queue without processing it.
@@ -547,10 +556,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
 		if (!requeue_skb)
 			goto requeue;
 
-		/* Sync and unmap the frame */
-		pci_dma_sync_single_for_cpu(sc->pdev, bf->bf_buf_addr,
-					    sc->rx.bufsize,
-					    PCI_DMA_FROMDEVICE);
+		/* Unmap the frame */
 		pci_unmap_single(sc->pdev, bf->bf_buf_addr,
 				 sc->rx.bufsize,
 				 PCI_DMA_FROMDEVICE);