* [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1
@ 2026-11-17 14:55 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
` (14 more replies)
0 siblings, 15 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
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
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 02/15] idpf: wipe mailbox " Stan Iliev
` (13 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
libie_ctlq_xn_send() copies the messages that fit in LIBIE_CP_TX_COPYBREAK
bytes into a DMA buffer of their transaction, which is reused for later
messages but never cleared. The messages can hold secrets, e.g. the PSP
TX keys that idpf inserts into the SADB of the device.
Wipe the copy once the message was sent, when its send queue entry is
cleaned, and when it couldn't be sent. The transaction can be reused as
soon as that entry is cleared, see libie_ctlq_xn_pop_free(): order the
wipe before it with smp_wmb(), paired with smp_acquire__after_ctrl_dep()
after the check of the entry, so that the wipe can't overwrite the next
message on weakly ordered architectures.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/libie/controlq.c | 28 ++++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/libie/controlq.c b/drivers/net/ethernet/intel/libie/controlq.c
index 6214fc036ce5..c31d3c9e792a 100644
--- a/drivers/net/ethernet/intel/libie/controlq.c
+++ b/drivers/net/ethernet/intel/libie/controlq.c
@@ -694,9 +694,16 @@ libie_ctlq_xn_pop_free(struct libie_ctlq_xn_manager *xnm)
* address is dirty in any way, reuse is already safe.
*/
if (xn->tx_msg &&
- data_race(xn->tx_msg->send_mem.pa) == xn->small_dma_mem.pa)
+ /* READ_ONCE() for the control dependency below */
+ data_race(READ_ONCE(xn->tx_msg->send_mem.pa)) ==
+ xn->small_dma_mem.pa)
continue;
+ /* The small buffer is wiped before the message is cleared,
+ * pairs with the smp_wmb() of libie_ctlq_xn_rel_tx_buf()
+ */
+ smp_acquire__after_ctrl_dep();
+
clear_bit(free_idx, xnm->free_xns_bm);
return xn;
@@ -998,6 +1005,8 @@ int libie_ctlq_xn_process_send(struct libie_ctlq_xn_send_params *params,
if (!libie_ctlq_send_desc_avail(ctlq)) {
if (!libie_cp_can_send_onstack(buf_len))
libie_cp_unmap_dma_mem(dev, dma_mem);
+ else
+ memzero_explicit(dma_mem->va, buf_len);
return -EBUSY;
}
@@ -1132,10 +1141,21 @@ static void libie_ctlq_xn_rel_tx_buf(const void *ctx,
{
const struct libie_ctlq_xn_rel_tx_ctx *rel_ctx = ctx;
- if (!libie_cp_can_send_onstack(dma_mem->size)) {
- libie_cp_unmap_dma_mem(rel_ctx->dev, dma_mem);
- rel_ctx->rel_tx_buf(dma_mem->va);
+ /* Small messages are copied into the buffer of their transaction,
+ * which is reused: wipe the copy, the message may hold secrets, e.g.
+ * crypto keys
+ */
+ if (libie_cp_can_send_onstack(dma_mem->size)) {
+ memzero_explicit(dma_mem->va, dma_mem->size);
+ /* libie_ctlq_send_clean() clears the message next, which lets
+ * libie_ctlq_xn_pop_free() reuse the buffer
+ */
+ smp_wmb();
+ return;
}
+
+ libie_cp_unmap_dma_mem(rel_ctx->dev, dma_mem);
+ rel_ctx->rel_tx_buf(dma_mem->va);
}
/**
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 02/15] idpf: wipe mailbox send buffers on release
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs Stan Iliev
` (12 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
The mailbox messages are freed with kfree() once they were sent, or when
they couldn't be sent. Some messages hold secrets, e.g. the PSP TX keys
inserted into the SADB of the device. Free all of them with
kfree_sensitive() instead: the mailbox isn't a fast path.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index c06b2d9bfe0a..fedac4716b08 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -129,7 +129,7 @@ void idpf_recv_event_msg(struct libie_ctlq_ctx *ctx,
*/
static void idpf_mb_clean(struct libie_ctlq_info *asq, bool deinit)
{
- libie_ctlq_xn_send_clean(asq, kfree, deinit);
+ libie_ctlq_xn_send_clean(asq, kfree_sensitive, deinit);
}
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
@@ -218,7 +218,7 @@ int idpf_send_mb_msg(struct idpf_adapter *adapter,
if (err) {
if (!libie_cp_can_send_onstack(send_buf_size))
- kfree(send_buf);
+ kfree_sensitive(send_buf);
return err;
}
@@ -230,7 +230,7 @@ int idpf_send_mb_msg(struct idpf_adapter *adapter,
xn_params->send_buf.iov_len = send_buf_size;
xn_params->xnm = adapter->xnm;
xn_params->ctlq = xn_params->ctlq ? xn_params->ctlq : adapter->asq;
- xn_params->rel_tx_buf = kfree;
+ xn_params->rel_tx_buf = kfree_sensitive;
xn_params->timeout_ms = min_t(u64, xn_params->timeout_ms, timeout_ms);
idpf_mb_clean(xn_params->ctlq, false);
@@ -264,7 +264,7 @@ int idpf_send_mb_msg_kfree(struct idpf_adapter *adapter,
int err = idpf_send_mb_msg(adapter, xn_params, send_buf, send_buf_size);
if (libie_cp_can_send_onstack(send_buf_size))
- kfree(send_buf);
+ kfree_sensitive(send_buf);
return err;
}
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 02/15] idpf: wipe mailbox " Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization Stan Iliev
` (11 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add WQ_SYSFS to the mailbox workqueue: the workqueue attributes are then
exported in /sys/devices/virtual/workqueue/, e.g. to inspect or change
the CPU mask and the nice level of the mailbox workqueue while debugging
mailbox latency. This is one of those cases where, when the need arises,
we wish we had that flag enabled, see https://lwn.net/Articles/967016/.
The PSP workqueue added later in this series sets it too.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
index c855572c5315..566d5804c8c1 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -319,7 +319,8 @@ static int idpf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_serv_wq_alloc;
}
- adapter->mbx_wq = alloc_workqueue("%s-%s-mbx", WQ_UNBOUND | WQ_HIGHPRI,
+ adapter->mbx_wq = alloc_workqueue("%s-%s-mbx",
+ WQ_UNBOUND | WQ_HIGHPRI | WQ_SYSFS,
0, dev_driver_string(dev),
dev_name(dev));
if (!adapter->mbx_wq) {
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (2 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities Stan Iliev
` (10 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add the PSP offload initialization:
- Introduce VIRTCHNL2_CAP_CRYPTO (bit 26 of the other capabilities)
and request it in VIRTCHNL2_OP_GET_CAPS if CONFIG_INET_PSP is
enabled.
- Add struct idpf_adapter_psp to struct idpf_adapter.
- Implement idpf_psp_init(), called from idpf_vc_core_init() on each
core init, including after a hard reset, and idpf_psp_free(), called
from idpf_remove(). PSP is enabled if VIRTCHNL2_CAP_CRYPTO was
granted, see idpf_is_psp_ena(). A failure disables PSP instead of
failing the core init.
- Add the PSP device ops with idpf_psp_set_config(), and
idpf_psp_register()/idpf_psp_unregister(). The PSP device is
registered in a later patch, once all mandatory PSP device ops and the
datapath are implemented.
- Build idpf_psp.c only with CONFIG_INET_PSP, with static inline stubs
in idpf_psp.h otherwise.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/Makefile | 2 +
drivers/net/ethernet/intel/idpf/idpf.h | 15 +++
drivers/net/ethernet/intel/idpf/idpf_lib.c | 1 +
drivers/net/ethernet/intel/idpf/idpf_main.c | 2 +
drivers/net/ethernet/intel/idpf/idpf_psp.c | 115 ++++++++++++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 24 ++++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 21 ++++
.../net/ethernet/intel/idpf/idpf_virtchnl.c | 7 ++
include/linux/net/intel/virtchnl2.h | 1 +
9 files changed, 188 insertions(+)
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
diff --git a/drivers/net/ethernet/intel/idpf/Makefile b/drivers/net/ethernet/intel/idpf/Makefile
index 81b27a406747..3162ea913417 100644
--- a/drivers/net/ethernet/intel/idpf/Makefile
+++ b/drivers/net/ethernet/intel/idpf/Makefile
@@ -21,5 +21,7 @@ idpf-$(CONFIG_IDPF_SINGLEQ) += idpf_singleq_txrx.o
idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_ptp.o
idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_virtchnl_ptp.o
+idpf-$(CONFIG_INET_PSP) += idpf_psp.o
+
idpf-y += xdp.o
idpf-y += xsk.o
diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
index 77729921b0a3..fe16fd99a41d 100644
--- a/drivers/net/ethernet/intel/idpf/idpf.h
+++ b/drivers/net/ethernet/intel/idpf/idpf.h
@@ -28,6 +28,7 @@ struct idpf_rss_data;
#include <linux/net/intel/virtchnl2.h>
#include "idpf_txrx.h"
+#include "idpf_psp_def.h"
#define GETMAXVAL(num_bits) GENMASK((num_bits) - 1, 0)
@@ -625,6 +626,7 @@ struct idpf_rdma_irq {
* @req_vec_chunks: Requested vector chunk data
* @mb_vector: Mailbox vector data
* @irq_mb_handler: Handler for hard interrupt for mailbox
+ * @psp: PSP offload state, see idpf_psp_init()
* @tx_timeout_count: Number of TX timeouts that have occurred
* @avail_queues: Device given queue limits
* @vports: Array to store vports created by the driver
@@ -683,6 +685,7 @@ struct idpf_adapter {
struct idpf_q_vector mb_vector;
irqreturn_t (*irq_mb_handler)(int irq, void *data);
+ struct idpf_adapter_psp psp;
u32 tx_timeout_count;
struct idpf_avail_queue_info avail_queues;
struct idpf_vport **vports;
@@ -761,6 +764,18 @@ static inline bool idpf_is_rdma_cap_ena(struct idpf_adapter *adapter)
return idpf_is_cap_ena(adapter, IDPF_OTHER_CAPS, VIRTCHNL2_CAP_RDMA);
}
+/**
+ * idpf_is_psp_ena - Determine if PSP offload is enabled
+ * @adapter: private data struct
+ *
+ * Return: true if PSP offload was negotiated in the last core init, see
+ * idpf_psp_init(), false otherwise
+ */
+static inline bool idpf_is_psp_ena(const struct idpf_adapter *adapter)
+{
+ return IS_ENABLED(CONFIG_INET_PSP) && READ_ONCE(adapter->psp.enabled);
+}
+
#define IDPF_CAP_RSS (\
VIRTCHNL2_FLOW_IPV4_TCP |\
VIRTCHNL2_FLOW_IPV4_UDP |\
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index e03661503e5f..1385209519b2 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -6,6 +6,7 @@
#include "idpf_ptp.h"
#include "xdp.h"
#include "xsk.h"
+#include "idpf_psp.h"
static const struct net_device_ops idpf_netdev_ops;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_main.c b/drivers/net/ethernet/intel/idpf/idpf_main.c
index 566d5804c8c1..2fab58f4b02b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_main.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_main.c
@@ -5,6 +5,7 @@
#include "idpf_devids.h"
#include "idpf_devlink.h"
#include "idpf_lan_vf_regs.h"
+#include "idpf_psp.h"
#include "idpf_virtchnl.h"
#define DRV_SUMMARY "Intel(R) Infrastructure Data Path Function Linux Driver"
@@ -180,6 +181,7 @@ static void idpf_remove(struct pci_dev *pdev)
}
kfree(adapter->vport_config);
adapter->vport_config = NULL;
+ idpf_psp_free(adapter);
kfree(adapter->netdevs);
adapter->netdevs = NULL;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
new file mode 100644
index 000000000000..c1297ec59163
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -0,0 +1,115 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <net/psp.h>
+
+#include "idpf_psp.h"
+
+/**
+ * idpf_psp_init - Initialize PSP offload
+ * @adapter: private data struct
+ *
+ * Called on each core init, including after a hard reset: PSP offload is
+ * negotiated again, the CP may grant different capabilities. PSP offload uses
+ * the virtchnl2 crypto offload API: if VIRTCHNL2_CAP_CRYPTO was not granted or
+ * the negotiation fails, PSP stays disabled for the adapter instead of failing
+ * the core init, see idpf_is_psp_ena().
+ */
+void idpf_psp_init(struct idpf_adapter *adapter)
+{
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ struct device *dev = &adapter->pdev->dev;
+
+ WRITE_ONCE(psp->enabled, false);
+
+ if (!idpf_is_cap_ena(adapter, IDPF_OTHER_CAPS, VIRTCHNL2_CAP_CRYPTO)) {
+ dev_notice(dev, "PSP disabled, crypto capability not granted\n");
+ return;
+ }
+
+ WRITE_ONCE(psp->enabled, true);
+}
+
+/**
+ * idpf_psp_free - Release the PSP offload resources
+ * @adapter: private data struct
+ *
+ * Called on remove, after idpf_vc_core_deinit().
+ */
+void idpf_psp_free(struct idpf_adapter *adapter)
+{
+ idpf_psp_unregister(adapter);
+}
+
+/**
+ * idpf_psp_set_config - Set the PSP device configuration
+ * @psd: PSP device
+ * @conf: new configuration
+ * @extack: netlink extended ack for error reporting
+ *
+ * The configuration is applied by the PSP core.
+ *
+ * Return: 0.
+ */
+static int idpf_psp_set_config(struct psp_dev *psd, struct psp_dev_config *conf,
+ struct netlink_ext_ack *extack)
+{
+ return 0;
+}
+
+/* PSP device operations, see idpf_psp_register() */
+static struct psp_dev_ops idpf_psp_ops = {
+ .set_config = idpf_psp_set_config,
+};
+
+/**
+ * idpf_psp_register - Register the PSP device
+ * @adapter: private data struct
+ *
+ * Register the PSP device of the first netdev if PSP offload was negotiated
+ * and the netdev is registered.
+ */
+void idpf_psp_register(struct idpf_adapter *adapter)
+{
+ struct device *dev = &adapter->pdev->dev;
+ struct psp_dev *psd;
+
+ if (!idpf_is_psp_ena(adapter) || adapter->psp.psp_dev)
+ return;
+
+ if (!adapter->netdevs || !adapter->netdevs[0] ||
+ !test_bit(IDPF_VPORT_REG_NETDEV, adapter->vport_config[0]->flags))
+ return;
+
+ /* The driver only allocates and inserts PSP version 0 keys */
+ adapter->psp.caps.versions = BIT(PSP_VERSION_HDR0_AES_GCM_128);
+
+ psd = psp_dev_create(adapter->netdevs[0], &idpf_psp_ops,
+ &adapter->psp.caps, NULL);
+ if (IS_ERR(psd)) {
+ dev_err(dev, "PSP failed to register: %pe\n", psd);
+ return;
+ }
+
+ adapter->psp.psp_dev = psd;
+ dev_info(dev, "PSP Netlink device registered successfully: id=%u\n",
+ psd->id);
+}
+
+/**
+ * idpf_psp_unregister - Unregister the PSP device
+ * @adapter: private data struct
+ *
+ * The PSP core deletes the TX keys of all the associations, see
+ * idpf_psp_tx_key_del(). Called before the netdev of the PSP device is
+ * unregistered.
+ */
+void idpf_psp_unregister(struct idpf_adapter *adapter)
+{
+ struct psp_dev *psd = adapter->psp.psp_dev;
+
+ if (!psd)
+ return;
+
+ psp_dev_unregister(psd);
+ adapter->psp.psp_dev = NULL;
+}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
new file mode 100644
index 000000000000..0f89dcc3b398
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _IDPF_PSP_H_
+#define _IDPF_PSP_H_
+
+#include "idpf.h"
+
+#if IS_ENABLED(CONFIG_INET_PSP)
+
+void idpf_psp_init(struct idpf_adapter *adapter);
+void idpf_psp_free(struct idpf_adapter *adapter);
+void idpf_psp_register(struct idpf_adapter *adapter);
+void idpf_psp_unregister(struct idpf_adapter *adapter);
+
+#else /* !CONFIG_INET_PSP */
+
+static inline void idpf_psp_init(struct idpf_adapter *adapter) { }
+static inline void idpf_psp_free(struct idpf_adapter *adapter) { }
+static inline void idpf_psp_register(struct idpf_adapter *adapter) { }
+static inline void idpf_psp_unregister(struct idpf_adapter *adapter) { }
+
+#endif /* CONFIG_INET_PSP */
+
+#endif /* !_IDPF_PSP_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
new file mode 100644
index 000000000000..2edb114784c1
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _IDPF_PSP_DEF_H_
+#define _IDPF_PSP_DEF_H_
+
+#include <net/psp.h>
+
+/**
+ * struct idpf_adapter_psp - PSP offload state of an adapter
+ * @enabled: PSP was negotiated with the CP in the last core init, see
+ * idpf_is_psp_ena()
+ * @psp_dev: the PSP device, see idpf_psp_register()
+ * @caps: capabilities of @psp_dev
+ */
+struct idpf_adapter_psp {
+ bool enabled;
+ struct psp_dev *psp_dev;
+ struct psp_dev_caps caps;
+};
+
+#endif /* !_IDPF_PSP_DEF_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index fedac4716b08..3f669683c8c0 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -9,6 +9,7 @@
#include "idpf.h"
#include "idpf_virtchnl.h"
#include "idpf_ptp.h"
+#include "idpf_psp.h"
/**
* idpf_vid_to_vport - Translate vport id to vport pointer
@@ -584,6 +585,10 @@ static int idpf_send_get_caps_msg(struct idpf_adapter *adapter)
VIRTCHNL2_CAP_PTP |
VIRTCHNL2_CAP_EDT);
+ /* PSP offload uses the virtchnl2 crypto offload API */
+ if (IS_ENABLED(CONFIG_INET_PSP))
+ caps.other_caps |= cpu_to_le64(VIRTCHNL2_CAP_CRYPTO);
+
err = idpf_send_mb_msg_stack(adapter, &xn_params, &caps);
if (err)
return err;
@@ -3179,6 +3184,8 @@ int idpf_vc_core_init(struct idpf_adapter *adapter)
goto intr_rel;
}
+ idpf_psp_init(adapter);
+
err = idpf_ptp_init(adapter);
if (err)
pci_err(adapter->pdev, "PTP init failed, err=%pe\n",
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 39fea65c075c..ec1a742b6557 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -221,6 +221,7 @@ enum virtchnl2_cap_other {
/* Other capability 20 is reserved */
VIRTCHNL2_CAP_FLOW_STEER = BIT_ULL(21),
VIRTCHNL2_CAP_LAN_MEMORY_REGIONS = BIT_ULL(22),
+ VIRTCHNL2_CAP_CRYPTO = BIT_ULL(26),
/* this must be the last capability */
VIRTCHNL2_CAP_OEM = BIT_ULL(63),
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (3 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities Stan Iliev
` (9 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for negotiating the crypto offload capabilities:
- Introduce VIRTCHNL2_OP_CRYPTO_GET_CAPS (564),
enum virtchnl2_cap_crypto and struct virtchnl2_crypto_get_caps.
- Implement idpf_send_get_crypto_caps() in the new
idpf_psp_virtchnl.c and call it from idpf_psp_negotiate_caps() in
idpf_psp_init(). PSP stays disabled, without failing probe, unless
PSP crypto offload and SADB entries are granted with a 21 or 26 bit
SA index width, and the SA indexes of all the SADB entries fit in
the width.
- Store the SADB size and the SA index width of the adapter in
adapter->psp.sadb_entries and adapter->psp.saidx_width.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/Makefile | 2 +-
drivers/net/ethernet/intel/idpf/idpf_psp.c | 61 ++++++++++++++++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 10 +++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 71 +++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 13 ++++
include/linux/net/intel/virtchnl2.h | 26 +++++++
6 files changed, 182 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
diff --git a/drivers/net/ethernet/intel/idpf/Makefile b/drivers/net/ethernet/intel/idpf/Makefile
index 3162ea913417..8db28c228e04 100644
--- a/drivers/net/ethernet/intel/idpf/Makefile
+++ b/drivers/net/ethernet/intel/idpf/Makefile
@@ -21,7 +21,7 @@ idpf-$(CONFIG_IDPF_SINGLEQ) += idpf_singleq_txrx.o
idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_ptp.o
idpf-$(CONFIG_PTP_1588_CLOCK) += idpf_virtchnl_ptp.o
-idpf-$(CONFIG_INET_PSP) += idpf_psp.o
+idpf-$(CONFIG_INET_PSP) += idpf_psp.o idpf_psp_virtchnl.o
idpf-y += xdp.o
idpf-y += xsk.o
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index c1297ec59163..c4f46f7337ef 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -3,6 +3,59 @@
#include <net/psp.h>
#include "idpf_psp.h"
+#include "idpf_psp_virtchnl.h"
+
+/**
+ * idpf_psp_negotiate_caps - Negotiate the crypto and PSP capabilities
+ * @adapter: private data struct
+ *
+ * Query the crypto and PSP capabilities granted by the CP, check that they
+ * cover what the driver implements and apply the negotiated values. Must only
+ * be called if VIRTCHNL2_CAP_CRYPTO was negotiated.
+ *
+ * Return: 0 if PSP offload can be used, negative error code otherwise.
+ */
+static int idpf_psp_negotiate_caps(struct idpf_adapter *adapter)
+{
+ struct virtchnl2_crypto_get_caps crypto_caps = { };
+ struct device *dev = &adapter->pdev->dev;
+ u32 sadb_entries;
+ int err;
+
+ err = idpf_send_get_crypto_caps(adapter, &crypto_caps);
+ if (err)
+ return err;
+
+ if (!(le32_to_cpu(crypto_caps.crypto_caps) & VIRTCHNL2_CAP_CRYPTO_PSP)) {
+ dev_notice(dev, "PSP crypto offload not granted by CP\n");
+ return -EOPNOTSUPP;
+ }
+
+ if (crypto_caps.saidx_width != IDPF_PSP_SAIDX_WIDTH_21 &&
+ crypto_caps.saidx_width != IDPF_PSP_SAIDX_WIDTH_26) {
+ dev_err(dev, "Unsupported PSP SA index width %u\n",
+ crypto_caps.saidx_width);
+ return -EOPNOTSUPP;
+ }
+
+ sadb_entries = le32_to_cpu(crypto_caps.num_sadb_entries);
+ if (!sadb_entries) {
+ dev_notice(dev, "No PSP SADB entries granted by CP\n");
+ return -EOPNOTSUPP;
+ }
+
+ /* The SA indexes of all the SADB entries must fit in the width */
+ if (sadb_entries > BIT(crypto_caps.saidx_width)) {
+ dev_err(dev, "%u PSP SADB entries don't fit in %u bit SA indexes\n",
+ sadb_entries, crypto_caps.saidx_width);
+ return -EOPNOTSUPP;
+ }
+
+ adapter->psp.sadb_entries = sadb_entries;
+ adapter->psp.saidx_width = crypto_caps.saidx_width;
+
+ return 0;
+}
/**
* idpf_psp_init - Initialize PSP offload
@@ -18,6 +71,7 @@ void idpf_psp_init(struct idpf_adapter *adapter)
{
struct idpf_adapter_psp *psp = &adapter->psp;
struct device *dev = &adapter->pdev->dev;
+ int err;
WRITE_ONCE(psp->enabled, false);
@@ -26,6 +80,13 @@ void idpf_psp_init(struct idpf_adapter *adapter)
return;
}
+ err = idpf_psp_negotiate_caps(adapter);
+ if (err) {
+ dev_warn(dev, "PSP disabled, capability negotiation failed: %d\n",
+ err);
+ return;
+ }
+
WRITE_ONCE(psp->enabled, true);
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 2edb114784c1..3a9e40284106 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -5,15 +5,25 @@
#include <net/psp.h>
+/* SA index widths supported by the driver, negotiated per adapter with
+ * VIRTCHNL2_OP_CRYPTO_GET_CAPS, see idpf_psp_negotiate_caps().
+ */
+#define IDPF_PSP_SAIDX_WIDTH_21 21
+#define IDPF_PSP_SAIDX_WIDTH_26 26
+
/**
* struct idpf_adapter_psp - PSP offload state of an adapter
* @enabled: PSP was negotiated with the CP in the last core init, see
* idpf_is_psp_ena()
+ * @sadb_entries: SADB size granted by VIRTCHNL2_OP_CRYPTO_GET_CAPS
+ * @saidx_width: SA index width granted by VIRTCHNL2_OP_CRYPTO_GET_CAPS
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
*/
struct idpf_adapter_psp {
bool enabled;
+ u32 sadb_entries;
+ u8 saidx_width;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
new file mode 100644
index 000000000000..65f7a9f63f90
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include "idpf_psp_virtchnl.h"
+#include "idpf_virtchnl.h"
+
+/**
+ * idpf_print_crypto_caps - Print values inside virtchnl2_crypto_get_caps
+ * @adapter: Driver specific private structure
+ * @caps: Pointer to virtchnl2_crypto_get_caps structure
+ */
+static void idpf_print_crypto_caps(struct idpf_adapter *adapter,
+ const struct virtchnl2_crypto_get_caps *caps)
+{
+ u32 num_sadb_entries = le32_to_cpu(caps->num_sadb_entries);
+ u32 crypto_caps = le32_to_cpu(caps->crypto_caps);
+
+ dev_dbg(&adapter->pdev->dev,
+ "virtchnl2_crypto_get_caps: crypto_caps=0x%08x (PSP=%u), num_sadb_entries=%u, saidx_width=%u\n",
+ crypto_caps, !!(crypto_caps & VIRTCHNL2_CAP_CRYPTO_PSP),
+ num_sadb_entries, caps->saidx_width);
+}
+
+/**
+ * idpf_send_get_crypto_caps - Send VIRTCHNL2_OP_CRYPTO_GET_CAPS request to CP
+ * @adapter: Driver specific private structure
+ * @caps: Output buffer for virtchnl2_crypto_get_caps
+ *
+ * Request the PSP crypto offload. Must only be sent if VIRTCHNL2_CAP_CRYPTO
+ * was granted.
+ *
+ * Return: 0 on success, negative on failure.
+ */
+int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
+ struct virtchnl2_crypto_get_caps *caps)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_CRYPTO_GET_CAPS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ struct virtchnl2_crypto_get_caps *send_caps;
+ int err;
+
+ /* Too large to be sent from the stack */
+ send_caps = kzalloc_obj(*send_caps);
+ if (!send_caps)
+ return -ENOMEM;
+
+ send_caps->crypto_caps = cpu_to_le32(VIRTCHNL2_CAP_CRYPTO_PSP);
+
+ err = idpf_send_mb_msg_kfree(adapter, &xn_params, send_caps,
+ sizeof(*send_caps));
+ if (err) {
+ dev_err(&adapter->pdev->dev, "Failed to get crypto caps: %d\n",
+ err);
+ return err;
+ }
+
+ if (xn_params.recv_mem.iov_len < sizeof(*caps)) {
+ dev_err(&adapter->pdev->dev, "Invalid crypto caps reply size: %zu\n",
+ xn_params.recv_mem.iov_len);
+ err = -EIO;
+ goto release_rx;
+ }
+
+ memcpy(caps, xn_params.recv_mem.iov_base, sizeof(*caps));
+ idpf_print_crypto_caps(adapter, caps);
+
+release_rx:
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+ return err;
+}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
new file mode 100644
index 000000000000..cf82ac9182ef
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _IDPF_PSP_VIRTCHNL_H_
+#define _IDPF_PSP_VIRTCHNL_H_
+
+#include <linux/net/intel/libie/controlq.h>
+
+#include "idpf_psp.h"
+
+int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
+ struct virtchnl2_crypto_get_caps *caps);
+
+#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index ec1a742b6557..59c379afcb71 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -84,6 +84,8 @@ enum virtchnl2_op {
VIRTCHNL2_OP_ADD_FLOW_RULE = 551,
VIRTCHNL2_OP_GET_FLOW_RULE = 552,
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
+ /* Crypto/PSP opcodes */
+ VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
};
/**
@@ -1817,4 +1819,28 @@ struct virtchnl2_flow_rule_add_del {
};
VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_flow_rule_add_del);
+/* Generic crypto offload types */
+enum virtchnl2_cap_crypto {
+ VIRTCHNL2_CAP_CRYPTO_PSP = BIT(0),
+};
+
+/**
+ * struct virtchnl2_crypto_get_caps - Crypto global capabilities
+ * @crypto_caps: See enum virtchnl2_cap_crypto
+ * @num_sadb_entries: Number of SADB entries of the function, not shared with
+ * the other functions of the device
+ * @saidx_width: SA index width in bits
+ * @padding: Padding to 256 bytes
+ *
+ * Request and response of VIRTCHNL2_OP_CRYPTO_GET_CAPS. On input @crypto_caps
+ * holds the requested capabilities, on output the granted ones.
+ */
+struct virtchnl2_crypto_get_caps {
+ __le32 crypto_caps;
+ __le32 num_sadb_entries;
+ u8 saidx_width;
+ u8 padding[247];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(256, virtchnl2_crypto_get_caps);
+
#endif /* _VIRTCHNL_2_H_ */
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (4 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status Stan Iliev
` (8 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for negotiating the PSP capabilities:
- Introduce VIRTCHNL2_OP_PSP_GET_CAPS (565), enum virtchnl2_psp_caps
and struct virtchnl2_psp_get_caps (64 bytes, sent from the stack).
- Introduce the common PSP key definitions:
enum virtchnl2_psp_key_type, VIRTCHNL2_PSP_KEY_SIZE_V0/V1,
enum virtchnl2_psp_domain_type and struct virtchnl2_psp_key_domain.
- Implement idpf_send_get_psp_caps(), which requests all PSP
capabilities, and call it from idpf_psp_negotiate_caps(). PSP stays
disabled unless PSP version 0 keys are granted. The granted
capabilities are stored in adapter->psp.psp_caps.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 15 ++++-
.../net/ethernet/intel/idpf/idpf_psp_def.h | 3 +
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 66 +++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 2 +
include/linux/net/intel/virtchnl2.h | 65 ++++++++++++++++++
5 files changed, 150 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index c4f46f7337ef..252ddb773cf5 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -18,8 +18,9 @@
static int idpf_psp_negotiate_caps(struct idpf_adapter *adapter)
{
struct virtchnl2_crypto_get_caps crypto_caps = { };
+ struct virtchnl2_psp_get_caps psp_caps = { };
struct device *dev = &adapter->pdev->dev;
- u32 sadb_entries;
+ u32 caps, sadb_entries;
int err;
err = idpf_send_get_crypto_caps(adapter, &crypto_caps);
@@ -51,6 +52,18 @@ static int idpf_psp_negotiate_caps(struct idpf_adapter *adapter)
return -EOPNOTSUPP;
}
+ err = idpf_send_get_psp_caps(adapter, &psp_caps);
+ if (err)
+ return err;
+
+ /* The driver only allocates and inserts PSP version 0 keys */
+ caps = le32_to_cpu(psp_caps.psp_caps);
+ if (!(caps & VIRTCHNL2_CAP_PSP_PROTO_V0)) {
+ dev_notice(dev, "PSP version 0 keys not granted by CP\n");
+ return -EOPNOTSUPP;
+ }
+
+ adapter->psp.psp_caps = caps;
adapter->psp.sadb_entries = sadb_entries;
adapter->psp.saidx_width = crypto_caps.saidx_width;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 3a9e40284106..0829d0bbd92b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -17,6 +17,8 @@
* idpf_is_psp_ena()
* @sadb_entries: SADB size granted by VIRTCHNL2_OP_CRYPTO_GET_CAPS
* @saidx_width: SA index width granted by VIRTCHNL2_OP_CRYPTO_GET_CAPS
+ * @psp_caps: PSP capabilities granted by VIRTCHNL2_OP_PSP_GET_CAPS, see
+ * enum virtchnl2_psp_caps
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
*/
@@ -24,6 +26,7 @@ struct idpf_adapter_psp {
bool enabled;
u32 sadb_entries;
u8 saidx_width;
+ u32 psp_caps;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index 65f7a9f63f90..ba114324d818 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -69,3 +69,69 @@ int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
libie_ctlq_release_rx_buf(&xn_params.recv_mem);
return err;
}
+
+/**
+ * idpf_print_psp_caps - Print values inside virtchnl2_psp_get_caps
+ * @adapter: Driver specific private structure
+ * @caps: Pointer to virtchnl2_psp_get_caps structure
+ */
+static void idpf_print_psp_caps(struct idpf_adapter *adapter,
+ const struct virtchnl2_psp_get_caps *caps)
+{
+ u32 psp_caps = le32_to_cpu(caps->psp_caps);
+
+ dev_dbg(&adapter->pdev->dev,
+ "virtchnl2_psp_get_caps: psp_caps=0x%08x (PROTO_V0=%u, PROTO_V1=%u, REQUEST_ROTATION=%u, DOMAIN=%u)\n",
+ psp_caps,
+ !!(psp_caps & VIRTCHNL2_CAP_PSP_PROTO_V0),
+ !!(psp_caps & VIRTCHNL2_CAP_PSP_PROTO_V1),
+ !!(psp_caps & VIRTCHNL2_CAP_PSP_REQUEST_ROTATION),
+ !!(psp_caps & VIRTCHNL2_CAP_PSP_DOMAIN));
+}
+
+/**
+ * idpf_send_get_psp_caps - Send VIRTCHNL2_OP_PSP_GET_CAPS request to CP
+ * @adapter: Driver specific private structure
+ * @caps: Output buffer for virtchnl2_psp_get_caps
+ *
+ * Request all PSP capabilities, PSP capabilities that are not requested are
+ * not available.
+ *
+ * Return: 0 on success, negative on failure.
+ */
+int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
+ struct virtchnl2_psp_get_caps *caps)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_PSP_GET_CAPS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ struct virtchnl2_psp_get_caps send_caps = {
+ .psp_caps = cpu_to_le32(VIRTCHNL2_CAP_PSP_PROTO_V0 |
+ VIRTCHNL2_CAP_PSP_PROTO_V1 |
+ VIRTCHNL2_CAP_PSP_REQUEST_ROTATION |
+ VIRTCHNL2_CAP_PSP_DOMAIN),
+ };
+ int err;
+
+ err = idpf_send_mb_msg_stack(adapter, &xn_params, &send_caps);
+ if (err) {
+ dev_err(&adapter->pdev->dev, "Failed to get PSP caps: %d\n",
+ err);
+ return err;
+ }
+
+ if (xn_params.recv_mem.iov_len < sizeof(*caps)) {
+ dev_err(&adapter->pdev->dev, "Invalid PSP caps reply size: %zu\n",
+ xn_params.recv_mem.iov_len);
+ err = -EIO;
+ goto release_rx;
+ }
+
+ memcpy(caps, xn_params.recv_mem.iov_base, sizeof(*caps));
+ idpf_print_psp_caps(adapter, caps);
+
+release_rx:
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+ return err;
+}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index cf82ac9182ef..b1c64575b417 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -9,5 +9,7 @@
int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
struct virtchnl2_crypto_get_caps *caps);
+int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
+ struct virtchnl2_psp_get_caps *caps);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 59c379afcb71..45cdfc0651e3 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -86,6 +86,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
/* Crypto/PSP opcodes */
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
+ VIRTCHNL2_OP_PSP_GET_CAPS = 565,
};
/**
@@ -1843,4 +1844,68 @@ struct virtchnl2_crypto_get_caps {
};
VIRTCHNL2_CHECK_STRUCT_LEN(256, virtchnl2_crypto_get_caps);
+/* PSP capability flags */
+enum virtchnl2_psp_caps {
+ /* PSP capability 0 is reserved */
+ VIRTCHNL2_CAP_PSP_PROTO_V0 = BIT(1),
+ VIRTCHNL2_CAP_PSP_PROTO_V1 = BIT(2),
+ VIRTCHNL2_CAP_PSP_REQUEST_ROTATION = BIT(3),
+ /* If not granted, the domain field of PSP requests is ignored */
+ VIRTCHNL2_CAP_PSP_DOMAIN = BIT(4),
+ /* PSP capabilities 16 and above are reserved for OEM */
+};
+
+/**
+ * struct virtchnl2_psp_get_caps - PSP global capabilities
+ * @psp_caps: See enum virtchnl2_psp_caps
+ * @padding: Padding to 64 bytes
+ *
+ * Request and response of VIRTCHNL2_OP_PSP_GET_CAPS. PSP capabilities are set
+ * per function: a capability that is not requested is not available.
+ */
+struct virtchnl2_psp_get_caps {
+ __le32 psp_caps;
+ u8 padding[60];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(64, virtchnl2_psp_get_caps);
+
+enum virtchnl2_psp_key_type {
+ VIRTCHNL2_PSP_KEY_TYPE_V0 = 1,
+ VIRTCHNL2_PSP_KEY_TYPE_V1 = 2,
+};
+
+#define VIRTCHNL2_PSP_KEY_SIZE_V0 16
+#define VIRTCHNL2_PSP_KEY_SIZE_V1 32
+
+/* PSP key domain types. Types VIRTCHNL2_PSP_DOMAIN_RESERVED_START to
+ * VIRTCHNL2_PSP_DOMAIN_RESERVED_END are reserved for future versions of the
+ * API, types VIRTCHNL2_PSP_DOMAIN_OEM_START to VIRTCHNL2_PSP_DOMAIN_OEM_END
+ * are OEM specific.
+ */
+enum virtchnl2_psp_domain_type {
+ VIRTCHNL2_PSP_DOMAIN_NONE = 0,
+ VIRTCHNL2_PSP_DOMAIN_RESERVED_START = 1,
+ VIRTCHNL2_PSP_DOMAIN_RESERVED_END = 0x7fff,
+ VIRTCHNL2_PSP_DOMAIN_OEM_START = 0x8000,
+ VIRTCHNL2_PSP_DOMAIN_OEM_END = 0xffff,
+};
+
+/**
+ * struct virtchnl2_psp_key_domain - PSP key domain
+ * @type: See enum virtchnl2_psp_domain_type
+ * @pad: Reserved/padding
+ * @value: Security context used as part of the PSP SPI binding, must be 0
+ * if @type is VIRTCHNL2_PSP_DOMAIN_NONE
+ *
+ * Key domains prevent steering attacks: PSP does not authenticate the IP
+ * header, so a compromised VM changing the destination IP address must not
+ * be able to decrypt the packets of another VM on the same host.
+ */
+struct virtchnl2_psp_key_domain {
+ __le16 type;
+ u8 pad[6];
+ __le64 value;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_key_domain);
+
#endif /* _VIRTCHNL_2_H_ */
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (5 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation Stan Iliev
` (7 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for querying the FIPS compliance status of the crypto
offload:
- Introduce VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS (567) and
struct virtchnl2_get_fips_compliance_status_resp.
- Implement idpf_send_get_fips_compliance_status(), called from
idpf_psp_init(), which logs the status as
"compliant@cmvp_cert_<a>_and_<b>" or "noncompliant". The status is
informational only: failing to read it doesn't disable PSP.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 6 ++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 59 +++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 1 +
include/linux/net/intel/virtchnl2.h | 14 +++++
4 files changed, 80 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 252ddb773cf5..67f1f1d7508c 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -100,6 +100,12 @@ void idpf_psp_init(struct idpf_adapter *adapter)
return;
}
+ /* The FIPS compliance status is informational only */
+ err = idpf_send_get_fips_compliance_status(adapter);
+ if (err)
+ dev_warn(dev, "Failed to get PSP FIPS compliance status: %d\n",
+ err);
+
WRITE_ONCE(psp->enabled, true);
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index ba114324d818..0502ce0b7abe 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -135,3 +135,62 @@ int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
libie_ctlq_release_rx_buf(&xn_params.recv_mem);
return err;
}
+
+/**
+ * idpf_send_get_fips_compliance_status - Get the FIPS compliance status
+ * @adapter: Driver specific private structure
+ *
+ * Query the FIPS compliance status of the crypto offload with
+ * VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS and log it in the legacy
+ * "compliant@cmvp_cert_<a>_and_<b>" form, or as "noncompliant".
+ *
+ * Return: 0 on success, negative on failure.
+ */
+int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ const struct virtchnl2_get_fips_compliance_status_resp *resp;
+ struct device *dev = &adapter->pdev->dev;
+ char status[128];
+ size_t reply_sz;
+ u32 num_certs;
+ int len, err;
+ /* The request has no payload, but libie can't send empty messages */
+ u8 dummy = 0;
+ u32 i;
+
+ err = idpf_send_mb_msg(adapter, &xn_params, &dummy, sizeof(dummy));
+ if (err)
+ return err;
+
+ reply_sz = xn_params.recv_mem.iov_len;
+ resp = xn_params.recv_mem.iov_base;
+ if (reply_sz < sizeof(*resp)) {
+ err = -EIO;
+ goto release_rx;
+ }
+
+ num_certs = le32_to_cpu(resp->num_certs);
+ if (struct_size(resp, certs, num_certs) > reply_sz) {
+ err = -EIO;
+ goto release_rx;
+ }
+
+ if (!num_certs) {
+ dev_info(dev, "PSP FIPS compliance: noncompliant\n");
+ goto release_rx;
+ }
+
+ len = scnprintf(status, sizeof(status), "compliant@cmvp_cert_");
+ for (i = 0; i < num_certs; i++)
+ len += scnprintf(status + len, sizeof(status) - len, "%s%u",
+ i ? "_and_" : "", le32_to_cpu(resp->certs[i]));
+ dev_info(dev, "PSP FIPS compliance: %s\n", status);
+
+release_rx:
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+ return err;
+}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index b1c64575b417..2ade2df2e34e 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -11,5 +11,6 @@ int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
struct virtchnl2_crypto_get_caps *caps);
int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
struct virtchnl2_psp_get_caps *caps);
+int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 45cdfc0651e3..c3a0e7b1b8e2 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -87,6 +87,7 @@ enum virtchnl2_op {
/* Crypto/PSP opcodes */
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
VIRTCHNL2_OP_PSP_GET_CAPS = 565,
+ VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS = 567,
};
/**
@@ -1908,4 +1909,17 @@ struct virtchnl2_psp_key_domain {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_key_domain);
+/**
+ * struct virtchnl2_get_fips_compliance_status_resp - FIPS compliance response
+ * @num_certs: Number of certificates, 0 if not FIPS compliant
+ * @pad: Reserved/padding
+ * @certs: Flexible array of certificate IDs
+ */
+struct virtchnl2_get_fips_compliance_status_resp {
+ __le32 num_certs;
+ u8 pad[4];
+ __le32 certs[] __counted_by_le(num_certs);
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_get_fips_compliance_status_resp);
+
#endif /* _VIRTCHNL_2_H_ */
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (6 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation Stan Iliev
` (6 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for allocating PSP RX keys on demand:
- Introduce VIRTCHNL2_OP_PSP_ALLOCATE_KEYS (560),
enum virtchnl2_psp_allocate_response_flags,
struct virtchnl2_psp_allocate_keys_request/_response and
struct virtchnl2_allocate_psp_key_v0/_v1.
- Implement idpf_send_allocate_psp_key(), which allocates one V0 RX
key with a synchronous request, validates the reply (key type,
keys_size_bytes, length, and an SPI with a key ID, which the PSP core
requires) and wipes the key from the mailbox buffer. The key, its SPI
and its master key generation are returned in struct idpf_psp_rx_key.
- Implement the rx_spi_alloc PSP device op. It gets the adapter from
the netdev of the PSP device, as the vports can be freed while the
PSP device is registered.
- Keep a copy of the vport ID in adapter->psp.vport_id, for the same
reason.
- Wipe the RX keys of late replies, which libie passes to
idpf_recv_event_msg() after the request timed out.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_lib.c | 3 +
drivers/net/ethernet/intel/idpf/idpf_psp.c | 43 +++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 6 ++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 19 ++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 89 +++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 2 +
.../net/ethernet/intel/idpf/idpf_virtchnl.c | 3 +
include/linux/net/intel/virtchnl2.h | 78 ++++++++++++++++
8 files changed, 243 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index 1385209519b2..062753a62f59 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -1144,6 +1144,9 @@ static struct idpf_vport *idpf_vport_alloc(struct idpf_adapter *adapter,
/* fill vport slot in the adapter struct */
adapter->vports[idx] = vport;
adapter->vport_ids[idx] = idpf_get_vport_id(vport);
+ /* Copy for the PSP requests that can run while the vports are freed */
+ if (IS_ENABLED(CONFIG_INET_PSP) && !idx)
+ WRITE_ONCE(adapter->psp.vport_id, adapter->vport_ids[idx]);
adapter->num_alloc_vports++;
/* prepare adapter->next_vport for next use */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 67f1f1d7508c..8ce390bcd617 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -106,6 +106,9 @@ void idpf_psp_init(struct idpf_adapter *adapter)
dev_warn(dev, "Failed to get PSP FIPS compliance status: %d\n",
err);
+ /* The counters cover the time since the core init */
+ atomic_set(&psp->keys_allocated, 0);
+
WRITE_ONCE(psp->enabled, true);
}
@@ -136,9 +139,49 @@ static int idpf_psp_set_config(struct psp_dev *psd, struct psp_dev_config *conf,
return 0;
}
+/**
+ * idpf_psp_rx_spi_alloc - Allocate a PSP RX SPI and key
+ * @psd: PSP device
+ * @version: PSP version
+ * @key: filled with the allocated SPI and key
+ * @extack: netlink extended ack for error reporting
+ *
+ * Allocate one RX key with a synchronous VIRTCHNL2_OP_PSP_ALLOCATE_KEYS
+ * request.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+static int idpf_psp_rx_spi_alloc(struct psp_dev *psd, u32 version,
+ struct psp_key_parsed *key,
+ struct netlink_ext_ack *extack)
+{
+ struct idpf_adapter *adapter = idpf_netdev_to_adapter(psd->main_netdev);
+ struct idpf_psp_rx_key rx_key;
+ int err;
+
+ /* Only version 0 keys are allocated, see idpf_psp_register() */
+ if (psp_key_size(version) != sizeof(rx_key.key)) {
+ NL_SET_ERR_MSG_MOD(extack, "Unsupported PSP version");
+ return -EOPNOTSUPP;
+ }
+
+ err = idpf_send_allocate_psp_key(adapter, &rx_key);
+ if (err) {
+ NL_SET_ERR_MSG_MOD(extack, "Failed to allocate RX SPI and key");
+ return err;
+ }
+
+ key->spi = rx_key.spi;
+ memcpy(key->key, rx_key.key, sizeof(rx_key.key));
+ memzero_explicit(&rx_key, sizeof(rx_key));
+
+ return 0;
+}
+
/* PSP device operations, see idpf_psp_register() */
static struct psp_dev_ops idpf_psp_ops = {
.set_config = idpf_psp_set_config,
+ .rx_spi_alloc = idpf_psp_rx_spi_alloc,
};
/**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index 0f89dcc3b398..fcafe71d3d00 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -11,6 +11,8 @@ void idpf_psp_init(struct idpf_adapter *adapter);
void idpf_psp_free(struct idpf_adapter *adapter);
void idpf_psp_register(struct idpf_adapter *adapter);
void idpf_psp_unregister(struct idpf_adapter *adapter);
+void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg);
#else /* !CONFIG_INET_PSP */
@@ -19,6 +21,10 @@ static inline void idpf_psp_free(struct idpf_adapter *adapter) { }
static inline void idpf_psp_register(struct idpf_adapter *adapter) { }
static inline void idpf_psp_unregister(struct idpf_adapter *adapter) { }
+static inline void
+idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg) { }
+
#endif /* CONFIG_INET_PSP */
#endif /* !_IDPF_PSP_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 0829d0bbd92b..f21bd7de5ae8 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -3,6 +3,7 @@
#ifndef _IDPF_PSP_DEF_H_
#define _IDPF_PSP_DEF_H_
+#include <linux/net/intel/virtchnl2.h>
#include <net/psp.h>
/* SA index widths supported by the driver, negotiated per adapter with
@@ -11,6 +12,18 @@
#define IDPF_PSP_SAIDX_WIDTH_21 21
#define IDPF_PSP_SAIDX_WIDTH_26 26
+/**
+ * struct idpf_psp_rx_key - PSP RX key allocated by the CP
+ * @spi: SPI of the key
+ * @generation: CP master key generation of the key
+ * @key: the key
+ */
+struct idpf_psp_rx_key {
+ __be32 spi;
+ u32 generation;
+ u8 key[VIRTCHNL2_PSP_KEY_SIZE_V0];
+};
+
/**
* struct idpf_adapter_psp - PSP offload state of an adapter
* @enabled: PSP was negotiated with the CP in the last core init, see
@@ -19,6 +32,10 @@
* @saidx_width: SA index width granted by VIRTCHNL2_OP_CRYPTO_GET_CAPS
* @psp_caps: PSP capabilities granted by VIRTCHNL2_OP_PSP_GET_CAPS, see
* enum virtchnl2_psp_caps
+ * @vport_id: ID of adapter->vports[0] for the PSP requests. A copy, as the
+ * PSP device stays registered while the vports are freed and
+ * allocated again during a soft reset. Set in idpf_vport_alloc().
+ * @keys_allocated: RX keys allocated
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
*/
@@ -27,6 +44,8 @@ struct idpf_adapter_psp {
u32 sadb_entries;
u8 saidx_width;
u32 psp_caps;
+ u32 vport_id;
+ atomic_t keys_allocated;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index 0502ce0b7abe..aa50948873a7 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -194,3 +194,92 @@ int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter)
libie_ctlq_release_rx_buf(&xn_params.recv_mem);
return err;
}
+
+/**
+ * idpf_send_allocate_psp_key - Allocate a PSP RX key
+ * @adapter: Driver specific private structure
+ * @key: filled with the allocated SPI and key and their master key generation
+ *
+ * Allocate one RX key with a synchronous VIRTCHNL2_OP_PSP_ALLOCATE_KEYS
+ * request. The caller must be allowed to sleep.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
+ struct idpf_psp_rx_key *key)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_PSP_ALLOCATE_KEYS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ const struct virtchnl2_psp_allocate_keys_response *vc_reply;
+ struct virtchnl2_psp_allocate_keys_request key_req = { };
+ const struct virtchnl2_allocate_psp_key_v0 *v0_key;
+ size_t reply_sz;
+ u32 spi;
+ int err;
+
+ BUILD_BUG_ON(sizeof(key->key) != sizeof(v0_key->v0_key));
+
+ key_req.vport_id = cpu_to_le32(READ_ONCE(adapter->psp.vport_id));
+ key_req.num_keys = cpu_to_le32(1);
+ key_req.key_type = VIRTCHNL2_PSP_KEY_TYPE_V0;
+ /* key_req.domain stays zeroed: VIRTCHNL2_PSP_DOMAIN_NONE */
+
+ err = idpf_send_mb_msg_stack(adapter, &xn_params, &key_req);
+ if (err)
+ return err;
+
+ reply_sz = xn_params.recv_mem.iov_len;
+ vc_reply = xn_params.recv_mem.iov_base;
+ if (reply_sz < sizeof(*vc_reply) + sizeof(*v0_key) ||
+ vc_reply->key_type != VIRTCHNL2_PSP_KEY_TYPE_V0 ||
+ le32_to_cpu(vc_reply->keys_size_bytes) != sizeof(*v0_key)) {
+ net_warn_ratelimited("%s: invalid reply of %zu bytes\n",
+ __func__, reply_sz);
+ err = -EIO;
+ goto release_rx;
+ }
+
+ v0_key = (const struct virtchnl2_allocate_psp_key_v0 *)vc_reply->keys;
+ spi = le32_to_cpu(v0_key->spi);
+ if (!(spi & PSP_SPI_KEY_ID)) {
+ net_warn_ratelimited("%s: invalid SPI %#x\n", __func__, spi);
+ err = -EIO;
+ goto release_rx;
+ }
+
+ key->spi = cpu_to_be32(spi);
+ key->generation = le32_to_cpu(vc_reply->master_key_generation);
+ memcpy(key->key, v0_key->v0_key, sizeof(key->key));
+ atomic_inc(&adapter->psp.keys_allocated);
+
+release_rx:
+ /* Don't leave the RX key in the recycled mailbox buffer */
+ memzero_explicit(xn_params.recv_mem.iov_base, reply_sz);
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+ return err;
+}
+
+/**
+ * idpf_psp_recv_late_reply - Handle a late reply to a PSP request
+ * @adapter: Driver specific private structure
+ * @ctlq_msg: reply, its receive buffer is released by the caller
+ *
+ * libie passes the replies to requests that timed out to idpf_recv_event_msg().
+ * The RX key of an allocation reply is wiped.
+ */
+void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg)
+{
+ const struct kvec *buff = &ctlq_msg->recv_mem;
+
+ switch (ctlq_msg->chnl_opcode) {
+ case VIRTCHNL2_OP_PSP_ALLOCATE_KEYS:
+ if (buff->iov_base)
+ memzero_explicit(buff->iov_base, buff->iov_len);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index 2ade2df2e34e..7ba86b540f2b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -12,5 +12,7 @@ int idpf_send_get_crypto_caps(struct idpf_adapter *adapter,
int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
struct virtchnl2_psp_get_caps *caps);
int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter);
+int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
+ struct idpf_psp_rx_key *key);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 3f669683c8c0..056fd82b3162 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -91,6 +91,9 @@ void idpf_recv_event_msg(struct libie_ctlq_ctx *ctx,
adapter = container_of(ctx, struct idpf_adapter, ctlq_ctx);
if (ctlq_msg->chnl_opcode != VIRTCHNL2_OP_EVENT) {
+ /* Late reply to a PSP request that timed out */
+ idpf_psp_recv_late_reply(adapter, ctlq_msg);
+
dev_dbg(&adapter->pdev->dev,
"Unhandled message with opcode %u from CP\n",
ctlq_msg->chnl_opcode);
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index c3a0e7b1b8e2..0ae439009f44 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -85,6 +85,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_GET_FLOW_RULE = 552,
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
/* Crypto/PSP opcodes */
+ VIRTCHNL2_OP_PSP_ALLOCATE_KEYS = 560,
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
VIRTCHNL2_OP_PSP_GET_CAPS = 565,
VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS = 567,
@@ -1891,6 +1892,15 @@ enum virtchnl2_psp_domain_type {
VIRTCHNL2_PSP_DOMAIN_OEM_END = 0xffff,
};
+/* VIRTCHNL2_PSP_ALLOC_KEY_EXHAUSTED: the keys derived from the current master
+ * key are exhausted and a master key rotation will be performed
+ * automatically. Only set on partial success, i.e. if fewer keys than
+ * requested, but at least one, were allocated.
+ */
+enum virtchnl2_psp_allocate_response_flags {
+ VIRTCHNL2_PSP_ALLOC_KEY_EXHAUSTED = BIT(0),
+};
+
/**
* struct virtchnl2_psp_key_domain - PSP key domain
* @type: See enum virtchnl2_psp_domain_type
@@ -1909,6 +1919,74 @@ struct virtchnl2_psp_key_domain {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_key_domain);
+/**
+ * struct virtchnl2_psp_allocate_keys_request - Allocate PSP RX keys request
+ * @vport_id: Virtual port ID
+ * @num_keys: Number of keys requested, 0 only reads the active master key
+ * generation
+ * @key_type: See enum virtchnl2_psp_key_type
+ * @pad: Reserved/padding
+ * @domain: Key domain, must be zero-filled if VIRTCHNL2_CAP_PSP_DOMAIN was
+ * not granted
+ */
+struct virtchnl2_psp_allocate_keys_request {
+ __le32 vport_id;
+ __le32 num_keys;
+ u8 key_type;
+ u8 pad[7];
+ struct virtchnl2_psp_key_domain domain;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_psp_allocate_keys_request);
+
+/**
+ * struct virtchnl2_allocate_psp_key_v0 - Allocated PSP V0 key entry
+ * @spi: Security parameter index
+ * @pad: Reserved/padding
+ * @v0_key: 128-bit key
+ */
+struct virtchnl2_allocate_psp_key_v0 {
+ __le32 spi;
+ u8 pad[4];
+ u8 v0_key[VIRTCHNL2_PSP_KEY_SIZE_V0];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_allocate_psp_key_v0);
+
+/**
+ * struct virtchnl2_allocate_psp_key_v1 - Allocated PSP V1 key entry
+ * @spi: Security parameter index
+ * @pad: Reserved/padding
+ * @v1_key: 256-bit key
+ */
+struct virtchnl2_allocate_psp_key_v1 {
+ __le32 spi;
+ u8 pad[4];
+ u8 v1_key[VIRTCHNL2_PSP_KEY_SIZE_V1];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_allocate_psp_key_v1);
+
+/**
+ * struct virtchnl2_psp_allocate_keys_response - Allocate PSP RX keys response
+ * @vport_id: Virtual port ID
+ * @key_type: See enum virtchnl2_psp_key_type
+ * @allocate_response_flags: See enum virtchnl2_psp_allocate_response_flags
+ * @pad1: Reserved/padding
+ * @master_key_generation: Master key generation, increased by 1 every time
+ * the set of active master keys changes
+ * @keys_size_bytes: Total size of keys payload in bytes
+ * @keys: Flexible array of struct virtchnl2_allocate_psp_key_v0 or
+ * struct virtchnl2_allocate_psp_key_v1 entries
+ */
+struct virtchnl2_psp_allocate_keys_response {
+ __le32 vport_id;
+ u8 key_type;
+ u8 allocate_response_flags;
+ u8 pad1[2];
+ __le32 master_key_generation;
+ __le32 keys_size_bytes;
+ u8 keys[] __counted_by_le(keys_size_bytes);
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_allocate_keys_response);
+
/**
* struct virtchnl2_get_fips_compliance_status_resp - FIPS compliance response
* @num_certs: Number of certificates, 0 if not FIPS compliant
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (7 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics Stan Iliev
` (5 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for PSP master key rotation:
- Introduce VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST (563),
struct virtchnl2_psp_rotate_keygen_request/_response,
VIRTCHNL2_EVENT_PSP_ROTATE_KEY (4) and
struct virtchnl2_psp_rotation_event/_data.
- Implement the key_rotate PSP device op with
idpf_psp_rotation_request(), which fails with -EOPNOTSUPP if
VIRTCHNL2_CAP_PSP_REQUEST_ROTATION was not granted. The PSP core
increments the PSP device generation before calling the op and
doesn't restore it if the op fails: the op restores it then.
- Track the master key of the allocated RX SPIs, to report their
generation on receive in a later patch: bit 31 of an SPI selects one
of the two master keys of the CP, and the CP master key generation
of the allocation tells when a master key was replaced. The packets
of a master key get the PSP device generation that was current when
its first SPI was allocated, which is the generation of the
associations using it. Associations then survive one rotation, as the
PSP core expects.
- Handle VIRTCHNL2_EVENT_PSP_ROTATE_KEY in idpf_recv_event_msg() with
idpf_psp_rotation_event(), which logs the new master key generation.
The PSP core can't be told about rotations it didn't request, like
in mlx5: document the limitation and a possible solution.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 72 +++++++++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 6 ++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 23 +++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 89 +++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 1 +
.../net/ethernet/intel/idpf/idpf_virtchnl.c | 3 +
include/linux/net/intel/virtchnl2.h | 53 +++++++++++
7 files changed, 247 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 8ce390bcd617..cf0216640ddc 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -106,6 +106,11 @@ void idpf_psp_init(struct idpf_adapter *adapter)
dev_warn(dev, "Failed to get PSP FIPS compliance status: %d\n",
err);
+ /* The master keys are tracked again for the new PSP device */
+ psp->generation = 0;
+ psp->rx_gen[0].gen = IDPF_PSP_GEN_UNKNOWN;
+ psp->rx_gen[1].gen = IDPF_PSP_GEN_UNKNOWN;
+
/* The counters cover the time since the core init */
atomic_set(&psp->keys_allocated, 0);
@@ -139,6 +144,36 @@ static int idpf_psp_set_config(struct psp_dev *psd, struct psp_dev_config *conf,
return 0;
}
+/**
+ * idpf_psp_rx_gen_update - Track the master key of an allocated SPI
+ * @adapter: private data struct
+ * @psd: PSP device, locked
+ * @spi: SPI allocated by the CP
+ * @cp_gen: CP master key generation of @spi
+ *
+ * Bit 31 of an SPI selects one of the two master keys of the CP, a rotation
+ * replaces the older one. The HW doesn't tell which master key decrypted a
+ * packet: report the PSP device generation that was current when the first
+ * SPI of the master key was allocated, which is the generation of the
+ * associations using it, see idpf_psp_rx_process_skb(). The CP master key
+ * generation tells when a master key was replaced, including by a rotation
+ * the PSP core didn't request, see idpf_psp_rotation_event().
+ */
+static void idpf_psp_rx_gen_update(struct idpf_adapter *adapter,
+ struct psp_dev *psd, __be32 spi, u32 cp_gen)
+{
+ struct idpf_psp_rx_gen *rx_gen;
+
+ lockdep_assert_held(&psd->lock);
+
+ rx_gen = &adapter->psp.rx_gen[be32_to_cpu(spi) >> 31];
+ if (rx_gen->gen != IDPF_PSP_GEN_UNKNOWN && rx_gen->cp_gen == cp_gen)
+ return;
+
+ rx_gen->cp_gen = cp_gen;
+ WRITE_ONCE(rx_gen->gen, psd->generation);
+}
+
/**
* idpf_psp_rx_spi_alloc - Allocate a PSP RX SPI and key
* @psd: PSP device
@@ -171,6 +206,8 @@ static int idpf_psp_rx_spi_alloc(struct psp_dev *psd, u32 version,
return err;
}
+ idpf_psp_rx_gen_update(adapter, psd, rx_key.spi, rx_key.generation);
+
key->spi = rx_key.spi;
memcpy(key->key, rx_key.key, sizeof(rx_key.key));
memzero_explicit(&rx_key, sizeof(rx_key));
@@ -178,10 +215,45 @@ static int idpf_psp_rx_spi_alloc(struct psp_dev *psd, u32 version,
return 0;
}
+/**
+ * idpf_psp_key_rotate - Rotate the PSP master keys
+ * @psd: PSP device
+ * @extack: netlink extended ack for error reporting
+ *
+ * The PSP core increments the PSP device generation before calling this op
+ * and doesn't restore it if the op fails, see psp_nl_key_rotate_doit(): restore
+ * it then, the master keys didn't change.
+ *
+ * Return: 0 on success, negative error code on failure.
+ */
+static int idpf_psp_key_rotate(struct psp_dev *psd,
+ struct netlink_ext_ack *extack)
+{
+ struct idpf_adapter *adapter = idpf_netdev_to_adapter(psd->main_netdev);
+ int err;
+
+ err = idpf_psp_rotation_request(adapter);
+ if (err) {
+ psd->generation = adapter->psp.generation;
+
+ if (err == -EOPNOTSUPP)
+ NL_SET_ERR_MSG_MOD(extack, "PSP key rotation request not granted by CP");
+ else
+ NL_SET_ERR_MSG_MOD(extack, "PSP key rotation request failed");
+
+ return err;
+ }
+
+ adapter->psp.generation = psd->generation;
+
+ return 0;
+}
+
/* PSP device operations, see idpf_psp_register() */
static struct psp_dev_ops idpf_psp_ops = {
.set_config = idpf_psp_set_config,
.rx_spi_alloc = idpf_psp_rx_spi_alloc,
+ .key_rotate = idpf_psp_key_rotate,
};
/**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index fcafe71d3d00..34534076da47 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -13,6 +13,8 @@ void idpf_psp_register(struct idpf_adapter *adapter);
void idpf_psp_unregister(struct idpf_adapter *adapter);
void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg);
+void idpf_psp_rotation_event(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg);
#else /* !CONFIG_INET_PSP */
@@ -25,6 +27,10 @@ static inline void
idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg) { }
+static inline void
+idpf_psp_rotation_event(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg) { }
+
#endif /* CONFIG_INET_PSP */
#endif /* !_IDPF_PSP_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index f21bd7de5ae8..3132efe00559 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -24,6 +24,23 @@ struct idpf_psp_rx_key {
u8 key[VIRTCHNL2_PSP_KEY_SIZE_V0];
};
+/* PSP device generation of an SPI phase whose master key isn't known */
+#define IDPF_PSP_GEN_UNKNOWN 0xff
+
+/**
+ * struct idpf_psp_rx_gen - Generation of the master key of an SPI phase
+ * @cp_gen: CP master key generation of the SPIs allocated in the phase
+ * @gen: PSP device generation reported for the packets of the phase,
+ * IDPF_PSP_GEN_UNKNOWN if no SPI was allocated in the phase
+ *
+ * Bit 31 of an SPI selects one of the two master keys of the CP, see
+ * idpf_psp_rx_gen_update().
+ */
+struct idpf_psp_rx_gen {
+ u32 cp_gen;
+ u8 gen;
+};
+
/**
* struct idpf_adapter_psp - PSP offload state of an adapter
* @enabled: PSP was negotiated with the CP in the last core init, see
@@ -35,6 +52,10 @@ struct idpf_psp_rx_key {
* @vport_id: ID of adapter->vports[0] for the PSP requests. A copy, as the
* PSP device stays registered while the vports are freed and
* allocated again during a soft reset. Set in idpf_vport_alloc().
+ * @generation: PSP device generation after the last key rotation, protected
+ * by the PSP device lock, see idpf_psp_key_rotate()
+ * @rx_gen: generation of the master key of each SPI phase, protected by the
+ * PSP device lock, see idpf_psp_rx_gen_update()
* @keys_allocated: RX keys allocated
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
@@ -45,6 +66,8 @@ struct idpf_adapter_psp {
u8 saidx_width;
u32 psp_caps;
u32 vport_id;
+ u8 generation;
+ struct idpf_psp_rx_gen rx_gen[2];
atomic_t keys_allocated;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index aa50948873a7..ddb9fd90291f 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -261,6 +261,95 @@ int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
return err;
}
+/**
+ * idpf_psp_rotation_request - Request a PSP master key rotation
+ * @adapter: Driver specific private structure
+ *
+ * Return: 0 on success, -EOPNOTSUPP if VIRTCHNL2_CAP_PSP_REQUEST_ROTATION was
+ * not granted, other negative error code on failure.
+ */
+int idpf_psp_rotation_request(struct idpf_adapter *adapter)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ const struct virtchnl2_psp_rotate_keygen_response *resp;
+ struct virtchnl2_psp_rotate_keygen_request req = { };
+ int err;
+
+ if (!(adapter->psp.psp_caps & VIRTCHNL2_CAP_PSP_REQUEST_ROTATION))
+ return -EOPNOTSUPP;
+
+ req.vport_id = cpu_to_le32(READ_ONCE(adapter->psp.vport_id));
+ /* req.domain stays zeroed: VIRTCHNL2_PSP_DOMAIN_NONE */
+
+ err = idpf_send_mb_msg_stack(adapter, &xn_params, &req);
+ if (err) {
+ net_warn_ratelimited("%s: err %d\n", __func__, err);
+ return err;
+ }
+
+ resp = xn_params.recv_mem.iov_base;
+ if (xn_params.recv_mem.iov_len >= sizeof(*resp))
+ dev_dbg(&adapter->pdev->dev,
+ "PSP master key generation %u after rotation\n",
+ le32_to_cpu(resp->master_key_generation));
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+
+ return 0;
+}
+
+/**
+ * idpf_psp_rotation_event - Handle a VIRTCHNL2_EVENT_PSP_ROTATE_KEY event
+ * @adapter: Driver specific private structure
+ * @ctlq_msg: event message, its receive buffer is released by the caller
+ *
+ * The CP rotated the master keys, it reports the generation of the new active
+ * master key. The driver tracks the master keys of the RX SPIs it allocates,
+ * see idpf_psp_rx_gen_update(): the next SPIs of the new master key are
+ * reported with the PSP device generation of their associations.
+ *
+ * The PSP core is not told about a rotation that it didn't request: the
+ * associations whose master key the rotation discarded can't receive anymore,
+ * but they aren't marked stale and no key rotation notification is sent. mlx5
+ * has the same limitation, see "no support for protecting against external
+ * rotations" in mlx5e_psp_key_rotate(). The PSP device lock can't be taken
+ * here, as it is held across synchronous mailbox requests that are completed
+ * by the mailbox task running this handler.
+ *
+ * A possible solution, not implemented: a PSP core helper for drivers, e.g.
+ * psp_dev_key_rotated(psd, generation), doing what psp_nl_key_rotate_doit()
+ * does after the ->key_rotate() op succeeded: set the generation, mark the
+ * associations of the discarded master key stale with psp_assocs_key_rotated()
+ * and send the key rotation notification. idpf would call it with the PSP
+ * device lock held from a work item queued here, for the events whose
+ * generation is not the one returned by idpf_psp_rotation_request(): the CP
+ * also sends the event for the rotations the driver requested.
+ */
+void idpf_psp_rotation_event(struct idpf_adapter *adapter,
+ const struct libie_ctlq_msg *ctlq_msg)
+{
+ const struct virtchnl2_psp_rotation_event *rt_event;
+ const struct kvec *buff = &ctlq_msg->recv_mem;
+
+ if (!idpf_is_psp_ena(adapter)) {
+ net_warn_ratelimited("PSP not enabled, ignoring PSP rotation event.\n");
+ return;
+ }
+
+ if (!buff->iov_base || buff->iov_len < sizeof(*rt_event)) {
+ net_warn_ratelimited("Invalid payload size for PSP rotation event, payload size: %zu, expected min: %zu\n",
+ buff->iov_len, sizeof(*rt_event));
+ return;
+ }
+
+ rt_event = buff->iov_base;
+
+ net_info_ratelimited("PSP Rotation Event processed, active master key generation %u.\n",
+ le32_to_cpu(rt_event->psp_rotate_event.active_master_key_generation));
+}
+
/**
* idpf_psp_recv_late_reply - Handle a late reply to a PSP request
* @adapter: Driver specific private structure
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index 7ba86b540f2b..f1b4f7747908 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -14,5 +14,6 @@ int idpf_send_get_psp_caps(struct idpf_adapter *adapter,
int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter);
int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
struct idpf_psp_rx_key *key);
+int idpf_psp_rotation_request(struct idpf_adapter *adapter);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 056fd82b3162..90fe5212095d 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -114,6 +114,9 @@ void idpf_recv_event_msg(struct libie_ctlq_ctx *ctx,
case VIRTCHNL2_EVENT_LINK_CHANGE:
idpf_handle_event_link(adapter, v2e);
break;
+ case VIRTCHNL2_EVENT_PSP_ROTATE_KEY:
+ idpf_psp_rotation_event(adapter, ctlq_msg);
+ break;
default:
dev_err(&adapter->pdev->dev,
"Unknown event %d from PF\n", event);
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 0ae439009f44..29dfa075e169 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -86,6 +86,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
/* Crypto/PSP opcodes */
VIRTCHNL2_OP_PSP_ALLOCATE_KEYS = 560,
+ VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST = 563,
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
VIRTCHNL2_OP_PSP_GET_CAPS = 565,
VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS = 567,
@@ -302,6 +303,7 @@ enum virtchnl2_event_codes {
VIRTCHNL2_EVENT_UNKNOWN = 0,
VIRTCHNL2_EVENT_LINK_CHANGE = 1,
/* Event type 2, 3 are reserved */
+ VIRTCHNL2_EVENT_PSP_ROTATE_KEY = 4,
};
/* Transmit and Receive queue types are valid in legacy as well as split queue
@@ -1987,6 +1989,57 @@ struct virtchnl2_psp_allocate_keys_response {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_allocate_keys_response);
+/**
+ * struct virtchnl2_psp_rotate_keygen_request - Request master key rotation
+ * @vport_id: Virtual port ID
+ * @pad: Reserved/padding
+ * @domain: Key domain, must be zero-filled if VIRTCHNL2_CAP_PSP_DOMAIN was
+ * not granted
+ */
+struct virtchnl2_psp_rotate_keygen_request {
+ __le32 vport_id;
+ u8 pad[4];
+ struct virtchnl2_psp_key_domain domain;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_psp_rotate_keygen_request);
+
+/**
+ * struct virtchnl2_psp_rotate_keygen_response - Master key rotation response
+ * @vport_id: Virtual port ID
+ * @master_key_generation: Master key generation
+ */
+struct virtchnl2_psp_rotate_keygen_response {
+ __le32 vport_id;
+ __le32 master_key_generation;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_psp_rotate_keygen_response);
+
+/**
+ * struct virtchnl2_psp_rotation_data - Master key rotation async event payload
+ * @active_master_key_generation: Active master key generation
+ * @pad: Reserved/padding
+ * @domain: Key domain
+ */
+struct virtchnl2_psp_rotation_data {
+ __le32 active_master_key_generation;
+ u8 pad[4];
+ struct virtchnl2_psp_key_domain domain;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_psp_rotation_data);
+
+/**
+ * struct virtchnl2_psp_rotation_event - Master key rotation async event
+ * @event: Event opcode (VIRTCHNL2_EVENT_PSP_ROTATE_KEY = 4)
+ * @pad: Reserved/padding, aligns @psp_rotate_event to 8 bytes
+ * @psp_rotate_event: Rotation event payload
+ */
+struct virtchnl2_psp_rotation_event {
+ __le32 event;
+ u8 pad[4];
+ struct virtchnl2_psp_rotation_data psp_rotate_event;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_psp_rotation_event);
+
/**
* struct virtchnl2_get_fips_compliance_status_resp - FIPS compliance response
* @num_certs: Number of certificates, 0 if not FIPS compliant
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (8 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 11/15] idpf: psp: add psp tx key state Stan Iliev
` (4 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for the PSP device statistics:
- Introduce VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS (566),
enum virtchnl2_psp_global_stats_type,
struct virtchnl2_psp_global_stats_request/_response,
struct virtchnl2_psp_global_common_stats and
struct virtchnl2_psp_global_addon_stats.
- Implement idpf_send_get_psp_global_stats(): only the requested stat
groups present in the reply are reported as supported.
- Implement the get_stats PSP device op. The last statistics read are
kept in adapter->psp.stats and reported when they can't be read,
e.g. during a reset.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 51 +++++++++++++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 13 ++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 52 +++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 2 +
include/linux/net/intel/virtchnl2.h | 75 +++++++++++++++++++
5 files changed, 193 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index cf0216640ddc..844463754632 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -249,11 +249,62 @@ static int idpf_psp_key_rotate(struct psp_dev *psd,
return 0;
}
+/**
+ * idpf_psp_get_stats - Get the PSP device statistics
+ * @psd: PSP device
+ * @stats: statistics to fill in
+ *
+ * Read the PSP global statistics with VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS. The
+ * last statistics read are reported if they can't be read, e.g. during reset.
+ */
+static void idpf_psp_get_stats(struct psp_dev *psd, struct psp_dev_stats *stats)
+{
+ struct idpf_adapter *adapter = idpf_netdev_to_adapter(psd->main_netdev);
+ struct idpf_psp_dev_stats *cur = &adapter->psp.stats;
+ struct virtchnl2_psp_global_stats_response resp;
+ u32 supported;
+
+ if (!idpf_send_get_psp_global_stats(adapter, &resp)) {
+ supported = le32_to_cpu(resp.supported_stats);
+
+ if (supported & VIRTCHNL2_PSP_STAT_COMMON) {
+ const struct virtchnl2_psp_global_common_stats *cs =
+ &resp.common_stats;
+
+ cur->rx_packets = le64_to_cpu(cs->rx_decrypted_packets);
+ cur->rx_bytes = le64_to_cpu(cs->rx_decrypted_bytes);
+ cur->rx_auth_fail = le32_to_cpu(cs->rx_auth_failures);
+ /* PSP spec: rx_error counts length/framing errors,
+ * rx_bad miscellaneous errors.
+ */
+ cur->rx_error = le32_to_cpu(cs->rx_bad_packets);
+ cur->rx_bad = le32_to_cpu(cs->rx_misc_errors);
+ cur->tx_packets = le64_to_cpu(cs->tx_encrypted_packets);
+ cur->tx_bytes = le64_to_cpu(cs->tx_encrypted_bytes);
+ cur->tx_error = (u64)le32_to_cpu(cs->tx_misc_errors) +
+ le32_to_cpu(cs->tx_bad_packets);
+ if (supported & VIRTCHNL2_PSP_STAT_ADDON)
+ cur->tx_error +=
+ le32_to_cpu(resp.addon_stats.tx_inv_sa_packets);
+ }
+ }
+
+ stats->rx_packets = cur->rx_packets;
+ stats->rx_bytes = cur->rx_bytes;
+ stats->rx_auth_fail = cur->rx_auth_fail;
+ stats->rx_error = cur->rx_error;
+ stats->rx_bad = cur->rx_bad;
+ stats->tx_packets = cur->tx_packets;
+ stats->tx_bytes = cur->tx_bytes;
+ stats->tx_error = cur->tx_error;
+}
+
/* PSP device operations, see idpf_psp_register() */
static struct psp_dev_ops idpf_psp_ops = {
.set_config = idpf_psp_set_config,
.rx_spi_alloc = idpf_psp_rx_spi_alloc,
.key_rotate = idpf_psp_key_rotate,
+ .get_stats = idpf_psp_get_stats,
};
/**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 3132efe00559..fdd65bc5321a 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -56,6 +56,9 @@ struct idpf_psp_rx_gen {
* by the PSP device lock, see idpf_psp_key_rotate()
* @rx_gen: generation of the master key of each SPI phase, protected by the
* PSP device lock, see idpf_psp_rx_gen_update()
+ * @stats: last PSP device statistics read with
+ * VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS, protected by the PSP device
+ * lock, see idpf_psp_get_stats()
* @keys_allocated: RX keys allocated
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
@@ -68,6 +71,16 @@ struct idpf_adapter_psp {
u32 vport_id;
u8 generation;
struct idpf_psp_rx_gen rx_gen[2];
+ struct idpf_psp_dev_stats {
+ u64 rx_packets;
+ u64 rx_bytes;
+ u64 rx_auth_fail;
+ u64 rx_error;
+ u64 rx_bad;
+ u64 tx_packets;
+ u64 tx_bytes;
+ u64 tx_error;
+ } stats;
atomic_t keys_allocated;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index ddb9fd90291f..d36f46a46cfd 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -350,6 +350,58 @@ void idpf_psp_rotation_event(struct idpf_adapter *adapter,
le32_to_cpu(rt_event->psp_rotate_event.active_master_key_generation));
}
+/**
+ * idpf_send_get_psp_global_stats - Send VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS
+ * @adapter: Driver specific private structure
+ * @stats: Output buffer for virtchnl2_psp_global_stats_response
+ *
+ * Request the common and add-on PSP statistics. Only the stat groups set in
+ * @stats->supported_stats are valid: a group is only reported as supported if
+ * it was requested and is present in the reply, which may leave out trailing
+ * groups that are not supported.
+ *
+ * Return: 0 on success, negative on failure.
+ */
+int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
+ struct virtchnl2_psp_global_stats_response *stats)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ const u32 requested = VIRTCHNL2_PSP_STAT_COMMON | VIRTCHNL2_PSP_STAT_ADDON;
+ struct virtchnl2_psp_global_stats_request req = {
+ .requested_stats = cpu_to_le32(requested),
+ };
+ size_t reply_sz;
+ u32 supported;
+ int err;
+
+ err = idpf_send_mb_msg_stack(adapter, &xn_params, &req);
+ if (err)
+ return err;
+
+ reply_sz = xn_params.recv_mem.iov_len;
+ if (reply_sz < offsetof(typeof(*stats), common_stats)) {
+ err = -EIO;
+ goto release_rx;
+ }
+
+ memset(stats, 0, sizeof(*stats));
+ memcpy(stats, xn_params.recv_mem.iov_base, min(reply_sz, sizeof(*stats)));
+
+ supported = le32_to_cpu(stats->supported_stats) & requested;
+ if (reply_sz < offsetofend(typeof(*stats), common_stats))
+ supported &= ~VIRTCHNL2_PSP_STAT_COMMON;
+ if (reply_sz < offsetofend(typeof(*stats), addon_stats))
+ supported &= ~VIRTCHNL2_PSP_STAT_ADDON;
+ stats->supported_stats = cpu_to_le32(supported);
+
+release_rx:
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+ return err;
+}
+
/**
* idpf_psp_recv_late_reply - Handle a late reply to a PSP request
* @adapter: Driver specific private structure
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index f1b4f7747908..b7261385adf6 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -15,5 +15,7 @@ int idpf_send_get_fips_compliance_status(struct idpf_adapter *adapter);
int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
struct idpf_psp_rx_key *key);
int idpf_psp_rotation_request(struct idpf_adapter *adapter);
+int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
+ struct virtchnl2_psp_global_stats_response *stats);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 29dfa075e169..ca07c32b0f1a 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -89,6 +89,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST = 563,
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
VIRTCHNL2_OP_PSP_GET_CAPS = 565,
+ VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS = 566,
VIRTCHNL2_OP_GET_FIPS_COMPLIANCE_STATUS = 567,
};
@@ -2040,6 +2041,80 @@ struct virtchnl2_psp_rotation_event {
};
VIRTCHNL2_CHECK_STRUCT_LEN(32, virtchnl2_psp_rotation_event);
+enum virtchnl2_psp_global_stats_type {
+ VIRTCHNL2_PSP_STAT_COMMON = BIT(0),
+ VIRTCHNL2_PSP_STAT_ADDON = BIT(1),
+};
+
+/**
+ * struct virtchnl2_psp_global_stats_request - PSP global stats request
+ * @requested_stats: Bitmask of requested stats (enum virtchnl2_psp_global_stats_type)
+ * @pad: Reserved/padding
+ *
+ * Stat groups that are not requested are not supported in the response.
+ */
+struct virtchnl2_psp_global_stats_request {
+ __le32 requested_stats;
+ u8 pad[4];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_psp_global_stats_request);
+
+/**
+ * struct virtchnl2_psp_global_common_stats - PSP global common stats
+ * @rx_decrypted_packets: Number of RX decrypted packets
+ * @rx_decrypted_bytes: Number of RX decrypted bytes
+ * @rx_auth_failures: Number of RX auth failures
+ * @rx_misc_errors: Number of RX misc errors
+ * @rx_bad_packets: Number of RX bad packets
+ * @pad1: Reserved/padding
+ * @tx_encrypted_packets: Number of TX encrypted packets
+ * @tx_encrypted_bytes: Number of TX encrypted bytes
+ * @tx_misc_errors: Number of TX misc errors
+ * @tx_bad_packets: Number of TX bad packets
+ */
+struct virtchnl2_psp_global_common_stats {
+ __le64 rx_decrypted_packets;
+ __le64 rx_decrypted_bytes;
+ __le32 rx_auth_failures;
+ __le32 rx_misc_errors;
+ __le32 rx_bad_packets;
+ u8 pad1[4];
+ __le64 tx_encrypted_packets;
+ __le64 tx_encrypted_bytes;
+ __le32 tx_misc_errors;
+ __le32 tx_bad_packets;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(56, virtchnl2_psp_global_common_stats);
+
+/**
+ * struct virtchnl2_psp_global_addon_stats - PSP global addon stats
+ * @tx_inv_sa_packets: Number of TX invalid SA packets
+ * @pad: Reserved/padding
+ */
+struct virtchnl2_psp_global_addon_stats {
+ __le32 tx_inv_sa_packets;
+ u8 pad[4];
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_psp_global_addon_stats);
+
+/**
+ * struct virtchnl2_psp_global_stats_response - PSP global stats response
+ * @supported_stats: Bitmask of supported stats returned
+ * @pad1: Reserved/padding
+ * @common_stats: Common stats structure
+ * @addon_stats: Addon stats structure
+ *
+ * An unsupported stat group followed by a supported one is zero-filled,
+ * trailing unsupported stat groups may be left out of the response.
+ */
+struct virtchnl2_psp_global_stats_response {
+ __le32 supported_stats;
+ u8 pad1[4];
+ struct virtchnl2_psp_global_common_stats common_stats;
+ struct virtchnl2_psp_global_addon_stats addon_stats;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(72, virtchnl2_psp_global_stats_response);
+
/**
* struct virtchnl2_get_fips_compliance_status_resp - FIPS compliance response
* @num_certs: Number of certificates, 0 if not FIPS compliant
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 11/15] idpf: psp: add psp tx key state
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (9 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion Stan Iliev
` (3 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
TX keys are inserted into the SADB asynchronously: the SA index of a
key is only known when the CP replies. Add struct idpf_psp_tx_key, the
reference counted state of a TX key, stored in the driver data of its
PSP association in a later patch:
- idpf_psp_tx_key_alloc(), idpf_psp_tx_key_get() and
idpf_psp_tx_key_put(). The TX path reads the SA index of the key
under RCU: the key is freed after an RCU grace period.
- The SA index is IDPF_PSP_IDX_IN_PROG while the insertion is pending,
IDPF_PSP_IDX_ERROR if it failed and IDPF_PSP_IDX_DELETED once the key
was deleted, see idpf_psp_idx_valid().
- idpf_psp_saidx_ok() checks the SA indexes returned by the CP against
the SA index width negotiated for the adapter.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 51 +++++++++++++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 31 +++++++++++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 30 +++++++++++
3 files changed, 112 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 844463754632..ef23b1699b09 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -128,6 +128,57 @@ void idpf_psp_free(struct idpf_adapter *adapter)
idpf_psp_unregister(adapter);
}
+/**
+ * idpf_psp_tx_key_alloc - Allocate the state of a PSP TX key
+ *
+ * Return: the TX key with a reference, NULL if it couldn't be allocated.
+ */
+struct idpf_psp_tx_key *idpf_psp_tx_key_alloc(void)
+{
+ struct idpf_psp_tx_key *key;
+
+ key = kzalloc_obj(*key);
+ if (!key)
+ return NULL;
+
+ kref_init(&key->ref);
+ spin_lock_init(&key->lock);
+ key->idx = IDPF_PSP_IDX_IN_PROG;
+
+ return key;
+}
+
+/**
+ * idpf_psp_tx_key_free - Free the state of a PSP TX key
+ * @ref: reference count of the TX key
+ */
+static void idpf_psp_tx_key_free(struct kref *ref)
+{
+ struct idpf_psp_tx_key *key = container_of(ref, struct idpf_psp_tx_key,
+ ref);
+
+ /* The TX path may still read the SA index of the key */
+ kfree_rcu(key, rcu);
+}
+
+/**
+ * idpf_psp_tx_key_get - Get a reference on a PSP TX key
+ * @key: the TX key
+ */
+void idpf_psp_tx_key_get(struct idpf_psp_tx_key *key)
+{
+ kref_get(&key->ref);
+}
+
+/**
+ * idpf_psp_tx_key_put - Release a reference on a PSP TX key
+ * @key: the TX key
+ */
+void idpf_psp_tx_key_put(struct idpf_psp_tx_key *key)
+{
+ kref_put(&key->ref, idpf_psp_tx_key_free);
+}
+
/**
* idpf_psp_set_config - Set the PSP device configuration
* @psd: PSP device
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index 34534076da47..44ac750e2c3b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -16,6 +16,37 @@ void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
void idpf_psp_rotation_event(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg);
+struct idpf_psp_tx_key *idpf_psp_tx_key_alloc(void);
+void idpf_psp_tx_key_get(struct idpf_psp_tx_key *key);
+void idpf_psp_tx_key_put(struct idpf_psp_tx_key *key);
+
+/**
+ * idpf_psp_saidx_ok - Check an SA index returned by the CP
+ * @adapter: private data struct
+ * @saidx: the SA index
+ *
+ * Return: true if @saidx fits in the SA index width negotiated for the
+ * adapter, false otherwise.
+ */
+static inline bool idpf_psp_saidx_ok(const struct idpf_adapter *adapter,
+ u32 saidx)
+{
+ return saidx < BIT(adapter->psp.saidx_width);
+}
+
+/**
+ * idpf_psp_idx_valid - Check if the SA index of a TX key is usable
+ * @idx: SA index or state of a TX key, see struct idpf_psp_tx_key
+ *
+ * Only SA indexes checked with idpf_psp_saidx_ok() are stored in a TX key.
+ *
+ * Return: true if @idx is an SA index, false if it is a state.
+ */
+static inline bool idpf_psp_idx_valid(u32 idx)
+{
+ return idx <= IDPF_PSP_IDX_MAX;
+}
+
#else /* !CONFIG_INET_PSP */
static inline void idpf_psp_init(struct idpf_adapter *adapter) { }
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index fdd65bc5321a..9ba99e08853a 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -3,6 +3,8 @@
#ifndef _IDPF_PSP_DEF_H_
#define _IDPF_PSP_DEF_H_
+#include <linux/kref.h>
+#include <linux/spinlock.h>
#include <linux/net/intel/virtchnl2.h>
#include <net/psp.h>
@@ -12,6 +14,34 @@
#define IDPF_PSP_SAIDX_WIDTH_21 21
#define IDPF_PSP_SAIDX_WIDTH_26 26
+/* Largest SA index the driver supports. The SA indexes the CP returns are
+ * checked against the width negotiated for the adapter before they are used,
+ * see idpf_psp_saidx_ok().
+ */
+#define IDPF_PSP_IDX_MAX (BIT(IDPF_PSP_SAIDX_WIDTH_26) - 1)
+/* States of a TX key without a usable SA index, see struct idpf_psp_tx_key */
+#define IDPF_PSP_IDX_NONE (U32_MAX - 3) /* no SA index */
+#define IDPF_PSP_IDX_IN_PROG (U32_MAX - 2) /* insertion pending */
+#define IDPF_PSP_IDX_ERROR (U32_MAX - 1) /* insertion failed */
+#define IDPF_PSP_IDX_DELETED U32_MAX /* key deleted */
+
+/**
+ * struct idpf_psp_tx_key - State of a PSP TX key
+ * @ref: reference count, held by the PSP association, see
+ * idpf_psp_tx_key_add(), and by the lists and the insert request the
+ * key is on
+ * @lock: protects @idx and @hw_idx updates, and @tx_queue
+ * @idx: SA index the TX path uses, or IDPF_PSP_IDX_IN_PROG,
+ * IDPF_PSP_IDX_ERROR or IDPF_PSP_IDX_DELETED. Read without @lock.
+ * @rcu: for freeing the key after the RCU readers of the TX path
+ */
+struct idpf_psp_tx_key {
+ struct kref ref;
+ spinlock_t lock; /* protects the SA indexes and tx_queue */
+ u32 idx;
+ struct rcu_head rcu;
+};
+
/**
* struct idpf_psp_rx_key - PSP RX key allocated by the CP
* @spi: SPI of the key
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (10 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 11/15] idpf: psp: add psp tx key state Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion Stan Iliev
` (2 subsequent siblings)
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for deleting TX keys from the SADB:
- Introduce VIRTCHNL2_OP_PSP_DELETE_KEYS (562) and
struct virtchnl2_psp_delete_keys_request/_response.
- Add the delete queue, filled by idpf_psp_queue_delete(): a list of
the TX keys whose SA index (hw_idx) must be deleted, which holds a
reference on them. No deletion is queued during a reset or remove,
as the SADB is flushed then.
- Implement idpf_send_delete_psp_keys(), which deletes up to
IDPF_PSP_DELETE_KEYS_MAX (1018) SA indexes per request:
- the SA indexes of a request the CP failed, e.g. because of an
invalid SA index, are retried once each on their own;
- only the num_sa_indexes_deleted SA indexes of the reply are
removed, the others are counted as lost;
- a request that timed out is not sent again, as the CP may have
processed it: its SA indexes are counted as lost. A late reply,
passed by libie to idpf_recv_event_msg(), moves the deleted ones
to removed, at most the SA indexes counted as lost since the last
core init;
- a request that couldn't be sent is queued again.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 38 ++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 3 +
.../net/ethernet/intel/idpf/idpf_psp_def.h | 23 +++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 175 +++++++++++++++++-
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 1 +
.../intel/idpf/idpf_psp_virtchnl_def.h | 17 ++
include/linux/net/intel/virtchnl2.h | 30 +++
7 files changed, 286 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index ef23b1699b09..d2a0ba79c7ab 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -106,6 +106,13 @@ void idpf_psp_init(struct idpf_adapter *adapter)
dev_warn(dev, "Failed to get PSP FIPS compliance status: %d\n",
err);
+ /* Initialized the first time PSP is negotiated */
+ if (!psp->initialized) {
+ spin_lock_init(&psp->del_lock);
+ INIT_LIST_HEAD(&psp->del_list);
+ psp->initialized = true;
+ }
+
/* The master keys are tracked again for the new PSP device */
psp->generation = 0;
psp->rx_gen[0].gen = IDPF_PSP_GEN_UNKNOWN;
@@ -113,6 +120,9 @@ void idpf_psp_init(struct idpf_adapter *adapter)
/* The counters cover the time since the core init */
atomic_set(&psp->keys_allocated, 0);
+ atomic_set(&psp->keys_removed, 0);
+ atomic_set(&psp->keys_lost, 0);
+ atomic_set(&psp->del_retries, 0);
WRITE_ONCE(psp->enabled, true);
}
@@ -144,6 +154,8 @@ struct idpf_psp_tx_key *idpf_psp_tx_key_alloc(void)
kref_init(&key->ref);
spin_lock_init(&key->lock);
key->idx = IDPF_PSP_IDX_IN_PROG;
+ key->hw_idx = IDPF_PSP_IDX_NONE;
+ INIT_LIST_HEAD(&key->del_node);
return key;
}
@@ -179,6 +191,32 @@ void idpf_psp_tx_key_put(struct idpf_psp_tx_key *key)
kref_put(&key->ref, idpf_psp_tx_key_free);
}
+/**
+ * idpf_psp_queue_delete - Queue the deletion of the SA index of a TX key
+ * @adapter: private data struct
+ * @key: the TX key, whose hw_idx is the SA index to delete
+ *
+ * The deletion requests are sent by the PSP work, which releases the
+ * reference taken on @key once the SA index was deleted, see
+ * idpf_send_delete_psp_keys(). No deletion is queued during a reset or
+ * remove: the SADB is flushed by the reset, and by the function reset on
+ * remove.
+ */
+void idpf_psp_queue_delete(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key)
+{
+ struct idpf_adapter_psp *psp = &adapter->psp;
+
+ if (idpf_is_reset_in_prog(adapter) ||
+ test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))
+ return;
+
+ idpf_psp_tx_key_get(key);
+ spin_lock_bh(&psp->del_lock);
+ list_add_tail(&key->del_node, &psp->del_list);
+ spin_unlock_bh(&psp->del_lock);
+}
+
/**
* idpf_psp_set_config - Set the PSP device configuration
* @psd: PSP device
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index 44ac750e2c3b..b4f46e43cd83 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -47,6 +47,9 @@ static inline bool idpf_psp_idx_valid(u32 idx)
return idx <= IDPF_PSP_IDX_MAX;
}
+void idpf_psp_queue_delete(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key);
+
#else /* !CONFIG_INET_PSP */
static inline void idpf_psp_init(struct idpf_adapter *adapter) { }
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 9ba99e08853a..3157b40006c1 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -4,10 +4,13 @@
#define _IDPF_PSP_DEF_H_
#include <linux/kref.h>
+#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/net/intel/virtchnl2.h>
#include <net/psp.h>
+#include "idpf_psp_virtchnl_def.h"
+
/* SA index widths supported by the driver, negotiated per adapter with
* VIRTCHNL2_OP_CRYPTO_GET_CAPS, see idpf_psp_negotiate_caps().
*/
@@ -33,12 +36,19 @@
* @lock: protects @idx and @hw_idx updates, and @tx_queue
* @idx: SA index the TX path uses, or IDPF_PSP_IDX_IN_PROG,
* IDPF_PSP_IDX_ERROR or IDPF_PSP_IDX_DELETED. Read without @lock.
+ * @hw_idx: SA index of the key in the SADB, IDPF_PSP_IDX_NONE if it has none
+ * @del_node: entry in the delete queue, see idpf_psp_queue_delete()
+ * @del_single: delete @hw_idx in a request of its own, after a request that
+ * failed
* @rcu: for freeing the key after the RCU readers of the TX path
*/
struct idpf_psp_tx_key {
struct kref ref;
spinlock_t lock; /* protects the SA indexes and tx_queue */
u32 idx;
+ u32 hw_idx;
+ struct list_head del_node;
+ bool del_single;
struct rcu_head rcu;
};
@@ -89,7 +99,14 @@ struct idpf_psp_rx_gen {
* @stats: last PSP device statistics read with
* VIRTCHNL2_OP_GET_PSP_GLOBAL_STATS, protected by the PSP device
* lock, see idpf_psp_get_stats()
+ * @initialized: the locks and lists below were initialized, the first time
+ * PSP was negotiated
+ * @del_lock: protects @del_list
+ * @del_list: TX keys whose SA index is queued for deletion
* @keys_allocated: RX keys allocated
+ * @keys_removed: SA indexes deleted
+ * @keys_lost: SA indexes that couldn't be deleted
+ * @del_retries: SA indexes retried after a failed deletion request
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
*/
@@ -111,7 +128,13 @@ struct idpf_adapter_psp {
u64 tx_bytes;
u64 tx_error;
} stats;
+ bool initialized;
+ spinlock_t del_lock; /* protects del_list */
+ struct list_head del_list;
atomic_t keys_allocated;
+ atomic_t keys_removed;
+ atomic_t keys_lost;
+ atomic_t del_retries;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index d36f46a46cfd..42a7d74db232 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -402,24 +402,197 @@ int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
return err;
}
+/**
+ * idpf_psp_delete_done - Release the TX keys of a deletion request
+ * @adapter: Driver specific private structure
+ * @batch: TX keys of the request
+ * @removed: number of SA indexes the CP deleted
+ * @lost: number of SA indexes that couldn't be deleted
+ */
+static void idpf_psp_delete_done(struct idpf_adapter *adapter,
+ struct list_head *batch, u32 removed,
+ u32 lost)
+{
+ struct idpf_psp_tx_key *key, *tmp;
+
+ atomic_add(removed, &adapter->psp.keys_removed);
+ if (lost) {
+ atomic_add(lost, &adapter->psp.keys_lost);
+ net_warn_ratelimited("%s: %u SA indexes couldn't be deleted\n",
+ __func__, lost);
+ }
+
+ list_for_each_entry_safe(key, tmp, batch, del_node) {
+ list_del_init(&key->del_node);
+ idpf_psp_tx_key_put(key);
+ }
+}
+
+/**
+ * idpf_send_delete_psp_keys - Delete queued SA indexes from the SADB
+ * @adapter: Driver specific private structure
+ *
+ * Send one synchronous VIRTCHNL2_OP_PSP_DELETE_KEYS request for the SA indexes
+ * queued by idpf_psp_queue_delete():
+ * - the CP fails the request if any SA index is invalid: the SA indexes of a
+ * failed request are retried once each, in a request of their own;
+ * - the CP stops the deletion at the first hardware or config queue error:
+ * the SA indexes it didn't delete stay in use and are counted as lost;
+ * - a request that timed out is not sent again, as the CP may have processed
+ * it and its SA indexes may be in use by new keys: they are counted as lost,
+ * a late reply moves the deleted ones to removed, see
+ * idpf_psp_recv_late_reply();
+ * - a request that couldn't be sent is retried the next time the PSP work runs.
+ *
+ * Return: true if SA indexes are still queued for deletion, false otherwise.
+ */
+bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_PSP_DELETE_KEYS,
+ .timeout_ms = IDPF_VC_XN_DEFAULT_TIMEOUT_MSEC,
+ };
+ const struct virtchnl2_psp_delete_keys_response *del_resp;
+ struct virtchnl2_psp_delete_keys_request *del_req;
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ struct idpf_psp_tx_key *key, *tmp;
+ u32 i, removed, num_keys = 0;
+ bool single = false, more;
+ LIST_HEAD(batch);
+ size_t buf_size;
+ int err;
+
+ BUILD_BUG_ON(struct_size_t(struct virtchnl2_psp_delete_keys_request,
+ sa_indexes, IDPF_PSP_DELETE_KEYS_MAX) >
+ LIBIE_CTLQ_MAX_BUF_LEN);
+
+ spin_lock_bh(&psp->del_lock);
+ list_for_each_entry_safe(key, tmp, &psp->del_list, del_node) {
+ /* SA indexes of a failed request are deleted on their own */
+ if (num_keys == IDPF_PSP_DELETE_KEYS_MAX ||
+ (num_keys && key->del_single))
+ break;
+
+ list_move_tail(&key->del_node, &batch);
+ num_keys++;
+ if (key->del_single) {
+ single = true;
+ break;
+ }
+ }
+ more = !list_empty(&psp->del_list);
+ spin_unlock_bh(&psp->del_lock);
+
+ if (!num_keys)
+ return false;
+
+ buf_size = struct_size(del_req, sa_indexes, num_keys);
+ del_req = kzalloc(buf_size, GFP_KERNEL);
+ if (!del_req) {
+ err = -ENOMEM;
+ goto requeue;
+ }
+
+ del_req->vport_id = cpu_to_le32(READ_ONCE(psp->vport_id));
+ del_req->num_sa_indexes = cpu_to_le32(num_keys);
+ /* del_req->domain stays zeroed: VIRTCHNL2_PSP_DOMAIN_NONE */
+ i = 0;
+ list_for_each_entry(key, &batch, del_node)
+ del_req->sa_indexes[i++] = cpu_to_le32(key->hw_idx);
+
+ err = idpf_send_mb_msg_kfree(adapter, &xn_params, del_req, buf_size);
+ switch (err) {
+ case 0:
+ /* The reply has the number of deleted SA indexes, a reply
+ * without it counts all SA indexes as deleted
+ */
+ del_resp = xn_params.recv_mem.iov_base;
+ removed = num_keys;
+ if (xn_params.recv_mem.iov_len >= sizeof(*del_resp))
+ removed = min(num_keys,
+ le32_to_cpu(del_resp->num_sa_indexes_deleted));
+ else
+ net_warn_ratelimited("%s: short reply %zu\n", __func__,
+ xn_params.recv_mem.iov_len);
+ libie_ctlq_release_rx_buf(&xn_params.recv_mem);
+
+ idpf_psp_delete_done(adapter, &batch, removed,
+ num_keys - removed);
+ return more;
+ case -EBADMSG:
+ /* The CP failed the request, e.g. because of an invalid SA
+ * index: retry each SA index on its own, once
+ */
+ if (single)
+ break;
+
+ list_for_each_entry(key, &batch, del_node)
+ key->del_single = true;
+ atomic_add(num_keys, &psp->del_retries);
+ spin_lock_bh(&psp->del_lock);
+ list_splice(&batch, &psp->del_list);
+ spin_unlock_bh(&psp->del_lock);
+
+ return true;
+ case -ETIMEDOUT:
+ break;
+ default:
+ goto requeue;
+ }
+
+ /* The request timed out, or failed again on its own */
+ idpf_psp_delete_done(adapter, &batch, 0, num_keys);
+
+ return more;
+
+requeue:
+ /* The request wasn't sent, e.g. no mailbox transaction was free. A
+ * reset flushes the queue.
+ */
+ spin_lock_bh(&psp->del_lock);
+ list_splice(&batch, &psp->del_list);
+ spin_unlock_bh(&psp->del_lock);
+ net_warn_ratelimited("%s: request not sent: %d\n", __func__, err);
+
+ return false;
+}
+
/**
* idpf_psp_recv_late_reply - Handle a late reply to a PSP request
* @adapter: Driver specific private structure
* @ctlq_msg: reply, its receive buffer is released by the caller
*
* libie passes the replies to requests that timed out to idpf_recv_event_msg().
- * The RX key of an allocation reply is wiped.
+ * The RX key of an allocation reply is wiped. The SA indexes deleted by a
+ * deletion reply were counted as lost, see idpf_send_delete_psp_keys(): they
+ * are counted as removed.
*/
void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg)
{
const struct kvec *buff = &ctlq_msg->recv_mem;
+ const struct virtchnl2_psp_delete_keys_response *del_resp;
+ u32 deleted;
switch (ctlq_msg->chnl_opcode) {
case VIRTCHNL2_OP_PSP_ALLOCATE_KEYS:
if (buff->iov_base)
memzero_explicit(buff->iov_base, buff->iov_len);
break;
+ case VIRTCHNL2_OP_PSP_DELETE_KEYS:
+ del_resp = buff->iov_base;
+ if (!idpf_is_psp_ena(adapter) || ctlq_msg->chnl_retval ||
+ !del_resp || buff->iov_len < sizeof(*del_resp))
+ break;
+
+ /* Only the SA indexes counted as lost since the last core
+ * init, the counters were reset by a reset meanwhile
+ */
+ deleted = min_t(u32, le32_to_cpu(del_resp->num_sa_indexes_deleted),
+ max(atomic_read(&adapter->psp.keys_lost), 0));
+ atomic_sub(deleted, &adapter->psp.keys_lost);
+ atomic_add(deleted, &adapter->psp.keys_removed);
+ break;
default:
break;
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index b7261385adf6..8d8ce4478842 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -17,5 +17,6 @@ int idpf_send_allocate_psp_key(struct idpf_adapter *adapter,
int idpf_psp_rotation_request(struct idpf_adapter *adapter);
int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
struct virtchnl2_psp_global_stats_response *stats);
+bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
new file mode 100644
index 000000000000..c2be65e541be
--- /dev/null
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _IDPF_PSP_VIRTCHNL_DEF_H_
+#define _IDPF_PSP_VIRTCHNL_DEF_H_
+
+#include <linux/net/intel/libie/controlq.h>
+#include <linux/net/intel/virtchnl2.h>
+
+/* PSP key insertion and deletion requests must fit in one mailbox buffer,
+ * which limits the number of TX keys and SA indexes per request.
+ */
+#define IDPF_PSP_DELETE_KEYS_MAX \
+ ((LIBIE_CTLQ_MAX_BUF_LEN - \
+ sizeof(struct virtchnl2_psp_delete_keys_request)) / \
+ sizeof(__le32))
+
+#endif /* !_IDPF_PSP_VIRTCHNL_DEF_H_ */
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index ca07c32b0f1a..903159235832 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -86,6 +86,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
/* Crypto/PSP opcodes */
VIRTCHNL2_OP_PSP_ALLOCATE_KEYS = 560,
+ VIRTCHNL2_OP_PSP_DELETE_KEYS = 562,
VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST = 563,
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
VIRTCHNL2_OP_PSP_GET_CAPS = 565,
@@ -1990,6 +1991,35 @@ struct virtchnl2_psp_allocate_keys_response {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_allocate_keys_response);
+/**
+ * struct virtchnl2_psp_delete_keys_request - Delete PSP TX keys request
+ * @vport_id: Virtual port ID
+ * @num_sa_indexes: Number of SA indexes to delete
+ * @domain: Key domain, must be zero-filled if VIRTCHNL2_CAP_PSP_DOMAIN was
+ * not granted
+ * @sa_indexes: Flexible array of SA indexes to delete
+ */
+struct virtchnl2_psp_delete_keys_request {
+ __le32 vport_id;
+ __le32 num_sa_indexes;
+ struct virtchnl2_psp_key_domain domain;
+ __le32 sa_indexes[] __counted_by_le(num_sa_indexes);
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_psp_delete_keys_request);
+
+/**
+ * struct virtchnl2_psp_delete_keys_response - Delete PSP TX keys response
+ * @vport_id: Virtual port ID
+ * @num_sa_indexes_deleted: Number of SA indexes deleted. The request fails if
+ * any SA index is invalid, and the deletion stops at
+ * the first hardware/config queue error.
+ */
+struct virtchnl2_psp_delete_keys_response {
+ __le32 vport_id;
+ __le32 num_sa_indexes_deleted;
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_psp_delete_keys_response);
+
/**
* struct virtchnl2_psp_rotate_keygen_request - Request master key rotation
* @vport_id: Virtual port ID
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (11 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration Stan Iliev
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add the PSP work and the completion of the asynchronous TX key
insertion requests:
- Add the PSP work on the PSP workqueue, allocated the first time PSP
is negotiated, which sends the queued deletion requests. A request
that couldn't be sent, e.g. because no mailbox transaction was free,
is sent again after IDPF_PSP_RETRY_MSEC: the PSP work is a delayed
work. It is cancelled during a reset and while a soft reset
reallocates the queues, and queued again afterwards.
- Introduce VIRTCHNL2_OP_PSP_INSERT_KEYS (561) and
struct virtchnl2_psp_insert_keys_response.
- Add struct idpf_psp_insert_req, the context of an insertion request,
which holds a reference on its keys: it binds the response callback
to the keys the request was sent for. At most one request is in
flight.
- Implement idpf_psp_tx_key_inserted(), which publishes the SA index
of an inserted key, and idpf_psp_tx_key_failed(). A key deleted
while its insertion was pending gets its SA index deleted.
- libie calls the response callback of a request once, after the
reply or the timeout, except on shutdown: idpf_psp_quiesce(), called
after libie_ctlq_xn_shutdown() in idpf_vc_core_deinit(), fails the
request in flight and drops the delete queue. libie only checks the
timeouts in the mailbox task: a timer runs it once the request timed
out, so that a lost reply in mailbox interrupt mode doesn't block the
insertions.
- The SA indexes of late replies, passed by libie to
idpf_recv_event_msg(), are queued for deletion.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_lib.c | 12 +
drivers/net/ethernet/intel/idpf/idpf_psp.c | 213 ++++++++++++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 14 ++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 34 +++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 50 +++-
.../intel/idpf/idpf_psp_virtchnl_def.h | 3 +
.../net/ethernet/intel/idpf/idpf_virtchnl.c | 3 +
include/linux/net/intel/virtchnl2.h | 16 ++
8 files changed, 344 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index 062753a62f59..18d484c1a2ca 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -1458,6 +1458,9 @@ static int idpf_vport_open(struct idpf_vport *vport, bool rtnl)
idpf_up_complete(vport);
+ /* Send the PSP requests queued while the vport was down */
+ idpf_queue_psp_work(adapter);
+
if (rtnl)
rtnl_unlock();
@@ -1755,6 +1758,9 @@ static void idpf_init_hard_reset(struct idpf_adapter *adapter)
dev_info(dev, "Device HW Reset initiated\n");
+ /* Stop sending PSP requests */
+ idpf_cancel_psp_work(adapter);
+
/* Prepare for reset */
if (test_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {
reg_ops->trigger_reset(adapter, IDPF_HR_DRV_LOAD);
@@ -1882,6 +1888,11 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
if (!new_vport)
return -ENOMEM;
+ /* No PSP packet is sent while the queues are reallocated, the PSP
+ * work is queued again below
+ */
+ idpf_cancel_psp_work(adapter);
+
/* This purposely avoids copying the end of the struct because it
* contains wait_queues and mutexes and other stuff we don't want to
* mess with. Nothing below should use those variables from new_vport
@@ -1970,6 +1981,7 @@ int idpf_initiate_soft_reset(struct idpf_vport *vport,
free_vport:
kfree(new_vport);
+ idpf_queue_psp_work(adapter);
if (reset_cause == IDPF_SR_MTU_CHANGE)
idpf_idc_vdev_mtu_event(vport->vdev_info,
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index d2a0ba79c7ab..373edbef9a7e 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -5,6 +5,101 @@
#include "idpf_psp.h"
#include "idpf_psp_virtchnl.h"
+/* Delay of the insert request timer after the request timeout */
+#define IDPF_PSP_INSERT_TIMER_SLACK_MSEC 1000
+
+/* Delay before the PSP work sends again a request that couldn't be sent */
+#define IDPF_PSP_RETRY_MSEC 100
+
+/**
+ * idpf_queue_psp_work - Queue the PSP work
+ * @adapter: private data struct
+ */
+void idpf_queue_psp_work(struct idpf_adapter *adapter)
+{
+ if (adapter->psp.wq)
+ mod_delayed_work(adapter->psp.wq, &adapter->psp.work, 0);
+}
+
+/**
+ * idpf_retry_psp_work - Queue the PSP work after a request couldn't be sent
+ * @adapter: private data struct
+ *
+ * The request is sent again after IDPF_PSP_RETRY_MSEC, unless the PSP work is
+ * queued earlier.
+ */
+void idpf_retry_psp_work(struct idpf_adapter *adapter)
+{
+ if (adapter->psp.wq)
+ queue_delayed_work(adapter->psp.wq, &adapter->psp.work,
+ msecs_to_jiffies(IDPF_PSP_RETRY_MSEC));
+}
+
+/**
+ * idpf_cancel_psp_work - Cancel the PSP work and wait for it to finish
+ * @adapter: private data struct
+ */
+void idpf_cancel_psp_work(struct idpf_adapter *adapter)
+{
+ if (adapter->psp.wq)
+ cancel_delayed_work_sync(&adapter->psp.work);
+}
+
+/**
+ * idpf_psp_work - Send the PSP key insertion and deletion requests
+ * @work: work of struct idpf_adapter_psp
+ *
+ * Send
+ * at most one request of each kind. The work is queued again when there is
+ * more to do, or after a delay when a request couldn't be sent.
+ */
+static void idpf_psp_work(struct work_struct *work)
+{
+ struct idpf_adapter *adapter = container_of(to_delayed_work(work),
+ struct idpf_adapter,
+ psp.work);
+
+ /* The mailbox is initialized again on reset, and released on remove
+ * and shutdown, see idpf_psp_quiesce()
+ */
+ if (idpf_is_reset_in_prog(adapter) ||
+ test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))
+ return;
+
+ if (idpf_send_delete_psp_keys(adapter))
+ idpf_queue_psp_work(adapter);
+}
+
+/**
+ * idpf_psp_insert_timeout - Insert request timer
+ * @t: insert_timer of struct idpf_adapter_psp
+ *
+ * libie times out asynchronous requests in the mailbox task, which only runs
+ * when the CP sends a message in mailbox interrupt mode. Run it once the insert
+ * request in flight timed out, so that a lost reply doesn't block the key
+ * insertions.
+ */
+static void idpf_psp_insert_timeout(struct timer_list *t)
+{
+ struct idpf_adapter_psp *psp = timer_container_of(psp, t, insert_timer);
+ struct idpf_adapter *adapter = container_of(psp, struct idpf_adapter,
+ psp);
+
+ queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
+}
+
+/**
+ * idpf_psp_insert_timer_arm - Start the insert request timer
+ * @adapter: private data struct
+ * @timeout_ms: timeout of the insert request
+ */
+void idpf_psp_insert_timer_arm(struct idpf_adapter *adapter, u32 timeout_ms)
+{
+ mod_timer(&adapter->psp.insert_timer,
+ jiffies + msecs_to_jiffies(timeout_ms +
+ IDPF_PSP_INSERT_TIMER_SLACK_MSEC));
+}
+
/**
* idpf_psp_negotiate_caps - Negotiate the crypto and PSP capabilities
* @adapter: private data struct
@@ -110,9 +205,23 @@ void idpf_psp_init(struct idpf_adapter *adapter)
if (!psp->initialized) {
spin_lock_init(&psp->del_lock);
INIT_LIST_HEAD(&psp->del_list);
+ INIT_DELAYED_WORK(&psp->work, idpf_psp_work);
+ spin_lock_init(&psp->insert_lock);
+ timer_setup(&psp->insert_timer, idpf_psp_insert_timeout, 0);
psp->initialized = true;
}
+ if (!psp->wq) {
+ psp->wq = alloc_workqueue("%s-%s-psp",
+ WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_SYSFS,
+ 0, dev_driver_string(dev),
+ dev_name(dev));
+ if (!psp->wq) {
+ dev_warn(dev, "PSP disabled, failed to allocate the workqueue\n");
+ return;
+ }
+ }
+
/* The master keys are tracked again for the new PSP device */
psp->generation = 0;
psp->rx_gen[0].gen = IDPF_PSP_GEN_UNKNOWN;
@@ -123,10 +232,60 @@ void idpf_psp_init(struct idpf_adapter *adapter)
atomic_set(&psp->keys_removed, 0);
atomic_set(&psp->keys_lost, 0);
atomic_set(&psp->del_retries, 0);
+ atomic_set(&psp->keys_inserted, 0);
+ atomic_set(&psp->insert_errors, 0);
+ atomic_set(&psp->insert_late, 0);
WRITE_ONCE(psp->enabled, true);
}
+/**
+ * idpf_psp_quiesce - Stop the PSP work and drop the pending requests
+ * @adapter: private data struct
+ *
+ * Called after libie_ctlq_xn_shutdown(), which discards the asynchronous
+ * transactions without calling their response callback: the keys of the
+ * insert request in flight are failed here. The SA indexes queued for deletion
+ * are dropped, as the SADB is flushed by the reset or remove that follows, see
+ * idpf_psp_queue_delete().
+ */
+void idpf_psp_quiesce(struct idpf_adapter *adapter)
+{
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ struct idpf_psp_insert_req *req;
+ struct idpf_psp_tx_key *key, *tmp;
+ LIST_HEAD(keys);
+ u32 i;
+
+ if (!psp->wq)
+ return;
+
+ cancel_delayed_work_sync(&psp->work);
+ timer_delete_sync(&psp->insert_timer);
+
+ spin_lock_bh(&psp->insert_lock);
+ req = psp->insert_req;
+ psp->insert_req = NULL;
+ spin_unlock_bh(&psp->insert_lock);
+
+ if (req) {
+ for (i = 0; i < req->num_keys; i++) {
+ idpf_psp_tx_key_failed(adapter, req->keys[i]);
+ idpf_psp_tx_key_put(req->keys[i]);
+ }
+ kfree(req);
+ }
+
+ spin_lock_bh(&psp->del_lock);
+ list_splice_init(&psp->del_list, &keys);
+ spin_unlock_bh(&psp->del_lock);
+
+ list_for_each_entry_safe(key, tmp, &keys, del_node) {
+ list_del_init(&key->del_node);
+ idpf_psp_tx_key_put(key);
+ }
+}
+
/**
* idpf_psp_free - Release the PSP offload resources
* @adapter: private data struct
@@ -136,6 +295,13 @@ void idpf_psp_init(struct idpf_adapter *adapter)
void idpf_psp_free(struct idpf_adapter *adapter)
{
idpf_psp_unregister(adapter);
+
+ if (!adapter->psp.wq)
+ return;
+
+ idpf_psp_quiesce(adapter);
+ destroy_workqueue(adapter->psp.wq);
+ adapter->psp.wq = NULL;
}
/**
@@ -215,6 +381,53 @@ void idpf_psp_queue_delete(struct idpf_adapter *adapter,
spin_lock_bh(&psp->del_lock);
list_add_tail(&key->del_node, &psp->del_list);
spin_unlock_bh(&psp->del_lock);
+
+ idpf_queue_psp_work(adapter);
+}
+
+/**
+ * idpf_psp_tx_key_inserted - Complete the insertion of a TX key
+ * @adapter: private data struct
+ * @key: TX key of an insert request
+ * @saidx: SA index the key was inserted at, see idpf_psp_saidx_ok()
+ *
+ * Called from the insert response callback, must not sleep.
+ */
+void idpf_psp_tx_key_inserted(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key, u32 saidx)
+{
+ bool deleted;
+
+ atomic_inc(&adapter->psp.keys_inserted);
+
+ spin_lock_bh(&key->lock);
+ key->hw_idx = saidx;
+ deleted = key->idx == IDPF_PSP_IDX_DELETED;
+ if (!deleted)
+ WRITE_ONCE(key->idx, saidx);
+ spin_unlock_bh(&key->lock);
+
+ /* The key was deleted while its insertion was pending */
+ if (deleted)
+ idpf_psp_queue_delete(adapter, key);
+}
+
+/**
+ * idpf_psp_tx_key_failed - Fail the insertion of a TX key
+ * @adapter: private data struct
+ * @key: TX key of an insert request
+ *
+ * Called from the insert response callback, must not sleep.
+ */
+void idpf_psp_tx_key_failed(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key)
+{
+ atomic_inc(&adapter->psp.insert_errors);
+
+ spin_lock_bh(&key->lock);
+ if (key->idx == IDPF_PSP_IDX_IN_PROG)
+ WRITE_ONCE(key->idx, IDPF_PSP_IDX_ERROR);
+ spin_unlock_bh(&key->lock);
}
/**
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index b4f46e43cd83..0b2ae019b4a0 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -50,6 +50,16 @@ static inline bool idpf_psp_idx_valid(u32 idx)
void idpf_psp_queue_delete(struct idpf_adapter *adapter,
struct idpf_psp_tx_key *key);
+void idpf_queue_psp_work(struct idpf_adapter *adapter);
+void idpf_retry_psp_work(struct idpf_adapter *adapter);
+void idpf_cancel_psp_work(struct idpf_adapter *adapter);
+void idpf_psp_quiesce(struct idpf_adapter *adapter);
+void idpf_psp_insert_timer_arm(struct idpf_adapter *adapter, u32 timeout_ms);
+void idpf_psp_tx_key_inserted(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key, u32 saidx);
+void idpf_psp_tx_key_failed(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key);
+
#else /* !CONFIG_INET_PSP */
static inline void idpf_psp_init(struct idpf_adapter *adapter) { }
@@ -65,6 +75,10 @@ static inline void
idpf_psp_rotation_event(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg) { }
+static inline void idpf_queue_psp_work(struct idpf_adapter *adapter) { }
+static inline void idpf_cancel_psp_work(struct idpf_adapter *adapter) { }
+static inline void idpf_psp_quiesce(struct idpf_adapter *adapter) { }
+
#endif /* CONFIG_INET_PSP */
#endif /* !_IDPF_PSP_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 3157b40006c1..4c42755615cb 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -6,6 +6,8 @@
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/spinlock.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
#include <linux/net/intel/virtchnl2.h>
#include <net/psp.h>
@@ -52,6 +54,21 @@ struct idpf_psp_tx_key {
struct rcu_head rcu;
};
+/**
+ * struct idpf_psp_insert_req - VIRTCHNL2_OP_PSP_INSERT_KEYS request
+ * @adapter: adapter the request was sent for
+ * @num_keys: number of keys in the request
+ * @keys: keys of the request in request order, with a reference each
+ *
+ * The request is the context of the response callback: it binds the response
+ * to the keys it was sent for, see idpf_psp_insert_keys_cb().
+ */
+struct idpf_psp_insert_req {
+ struct idpf_adapter *adapter;
+ u32 num_keys;
+ struct idpf_psp_tx_key *keys[] __counted_by(num_keys);
+};
+
/**
* struct idpf_psp_rx_key - PSP RX key allocated by the CP
* @spi: SPI of the key
@@ -103,7 +120,16 @@ struct idpf_psp_rx_gen {
* PSP was negotiated
* @del_lock: protects @del_list
* @del_list: TX keys whose SA index is queued for deletion
+ * @wq: workqueue of @work
+ * @work: sends the insertion and deletion requests
+ * @insert_lock: protects @insert_req
+ * @insert_req: the VIRTCHNL2_OP_PSP_INSERT_KEYS request in flight, if any
+ * @insert_timer: makes the mailbox task time out a lost insert request,
+ * see idpf_psp_insert_timeout()
* @keys_allocated: RX keys allocated
+ * @keys_inserted: TX keys inserted into the SADB
+ * @insert_errors: TX keys whose insertion failed
+ * @insert_late: SA indexes of late insertion replies, queued for deletion
* @keys_removed: SA indexes deleted
* @keys_lost: SA indexes that couldn't be deleted
* @del_retries: SA indexes retried after a failed deletion request
@@ -131,7 +157,15 @@ struct idpf_adapter_psp {
bool initialized;
spinlock_t del_lock; /* protects del_list */
struct list_head del_list;
+ struct workqueue_struct *wq;
+ struct delayed_work work;
+ spinlock_t insert_lock; /* protects the insertions */
+ struct idpf_psp_insert_req *insert_req;
+ struct timer_list insert_timer;
atomic_t keys_allocated;
+ atomic_t keys_inserted;
+ atomic_t insert_errors;
+ atomic_t insert_late;
atomic_t keys_removed;
atomic_t keys_lost;
atomic_t del_retries;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index 42a7d74db232..e813dca8961d 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -442,7 +442,8 @@ static void idpf_psp_delete_done(struct idpf_adapter *adapter,
* it and its SA indexes may be in use by new keys: they are counted as lost,
* a late reply moves the deleted ones to removed, see
* idpf_psp_recv_late_reply();
- * - a request that couldn't be sent is retried the next time the PSP work runs.
+ * - a request that couldn't be sent is sent again after a delay, see
+ * idpf_retry_psp_work().
*
* Return: true if SA indexes are still queued for deletion, false otherwise.
*/
@@ -553,10 +554,52 @@ bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter)
list_splice(&batch, &psp->del_list);
spin_unlock_bh(&psp->del_lock);
net_warn_ratelimited("%s: request not sent: %d\n", __func__, err);
+ idpf_retry_psp_work(adapter);
return false;
}
+/**
+ * idpf_psp_insert_late - Delete the SA indexes of a late insertion reply
+ * @adapter: Driver specific private structure
+ * @buff: VIRTCHNL2_OP_PSP_INSERT_KEYS reply
+ *
+ * The keys of the request were failed when it timed out: delete the SA indexes
+ * they were inserted at.
+ */
+static void idpf_psp_insert_late(struct idpf_adapter *adapter,
+ const struct kvec *buff)
+{
+ const struct virtchnl2_psp_insert_keys_response *resp = buff->iov_base;
+ struct idpf_psp_tx_key *key;
+ u32 i, num_sa_indexes;
+
+ if (!resp || buff->iov_len < sizeof(*resp))
+ return;
+
+ num_sa_indexes = min_t(size_t, le32_to_cpu(resp->num_sa_indexes),
+ (buff->iov_len - sizeof(*resp)) /
+ sizeof(resp->sa_indexes[0]));
+
+ for (i = 0; i < num_sa_indexes; i++) {
+ u32 saidx = le32_to_cpu(resp->sa_indexes[i]);
+
+ if (!idpf_psp_saidx_ok(adapter, saidx))
+ continue;
+
+ atomic_inc(&adapter->psp.insert_late);
+ key = idpf_psp_tx_key_alloc();
+ if (!key) {
+ atomic_inc(&adapter->psp.keys_lost);
+ continue;
+ }
+
+ key->hw_idx = saidx;
+ idpf_psp_queue_delete(adapter, key);
+ idpf_psp_tx_key_put(key);
+ }
+}
+
/**
* idpf_psp_recv_late_reply - Handle a late reply to a PSP request
* @adapter: Driver specific private structure
@@ -566,6 +609,7 @@ bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter)
* The RX key of an allocation reply is wiped. The SA indexes deleted by a
* deletion reply were counted as lost, see idpf_send_delete_psp_keys(): they
* are counted as removed.
+ * The SA indexes of an insertion reply are deleted, see idpf_psp_insert_late().
*/
void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
const struct libie_ctlq_msg *ctlq_msg)
@@ -593,6 +637,10 @@ void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
atomic_sub(deleted, &adapter->psp.keys_lost);
atomic_add(deleted, &adapter->psp.keys_removed);
break;
+ case VIRTCHNL2_OP_PSP_INSERT_KEYS:
+ if (idpf_is_psp_ena(adapter) && !ctlq_msg->chnl_retval)
+ idpf_psp_insert_late(adapter, buff);
+ break;
default:
break;
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
index c2be65e541be..69a61fa421e0 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
@@ -6,6 +6,9 @@
#include <linux/net/intel/libie/controlq.h>
#include <linux/net/intel/virtchnl2.h>
+/* Timeout of the asynchronous VIRTCHNL2_OP_PSP_INSERT_KEYS requests */
+#define IDPF_VC_XN_PSP_RESPONSE_TIMEOUT_MSEC (60 * 1000)
+
/* PSP key insertion and deletion requests must fit in one mailbox buffer,
* which limits the number of TX keys and SA indexes per request.
*/
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 90fe5212095d..bff3b0f46113 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3281,6 +3281,9 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
if (remove_in_prog)
libie_ctlq_xn_shutdown(adapter->xnm);
+ /* The mailbox transactions were shut down in both cases */
+ idpf_psp_quiesce(adapter);
+
cancel_delayed_work_sync(&adapter->serv_task);
cancel_delayed_work_sync(&adapter->mbx_task);
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index 903159235832..b8940e33fd04 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -86,6 +86,7 @@ enum virtchnl2_op {
VIRTCHNL2_OP_DEL_FLOW_RULE = 553,
/* Crypto/PSP opcodes */
VIRTCHNL2_OP_PSP_ALLOCATE_KEYS = 560,
+ VIRTCHNL2_OP_PSP_INSERT_KEYS = 561,
VIRTCHNL2_OP_PSP_DELETE_KEYS = 562,
VIRTCHNL2_OP_PSP_ROTATE_KEYGEN_REQUEST = 563,
VIRTCHNL2_OP_CRYPTO_GET_CAPS = 564,
@@ -1991,6 +1992,21 @@ struct virtchnl2_psp_allocate_keys_response {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_allocate_keys_response);
+/**
+ * struct virtchnl2_psp_insert_keys_response - Insert PSP TX keys response
+ * @vport_id: Virtual port ID
+ * @num_sa_indexes: Number of allocated SA indexes, at most the number of keys
+ * requested. On partial success the insertion stops at the
+ * first failure.
+ * @sa_indexes: Flexible array of allocated SA indexes
+ */
+struct virtchnl2_psp_insert_keys_response {
+ __le32 vport_id;
+ __le32 num_sa_indexes;
+ __le32 sa_indexes[] __counted_by_le(num_sa_indexes);
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(8, virtchnl2_psp_insert_keys_response);
+
/**
* struct virtchnl2_psp_delete_keys_request - Delete PSP TX keys request
* @vport_id: Virtual port ID
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (12 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration Stan Iliev
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add support for inserting TX keys into the SADB:
- Introduce struct virtchnl2_insert_psp_key and
struct virtchnl2_psp_insert_keys_request.
- Add the insert queue, a list of the TX keys to insert with their SPI
and key.
- Implement idpf_send_insert_psp_keys(), called from the PSP work,
which inserts up to IDPF_PSP_INSERT_KEYS_MAX (101) queued TX keys
with one asynchronous request. A request that couldn't be sent puts
its keys back in the queue, they are sent again after a delay.
- Implement its response callback idpf_psp_insert_keys_cb(): the CP
inserts the keys in request order and stops at the first failure,
the keys without a valid SA index in the reply are failed. The
callback queues the work again for the next request, so the work
never waits for a reply.
- The keys are wiped once the request completed, the request buffer is
freed with kfree_sensitive() by idpf_send_mb_msg_kfree().
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 13 ++
.../net/ethernet/intel/idpf/idpf_psp_def.h | 12 +-
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 190 ++++++++++++++++++
.../ethernet/intel/idpf/idpf_psp_virtchnl.h | 1 +
.../intel/idpf/idpf_psp_virtchnl_def.h | 4 +
include/linux/net/intel/virtchnl2.h | 35 ++++
6 files changed, 254 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 373edbef9a7e..95926ac99777 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -66,6 +66,7 @@ static void idpf_psp_work(struct work_struct *work)
test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))
return;
+ idpf_send_insert_psp_keys(adapter);
if (idpf_send_delete_psp_keys(adapter))
idpf_queue_psp_work(adapter);
}
@@ -208,6 +209,7 @@ void idpf_psp_init(struct idpf_adapter *adapter)
INIT_DELAYED_WORK(&psp->work, idpf_psp_work);
spin_lock_init(&psp->insert_lock);
timer_setup(&psp->insert_timer, idpf_psp_insert_timeout, 0);
+ INIT_LIST_HEAD(&psp->ins_list);
psp->initialized = true;
}
@@ -266,6 +268,8 @@ void idpf_psp_quiesce(struct idpf_adapter *adapter)
spin_lock_bh(&psp->insert_lock);
req = psp->insert_req;
psp->insert_req = NULL;
+ list_splice_init(&psp->ins_list, &keys);
+ WRITE_ONCE(psp->ins_queued, 0);
spin_unlock_bh(&psp->insert_lock);
if (req) {
@@ -276,6 +280,12 @@ void idpf_psp_quiesce(struct idpf_adapter *adapter)
kfree(req);
}
+ list_for_each_entry_safe(key, tmp, &keys, ins_node) {
+ list_del_init(&key->ins_node);
+ idpf_psp_tx_key_failed(adapter, key);
+ idpf_psp_tx_key_put(key);
+ }
+
spin_lock_bh(&psp->del_lock);
list_splice_init(&psp->del_list, &keys);
spin_unlock_bh(&psp->del_lock);
@@ -322,6 +332,7 @@ struct idpf_psp_tx_key *idpf_psp_tx_key_alloc(void)
key->idx = IDPF_PSP_IDX_IN_PROG;
key->hw_idx = IDPF_PSP_IDX_NONE;
INIT_LIST_HEAD(&key->del_node);
+ INIT_LIST_HEAD(&key->ins_node);
return key;
}
@@ -335,6 +346,8 @@ static void idpf_psp_tx_key_free(struct kref *ref)
struct idpf_psp_tx_key *key = container_of(ref, struct idpf_psp_tx_key,
ref);
+ /* In case the key was never copied into an insert request */
+ memzero_explicit(key->key, sizeof(key->key));
/* The TX path may still read the SA index of the key */
kfree_rcu(key, rcu);
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 4c42755615cb..5af3347d9596 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -39,6 +39,9 @@
* @idx: SA index the TX path uses, or IDPF_PSP_IDX_IN_PROG,
* IDPF_PSP_IDX_ERROR or IDPF_PSP_IDX_DELETED. Read without @lock.
* @hw_idx: SA index of the key in the SADB, IDPF_PSP_IDX_NONE if it has none
+ * @spi: SPI of the key
+ * @key: the key, wiped once copied into the insert request
+ * @ins_node: entry in the insert queue, see idpf_psp_queue_insert()
* @del_node: entry in the delete queue, see idpf_psp_queue_delete()
* @del_single: delete @hw_idx in a request of its own, after a request that
* failed
@@ -49,6 +52,9 @@ struct idpf_psp_tx_key {
spinlock_t lock; /* protects the SA indexes and tx_queue */
u32 idx;
u32 hw_idx;
+ __be32 spi;
+ u8 key[VIRTCHNL2_PSP_KEY_SIZE_V0];
+ struct list_head ins_node;
struct list_head del_node;
bool del_single;
struct rcu_head rcu;
@@ -122,10 +128,12 @@ struct idpf_psp_rx_gen {
* @del_list: TX keys whose SA index is queued for deletion
* @wq: workqueue of @work
* @work: sends the insertion and deletion requests
- * @insert_lock: protects @insert_req
+ * @insert_lock: protects @insert_req, @ins_list and @ins_queued
* @insert_req: the VIRTCHNL2_OP_PSP_INSERT_KEYS request in flight, if any
* @insert_timer: makes the mailbox task time out a lost insert request,
* see idpf_psp_insert_timeout()
+ * @ins_list: TX keys queued for insertion
+ * @ins_queued: number of keys in @ins_list
* @keys_allocated: RX keys allocated
* @keys_inserted: TX keys inserted into the SADB
* @insert_errors: TX keys whose insertion failed
@@ -162,6 +170,8 @@ struct idpf_adapter_psp {
spinlock_t insert_lock; /* protects the insertions */
struct idpf_psp_insert_req *insert_req;
struct timer_list insert_timer;
+ struct list_head ins_list;
+ u32 ins_queued;
atomic_t keys_allocated;
atomic_t keys_inserted;
atomic_t insert_errors;
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index e813dca8961d..480b56ce8164 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -559,6 +559,79 @@ bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter)
return false;
}
+/**
+ * idpf_psp_insert_keys_cb - VIRTCHNL2_OP_PSP_INSERT_KEYS response callback
+ * @ctx: struct idpf_psp_insert_req of the request
+ * @buff: reply, NULL if the request timed out
+ * @status: 0 on success, -EFAULT if the CP failed the request, -ETIMEDOUT if
+ * the request timed out
+ *
+ * libie calls the response callback once per request that was sent, except on
+ * shutdown, see idpf_psp_quiesce(). It is called from the mailbox task with the
+ * transaction locked, it must not sleep. The CP inserts the keys in request
+ * order and stops at the first failure: the keys without an SA index in the
+ * reply failed.
+ */
+static void idpf_psp_insert_keys_cb(void *ctx, struct kvec *buff, int status)
+{
+ const struct virtchnl2_psp_insert_keys_response *resp = NULL;
+ struct idpf_psp_insert_req *req = ctx;
+ struct idpf_adapter *adapter = req->adapter;
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ u32 i, num_sa_indexes = 0;
+
+ if (!status) {
+ size_t reply_sz = buff && buff->iov_base ? buff->iov_len : 0;
+
+ if (reply_sz >= sizeof(*resp)) {
+ resp = buff->iov_base;
+ num_sa_indexes = min3(le32_to_cpu(resp->num_sa_indexes),
+ (u32)((reply_sz - sizeof(*resp)) /
+ sizeof(resp->sa_indexes[0])),
+ req->num_keys);
+ } else {
+ net_warn_ratelimited("%s: short reply %zu\n", __func__,
+ reply_sz);
+ }
+ } else {
+ net_warn_ratelimited("%s: request %s\n", __func__,
+ status == -ETIMEDOUT ? "timed out" :
+ "failed");
+ }
+
+ spin_lock_bh(&psp->insert_lock);
+ if (psp->insert_req == req)
+ psp->insert_req = NULL;
+ spin_unlock_bh(&psp->insert_lock);
+ timer_delete(&psp->insert_timer);
+
+ for (i = 0; i < req->num_keys; i++) {
+ struct idpf_psp_tx_key *key = req->keys[i];
+ u32 saidx = IDPF_PSP_IDX_NONE;
+
+ if (i < num_sa_indexes)
+ saidx = le32_to_cpu(resp->sa_indexes[i]);
+
+ if (idpf_psp_saidx_ok(adapter, saidx)) {
+ idpf_psp_tx_key_inserted(adapter, key, saidx);
+ } else {
+ if (i < num_sa_indexes)
+ net_warn_ratelimited("%s: invalid SA index %u\n",
+ __func__, saidx);
+ idpf_psp_tx_key_failed(adapter, key);
+ }
+
+ /* The key was copied into the request */
+ memzero_explicit(key->key, sizeof(key->key));
+ idpf_psp_tx_key_put(key);
+ }
+
+ kfree(req);
+
+ /* Send the next request */
+ idpf_queue_psp_work(adapter);
+}
+
/**
* idpf_psp_insert_late - Delete the SA indexes of a late insertion reply
* @adapter: Driver specific private structure
@@ -600,6 +673,123 @@ static void idpf_psp_insert_late(struct idpf_adapter *adapter,
}
}
+/**
+ * idpf_psp_insert_requeue - Queue the TX keys of an unsent request again
+ * @adapter: Driver specific private structure
+ * @req: insert request that couldn't be sent
+ *
+ * The keys are sent again after a delay, see idpf_retry_psp_work().
+ */
+static void idpf_psp_insert_requeue(struct idpf_adapter *adapter,
+ struct idpf_psp_insert_req *req)
+{
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ u32 i;
+
+ spin_lock_bh(&psp->insert_lock);
+ if (psp->insert_req == req)
+ psp->insert_req = NULL;
+ /* In request order, at the head of the queue */
+ for (i = req->num_keys; i; i--)
+ list_add(&req->keys[i - 1]->ins_node, &psp->ins_list);
+ WRITE_ONCE(psp->ins_queued, psp->ins_queued + req->num_keys);
+ spin_unlock_bh(&psp->insert_lock);
+
+ kfree(req);
+ idpf_retry_psp_work(adapter);
+}
+
+/**
+ * idpf_send_insert_psp_keys - Insert queued TX keys into the SADB
+ * @adapter: Driver specific private structure
+ *
+ * Send one asynchronous VIRTCHNL2_OP_PSP_INSERT_KEYS request for the TX keys
+ * queued by idpf_psp_queue_insert(), at most as many as fit in one message.
+ * At most one request is in flight: the response callback queues the PSP work
+ * again, see idpf_psp_insert_keys_cb(). Called from the PSP work.
+ */
+void idpf_send_insert_psp_keys(struct idpf_adapter *adapter)
+{
+ struct libie_ctlq_xn_send_params xn_params = {
+ .chnl_opcode = VIRTCHNL2_OP_PSP_INSERT_KEYS,
+ .timeout_ms = IDPF_VC_XN_PSP_RESPONSE_TIMEOUT_MSEC,
+ .resp_cb = idpf_psp_insert_keys_cb,
+ };
+ struct virtchnl2_psp_insert_keys_request *key_req;
+ struct idpf_adapter_psp *psp = &adapter->psp;
+ struct idpf_psp_insert_req *req;
+ u32 i, num_keys;
+ size_t buf_size;
+ int err;
+
+ BUILD_BUG_ON(struct_size_t(struct virtchnl2_psp_insert_keys_request,
+ keys, IDPF_PSP_INSERT_KEYS_MAX) >
+ LIBIE_CTLQ_MAX_BUF_LEN);
+
+ spin_lock_bh(&psp->insert_lock);
+ num_keys = psp->insert_req ? 0 :
+ min_t(u32, psp->ins_queued, IDPF_PSP_INSERT_KEYS_MAX);
+ spin_unlock_bh(&psp->insert_lock);
+ if (!num_keys)
+ return;
+
+ req = kzalloc(struct_size(req, keys, num_keys), GFP_KERNEL);
+ if (!req) {
+ idpf_retry_psp_work(adapter);
+ return;
+ }
+
+ req->adapter = adapter;
+
+ /* Keys may have been deleted meanwhile */
+ spin_lock_bh(&psp->insert_lock);
+ req->num_keys = min(num_keys, psp->ins_queued);
+ for (i = 0; i < req->num_keys; i++) {
+ req->keys[i] = list_first_entry(&psp->ins_list,
+ struct idpf_psp_tx_key,
+ ins_node);
+ list_del_init(&req->keys[i]->ins_node);
+ }
+ WRITE_ONCE(psp->ins_queued, psp->ins_queued - req->num_keys);
+ if (req->num_keys)
+ psp->insert_req = req;
+ spin_unlock_bh(&psp->insert_lock);
+
+ if (!req->num_keys) {
+ kfree(req);
+ return;
+ }
+
+ buf_size = struct_size(key_req, keys, req->num_keys);
+ key_req = kzalloc(buf_size, GFP_KERNEL);
+ if (!key_req) {
+ idpf_psp_insert_requeue(adapter, req);
+ return;
+ }
+
+ key_req->vport_id = cpu_to_le32(READ_ONCE(psp->vport_id));
+ key_req->num_keys = cpu_to_le32(req->num_keys);
+ /* key_req->domain stays zeroed: VIRTCHNL2_PSP_DOMAIN_NONE */
+ for (i = 0; i < req->num_keys; i++) {
+ key_req->keys[i].spi = cpu_to_le32(be32_to_cpu(req->keys[i]->spi));
+ key_req->keys[i].key_type = VIRTCHNL2_PSP_KEY_TYPE_V0;
+ memcpy(key_req->keys[i].v0_key, req->keys[i]->key,
+ VIRTCHNL2_PSP_KEY_SIZE_V0);
+ }
+
+ /* The request can complete as soon as it is sent */
+ xn_params.send_ctx = req;
+ idpf_psp_insert_timer_arm(adapter, xn_params.timeout_ms);
+ err = idpf_send_mb_msg_kfree(adapter, &xn_params, key_req, buf_size);
+ if (err) {
+ /* libie only calls the response callback of sent requests */
+ timer_delete(&psp->insert_timer);
+ net_warn_ratelimited("%s: request not sent: %d\n", __func__,
+ err);
+ idpf_psp_insert_requeue(adapter, req);
+ }
+}
+
/**
* idpf_psp_recv_late_reply - Handle a late reply to a PSP request
* @adapter: Driver specific private structure
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
index 8d8ce4478842..0013a9134cfc 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.h
@@ -18,5 +18,6 @@ int idpf_psp_rotation_request(struct idpf_adapter *adapter);
int idpf_send_get_psp_global_stats(struct idpf_adapter *adapter,
struct virtchnl2_psp_global_stats_response *stats);
bool idpf_send_delete_psp_keys(struct idpf_adapter *adapter);
+void idpf_send_insert_psp_keys(struct idpf_adapter *adapter);
#endif /* !_IDPF_PSP_VIRTCHNL_H_ */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
index 69a61fa421e0..76b00946119b 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl_def.h
@@ -12,6 +12,10 @@
/* PSP key insertion and deletion requests must fit in one mailbox buffer,
* which limits the number of TX keys and SA indexes per request.
*/
+#define IDPF_PSP_INSERT_KEYS_MAX \
+ ((LIBIE_CTLQ_MAX_BUF_LEN - \
+ sizeof(struct virtchnl2_psp_insert_keys_request)) / \
+ sizeof(struct virtchnl2_insert_psp_key))
#define IDPF_PSP_DELETE_KEYS_MAX \
((LIBIE_CTLQ_MAX_BUF_LEN - \
sizeof(struct virtchnl2_psp_delete_keys_request)) / \
diff --git a/include/linux/net/intel/virtchnl2.h b/include/linux/net/intel/virtchnl2.h
index b8940e33fd04..225ddee93409 100644
--- a/include/linux/net/intel/virtchnl2.h
+++ b/include/linux/net/intel/virtchnl2.h
@@ -1992,6 +1992,41 @@ struct virtchnl2_psp_allocate_keys_response {
};
VIRTCHNL2_CHECK_STRUCT_LEN(16, virtchnl2_psp_allocate_keys_response);
+/**
+ * struct virtchnl2_insert_psp_key - PSP TX key entry to insert into SADB
+ * @spi: Security parameter index
+ * @key_type: See enum virtchnl2_psp_key_type
+ * @pad: Reserved/padding
+ * @v0_key: 128-bit key for V0
+ * @v1_key: 256-bit key for V1
+ */
+struct virtchnl2_insert_psp_key {
+ __le32 spi;
+ u8 key_type;
+ u8 pad[3];
+ union {
+ u8 v0_key[VIRTCHNL2_PSP_KEY_SIZE_V0];
+ u8 v1_key[VIRTCHNL2_PSP_KEY_SIZE_V1];
+ };
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(40, virtchnl2_insert_psp_key);
+
+/**
+ * struct virtchnl2_psp_insert_keys_request - Insert PSP TX keys request
+ * @vport_id: Virtual port ID
+ * @num_keys: Number of keys to insert
+ * @domain: Key domain, must be zero-filled if VIRTCHNL2_CAP_PSP_DOMAIN was
+ * not granted
+ * @keys: Flexible array of keys to insert
+ */
+struct virtchnl2_psp_insert_keys_request {
+ __le32 vport_id;
+ __le32 num_keys;
+ struct virtchnl2_psp_key_domain domain;
+ struct virtchnl2_insert_psp_key keys[] __counted_by_le(num_keys);
+};
+VIRTCHNL2_CHECK_STRUCT_LEN(24, virtchnl2_psp_insert_keys_request);
+
/**
* struct virtchnl2_psp_insert_keys_response - Insert PSP TX keys response
* @vport_id: Virtual port ID
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
` (13 preceding siblings ...)
2026-11-17 14:55 ` [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion Stan Iliev
@ 2026-11-17 14:55 ` Stan Iliev
14 siblings, 0 replies; 16+ messages in thread
From: Stan Iliev @ 2026-11-17 14:55 UTC (permalink / raw)
To: Tony Nguyen, Przemek Kitszel, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Andrew Lunn, intel-wired-lan
Cc: netdev, linux-kernel, David Decotigny, Madhu Chittim,
Emil Tantilov, Sridhar Samudrala, Brian Vazquez, Li Li,
Alexander Lobakin, Daniel Zahka, Willem de Bruijn, Kees Cook,
Gustavo A. R. Silva, linux-hardening
Add idpf_psp_queue_insert(), which queues a TX key for insertion:
- The key reserves a SADB entry, released if the insertion fails, or
once its SA index was deleted. An SA index that couldn't be deleted
keeps its SADB entry, as does the SA index of a late insertion reply
until it is deleted.
- New keys are refused with -ENOSPC once the SADB or the insert queue
(IDPF_PSP_INS_QUEUE_MAX keys) is full.
- The RX SPI allocation refuses the RX keys of new connections then,
instead of failing their TX keys later.
Signed-off-by: Stan Iliev <stani@google.com>
---
drivers/net/ethernet/intel/idpf/idpf_psp.c | 62 +++++++++++++++++++
drivers/net/ethernet/intel/idpf/idpf_psp.h | 2 +
.../net/ethernet/intel/idpf/idpf_psp_def.h | 4 ++
.../ethernet/intel/idpf/idpf_psp_virtchnl.c | 4 ++
4 files changed, 72 insertions(+)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.c b/drivers/net/ethernet/intel/idpf/idpf_psp.c
index 95926ac99777..1dfec4177c43 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.c
@@ -11,6 +11,9 @@
/* Delay before the PSP work sends again a request that couldn't be sent */
#define IDPF_PSP_RETRY_MSEC 100
+/* Maximum number of TX keys queued for insertion */
+#define IDPF_PSP_INS_QUEUE_MAX 1024
+
/**
* idpf_queue_psp_work - Queue the PSP work
* @adapter: private data struct
@@ -237,6 +240,8 @@ void idpf_psp_init(struct idpf_adapter *adapter)
atomic_set(&psp->keys_inserted, 0);
atomic_set(&psp->insert_errors, 0);
atomic_set(&psp->insert_late, 0);
+ atomic_set(&psp->sadb_used, 0);
+ atomic_set(&psp->keys_refused, 0);
WRITE_ONCE(psp->enabled, true);
}
@@ -436,6 +441,8 @@ void idpf_psp_tx_key_failed(struct idpf_adapter *adapter,
struct idpf_psp_tx_key *key)
{
atomic_inc(&adapter->psp.insert_errors);
+ /* The SADB entry reserved for the key wasn't used */
+ atomic_dec(&adapter->psp.sadb_used);
spin_lock_bh(&key->lock);
if (key->idx == IDPF_PSP_IDX_IN_PROG)
@@ -443,6 +450,54 @@ void idpf_psp_tx_key_failed(struct idpf_adapter *adapter,
spin_unlock_bh(&key->lock);
}
+/**
+ * idpf_psp_sadb_full - Check if new PSP keys must be refused
+ * @adapter: private data struct
+ *
+ * Return: true if the SADB or the insertion queue is full, false otherwise.
+ */
+static bool idpf_psp_sadb_full(struct idpf_adapter *adapter)
+{
+ /* sadb_entries fits in 26 bits, see idpf_psp_negotiate_caps() */
+ return atomic_read(&adapter->psp.sadb_used) >=
+ (int)adapter->psp.sadb_entries ||
+ READ_ONCE(adapter->psp.ins_queued) >= IDPF_PSP_INS_QUEUE_MAX;
+}
+
+/**
+ * idpf_psp_queue_insert - Queue a TX key for insertion into the SADB
+ * @adapter: private data struct
+ * @key: the TX key, with its SPI and key set
+ *
+ * Reserve a SADB entry for the key and queue it for insertion. The PSP work
+ * inserts the queued keys, see idpf_send_insert_psp_keys(), and releases the
+ * reference taken on @key once the insertion completed.
+ *
+ * Return: 0 on success, -ENOSPC if the SADB or the insertion queue is full.
+ */
+int idpf_psp_queue_insert(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key)
+{
+ struct idpf_adapter_psp *psp = &adapter->psp;
+
+ spin_lock_bh(&psp->insert_lock);
+ if (idpf_psp_sadb_full(adapter)) {
+ spin_unlock_bh(&psp->insert_lock);
+ atomic_inc(&psp->keys_refused);
+ return -ENOSPC;
+ }
+
+ atomic_inc(&psp->sadb_used);
+ idpf_psp_tx_key_get(key);
+ list_add_tail(&key->ins_node, &psp->ins_list);
+ WRITE_ONCE(psp->ins_queued, psp->ins_queued + 1);
+ spin_unlock_bh(&psp->insert_lock);
+
+ idpf_queue_psp_work(adapter);
+
+ return 0;
+}
+
/**
* idpf_psp_set_config - Set the PSP device configuration
* @psd: PSP device
@@ -515,6 +570,13 @@ static int idpf_psp_rx_spi_alloc(struct psp_dev *psd, u32 version,
return -EOPNOTSUPP;
}
+ /* Refuse new connections whose TX key couldn't be inserted */
+ if (idpf_psp_sadb_full(adapter)) {
+ atomic_inc(&adapter->psp.keys_refused);
+ NL_SET_ERR_MSG_MOD(extack, "PSP SADB full");
+ return -ENOSPC;
+ }
+
err = idpf_send_allocate_psp_key(adapter, &rx_key);
if (err) {
NL_SET_ERR_MSG_MOD(extack, "Failed to allocate RX SPI and key");
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp.h b/drivers/net/ethernet/intel/idpf/idpf_psp.h
index 0b2ae019b4a0..377cd4889f51 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp.h
@@ -59,6 +59,8 @@ void idpf_psp_tx_key_inserted(struct idpf_adapter *adapter,
struct idpf_psp_tx_key *key, u32 saidx);
void idpf_psp_tx_key_failed(struct idpf_adapter *adapter,
struct idpf_psp_tx_key *key);
+int idpf_psp_queue_insert(struct idpf_adapter *adapter,
+ struct idpf_psp_tx_key *key);
#else /* !CONFIG_INET_PSP */
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
index 5af3347d9596..449bcb3c9ee2 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_def.h
@@ -134,6 +134,7 @@ struct idpf_psp_rx_gen {
* see idpf_psp_insert_timeout()
* @ins_list: TX keys queued for insertion
* @ins_queued: number of keys in @ins_list
+ * @sadb_used: SADB entries used, or reserved by keys queued for insertion
* @keys_allocated: RX keys allocated
* @keys_inserted: TX keys inserted into the SADB
* @insert_errors: TX keys whose insertion failed
@@ -141,6 +142,7 @@ struct idpf_psp_rx_gen {
* @keys_removed: SA indexes deleted
* @keys_lost: SA indexes that couldn't be deleted
* @del_retries: SA indexes retried after a failed deletion request
+ * @keys_refused: RX and TX keys refused, SADB or insertion queue full
* @psp_dev: the PSP device, see idpf_psp_register()
* @caps: capabilities of @psp_dev
*/
@@ -172,6 +174,7 @@ struct idpf_adapter_psp {
struct timer_list insert_timer;
struct list_head ins_list;
u32 ins_queued;
+ atomic_t sadb_used;
atomic_t keys_allocated;
atomic_t keys_inserted;
atomic_t insert_errors;
@@ -179,6 +182,7 @@ struct idpf_adapter_psp {
atomic_t keys_removed;
atomic_t keys_lost;
atomic_t del_retries;
+ atomic_t keys_refused;
struct psp_dev *psp_dev;
struct psp_dev_caps caps;
};
diff --git a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
index 480b56ce8164..0843f8e0ffea 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_psp_virtchnl.c
@@ -416,6 +416,7 @@ static void idpf_psp_delete_done(struct idpf_adapter *adapter,
struct idpf_psp_tx_key *key, *tmp;
atomic_add(removed, &adapter->psp.keys_removed);
+ atomic_sub(removed, &adapter->psp.sadb_used);
if (lost) {
atomic_add(lost, &adapter->psp.keys_lost);
net_warn_ratelimited("%s: %u SA indexes couldn't be deleted\n",
@@ -661,6 +662,8 @@ static void idpf_psp_insert_late(struct idpf_adapter *adapter,
continue;
atomic_inc(&adapter->psp.insert_late);
+ /* The SA index is used until it is deleted */
+ atomic_inc(&adapter->psp.sadb_used);
key = idpf_psp_tx_key_alloc();
if (!key) {
atomic_inc(&adapter->psp.keys_lost);
@@ -826,6 +829,7 @@ void idpf_psp_recv_late_reply(struct idpf_adapter *adapter,
max(atomic_read(&adapter->psp.keys_lost), 0));
atomic_sub(deleted, &adapter->psp.keys_lost);
atomic_add(deleted, &adapter->psp.keys_removed);
+ atomic_sub(deleted, &adapter->psp.sadb_used);
break;
case VIRTCHNL2_OP_PSP_INSERT_KEYS:
if (idpf_is_psp_ena(adapter) && !ctlq_msg->chnl_retval)
--
2.56.0.679.gc527c65306-goog
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2026-11-17 14:55 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 14:55 [PATCH iwl-next 00/15] idpf: add PSP offload support, part 1 Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 01/15] libie: wipe copied small send buffers on release Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 02/15] idpf: wipe mailbox " Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 03/15] idpf: make the mailbox workqueue visible in sysfs Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 04/15] idpf: psp: add psp offload initialization Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 05/15] idpf: psp: add support for crypto capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 06/15] idpf: psp: add support for psp capabilities Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 07/15] idpf: psp: add support for fips compliance status Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 08/15] idpf: psp: add support for psp rx key allocation Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 09/15] idpf: psp: add support for psp key rotation Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 10/15] idpf: psp: add support for psp statistics Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 11/15] idpf: psp: add psp tx key state Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 12/15] idpf: psp: add support for psp tx key deletion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 13/15] idpf: psp: add psp work and tx key insertion completion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 14/15] idpf: psp: add support for psp tx key insertion Stan Iliev
2026-11-17 14:55 ` [PATCH iwl-next 15/15] idpf: psp: add psp tx key registration Stan Iliev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®