[openib-general] [PATCH] IB/ipoib: DMA alignment on ppc64
Michael S. Tsirkin
mst at mellanox.co.il
Mon Nov 13 01:55:49 PST 2006
Unaligned DMA is slow ppc64 systems - that's why this architecture
overrides NET_IP_ALIGN. IPoIB should take this into account and align
DMA on this platform.
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>
---
Roland, what do you think?
This comes from reading linux/skbuff.h and asm-powerpc/system.h - I
don't actually have a ppc64 to test the performance impact.
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 8bf5e9e..cec1cb4 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -125,7 +125,7 @@ static int ipoib_alloc_rx_skb(struct net
struct sk_buff *skb;
dma_addr_t addr;
- skb = dev_alloc_skb(IPOIB_BUF_SIZE + 4);
+ skb = dev_alloc_skb(IPOIB_BUF_SIZE + (NET_IP_ALIGN ? 4 : 0));
if (!skb)
return -ENOMEM;
@@ -133,8 +133,12 @@ static int ipoib_alloc_rx_skb(struct net
* IB will leave a 40 byte gap for a GRH and IPoIB adds a 4 byte
* header. So we need 4 more bytes to get to 48 and align the
* IP header to a multiple of 16.
+ *
+ * But don't do this on architectures that override NET_IP_ALIGN -
+ * see comment in linux/skbuff.h for reasons why.
*/
- skb_reserve(skb, 4);
+ if (NET_IP_ALIGN)
+ skb_reserve(skb, 4);
addr = dma_map_single(priv->ca->dma_device,
skb->data, IPOIB_BUF_SIZE,
--
MST
More information about the general
mailing list