[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0e2f9b38d0a73e5b2ce24c4817a968685e065684.camel@redhat.com>
Date: Thu, 25 Oct 2018 15:00:09 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: Network Development <netdev@...r.kernel.org>,
Willem de Bruijn <willemb@...gle.com>,
steffen.klassert@...unet.com
Subject: Re: [RFC PATCH v2 01/10] udp: implement complete book-keeping for
encap_needed
Hi,
I'm sorry for lagging behind, this one felt outside my radar.
On Mon, 2018-10-22 at 12:06 -0400, Willem de Bruijn wrote:
> @@ -2431,7 +2435,9 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
> > /* FALLTHROUGH */
> > case UDP_ENCAP_L2TPINUDP:
> > up->encap_type = val;
> > - udp_encap_enable();
> > + if (!up->encap_enabled)
> > + udp_encap_enable();
> > + up->encap_enabled = 1;
>
> nit: no need for the branch: udp_encap_enable already has a branch and
> is static inline.
Uhm... I think it's needed, so that we call udp_encap_enable() at most
once per socket. If up->encap_enabled we also call static_key_disable
at socket destruction time (once per socket, again) and hopefully we
don't "leak" static_key_enable invocation.
> Perhaps it makes sense to convert that to take the udp_sock and handle
> the state change within, to avoid having to open code at multiple
> locations.
Possibly calling directly udp_tunnel_encap_enable()? that additionally
cope with ipv6, which is not needed here, but should not hurt.
Cheers,
Paolo
Powered by blists - more mailing lists