]> git.baikalelectronics.ru Git - kernel.git/commit
udp: implement complete book-keeping for encap_needed
authorPaolo Abeni <pabeni@redhat.com>
Wed, 7 Nov 2018 11:38:28 +0000 (12:38 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Nov 2018 00:23:04 +0000 (16:23 -0800)
commit408d685f8552f0c88b6435a40dd6d201a75896d2
tree92197dd09800c0f4704f94bfd49ffe2d9a9d664e
parentf83ca592d6983b0acf8c01b073fc4cdf9f3a38b2
udp: implement complete book-keeping for encap_needed

The *encap_needed static keys are enabled by UDP tunnels
and several UDP encapsulations type, but they are never
turned off. This can cause unneeded overall performance
degradation for systems where such features are used
transiently.

This patch introduces complete book-keeping for such keys,
decreasing the usage at socket destruction time, if needed,
and avoiding that the same socket could increase the key
usage multiple times.

rfc v3 -> v1:
 - add socket lock around udp_tunnel_encap_enable()

rfc v2 -> rfc v3:
 - use udp_tunnel_encap_enable() in setsockopt()

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/udp.h
include/net/udp_tunnel.h
net/ipv4/udp.c
net/ipv6/udp.c