diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2009-01-15 18:29:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-15 18:29:35 -0500 |
commit | a58c891a53aca81c78f9cbe0572a301042470e96 (patch) | |
tree | b81ac812625a701e30157877a6f563c89002cb92 /drivers | |
parent | 1c5625cf0f121486abad4da0e0251ec67765aa95 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/b44.c | 4 | ||||
-rw-r--r-- | 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 5ae131c147f9..c38512ebcea6 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) | |||
679 | dev_kfree_skb_any(skb); | 679 | dev_kfree_skb_any(skb); |
680 | return -ENOMEM; | 680 | return -ENOMEM; |
681 | } | 681 | } |
682 | bp->force_copybreak = 1; | ||
682 | } | 683 | } |
683 | 684 | ||
684 | rh = (struct rx_header *) skb->data; | 685 | rh = (struct rx_header *) skb->data; |
@@ -800,7 +801,7 @@ static int b44_rx(struct b44 *bp, int budget) | |||
800 | /* Omit CRC. */ | 801 | /* Omit CRC. */ |
801 | len -= 4; | 802 | len -= 4; |
802 | 803 | ||
803 | if (len > RX_COPY_THRESHOLD) { | 804 | if (!bp->force_copybreak && len > RX_COPY_THRESHOLD) { |
804 | int skb_size; | 805 | int skb_size; |
805 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); | 806 | skb_size = b44_alloc_rx_skb(bp, cons, bp->rx_prod); |
806 | if (skb_size < 0) | 807 | if (skb_size < 0) |
@@ -2152,6 +2153,7 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2152 | bp = netdev_priv(dev); | 2153 | bp = netdev_priv(dev); |
2153 | bp->sdev = sdev; | 2154 | bp->sdev = sdev; |
2154 | bp->dev = dev; | 2155 | bp->dev = dev; |
2156 | bp->force_copybreak = 0; | ||
2155 | 2157 | ||
2156 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); | 2158 | bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE); |
2157 | 2159 | ||
diff --git a/drivers/net/b44.h b/drivers/net/b44.h index 7db0c84a7950..e678498de6db 100644 --- a/drivers/net/b44.h +++ b/drivers/net/b44.h | |||
@@ -395,7 +395,7 @@ struct b44 { | |||
395 | u32 rx_pending; | 395 | u32 rx_pending; |
396 | u32 tx_pending; | 396 | u32 tx_pending; |
397 | u8 phy_addr; | 397 | u8 phy_addr; |
398 | 398 | u8 force_copybreak; | |
399 | struct mii_if_info mii_if; | 399 | struct mii_if_info mii_if; |
400 | }; | 400 | }; |
401 | 401 | ||