b44: GFP_DMA skb should not escape from driver

Previous thread: korina: do not use IRQF_SHARED with IRQF_DISABLED by Linux Kernel Mailing List on Thursday, January 15, 2009 - 7:05 pm. (1 message)

Next thread: sparc64: Fix UP build failure. by Linux Kernel Mailing List on Thursday, January 15, 2009 - 7:05 pm. (1 message)
From: Linux Kernel Mailing List
Date: Thursday, January 15, 2009 - 7:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a58c89...
Commit:     a58c891a53aca81c78f9cbe0572a301042470e96
Parent:     1c5625cf0f121486abad4da0e0251ec67765aa95
Author:     Eric Dumazet <dada1@cosmosbay.com>
AuthorDate: Thu Jan 15 15:29:35 2009 -0800
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Thu Jan 15 15:29:35 2009 -0800

    b44: GFP_DMA skb should not escape from driver
    
    b44 chip has some hardware limitations, that need GFP_DMA bounce
    buffers in some situations.
    
    In order to not deplete DMA zone, we should keep allocated GFP_DMA skb
    only for driver use. At rx time, we copy such skb to newly allocated
    skb, reusing existing copybreak infrastructure.
    
    On machines with low amount of memory, all skb meet the hardware limitation,
    so no copy is needed. We detect this situation using a new device flag, set
    to one if one GFP_DMA skb was ever allocated by b44_alloc_rx_skb().
    
    Previously allocated skb, even outside from DMA zone will then be recycled,
    to have minimal impact on DMA zone use.
    
    Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
    Tested-by: Ionut Leonte <ionut.leonte@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/b44.c |    4 +++-
 drivers/net/b44.h |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 5ae131c..c38512e 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -679,6 +679,7 @@ static int b44_alloc_rx_skb(struct b44 *bp, int src_idx, u32 dest_idx_unmasked)
 			dev_kfree_skb_any(skb);
 			return -ENOMEM;
 		}
+		bp->force_copybreak = 1;
 	}
 
 	rh = (struct rx_header *) skb->data;
@@ -800,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget)
 		/* Omit CRC. */
 		len -= 4;
 
-		if (len > RX_COPY_THRESHOLD) {
+		if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) {
 			int ...
Previous thread: korina: do not use IRQF_SHARED with IRQF_DISABLED by Linux Kernel Mailing List on Thursday, January 15, 2009 - 7:05 pm. (1 message)

Next thread: sparc64: Fix UP build failure. by Linux Kernel Mailing List on Thursday, January 15, 2009 - 7:05 pm. (1 message)