Subject: [multipathtcp] MPTCP checksum

From: Mahesh M <[email-masked]>
Date: Wed, 11 Jul 2012 11:55:02 -0700

Hi,

For internet checksum calculation either we can use 16bit, 32bit or 64bit words and we need to fold the sum at the end and add the carry. For parallelism when we make choice of 32bit or 64bit accumulators, we usually we choose 64bit when native register size is 64bits.
IPv4/IPv6 packet cannot go beyond 64KB (i.e. including IP and TCP headers), so TCP checksum theoretically cannot wrap around 32bit value and use of 64 bit accumulator gives us parallelism. But MPTCP checksum mapping can be 64KB-1 + 16bytes of pseudo header which can overflow 32bit value. If my understanding is correct then we need to use 64bit accumulator if our checksum calculation.

Any comments on this?

Regards,
Mahesh

---

From: Joe Touch <[email-masked]>
Date: Mon, 16 Jul 2012 14:04:26 -0700

On 7/11/2012 11:55 AM, Mahesh M wrote:
> Hi,
>
> For internet checksum calculation either we can use 16bit, 32bit or
> 64bit words and we need to fold the sum at the end and add the carry.

You need to add the carry back at each word you add as you accumulate 
the sum.

> For parallelism when we make choice of 32bit or 64bit accumulators, we
> usually we choose 64bit when native register size is 64bits.
>
> IPv4/IPv6 packet cannot go beyond 64KB (i.e. including IP and TCP
> headers), so TCP checksum theoretically cannot wrap around 32bit value

It sure can - it can wrap nearly every 32-bit value you add in. That's 
the carry that could happen at each word you sum in.

> and use of 64 bit accumulator gives us parallelism. But MPTCP checksum
> mapping can be 64KB-1 + 16bytes of pseudo header which can overflow
> 32bit value. If my understanding is correct then we need to use 64bit
> accumulator if our checksum calculation.

You cannot overflow a 1's complement sum. You merely keep adding the 
carry back in. It's "circular".

What you do is compute 64-bit ones-complement sums as you go, and then 
fold into a 16-bit sum later. That works because summation is 
commutative, even in 1's complement.

See any of the numerous RFCs on computing the IP checksum for further 
information.

Joe

>
> Any comments on this?
>
> Regards,
>
> Mahesh
>
>
>
> _______________________________________________
> multipathtcp mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/multipathtcp
>