TCP checksum offloading (complete)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi here, please answer to my mail address (ive not
subscribed) :


I've studied the hardware checksum computation. i've
read in include/linux/skbuff.h that when ip->summed is
set to CHECKSUM_HW, skb->csum contains the checksum on
all the packet (as seen by the device).

The fact is, the ip layer does'nt care about skb->csum
(the checksum is verified from the scratch) but
skb->csum ne is used to compute the final checksum of
tcp (completed with the pseudo header checksum).

As mentionned in the skbuff.h file, as the skb->csum
covers all the packet, i think skb->csum can't be used
for tcp computing "as is". (as we cover ip header by
this checksum). 

So i imagine that we substract the value of ip header
checksum before that tcp uses skb->csum in :
from tcp_ipv4.c

if ((skb->ip_summed != CHECKSUM_UNNECESSARY &&
         tcp_v4_checksum_init(skb) < 0))
            goto bad_packet;


with :

static int tcp_v4_checksum_init(struct sk_buff *skb)
    {
        if (skb->ip_summed == CHECKSUM_HW) {
            skb->ip_summed = CHECKSUM_UNNECESSARY;
            if
(!tcp_v4_check(skb->h.th,skb->len,skb->nh.iph->saddr,
                             
skb->nh.iph->daddr,skb->csum))
                    return 0;
  [...]

                    skb->ip_summed = CHECKSUM_NONE;
        }

That is to say, as the skb->csum field is filled with
a sum on the entire packets contents, i guess it must
be transformed when used by tcp to finally compute the
checksum (completing with the pseudo header).
 
I found no trace of this skb->csum transormation
before use in tcp_v4_checksum_init on the receive
path.
 
Thanks




___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux