From 176f0e841e944db044b4c3d66903965f63d79b4f Mon Sep 17 00:00:00 2001 From: Sujith Manoharan Date: Tue, 23 Apr 2013 12:22:19 +0530 Subject: [PATCH] ath9k: Fix RX DMA mapping After the commit "ath9k: improve dma map failure handling", the wrong buffer was DMA-unmapped, introducing warnings like the one below. This patch fixes the issue. WARNING: at /home/sujith/dev/wireless-testing/lib/dma-debug.c:986 check_sync+0x4bc/0x580() Hardware name: LIFEBOOK AH531 ath9k 0000:02:00.0: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x00000000d9012800] [size=48 bytes] Pid: 86, comm: kworker/u:5 Tainted: G W O 3.9.0-rc8-wl-debug #106 Call Trace: [] warn_slowpath_common+0x70/0xa0 [] warn_slowpath_fmt+0x4c/0x50 [] check_sync+0x4bc/0x580 [] ? trace_hardirqs_on_caller+0xa7/0x190 [] ? trace_hardirqs_on+0xd/0x10 [] debug_dma_sync_single_for_device+0x48/0x50 [] ? ath9k_iowrite32+0x35/0x90 [ath9k] [] ? swiotlb_tbl_sync_single+0x50/0x90 [] ? swiotlb_sync_single+0x20/0x30 [] ? swiotlb_sync_single_for_device+0xf/0x20 [] ath_rx_edma_buf_link+0xef/0x140 [ath9k] [] ath_rx_addbuffer_edma+0x4e/0x90 [ath9k] [] ath_startrecv+0xf1/0x120 [ath9k] [] ath_complete_reset+0x20/0x130 [ath9k] [] ath_reset_internal+0x10d/0x210 [ath9k] [] ath9k_config+0x47c/0x7b0 [ath9k] [] ieee80211_hw_config+0x88/0x3f0 [mac80211] [] ? ieee80211_hw_config+0x14f/0x3f0 [mac80211] [] __ieee80211_scan_completed+0xc1/0x440 [mac80211] [] ieee80211_scan_work+0x82/0x440 [mac80211] [] process_one_work+0x1e3/0x530 [] ? process_one_work+0x181/0x530 [] worker_thread+0x10f/0x3c0 [] ? manage_workers+0x330/0x330 [] kthread+0xea/0xf0 [] ? kthread_create_on_node+0x140/0x140 [] ret_from_fork+0x7c/0xb0 [] ? kthread_create_on_node+0x140/0x140 Cc: Felix Fietkau Signed-off-by: Sujith Manoharan Acked-by: Felix Fietkau Signed-off-by: John W. Linville --- drivers/net/wireless/ath/ath9k/recv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c index 9c0045e..8be2b5d 100644 --- a/drivers/net/wireless/ath/ath9k/recv.c +++ b/drivers/net/wireless/ath/ath9k/recv.c @@ -1279,13 +1279,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) goto requeue_drop_frag; } - bf->bf_mpdu = requeue_skb; - bf->bf_buf_addr = new_buf_addr; - /* Unmap the frame */ dma_unmap_single(sc->dev, bf->bf_buf_addr, common->rx_bufsize, dma_type); + bf->bf_mpdu = requeue_skb; + bf->bf_buf_addr = new_buf_addr; + skb_put(skb, rs.rs_datalen + ah->caps.rx_status_len); if (ah->caps.rx_status_len) skb_pull(skb, ah->caps.rx_status_len); -- 2.7.4