netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Alexander Duyck <alexander.h.duyck@intel.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	herbert@gondor.apana.org
Subject: Re: [PATCH v3] net: Do not include padding in TCP GRO checksum
Date: Fri, 15 Nov 2013 20:10:00 -0800	[thread overview]
Message-ID: <5286F018.8060801@gmail.com> (raw)
In-Reply-To: <20131116015301.GA1999@gondor.apana.org.au>

On 11/15/2013 05:53 PM, Herbert Xu wrote:
> On Sat, Nov 16, 2013 at 08:47:38AM +0800, Herbert Xu wrote:
>> On Fri, Nov 15, 2013 at 03:00:34PM -0800, Alexander Duyck wrote:
>>> In some recent tests I found the TCP checksum was being treated as valid
>>> for certain frames with padding on them.  On closer inspection I found the
>>> issue was that GRO was using the skb->len instead of the length recorded in
>>> the IP/IPv6 header to determine the number of bytes to checksum.  As such
>>> padded frames that actually had invalid checksums generated by adding the
>>> padding to the checksum were being incorrectly tagged as valid.
>>>
>>> This change corrects that by using the tot_len from IPv4 headers and the
>>> payload_len from IPv6 headers to compute the total number of bytes to be
>>> included in the checksum.
>>>
>>> To address the fact that skb->csum is invalid when a padded frame is
>>> received I have updated the code to fall though to the CHECKSUM_NONE path
>>> for CHECKSUM_COMPLETE frames that contain padding.
>>>
>>> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
>> Nack.  This is needlessly complex.  As I said before, please
>> just do a pskb_trim_rcsum in inet_gro_receive and its IPv6
>> counterpart and this should all just work.
> Actually I take that back.  You are right that the preference is to
> flush and not trim, since we want to preserve the incoming packet in
> its exact form.
>
> So can you tell me a bit more about the padding? Is it added by the
> NIC or did it come from the remote side?
>
> Thanks,

The case I am addressing is padding added by the remote side. 
Specifically in my case I was seeing TCP frames without options that
were padded up to 60 bytes from a netperf TCP_RR test.  I messed up the
padding/checksum logic so it was making the same mistake in the Tx
checksum logic in the driver that I caught here in GRO.  As a result I
was seeing checksum errors errors in wireshark, but noticed they were
being accepted by the stack as valid.

The driver has been fixed, and isn't anything that has been pushed
upstream yet so no harm there.  I figured while I was at it I should
probably fix the GRO logic so that it doesn't mis-identify those types
of frames as being valid since that is something that may lead to
similar driver errors going undetected.

Thanks,

Alex

  reply	other threads:[~2013-11-16  4:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-15 23:00 [PATCH v3] net: Do not include padding in TCP GRO checksum Alexander Duyck
2013-11-16  0:47 ` Herbert Xu
2013-11-16  1:34   ` David Miller
2013-11-16  1:43     ` Herbert Xu
2013-11-16  2:11       ` David Miller
2013-11-16  1:53   ` Herbert Xu
2013-11-16  4:10     ` Alexander Duyck [this message]
2013-11-16  6:46       ` Herbert Xu
2013-11-16  7:23         ` Herbert Xu
2013-11-16 17:02         ` Alexander Duyck
2013-11-17  3:17           ` Herbert Xu
2013-11-17 18:24             ` Alexander Duyck
2013-11-18  0:03               ` Herbert Xu
2013-11-18 17:43         ` Alexander Duyck
2013-11-21 18:35           ` David Miller
2013-11-22  2:30             ` Herbert Xu
2013-11-22  2:31               ` [1/2] gro: Only verify TCP checksums for candidates Herbert Xu
2013-11-22  5:55                 ` Eric Dumazet
2013-11-23 22:47                   ` David Miller
2013-11-22  2:32               ` [2/2] gro: Clean up tcpX_gro_receive checksum verification Herbert Xu
2013-11-22  5:58                 ` Eric Dumazet
2013-11-23 22:47                   ` 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=5286F018.8060801@gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=alexander.h.duyck@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).