From patchwork Thu Mar 27 22:23:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 14031481 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 931E81DC9AB for ; Thu, 27 Mar 2025 22:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114203; cv=none; b=HsjGrdK8IrSIA37a0CeYjef+xfQlAVKI+W7mv5X4mWesq5faKavhoujamZMGkowXh29Kxisyf0F2J62Tt7iqab+/JdpcMXKth2JUzOOKjnaR1AZPbGsRFcD9BP74GqJwdSf/Z6pmHCKCrGyAm1hVmcV5mCSrs2+7mCQL/Gbhig0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114203; c=relaxed/simple; bh=1J9jDLUdm+uyQyLly2UdXpzqRBADlJ68oaMqriBMqhY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bd1xEWMqya2bGifPbVJxiV8v2hCvZCfI3GW7qaGHeq7LGo3pfKHFko90SIvQP7H9eJyR+godExwWDJxyNosn5tys8RGk9txw2+9IpY1Icl3yQjjk9adF1FB/bCgzjzeFdKF5jM1VqPTWkzVoVSBS+DMRMH5wyGX7zR2kbtNl6t4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tMzLbU9E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tMzLbU9E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4473C4CEEA; Thu, 27 Mar 2025 22:23:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743114203; bh=1J9jDLUdm+uyQyLly2UdXpzqRBADlJ68oaMqriBMqhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tMzLbU9EcC1xQsJuNANiOxoSTESrhbpccL90+JA5UFGxjNzsvlSW4rhW4IbfVVu83 k5znXLzjj/pC9CiOvjRH5c98axAceddmHEY1C8pCSGdfqnIJ0GFWe+bd04wiQRNyVM Eh2Yxdbtfk1O+wxiNcjdiVtxJHkaZ+NHVidcp2EqhqabUJQjYQUoznA+6SVuR0rs4y 1tNkRUZ5aGriSjxiB9WULv58hhUJQEEx7mZiz0N+1Z0XAYJFZjp+92U3kVXhNy/jNm 5ZF2GgrTQBtJ6meKJRFX+sKM9x4Gu86ykfBd8b/WgUXQ4lj24S09rbladxEKLOwTK6 KJdqqDI7c839Q== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me, willemdebruijn.kernel@gmail.com, Jakub Kicinski Subject: [PATCH net v3 1/3] selftests: drv-net: replace the rpath helper with Path objects Date: Thu, 27 Mar 2025 15:23:13 -0700 Message-ID: <20250327222315.1098596-2-kuba@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250327222315.1098596-1-kuba@kernel.org> References: <20250327222315.1098596-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org The single letter + "path" helpers do not have many fans (see Link). Use a Path object with a better name. test_dir is the replacement for rpath(), net_lib_dir is a new path of the $ksft/net/lib directory. The Path() class overloads the "/" operator and can be cast to string automatically, so to get a path to a file tests can do: path = env.test_dir / "binary" Link: https://lore.kernel.org/CA+FuTSemTNVZ5MxXkq8T9P=DYm=nSXcJnL7CJBPZNAT_9UFisQ@mail.gmail.com Signed-off-by: Jakub Kicinski Reviewed-by: Willem de Bruijn --- v3: - change the approach to use Path v2: https://lore.kernel.org/20250306171158.1836674-1-kuba@kernel.org --- tools/testing/selftests/drivers/net/hds.py | 2 +- .../testing/selftests/drivers/net/hw/csum.py | 2 +- tools/testing/selftests/drivers/net/hw/irq.py | 2 +- .../selftests/drivers/net/lib/py/env.py | 21 +++++++------------ tools/testing/selftests/drivers/net/queues.py | 4 ++-- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/tools/testing/selftests/drivers/net/hds.py b/tools/testing/selftests/drivers/net/hds.py index 7cc74faed743..8b7f6acad15f 100755 --- a/tools/testing/selftests/drivers/net/hds.py +++ b/tools/testing/selftests/drivers/net/hds.py @@ -20,7 +20,7 @@ from lib.py import defer, ethtool, ip def _xdp_onoff(cfg): - prog = cfg.rpath("../../net/lib/xdp_dummy.bpf.o") + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" ip("link set dev %s xdp obj %s sec xdp" % (cfg.ifname, prog)) ip("link set dev %s xdp off" % cfg.ifname) diff --git a/tools/testing/selftests/drivers/net/hw/csum.py b/tools/testing/selftests/drivers/net/hw/csum.py index 701aca1361e0..cd23af875317 100755 --- a/tools/testing/selftests/drivers/net/hw/csum.py +++ b/tools/testing/selftests/drivers/net/hw/csum.py @@ -88,7 +88,7 @@ from lib.py import bkg, cmd, wait_port_listen with NetDrvEpEnv(__file__, nsim_test=False) as cfg: check_nic_features(cfg) - cfg.bin_local = cfg.rpath("../../../net/lib/csum") + cfg.bin_local = cfg.net_lib_dir / "csum" cfg.bin_remote = cfg.remote.deploy(cfg.bin_local) cases = [] diff --git a/tools/testing/selftests/drivers/net/hw/irq.py b/tools/testing/selftests/drivers/net/hw/irq.py index 42ab98370245..d772a18d8a1b 100755 --- a/tools/testing/selftests/drivers/net/hw/irq.py +++ b/tools/testing/selftests/drivers/net/hw/irq.py @@ -69,7 +69,7 @@ from lib.py import cmd, ip, defer def check_reconfig_xdp(cfg) -> None: def reconfig(cfg) -> None: ip(f"link set dev %s xdp obj %s sec xdp" % - (cfg.ifname, cfg.rpath("xdp_dummy.bpf.o"))) + (cfg.ifname, cfg.test_dir / "xdp_dummy.bpf.o")) ip(f"link set dev %s xdp off" % cfg.ifname) _check_reconfig(cfg, reconfig) diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py index fd4d674e6c72..ad5ff645183a 100644 --- a/tools/testing/selftests/drivers/net/lib/py/env.py +++ b/tools/testing/selftests/drivers/net/lib/py/env.py @@ -13,23 +13,18 @@ from .remote import Remote class NetDrvEnvBase: """ Base class for a NIC / host envirnoments + + Attributes: + test_dir: Path to the source directory of the test + net_lib_dir: Path to the net/lib directory """ def __init__(self, src_path): - self.src_path = src_path + self.src_path = Path(src_path) + self.test_dir = self.src_path.parent.resolve() + self.net_lib_dir = (Path(__file__).parent / "../../../../net/lib").resolve() + self.env = self._load_env_file() - def rpath(self, path): - """ - Get an absolute path to a file based on a path relative to the directory - containing the test which constructed env. - - For example, if the test.py is in the same directory as - a binary (built from helper.c), the test can use env.rpath("helper") - to get the absolute path to the binary - """ - src_dir = Path(self.src_path).parent.resolve() - return (src_dir / path).as_posix() - def _load_env_file(self): env = os.environ.copy() diff --git a/tools/testing/selftests/drivers/net/queues.py b/tools/testing/selftests/drivers/net/queues.py index cae923f84f69..06abd3f233e1 100755 --- a/tools/testing/selftests/drivers/net/queues.py +++ b/tools/testing/selftests/drivers/net/queues.py @@ -26,13 +26,13 @@ import struct def check_xsk(cfg, nl, xdp_queue_id=0) -> None: # Probe for support - xdp = cmd(cfg.rpath("xdp_helper") + ' - -', fail=False) + xdp = cmd(f'{cfg.test_dir / "xdp_helper"} - -', fail=False) if xdp.ret == 255: raise KsftSkipEx('AF_XDP unsupported') elif xdp.ret > 0: raise KsftFailEx('unable to create AF_XDP socket') - with bkg(f'{cfg.rpath("xdp_helper")} {cfg.ifindex} {xdp_queue_id}', + with bkg(f'{cfg.test_dir / "xdp_helper"} {cfg.ifindex} {xdp_queue_id}', ksft_wait=3): rx = tx = False From patchwork Thu Mar 27 22:23:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 14031483 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8D2F1DE89D for ; Thu, 27 Mar 2025 22:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114203; cv=none; b=GNog2JDYTI2ZGnJmSpJ9Y7PFCrwYKoVJRsIUQjiMTMH151e7GqY6jkV0OkYyTZWqhyGpEVPlbqZ6dHjPIdBCTzfzawbYx0sV06h5/11/Xq5fXPPQp9y7JwQNw/tjE3G6Khu3vjcdjS5dlQUvMarUgyXf2BaRb+qhj7pHp6POKhU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114203; c=relaxed/simple; bh=XjJ9aP+2NRuq1+0cLMY1B3KwKqgw/TQZtBjaOswJBJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NgQAvTGAD/4zhzsOlt/cHnbYYS+Q6TprGipxvtdJ2qOSGPsWLLjC2GXJfcW+3naGDfdweve0aHxAmr4BXLCVobGxuqeTZZub7e91Dw/PEtLvIabokQL8TvPDrvgTsu6gMKn3tVS1xw40cpoVSyFFNhBs8LYTsihBrMMPnXfTvjQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bcvzJRcz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bcvzJRcz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44893C4CEEB; Thu, 27 Mar 2025 22:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743114203; bh=XjJ9aP+2NRuq1+0cLMY1B3KwKqgw/TQZtBjaOswJBJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bcvzJRczFiBaSowRgDO1uzqGcLmGcOyLDulnkD2ZjguAOW/CQAZDhG31lm31AA/sa UF94iQy/n1ltLLKnxS0ettVVEqMQBA7c/sunTz+zF+sQXE92t8hepAY3d5JEJv3Jzx gJrOA53x3sFfBd1CHGPueFIlm0tS/g8zbER+fkLFFe091ANizdsys67mGXYykXo1jk PFzGxgXi6rLHfRJnDkkI9dShUkGiPQO0A//iq0DT7RT3WbRe2h7eXlNuGN178zO3x+ U+0AGblLassn9zz09EODPhS6/n8LXdeyzcpnQm+TY/S/afzKGMd9GgP01nSFCObrLj JQ17ZGqqW/wYw== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me, willemdebruijn.kernel@gmail.com, Jakub Kicinski Subject: [PATCH net v3 2/3] selftests: net: use the dummy bpf from net/lib Date: Thu, 27 Mar 2025 15:23:14 -0700 Message-ID: <20250327222315.1098596-3-kuba@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250327222315.1098596-1-kuba@kernel.org> References: <20250327222315.1098596-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Commit 29b036be1b0b ("selftests: drv-net: test XDP, HDS auto and the ioctl path") added an sample XDP_PASS prog in net/lib, so that we can reuse it in various sub-directories. Delete the old sample and use the one from the lib in existing tests. Acked-by: Stanislav Fomichev Signed-off-by: Jakub Kicinski Reviewed-by: Willem de Bruijn --- v3: - adjust to use of Path v2: https://lore.kernel.org/20250306171158.1836674-2-kuba@kernel.org - also remove the one in drivers/net/hw/ v1: https://lore.kernel.org/20250228212956.25399-2-kuba@kernel.org --- .../selftests/drivers/net/hw/xdp_dummy.bpf.c | 13 ------------- tools/testing/selftests/net/xdp_dummy.bpf.c | 13 ------------- tools/testing/selftests/drivers/net/hw/irq.py | 2 +- tools/testing/selftests/net/udpgro_bench.sh | 2 +- tools/testing/selftests/net/udpgro_frglist.sh | 2 +- tools/testing/selftests/net/udpgro_fwd.sh | 2 +- tools/testing/selftests/net/veth.sh | 2 +- 7 files changed, 5 insertions(+), 31 deletions(-) delete mode 100644 tools/testing/selftests/drivers/net/hw/xdp_dummy.bpf.c delete mode 100644 tools/testing/selftests/net/xdp_dummy.bpf.c diff --git a/tools/testing/selftests/drivers/net/hw/xdp_dummy.bpf.c b/tools/testing/selftests/drivers/net/hw/xdp_dummy.bpf.c deleted file mode 100644 index d988b2e0cee8..000000000000 --- a/tools/testing/selftests/drivers/net/hw/xdp_dummy.bpf.c +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#define KBUILD_MODNAME "xdp_dummy" -#include -#include - -SEC("xdp") -int xdp_dummy_prog(struct xdp_md *ctx) -{ - return XDP_PASS; -} - -char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/net/xdp_dummy.bpf.c b/tools/testing/selftests/net/xdp_dummy.bpf.c deleted file mode 100644 index d988b2e0cee8..000000000000 --- a/tools/testing/selftests/net/xdp_dummy.bpf.c +++ /dev/null @@ -1,13 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#define KBUILD_MODNAME "xdp_dummy" -#include -#include - -SEC("xdp") -int xdp_dummy_prog(struct xdp_md *ctx) -{ - return XDP_PASS; -} - -char _license[] SEC("license") = "GPL"; diff --git a/tools/testing/selftests/drivers/net/hw/irq.py b/tools/testing/selftests/drivers/net/hw/irq.py index d772a18d8a1b..0699d6a8b4e2 100755 --- a/tools/testing/selftests/drivers/net/hw/irq.py +++ b/tools/testing/selftests/drivers/net/hw/irq.py @@ -69,7 +69,7 @@ from lib.py import cmd, ip, defer def check_reconfig_xdp(cfg) -> None: def reconfig(cfg) -> None: ip(f"link set dev %s xdp obj %s sec xdp" % - (cfg.ifname, cfg.test_dir / "xdp_dummy.bpf.o")) + (cfg.ifname, cfg.net_lib_dir / "xdp_dummy.bpf.o")) ip(f"link set dev %s xdp off" % cfg.ifname) _check_reconfig(cfg, reconfig) diff --git a/tools/testing/selftests/net/udpgro_bench.sh b/tools/testing/selftests/net/udpgro_bench.sh index c51ea90a1395..815fad8c53a8 100755 --- a/tools/testing/selftests/net/udpgro_bench.sh +++ b/tools/testing/selftests/net/udpgro_bench.sh @@ -7,7 +7,7 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="xdp_dummy.bpf.o" +BPF_FILE="lib/xdp_dummy.bpf.o" cleanup() { local -r jobs="$(jobs -p)" diff --git a/tools/testing/selftests/net/udpgro_frglist.sh b/tools/testing/selftests/net/udpgro_frglist.sh index 17404f49cdb6..5f3d1a110d11 100755 --- a/tools/testing/selftests/net/udpgro_frglist.sh +++ b/tools/testing/selftests/net/udpgro_frglist.sh @@ -7,7 +7,7 @@ source net_helper.sh readonly PEER_NS="ns-peer-$(mktemp -u XXXXXX)" -BPF_FILE="xdp_dummy.bpf.o" +BPF_FILE="lib/xdp_dummy.bpf.o" cleanup() { local -r jobs="$(jobs -p)" diff --git a/tools/testing/selftests/net/udpgro_fwd.sh b/tools/testing/selftests/net/udpgro_fwd.sh index 550d8eb3e224..f22f6c66997e 100755 --- a/tools/testing/selftests/net/udpgro_fwd.sh +++ b/tools/testing/selftests/net/udpgro_fwd.sh @@ -3,7 +3,7 @@ source net_helper.sh -BPF_FILE="xdp_dummy.bpf.o" +BPF_FILE="lib/xdp_dummy.bpf.o" readonly BASE="ns-$(mktemp -u XXXXXX)" readonly SRC=2 readonly DST=1 diff --git a/tools/testing/selftests/net/veth.sh b/tools/testing/selftests/net/veth.sh index 6bb7dfaa30b6..9709dd067c72 100755 --- a/tools/testing/selftests/net/veth.sh +++ b/tools/testing/selftests/net/veth.sh @@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -BPF_FILE="xdp_dummy.bpf.o" +BPF_FILE="lib/xdp_dummy.bpf.o" readonly STATS="$(mktemp -p /tmp ns-XXXXXX)" readonly BASE=`basename $STATS` readonly SRC=2 From patchwork Thu Mar 27 22:23:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 14031484 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C57C01DF75C for ; Thu, 27 Mar 2025 22:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114204; cv=none; b=RBgoitRXHTvAST2Lnq8NYzFStl1o9TYdR5FURfqox9/PCnEBfUSUFs+036jGEbwYUsChNLo1vtl0S4O2YXSBk1C1LyQ1sfWLY8eOgGgOh2UL2jod5jW/lsu4ShFVmr0FuxtXcW2z+N+ehR0akimztmR66q/6wwKF4TsTU2248kA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743114204; c=relaxed/simple; bh=zeicdEtx4xa3ZxYSJzfyGhAkDy8TJ8eztYnW5ZxEW3M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SZXMM9p9Ni5HSzNWL6l+uczdCLgw8jupNve0AB0v3BUOaiC82bRiJnUfROkkimNJEcXuKeg50y7z2XKLaxdNJNEHwuEjSHk5MWeodc+ISbHABcsyeDDbG8S4Hovq+13AczFjHodekloh2oHRc/Z/MQccsj6G+CDHlBOPTCJPX0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vrol0NyG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vrol0NyG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF2F3C4CEED; Thu, 27 Mar 2025 22:23:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743114204; bh=zeicdEtx4xa3ZxYSJzfyGhAkDy8TJ8eztYnW5ZxEW3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vrol0NyGh6BaEAgyHgX1t7B6Qp7/xk0201d6x2UR7VHNY/Xa8YY6/Thyw2QK66XOx R8uSknaxhkSKWC/6yLhp6oeBWgK8oOLIly2ACF4g6Oo0aDgyrerhGcDa50mBo2s7Ju KWsWP0PO8Bg0DAgNHNmSk4oZzd4PqghJlVgjHX2Hcdx+QdyTYE6NqCqZpJEYGlVAXv nW56tFhK7ogAJBxQvJmVAyqRaQD7/i7L7JKLpoKMXVGfG6Ga78PbNjEaKgthFq+pQp +mCm+r403GcHYf0EXdzaWFfzWjA47duTZGlW2YvhvKmCj4lG1YFvM0XmDR6ZYKGVNp sp8F6Snv5t5+A== From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me, willemdebruijn.kernel@gmail.com, Jakub Kicinski Subject: [PATCH net v3 3/3] selftests: net: use Path helpers in ping Date: Thu, 27 Mar 2025 15:23:15 -0700 Message-ID: <20250327222315.1098596-4-kuba@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250327222315.1098596-1-kuba@kernel.org> References: <20250327222315.1098596-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that net and net-next have converged we can use the Path helpers in the ping test without conflicts. Signed-off-by: Jakub Kicinski Reviewed-by: Willem de Bruijn --- tools/testing/selftests/drivers/net/ping.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/drivers/net/ping.py b/tools/testing/selftests/drivers/net/ping.py index 93120e86e102..4b6822866066 100755 --- a/tools/testing/selftests/drivers/net/ping.py +++ b/tools/testing/selftests/drivers/net/ping.py @@ -56,8 +56,7 @@ no_sleep=False return def _set_xdp_generic_sb_on(cfg) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) cmd(f"ip link set dev {cfg.ifname} mtu 1500 xdpgeneric obj {prog} sec xdp", shell=True) defer(cmd, f"ip link set dev {cfg.ifname} xdpgeneric off") @@ -66,8 +65,7 @@ no_sleep=False time.sleep(10) def _set_xdp_generic_mb_on(cfg) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote) defer(ip, f"link set dev {remote_ifname} mtu 1500", host=cfg.remote) ip("link set dev %s mtu 9000 xdpgeneric obj %s sec xdp.frags" % (cfg.ifname, prog)) @@ -77,8 +75,7 @@ no_sleep=False time.sleep(10) def _set_xdp_native_sb_on(cfg) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" cmd(f"ip link set dev {remote_ifname} mtu 1500", shell=True, host=cfg.remote) cmd(f"ip -j link set dev {cfg.ifname} mtu 1500 xdp obj {prog} sec xdp", shell=True) defer(ip, f"link set dev {cfg.ifname} mtu 1500 xdp off") @@ -95,8 +92,7 @@ no_sleep=False time.sleep(10) def _set_xdp_native_mb_on(cfg) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" cmd(f"ip link set dev {remote_ifname} mtu 9000", shell=True, host=cfg.remote) defer(ip, f"link set dev {remote_ifname} mtu 1500", host=cfg.remote) try: @@ -109,8 +105,7 @@ no_sleep=False time.sleep(10) def _set_xdp_offload_on(cfg) -> None: - test_dir = os.path.dirname(os.path.realpath(__file__)) - prog = test_dir + "/../../net/lib/xdp_dummy.bpf.o" + prog = cfg.net_lib_dir / "xdp_dummy.bpf.o" cmd(f"ip link set dev {cfg.ifname} mtu 1500", shell=True) try: cmd(f"ip link set dev {cfg.ifname} xdpoffload obj {prog} sec xdp", shell=True)