xen-netfront: Avoid unaligned accesses to IP header
authorIsaku Yamahata <yamahata@valinux.co.jp>
Wed, 15 Oct 2008 00:50:42 +0000 (17:50 -0700)
committerJeff Garzik <jgarzik@redhat.com>
Thu, 16 Oct 2008 09:11:07 +0000 (05:11 -0400)
Align ip header to a 16 byte boundary to avoid unaligned
access like other drivers.
Without this patch, xen-netfront doesn't work well on ia64.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/xen-netfront.c

index c749bdba214ce1fb686daaa2c80eda4237f49fcc..9ffe743f4eb1cac391cdc65d163180a211de4d6e 100644 (file)
@@ -239,11 +239,14 @@ static void xennet_alloc_rx_buffers(struct net_device *dev)
         */
        batch_target = np->rx_target - (req_prod - np->rx.rsp_cons);
        for (i = skb_queue_len(&np->rx_batch); i < batch_target; i++) {
-               skb = __netdev_alloc_skb(dev, RX_COPY_THRESHOLD,
+               skb = __netdev_alloc_skb(dev, RX_COPY_THRESHOLD + NET_IP_ALIGN,
                                         GFP_ATOMIC | __GFP_NOWARN);
                if (unlikely(!skb))
                        goto no_skb;
 
+               /* Align ip header to a 16 bytes boundary */
+               skb_reserve(skb, NET_IP_ALIGN);
+
                page = alloc_page(GFP_ATOMIC | __GFP_NOWARN);
                if (!page) {
                        kfree_skb(skb);