diff mbox

virtio_net: Fix IP alignment on non-mergeable RX path

Message ID 200906120829.23999.rusty@rustcorp.com.au
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Rusty Russell June 11, 2009, 10:59 p.m. UTC
From: Herbert Xu <herbert@gondor.apana.org.au>

We need to enforce the IP alignment on the non-mergeable RX path just
like the other RX path.  Not doing so results in misaligned IP
headers.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>


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

Comments

David Miller June 12, 2009, 3:55 a.m. UTC | #1
From: Rusty Russell <rusty@rustcorp.com.au>
Date: Fri, 12 Jun 2009 08:29:22 +0930

> From: Herbert Xu <herbert@gondor.apana.org.au>
> 
> We need to enforce the IP alignment on the non-mergeable RX path just
> like the other RX path.  Not doing so results in misaligned IP
> headers.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Applied, thanks everyone.
--
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
diff mbox

Patch

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4d1d479..52fba8e 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -283,10 +283,11 @@  static void try_fill_recv_maxbufs(struct virtnet_info *vi)
 	for (;;) {
 		struct virtio_net_hdr *hdr;
 
-		skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN);
+		skb = netdev_alloc_skb(vi->dev, MAX_PACKET_LEN + NET_IP_ALIGN);
 		if (unlikely(!skb))
 			break;
 
+		skb_reserve(skb, NET_IP_ALIGN);
 		skb_put(skb, MAX_PACKET_LEN);
 
 		hdr = skb_vnet_hdr(skb);