Skip to content

idpf: add PSP offload support, part 1

Stan Iliev intel-wired-lan linux-hardening lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest15 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15libie: wipe copied small send buffers on releasedrivers/net/ethernet/intel/libie/controlq.c+24 -40 replies
2/15idpf: wipe mailbox send buffers on releasedrivers/net/ethernet/intel/idpf/idpf_virtchnl.c+4 -40 replies
3/15idpf: make the mailbox workqueue visible in sysfsdrivers/net/ethernet/intel/idpf/idpf_main.c+2 -10 replies
4/15idpf: psp: add psp offload initializationdrivers/net/ethernet/intel/idpf/Makefile drivers/net/ethernet/intel/idpf/idpf.h drivers/net/ethernet/intel/idpf/idpf_lib.c +6 more+188 -01 reply
5/15idpf: psp: add support for crypto capabilitiesdrivers/net/ethernet/intel/idpf/Makefile drivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp_def.h +3 more+182 -11 reply
6/15idpf: psp: add support for psp capabilitiesdrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp_def.h drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c +2 more+150 -10 replies
7/15idpf: psp: add support for fips compliance statusdrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h +1 more+80 -01 reply
8/15idpf: psp: add support for psp rx key allocationdrivers/net/ethernet/intel/idpf/idpf_lib.c drivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h +5 more+243 -01 reply
9/15idpf: psp: add support for psp key rotationdrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h drivers/net/ethernet/intel/idpf/idpf_psp_def.h +4 more+247 -01 reply
10/15idpf: psp: add support for psp statisticsdrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp_def.h drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c +2 more+193 -00 replies
11/15idpf: psp: add psp tx key statedrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h drivers/net/ethernet/intel/idpf/idpf_psp_def.h+112 -00 replies
12/15idpf: psp: add support for psp tx key deletiondrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h drivers/net/ethernet/intel/idpf/idpf_psp_def.h +4 more+286 -10 replies
13/15idpf: psp: add psp work and tx key insertion completiondrivers/net/ethernet/intel/idpf/idpf_lib.c drivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h +5 more+344 -10 replies
14/15idpf: psp: add support for psp tx key insertiondrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp_def.h drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c +3 more+254 -10 replies
15/15idpf: psp: add psp tx key registrationdrivers/net/ethernet/intel/idpf/idpf_psp.c drivers/net/ethernet/intel/idpf/idpf_psp.h drivers/net/ethernet/intel/idpf/idpf_psp_def.h +1 more+72 -00 replies

Reviews trailers per patch

1 of 15 patches has a Reviewed-by or Acked-by.

PatchAleksandr Loktionov
1/15
2/15
3/15
4/15
5/15R-b
6/15
7/15
8/15
9/15
10/15
11/15
12/15
13/15
14/15
15/15

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1

This series adds PSP (PSP Security Protocol) [1] inline crypto offload to idpf, through the PSP device API of the PSP core [2]. It comes in two parts. This is part 1, which adds the control path.

The device encrypts and decrypts the PSP packets. Its control plane (CP) holds the master keys and the security association database (SADB) of the TX keys. idpf manages them with new virtchnl2 commands over the mailbox:
- the CP derives an RX key from a master key and the SPI it allocates, one synchronous request per rx_spi_alloc;
- the TX keys are inserted into the SADB asynchronously, in batches of up to 101 keys. The SA index that the CP returns for a key goes into a TX context descriptor of each of its packets (part 2);
- the SA indexes of the released associations are deleted in batches.

Part 1:
- patches 1-2 wipe the mailbox send buffers on release, as some of the messages carry keys;
- patch 3 makes the mailbox workqueue visible in sysfs, like the PSP workqueue added later;
- patches 4-7 add the PSP initialization and negotiate the crypto offload capabilities, the PSP capabilities and the FIPS compliance status;
- patches 8-10 implement the rx_spi_alloc, key_rotate and get_stats PSP device ops;
- patches 11-15 add the TX key state, and the insertion of the TX keys into the SADB and their deletion.

Part 2 makes idpf_tso() run after the splitq TX resource check, implements the tx_key_add and tx_key_del PSP device ops and the TX and RX datapath, and registers the PSP device. Until then, the only change visible on a device with the crypto offload is the capability negotiation, which also logs the FIPS compliance status.

PSP is only enabled if the CP grants the new VIRTCHNL2_CAP_CRYPTO capability, idpf works as before otherwise. The crypto offload API of the CP uses the virtchnl2 opcodes 560 to 567, the VIRTCHNL2_EVENT_PSP_ROTATE_KEY event and the VIRTCHNL2_PROTO_HDR_PSP protocol ID.

Limitations:
- PSP version 0 (AES-GCM-128) and the splitq queue model only;
- the RX datapath only recognizes the IPv6 PSP packet type;
- master key rotations started by the CP itself can't be reported to the PSP core, as in mlx5;
- the PSP state doesn't survive a hard reset: the PSP device is unregistered at the start of the reset and registered again once the reset is done, as in mlx5.

Testing, of both parts on next-queue/dev-queue:
- each patch built with W=1 (allmodconfig) with gcc 15 and clang 21, and with gcc without CONFIG_INET_PSP: no warnings in idpf, libie and ixd, and no new kernel-doc warnings. checkpatch --strict only asks for blank lines between the new virtchnl2.h structures and their VIRTCHNL2_CHECK_STRUCT_LEN(), which would break the style of the file;
- tools/testing/selftests/drivers/net/psp.py between two hosts with Intel IPU devices (idpf PF, PCI ID 8086:1452), in both directions, plus a local case that checks that a connection keeps receiving after one key rotation: pass:19 fail:1 xfail:2 skip:11. Same result with RX checksum offload off on both hosts, without TCP checksum errors. The skips are the IPv4 cases (no IPv4 on these hosts), PSP versions 1 to 3 and kTLS, the xfails need netdevsim. data_mss_adjust fails since commit 3c6e29760c13 ("tcp: Subtract psp_sk_overhead() in __tcp_mtu_to_mss() and tcp_mss_to_mtu()."): the routes between these hosts have mtu 4220 and advmss 4108, so the PSP overhead no longer reduces the 4096 byte MSS, as that commit intends, while the test expects a 40 byte reduction. It passed on the same hosts without that commit;
- after the tests, the TX keys inserted into the SADB were all deleted once their sockets were gone;
- with part 1 only, the hosts boot, negotiate the crypto offload and log the FIPS compliance status, without a PSP device.

An AI coding assistant was used to rework parts of the code and of the commit messages of this series after an internal review, and an AI code review tool (Sashiko) reviewed the series. I reviewed and tested all the changes.

[1] https://raw.githubusercontent.com/google/psp/main/doc/PSP_Arch_Spec.pdf
[2] https://docs.kernel.org/networking/psp.html

Stan Iliev (15):
libie: wipe copied small send buffers on release
idpf: wipe mailbox send buffers on release
idpf: make the mailbox workqueue visible in sysfs
idpf: psp: add psp offload initialization
idpf: psp: add support for crypto capabilities
idpf: psp: add support for psp capabilities
idpf: psp: add support for fips compliance status
idpf: psp: add support for psp rx key allocation
idpf: psp: add support for psp key rotation
idpf: psp: add support for psp statistics
idpf: psp: add psp tx key state
idpf: psp: add support for psp tx key deletion
idpf: psp: add psp work and tx key insertion completion
idpf: psp: add support for psp tx key insertion
idpf: psp: add psp tx key registration

 drivers/net/ethernet/intel/idpf/Makefile      |   2 +
 drivers/net/ethernet/intel/idpf/idpf.h        |  15 +
 drivers/net/ethernet/intel/idpf/idpf_lib.c    |  16 +
 drivers/net/ethernet/intel/idpf/idpf_main.c   |   5 +-
 drivers/net/ethernet/intel/idpf/idpf_psp.c    | 738 +++++++++++++++
 drivers/net/ethernet/intel/idpf/idpf_psp.h    |  86 ++
 .../net/ethernet/intel/idpf/idpf_psp_def.h    | 190 ++++
 .../ethernet/intel/idpf/idpf_psp_virtchnl.c   | 841 ++++++++++++++++++
 .../ethernet/intel/idpf/idpf_psp_virtchnl.h   |  23 +
 .../intel/idpf/idpf_psp_virtchnl_def.h        |  24 +
 .../net/ethernet/intel/idpf/idpf_virtchnl.c   |  24 +-
 drivers/net/ethernet/intel/libie/controlq.c   |  28 +-
 include/linux/net/intel/virtchnl2.h           | 393 ++++++++
 13 files changed, 2376 insertions(+), 9 deletions(-)
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp.c
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp.h
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_def.h
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
 create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h

base-commit: 4cd5d9c333fb45a4e70ad6a77c44f13bd7312afb

Signature · 1 line
2.56.0.679.gc527c65306-goog