netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* virtio_net: Set correct gso->hdr_len
@ 2009-06-04 10:59 Herbert Xu
  2009-06-05  4:21 ` Rusty Russell
  2009-06-08  7:22 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Herbert Xu @ 2009-06-04 10:59 UTC (permalink / raw)
  To: Rusty Russell, David S. Miller, netdev

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);
 		hdr->gso_size = skb_shinfo(skb)->gso_size;
 		if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV4)
 			hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-06-08  7:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 10:59 virtio_net: Set correct gso->hdr_len Herbert Xu
2009-06-05  4:21 ` Rusty Russell
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

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