From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org,
Jakub Kicinski <kuba@kernel.org>,
shuah@kernel.org, sdf@fomichev.me, dw@davidwei.uk,
linux-kselftest@vger.kernel.org
Subject: [PATCH net-next] selftests: drv-net: print device info at the start
Date: Mon, 3 Aug 2026 14:19:44 -0700 [thread overview]
Message-ID: <20260803211944.2166211-1-kuba@kernel.org> (raw)
When a reviewer asks a developer to run an upstream test during code
review, it's often ambiguous whether the test was actually run against
a real device, or just against netdevsim. Print the driver name and
ifname at the start of the test, e.g.:
# Interface: enp0s13f0u1u4, driver: r8152
TAP version 13
1..1
ok 1 ...
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: shuah@kernel.org
CC: sdf@fomichev.me
CC: dw@davidwei.uk
CC: linux-kselftest@vger.kernel.org
---
.../selftests/drivers/net/lib/py/env.py | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py
index e4acf3d8333f..a8e8029868a7 100644
--- a/tools/testing/selftests/drivers/net/lib/py/env.py
+++ b/tools/testing/selftests/drivers/net/lib/py/env.py
@@ -7,7 +7,7 @@ import time
import json
from pathlib import Path
from lib.py import KsftSkipEx, KsftXfailEx
-from lib.py import ksft_setup, wait_file
+from lib.py import ksft_pr, ksft_setup, wait_file
from lib.py import cmd, ethtool, ip, CmdExitFailure
from lib.py import NetNS, NetdevSimDev, UserNetNS
from .remote import Remote
@@ -31,6 +31,7 @@ from . import bpftool, RtnlFamily, Netlink
# Following attrs must be set be inheriting classes
self.dev = None
+ self.ifname = None
def _load_env_file(self):
env = os.environ.copy()
@@ -58,6 +59,22 @@ from . import bpftool, RtnlFamily, Netlink
def __del__(self):
pass
+ def _print_dev_info(self):
+ """
+ Show whether the test ran on real hardware or netdevsim.
+ Useful to confirm when results are shared on the mailing list.
+ """
+ driver = "unknown"
+ try:
+ info = ethtool(f"-i {self.ifname}").stdout
+ for line in info.splitlines():
+ if line.startswith("driver:"):
+ driver = line.split(':', 1)[1].strip() or driver
+ break
+ except (CmdExitFailure, FileNotFoundError):
+ pass
+ ksft_pr(f"Interface: {self.ifname}, driver: {driver}")
+
def __enter__(self):
ip(f"link set dev {self.dev['ifname']} up")
wait_file(f"/sys/class/net/{self.dev['ifname']}/carrier",
@@ -94,6 +111,7 @@ from . import bpftool, RtnlFamily, Netlink
self.dev = self._ns.nsims[0].dev
self.ifname = self.dev['ifname']
self.ifindex = self.dev['ifindex']
+ self._print_dev_info()
def __del__(self):
if self._ns:
@@ -163,6 +181,7 @@ from . import bpftool, RtnlFamily, Netlink
self.ifname = self.dev['ifname']
self.ifindex = self.dev['ifindex']
+ self._print_dev_info()
# resolve remote interface name
self.remote_ifname = self.resolve_remote_ifc()
--
2.55.0
next reply other threads:[~2026-08-03 21:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 21:19 Jakub Kicinski [this message]
2026-08-05 16:26 ` [PATCH net-next] selftests: drv-net: print device info at the start Simon Horman
2026-08-06 1:20 ` patchwork-bot+netdevbpf
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=20260803211944.2166211-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dw@davidwei.uk \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.