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.
5 Cc: Francesco Gringoli <francesco.gringoli@ing.unibs.it>
6 Signed-off-by: Michael Buesch <mb@bu3sch.de>
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);
20 + dmaaddr = meta->dmaaddr;
21 + goto drop_recycle_buffer;
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);
32 + dmaaddr = meta->dmaaddr;
33 + goto drop_recycle_buffer;
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
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,
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);
48 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
49 - sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
51 + goto drop_recycle_buffer;
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);
61 + /* Poison and recycle the RX buffer. */
62 + b43_poison_rx_buffer(ring, skb);
63 + sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
66 void b43_dma_rx(struct b43_dmaring *ring)