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

From: Willem de Bruijn <[email-masked]>
Date: Tue, 07 Apr 2026 17:52:36 -0400

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 <[email-masked]>
> Reviewed-by: Kiran Kella <[email-masked]>
> Reviewed-by: Ajit Kumar Khaparde <[email-masked]>
> ---
>  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)?