Re: [PATCH net-next v7 1/2] net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS,IP,NSH etc.
From: Martin Varghese <hidden>
Date: 2020-02-17 02:43:57
On Sun, Feb 16, 2020 at 10:58:30AM -0600, Willem de Bruijn wrote:
On Fri, Feb 14, 2020 at 11:20 PM Martin Varghese [off-list ref] wrote:quoted
From: Martin Varghese <redacted> 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 <redacted>A few small pointsquoted
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.
In Bareudp.c correct? Wondering if there is any flag in checkpatch to catch them?
quoted
+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; + } +#endifThis 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.
Yes , We need not initialize fl4 when cache is used. But i didnt get your point on restructuing to have a single #ifdef block Could you please give more details