]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: drv-net: psp: Better control the used PSP dev
authorCosmin Ratiu <cratiu@nvidia.com>
Fri, 9 Jan 2026 11:08:51 +0000 (13:08 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 10 Jan 2026 22:44:05 +0000 (14:44 -0800)
commit9086984ff52e703cd7ce47ae19f12d8d31914396
tree5d9ffc2e4f8be2d9ff02cec610a5b5f1dc4d4a49
parentd0c2d28cfd7ebc20bc582061402c603d00f0dd39
selftests: drv-net: psp: Better control the used PSP dev

The PSP responder fails when zero or multiple PSP devices are detected.
There's an option to select the device id to use (-d) but it's
currently not used from the PSP self test. It's also hard to use because
the PSP test doesn't dump the PSP devices so can't choose one.
When zero devices are detected, psp_responder fails which will cause the
parent test to fail as well instead of skipping PSP tests.

Fix both of these problems. Change psp_responder to:
- not fail when no PSP devs are detected.
- get an optional -i ifindex argument instead of -d.
- select the correct PSP dev from the dump corresponding to ifindex or
- select the first PSP dev when -i is not given.
- fail when multiple devs are found and -i is not given.
- warn and continue when the requested ifindex is not found.

Also plumb the ifindex from the Python test.

With these, when there are no PSP devs found or the wrong one is chosen,
psp_responder opens the server socket, listens for control connections
normally, and leaves the skipping of the various test cases which
require a PSP device (~most, but not all of them) to the parent test.
This results in output like:

ok 1 psp.test_case # SKIP No PSP devices found
[...]
ok 12 psp.dev_get_device # SKIP No PSP devices found
ok 13 psp.dev_get_device_bad
ok 14 psp.dev_rotate # SKIP No PSP devices found
[...]

Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Link: https://patch.msgid.link/20260109110851.2952906-2-cratiu@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/lib/py/env.py
tools/testing/selftests/drivers/net/psp.py
tools/testing/selftests/drivers/net/psp_responder.c