From f88efb1bee25b18e78c6d15781dc5e0184de0b61 Mon Sep 17 00:00:00 2001 From: mb Date: Mon, 6 Apr 2009 17:15:19 +0000 Subject: b43: Add DMA poisoning patches git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15121 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ...b43-refresh-rx-poison-on-buffer-recycling.patch | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 package/mac80211/patches/511-b43-refresh-rx-poison-on-buffer-recycling.patch (limited to 'package/mac80211/patches/511-b43-refresh-rx-poison-on-buffer-recycling.patch') diff --git a/package/mac80211/patches/511-b43-refresh-rx-poison-on-buffer-recycling.patch b/package/mac80211/patches/511-b43-refresh-rx-poison-on-buffer-recycling.patch new file mode 100644 index 000000000..e72a61ff0 --- /dev/null +++ b/package/mac80211/patches/511-b43-refresh-rx-poison-on-buffer-recycling.patch @@ -0,0 +1,68 @@ +The RX buffer poison needs to be refreshed, if we recycle an RX buffer, +because it might be (partially) overwritten by some DMA operations. + +Cc: stable@kernel.org +Cc: Francesco Gringoli +Signed-off-by: Michael Buesch + +--- + +Index: compat-wireless-2009-03-31/drivers/net/wireless/b43/dma.c +=================================================================== +--- compat-wireless-2009-03-31.orig/drivers/net/wireless/b43/dma.c 2009-04-06 18:52:30.000000000 +0200 ++++ compat-wireless-2009-03-31/drivers/net/wireless/b43/dma.c 2009-04-06 18:53:04.000000000 +0200 +@@ -1503,20 +1503,16 @@ static void dma_rx(struct b43_dmaring *r + len = le16_to_cpu(rxhdr->frame_len); + } while (len == 0 && i++ < 5); + if (unlikely(len == 0)) { +- /* recycle the descriptor buffer. */ +- sync_descbuffer_for_device(ring, meta->dmaaddr, +- ring->rx_buffersize); +- goto drop; ++ dmaaddr = meta->dmaaddr; ++ goto drop_recycle_buffer; + } + } + if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) { + /* Something went wrong with the DMA. + * The device did not touch the buffer and did not overwrite the poison. */ + b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n"); +- /* recycle the descriptor buffer. */ +- sync_descbuffer_for_device(ring, meta->dmaaddr, +- ring->rx_buffersize); +- goto drop; ++ dmaaddr = meta->dmaaddr; ++ goto drop_recycle_buffer; + } + if (unlikely(len > ring->rx_buffersize)) { + /* The data did not fit into one descriptor buffer +@@ -1530,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *r + while (1) { + desc = ops->idx2desc(ring, *slot, &meta); + /* recycle the descriptor buffer. */ ++ b43_poison_rx_buffer(ring, meta->skb); + sync_descbuffer_for_device(ring, meta->dmaaddr, + ring->rx_buffersize); + *slot = next_slot(ring, *slot); +@@ -1548,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *r + err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); + if (unlikely(err)) { + b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); +- sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); +- goto drop; ++ goto drop_recycle_buffer; + } + + unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); +@@ -1559,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *r + b43_rx(ring->dev, skb, rxhdr); + drop: + return; ++ ++drop_recycle_buffer: ++ /* Poison and recycle the RX buffer. */ ++ b43_poison_rx_buffer(ring, skb); ++ sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); + } + + void b43_dma_rx(struct b43_dmaring *ring) -- cgit v1.2.3