Linux Documentation
 help / color / mirror / Atom feed
* [PATCH net-next v2 00/12] psp: introduce socket-less associations
@ 2026-11-19  1:30 Todd Freed
  2026-11-19  1:30 ` [PATCH net-next v2 01/12] psp: get netns from net_device instead of sock Todd Freed
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Todd Freed @ 2026-11-19  1:30 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Andrew Lunn, Björn Töpel,
	Boris Pismenny, Cosmin Ratiu, Daniel Zahka, Donald Hunter,
	Dragos Tatulea, Eric Dumazet, Jakub Kicinski, Jamal Hadi Salim,
	Jiri Pirko, Leon Romanovsky, linux-doc, linux-kernel,
	linux-kselftest, linux-rdma, Mark Bloch, Paolo Abeni,
	Pedro Tammela, Saeed Mahameed, Simon Horman, Tariq Toukan,
	Wei Wang, Willem de Bruijn

PSP associations today are bound to a TCP socket when created. Traffic
on that socket is encapsulated in transport mode PSP, and encrypted.

This series adds PSP which isn't bound to a socket, which allows PSP
encapsulation and encryption to be applied to forwarded traffic. You can
use this to transparently apply PSP to flows, with help from userspace
to manage the tc rules and orchestrate key exchange.

Socket-less PSP is managed over the PSP netlink family. Tx associations
hold the peer's key in the device, and are addressable by ID, for the tc
psp encap action. Rx does not have any kernel state.

Since the kernel keeps no Rx state, it doesn't enforce key rotation for
socket-less Rx. Userspace must remove the decap rules of an SPI before a
second rotation lets the device allocate the same SPI again. The
documentation patch describes this, with ways to use tc to keep track of
the rules.

Series structure:

1, 2/ Prepare PSP to work with non-TCP packets.

3, 4/ Add the netlink commands for socket-less PSP.

5/ Adds a METADATA_PSP dst which carries a socket-less PSP association
on an skb for Tx, and the transmit checks for it.

6/ Adds the act_psp tc action, psp encap and psp decap. Encap is egress
only.

7/ Adds flower matches on PSP header fields, for Rx matching.

8, 9/ Add drv-net tests (netdevsim and hardware).

10/ Makes tc-testing run dependsOn probes outside the test namespace,
where they currently always fail.

11/ Adds tc-testing tests.

12/ Documentation for socket-less PSP.

A following series adds hardware offload of the psp actions and flower
matches, PSP tunnel mode (which is offload only and therefore not
included here), encap on ingress (also offload only), and the mlx5
implementation for switchdev mode. It's available in the tree below.

Dependency on net:

v1 patches 6-8 are now a separate series to net:

  "net: don't redirect decrypted skbs to ingress, psp time-wait validator"

  https://lore.kernel.org/netdev/20261117192411.247117-1-toddfreed@meta.com

This series builds without it, but relies on it: act_psp marks the
packets it encaps decrypted, which mirred and bpf must not send back to
ingress (the data_tc_encap_ingress test fails without the fix), and
act_psp drops packets of sockets with a validator, which non-PSP
time-wait sockets have without the fix.

Relation to the PSP fixes in net:

 "psp, tls: don't send offloaded contents in cleartext"

 https://lore.kernel.org/netdev/20261117203137.804424-1-toddfreed@meta.com

When net is merged into net-next:

 - net/psp/psp_main.c conflicts around psp_dev_encap_ok(), which both
   add: net's only allows TCP, this series' (patch 2) takes any L4
   protocol. Keep this series' version of the function, and its comments
   above it and above psp_dev_encapsulate().
 - tools/testing/selftests/drivers/net/psp.py and
   tools/testing/selftests/drivers/net/config conflict: keep both sides
   (imports, constants, the list of test cases; the NET_ACT_* options).

Relation to the netfilter fixes in nf-next:

Packets which a PSP device decrypted don't have to end in a local PSP
socket. They can already be forwarded or bridged today, but with
socket-less PSP that is the intended use, e.g. a router that decaps and
forwards. Netfilter handles two cases itself, outside the IP stack paths
which the net series fixes, and would send such a packet's decrypted
contents in clear text:

 - The bridge refragments packets which bridge conntrack reassembled
   (br_ip6_fragment(), nf_br_ip_fragment()), without the check of "net:
   don't fragment decrypted skbs".
 - The reject code builds its own ICMP errors and TCP resets
   (nf_reject_skb_v4_unreach() and friends), without icmp_send() and
   icmpv6_send(), which the net series' ICMP patches cover.

A separate series to nf-next applies the net series' rules to both:

  "netfilter: bridge: don't refragment decrypted skbs"
  "netfilter: reject: don't reply to decrypted skbs"

  https://lore.kernel.org/netfilter-devel/20261111003111.3826942-1-toddfreed@meta.com

It doesn't depend on this series, and the two don't conflict.

Trees:

The full tree, with the net fixes, the nf-next series, this series and
the mlx5 offload series, and the conflicts above resolved, is at:

 https://github.com/toddfreed/psptc branch psptc

iproute2 support for the psp action and the PSP flower matches, which
the selftests need, is posted to iproute2-next as "tc: add the psp
action and flower psp matches", and at:

 https://github.com/toddfreed/iproute2-psptc branch tc-psp

It needs no change for v2: the tc uAPI is the same.

Testing:

 - netdevsim: drivers/net psp.py passes (57 tests), and tc-testing
   psp.json (15 tests), with the net fixes series applied and tc from
   the iproute2-next series.
 - mlx5 (ConnectX-7, FW 28.48), two hosts: drivers/net psp.py passes:
   46 pass, 8 skip (GMAC versions not supported by the device),
   3 xfail (netdevsim only), with the net fixes series applied.
 - Each patch builds without warnings with gcc and clang, allmodconfig,
   W=1.

v2:
 - Moved the mirred, bpf and time-wait validator fixes (v1 patches 6-8)
   to a net series, with Fixes tags. (Daniel)
 - Don't store Rx associations at all (Daniel)
 - Keep socket-less Tx associations on their own device list (Daniel)
 - Documentation: the userspace key rotation contract, and the use of tc
   action cookies, filter handles and a chain per key phase to track
   decap rules. (Daniel)
 - act_psp: add .get_fill_size. (Sashiko, Jamal)
 - psp.py: use ctl_file_write(), and _check_data_outq() to wait for
   retransmits. (Sashiko)
 - tc-testing dependsOn fix: add a Fixes tag, and document the probe
   stage. (Sashiko)
 - Outer UDP source port: only use sk_hash for TCP sockets. (Sashiko)
 - flower: don't offload a rule which uses the PSP matches, and reject it
   with skip_sw, until a driver supports them: some drivers would offload
   it without them. (Sashiko)
 - Moved the drop of a packet with both a socket offload and a
   METADATA_PSP dst to the METADATA_PSP patch, with the rest of
   sk_validate_xmit_skb().
 - Say that encap on ingress isn't supported, rather than hardware
   offload only, in act_psp.c, psp.rst and the commit messages.
   (Sashiko)
 - psp.rst: an encapped packet is dropped if it loses its association
   or the PSP device is unregistered, not when the association is
   deleted. (Sashiko)
 - tc-testing: the tests of rejected psp actions match the kernel's
   extack, the decap with an association and encap without an
   association tests are dropped (tc rejects those itself), and the
   flower decap tests also probe for the psp action. (Sashiko)
 - Rebased on net-next.

v1: https://lore.kernel.org/netdev/20261111005533.6436-1-toddfreed@meta.com

Todd Freed (12):
  psp: get netns from net_device instead of sock
  psp: take the psp nexthdr from the packet on encap
  psp: declare psp_assoc_set_tx() in psp.h
  psp: add support for socket-less psp associations
  net: add METADATA_PSP dst to carry a psp association on an skb
  net/sched: add act_psp for psp transport mode
  net/sched: flower: add psp_spi, psp_ver, and psp_dev matches
  selftests: drv-net: psp: test socket-less associations and the tc psp
    action
  selftests: drv-net: psp: test that software encap on ingress drops
  selftests: tc-testing: run dependsOn probes outside the test namespace
  selftests: tc-testing: add tests for the psp action
  Documentation: networking: psp: document socket-less associations

 Documentation/netlink/specs/psp.yaml          |  91 +++
 Documentation/netlink/specs/tc.yaml           |  14 +
 Documentation/networking/psp.rst              | 169 +++-
 MAINTAINERS                                   |   3 +
 .../mellanox/mlx5/core/en_accel/psp_rxtx.c    |   2 +-
 .../net/ethernet/mellanox/mlx5/core/en_main.c |  33 +
 drivers/net/netdevsim/psp.c                   |   2 +-
 include/linux/skbuff.h                        |   4 +
 include/net/dst_metadata.h                    |  19 +
 include/net/flow_dissector.h                  |  18 +
 include/net/psp/functions.h                   |  82 +-
 include/net/psp/types.h                       |   2 +
 include/net/tc_act/tc_psp.h                   |  23 +
 include/uapi/linux/pkt_cls.h                  |   6 +
 include/uapi/linux/psp.h                      |   6 +
 include/uapi/linux/tc_act/tc_psp.h            |  28 +
 net/core/dev.c                                |  50 +-
 net/core/dst.c                                |   5 +
 net/core/flow_dissector.c                     |  27 +
 net/psp/Makefile                              |   2 +-
 net/psp/psp-nl-gen.c                          |  60 ++
 net/psp/psp-nl-gen.h                          |   8 +
 net/psp/psp.h                                 |   7 +
 net/psp/psp_assoc.c                           | 122 +++
 net/psp/psp_main.c                            |  62 +-
 net/psp/psp_nl.c                              | 242 ++++++
 net/psp/psp_sock.c                            |  16 +-
 net/sched/Kconfig                             |  13 +
 net/sched/Makefile                            |   1 +
 net/sched/act_psp.c                           | 439 +++++++++++
 net/sched/cls_flower.c                        |  74 ++
 tools/testing/selftests/drivers/net/config    |   5 +
 tools/testing/selftests/drivers/net/psp.py    | 729 +++++++++++++++++-
 tools/testing/selftests/tc-testing/README     |   1 +
 tools/testing/selftests/tc-testing/config     |   2 +
 .../creating-testcases/AddingTestCases.txt    |   4 +-
 .../tc-testing/tc-tests/actions/psp.json      | 403 ++++++++++
 tools/testing/selftests/tc-testing/tdc.py     |   2 +-
 tools/testing/selftests/tc-testing/tdc.sh     |   1 +
 39 files changed, 2727 insertions(+), 50 deletions(-)
 create mode 100644 include/net/tc_act/tc_psp.h
 create mode 100644 include/uapi/linux/tc_act/tc_psp.h
 create mode 100644 net/psp/psp_assoc.c
 create mode 100644 net/sched/act_psp.c
 create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/psp.json


base-commit: 89f0fb60afdb35cf2a94e6279c8960feb1c4d1d4
-- 
2.53.1-Meta


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-11-19  1:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19  1:30 [PATCH net-next v2 00/12] psp: introduce socket-less associations Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 01/12] psp: get netns from net_device instead of sock Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 02/12] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 03/12] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 04/12] psp: add support for socket-less psp associations Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 05/12] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 06/12] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-19  1:30 ` [PATCH net-next v2 08/12] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-19  1:31 ` [PATCH net-next v2 09/12] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-19  1:31 ` [PATCH net-next v2 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-19  1:31 ` [PATCH net-next v2 11/12] selftests: tc-testing: add tests for the psp action Todd Freed
2026-11-19  1:31 ` [PATCH net-next v2 12/12] Documentation: networking: psp: document socket-less associations Todd Freed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox