Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Cosmin Ratiu <cratiu@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>, Cosmin Ratiu <cratiu@nvidia.com>,
	Carolina Jubran <cjubran@nvidia.com>,
	<linux-kselftest@vger.kernel.org>
Subject: [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present
Date: Mon, 5 Jan 2026 12:04:23 +0200	[thread overview]
Message-ID: <20260105100424.2626542-2-cratiu@nvidia.com> (raw)
In-Reply-To: <20260105100424.2626542-1-cratiu@nvidia.com>

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


  reply	other threads:[~2026-01-05 10:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05 10:04 [PATCH net-next 0/2] PSP self test improvements Cosmin Ratiu
2026-01-05 10:04 ` Cosmin Ratiu [this message]
2026-01-06  1:44   ` [PATCH net-next 1/2] selftests: drv-net: psp: Use first device when multiple are present 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260105100424.2626542-2-cratiu@nvidia.com \
    --to=cratiu@nvidia.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=cjubran@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox