Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751150AbdIEGrw (ORCPT ); Tue, 5 Sep 2017 02:47:52 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:52600 "EHLO relay4-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750846AbdIEGrt (ORCPT ); Tue, 5 Sep 2017 02:47:49 -0400 X-Originating-IP: 209.85.128.176 X-Google-Smtp-Source: ADKCNb7qunYGbNo94iEQ9whZLTSPbEVsY+gUs91YIjs5Nez6TuS8/+bB+myVymkBHO4AxzFOdllkSrspbQmOuu1+oNs= MIME-Version: 1.0 In-Reply-To: <1504442982-12431-1-git-send-email-yanhaishuang@cmss.chinamobile.com> References: <1504442982-12431-1-git-send-email-yanhaishuang@cmss.chinamobile.com> From: Pravin Shelar Date: Mon, 4 Sep 2017 23:47:47 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] geneve: Fix setting ttl value in collect metadata mode To: Haishuang Yan Cc: "David S. Miller" , Girish Moodalbail , Linux Kernel Network Developers , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2119 Lines: 50 On Sun, Sep 3, 2017 at 5:49 AM, Haishuang Yan wrote: > If key->tos is zero in collect metadata mode, tos should fallback to > ip{4,6}_dst_hoplimit, same as normal mode. > > Signed-off-by: Haishuang Yan > --- > drivers/net/geneve.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c > index f640407..d52a65f 100644 > --- a/drivers/net/geneve.c > +++ b/drivers/net/geneve.c > @@ -834,11 +834,10 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev, > sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); > if (geneve->collect_md) { > tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb); > - ttl = key->ttl; > } else { > tos = ip_tunnel_ecn_encap(fl4.flowi4_tos, ip_hdr(skb), skb); > - ttl = key->ttl ? : ip4_dst_hoplimit(&rt->dst); > } > + ttl = key->ttl ? : ip4_dst_hoplimit(&rt->dst); In collect md mode, geneve has to set TTL value from tunnel metadata. That is the API exposed to userspace. is there reason for this change? > df = key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; > > err = geneve_build_skb(&rt->dst, skb, info, xnet, sizeof(struct iphdr)); > @@ -873,12 +872,11 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev, > sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true); > if (geneve->collect_md) { > prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb); > - ttl = key->ttl; > } else { > prio = ip_tunnel_ecn_encap(ip6_tclass(fl6.flowlabel), > ip_hdr(skb), skb); > - ttl = key->ttl ? : ip6_dst_hoplimit(dst); > } > + ttl = key->ttl ? : ip6_dst_hoplimit(dst); > err = geneve_build_skb(dst, skb, info, xnet, sizeof(struct ipv6hdr)); > if (unlikely(err)) > return err; > -- > 1.8.3.1 > > >