[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCtPEBmBFvM-bA_i@mini-arch>
Date: Mon, 19 May 2025 08:32:32 -0700
From: Stanislav Fomichev <stfomichev@...il.com>
To: Mina Almasry <almasrymina@...gle.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Ilias Apalodimas <ilias.apalodimas@...aro.org>,
Neal Cardwell <ncardwell@...gle.com>,
Kuniyuki Iwashima <kuniyu@...zon.com>,
David Ahern <dsahern@...nel.org>,
Andrew Lunn <andrew+netdev@...n.ch>, Shuah Khan <shuah@...nel.org>,
sdf@...ichev.me, ap420073@...il.com, praan@...gle.com,
shivajikant@...gle.com
Subject: Re: [PATCH net-next v1 5/9] net: devmem: ksft: add ipv4 support
On 05/19, Mina Almasry wrote:
> 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@...gle.com>
>
> ---
> .../selftests/drivers/net/hw/devmem.py | 33 ++++++++++++-------
> 1 file changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
> index f5d7809400ea..850381e14d9e 100755
> --- a/tools/testing/selftests/drivers/net/hw/devmem.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem.py
> @@ -18,30 +18,36 @@ def require_devmem(cfg):
> raise KsftSkipEx("Test requires devmem support")
>
>
> -def check_rx(cfg) -> None:
> - cfg.require_ipver("6")
> +def check_rx(cfg, ipver) -> None:
> require_devmem(cfg)
>
> + addr = cfg.addr_v[ipver]
> + if ipver == "6":
> + addr = "[" + addr + "]"
I think you can add [] unconditionally, no need to special case v6.
> +
> + socat = f"socat -u - TCP{ipver}:{addr}:{port}"
> +
> port = rand_port()
> listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}"
>
> - with bkg(listen_cmd) as socat:
> + with bkg(listen_cmd) as ncdevmem:
> wait_port_listen(port)
> - cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP6:[{cfg.addr_v['6']}]:{port}", host=cfg.remote, shell=True)
> + cmd(f"echo -e \"hello\\nworld\"| {socat}", host=cfg.remote, shell=True)
>
> - ksft_eq(socat.stdout.strip(), "hello\nworld")
> + ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
>
>
> -def check_tx(cfg) -> None:
> - cfg.require_ipver("6")
> +def check_tx(cfg, ipver) -> None:
> require_devmem(cfg)
>
> port = rand_port()
> - listen_cmd = f"socat -U - TCP6-LISTEN:{port}"
> + listen_cmd = f"socat -U - TCP{ipver}-LISTEN:{port}"
>
> - with bkg(listen_cmd, exit_wait=True) as socat:
> + addr = cfg.addr_v[ipver]
> +
> + with bkg(listen_cmd) as socat:
> wait_port_listen(port)
> - cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {cfg.addr_v['6']} -p {port}", host=cfg.remote, shell=True)
> + cmd(f"echo -e \"hello\\nworld\"| {cfg.bin_remote} -f {cfg.ifname} -s {addr} -p {port}", host=cfg.remote, shell=True)
>
> ksft_eq(socat.stdout.strip(), "hello\nworld")
>
> @@ -51,8 +57,13 @@ def main() -> None:
> cfg.bin_local = path.abspath(path.dirname(__file__) + "/ncdevmem")
> cfg.bin_remote = cfg.remote.deploy(cfg.bin_local)
>
> + if "4" in cfg.addr_v:
> + ipver = "4"
> + else:
> + ipver = "6"
If we have both, we prefer v4, can we do the opposite?
Powered by blists - more mailing lists