netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael Chan" <mchan@broadcom.com>
To: "Herbert Xu" <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [3/5] [NET]: Add software TSOv4
Date: Fri, 23 Jun 2006 12:33:50 -0700	[thread overview]
Message-ID: <1151091230.6498.4.camel@rh4> (raw)
In-Reply-To: <20060622081400.GC22671@gondor.apana.org.au>

On Thu, 2006-06-22 at 18:14 +1000, Herbert Xu wrote:
> [NET]: Add software TSOv4
> 
> This patch adds the GSO implementation for IPv4 TCP.

Herbert, Looks like there were some problems in the CHECKSUM_HW case.
This patch should fix it.  Please double-check my checksum math.

[NET]: Fix CHECKSUM_HW GSO problems.

Fix the following 2 problems in the GSO code path for CHECKSUM_HW
packets:

1. Adjust ipv4 TCP pseudo header checksum.

2. Initialize skb->tail.

Signed-off-by: Michael Chan <mchan@broadcom.com>


diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8e5044b..3f19b3d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1954,6 +1954,7 @@ struct sk_buff *skb_segment(struct sk_bu
 		nskb->data_len = len - hsize;
 		nskb->len += nskb->data_len;
 		nskb->truesize += nskb->data_len;
+		nskb->tail += nskb->data_len;
 	} while ((offset += len) < skb->len);
 
 	return segs;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0e029c4..3399110 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2186,7 +2186,8 @@ struct sk_buff *tcp_tso_segment(struct s
 		if (skb->ip_summed == CHECKSUM_NONE) {
 			th->check = csum_fold(csum_partial(
 				skb->h.raw, thlen, csum_add(skb->csum, delta)));
-		}
+		} else if (skb->ip_summed == CHECKSUM_HW)
+			th->check = ~csum_fold(csum_add(th->check, delta));
 
 		seq += len;
 		skb = skb->next;
@@ -2196,11 +2197,12 @@ struct sk_buff *tcp_tso_segment(struct s
 		th->cwr = 0;
 	} while (skb->next);
 
+	delta = csum_add(oldlen, htonl(skb->tail - skb->h.raw));
 	if (skb->ip_summed == CHECKSUM_NONE) {
-		delta = csum_add(oldlen, htonl(skb->tail - skb->h.raw));
 		th->check = csum_fold(csum_partial(
 			skb->h.raw, thlen, csum_add(skb->csum, delta)));
-	}
+	} else if (skb->ip_summed == CHECKSUM_HW)
+		th->check = ~csum_fold(csum_add(th->check, delta));
 
 out:
 	return segs;



  parent reply	other threads:[~2006-06-23 19:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-22  8:12 [0/5] GSO: Generic Segmentation Offload Herbert Xu
2006-06-22  8:12 ` [1/5] [NET]: Merge TSO/UFO fields in sk_buff Herbert Xu
2006-06-22  8:13 ` [2/5] [NET]: Add generic segmentation offload Herbert Xu
2006-06-22  8:14 ` [3/5] [NET]: Add software TSOv4 Herbert Xu
2006-06-22  8:23   ` Herbert Xu
2006-06-22 15:04   ` YOSHIFUJI Hideaki / 吉藤英明
2006-06-22 21:32     ` David Miller
2006-06-24  0:28       ` Ravinandan Arakali
2006-06-24  1:32         ` YOSHIFUJI Hideaki / 吉藤英明
2006-06-26 18:33           ` Ravinandan Arakali
2006-06-23 19:33   ` Michael Chan [this message]
2006-06-23 21:26     ` Michael Chan
2006-06-23 23:38       ` Herbert Xu
2006-06-23 23:53         ` Herbert Xu
2006-06-24  3:08           ` Michael Chan
2006-06-26  6:55             ` David Miller
2006-06-22  8:14 ` [4/5] [NET]: Added GSO toggle Herbert Xu
2006-06-22  8:14 ` [5/5] [IPSEC]: Handle GSO packets Herbert Xu
2006-06-22  8:15 ` [0/5] GSO: Generic Segmentation Offload Herbert Xu
2006-06-22 10:08 ` David Miller
2006-06-22 14:28 ` YOSHIFUJI Hideaki / 吉藤英明
2006-06-24  5:36   ` Herbert Xu
  -- strict thread matches above, loose matches on Subject: below --
2006-06-20  9:09 Herbert Xu
2006-06-20  9:29 ` [3/5] [NET]: Add software TSOv4 Herbert Xu

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=1151091230.6498.4.camel@rh4 \
    --to=mchan@broadcom.com \
    --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 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).