From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: netdev@vger.kernel.org
Cc: magnus.karlsson@intel.com, stfomichev@gmail.com, kuba@kernel.org,
pabeni@redhat.com, tushar.vyavahare@intel.com,
kerneljasonxing@gmail.com, bjorn@kernel.org,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: [PATCH v5 net-next 11/13] selftests: drv-net: decouple local link setup from netdevsim
Date: Thu, 19 Nov 2026 17:46:34 +0100 [thread overview]
Message-ID: <20261119164636.1071385-12-maciej.fijalkowski@intel.com> (raw)
In-Reply-To: <20261119164636.1071385-1-maciej.fijalkowski@intel.com>
Without NETIF, NetDrvEpEnv addresses its pair of netdevsim devices from
nsim_v4_pfx and nsim_v6_pfx and brings them up in create_local(). A
following patch lets the env create a veth pair instead, which needs the
same addresses and setup.
Rename the prefixes to sw_v4_pfx and sw_v6_pfx, as they serve any
software interface pair, and update tso.py, which builds its tunnel
addresses from them. Move the address and link setup out of
create_local() into _setup_sw_ifaces(), which takes the names of the
local interface and its peer.
No functional change.
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
tools/testing/selftests/drivers/net/hw/tso.py | 8 ++---
.../selftests/drivers/net/lib/py/env.py | 29 +++++++++++--------
2 files changed, 21 insertions(+), 16 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/hw/tso.py b/tools/testing/selftests/drivers/net/hw/tso.py
index 176ddf97fabb..5fd6d3d2ec73 100755
--- a/tools/testing/selftests/drivers/net/hw/tso.py
+++ b/tools/testing/selftests/drivers/net/hw/tso.py
@@ -245,10 +245,10 @@ def run_big_tcp_stream(cfg, ipver, remote_v4, remote_v6):
def build_tunnel(cfg, outer_ipver, tun_info):
- local_v4 = NetDrvEpEnv.nsim_v4_pfx + "1"
- local_v6 = NetDrvEpEnv.nsim_v6_pfx + "1"
- remote_v4 = NetDrvEpEnv.nsim_v4_pfx + "2"
- remote_v6 = NetDrvEpEnv.nsim_v6_pfx + "2"
+ local_v4 = NetDrvEpEnv.sw_v4_pfx + "1"
+ local_v6 = NetDrvEpEnv.sw_v6_pfx + "1"
+ remote_v4 = NetDrvEpEnv.sw_v4_pfx + "2"
+ remote_v6 = NetDrvEpEnv.sw_v6_pfx + "2"
local_addr = cfg.addr_v[outer_ipver]
remote_addr = cfg.remote_addr_v[outer_ipver]
diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py
index 6262080a8bf4..c1d58bef754f 100644
--- a/tools/testing/selftests/drivers/net/lib/py/env.py
+++ b/tools/testing/selftests/drivers/net/lib/py/env.py
@@ -129,8 +129,8 @@ class NetDrvEpEnv(NetDrvEnvBase):
"""
# Network prefixes used for local tests
- nsim_v4_pfx = "192.0.2."
- nsim_v6_pfx = "2001:db8::"
+ sw_v4_pfx = "192.0.2."
+ sw_v6_pfx = "2001:db8::"
def __init__(self, src_path, nsim_test=None, queue_count=None):
super().__init__(src_path)
@@ -169,10 +169,10 @@ class NetDrvEpEnv(NetDrvEnvBase):
self.dev = self._ns.nsims[0].dev
- self.addr_v["4"] = self.nsim_v4_pfx + "1"
- self.addr_v["6"] = self.nsim_v6_pfx + "1"
- self.remote_addr_v["4"] = self.nsim_v4_pfx + "2"
- self.remote_addr_v["6"] = self.nsim_v6_pfx + "2"
+ self.addr_v["4"] = self.sw_v4_pfx + "1"
+ self.addr_v["6"] = self.sw_v6_pfx + "1"
+ self.remote_addr_v["4"] = self.sw_v4_pfx + "2"
+ self.remote_addr_v["6"] = self.sw_v6_pfx + "2"
kind = "netns"
args = self._netns.name
@@ -208,13 +208,18 @@ class NetDrvEpEnv(NetDrvEnvBase):
NetdevSimDev.ctrl_write('link_device',
f'{nsfd0.fileno()}:{ifi0} {nsfd1.fileno()}:{ifi1}')
- ip(f" addr add dev {self._ns.nsims[0].ifname} {self.nsim_v4_pfx}1/24")
- ip(f"-6 addr add dev {self._ns.nsims[0].ifname} {self.nsim_v6_pfx}1/64 nodad")
- ip(f" link set dev {self._ns.nsims[0].ifname} up")
+ self._setup_sw_ifaces(self._ns.nsims[0].ifname,
+ self._ns_peer.nsims[0].ifname)
- ip(f" addr add dev {self._ns_peer.nsims[0].ifname} {self.nsim_v4_pfx}2/24", ns=self._netns)
- ip(f"-6 addr add dev {self._ns_peer.nsims[0].ifname} {self.nsim_v6_pfx}2/64 nodad", ns=self._netns)
- ip(f" link set dev {self._ns_peer.nsims[0].ifname} up", ns=self._netns)
+ def _setup_sw_ifaces(self, ifname, peer_ifname):
+ """Address and bring up a local interface and its peer in _netns."""
+ ip(f" addr add dev {ifname} {self.sw_v4_pfx}1/24")
+ ip(f"-6 addr add dev {ifname} {self.sw_v6_pfx}1/64 nodad")
+ ip(f" link set dev {ifname} up")
+
+ ip(f" addr add dev {peer_ifname} {self.sw_v4_pfx}2/24", ns=self._netns)
+ ip(f"-6 addr add dev {peer_ifname} {self.sw_v6_pfx}2/64 nodad", ns=self._netns)
+ ip(f" link set dev {peer_ifname} up", ns=self._netns)
def _check_env(self):
vars_needed = [
--
2.43.0
next prev parent reply other threads:[~2026-11-19 16:47 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 16:46 [PATCH v5 net-next 00/13] selftests: net: adjust xskxceiver to drv-net Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 01/13] selftests: xsk: factor endpoint work out of pthread wrappers Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 02/13] selftests: xsk: size the TX UMEM in HW_SW_MAX_RING_SIZE Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 03/13] selftests: xsk: drop the single-interface loopback mode Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 04/13] selftests: xsk: collect interface capabilities in struct xsk_caps Maciej Fijalkowski
2026-11-19 16:46 ` [PATCH v5 net-next 05/13] selftests: xsk: split xskxceiver main() into setup, run and cleanup Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 06/13] selftests: xsk: run one test case per xskxceiver invocation Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 07/13] selftests: xsk: run the RX and TX endpoints in separate processes Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 08/13] selftests: xsk: send UDP over IPv4 or IPv6 between the interface MACs Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-23 19:08 ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 09/13] selftests: xsk: prepare xskxceiver for endpoints on two hosts Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-23 19:10 ` Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 10/13] selftests: xsk: list the endpoint roles of the test cases Maciej Fijalkowski
2026-11-23 19:12 ` Björn Töpel
2026-11-19 16:46 ` Maciej Fijalkowski [this message]
2026-11-23 19:12 ` [PATCH v5 net-next 11/13] selftests: drv-net: decouple local link setup from netdevsim Björn Töpel
2026-11-19 16:46 ` [PATCH v5 net-next 12/13] selftests: drv-net: run the AF_XDP tests over veth or a NIC Maciej Fijalkowski
2026-11-23 18:46 ` netdev-bot+sashiko
2026-11-19 16:46 ` [PATCH v5 net-next 13/13] selftests: xsk: document generic and hardware endpoint runs Maciej Fijalkowski
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=20261119164636.1071385-12-maciej.fijalkowski@intel.com \
--to=maciej.fijalkowski@intel.com \
--cc=bjorn@kernel.org \
--cc=kerneljasonxing@gmail.com \
--cc=kuba@kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@gmail.com \
--cc=tushar.vyavahare@intel.com \
/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