Re: [PATCH net-next 3/3] selftests: net: psp: add crypt-offset and spi-threshold test cases

Willem de Bruijn
2026-04-07T21:52:37Z

Akhilesh Samineni wrote:
> Add test cases to set and get crypt-offset and spi-threshold attributes,
> verifying both the applied value and the restored prior value.
>
> Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
> Reviewed-by: Kiran Kella <kiran.kella@broadcom.com>
> Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
> ---
> tools/testing/selftests/drivers/net/psp.py | 32 ++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py
> index 864d9fce1094..9253aab29ded 100755
> --- a/tools/testing/selftests/drivers/net/psp.py
> +++ b/tools/testing/selftests/drivers/net/psp.py
> @@ -171,6 +171,38 @@ def dev_get_device_bad(cfg):
> ksft_true(raised)
>
>
> +def dev_set_crypt_offset(cfg):
> + """ Set and get the crypt-offset """
> + _init_psp_dev(cfg)
> +
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + orig = dev['crypt-offset']
> + cfg.pspnl.dev_set({"id": cfg.psp_dev_id,
> + "crypt-offset": 5})
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + ksft_eq(dev['crypt-offset'], 5)
> + cfg.pspnl.dev_set({"id": cfg.psp_dev_id,
> + "crypt-offset": orig})
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + ksft_eq(dev['crypt-offset'], orig)
> +
> +
> +def dev_set_spi_threshold(cfg):
> + """ Set and get the spi-threshold """
> + _init_psp_dev(cfg)
> +
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + orig = dev['spi-threshold']
> + cfg.pspnl.dev_set({"id": cfg.psp_dev_id,
> + "spi-threshold": 10})
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + ksft_eq(dev['spi-threshold'], 10)
> + cfg.pspnl.dev_set({"id": cfg.psp_dev_id,
> + "spi-threshold": orig})
> + dev = cfg.pspnl.dev_get({'id': cfg.psp_dev_id})
> + ksft_eq(dev['spi-threshold'], orig)

These tests mainly verify that netlink works as intended. Not sure how
much value that brings.

Once crypt-offset requires bounds checking (say), such control ops
functional tests may become more valuable.

More interesting would be to see the effect on the datapath. E.g.,
a crypt-offset that actually leaves plaintext. Not sure how easy or
hard this is, so don't take this as a requirement. But maybe something
that achievable with PSP packetdrill (eventually)?