Skip to content

Commit 12d3114

Browse files
minakuba-moo
authored andcommitted
net: devmem: ksft: add ipv4 support
ncdevmem supports both ipv4 and ipv6, but the ksft is currently ipv6-only. Propagate the ipv4 support to the ksft, so that folks that are limited to these networks can also test. Signed-off-by: Mina Almasry <almasrymina@google.com> Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250523230524.1107879-5-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 85cea17 commit 12d3114

File tree

1 file changed

+7
-9
lines changed
  • tools/testing/selftests/drivers/net/hw

1 file changed

+7
-9
lines changed

tools/testing/selftests/drivers/net/hw/devmem.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,28 @@ def require_devmem(cfg):
2121

2222
@ksft_disruptive
2323
def check_rx(cfg) -> None:
24-
cfg.require_ipver("6")
2524
require_devmem(cfg)
2625

2726
port = rand_port()
28-
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}"
27+
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port}"
2928

30-
with bkg(listen_cmd) as socat:
29+
with bkg(listen_cmd) as ncdevmem:
3130
wait_port_listen(port)
32-
cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP6:[{cfg.addr_v['6']}]:{port}", host=cfg.remote, shell=True)
31+
cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port}", host=cfg.remote, shell=True)
3332

34-
ksft_eq(socat.stdout.strip(), "hello\nworld")
33+
ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
3534

3635

3736
@ksft_disruptive
3837
def check_tx(cfg) -> None:
39-
cfg.require_ipver("6")
4038
require_devmem(cfg)
4139

4240
port = rand_port()
43-
listen_cmd = f"socat -U - TCP6-LISTEN:{port}"
41+
listen_cmd = f"socat -U - TCP{cfg.addr_ipver}-LISTEN:{port}"
4442

45-
with bkg(listen_cmd, exit_wait=True) as socat:
43+
with bkg(listen_cmd) as socat:
4644
wait_port_listen(port)
47-
cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}", host=cfg.remote, shell=True)
45+
cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr} -p {port}", host=cfg.remote, shell=True)
4846

4947
ksft_eq(socat.stdout.strip(), "hello\nworld")
5048

0 commit comments

Comments
 (0)