e72a61ff0d189a4f85642b7ca84da9c3a82d7b7f
[openwrt.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 Index: compat-wireless-2009-03-31/drivers/net/wireless/b43/dma.c
11 ===================================================================
12 --- compat-wireless-2009-03-31.orig/drivers/net/wireless/b43/dma.c 2009-04-06 18:52:30.000000000 +0200
13 +++ compat-wireless-2009-03-31/drivers/net/wireless/b43/dma.c 2009-04-06 18:53:04.000000000 +0200
14 @@ -1503,20 +1503,16 @@ static void dma_rx(struct b43_dmaring *r
15 len = le16_to_cpu(rxhdr->frame_len);
16 } while (len == 0 && i++ < 5);
17 if (unlikely(len == 0)) {
18 - /* recycle the descriptor buffer. */
19 - sync_descbuffer_for_device(ring, meta->dmaaddr,
20 - ring->rx_buffersize);
21 - goto drop;
22 + dmaaddr = meta->dmaaddr;
23 + goto drop_recycle_buffer;
24 }
25 }
26 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
27 /* Something went wrong with the DMA.
28 * The device did not touch the buffer and did not overwrite the poison. */
29 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
30 - /* recycle the descriptor buffer. */
31 - sync_descbuffer_for_device(ring, meta->dmaaddr,
32 - ring->rx_buffersize);
33 - goto drop;
34 + dmaaddr = meta->dmaaddr;
35 + goto drop_recycle_buffer;
36 }
37 if (unlikely(len > ring->rx_buffersize)) {
38 /* The data did not fit into one descriptor buffer
39 @@ -1530,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *r
40 while (1) {
41 desc = ops->idx2desc(ring, *slot, &meta);
42 /* recycle the descriptor buffer. */
43 + b43_poison_rx_buffer(ring, meta->skb);
44 sync_descbuffer_for_device(ring, meta->dmaaddr,
45 ring->rx_buffersize);
46 *slot = next_slot(ring, *slot);
47 @@ -1548,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *r
48 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
49 if (unlikely(err)) {
50 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
51 - sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
52 - goto drop;
53 + goto drop_recycle_buffer;
54 }
55
56 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
57 @@ -1559,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *r
58 b43_rx(ring->dev, skb, rxhdr);
59 drop:
60 return;
61 +
62 +drop_recycle_buffer:
63 + /* Poison and recycle the RX buffer. */
64 + b43_poison_rx_buffer(ring, skb);
65 + sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
66 }
67
68 void b43_dma_rx(struct b43_dmaring *ring)
This page took 0.044426 seconds and 3 git commands to generate.