Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next v3 00/12] psp: introduce socket-less associations
@ 2026-11-24 22:17 Todd Freed
  2026-11-24 22:17 ` [PATCH net-next v3 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-24 22:17 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, Kuniyuki Iwashima, bpf,
	Asbjørn Sloth Tønnesen, Qingfang Deng,
	Toke Høiland-Jørgensen, Shuah Khan, Jonathan Corbet,
	Shuah Khan, Randy Dunlap, Matthieu Baerts, David Ahern,
	Jonas Köppeler, Hangbin Liu

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.

Relation to the PSP fixes in net:

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

 https://lore.kernel.org/netdev/20261124010601.3995693-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 fix in nf:

  "netfilter: reject: don't quote decrypted payload in icmp errors"

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

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. The netfilter reject expression in netdev and bridge chains
builds its own ICMP errors, outside icmp_send() and icmpv6_send(), which
the net series' ICMP patches cover. A separate patch to nf applies the
same rule there:

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

Relation to the iproute2 series:

 "tc: add the psp action and flower psp matches"

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

adds tc support for the psp action and the flower psp matches, which the
tc selftests of this series need. It waits for this series' uAPI in
iproute2-next, and needs no change for v3: the tc uAPI is the same.

Trees:

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

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

The iproute2 series, plus tc support for the tunnel mode of the offload
series, is at:

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

Testing:

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

v3:
 - psp_dev_encapsulate(): refuse a packet with a checksum to complete
   (CHECKSUM_PARTIAL) for a next header other than TCP or UDP. (Sashiko)
 - Document the sockless_assocs list in struct psp_dev. (Sashiko)
 - The METADATA_PSP checks on the transmit path are now behind a static key,
   enabled while any METADATA_PSP dst exists.
 - flower: psp_dev 0 is rejected, PSP device IDs start at 1. (Sashiko)
 - psp.rst: rx-assoc allocates SPIs from the same space as rx-spi-alloc,
   so stale decap rules have to go before the device rotates, or as soon
   as it does; list the drop of a packet whose socket gained an offload
   while queued; a packet redirected to ingress after encap is delivered
   locally with skb->decrypted set.
   psp_xmit_md() kernel-doc. Selftests: assoc_sockless_tc no longer
   relies on tc to reject decap with an association, use the rekey
   series' helpers, and tdc 3203 and 006b match the kernel's extack. The
   tc-testing dependsOn fix says which probes failed. (Sashiko)
 - CC the maintainers which patchwork flagged.
 - Wrap lines over 80 columns (psp_nl.c, cls_flower.c), fix the unused
   variable and argument warnings in psp.py. psp.py keeps socket.timeout,
   which ruff flags (UP041): it is TimeoutError only from Python 3.10, and the
   kernel's minimum is 3.9.
 - Rebased on net-next.

v2: https://lore.kernel.org/netdev/20261119013103.1092559-1-toddfreed@meta.com
 - 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           |  19 +
 Documentation/networking/psp.rst              | 182 ++++-
 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                   | 106 ++-
 include/net/psp/types.h                       |   4 +
 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                            | 104 ++-
 net/psp/psp_nl.c                              | 244 +++++++
 net/psp/psp_sock.c                            |  16 +-
 net/sched/Kconfig                             |  13 +
 net/sched/Makefile                            |   1 +
 net/sched/act_psp.c                           | 437 ++++++++++++
 net/sched/cls_flower.c                        |  76 ++
 tools/testing/selftests/drivers/net/config    |   5 +
 tools/testing/selftests/drivers/net/psp.py    | 668 +++++++++++++++++-
 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      | 427 +++++++++++
 tools/testing/selftests/tc-testing/tdc.py     |   2 +-
 tools/testing/selftests/tc-testing/tdc.sh     |   1 +
 39 files changed, 2777 insertions(+), 51 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: c2621b518b38ed38e280e008aa33e6c2d302f8cc
-- 
2.53.1-Meta


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

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

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