All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Sridhar Samudrala <sri@us.ibm.com>,
	Mark McLoughlin <markmc@redhat.com>,
	Danielius Kudinskas <kudinskas@uk.ibm.com>,
	aliguori@linux.vnet.ibm.com, Paul T Knowles <pablo@uk.ibm.com>,
	netdev@vger.kernel.org
Subject: [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path
Date: Fri, 12 Jun 2009 08:29:22 +0930	[thread overview]
Message-ID: <200906120829.23999.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20090611205003.GA8677@gondor.apana.org.au>

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>

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


  reply	other threads:[~2009-06-11 22:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF1B881599.F1B4A2EF-ON802575BB.0036EA40-802575BC.0041BFB5@au1.ibm.com>
     [not found] ` <200905251601.29327.rusty@rustcorp.com.au>
     [not found]   ` <1243268223.32745.25.camel@blaa>
2009-06-10  5:12     ` virtio-net header alignment Herbert Xu
2009-06-11 12:39       ` David Miller
2009-06-11 18:01       ` Sridhar Samudrala
2009-06-11 20:50         ` Herbert Xu
2009-06-11 22:59           ` Rusty Russell [this message]
2009-06-12  3:55             ` [PATCH] virtio_net: Fix IP alignment on non-mergeable RX path David Miller

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=200906120829.23999.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kudinskas@uk.ibm.com \
    --cc=markmc@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@uk.ibm.com \
    --cc=sri@us.ibm.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.