|
|
Log in / Subscribe / Register

net: tunnel: introduce noref xmit flows for tunnels

From:  Marek Mietus <mmietus97-AT-yahoo.com>
To:  netdev-AT-vger.kernel.org, sd-AT-queasysnail.net, kuba-AT-kernel.org
Subject:  [PATCH net-next v5 00/11] net: tunnel: introduce noref xmit flows for tunnels
Date:  Tue, 13 Jan 2026 17:29:43 +0100
Message-ID:  <20260113162954.5948-1-mmietus97@yahoo.com>
Cc:  Jason-AT-zx2c4.com, Marek Mietus <mmietus97-AT-yahoo.com>
Archive-link:  Article

Currently, tunnel xmit flows always take a reference on the dst_entry
for each xmitted packet. These atomic operations are redundant in some
flows.

This patchset introduces the infrastructure required for converting
the tunnel xmit flows to noref, and converts them where possible.

These changes improve tunnel performance, since less atomic operations
are used.

There are already noref optimizations in both ipv4 and ip6.
(See __ip_queue_xmit, inet6_csk_xmit)
This patchset implements similar optimizations in ip and udp tunnels.

Benchmarks:
I used a vxlan tunnel over a pair of veth peers and measured the average
throughput over multiple samples.

I ran 100 samples on a clean build, and another 100 on a patched
build. Each sample ran for 120 seconds. These were my results:

clean:      71.95 mb/sec, stddev = 1.71
patched:    74.92 mb/sec, stddev = 1.35

TL;DR - This patchset results in a 4% improvement in throughput for
vxlan. It's safe to assume that we might see similar results when testing
other tunnels.

Changes in v5:
 - Reverted dstref object implementation
 - Converted tunnel xmit functions to be noref instead of using dstref objects
 - Added a "noref" output boolean argument in the tunnel lookup functions in order to return noref dsts

Link to v4: https://lore.kernel.org/netdev/20251112072720.5076-1-mmie...

Marek Mietus (11):
  net: dst_cache: add noref versions for dst_cache
  net: tunnel: convert iptunnel_xmit to noref
  net: tunnel: convert udp_tunnel{6,}_xmit_skb to noref
  net: tunnel: allow noref dsts in udp_tunnel{,6}_dst_lookup
  net: ovpn: convert ovpn_udp{4,6}_output to use a noref dst
  wireguard: socket: convert send{4,6} to use a noref dst when possible
  net: tunnel: convert ip_md_tunnel_xmit to use a noref dst when
    possible
  net: tunnel: convert ip_tunnel_xmit to use a noref dst when possible
  net: sctp: convert sctp_v{4,6}_xmit to use a noref dst when possible
  net: sit: convert ipip6_tunnel_xmit to use a noref dst
  net: tipc: convert tipc_udp_xmit to use a noref dst

 drivers/net/amt.c              |   3 +
 drivers/net/bareudp.c          |  28 +++++--
 drivers/net/geneve.c           |  59 ++++++++++-----
 drivers/net/gtp.c              |   5 ++
 drivers/net/ovpn/udp.c         |   8 +-
 drivers/net/vxlan/vxlan_core.c |  39 +++++++---
 drivers/net/wireguard/socket.c |  12 ++-
 include/net/dst_cache.h        |  71 ++++++++++++++++++
 include/net/udp_tunnel.h       |   6 +-
 net/core/dst_cache.c           | 133 ++++++++++++++++++++++++++++++---
 net/ipv4/ip_tunnel.c           |  47 +++++++-----
 net/ipv4/ip_tunnel_core.c      |   2 +-
 net/ipv4/udp_tunnel_core.c     |  16 ++--
 net/ipv6/ip6_udp_tunnel.c      |  19 +++--
 net/ipv6/sit.c                 |  13 +---
 net/sctp/ipv6.c                |   4 +-
 net/sctp/protocol.c            |   4 +-
 net/tipc/udp_media.c           |   6 +-
 18 files changed, 372 insertions(+), 103 deletions(-)

-- 
2.51.0




Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds