Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] PSP self test improvements
@ 2026-01-05 10:04 Cosmin Ratiu
  2026-01-05 10:04 ` [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present Cosmin Ratiu
  2026-01-05 10:04 ` [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found Cosmin Ratiu
  0 siblings, 2 replies; 7+ messages in thread
From: Cosmin Ratiu @ 2026-01-05 10:04 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Cosmin Ratiu, Carolina Jubran,
	linux-kselftest

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(-)

-- 
2.45.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present
  2026-01-05 10:04 [PATCH net-next 0/2] PSP self test improvements Cosmin Ratiu
@ 2026-01-05 10:04 ` Cosmin Ratiu
  2026-01-06  1:44   ` Jakub Kicinski
  2026-01-05 10:04 ` [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found Cosmin Ratiu
  1 sibling, 1 reply; 7+ messages in thread
From: Cosmin Ratiu @ 2026-01-05 10:04 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Cosmin Ratiu, Carolina Jubran,
	linux-kselftest

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;
 	}
 
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found
  2026-01-05 10:04 [PATCH net-next 0/2] PSP self test improvements Cosmin Ratiu
  2026-01-05 10:04 ` [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present Cosmin Ratiu
@ 2026-01-05 10:04 ` Cosmin Ratiu
  2026-01-06  1:52   ` Jakub Kicinski
  1 sibling, 1 reply; 7+ messages in thread
From: Cosmin Ratiu @ 2026-01-05 10:04 UTC (permalink / raw)
  To: netdev
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Shuah Khan, Cosmin Ratiu, Carolina Jubran,
	linux-kselftest

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);
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present
  2026-01-05 10:04 ` [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present Cosmin Ratiu
@ 2026-01-06  1:44   ` Jakub Kicinski
  2026-01-07 11:44     ` Cosmin Ratiu
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-01-06  1:44 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, Carolina Jubran, linux-kselftest

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found
  2026-01-05 10:04 ` [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found Cosmin Ratiu
@ 2026-01-06  1:52   ` Jakub Kicinski
  2026-01-07 11:47     ` Cosmin Ratiu
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2026-01-06  1:52 UTC (permalink / raw)
  To: Cosmin Ratiu
  Cc: netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Paolo Abeni,
	Shuah Khan, Carolina Jubran, linux-kselftest

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present
  2026-01-06  1:44   ` Jakub Kicinski
@ 2026-01-07 11:44     ` Cosmin Ratiu
  0 siblings, 0 replies; 7+ messages in thread
From: Cosmin Ratiu @ 2026-01-07 11:44 UTC (permalink / raw)
  To: kuba@kernel.org
  Cc: andrew+netdev@lunn.ch, davem@davemloft.net,
	linux-kselftest@vger.kernel.org, shuah@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org, edumazet@google.com,
	Carolina Jubran

On Mon, 2026-01-05 at 17:44 -0800, Jakub Kicinski wrote:
> 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.

I see now that the psp dev dump command exports the netdev ifindex
alongside the psp devid. psp_responder could match that against a
command line argument (replacing -d). I'll concoct something and send
it as next version.

Cosmin.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found
  2026-01-06  1:52   ` Jakub Kicinski
@ 2026-01-07 11:47     ` Cosmin Ratiu
  0 siblings, 0 replies; 7+ messages in thread
From: Cosmin Ratiu @ 2026-01-07 11:47 UTC (permalink / raw)
  To: kuba@kernel.org
  Cc: andrew+netdev@lunn.ch, davem@davemloft.net,
	linux-kselftest@vger.kernel.org, shuah@kernel.org,
	pabeni@redhat.com, netdev@vger.kernel.org, edumazet@google.com,
	Carolina Jubran

On Mon, 2026-01-05 at 17:52 -0800, Jakub Kicinski wrote:
> On Mon, 5 Jan 2026 12:04:24 +0200 Cosmin Ratiu wrote:
> 
> > 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.

This happens when one runs the psp selftest against a DUT with PSP
disabled (e.g. no PSP devices present, or cap bits off or something
else not working).
This patch makes psp_responder not fail in this case, establish the
control connection and let the parent test determine which test cases
to run.

Cosmin.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-07 11:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-05 10:04 [PATCH net-next 0/2] PSP self test improvements Cosmin Ratiu
2026-01-05 10:04 ` [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present Cosmin Ratiu
2026-01-06  1:44   ` Jakub Kicinski
2026-01-07 11:44     ` Cosmin Ratiu
2026-01-05 10:04 ` [PATCH net-next 2/2] selftests: drv-net: psp: Don't fail psp_responder when no PSP devs found Cosmin Ratiu
2026-01-06  1:52   ` Jakub Kicinski
2026-01-07 11:47     ` Cosmin Ratiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox