Re: skb->csum

Andi Kleen (ak@muc.de)
01 Dec 1999 10:23:27 +0100


prakash@rnd.cts-corp.com writes:

> Hi all,
>
> I am trying to understand the use of skb->csum in the struct skbuff.
>
> Does it affect in calculating the tcp checksum. If so how???

skb->csum contains the "running" checksum over the data, this means it
is a 32bit sum of the 16bit words in the payload upto the IP header
(the IP header has its own checksum). To finally verify the checksum
TCP adds in the TCP pseudo header (saddr,daddr,length,ip protocol),
folds it to 16bit and inverts it. Then the result should be, if this
is true the checksum including the checksum in the TCP headers is correct.

skb->csum is only valid when skb->ip_summed == CHECKSUM_HW, TCP computes
the checksum in software. It is used because some Networking Hardware
is able to compute the TCP checksum over data in hardware, which saves
a complete checksumming pass over the data.

It is only used for the input path, for output the checksum is always
computed during the copy from the user supplied buffer to the skbuff
and these fields are not used.

I hope this helps,

-Andi

-- 
This is like TV. I don't like TV.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/