Subject: tun: Fix csum_start computation
Date: Fri, 13 Jun 2008 14:27:37 +0100
From: Mark McLoughlin <markmc@redhat.com>

virtio_net_hdr's csum_start is relative to the start
of the ethernet header. skb.csum_start is relative
to skb->head.

In skb_partial_csum set() we add the headroom to the
supplied csum_start to get skb->head.

However, when tun.c:xmit_packets() gets around to
calling it, the ethernet head has been pulled into
the skb headroom. Therefore we need to supply a
csum_start which is relative to the IP header.

(Fixes misc:tun-xmit-vring.patch)

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
---
 drivers/net/tun.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2d0c16a..75362ce 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -642,7 +642,7 @@ static int xmit_packets(void *_tun)
 			return PTR_ERR(skb);
 
 		if ((h.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) &&
-		    !skb_partial_csum_set(skb, h.csum_start, h.csum_offset)) {
+		    !skb_partial_csum_set(skb, h.csum_start - ETH_HLEN, h.csum_offset)) {
 			kfree_skb(skb);
 			return -EINVAL;
 		}
