From: Alexander Duyck <alexander.h.duyck@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
Alexander Duyck <alexander.duyck@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com
Subject: Re: [PATCH v3] net: Do not include padding in TCP GRO checksum
Date: Mon, 18 Nov 2013 09:43:18 -0800 [thread overview]
Message-ID: <528A51B6.2040609@intel.com> (raw)
In-Reply-To: <20131116064611.GA12146@gondor.apana.org.au>
On 11/15/2013 10:46 PM, Herbert Xu wrote:
> On Fri, Nov 15, 2013 at 08:10:00PM -0800, Alexander Duyck wrote:
>>
>> 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.
>
> OK great. So this isn't normal data that we expect to aggregate.
>
> In that case the simplest solution is to skip the checksum check
> altogether. We only require it if the packet is going to be merged.
>
> So how about something like this?
>
> gro: Only verify TCP checksums for candidates
>
> In some cases we may receive IP packets that are longer than
> their stated lengths. Such packets are never merged in GRO.
> However, we may end up computing their checksums incorrectly
> and end up allowing packets with a bogus checksum enter our
> stack with the checksum status set as verified.
>
> Since such packets are rare and not performance-critical, this
> patch simply skips the checksum verification for them.
>
> Reported-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
> index a2b68a1..55aeec9 100644
> --- a/net/ipv4/tcp_offload.c
> +++ b/net/ipv4/tcp_offload.c
> @@ -276,6 +276,10 @@ static struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *
> __wsum wsum;
> __sum16 sum;
>
> + /* Don't bother verifying checksum if we're going to flush anyway. */
> + if (NAPI_GRO_CB(skb)->flush)
> + goto skip_csum;
> +
> switch (skb->ip_summed) {
> case CHECKSUM_COMPLETE:
> if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr,
> @@ -301,6 +305,7 @@ flush:
> break;
> }
>
> +skip_csum:
> return tcp_gro_receive(head, skb);
> }
>
> diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
> index c1097c7..71923d1 100644
> --- a/net/ipv6/tcpv6_offload.c
> +++ b/net/ipv6/tcpv6_offload.c
> @@ -39,6 +39,10 @@ static struct sk_buff **tcp6_gro_receive(struct sk_buff **head,
> __wsum wsum;
> __sum16 sum;
>
> + /* Don't bother verifying checksum if we're going to flush anyway. */
> + if (NAPI_GRO_CB(skb)->flush)
> + goto skip_csum;
> +
> switch (skb->ip_summed) {
> case CHECKSUM_COMPLETE:
> if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr,
> @@ -65,6 +69,7 @@ flush:
> break;
> }
>
> +skip_csum:
> return tcp_gro_receive(head, skb);
> }
>
> Thanks,
>
I'm not going to have a chance to test this today, but on review it
should fix the issue.
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
next prev parent reply other threads:[~2013-11-18 17:43 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
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 [this message]
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=528A51B6.2040609@intel.com \
--to=alexander.h.duyck@intel.com \
--cc=alexander.duyck@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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).