Re: [PATCH net-next v1 7/9] net: devmem: ksft: add 5 tuple FS support

Stanislav Fomichev
2025-05-19T15:37:06Z

On 05/19, Mina Almasry wrote:
> ncdevmem supports drivers that are limited to either 3-tuple or 5-tuple
> FS support, but the ksft is currently 3-tuple only. Support drivers that
> have 5-tuple FS supported by adding a ksft arg.
>
> Signed-off-by: Mina Almasry <almasrymina@google.com>
>
> ---
> .../testing/selftests/drivers/net/hw/devmem.py | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/devmem.py b/tools/testing/selftests/drivers/net/hw/devmem.py
> index 39b5241463aa..40fe5b525d51 100755
> --- a/tools/testing/selftests/drivers/net/hw/devmem.py
> +++ b/tools/testing/selftests/drivers/net/hw/devmem.py
> @@ -21,14 +21,27 @@ def require_devmem(cfg):
> def check_rx(cfg, ipver) -> None:
> require_devmem(cfg)
>
> + fs_5_tuple = False
> + if "FLOW_STEERING_5_TUPLE" in cfg.env:
> + fs_5_tuple = cfg.env["FLOW_STEERING_5_TUPLE"]

I wonder if we can transparently handle it in ncdevmem: if -c is passed,
try installing 3-tuple rule, and if it fails, try 5-tuple one. This
should work without any user input / extra environment variable.

> addr = cfg.addr_v[ipver]
> + remote_addr = cfg.remote_addr_v[ipver]
> + port = rand_port()
> +
> if ipver == "6":
> addr = "[" + addr + "]"
> + remote_addr = "[" + remote_addr + "]"
>
> 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}"
> + if fs_5_tuple:
> + socat += f",bind={remote_addr}:{port}"

This we can always do regardless of 3 or 5 tuple?