Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: alexei.starovoitov@gmail.com
Cc: therbert@google.com, Yuval.Mintz@qlogic.com, netdev@vger.kernel.org
Subject: Re: How exactly does CHECKSUM_COMPLETE works?
Date: Tue, 30 Sep 2014 14:48:19 -0400 (EDT)	[thread overview]
Message-ID: <20140930.144819.890888642079982128.davem@davemloft.net> (raw)
In-Reply-To: <CAADnVQLxX4LGFfqd6x+krfEMB57y_o80xW_3brkPvEJueDNWVg@mail.gmail.com>

From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Date: Tue, 30 Sep 2014 09:58:32 -0700

> On Tue, Sep 30, 2014 at 7:59 AM, Tom Herbert <therbert@google.com> wrote:
>>
>>> So, to summarize my questions -
>>> 1. What should a driver set as the SKBs csum value when passing CHECKSUM_COMPLETE?
>>
>> This ones complete checksum of the Ethernet payload (start of IP
>> header to the end of the packet).
> 
> I think it's confusing to describe CHECKSUM_COMPLETE this way.
> It is such only because driver pulls eth header before passing skb to stack.
> CHECKSUM_COMPLETE should cover the whole packet. If there are multiple
> vlan headers in front of IP they should be part of csum, since not all
> drivers may
> have hw offloading for vlan. The most simplistic HW would compute csum over
> the whole packet including eth header and driver will do
> eth_type_trans+skb_postpull_rcsum

The sungem computes the checksum over the entire frame.  Here are the relevant
parts from the programmer's manual:

	RX Descriptor Fields
  ...
	TCP Pseudo-Checksum - Contains the 16-bit TCP checksum calculated over
	the entire frame, starting at an offset programmable in the RX
	Configuration Register.

In the gengem driver this is the RXDMA_CFG_CSUMOFF field of the RXDMA_CFG
register.

The driver seems to set this to the size of the ethernet header, which has
the problems you mention.

  reply	other threads:[~2014-09-30 18:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 12:51 How exactly does CHECKSUM_COMPLETE works? Yuval Mintz
2014-09-30 14:59 ` Tom Herbert
2014-09-30 16:58   ` Alexei Starovoitov
2014-09-30 18:48     ` David Miller [this message]
2014-09-30 19:05   ` Yuval Mintz
2014-09-30 19:22     ` Eric Dumazet
2014-09-30 19:37       ` Eric Dumazet
2014-09-30 20:14         ` David Miller
2014-10-01  5:12           ` [PATCH net-next] ipv4: mentions skb_gro_postpull_rcsum() in inet_gro_receive() Eric Dumazet
2014-10-01 17:44             ` David Miller
2014-09-30 20:19         ` How exactly does CHECKSUM_COMPLETE works? Yuval Mintz
2014-09-30 20:32           ` Yuval Mintz
2014-10-01  5:15             ` Tom Herbert
2014-10-01  5:17               ` Yuval Mintz
2014-10-01  5:25                 ` David Miller

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=20140930.144819.890888642079982128.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=Yuval.Mintz@qlogic.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=therbert@google.com \
    /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