Skip to contentSkip to conversation

selftests: drv-net: so_txtime: only send test traffic to sch_etf

PATCH Superseded Willem de Bruijn 2 participants 3 messages Aug 6 – Aug 7

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Willem de Bruijn

author maintainer
#0 lore raw

PATCH 1/1 selftests: drv-net: so_txtime: only send test traffic to sch_etf

From: Willem de Bruijn <[email protected]>

The ETF qdiscs drops traffic without a socket or txtime. Even with parameter skip_sock_check regular traffic is affected by ETF.

This test ran fine when run manually in a pure software environment. But with drv-net across two hosts tests fail as early as when calling cfg.remote.deploy due to effectively losing connectivity.

Isolate the intended test traffic:
- mark that with SO_MARK 100
- install a regular permissive root prio qdisc for background traffic
- install the ETF qdisc as leaf
- install a filter that only directs SO_MARK 100 traffic to this leaf

Technically other high prio traffic will map onto this leaf based on ToS band mapping too. But that is immaterial in practice.

Fixes 5c6baef3885c ("selftests: drv-net: convert so_txtime to drv-net")
---
 tools/testing/selftests/drivers/net/config       |  2 ++
 tools/testing/selftests/drivers/net/so_txtime.py | 16 +++++++++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)
tools/testing/selftests/drivers/net/config +2 -0
index 2070e890e064..de7af08a188d 100644
@@ -6,6 +6,7 @@ CONFIG_IPV6=y
 CONFIG_MACSEC=m
 CONFIG_NET_CLS_ACT=y
 CONFIG_NET_CLS_BPF=y
+CONFIG_NET_CLS_FW=m
 CONFIG_NETCONSOLE=m
 CONFIG_NETCONSOLE_DYNAMIC=y
 CONFIG_NETCONSOLE_EXTENDED_LOG=y
@@ -14,6 +15,7 @@ CONFIG_NETKIT=y
 CONFIG_NET_SCH_ETF=m
 CONFIG_NET_SCH_FQ=m
 CONFIG_NET_SCH_INGRESS=y
+CONFIG_NET_SCH_PRIO=m
 CONFIG_PPP=y
 CONFIG_PPPOE=y
 CONFIG_VLAN_8021Q=m
tools/testing/selftests/drivers/net/so_txtime.py +13 -3
index adf6c848d6d8..9fbc0278d28b 100755
@@ -27,7 +27,7 @@ def test_so_txtime(cfg, clockid, ipver, args_tx, args_rx, expect_success):
     cmd_addr = f"-S {cfg.addr_v[ipver]} -D {cfg.remote_addr_v[ipver]}"
     cmd_args = f"-{ipver} -c {clockid} -t {tstart} {cmd_addr}"
     cmd_rx = f"{cfg.bin_remote} {cmd_args} {args_rx} -r"
-    cmd_tx = f"{cfg.bin_local} {cmd_args} {args_tx}"
+    cmd_tx = f"{cfg.bin_local} -m 100 {cmd_args} {args_tx}"
 
     expect_fail = not expect_success
     if slow_machine:
@@ -45,7 +45,7 @@ def _qdisc_setup(ifname, qdisc, optargs=""):
     """
     orig = tc(f"qdisc show dev {ifname} root", json=True)[0].get("kind", None)
     defer(tc, f"qdisc replace dev {ifname} root {orig}")
-    tc(f"qdisc replace dev {ifname} root {qdisc} {optargs}")
+    tc(f"qdisc replace dev {ifname} root handle 1: {qdisc} {optargs}")
 
 
 def _test_variants_fq():
@@ -96,11 +96,21 @@ def _test_variants_etf():
 def test_so_txtime_etf(cfg, ipver, args_tx, args_rx, expect_fail):
     """Run all variants of etf tests."""
     cfg.require_ipver(ipver)
+
+    # root qdisc for background traffic (e.g., bkg())
+    _qdisc_setup(cfg.ifname, "prio")
+
+    # leaf ETF qdisc only for intended packets
     try:
-        _qdisc_setup(cfg.ifname, "etf", "clockid CLOCK_TAI delta 400000")
+        etf_args = "clockid CLOCK_TAI delta 400000"
+        tc(f"qdisc add dev {cfg.ifname} parent 1:1 handle 10: etf {etf_args}")
     except Exception as e:
         raise KsftSkipEx("tc does not support qdisc etf. skipping") from e
 
+    # redirect mark 100 to leaf
+    filter_args = "protocol all handle 100 fw flowid 1:1"
+    tc(f"filter add dev {cfg.ifname} parent 1: {filter_args}")
+
     test_so_txtime(cfg, "tai", ipver, args_tx, args_rx, expect_fail)
 
 
Signature · 1 line
2.55.0.679.g6767b8d81c-goog
maintainer
#1 lore raw
Quoted 1 line · On Thu, 6 Aug 2026 13:36:57 -0400 Willem de Bruijn wrote:

Subject: [PATCH net] selftests: drv-net: so_txtime: only send test traffic to sch_etf

This should probably go to net-next - where it does not apply. I'm not sure if we documented this but selftests should not be treated as fixes, unless they are packaged with a kernel fix. Or you _really_ need them in the current kernel version, but then you have to explain why it matters specifically to you.

Signature · 1 line
pw-bot: cr
author maintainer
#2 lore raw
Quoted 4 lines · Jakub Kicinski
Quoted 1 line · On Thu, 6 Aug 2026 13:36:57 -0400 Willem de Bruijn wrote:

Subject: [PATCH net] selftests: drv-net: so_txtime: only send test traffic to sch_etf

This should probably go to net-next - where it does not apply.

Ack, will address and send to net-next.

Quoted 4 lines

I'm not sure if we documented this but selftests should not be treated as fixes, unless they are packaged with a kernel fix. Or you _really_ need them in the current kernel version, but then you have to explain why it matters specifically to you.

No need from me. Makes total sense, but I was not aware. I do not yet see it explicitly in maintainer-netdev.rst. If you want I can send something like this:

@@ -66,7 +66,8 @@ driven by David Miller, the main network maintainer. There is the
``net`` tree, and the ``net-next`` tree. As you can probably guess from the names, the ``net`` tree is for fixes to existing code already in the mainline tree from Linus, and ``net-next`` is where the new code goes
-for the future release. You can find the trees here:
+for the future release. For selftests, all patches, including fixes, +target net-next. You can find the trees here: