Netdev List
 help / color / mirror / Atom feed
From: Julius Bairaktaris <julius@bairaktaris.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, dsahern@kernel.org,
	idosch@nvidia.com, willemb@google.com, ncardwell@google.com,
	kuniyu@google.com, steffen.klassert@secunet.com, nbd@nbd.name,
	jiayuan.chen@linux.dev, mfleming@cloudflare.com,
	almasrymina@google.com, bigeasy@linutronix.de,
	richardbgobert@gmail.com, ecree.xilinx@gmail.com,
	bsdhenrymartin@gmail.com
Subject: [PATCH net v6 0/5] ipmr: forward GSO multicast packets
Date: Sat, 21 Nov 2026 22:14:17 +0100	[thread overview]
Message-ID: <cover.1795295554.git.julius@bairaktaris.de> (raw)

With fraglist GRO or UDP GRO forwarding on, a routed IPv4 multicast
stream arrives as GSO packets. ipmr_prepare_xmit() drops every DF
aggregate larger than the MTU, and ip_encap() sets no tunnel GSO state,
so a GSO packet sent to a VIFF_TUNNEL vif is dropped during
segmentation. Checking the segment length instead of skb->len relies on
skb_gso_transport_seglen(), which reads the inner transport header:
fraglist GRO does not set it for the inner flow of a tunnel, and the
encapsulated UDP case counts the inner UDP header 8 bytes short. A
fraglist packet in a tunnel that computes its outer checksum in software
leaves skb_segment_list() with a wrong outer checksum.

Patch 1 sets the inner transport header of encapsulated fraglist
packets.
Patch 2 segments fraglist packets with a software tunnel checksum by
skb_segment().
Patch 3 counts the inner UDP header of encapsulated UDP GSO packets.
Patch 4 sets up IPXIP4 GSO state, outer IP IDs and length in ip_encap(),
and completes a pending checksum of an encapsulated packet before it.
Patch 5 lets DF GSO packets pass when their segments fit the MTU.

v5 patch 1 was applied as abccf171fa8e ("net: make room for the tunnel
header in skb_segment_list()").

Tested in QEMU (KVM), 3 runs with this series on net (acd205ab5c6d);
comparisons on net ran on d5b89d55a322, 3 commits before it, which do
not touch these paths, unless noted:
- VXLAN with an inner UDP or TCP flow over IPv4 or IPv6, outer UDP
  checksum zero or set, fraglist GRO on the router, forwarded unicast
  and by an MFC entry over a 1400-byte route, 1000 packets per case: net
  delivers 4 to 398 per case (4 runs of 16 cases); with this series all
  1000 arrive with valid outer and inner checksums, also with checksum
  offload on the egress, where skb_segment_list() still segments them,
  and packets with a 1404-byte outer header are refused.
- An IPIP aggregate built by GRO, routed to a tunnel vif: all 1000
  datagrams arrive on net, carried in IPIP packets with 125 to 154
  distinct outer IDs (3 runs); with this series every IPIP packet has its
  own ID.
- A TCP flow from a local VXLAN device (outer UDP checksum) behind veth,
  so the aggregates the router builds are CHECKSUM_PARTIAL, forwarded
  with and without checksum offload on the egress: on net (acd205ab5c6d)
  156 to 1057 segments per 4 MB transfer leave with a wrong outer
  checksum (2 runs of 3 transfers); with this series none, and every
  byte arrives.
- IPIP and VXLAN tunnels that end on the router, rx-gro-list on, inner
  UDP and TCP forwarded: aggregated as on net (fraglist for TCP), every
  payload byte delivered.
- An encapsulated non-GSO packet with a pending checksum, forwarded and
  sent locally to a tunnel vif: net hands the IPIP packet to the device
  as CHECKSUM_PARTIAL (2 runs); with this series the checksum is
  complete. With spliced payload, completing it moves the head; on a
  KASAN kernel no report follows (3 runs).
- An MFC entry to a plain and a tunnel vif, 4000 datagrams per arm,
  UDP_SEGMENT, fraglist GRO and UDP GRO forwarding, DF set and clear,
  software and device segmentation: 4000 of 4000 on the plain vif and
  4000 IPIP packets with unique outer IDs, or the 100 GSO packets whole,
  on the tunnel vif, all 12 arms.
- A GRE GSO packet multicast-routed to a tunnel vif is dropped before
  the vif counts it; with fraglist GRO routed into VXLAN and IPIP, every
  segment reaches the peer.

Changes in v6:
- Patch 1 (new): set the inner transport header in the fraglist
  completion of TCP and UDP, IPv4 and IPv6 (Sashiko on v5 patch 2).
- Patch 2 (new): segment a fraglist packet with skb_segment() when a GRE
  or UDP tunnel computes its outer checksum in software, because the
  egress does not offload it or the packet is still CHECKSUM_PARTIAL,
  which skb_segment_list() leaves wrong; found while testing patch 1
  with an outer checksum.
- Patch 4: drop only encapsulated GSO packets without SKB_GSO_IPXIP4, as
  IPIP and SIT aggregates segment correctly (Sashiko on v5 patch 3);
  complete the pending checksum of an encapsulated non-GSO packet before
  ip_encap() (Sashiko on v5 patch 3); state why GRE and UDP tunnel
  aggregates are dropped and what a device segmenting IPXIP4 gets.
  Simon's Reviewed-by is dropped, as the code changed.
- Rebase onto net.
- v5: https://lore.kernel.org/netdev/cover.1794151759.git.julius@bairaktaris.de/

Changes in v5:
- Patch 3: drop an already encapsulated GSO packet in
  ipmr_prepare_xmit() before the route lookup, so the vif does not count
  it, and call iptunnel_handle_offloads() without error handling, since
  skb_cow() leaves no header to unclone (Eric Dumazet, Sashiko). Simon's
  Reviewed-by stays, as this is the change Eric asked for.
- Outer tot_len 0 (Eric): 50 x 1310-byte datagrams merged by UDP GRO
  forwarding make a 65528-byte packet, so the outer header gets tot_len
  0 from iph_set_totlen(); before, htons() truncated it to 12. In 3 runs
  nft ip forward chains still match it with meta l4proto 4 and
  ip protocol 4 (100 of 100), while a netdev egress chain on the output
  device does not match meta l4proto 4 (0 of 100), as
  nft_set_pktinfo_ipv4_validate() takes the length from iph_totlen().
  All 5000 segments reach the peer, with software and device
  segmentation.
- skb_gso_transport_seglen() also leaves out the inner SCTP header of
  an encapsulated SCTP GSO packet (Sashiko on patch 2). That predates
  this series, and multicast routing does not see such packets:
  sctp_v4_addr_valid() and sctp_v4_available() reject multicast
  addresses.
- Rebase onto net.
- v4: https://lore.kernel.org/netdev/cover.1792838740.git.julius@bairaktaris.de/

Changes in v4:
- Add patch 2 (Sashiko).
- Patch 3: drop GSO packets that are already encapsulated, and set the
  outer length with iph_set_totlen() (Sashiko).
- Drop v3 patch 2 (TCP fixed-ID flag on encapsulation): multicast
  routing does not carry TCP, and the flag also needs the decap and
  GRE/UDP segmentation paths, which go to a separate series (Sashiko).
- Rebase onto net.
- v3: https://lore.kernel.org/netdev/cover.1792293419.git.julius@bairaktaris.de/

Changes in v3:
- Patch 1: name the VXLAN case, where a member has no headroom for the
  tunnel header (Sashiko).
- Add patch 2 (Sashiko).
- Patch 3: reserve one outer IP ID per segment (Sashiko).
- v2: https://lore.kernel.org/netdev/20261011162957.1328474-1-julius@bairaktaris.de/

Changes in v2:
- Add patches 1 and 3; v1 let DF GSO packets reach ip_encap() on tunnel
  vifs, where they were dropped during segmentation (Sashiko).
- Keep the additive MTU comparison and check mtu > encap before
  subtracting, so a route MTU below 20 cannot wrap (Sashiko).
- v1: https://lore.kernel.org/netdev/20261010131842.2157365-1-julius@bairaktaris.de/

I used Claude (Anthropic) to help write these patches.


Julius Bairaktaris (5):
  net: gro: set the inner transport header of encapsulated fraglist
    packets
  net: gso: segment fraglist packets with a software tunnel checksum
  net: gso: count the inner UDP header of encapsulated UDP GSO packets
  ipmr: set up GSO state for tunnel vifs
  ipmr: do not drop GSO packets that fit the MTU after segmentation

 include/net/gso.h        | 24 ++++++++++++++++++++++++
 net/core/gso.c           |  2 ++
 net/ipv4/gre_offload.c   |  2 +-
 net/ipv4/ipmr.c          | 34 +++++++++++++++++++++++++++++++---
 net/ipv4/tcp_offload.c   |  6 +++++-
 net/ipv4/udp_offload.c   |  6 +++++-
 net/ipv6/tcpv6_offload.c |  6 +++++-
 net/ipv6/udp_offload.c   |  3 +++
 8 files changed, 76 insertions(+), 7 deletions(-)


base-commit: acd205ab5c6d762c7ab8f8413a5122e6f6fa2a59
-- 
2.53.0


             reply	other threads:[~2026-11-21 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 21:14 Julius Bairaktaris [this message]
2026-11-21 21:14 ` [PATCH net v6 1/5] net: gro: set the inner transport header of encapsulated fraglist packets Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 2/5] net: gso: segment fraglist packets with a software tunnel checksum Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 3/5] net: gso: count the inner UDP header of encapsulated UDP GSO packets Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 4/5] ipmr: set up GSO state for tunnel vifs Julius Bairaktaris
2026-11-21 21:14 ` [PATCH net v6 5/5] ipmr: do not drop GSO packets that fit the MTU after segmentation Julius Bairaktaris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1795295554.git.julius@bairaktaris.de \
    --to=julius@bairaktaris.de \
    --cc=almasrymina@google.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsdhenrymartin@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jiayuan.chen@linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=mfleming@cloudflare.com \
    --cc=nbd@nbd.name \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardbgobert@gmail.com \
    --cc=steffen.klassert@secunet.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox