From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joseph Gasparakis Subject: Re: [PATCH 2/3] net: UDP gro_receive accept csum=0 Date: Fri, 14 Feb 2014 10:34:56 -0800 (PST) Message-ID: References: <52FC7D0C.1020601@mellanox.com> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: Joseph Gasparakis , Or Gerlitz , Or Gerlitz , David Miller , Linux Netdev List , Jerry Chu , Eric Dumazet To: Tom Herbert Return-path: Received: from mga02.intel.com ([134.134.136.20]:22283 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751242AbaBNSRD (ORCPT ); Fri, 14 Feb 2014 13:17:03 -0500 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Thu, 13 Feb 2014, Tom Herbert wrote: > >> > 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 > > It looks like udp4_csum_init turns CHECKSUM_COMPLETE and check==0 into > CHECKSUM_UNNECESSARY which could bypass the checksum validation for > the encapsulated packet. This would be a significant functionality > bug. Unfortunately udp4_csum_init writes ip_summed without regard to > encapsulation. > > Seems like the logic in the UDP rcv path should be: > > if ip_summed == CHECKSUM_COMPLETE, ensure this is same value when > calling encap_rcv > if ip_summed == CHECKSUM_UNNECESSARY && !skb->encap change to > CHECKSUM_NONE before calling encap_rcv > if ip_summed == CHECKSUM_UNNECESSARY && skb->encap ip_summed value is okay > > In any case, we need to consider the orignal ip_summed value from the > driver, not the one that udp4_csum_init (udp_gro or anywhere else in > the path) would set. > > Also, udp_gro_receive should be able to handle the case where > ip_summed == CHECKSUM_UNNECESSARY and !skb->encapsulation, that will > be very common scenario. Probably CHECKSUM_NONE also. > Yes, I now see your point and totaly agree. Thanks.