lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250710165337.614159-1-vishs@meta.com>
Date: Thu, 10 Jul 2025 09:53:37 -0700
From: Vishwanath Seshagiri <vishs@...a.com>
To: "David S . Miller" <davem@...emloft.net>,
        Eric Dumazet
	<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni
	<pabeni@...hat.com>
CC: Andrew Lunn <andrew+netdev@...n.ch>, David Wei <dw@...idwei.uk>,
        "Joe
 Damato" <jdamato@...tly.com>, Simon Horman <horms@...nel.org>,
        <netdev@...r.kernel.org>, Vishwanath Seshagiri <vishs@...com>
Subject: [PATCH net-next v2] selftests: flip local/remote endpoints in iou-zcrx.py

From: Vishwanath Seshagiri <vishs@...com>

The iou-zcrx selftest currently runs the server on the remote host
and the client on the local host. This commit flips the endpoints
such that server runs on localhost and client on remote.
This change brings the iou-zcrx selftest in convention with other
selftests.

Drive-by fix for a missing import exception that happens when the
network interface has less than 2 combined channels.

Test plan: ran iou-zcrx.py selftest between 2 physical machines

Signed-off-by: Vishwanath Seshagiri <vishs@...com>
---
Changelog:
v2: Updated patch title, description to provide more context on the
specific changes made.
v1 link: https://lore.kernel.org/netdev/20250707232223.190242-1-vishs@meta.com/T/#u
---
 .../selftests/drivers/net/hw/iou-zcrx.py      | 98 +++++++++----------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
index 9c03fd777f3d..712c806508b5 100755
--- a/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
+++ b/tools/testing/selftests/drivers/net/hw/iou-zcrx.py
@@ -3,37 +3,37 @@
 
 import re
 from os import path
-from lib.py import ksft_run, ksft_exit
+from lib.py import ksft_run, ksft_exit, KsftSkipEx
 from lib.py import NetDrvEpEnv
 from lib.py import bkg, cmd, defer, ethtool, rand_port, wait_port_listen
 
 
 def _get_current_settings(cfg):
-    output = ethtool(f"-g {cfg.ifname}", json=True, host=cfg.remote)[0]
+    output = ethtool(f"-g {cfg.ifname}", json=True)[0]
     return (output['rx'], output['hds-thresh'])
 
 
 def _get_combined_channels(cfg):
-    output = ethtool(f"-l {cfg.ifname}", host=cfg.remote).stdout
+    output = ethtool(f"-l {cfg.ifname}").stdout
     values = re.findall(r'Combined:\s+(\d+)', output)
     return int(values[1])
 
 
 def _create_rss_ctx(cfg, chan):
-    output = ethtool(f"-X {cfg.ifname} context new start {chan} equal 1", host=cfg.remote).stdout
+    output = ethtool(f"-X {cfg.ifname} context new start {chan} equal 1").stdout
     values = re.search(r'New RSS context is (\d+)', output).group(1)
     ctx_id = int(values)
-    return (ctx_id, defer(ethtool, f"-X {cfg.ifname} delete context {ctx_id}", host=cfg.remote))
+    return (ctx_id, defer(ethtool, f"-X {cfg.ifname} delete context {ctx_id}"))
 
 
 def _set_flow_rule(cfg, port, chan):
-    output = ethtool(f"-N {cfg.ifname} flow-type tcp6 dst-port {port} action {chan}", host=cfg.remote).stdout
+    output = ethtool(f"-N {cfg.ifname} flow-type tcp6 dst-port {port} action {chan}").stdout
     values = re.search(r'ID (\d+)', output).group(1)
     return int(values)
 
 
 def _set_flow_rule_rss(cfg, port, ctx_id):
-    output = ethtool(f"-N {cfg.ifname} flow-type tcp6 dst-port {port} context {ctx_id}", host=cfg.remote).stdout
+    output = ethtool(f"-N {cfg.ifname} flow-type tcp6 dst-port {port} context {ctx_id}").stdout
     values = re.search(r'ID (\d+)', output).group(1)
     return int(values)
 
@@ -47,26 +47,26 @@ def test_zcrx(cfg) -> None:
     (rx_ring, hds_thresh) = _get_current_settings(cfg)
     port = rand_port()
 
-    ethtool(f"-G {cfg.ifname} tcp-data-split on", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} tcp-data-split on")
+    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto")
 
-    ethtool(f"-G {cfg.ifname} hds-thresh 0", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} hds-thresh 0")
+    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}")
 
-    ethtool(f"-G {cfg.ifname} rx 64", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} rx 64")
+    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}")
 
-    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}", host=cfg.remote)
-    defer(ethtool, f"-X {cfg.ifname} default", host=cfg.remote)
+    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}")
+    defer(ethtool, f"-X {cfg.ifname} default")
 
     flow_rule_id = _set_flow_rule(cfg, port, combined_chans - 1)
-    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}", host=cfg.remote)
+    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}")
 
-    rx_cmd = f"{cfg.bin_remote} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1}"
-    tx_cmd = f"{cfg.bin_local} -c -h {cfg.remote_addr_v['6']} -p {port} -l 12840"
-    with bkg(rx_cmd, host=cfg.remote, exit_wait=True):
-        wait_port_listen(port, proto="tcp", host=cfg.remote)
-        cmd(tx_cmd)
+    rx_cmd = f"{cfg.bin_local} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1}"
+    tx_cmd = f"{cfg.bin_remote} -c -h {cfg.addr_v['6']} -p {port} -l 12840"
+    with bkg(rx_cmd, exit_wait=True):
+        wait_port_listen(port, proto="tcp")
+        cmd(tx_cmd, host=cfg.remote)
 
 
 def test_zcrx_oneshot(cfg) -> None:
@@ -78,26 +78,26 @@ def test_zcrx_oneshot(cfg) -> None:
     (rx_ring, hds_thresh) = _get_current_settings(cfg)
     port = rand_port()
 
-    ethtool(f"-G {cfg.ifname} tcp-data-split on", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} tcp-data-split on")
+    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto")
 
-    ethtool(f"-G {cfg.ifname} hds-thresh 0", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} hds-thresh 0")
+    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}")
 
-    ethtool(f"-G {cfg.ifname} rx 64", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} rx 64")
+    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}")
 
-    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}", host=cfg.remote)
-    defer(ethtool, f"-X {cfg.ifname} default", host=cfg.remote)
+    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}")
+    defer(ethtool, f"-X {cfg.ifname} default")
 
     flow_rule_id = _set_flow_rule(cfg, port, combined_chans - 1)
-    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}", host=cfg.remote)
+    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}")
 
-    rx_cmd = f"{cfg.bin_remote} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1} -o 4"
-    tx_cmd = f"{cfg.bin_local} -c -h {cfg.remote_addr_v['6']} -p {port} -l 4096 -z 16384"
-    with bkg(rx_cmd, host=cfg.remote, exit_wait=True):
-        wait_port_listen(port, proto="tcp", host=cfg.remote)
-        cmd(tx_cmd)
+    rx_cmd = f"{cfg.bin_local} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1} -o 4"
+    tx_cmd = f"{cfg.bin_remote} -c -h {cfg.addr_v['6']} -p {port} -l 4096 -z 16384"
+    with bkg(rx_cmd, exit_wait=True):
+        wait_port_listen(port, proto="tcp")
+        cmd(tx_cmd, host=cfg.remote)
 
 
 def test_zcrx_rss(cfg) -> None:
@@ -109,27 +109,27 @@ def test_zcrx_rss(cfg) -> None:
     (rx_ring, hds_thresh) = _get_current_settings(cfg)
     port = rand_port()
 
-    ethtool(f"-G {cfg.ifname} tcp-data-split on", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} tcp-data-split on")
+    defer(ethtool, f"-G {cfg.ifname} tcp-data-split auto")
 
-    ethtool(f"-G {cfg.ifname} hds-thresh 0", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} hds-thresh 0")
+    defer(ethtool, f"-G {cfg.ifname} hds-thresh {hds_thresh}")
 
-    ethtool(f"-G {cfg.ifname} rx 64", host=cfg.remote)
-    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}", host=cfg.remote)
+    ethtool(f"-G {cfg.ifname} rx 64")
+    defer(ethtool, f"-G {cfg.ifname} rx {rx_ring}")
 
-    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}", host=cfg.remote)
-    defer(ethtool, f"-X {cfg.ifname} default", host=cfg.remote)
+    ethtool(f"-X {cfg.ifname} equal {combined_chans - 1}")
+    defer(ethtool, f"-X {cfg.ifname} default")
 
     (ctx_id, delete_ctx) = _create_rss_ctx(cfg, combined_chans - 1)
     flow_rule_id = _set_flow_rule_rss(cfg, port, ctx_id)
-    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}", host=cfg.remote)
+    defer(ethtool, f"-N {cfg.ifname} delete {flow_rule_id}")
 
-    rx_cmd = f"{cfg.bin_remote} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1}"
-    tx_cmd = f"{cfg.bin_local} -c -h {cfg.remote_addr_v['6']} -p {port} -l 12840"
-    with bkg(rx_cmd, host=cfg.remote, exit_wait=True):
-        wait_port_listen(port, proto="tcp", host=cfg.remote)
-        cmd(tx_cmd)
+    rx_cmd = f"{cfg.bin_local} -s -p {port} -i {cfg.ifname} -q {combined_chans - 1}"
+    tx_cmd = f"{cfg.bin_remote} -c -h {cfg.addr_v['6']} -p {port} -l 12840"
+    with bkg(rx_cmd, exit_wait=True):
+        wait_port_listen(port, proto="tcp")
+        cmd(tx_cmd, host=cfg.remote)
 
 
 def main() -> None:
-- 
2.47.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ