Subject: Re: [PATCH 2/3] net: UDP gro_receive accept csum=0

From: Joseph Gasparakis <[email-masked]>
Date: Thu, 13 Feb 2014 16:04:02 -0800 (PST)

On Thu, 13 Feb 2014, Or Gerlitz wrote:

> On Fri, Feb 14, 2014 at 12:27 AM, Tom Herbert <[email-masked]> wrote:
> 
> >> [...] this is according to the conventions set by
> >> 0afb166 vxlan: Add capability of Rx checksum offload for inner packet
> >> 6a674e9 net: Add support for hardware-offloaded encapsulation
> >> B/c after finalizing the GRO work and decapsulating, skb injected up into
> >> the TCP stack with ip_summed equals to CHECKSUM_NONE are rejected. If >> this assumption is wrong, maybe we can remove testing the ip_summed field
> >> here altogether?
> 
> > If I'm interpreting the semantics correctly, when skb->encapsulation
> > is set the ip_summed is valid for both the inner and outer header
> > (e.g. CHECKSUM_COMPLETE is always assumed okay for both layers). If
> > skb->encapsulation is not set then ip_summed is only valid for outer header.
> 
> Yep, I think this would be correct interpertation, Joseph, agree?

Agreed.

> 
> > So then the patch is broken in the case that encap is not set,
> > ip_summed is CHECKSUM_UNNECESSARY, csum == 0, and we need to
> > validate the inner checksum.
> 
> Just to make sure, by "the patch" you refer to your patch or the current code?
> 
> > But even worse, is there a fundamental issue where udp4_csum_init is able
> > to change ip_summed to be CHECKSUM_UNNECESSARY (either check == 0
> > or ip_summed == CHECKSUM_UNNECESSARY) regardless of
> > skb->encapsulation, sending the packet into encap_rcv which could
> > ultimately incorrectly apply ip_summed on the inner TCP/UDP packet?
> 
> By fundamental you mean performance issue or functionality issue (bug) or both?
> 

I would expect the check to be for ip_summed == CHECKSUM_UNNECESSARY. This 
was the original thought behind commit:

0afb166 vxlan: Add capability of Rx checksum offload for inner packet