Skip to content

udp: implement GRO support

Paolo Abeni netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10udp: implement complete book-keeping for encap_neededinclude/linux/udp.h include/net/udp_tunnel.h net/ipv4/udp.c +1 more+34 -121 reply
2/10udp: implement GRO for plain UDP sockets.include/linux/udp.h include/uapi/linux/udp.h net/ipv4/udp.c +2 more+99 -280 replies
3/10udp: add support for UDP_GRO cmsginclude/linux/udp.h net/ipv4/udp.c net/ipv6/udp.c+18 -00 replies
4/10ip: factor out protocol delivery helperinclude/net/ip.h net/ipv4/ip_input.c+37 -370 replies
5/10ipv6: factor out protocol delivery helperinclude/net/ipv6.h net/ipv6/ip6_input.c+18 -123 replies
6/10udp: cope with UDP GRO packet misdirectioninclude/linux/udp.h include/net/udp.h net/ipv4/udp.c +1 more+88 -100 replies
7/10selftests: add GRO support to udp bench rx programtools/testing/selftests/net/udpgso_bench_rx.c+30 -70 replies
8/10selftests: add dummy xdp test helpertools/testing/selftests/bpf/Makefile tools/testing/selftests/bpf/xdp_dummy.c+15 -10 replies
9/10selftests: add some benchmark for UDP GROtools/testing/selftests/net/Makefile tools/testing/selftests/net/udpgro_bench.sh+94 -00 replies
10/10selftests: add functionals test for UDP GROtools/testing/selftests/net/Makefile tools/testing/selftests/net/udpgro.sh tools/testing/selftests/net/udpgro_bench.sh +3 more+282 -230 replies

Reviews trailers per patch

None of the 10 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchWillem de Bruijn
SeriesA-b
1/10
2/10
3/10
4/10
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 00/10] udp: implement GRO support

This series implements GRO support for UDP sockets, as the RX counterpart of commit bec1f6f69736 ("udp: generate gso with UDP_SEGMENT").
The core functionality is implemented by the second patch, introducing a new sockopt to enable UDP_GRO, while patch 3 implements support for passing the segment size to the user space via a new cmsg.
UDP GRO performs a socket lookup for each ingress packets and aggregate datagram directed to UDP GRO enabled sockets with constant l4 tuple.

UDP GRO packets can land on non GRO-enabled sockets, e.g. due to iptables NAT rules, and that could potentially confuse existing applications.

The solution adopted here is to de-segment the GRO packet before enqueuing as needed. Since we must cope with packet reinsertion after de-segmentation, the relevant code is factored-out in ipv4 and ipv6 specific helpers and exposed to UDP usage.

While the current code can probably be improved, this safeguard ,implemented in the patches 4-7, allows future enachements to enable UDP GSO offload on more virtual devices eventually even on forwarded packets.

The last 4 for patches implement some performance and functional self-tests, re-using the existing udpgso infrastructure. The problematic scenario described above is explicitly tested.

This revision of the series try to address the feedback provided by Willem and Subash on previous iteration.

Paolo Abeni (10):
udp: implement complete book-keeping for encap_needed
udp: implement GRO for plain UDP sockets.
udp: add support for UDP_GRO cmsg
ip: factor out protocol delivery helper
ipv6: factor out protocol delivery helper
udp: cope with UDP GRO packet misdirection
selftests: add GRO support to udp bench rx program
selftests: add dummy xdp test helper
selftests: add some benchmark for UDP GRO
selftests: add functionals test for UDP GRO

 include/linux/udp.h                           |  25 ++-
 include/net/ip.h                              |   1 +
 include/net/ipv6.h                            |   2 +
 include/net/udp.h                             |  45 ++++-
 include/net/udp_tunnel.h                      |   6 +
 include/uapi/linux/udp.h                      |   1 +
 net/ipv4/ip_input.c                           |  73 ++++----
 net/ipv4/udp.c                                |  54 +++++-
 net/ipv4/udp_offload.c                        | 109 +++++++++---
 net/ipv6/ip6_input.c                          |  28 ++--
 net/ipv6/udp.c                                |  41 ++++-
 net/ipv6/udp_offload.c                        |   6 +-
 tools/testing/selftests/bpf/Makefile          |   3 +-
 tools/testing/selftests/bpf/xdp_dummy.c       |  13 ++
 tools/testing/selftests/net/Makefile          |   1 +
 tools/testing/selftests/net/udpgro.sh         | 148 +++++++++++++++++
 tools/testing/selftests/net/udpgro_bench.sh   |  95 +++++++++++
 tools/testing/selftests/net/udpgso_bench.sh   |   2 +-
 tools/testing/selftests/net/udpgso_bench_rx.c | 156 ++++++++++++++++--
 tools/testing/selftests/net/udpgso_bench_tx.c |  22 ++-
 20 files changed, 708 insertions(+), 123 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/xdp_dummy.c
 create mode 100755 tools/testing/selftests/net/udpgro.sh
 create mode 100755 tools/testing/selftests/net/udpgro_bench.sh
Signature · 1 line
2.17.2