summaryrefslogtreecommitdiff
path: root/include/net
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2025-03-11 21:42:29 +0100
committerPaolo Abeni <pabeni@redhat.com>2025-03-18 11:40:30 +0100
commit311b36574ceaccfa3f91b74054a09cd4bb877702 (patch)
tree3d1bf81f61f5a67fa29b27bfbf10b5dece0a0e6e /include/net
parent8d4880db378350f8ed8969feea13bdc164564fc1 (diff)
udp_tunnel: use static call for GRO hooks when possible
It's quite common to have a single UDP tunnel type active in the whole system. In such a case we can replace the indirect call for the UDP tunnel GRO callback with a static call. Add the related accounting in the control path and switch to static call when possible. To keep the code simple use a static array for the registered tunnel types, and size such array based on the kernel config. Reviewed-by: Willem de Bruijn <willemb@google.com> Link: https://patch.msgid.link/6fd1f9c7651151493ecab174e7b8386a1534170d.1741718157.git.pabeni@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/udp_tunnel.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/net/udp_tunnel.h b/include/net/udp_tunnel.h
index eda0f3e2f65f..a7b230867eb1 100644
--- a/include/net/udp_tunnel.h
+++ b/include/net/udp_tunnel.h
@@ -205,9 +205,11 @@ static inline void udp_tunnel_encap_enable(struct sock *sk)
#if IS_ENABLED(CONFIG_NET_UDP_TUNNEL)
void udp_tunnel_update_gro_lookup(struct net *net, struct sock *sk, bool add);
+void udp_tunnel_update_gro_rcv(struct sock *sk, bool add);
#else
static inline void udp_tunnel_update_gro_lookup(struct net *net,
struct sock *sk, bool add) {}
+static inline void udp_tunnel_update_gro_rcv(struct sock *sk, bool add) {}
#endif
static inline void udp_tunnel_cleanup_gro(struct sock *sk)
@@ -215,6 +217,8 @@ static inline void udp_tunnel_cleanup_gro(struct sock *sk)
struct udp_sock *up = udp_sk(sk);
struct net *net = sock_net(sk);
+ udp_tunnel_update_gro_rcv(sk, false);
+
if (!up->tunnel_list.pprev)
return;