From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1732C432C0 for ; Sat, 23 Nov 2019 18:30:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 80D2B2068D for ; Sat, 23 Nov 2019 18:30:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbfKWSa0 (ORCPT ); Sat, 23 Nov 2019 13:30:26 -0500 Received: from smtprelay0158.hostedemail.com ([216.40.44.158]:40553 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726494AbfKWSa0 (ORCPT ); Sat, 23 Nov 2019 13:30:26 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id A7669181D3025; Sat, 23 Nov 2019 18:30:24 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: color55_77d9b74f7dc5d X-Filterd-Recvd-Size: 2351 Received: from XPS-9350.home (unknown [47.151.135.224]) (Authenticated sender: joe@perches.com) by omf20.hostedemail.com (Postfix) with ESMTPA; Sat, 23 Nov 2019 18:30:23 +0000 (UTC) Message-ID: <491b61d7be054a2200639e4acb6a00f8e39409c4.camel@perches.com> Subject: Re: [PATCH] net: ip/tnl: Set iph->id only when don't fragment is not set From: Joe Perches To: Eric Dumazet , Oliver Herms , davem@davemloft.net, kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org Cc: netdev@vger.kernel.org Date: Sat, 23 Nov 2019 10:29:58 -0800 In-Reply-To: References: <20191123145817.GA22321@fuckup> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.34.1-2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sat, 2019-11-23 at 09:53 -0800, Eric Dumazet wrote: > > On 11/23/19 6:58 AM, Oliver Herms wrote: > > In IPv4 the identification field ensures that fragments of different datagrams > > are not mixed by the receiver. Packets with Don't Fragment (DF) flag set are not > > to be fragmented in transit and thus don't need an identification. > > Official sources for this assertion please, so that we can double check if you > implemented the proper avoidance ? > > > Calculating the identification takes significant CPU time. > > This patch will increase IP tunneling performance by ~10% unless DF is not set. > > However, DF is set by default which is best practice. > > > > Signed-off-by: Oliver Herms > > --- > > net/ipv4/ip_tunnel_core.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c > > index 1452a97914a0..8636c1e0e7b7 100644 > > --- a/net/ipv4/ip_tunnel_core.c > > +++ b/net/ipv4/ip_tunnel_core.c > > @@ -73,7 +73,9 @@ void iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb, > > iph->daddr = dst; > > iph->saddr = src; > > iph->ttl = ttl; > > - __ip_select_ident(net, iph, skb_shinfo(skb)->gso_segs ?: 1); > > + > > + if (unlikely((iph->frag_off & htons(IP_DF)) == false)) > > This unlikely() seems wrong to me. as does the comparison to false.