LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Jeff Garzik <jeff@garzik.org>
Cc: linux-kernel@vger.kernel.org,
	Isaku Yamahata <yamahata@valinux.co.jp>,
	NetDev <netdev@vger.kernel.org>, Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 3 of 5] xen-netfront: Avoid unaligned accesses to IP header
Date: Tue, 14 Oct 2008 17:50:42 -0700	[thread overview]
Message-ID: <d3d2ad0d95db689f77ab.1224031842@abulafia.goop.org> (raw)
In-Reply-To: <patchbomb.1224031839@abulafia.goop.org>

From: Isaku Yamahata <yamahata@valinux.co.jp>

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.

[ Jeff, this is the only patch in the series which is in your
  territory. -J ]

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
 drivers/net/xen-netfront.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -239,10 +239,13 @@
 	 */
 	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) {



  parent reply	other threads:[~2008-10-15  0:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15  0:50 [PATCH 0 of 5] xen: fix some things which make ia64 upset Jeremy Fitzhardinge
2008-10-15  0:50 ` [PATCH 1 of 5] xen: don't reload cr3 on suspend Jeremy Fitzhardinge
2008-10-15  0:50 ` [PATCH 2 of 5] xen: portability clean up and some minor clean up for xencomm.c Jeremy Fitzhardinge
2008-10-15  0:50 ` Jeremy Fitzhardinge [this message]
2008-10-16  9:12   ` [PATCH 3 of 5] xen-netfront: Avoid unaligned accesses to IP header Jeff Garzik
2008-10-15  0:50 ` [PATCH 4 of 5] xen: compilation fix fo xen CPU hotplugging Jeremy Fitzhardinge
2008-10-15  0:50 ` [PATCH 5 of 5] xen: compilation fix of drivers/xen/events.c on IA64 Jeremy Fitzhardinge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3d2ad0d95db689f77ab.1224031842@abulafia.goop.org \
    --to=jeremy@goop.org \
    --cc=jeff@garzik.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=yamahata@valinux.co.jp \
    --subject='Re: [PATCH 3 of 5] xen-netfront: Avoid unaligned accesses to IP header' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).