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

Mina Almasry
2025-05-19T02:35:32Z

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"]
+
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}"
+
+ listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {addr} -p {port}"
+
+ if fs_5_tuple:
+ listen_cmd += f" -c {remote_addr}"

with bkg(listen_cmd, exit_wait=True) as ncdevmem:
wait_port_listen(port)
--
2.49.0.1101.gccaa498523-goog