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: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: virtio_net: Set correct gso->hdr_len
Date: Fri, 5 Jun 2009 13:51:05 +0930	[thread overview]
Message-ID: <200906051351.06385.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20090604105917.GA28273@gondor.apana.org.au>

On Thu, 4 Jun 2009 08:29:18 pm Herbert Xu wrote:
> Hi:
>
> virtio_net: Set correct gso->hdr_len
>
> Through a bug in the tun driver, I noticed that virtio_net is
> producing bogus hdr_len values.  In particular, it only includes
> the IP header in the linear area, and excludes the entire TCP
> header.  This causes the TCP header to be copied twice for each
> packet.  (The bug omitted the second copy :)
>
> This patch corrects this.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 4d1d479..1c9cedd 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -470,7 +470,7 @@ static int xmit_skb(struct virtnet_info *vi, struct
> sk_buff *skb) }
>
>  	if (skb_is_gso(skb)) {
> -		hdr->hdr_len = skb_transport_header(skb) - skb->data;
> +		hdr->hdr_len = skb_headlen(skb);

Ouch!

But are we allowed to make the assumption that skb_headlen() == 
skb_transport_header(skb) + sizeof(transport header) ?  Or should we be 
checking that here?

Also how did this ever work?  Why are we getting packets through at all?

Damn, I'm away from my test boxes an I really want to benchmark this fix.
Rusty.

  reply	other threads:[~2009-06-05  4:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04 10:59 virtio_net: Set correct gso->hdr_len Herbert Xu
2009-06-05  4:21 ` Rusty Russell [this message]
2009-06-05  4:27   ` Herbert Xu
2009-06-05  6:50     ` Rusty Russell
2009-06-05  6:53       ` Herbert Xu
2009-06-08  7:22 ` 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=200906051351.06385.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /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.