* Questions about CHECKSUM_COMPLETE
@ 2011-10-21 3:05 fengcheng lu
2011-10-21 12:09 ` Ben Hutchings
0 siblings, 1 reply; 2+ messages in thread
From: fengcheng lu @ 2011-10-21 3:05 UTC (permalink / raw)
To: netdev
Hello everyone
I have one question about the CHECKSUM_COMPLETE. When
CHECK_SUM_COMPLETE is set, which data does the skb->csum computed by
hardware cover?
I thought skb->csum only covers the Transport header (e.g. TCP/UDP) +
Transport payload + pseudo header. However, after I read the vlan
codes (vlan_skb_recv in the vlan_dev.c of linux kernel 2.6.27.19), I
become confuse.
The vlan_skb_recv calls skb_pull_rcsum which updates the skb->csum if
CHECKSUM_COMPLETE is set. It implies the vlan header is also covered
by the skb->csum. so I wonder if the skb->csum cover the whole data
besides the eth header (14 bytes).
Thanks
Steven Lu
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Questions about CHECKSUM_COMPLETE
2011-10-21 3:05 Questions about CHECKSUM_COMPLETE fengcheng lu
@ 2011-10-21 12:09 ` Ben Hutchings
0 siblings, 0 replies; 2+ messages in thread
From: Ben Hutchings @ 2011-10-21 12:09 UTC (permalink / raw)
To: fengcheng lu; +Cc: netdev
On Thu, 2011-10-20 at 23:05 -0400, fengcheng lu wrote:
> Hello everyone
>
> I have one question about the CHECKSUM_COMPLETE. When
> CHECK_SUM_COMPLETE is set, which data does the skb->csum computed by
> hardware cover?
>
> I thought skb->csum only covers the Transport header (e.g. TCP/UDP) +
> Transport payload + pseudo header. However, after I read the vlan
> codes (vlan_skb_recv in the vlan_dev.c of linux kernel 2.6.27.19), I
> become confuse.
>
> The vlan_skb_recv calls skb_pull_rcsum which updates the skb->csum if
> CHECKSUM_COMPLETE is set. It implies the vlan header is also covered
> by the skb->csum. so I wonder if the skb->csum cover the whole data
> besides the eth header (14 bytes).
That's right, it's supposed to cover the complete packet (as seen by
Linux, so not including an Ethernet CRC). The hardware doesn't need to
parse L3/L4 headers to implement this.
If the hardware you're dealing with doesn't calculate the full checksum
but it does parse headers and verify checksums for specific protocols
then you can set ip_summed = CHECKSUM_UNNECESSARY if the checksums are
OK.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-10-21 12:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-21 3:05 Questions about CHECKSUM_COMPLETE fengcheng lu
2011-10-21 12:09 ` Ben Hutchings
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).