diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-06-04 16:25:38 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-07-08 22:16:40 -0400 |
commit | f65a71775cc3eb5d5d8ac4c349c8f48a7d5c7759 (patch) | |
tree | 7733077740f8af58631f478998a6fd3fa9a0a1e7 /drivers/net/b44.c | |
parent | a72a8179734393ca351f6ecf8cad6841ab7e1470 (diff) |
b44: tx bounce sizing.
No need to grap full size MTU buffer for possibly small transmit
bounce buffers.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/b44.c')
-rw-r--r-- | drivers/net/b44.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index e87bab9f9bea..d10d31cd12d7 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -69,7 +69,6 @@ | |||
69 | #define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1)) | 69 | #define NEXT_TX(N) (((N) + 1) & (B44_TX_RING_SIZE - 1)) |
70 | 70 | ||
71 | #define RX_PKT_BUF_SZ (1536 + bp->rx_offset + 64) | 71 | #define RX_PKT_BUF_SZ (1536 + bp->rx_offset + 64) |
72 | #define TX_PKT_BUF_SZ (B44_MAX_MTU + ETH_HLEN + 8) | ||
73 | 72 | ||
74 | /* minimum number of free TX descriptors required to wake up TX process */ | 73 | /* minimum number of free TX descriptors required to wake up TX process */ |
75 | #define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4) | 74 | #define B44_TX_WAKEUP_THRESH (B44_TX_RING_SIZE / 4) |
@@ -968,7 +967,6 @@ static void b44_tx_timeout(struct net_device *dev) | |||
968 | static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | 967 | static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) |
969 | { | 968 | { |
970 | struct b44 *bp = netdev_priv(dev); | 969 | struct b44 *bp = netdev_priv(dev); |
971 | struct sk_buff *bounce_skb; | ||
972 | int rc = NETDEV_TX_OK; | 970 | int rc = NETDEV_TX_OK; |
973 | dma_addr_t mapping; | 971 | dma_addr_t mapping; |
974 | u32 len, entry, ctrl; | 972 | u32 len, entry, ctrl; |
@@ -986,12 +984,13 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
986 | 984 | ||
987 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); | 985 | mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE); |
988 | if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { | 986 | if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { |
987 | struct sk_buff *bounce_skb; | ||
988 | |||
989 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ | 989 | /* Chip can't handle DMA to/from >1GB, use bounce buffer */ |
990 | if (!dma_mapping_error(mapping)) | 990 | if (!dma_mapping_error(mapping)) |
991 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); | 991 | pci_unmap_single(bp->pdev, mapping, len, PCI_DMA_TODEVICE); |
992 | 992 | ||
993 | bounce_skb = __dev_alloc_skb(TX_PKT_BUF_SZ, | 993 | bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA); |
994 | GFP_ATOMIC|GFP_DMA); | ||
995 | if (!bounce_skb) | 994 | if (!bounce_skb) |
996 | goto err_out; | 995 | goto err_out; |
997 | 996 | ||
@@ -1000,13 +999,12 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1000 | if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { | 999 | if (dma_mapping_error(mapping) || mapping + len > DMA_30BIT_MASK) { |
1001 | if (!dma_mapping_error(mapping)) | 1000 | if (!dma_mapping_error(mapping)) |
1002 | pci_unmap_single(bp->pdev, mapping, | 1001 | pci_unmap_single(bp->pdev, mapping, |
1003 | len, PCI_DMA_TODEVICE); | 1002 | len, PCI_DMA_TODEVICE); |
1004 | dev_kfree_skb_any(bounce_skb); | 1003 | dev_kfree_skb_any(bounce_skb); |
1005 | goto err_out; | 1004 | goto err_out; |
1006 | } | 1005 | } |
1007 | 1006 | ||
1008 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), | 1007 | skb_copy_from_linear_data(skb, skb_put(bounce_skb, len), len); |
1009 | skb->len); | ||
1010 | dev_kfree_skb_any(skb); | 1008 | dev_kfree_skb_any(skb); |
1011 | skb = bounce_skb; | 1009 | skb = bounce_skb; |
1012 | } | 1010 | } |