From 62b2ee8c1e8d4b3a28083f136dd915a11de2d4c0 Mon Sep 17 00:00:00 2001 From: Luis R. Rodriguez Date: Tue, 18 Nov 2008 19:06:51 -0800 Subject: [PATCH] ath9k: Fix SW-IOMMU bounce buffer starvation To: johannes@sipsolutions.net, linville@tuxdriver.com Cc: linux-wireless@vger.kernel.org This should fix the SW-IOMMU bounce buffer starvation seen ok kernel.org bugzilla 11811: http://bugzilla.kernel.org/show_bug.cgi?id=11811 Users on MacBook Pro 3.1 would see: DMA: Out of SW-IOMMU space for 4224 bytes at device 0000:0b:00.0 It is expected you will see a panic now, but that is a separate issue, we are working on trying to resolve that as well. Unfortunately its not easy to trigger as well on non MacBook Pro 3.1s so its difficult to debug. We were pci_unmap_single() less bytes than what we called for with pci_map_single() and as such we were starving the swiotlb from its 64MB amount of bounce buffers. Still not sure why this is so easily triggerable on MacBook Pro 3.1, it may be the hardware configuration tends to use more memory > 3GB mark for DMA. Signed-off-by: Maciej Zenczykowski Signed-off-by: Luis R. Rodriguez --- drivers/net/wireless/ath9k/recv.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index 20ddb7a..7b94539 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c @@ -1015,7 +1015,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) PCI_DMA_FROMDEVICE); pci_unmap_single(sc->pdev, bf->bf_buf_addr, - sc->sc_rxbufsize, + skb_end_pointer(skb) - skb->head, PCI_DMA_FROMDEVICE); /* XXX: Ah! make me more readable, use a helper */ -- 1.5.6.3