Patchwork [3,of,5] xen-netfront: Avoid unaligned accesses to IP header

login
register
mail settings
Submitter Jeremy Fitzhardinge
Date Oct. 15, 2008, 12:50 a.m.
Message ID <d3d2ad0d95db689f77ab.1224031842@abulafia.goop.org>
Download mbox | patch
Permalink /patch/4539/
State Accepted
Delegated to: Jeff Garzik
Headers show

Comments

Jeremy Fitzhardinge - Oct. 15, 2008, 12:50 a.m.
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(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Garzik - Oct. 16, 2008, 9:12 a.m.
Jeremy Fitzhardinge wrote:
> 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(-)

applied


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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) {