These two patches improve PSP self tests when there are no PSP devs found (test failures instead of Python exception) and when there are multiple PSP devices present (use the first one instead of failing).
Cosmin Ratiu (2): selftests: drv-net: psp: Use first device when multiple are present selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found
.../selftests/drivers/net/psp_responder.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-)
The PSP responder fails when multiple devices are detected. There's an option to select the device id to use (-d) but that's currently not used from the PSP self test.
Change the default behavior of psp_responder to pick the first device instead of giving up altogether.
Signed-off-by: Cosmin Ratiu cratiu@nvidia.com Reviewed-by: Carolina Jubran cjubran@nvidia.com --- tools/testing/selftests/drivers/net/psp_responder.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/psp_responder.c b/tools/testing/selftests/drivers/net/psp_responder.c index f309e0d73cbf..8d2bad134e63 100644 --- a/tools/testing/selftests/drivers/net/psp_responder.c +++ b/tools/testing/selftests/drivers/net/psp_responder.c @@ -410,6 +410,7 @@ static int psp_dev_set_ena(struct ynl_sock *ys, __u32 dev_id, __u32 versions) int main(int argc, char **argv) { struct psp_dev_get_list *dev_list; + bool multiple_devs = false; bool devid_found = false; __u32 ver_ena, ver_cap; struct opts opts = {}; @@ -446,8 +447,7 @@ int main(int argc, char **argv) ver_ena = d->psp_versions_ena; ver_cap = d->psp_versions_cap; } else { - fprintf(stderr, "Multiple PSP devices found\n"); - goto err_close_silent; + multiple_devs = true; } } psp_dev_get_list_free(dev_list); @@ -457,6 +457,10 @@ int main(int argc, char **argv) opts.devid); goto err_close_silent; } else if (!opts.devid) { + if (multiple_devs) + fprintf(stderr, + "Multiple PSP devices found, choosing first one with devid %d\n", + first_id); opts.devid = first_id; }
On Mon, 5 Jan 2026 12:04:23 +0200 Cosmin Ratiu wrote:
The PSP responder fails when multiple devices are detected. There's an option to select the device id to use (-d) but that's currently not used from the PSP self test.
Change the default behavior of psp_responder to pick the first device instead of giving up altogether.
We know what ifindex we expect to run against (cfg.remote_ifname) we can resolve which PSP device it belongs to either in the C code or in the Python script.
psp_responder, used in the PSP self tests, fails when no PSP devices are found. This makes the PSP test time out on connecting to the responder and throw out an unpleasant Python exception.
Change psp_responder to open the server socket and listen for control connections normally, and leave 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 --- tools/testing/selftests/drivers/net/psp_responder.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/psp_responder.c b/tools/testing/selftests/drivers/net/psp_responder.c index 8d2bad134e63..b240888068d3 100644 --- a/tools/testing/selftests/drivers/net/psp_responder.c +++ b/tools/testing/selftests/drivers/net/psp_responder.c @@ -430,12 +430,8 @@ int main(int argc, char **argv) }
dev_list = psp_dev_get_dump(ys); - if (ynl_dump_empty(dev_list)) { - if (ys->err.code) - goto err_close; - fprintf(stderr, "No PSP devices\n"); - goto err_close_silent; - } + if (ynl_dump_empty(dev_list) && ys->err.code) + goto err_close;
ynl_dump_foreach(dev_list, d) { if (opts.devid) { @@ -464,7 +460,7 @@ int main(int argc, char **argv) opts.devid = first_id; }
- if (ver_ena != ver_cap) { + if (opts.devid && ver_ena != ver_cap) { ret = psp_dev_set_ena(ys, opts.devid, ver_cap); if (ret) goto err_close; @@ -472,7 +468,8 @@ int main(int argc, char **argv)
ret = run_responder(ys, &opts);
- if (ver_ena != ver_cap && psp_dev_set_ena(ys, opts.devid, ver_ena)) + if (opts.devid && ver_ena != ver_cap && + psp_dev_set_ena(ys, opts.devid, ver_ena)) fprintf(stderr, "WARN: failed to set the PSP versions back\n");
ynl_sock_destroy(ys);
On Mon, 5 Jan 2026 12:04:24 +0200 Cosmin Ratiu wrote:
psp_responder, used in the PSP self tests, fails when no PSP devices are found. This makes the PSP test time out on connecting to the responder and throw out an unpleasant Python exception.
Indeed, handling the errors for responders within bkg() is quite annoying. Or at least I didn't find a clean way to do it.
Change psp_responder to open the server socket and listen for control connections normally, and leave 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 [...]
To be clear - in this case the DUT also doesn't have a PSP device? I'm struggling to connect the dots on how this error msg could come from psp_responder.
linux-kselftest-mirror@lists.linaro.org