[Openvpn-devel,net-next,v3,0/3] ovpn: reduce cacheline contention in the data path

Message ID 20261012163333.60389-1-marco@mandelbit.com
Headers
Series ovpn: reduce cacheline contention in the data path |

Message

Marco Baffo Oct. 12, 2026, 4:33 p.m. UTC
  Packet processing updates shared peer and key-slot reference counters
and per-peer statistics. These updates cause cacheline contention when
traffic for one peer is spread across CPUs.

Use percpu_ref for peers and key slots, and per-CPU counters for peer
statistics. Separate read-mostly fields from fields written per packet
to reduce false sharing.

Tests used an EPYC 7443 encryptor and a workstation decryptor, with five
flows pinned to separate cores across four CCDs and RPS enabled on the
encryptor's tunnel interface. Results are averages of four interleaved
runs per configuration.

The per-CPU conversions increased throughput from 12.095 to 12.856 Gbit/s
(+6.29%). The cacheline layout changes included in this series added
another 2.11%, bringing the total gain to approximately 8.5%.

With all cores on one CCD, changes ranged from -0.9% to +1.5%, within
measurement variance. The benefit is therefore most visible when traffic
spans CCDs.

Marco Baffo (1):
  ovpn: use per-CPU peer statistics

Ralf Lici (2):
  ovpn: use percpu references for peers
  ovpn: use percpu references for key slots

 drivers/net/ovpn/Makefile      |  1 -
 drivers/net/ovpn/crypto.c      | 16 ++++-----
 drivers/net/ovpn/crypto.h      | 33 +++++++++++++++---
 drivers/net/ovpn/crypto_aead.c | 20 ++++++++---
 drivers/net/ovpn/io.c          | 17 +++++----
 drivers/net/ovpn/netlink.c     | 26 ++++++++------
 drivers/net/ovpn/peer.c        | 59 +++++++++++++++++++++----------
 drivers/net/ovpn/peer.h        | 57 ++++++++++++++++++++++++------
 drivers/net/ovpn/stats.c       | 21 ------------
 drivers/net/ovpn/stats.h       | 63 ++++++++++++++++++++--------------
 drivers/net/ovpn/tcp.c         | 42 +++++++++++------------
 11 files changed, 220 insertions(+), 135 deletions(-)
 delete mode 100644 drivers/net/ovpn/stats.c