diff options
author | Olof Johansson <olof@lixom.net> | 2007-10-02 17:26:53 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:25 -0400 |
commit | 8dc121a4b620090e594945fd36f878836fc5a14a (patch) | |
tree | 1be4e5078a4a7dee15e0a7bc2690707312ee72a7 /drivers | |
parent | 9a50bebda95745d312c69d3bb6d788067cbefb84 (diff) |
pasemi_mac: add local skb alignment
pasemi_mac: add local skb alignment
Add local SKB alignment to pasemi_mac, since ppc64 in general has it at 0
because of design flaws in some of the IBM server bridge chips. However,
for PWRficient doing the unaligned copies is more expensive than doing
unaligned DMA so make sure the data is aligned instead.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/pasemi_mac.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index c538c66d4b4f..b3994f5d2d2b 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -37,6 +37,12 @@ | |||
37 | 37 | ||
38 | #include "pasemi_mac.h" | 38 | #include "pasemi_mac.h" |
39 | 39 | ||
40 | /* We have our own align, since ppc64 in general has it at 0 because | ||
41 | * of design flaws in some of the server bridge chips. However, for | ||
42 | * PWRficient doing the unaligned copies is more expensive than doing | ||
43 | * unaligned DMA, so make sure the data is aligned instead. | ||
44 | */ | ||
45 | #define LOCAL_SKB_ALIGN 2 | ||
40 | 46 | ||
41 | /* TODO list | 47 | /* TODO list |
42 | * | 48 | * |
@@ -409,13 +415,16 @@ static void pasemi_mac_replenish_rx_ring(struct net_device *dev, int limit) | |||
409 | /* skb might still be in there for recycle on short receives */ | 415 | /* skb might still be in there for recycle on short receives */ |
410 | if (info->skb) | 416 | if (info->skb) |
411 | skb = info->skb; | 417 | skb = info->skb; |
412 | else | 418 | else { |
413 | skb = dev_alloc_skb(BUF_SIZE); | 419 | skb = dev_alloc_skb(BUF_SIZE); |
420 | skb_reserve(skb, LOCAL_SKB_ALIGN); | ||
421 | } | ||
414 | 422 | ||
415 | if (unlikely(!skb)) | 423 | if (unlikely(!skb)) |
416 | break; | 424 | break; |
417 | 425 | ||
418 | dma = pci_map_single(mac->dma_pdev, skb->data, BUF_SIZE, | 426 | dma = pci_map_single(mac->dma_pdev, skb->data, |
427 | BUF_SIZE - LOCAL_SKB_ALIGN, | ||
419 | PCI_DMA_FROMDEVICE); | 428 | PCI_DMA_FROMDEVICE); |
420 | 429 | ||
421 | if (unlikely(dma_mapping_error(dma))) { | 430 | if (unlikely(dma_mapping_error(dma))) { |
@@ -553,10 +562,12 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit) | |||
553 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; | 562 | len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S; |
554 | 563 | ||
555 | if (len < 256) { | 564 | if (len < 256) { |
556 | struct sk_buff *new_skb = | 565 | struct sk_buff *new_skb; |
557 | netdev_alloc_skb(mac->netdev, len + NET_IP_ALIGN); | 566 | |
567 | new_skb = netdev_alloc_skb(mac->netdev, | ||
568 | len + LOCAL_SKB_ALIGN); | ||
558 | if (new_skb) { | 569 | if (new_skb) { |
559 | skb_reserve(new_skb, NET_IP_ALIGN); | 570 | skb_reserve(new_skb, LOCAL_SKB_ALIGN); |
560 | memcpy(new_skb->data, skb->data, len); | 571 | memcpy(new_skb->data, skb->data, len); |
561 | /* save the skb in buffer_info as good */ | 572 | /* save the skb in buffer_info as good */ |
562 | skb = new_skb; | 573 | skb = new_skb; |