]> Pileus Git - ~andy/linux/blobdiff - drivers/net/wireless/b43/dma.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[~andy/linux] / drivers / net / wireless / b43 / dma.c
index 122146943bf204693b540b124f6c947bec34833b..f7c70b3a6ea978883f67f1abe0983cf51a476ada 100644 (file)
@@ -419,8 +419,6 @@ static inline
 
 static int alloc_ringmemory(struct b43_dmaring *ring)
 {
-       gfp_t flags = GFP_KERNEL;
-
        /* The specs call for 4K buffers for 30- and 32-bit DMA with 4K
         * alignment and 8K buffers for 64-bit DMA with 8K alignment.
         * In practice we could use smaller buffers for the latter, but the
@@ -435,12 +433,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
 
        ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
                                            ring_mem_size, &(ring->dmabase),
-                                           flags);
-       if (!ring->descbase) {
-               b43err(ring->dev->wl, "DMA ringmemory allocation failed\n");
+                                           GFP_KERNEL | __GFP_ZERO);
+       if (!ring->descbase)
                return -ENOMEM;
-       }
-       memset(ring->descbase, 0, ring_mem_size);
 
        return 0;
 }
@@ -1733,6 +1728,25 @@ drop_recycle_buffer:
        sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
 }
 
+void b43_dma_handle_rx_overflow(struct b43_dmaring *ring)
+{
+       int current_slot, previous_slot;
+
+       B43_WARN_ON(ring->tx);
+
+       /* Device has filled all buffers, drop all packets and let TCP
+        * decrease speed.
+        * Decrement RX index by one will let the device to see all slots
+        * as free again
+        */
+       /*
+       *TODO: How to increase rx_drop in mac80211?
+       */
+       current_slot = ring->ops->get_current_rxslot(ring);
+       previous_slot = prev_slot(ring, current_slot);
+       ring->ops->set_current_rxslot(ring, previous_slot);
+}
+
 void b43_dma_rx(struct b43_dmaring *ring)
 {
        const struct b43_dma_ops *ops = ring->ops;