summaryrefslogtreecommitdiff
path: root/net/ipv4/udp_offload.c
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2018-10-05 18:31:40 +0300
committerDavid S. Miller <davem@davemloft.net>2018-10-05 21:52:38 +0300
commitf2e9de210d50187d206989e60bc5a99c2b692209 (patch)
tree89597b81b0eb9e6ce7318ace7a17ff8ec507c325 /net/ipv4/udp_offload.c
parent2b9156129f8ee7312287c4826fe4c34a5402d74e (diff)
downloadlinux-f2e9de210d50187d206989e60bc5a99c2b692209.tar.xz
udp: gro behind static key
Avoid the socket lookup cost in udp_gro_receive if no socket has a udp tunnel callback configured. udp_sk(sk)->gro_receive requires a registration with setup_udp_tunnel_sock, which enables the static key. Signed-off-by: Willem de Bruijn <willemb@google.com> Acked-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp_offload.c')
-rw-r--r--net/ipv4/udp_offload.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index 0c0522b79b43..802f2bc00d69 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -405,7 +405,7 @@ static struct sk_buff *udp4_gro_receive(struct list_head *head,
{
struct udphdr *uh = udp_gro_udphdr(skb);
- if (unlikely(!uh))
+ if (unlikely(!uh) || !static_branch_unlikely(&udp_encap_needed_key))
goto flush;
/* Don't bother verifying checksum if we're going to flush anyway. */