aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2009-03-27 19:41:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-16 10:39:03 -0400
commitcf68636a9773aa97915497fe54fa4a51e3f08f3a (patch)
tree8280b54bdceffc726a9b9f4cdff395a95998a302 /drivers
parentec9a1d8c13e36440eda0f3c79b8149080e3ab5ba (diff)
b43: Refresh RX poison on buffer recycling
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 <francesco.gringoli@ing.unibs.it> Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/dma.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
index dfa6c72c3bd2..eae680b53052 100644
--- a/drivers/net/wireless/b43/dma.c
+++ b/drivers/net/wireless/b43/dma.c
@@ -1503,20 +1503,16 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1503 len = le16_to_cpu(rxhdr->frame_len); 1503 len = le16_to_cpu(rxhdr->frame_len);
1504 } while (len == 0 && i++ < 5); 1504 } while (len == 0 && i++ < 5);
1505 if (unlikely(len == 0)) { 1505 if (unlikely(len == 0)) {
1506 /* recycle the descriptor buffer. */ 1506 dmaaddr = meta->dmaaddr;
1507 sync_descbuffer_for_device(ring, meta->dmaaddr, 1507 goto drop_recycle_buffer;
1508 ring->rx_buffersize);
1509 goto drop;
1510 } 1508 }
1511 } 1509 }
1512 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) { 1510 if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
1513 /* Something went wrong with the DMA. 1511 /* Something went wrong with the DMA.
1514 * The device did not touch the buffer and did not overwrite the poison. */ 1512 * The device did not touch the buffer and did not overwrite the poison. */
1515 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n"); 1513 b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
1516 /* recycle the descriptor buffer. */ 1514 dmaaddr = meta->dmaaddr;
1517 sync_descbuffer_for_device(ring, meta->dmaaddr, 1515 goto drop_recycle_buffer;
1518 ring->rx_buffersize);
1519 goto drop;
1520 } 1516 }
1521 if (unlikely(len > ring->rx_buffersize)) { 1517 if (unlikely(len > ring->rx_buffersize)) {
1522 /* The data did not fit into one descriptor buffer 1518 /* The data did not fit into one descriptor buffer
@@ -1530,6 +1526,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1530 while (1) { 1526 while (1) {
1531 desc = ops->idx2desc(ring, *slot, &meta); 1527 desc = ops->idx2desc(ring, *slot, &meta);
1532 /* recycle the descriptor buffer. */ 1528 /* recycle the descriptor buffer. */
1529 b43_poison_rx_buffer(ring, meta->skb);
1533 sync_descbuffer_for_device(ring, meta->dmaaddr, 1530 sync_descbuffer_for_device(ring, meta->dmaaddr,
1534 ring->rx_buffersize); 1531 ring->rx_buffersize);
1535 *slot = next_slot(ring, *slot); 1532 *slot = next_slot(ring, *slot);
@@ -1548,8 +1545,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1548 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); 1545 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
1549 if (unlikely(err)) { 1546 if (unlikely(err)) {
1550 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n"); 1547 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
1551 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); 1548 goto drop_recycle_buffer;
1552 goto drop;
1553 } 1549 }
1554 1550
1555 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); 1551 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
@@ -1559,6 +1555,11 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
1559 b43_rx(ring->dev, skb, rxhdr); 1555 b43_rx(ring->dev, skb, rxhdr);
1560drop: 1556drop:
1561 return; 1557 return;
1558
1559drop_recycle_buffer:
1560 /* Poison and recycle the RX buffer. */
1561 b43_poison_rx_buffer(ring, skb);
1562 sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
1562} 1563}
1563 1564
1564void b43_dma_rx(struct b43_dmaring *ring) 1565void b43_dma_rx(struct b43_dmaring *ring)