[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTSfHFn=niNFmd0yuHYt39a3P8Sfq7RMSBjqK1iro8EWGaQ@mail.gmail.com>
Date: Sun, 16 Feb 2020 10:58:30 -0600
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Martin Varghese <martinvarghesenokia@...il.com>
Cc: Network Development <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Jonathan Corbet <corbet@....net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
scott.drennan@...ia.com, Jiri Benc <jbenc@...hat.com>,
martin.varghese@...ia.com
Subject: Re: [PATCH net-next v7 1/2] net: UDP tunnel encapsulation module for
tunnelling different protocols like MPLS,IP,NSH etc.
On Fri, Feb 14, 2020 at 11:20 PM Martin Varghese
<martinvarghesenokia@...il.com> wrote:
>
> From: Martin Varghese <martin.varghese@...ia.com>
>
> The Bareudp tunnel module provides a generic L3 encapsulation
> tunnelling module for tunnelling different protocols like MPLS,
> IP,NSH etc inside a UDP tunnel.
>
> Signed-off-by: Martin Varghese <martin.varghese@...ia.com>
A few small points
> net/ipv4/route.c | 48 +++
> net/ipv6/ip6_output.c | 70 ++++
Both protocols have route.c and ip(6)_output.c files. For the sake of
consistency, both should ideally be in route.c. Did you choose
ip6_output.c for a reason?
There are also a couple of reverse christmas tree violations.
> +struct rtable *ip_route_output_tunnel(struct sk_buff *skb,
> + struct net_device *dev,
> + struct net *net, __be32 *saddr,
> + const struct ip_tunnel_info *info,
> + u8 protocol, bool use_cache)
> +{
> +#ifdef CONFIG_DST_CACHE
> + struct dst_cache *dst_cache;
> +#endif
> + struct rtable *rt = NULL;
> + struct flowi4 fl4;
> + __u8 tos;
> +
> + memset(&fl4, 0, sizeof(fl4));
> + fl4.flowi4_mark = skb->mark;
> + fl4.flowi4_proto = protocol;
> + fl4.daddr = info->key.u.ipv4.dst;
> + fl4.saddr = info->key.u.ipv4.src;
> +
> + tos = info->key.tos;
> + fl4.flowi4_tos = RT_TOS(tos);
> +#ifdef CONFIG_DST_CACHE
> + dst_cache = (struct dst_cache *)&info->dst_cache;
> + if (use_cache) {
> + rt = dst_cache_get_ip4(dst_cache, saddr);
> + if (rt)
> + return rt;
> + }
> +#endif
This is the same in geneve, but no need to initialize fl4 on a cache
hit. Then can also be restructured to only have a single #ifdef block.
Powered by blists - more mailing lists