netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Varghese <martinvarghesenokia@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Network Development <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Jonathan Corbet <corbet@lwn.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	scott.drennan@nokia.com, Jiri Benc <jbenc@redhat.com>,
	martin.varghese@nokia.com
Subject: Re: [PATCH net-next v7 1/2] net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS,IP,NSH etc.
Date: Sun, 23 Feb 2020 21:44:47 +0530	[thread overview]
Message-ID: <20200223161447.GA2682@martin-VirtualBox> (raw)
In-Reply-To: <CA+FuTSeMBFu44266y_JkkxduUcXVcbVctjaFCuFaCnEwS_LwEQ@mail.gmail.com>

On Sun, Feb 16, 2020 at 09:16:34PM -0800, Willem de Bruijn wrote:
> > > There are also a couple of reverse christmas tree violations.
> > >
> > In Bareudp.c correct?
> 
> Right. Like bareudp_udp_encap_recv.
> 
> > Wondering if there is any flag in checkpatch to catch them?
> 
> It has come up, but I don't believe anything is merged.
> 
> > > > +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.
> > 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
> 
> Actually, I was mistaken, missing the third #ifdef block that calls
> dst_cache_set_ip[46]. But the type of info->dst_cache is struct
> dst_cache, so I don't think the explicit cast or additional pointer
> variable (and with that the first #ifdef) is needed. But it's clearly
> not terribly important.
I tried to remove the additional pointer variable and the explicit cast.But Compiler warns as 
the info is a const variable (same for geneve)

So shall we keep as it is ?



  reply	other threads:[~2020-02-23 16:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-15  6:19 [PATCH net-next v7 0/2] Bare UDP L3 Encapsulation Module Martin Varghese
2020-02-15  6:20 ` [PATCH net-next v7 1/2] net: UDP tunnel encapsulation module for tunnelling different protocols like MPLS,IP,NSH etc Martin Varghese
2020-02-16 16:58   ` Willem de Bruijn
2020-02-17  2:43     ` Martin Varghese
2020-02-17  5:16       ` Willem de Bruijn
2020-02-23 16:14         ` Martin Varghese [this message]
2020-02-24  2:19           ` Willem de Bruijn
2020-02-16 18:26   ` Willem de Bruijn
2020-02-17  2:49     ` Martin Varghese
2020-02-17  5:19       ` Willem de Bruijn
2020-02-15  6:20 ` [PATCH net-next v7 2/2] net: Special handling for IP & MPLS Martin Varghese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200223161447.GA2682@martin-VirtualBox \
    --to=martinvarghesenokia@gmail.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=jbenc@redhat.com \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=martin.varghese@nokia.com \
    --cc=netdev@vger.kernel.org \
    --cc=scott.drennan@nokia.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).