mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
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>
This commit is contained in:
committed by
David S. Miller
parent
7e225619e8
commit
60fb9567bf
@@ -165,6 +165,12 @@ static inline int udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum)
|
||||
|
||||
static inline void udp_tunnel_encap_enable(struct socket *sock)
|
||||
{
|
||||
struct udp_sock *up = udp_sk(sock->sk);
|
||||
|
||||
if (up->encap_enabled)
|
||||
return;
|
||||
|
||||
up->encap_enabled = 1;
|
||||
#if IS_ENABLED(CONFIG_IPV6)
|
||||
if (sock->sk->sk_family == PF_INET6)
|
||||
ipv6_stub->udpv6_encap_enable();
|
||||
|
Reference in New Issue
Block a user