[brcm47xx] use vmalloc instead of kmalloc when reserving space for the lzma initramfs...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 511-b43-refresh-rx-poison-on-buffer-recycling.patch
1 The RX buffer poison needs to be refreshed, if we recycle an RX buffer,
2 because it might be (partially) overwritten by some DMA operations.
3
4 Cc: stable@kernel.org
5 Cc: Francesco Gringoli <francesco.gringoli@ing.unibs.it>
6 Signed-off-by: Michael Buesch <mb@bu3sch.de>
7
8 ---
9
10 --- a/drivers/net/wireless/b43/dma.c
11 +++ b/drivers/net/wireless/b43/dma.c
12 @@ -1503,20 +1503,16 @@ static void dma_rx(struct b43_dmaring *r
13 len = le16_to_cpu(rxhdr->frame_len);
14 } while (len == 0 && i++ < 5);
15 if (unlikely(len == 0)) {
16 - /* recycle the descriptor buffer. */
17 - sync_descbuffer_for_device(ring, meta->dmaaddr,
18 - ring->rx_buffersize);
19 - goto drop;
20 + dmaaddr = meta->dmaaddr;
21 + goto drop_recycle_buffer;
22 }
23 }
24 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
25 /* Something went wrong with the DMA.
26 * The device did not touch the buffer and did not overwrite the poison. */
27 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
28 - /* recycle the descriptor buffer. */
29 - sync_descbuffer_for_device(ring, meta->dmaaddr,
30 - ring->rx_buffersize);
31 - goto drop;
32 + dmaaddr = meta->dmaaddr;
33 + goto drop_recycle_buffer;
34 }
35 if (unlikely(len > ring->rx_buffersize)) {
36 /* The data did not fit into one descriptor buffer
37 @@ -1530,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *r
38 while (1) {
39 desc = ops->idx2desc(ring, *slot, &meta);
40 /* recycle the descriptor buffer. */
41 + b43_poison_rx_buffer(ring, meta->skb);
42 sync_descbuffer_for_device(ring, meta->dmaaddr,
43 ring->rx_buffersize);
44 *slot = next_slot(ring, *slot);
45 @@ -1548,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *r
46 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
47 if (unlikely(err)) {
48 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
49 - sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
50 - goto drop;
51 + goto drop_recycle_buffer;
52 }
53
54 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
55 @@ -1559,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *r
56 b43_rx(ring->dev, skb, rxhdr);
57 drop:
58 return;
59 +
60 +drop_recycle_buffer:
61 + /* Poison and recycle the RX buffer. */
62 + b43_poison_rx_buffer(ring, skb);
63 + sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
64 }
65
66 void b43_dma_rx(struct b43_dmaring *ring)