Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=8dc121a4b620090e594945fd36f878836fc5a14a
Commit:     8dc121a4b620090e594945fd36f878836fc5a14a
Parent:     9a50bebda95745d312c69d3bb6d788067cbefb84
Author:     Olof Johansson <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 2 16:26:53 2007 -0500
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Oct 10 16:54:25 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 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 c538c66..b3994f5 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -37,6 +37,12 @@
 
 #include "pasemi_mac.h"
 
+/* We have our own align, since ppc64 in general has it at 0 because
+ * of design flaws in some of the 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.
+ */
+#define LOCAL_SKB_ALIGN        2
 
 /* TODO list
  *
@@ -409,13 +415,16 @@ static void pasemi_mac_replenish_rx_ring(struct 
net_device *dev, int limit)
                /* skb might still be in there for recycle on short receives */
                if (info->skb)
                        skb = info->skb;
-               else
+               else {
                        skb = dev_alloc_skb(BUF_SIZE);
+                       skb_reserve(skb, LOCAL_SKB_ALIGN);
+               }
 
                if (unlikely(!skb))
                        break;
 
-               dma = pci_map_single(mac->dma_pdev, skb->data, BUF_SIZE,
+               dma = pci_map_single(mac->dma_pdev, skb->data,
+                                    BUF_SIZE - LOCAL_SKB_ALIGN,
                                     PCI_DMA_FROMDEVICE);
 
                if (unlikely(dma_mapping_error(dma))) {
@@ -553,10 +562,12 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, 
int limit)
                len = (macrx & XCT_MACRX_LLEN_M) >> XCT_MACRX_LLEN_S;
 
                if (len < 256) {
-                       struct sk_buff *new_skb =
-                           netdev_alloc_skb(mac->netdev, len + NET_IP_ALIGN);
+                       struct sk_buff *new_skb;
+
+                       new_skb = netdev_alloc_skb(mac->netdev,
+                                                  len + LOCAL_SKB_ALIGN);
                        if (new_skb) {
-                               skb_reserve(new_skb, NET_IP_ALIGN);
+                               skb_reserve(new_skb, LOCAL_SKB_ALIGN);
                                memcpy(new_skb->data, skb->data, len);
                                /* save the skb in buffer_info as good */
                                skb = new_skb;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to