Skip to content

Commit 243d47a

Browse files
minakuba-moo
authored andcommitted
net: devmem: ksft: add 5 tuple FS support
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> fix 5-tuple fix 5-tuple Acked-by: Stanislav Fomichev <sdf@fomichev.me> Link: https://patch.msgid.link/20250523230524.1107879-7-almasrymina@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 57605ae commit 243d47a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def check_rx(cfg) -> None:
2424
require_devmem(cfg)
2525

2626
port = rand_port()
27-
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port}"
27+
listen_cmd = f"{cfg.bin_local} -l -f {cfg.ifname} -s {cfg.addr} -p {port} -c {cfg.remote_addr}"
2828

2929
with bkg(listen_cmd, exit_wait=True) as ncdevmem:
3030
wait_port_listen(port)
31-
cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port}", host=cfg.remote, shell=True)
31+
cmd(f"echo -e \"hello\\nworld\"| socat -u - TCP{cfg.addr_ipver}:{cfg.addr}:{port},bind={cfg.remote_addr}:{port}", host=cfg.remote, shell=True)
3232

3333
ksft_eq(ncdevmem.stdout.strip(), "hello\nworld")
3434

tools/testing/selftests/drivers/net/hw/ncdevmem.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,26 @@ static int configure_flow_steering(struct sockaddr_in6 *server_sin)
373373
server_addr = strrchr(server_addr, ':') + 1;
374374
}
375375

376-
return run_command("sudo ethtool -N %s flow-type %s %s %s dst-ip %s %s %s dst-port %s queue %d >&2",
376+
/* Try configure 5-tuple */
377+
if (run_command("sudo ethtool -N %s flow-type %s %s %s dst-ip %s %s %s dst-port %s queue %d >&2",
377378
ifname,
378379
type,
379380
client_ip ? "src-ip" : "",
380381
client_ip ?: "",
381382
server_addr,
382383
client_ip ? "src-port" : "",
383384
client_ip ? port : "",
384-
port, start_queue);
385+
port, start_queue))
386+
/* If that fails, try configure 3-tuple */
387+
if (run_command("sudo ethtool -N %s flow-type %s dst-ip %s dst-port %s queue %d >&2",
388+
ifname,
389+
type,
390+
server_addr,
391+
port, start_queue))
392+
/* If that fails, return error */
393+
return -1;
394+
395+
return 0;
385396
}
386397

387398
static int bind_rx_queue(unsigned int ifindex, unsigned int dmabuf_fd,

0 commit comments

Comments
 (0)