]> www.infradead.org Git - users/jedix/linux-maple.git/commit
udp_tunnel: create a fastpath GRO lookup.
authorPaolo Abeni <pabeni@redhat.com>
Tue, 11 Mar 2025 20:42:28 +0000 (21:42 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 18 Mar 2025 10:40:26 +0000 (11:40 +0100)
commit8d4880db378350f8ed8969feea13bdc164564fc1
tree799ea1e198b3bc6b9a6325d28e0badade992f116
parentf5825e79b2b7b1b0912c219d24cd7aa3eb3e300d
udp_tunnel: create a fastpath GRO lookup.

Most UDP tunnels bind a socket to a local port, with ANY address, no
peer and no interface index specified.
Additionally it's quite common to have a single tunnel device per
namespace.

Track in each namespace the UDP tunnel socket respecting the above.
When only a single one is present, store a reference in the netns.

When such reference is not NULL, UDP tunnel GRO lookup just need to
match the incoming packet destination port vs the socket local port.

The tunnel socket never sets the reuse[port] flag[s]. When bound to no
address and interface, no other socket can exist in the same netns
matching the specified local port.

Matching packets with non-local destination addresses will be
aggregated, and eventually segmented as needed - no behavior changes
intended.

Note that the UDP tunnel socket reference is stored into struct
netns_ipv4 for both IPv4 and IPv6 tunnels. That is intentional to keep
all the fastpath-related netns fields in the same struct and allow
cacheline-based optimization. Currently both the IPv4 and IPv6 socket
pointer share the same cacheline as the `udp_table` field.

Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/4d5c319c4471161829f50cb8436841de81a5edae.1741718157.git.pabeni@redhat.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/linux/udp.h
include/net/netns/ipv4.h
include/net/udp.h
include/net/udp_tunnel.h
net/ipv4/udp.c
net/ipv4/udp_offload.c
net/ipv4/udp_tunnel_core.c
net/ipv6/udp.c
net/ipv6/udp_offload.c