From patchwork Thu Mar 6 17:11:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 14005018 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 50141204C27; Thu, 6 Mar 2025 17:12:03 +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=1741281124; cv=none; b=LYEQSF0ikElqTOkwt8pyc+rtg+F7yOlffLKU7JHmo+OyxWxi9HZbI33DEBAJU91J6Ydy5KzDMnlXBlwfI6xJYxX34Pirzm1W3fCz1TNpT5YmMs2J+H1RI0uUb7ZGWdQQQ0Q/1WDKKLbiDBLl9X2wNQeVqANJ4nk2MTTQrJm/+Ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741281124; c=relaxed/simple; bh=0DHTwPG1prK5tVFv6X39ziG+G8/unYmRdaj84lGeqk0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=r9y+pLmONZe460/ppo2XyVNvBGZy+LHzkzCUl8jV0jK8IkrGV1JvW+rx+Vmr7t8kGGgi1/8DwZw4ai+Nnmcci8xu2g9ZpGAc8n3QIBmK+vc1l0TqMgRR4jh06cFtFnSsHI8B5/hQjOp8VycNHEjZJdgrdHPJgcTWreOe29hL+q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EIN6gJSl; 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="EIN6gJSl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ED2BC4CEE0; Thu, 6 Mar 2025 17:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741281123; bh=0DHTwPG1prK5tVFv6X39ziG+G8/unYmRdaj84lGeqk0=; h=From:To:Cc:Subject:Date:From; b=EIN6gJSlYv4BGPwNmkQoj2/1l2lLao9fZ5JfakacKDWlGk61DyAZ7+QDRwtkrVBq6 fvVwVMTRfFCMBVqHxyIAHgeueXsI6nBCKcLB0I5ewMua/r+nthMtI6sCvxEoZ89gQ1 5vLx1DEwI81DJW5Uy8eNi2QNsfqDHSYrEA+Mt8MlA1Oexpme57OUOygCKL8yKa6BOg oF89fTeW5uiqUasemslucxQNQq2Bcr7Mp2Qthmo623W2q+zFf7Ili27Q3GGmakAkkh mft5nNm7XaSNfxqpKHkcIUeHYIYIurypszitN0AZAFFKrGcXG/Iojmgeua6pK9OZ2N m37uTpxYm5zXQ== 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, shuah@kernel.org, willemb@google.com, petrm@nvidia.com, sdf@fomichev.me, linux-kselftest@vger.kernel.org, Jakub Kicinski Subject: [PATCH net-next v2 1/2] selftests: drv-net: add path helper for net/lib Date: Thu, 6 Mar 2025 09:11:57 -0800 Message-ID: <20250306171158.1836674-1-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Looks like a lot of users of recently added env.rpath() actually want to access stuff under net/lib. Add another helper. Signed-off-by: Jakub Kicinski Reviewed-by: Willem de Bruijn --- tools/testing/selftests/drivers/net/hds.py | 2 +- tools/testing/selftests/drivers/net/hw/csum.py | 2 +- tools/testing/selftests/drivers/net/lib/py/env.py | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/drivers/net/hds.py b/tools/testing/selftests/drivers/net/hds.py index 7cc74faed743..def44c10349a 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.lpath("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..49ec98aef579 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.lpath("csum") cfg.bin_remote = cfg.remote.deploy(cfg.bin_local) cases = [] diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py index fd4d674e6c72..2a1f8bd0ec19 100644 --- a/tools/testing/selftests/drivers/net/lib/py/env.py +++ b/tools/testing/selftests/drivers/net/lib/py/env.py @@ -30,6 +30,13 @@ from .remote import Remote src_dir = Path(self.src_path).parent.resolve() return (src_dir / path).as_posix() + def lpath(self, path): + """ + Similar to rpath, but for files in net/lib TARGET. + """ + lib_dir = (Path(__file__).parent / "../../../../net/lib").resolve() + return (lib_dir / path).as_posix() + def _load_env_file(self): env = os.environ.copy() From patchwork Thu Mar 6 17:11:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Kicinski X-Patchwork-Id: 14005019 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 EB50E25C6EF; Thu, 6 Mar 2025 17:12:04 +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=1741281125; cv=none; b=FnV0t58Ji2g+KPCuQ/ILT2ed0lFFi/CLiPWNiTgbWSEA7Rwg7WueNaLBo7uw2Y2Nl7HaHtMxzXG/rgsR+8l9nmaVn8MzVXov724U4d0lwmMhqlRNKbc8w7Y9t5YBg7IjJ9/Rwx60xoQ0mnLMPZpNODFoSBi8a4Evhp0p4tf29D0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741281125; c=relaxed/simple; bh=mZaaHmxzKtFTrqLSEyIuz4NQdokwcpZv8Vp1oFKHrxI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gfDKBiRTxCWQ7UoP3UgBdNYGaJa4VR4qN1/Sq8/sLO3COTDxaidTz3zzN0csBq5HDJMMaUuWuQsO/kfQKQU3muh1zyaE7i4hGu90ljjIkUKYwWaeNvoeKIYZLkHegwAeZvdca3DFU3c+RVjaQOvgHOceILMS7GakSFk/mA1wKwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eYqLkaj7; 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="eYqLkaj7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7BB4C4CEE8; Thu, 6 Mar 2025 17:12:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741281124; bh=mZaaHmxzKtFTrqLSEyIuz4NQdokwcpZv8Vp1oFKHrxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eYqLkaj7X5/K72ORO2jA0DzfbmWpbCHO3vJosw9rtp7KW9UOCh/tv65nHO+8aCOz8 HUacEu6Key6+kg7EYu/s7ki4z93/DaMO9ivG8f7Jt67QrmqK3CFJULCNdquT+k5D1k AKcjzFpgDIQuUl8n69konQyztxAsLD+k81oLAKKyz6LgFo0L7KGj7MsUpSjJMDU7g1 Z3Jy1gFxTSR5b288IOmOm2JMRg+4fMwJco9vCbVk0tJhfZl+hXJdFe0C4WDxw15IMk zRBrJyccKUcg4mcbUYpkldb7gy61Y7z9fkxpUnILL28gxlAOZK9w5xaN6JljUcv65o RzMRKUDwSIjCw== 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, shuah@kernel.org, willemb@google.com, petrm@nvidia.com, sdf@fomichev.me, linux-kselftest@vger.kernel.org, Jakub Kicinski Subject: [PATCH net-next v2 2/2] selftests: net: use the dummy bpf from net/lib Date: Thu, 6 Mar 2025 09:11:58 -0800 Message-ID: <20250306171158.1836674-2-kuba@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250306171158.1836674-1-kuba@kernel.org> References: <20250306171158.1836674-1-kuba@kernel.org> Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- v2: - 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 42ab98370245..e3c2201bb58b 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.lpath("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