[PATCH net-next 0/3] psp: add crypt-offset and spi-threshold attributes

Akhilesh Samineni
2026-04-06T22:23:24Z

This series introduces two new configurable per-device attributes to
the PSP (PSP Security Protocol) subsystem: crypt-offset and spi-threshold.

crypt-offset (Crypt Offset)
----------------------------------
The crypt-offset attribute specifies the byte offset within a packet from
which encryption begins. A non-zero value allows a fixed-size portion of
the packet header to remain in plaintext, which is useful where
intermediate network nodes need to inspect a well-known header before the
encrypted region. The default value is 0, meaning encryption starts
immediately after the PSP header.

spi-threshold (SPI Threshold)
-------------------------------
SPI values are allocated monotonically from a 32-bit per-device space.
The spi-threshold attribute lets userspace configure the SPI value at
which rotation should be triggered before the space is exhausted.

A named constant PSP_SPI_THRESHOLD_DEFAULT (~90% of 0x7FFFFFFF) is
introduced in include/net/psp/types.h as the single authoritative
definition, used by both the PSP core (psp_main.c) and the netdevsim
driver (psp.c). This avoids scattering the magic value across drivers.

A follow-up series will add netlink notification support to alert
subscribed listeners when the configured spi-threshold is reached,
enabling timely SPI rotation.

Akhilesh Samineni (3):
psp: add crypt-offset and spi-threshold get/set attributes
netdevsim: psp: handle the new crypt-offset and spi-threshold get/set operations
selftests: net: psp: add crypt-offset and spi-threshold test cases

Documentation/netlink/specs/psp.yaml | 13 +++++++++
drivers/net/netdevsim/netdevsim.h | 2 ++
drivers/net/netdevsim/psp.c | 6 ++++
include/net/psp/types.h | 7 +++++
include/uapi/linux/psp.h | 2 ++
net/psp/psp-nl-gen.c | 6 ++--
net/psp/psp_main.c | 3 ++
net/psp/psp_nl.c | 27 +++++++++++++++---
tools/testing/selftests/drivers/net/psp.py | 32 +++++++++++++++++++++++
9 files changed, 92 insertions(+), 6 deletions(-)

--
2.45.4