* [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test
@ 2026-09-18 11:25 Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Ovidiu Panait @ 2026-09-18 11:25 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb
Cc: linux-kernel, netdev, linux-kselftest, Ovidiu Panait
This series adds a selftest that pings over 802.1q, 802.1ad and
QinQ VLAN interfaces with RX VLAN stripping offloads enabled
and disabled.
This series contains only the selftest part of [1].
[1] https://lore.kernel.org/all/20260908164309.59282-1-ovidiu.panait.rb@renesas.com/
v2 changes:
- Added a new commit to check if the ethtool changes were actually applied.
- Allowed for the VLAN IPs to be set from the environment, to avoid
possible clashes.
- Added Nicolai's Rb tag.
Ovidiu Panait (3):
selftests: drv-net: Move _set_ethtool_feat() into lib
selftests: drv-net: Check the features set by set_ethtool_feat()
selftests: drv-net: Add VLAN test
.../testing/selftests/drivers/net/gro_lib.py | 66 +++------
.../testing/selftests/drivers/net/hw/Makefile | 1 +
tools/testing/selftests/drivers/net/hw/config | 1 +
.../drivers/net/hw/lib/py/__init__.py | 3 +-
.../testing/selftests/drivers/net/hw/vlan.py | 127 ++++++++++++++++++
.../selftests/drivers/net/lib/py/__init__.py | 3 +-
.../selftests/drivers/net/lib/py/feat.py | 43 ++++++
7 files changed, 197 insertions(+), 47 deletions(-)
create mode 100755 tools/testing/selftests/drivers/net/hw/vlan.py
create mode 100644 tools/testing/selftests/drivers/net/lib/py/feat.py
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
@ 2026-09-18 11:25 ` Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Ovidiu Panait
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Ovidiu Panait @ 2026-09-18 11:25 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb
Cc: linux-kernel, netdev, linux-kselftest, Ovidiu Panait
Move the _set_ethtool_feat() helper from gro_lib.py into lib, so that it
can be reused by the VLAN test added in the next commit. Drop the leading
underscore, now that the helper is exported.
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
---
v2:
- Added Nicolai's "Reviewed-by" tag.
.../testing/selftests/drivers/net/gro_lib.py | 65 ++++++-------------
.../drivers/net/hw/lib/py/__init__.py | 3 +-
.../selftests/drivers/net/lib/py/__init__.py | 3 +-
.../selftests/drivers/net/lib/py/feat.py | 35 ++++++++++
4 files changed, 59 insertions(+), 47 deletions(-)
create mode 100644 tools/testing/selftests/drivers/net/lib/py/feat.py
diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
index abecf60baa53..7856ebdd49d3 100644
--- a/tools/testing/selftests/drivers/net/gro_lib.py
+++ b/tools/testing/selftests/drivers/net/gro_lib.py
@@ -52,7 +52,7 @@ import re
from lib.py import ksft_run, ksft_exit, ksft_pr, ksft_eq
from lib.py import NetDrvEpEnv, KsftFailEx, KsftSkipEx, KsftXfailEx
from lib.py import NetdevFamily, EthtoolFamily
-from lib.py import bkg, cmd, ctl_file_write, defer, ethtool, ip
+from lib.py import bkg, cmd, ctl_file_write, defer, ethtool, ip, set_ethtool_feat
from lib.py import ksft_variants, KsftNamedVariant
@@ -125,31 +125,6 @@ def _set_gro_size_restore(cfg, size):
comment="gro_ipv4_max_size not applied")
-def _set_ethtool_feat(dev, current, feats, host=None):
- s2n = {True: "on", False: "off"}
-
- new = ["-K", dev]
- old = ["-K", dev]
- no_change = True
- for name, state in feats.items():
- new += [name, s2n[state]]
- old += [name, s2n[current[name]["active"]]]
-
- if current[name]["active"] != state:
- no_change = False
- if current[name]["fixed"]:
- raise KsftXfailEx(f"Device does not support {name}")
- if no_change:
- return
-
- eth_cmd = ethtool(" ".join(new), host=host)
- defer(ethtool, " ".join(old), host=host)
-
- # If ethtool printed something kernel must have modified some features
- if eth_cmd.stdout:
- ksft_pr(eth_cmd)
-
-
def _get_queue_stats(cfg, queue_id):
"""Get stats for a specific Rx queue."""
cfg.wait_hw_stats_settle()
@@ -280,15 +255,15 @@ def _setup(cfg, mode, test_name):
ctl_file_write(flush_path, "200000")
ctl_file_write(irq_path, "10")
- _set_ethtool_feat(cfg.ifname, cfg.feat,
- {"generic-receive-offload": True,
- "rx-gro-hw": False,
- "large-receive-offload": False})
+ set_ethtool_feat(cfg.ifname, cfg.feat,
+ {"generic-receive-offload": True,
+ "rx-gro-hw": False,
+ "large-receive-offload": False})
elif mode == "hw":
- _set_ethtool_feat(cfg.ifname, cfg.feat,
- {"generic-receive-offload": False,
- "rx-gro-hw": True,
- "large-receive-offload": False})
+ set_ethtool_feat(cfg.ifname, cfg.feat,
+ {"generic-receive-offload": False,
+ "rx-gro-hw": True,
+ "large-receive-offload": False})
# Some NICs treat HW GRO as a GRO sub-feature so disabling GRO
# will also clear HW GRO. Use a hack of installing XDP generic
@@ -303,27 +278,27 @@ def _setup(cfg, mode, test_name):
# Attaching XDP may change features, fetch the latest state
feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
- _set_ethtool_feat(cfg.ifname, feat,
- {"generic-receive-offload": True,
- "rx-gro-hw": True,
- "large-receive-offload": False})
+ set_ethtool_feat(cfg.ifname, feat,
+ {"generic-receive-offload": True,
+ "rx-gro-hw": True,
+ "large-receive-offload": False})
elif mode == "lro":
# netdevsim advertises LRO for feature inheritance testing with
# bonding/team tests but it doesn't actually perform the offload
cfg.require_nsim(nsim_test=False)
- _set_ethtool_feat(cfg.ifname, cfg.feat,
- {"generic-receive-offload": False,
- "rx-gro-hw": False,
- "large-receive-offload": True})
+ set_ethtool_feat(cfg.ifname, cfg.feat,
+ {"generic-receive-offload": False,
+ "rx-gro-hw": False,
+ "large-receive-offload": True})
try:
# Disable TSO for local tests
cfg.require_nsim() # will raise KsftXfailEx if not running on nsim
- _set_ethtool_feat(cfg.remote_ifname, cfg.remote_feat,
- {"tcp-segmentation-offload": False},
- host=cfg.remote)
+ set_ethtool_feat(cfg.remote_ifname, cfg.remote_feat,
+ {"tcp-segmentation-offload": False},
+ host=cfg.remote)
except KsftXfailEx:
pass
diff --git a/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py b/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
index 81e1d1865cd5..4077f5f1a1be 100644
--- a/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
+++ b/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py
@@ -31,6 +31,7 @@ try:
ksft_setup, ksft_variants, KsftNamedVariant
from net.lib.py import ksft_eq, ksft_ge, ksft_in, ksft_is, ksft_lt, \
ksft_ne, ksft_not_in, ksft_raises, ksft_true, ksft_gt, ksft_not_none
+ from drivers.net.lib.py import set_ethtool_feat
from drivers.net.lib.py import GenerateTraffic, Remote, Iperf3Runner
from drivers.net.lib.py import NetDrvEnv, NetDrvEpEnv, NetDrvContEnv
@@ -49,7 +50,7 @@ try:
"ksft_ne", "ksft_not_in", "ksft_raises", "ksft_true", "ksft_gt",
"ksft_not_none", "ksft_not_none",
"NetDrvEnv", "NetDrvEpEnv", "NetDrvContEnv", "GenerateTraffic",
- "Remote", "Iperf3Runner"]
+ "Remote", "Iperf3Runner", "set_ethtool_feat"]
except ModuleNotFoundError as e:
print("Failed importing `net` library from kernel sources")
print(str(e))
diff --git a/tools/testing/selftests/drivers/net/lib/py/__init__.py b/tools/testing/selftests/drivers/net/lib/py/__init__.py
index 591b1e6c7eea..40ccdcf0c378 100644
--- a/tools/testing/selftests/drivers/net/lib/py/__init__.py
+++ b/tools/testing/selftests/drivers/net/lib/py/__init__.py
@@ -48,11 +48,12 @@ try:
"ksft_not_none", "ksft_not_none"]
from .env import NetDrvEnv, NetDrvEpEnv, NetDrvContEnv
+ from .feat import set_ethtool_feat
from .load import GenerateTraffic, Iperf3Runner
from .remote import Remote
__all__ += ["NetDrvEnv", "NetDrvEpEnv", "NetDrvContEnv", "GenerateTraffic",
- "Remote", "Iperf3Runner"]
+ "Remote", "Iperf3Runner", "set_ethtool_feat"]
except ModuleNotFoundError as e:
print("Failed importing `net` library from kernel sources")
print(str(e))
diff --git a/tools/testing/selftests/drivers/net/lib/py/feat.py b/tools/testing/selftests/drivers/net/lib/py/feat.py
new file mode 100644
index 000000000000..b94a24214e59
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/lib/py/feat.py
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0
+
+"""
+Netdev feature helper utilities for kernel selftests.
+
+Provides common operations for changing device features via ethtool.
+"""
+
+from . import KsftXfailEx, defer, ethtool, ksft_pr
+
+
+def set_ethtool_feat(dev, current, feats, host=None):
+ """Set ethtool features with defer to restore original state."""
+ s2n = {True: "on", False: "off"}
+
+ new = ["-K", dev]
+ old = ["-K", dev]
+ no_change = True
+ for name, state in feats.items():
+ new += [name, s2n[state]]
+ old += [name, s2n[current[name]["active"]]]
+
+ if current[name]["active"] != state:
+ no_change = False
+ if current[name]["fixed"]:
+ raise KsftXfailEx(f"Device does not support {name}")
+ if no_change:
+ return
+
+ eth_cmd = ethtool(" ".join(new), host=host)
+ defer(ethtool, " ".join(old), host=host)
+
+ # If ethtool printed something kernel must have modified some features
+ if eth_cmd.stdout:
+ ksft_pr(eth_cmd)
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat()
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
@ 2026-09-18 11:25 ` Ovidiu Panait
2026-09-18 11:51 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-24 15:30 ` [PATCH net-next v2 0/3] " patchwork-bot+netdevbpf
3 siblings, 2 replies; 11+ messages in thread
From: Ovidiu Panait @ 2026-09-18 11:25 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb
Cc: linux-kernel, netdev, linux-kselftest, Ovidiu Panait
Read back the features after running ethtool -K to check if they were
actually applied. The drivers might refuse to set a feature silently and
the test could run with a different configuration than the requested one.
Add a 'check' parameter to skip this, as the GRO "hw" mode handles the
case where HW GRO is cleared by the driver.
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
---
v2: New patch.
tools/testing/selftests/drivers/net/gro_lib.py | 3 ++-
tools/testing/selftests/drivers/net/lib/py/feat.py | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
index 7856ebdd49d3..875a715b2ae1 100644
--- a/tools/testing/selftests/drivers/net/gro_lib.py
+++ b/tools/testing/selftests/drivers/net/gro_lib.py
@@ -263,7 +263,8 @@ def _setup(cfg, mode, test_name):
set_ethtool_feat(cfg.ifname, cfg.feat,
{"generic-receive-offload": False,
"rx-gro-hw": True,
- "large-receive-offload": False})
+ "large-receive-offload": False},
+ check=False)
# Some NICs treat HW GRO as a GRO sub-feature so disabling GRO
# will also clear HW GRO. Use a hack of installing XDP generic
diff --git a/tools/testing/selftests/drivers/net/lib/py/feat.py b/tools/testing/selftests/drivers/net/lib/py/feat.py
index b94a24214e59..f0630844f023 100644
--- a/tools/testing/selftests/drivers/net/lib/py/feat.py
+++ b/tools/testing/selftests/drivers/net/lib/py/feat.py
@@ -9,7 +9,7 @@ Provides common operations for changing device features via ethtool.
from . import KsftXfailEx, defer, ethtool, ksft_pr
-def set_ethtool_feat(dev, current, feats, host=None):
+def set_ethtool_feat(dev, current, feats, host=None, check=True):
"""Set ethtool features with defer to restore original state."""
s2n = {True: "on", False: "off"}
@@ -33,3 +33,11 @@ def set_ethtool_feat(dev, current, feats, host=None):
# If ethtool printed something kernel must have modified some features
if eth_cmd.stdout:
ksft_pr(eth_cmd)
+
+ if not check:
+ return
+
+ current = ethtool(f"-k {dev}", json=True, host=host)[0]
+ for name, state in feats.items():
+ if current[name]["active"] != state:
+ raise KsftXfailEx(f"{name} was not set to {s2n[state]}")
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Ovidiu Panait
@ 2026-09-18 11:25 ` Ovidiu Panait
2026-09-18 12:04 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-24 15:30 ` [PATCH net-next v2 0/3] " patchwork-bot+netdevbpf
3 siblings, 2 replies; 11+ messages in thread
From: Ovidiu Panait @ 2026-09-18 11:25 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb
Cc: linux-kernel, netdev, linux-kselftest, Ovidiu Panait
Add a test that validates ping traffic over VLAN interfaces. It aims
to catch drivers which mishandle hardware VLAN tag stripping, in
particular QinQ.
Three VLAN configurations are covered, each with hardware RX VLAN
stripping enabled and disabled (via the rx-vlan-offload and
rx-vlan-stag-hw-parse features):
- a single 802.1q VLAN interface
- a single 802.1ad VLAN interface
- an 802.1q VLAN stacked on top of an 802.1ad interface
The "hw" test variants enable the RX VLAN stripping features supported
by the device (rx-vlan-offload and rx-vlan-stag-hw-parse), the "sw"
test variants disable all of them. A test is xfailed if the requested
configuration is not possible.
VLAN insertion offloads are not tested for now.
NETIF=end0 LOCAL_V4=172.16.0.2 REMOTE_V4=172.16.0.3 \
REMOTE_TYPE=ssh REMOTE_ARGS=root@172.16.0.3 \
run_kselftest.sh -t drivers/net/hw:vlan.py
TAP version 13
1..1
# timeout set to 0
# selftests: drivers/net/hw: vlan.py
# # Interface: end0, driver: st_gmac
# TAP version 13
# 1..6
# ok 1 vlan.test.8021q_hw
# ok 2 vlan.test.8021q_sw
# ok 3 vlan.test.8021ad_hw
# ok 4 vlan.test.8021ad_sw
# ok 5 vlan.test.qinq_hw
# ok 6 vlan.test.qinq_sw
# # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0
ok 1 selftests: drivers/net/hw: vlan.py
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
---
v2:
- Allowed the VLAN test IPs to be set from the environment, to avoid
possible clashes.
.../testing/selftests/drivers/net/hw/Makefile | 1 +
tools/testing/selftests/drivers/net/hw/config | 1 +
.../testing/selftests/drivers/net/hw/vlan.py | 127 ++++++++++++++++++
3 files changed, 129 insertions(+)
create mode 100755 tools/testing/selftests/drivers/net/hw/vlan.py
diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile
index 8aebdc6feb17..18ce235a77f8 100644
--- a/tools/testing/selftests/drivers/net/hw/Makefile
+++ b/tools/testing/selftests/drivers/net/hw/Makefile
@@ -50,6 +50,7 @@ TEST_PROGS = \
tso.py \
userns_devmem.py \
uso.py \
+ vlan.py \
xdp_metadata.py \
xsk_reconfig.py \
#
diff --git a/tools/testing/selftests/drivers/net/hw/config b/tools/testing/selftests/drivers/net/hw/config
index d89a9ba17655..c6c2b64bb712 100644
--- a/tools/testing/selftests/drivers/net/hw/config
+++ b/tools/testing/selftests/drivers/net/hw/config
@@ -24,5 +24,6 @@ CONFIG_NET_SCH_INGRESS=y
CONFIG_SYNC_FILE=y
CONFIG_UDMABUF=y
CONFIG_USER_NS=y
+CONFIG_VLAN_8021Q=m
CONFIG_VXLAN=y
CONFIG_XFRM_USER=y
diff --git a/tools/testing/selftests/drivers/net/hw/vlan.py b/tools/testing/selftests/drivers/net/hw/vlan.py
new file mode 100755
index 000000000000..00c90b930f67
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/hw/vlan.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python3
+# SPDX-License-Identifier: GPL-2.0
+
+"""
+VLAN tests.
+
+Validates that ping traffic is sent and received correctly over 802.1q
+and 802.1ad VLAN interfaces, with hardware RX VLAN stripping enabled and
+disabled on the local interface.
+
+The "hw" test variants enable the RX VLAN stripping features supported by
+the device, the "sw" test variants disable all of them. A test is xfailed
+if the requested configuration is not possible.
+
+Test cases:
+ - 8021q_hw: Traffic over a single 802.1q VLAN, HW stripping on
+ - 8021q_sw: Traffic over a single 802.1q VLAN, HW stripping off
+ - 8021ad_hw: Traffic over a single 802.1ad VLAN, HW stripping on
+ - 8021ad_sw: Traffic over a single 802.1ad VLAN, HW stripping off
+ - qinq_hw: Traffic over an 802.1q VLAN stacked on an 802.1ad VLAN,
+ HW stripping on
+ - qinq_sw: Traffic over an 802.1q VLAN stacked on an 802.1ad VLAN,
+ HW stripping off
+"""
+
+import os
+
+from lib.py import (
+ KsftNamedVariant,
+ KsftXfailEx,
+ NetDrvEpEnv,
+ cmd,
+ defer,
+ ethtool,
+ ip,
+ ksft_exit,
+ ksft_run,
+ ksft_variants,
+ set_ethtool_feat,
+)
+
+OUTER_DEV = f"vlout{os.getpid()}"
+INNER_DEV = f"vlin{os.getpid()}"
+
+OUTER_VID = 100
+INNER_VID = 200
+
+LOCAL_IP = os.environ.get("VLAN_LOCAL_V4", "198.51.100.1")
+REMOTE_IP = os.environ.get("VLAN_REMOTE_V4", "198.51.100.2")
+
+
+def _vlan_add(base, name, proto, vid, host=None):
+ """Create a VLAN device on top of base and bring it up."""
+
+ ip(f"link add link {base} name {name} type vlan proto {proto} id {vid}",
+ host=host)
+ defer(ip, f"link del {name}", host=host)
+ ip(f"link set {name} up", host=host)
+
+
+def _vlan_setup(base, addr, outer_proto, inner_proto, host=None):
+ """Create VLAN interfaces on base and set an IP on the innermost one."""
+
+ _vlan_add(base, OUTER_DEV, outer_proto, OUTER_VID, host=host)
+ if inner_proto:
+ _vlan_add(OUTER_DEV, INNER_DEV, inner_proto, INNER_VID, host=host)
+
+ dev = INNER_DEV if inner_proto else OUTER_DEV
+ ip(f"addr add {addr}/24 dev {dev}", host=host)
+
+
+def _setup(cfg, outer_proto, inner_proto, hw_strip):
+ """Configure VLAN stripping and create the VLAN interfaces."""
+
+ names = ["rx-vlan-offload"]
+ if outer_proto == "802.1ad":
+ names.append("rx-vlan-stag-hw-parse")
+
+ feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
+ feats = {}
+ for name in names:
+ # hw: skip the features the device does not support
+ # sw: request all of them off
+ if hw_strip and feat[name]["fixed"] and not feat[name]["active"]:
+ continue
+ feats[name] = hw_strip
+
+ if hw_strip and not feats:
+ raise KsftXfailEx("Device does not support RX VLAN stripping")
+
+ set_ethtool_feat(cfg.ifname, feat, feats)
+
+ _vlan_setup(cfg.ifname, LOCAL_IP, outer_proto, inner_proto)
+ _vlan_setup(cfg.remote_ifname, REMOTE_IP, outer_proto, inner_proto,
+ host=cfg.remote)
+
+
+def _vlan_variants():
+ """Generator that yields the VLAN protocols and the stripping mode."""
+
+ yield KsftNamedVariant("8021q_hw", "802.1q", None, True)
+ yield KsftNamedVariant("8021q_sw", "802.1q", None, False)
+ yield KsftNamedVariant("8021ad_hw", "802.1ad", None, True)
+ yield KsftNamedVariant("8021ad_sw", "802.1ad", None, False)
+ yield KsftNamedVariant("qinq_hw", "802.1ad", "802.1q", True)
+ yield KsftNamedVariant("qinq_sw", "802.1ad", "802.1q", False)
+
+
+@ksft_variants(_vlan_variants())
+def test(cfg, outer_proto, inner_proto, hw_strip):
+ """Run a single VLAN test"""
+
+ _setup(cfg, outer_proto, inner_proto, hw_strip)
+
+ cmd(f"ping -c 1 -W 5 {REMOTE_IP}")
+
+
+def main() -> None:
+ """ Ksft boiler plate main """
+
+ with NetDrvEpEnv(__file__) as cfg:
+ ksft_run(cases=[test], args=(cfg, ))
+ ksft_exit()
+
+
+if __name__ == "__main__":
+ main()
--
2.34.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat()
2026-09-18 11:25 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Ovidiu Panait
@ 2026-09-18 11:51 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
1 sibling, 0 replies; 11+ messages in thread
From: Nicolai Buchwitz @ 2026-09-18 11:51 UTC (permalink / raw)
To: Ovidiu Panait
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah,
linux-kernel, netdev, linux-kselftest
Hi Ovidiu
On 18.9.2026 13:25, Ovidiu Panait wrote:
> Read back the features after running ethtool -K to check if they were
> actually applied. The drivers might refuse to set a feature silently
> and
> the test could run with a different configuration than the requested
> one.
>
> Add a 'check' parameter to skip this, as the GRO "hw" mode handles the
> case where HW GRO is cleared by the driver.
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
> ---
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
@ 2026-09-18 12:04 ` Nicolai Buchwitz
2026-09-18 22:12 ` Jakub Kicinski
2026-09-22 12:01 ` netdev-bot+sashiko
1 sibling, 1 reply; 11+ messages in thread
From: Nicolai Buchwitz @ 2026-09-18 12:04 UTC (permalink / raw)
To: Ovidiu Panait
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah,
linux-kernel, netdev, linux-kselftest
Hi Ovidiu
On 18.9.2026 13:25, Ovidiu Panait wrote:
> Add a test that validates ping traffic over VLAN interfaces. It aims
> to catch drivers which mishandle hardware VLAN tag stripping, in
> particular QinQ.
>
> Three VLAN configurations are covered, each with hardware RX VLAN
> stripping enabled and disabled (via the rx-vlan-offload and
> rx-vlan-stag-hw-parse features):
> - a single 802.1q VLAN interface
> - a single 802.1ad VLAN interface
> - an 802.1q VLAN stacked on top of an 802.1ad interface
>
> The "hw" test variants enable the RX VLAN stripping features supported
> by the device (rx-vlan-offload and rx-vlan-stag-hw-parse), the "sw"
> test variants disable all of them. A test is xfailed if the requested
> configuration is not possible.
>
> VLAN insertion offloads are not tested for now.
>
> NETIF=end0 LOCAL_V4=172.16.0.2 REMOTE_V4=172.16.0.3 \
> REMOTE_TYPE=ssh REMOTE_ARGS=root@172.16.0.3 \
> run_kselftest.sh -t drivers/net/hw:vlan.py
> TAP version 13
> 1..1
> # timeout set to 0
> # selftests: drivers/net/hw: vlan.py
> # # Interface: end0, driver: st_gmac
> # TAP version 13
> # 1..6
> # ok 1 vlan.test.8021q_hw
> # ok 2 vlan.test.8021q_sw
> # ok 3 vlan.test.8021ad_hw
> # ok 4 vlan.test.8021ad_sw
> # ok 5 vlan.test.qinq_hw
> # ok 6 vlan.test.qinq_sw
> # # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0
> ok 1 selftests: drivers/net/hw: vlan.py
> # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
> ---
> [...]
> +LOCAL_IP = os.environ.get("VLAN_LOCAL_V4", "198.51.100.1")
> +REMOTE_IP = os.environ.get("VLAN_REMOTE_V4", "198.51.100.2")
LOCAL_IP = "198.51.100.1"
REMOTE_IP = "198.51.100.2"
IMHO it would be better to use cfg.env, so net.config is honoured.
Either way the vars (eg. VLAN_LOCAL_V4 / VLAN_REMOVE_V4) should be
mentioned in README.rst? Right now it is only stated in the v2 changelog
in this commit.
> +
> +
> +def _vlan_add(base, name, proto, vid, host=None):
> + """Create a VLAN device on top of base and bring it up."""
> +
> + ip(f"link add link {base} name {name} type vlan proto {proto} id
> {vid}",
> + host=host)
> + defer(ip, f"link del {name}", host=host)
> + ip(f"link set {name} up", host=host)
> +
> +
> +def _vlan_setup(base, addr, outer_proto, inner_proto, host=None):
> + """Create VLAN interfaces on base and set an IP on the innermost
> one."""
> +
> + _vlan_add(base, OUTER_DEV, outer_proto, OUTER_VID, host=host)
> + if inner_proto:
> + _vlan_add(OUTER_DEV, INNER_DEV, inner_proto, INNER_VID,
> host=host)
> +
> + dev = INNER_DEV if inner_proto else OUTER_DEV
> + ip(f"addr add {addr}/24 dev {dev}", host=host)
> +
> +
> +def _setup(cfg, outer_proto, inner_proto, hw_strip):
> + """Configure VLAN stripping and create the VLAN interfaces."""
> +
> + names = ["rx-vlan-offload"]
> + if outer_proto == "802.1ad":
> + names.append("rx-vlan-stag-hw-parse")
> +
> + feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> + feats = {}
> + for name in names:
> + # hw: skip the features the device does not support
> + # sw: request all of them off
> + if hw_strip and feat[name]["fixed"] and not
> feat[name]["active"]:
> + continue
> + feats[name] = hw_strip
> +
> + if hw_strip and not feats:
> + raise KsftXfailEx("Device does not support RX VLAN stripping")
> +
> + set_ethtool_feat(cfg.ifname, feat, feats)
> +
> + _vlan_setup(cfg.ifname, LOCAL_IP, outer_proto, inner_proto)
> + _vlan_setup(cfg.remote_ifname, REMOTE_IP, outer_proto,
> inner_proto,
LOCAL_IP -> cfg.local_ip
REMOTE_IP -> cfg.remote_ip
> + host=cfg.remote)
> +
> +
> +def _vlan_variants():
> + """Generator that yields the VLAN protocols and the stripping
> mode."""
> +
> + yield KsftNamedVariant("8021q_hw", "802.1q", None, True)
> + yield KsftNamedVariant("8021q_sw", "802.1q", None, False)
> + yield KsftNamedVariant("8021ad_hw", "802.1ad", None, True)
> + yield KsftNamedVariant("8021ad_sw", "802.1ad", None, False)
> + yield KsftNamedVariant("qinq_hw", "802.1ad", "802.1q", True)
> + yield KsftNamedVariant("qinq_sw", "802.1ad", "802.1q", False)
> +
> +
> +@ksft_variants(_vlan_variants())
> +def test(cfg, outer_proto, inner_proto, hw_strip):
> + """Run a single VLAN test"""
> +
> + _setup(cfg, outer_proto, inner_proto, hw_strip)
> +
> + cmd(f"ping -c 1 -W 5 {REMOTE_IP}")
REMOTE_IP -> cfg.remote_ip
> +
> +
> +def main() -> None:
> + """ Ksft boiler plate main """
> +
> + with NetDrvEpEnv(__file__) as cfg:
cfg.local_ip = cfg.env.get("VLAN_LOCAL_V4", LOCAL_IP)
cfg.remote_ip = cfg.env.get("VLAN_REMOTE_V4", REMOTE_IP)
> + ksft_run(cases=[test], args=(cfg, ))
> + ksft_exit()
> +
> +
> +if __name__ == "__main__":
> + main()
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test
2026-09-18 12:04 ` Nicolai Buchwitz
@ 2026-09-18 22:12 ` Jakub Kicinski
2026-09-19 21:43 ` Nicolai Buchwitz
0 siblings, 1 reply; 11+ messages in thread
From: Jakub Kicinski @ 2026-09-18 22:12 UTC (permalink / raw)
To: Nicolai Buchwitz
Cc: Ovidiu Panait, andrew+netdev, davem, edumazet, pabeni, shuah,
linux-kernel, netdev, linux-kselftest
On Fri, 18 Sep 2026 14:04:13 +0200 Nicolai Buchwitz wrote:
> > +LOCAL_IP = os.environ.get("VLAN_LOCAL_V4", "198.51.100.1")
> > +REMOTE_IP = os.environ.get("VLAN_REMOTE_V4", "198.51.100.2")
>
> LOCAL_IP = "198.51.100.1"
> REMOTE_IP = "198.51.100.2"
LOCAL_IP / REMOTE_IP are in the default network segment (vlan 0)
Here we need some "unused" IP subnet that we can assign without
conflicts. Getting it from the config would indeed be good, but
since this is the first use perhaps we should defer until it actually
bothers someone?
Or am I missing something?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test
2026-09-18 22:12 ` Jakub Kicinski
@ 2026-09-19 21:43 ` Nicolai Buchwitz
0 siblings, 0 replies; 11+ messages in thread
From: Nicolai Buchwitz @ 2026-09-19 21:43 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Ovidiu Panait, andrew+netdev, davem, edumazet, pabeni, shuah,
linux-kernel, netdev, linux-kselftest
On 19.9.2026 00:12, Jakub Kicinski wrote:
> On Fri, 18 Sep 2026 14:04:13 +0200 Nicolai Buchwitz wrote:
>> > +LOCAL_IP = os.environ.get("VLAN_LOCAL_V4", "198.51.100.1")
>> > +REMOTE_IP = os.environ.get("VLAN_REMOTE_V4", "198.51.100.2")
>>
>> LOCAL_IP = "198.51.100.1"
>> REMOTE_IP = "198.51.100.2"
>
> LOCAL_IP / REMOTE_IP are in the default network segment (vlan 0)
> Here we need some "unused" IP subnet that we can assign without
> conflicts. Getting it from the config would indeed be good, but
> since this is the first use perhaps we should defer until it actually
> bothers someone?
Fine with me. Having the the selftest in place is probably more useful
than re-spinning for sole config issues. Let's fix this once someone
needs it.
> [...]
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Thanks,
Nicolai
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat()
2026-09-18 11:25 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Ovidiu Panait
2026-09-18 11:51 ` Nicolai Buchwitz
@ 2026-09-22 12:01 ` netdev-bot+sashiko
1 sibling, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-09-22 12:01 UTC (permalink / raw)
To: ovidiu.panait.rb
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb,
linux-kernel, netdev, linux-kselftest
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] In gro_lib._setup() the "hw" mode passes check=False to
set_ethtool_feat(), which disables the newly added read-back for the…
- [Medium] The read-back verification added to the shared helper
set_ethtool_feat() (drivers/net/lib/py/feat.py:40-43) is not mirrored…
--
selftests: drv-net: Check the features set by set_ethtool_feat()
This adds a read-back of the device features after running ethtool -K in
set_ethtool_feat(), raising KsftXfailEx when the requested state was not
applied. A new check parameter allows callers to skip the verification, and
the GRO "hw" setup mode in gro_lib.py uses it.
> diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
> index 7856ebdd49d3..875a715b2ae1 100644
> --- a/tools/testing/selftests/drivers/net/gro_lib.py
> +++ b/tools/testing/selftests/drivers/net/gro_lib.py
> @@ -263,7 +263,8 @@ def _setup(cfg, mode, test_name):
> set_ethtool_feat(cfg.ifname, cfg.feat,
> {"generic-receive-offload": False,
> "rx-gro-hw": True,
> - "large-receive-offload": False})
> + "large-receive-offload": False},
> + check=False)
[Severity: Medium]
The commit message justifies skipping the check only for rx-gro-hw ("the
GRO "hw" mode handles the case where HW GRO is cleared by the driver"), but
check=False disables verification for all three features in this request.
The follow-up read-back in _setup() only looks at rx-gro-hw:
feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
if not feat["rx-gro-hw"]["active"]:
ksft_pr("Driver clears HW GRO and SW GRO is cleared, using generic XDP workaround")
so generic-receive-offload is never verified in this path. If a driver
accepts rx-gro-hw but leaves SW GRO active, the XDP generic workaround
branch is not taken (it only runs when rx-gro-hw is inactive) and the
gro_hw.py tests then run with SW GRO enabled, which can coalesce in
software and pass even when the hardware offload does nothing. Isn't that
the same "test could run with a different configuration than the requested
one" case the patch is meant to catch?
Note that for the third feature the kernel does enforce the requested
state, netdev_fix_features() drops LRO when HW GRO is requested:
if ((features & NETIF_F_GRO_HW) && (features & NETIF_F_LRO)) {
netdev_dbg(dev, "Dropping LRO feature since HW-GRO is requested.\n");
features &= ~NETIF_F_LRO;
but there is no equivalent rule tying generic GRO to HW GRO. Would a
per-feature exemption (skip verification of rx-gro-hw only) instead of the
all-or-nothing boolean work here?
> diff --git a/tools/testing/selftests/drivers/net/lib/py/feat.py b/tools/testing/selftests/drivers/net/lib/py/feat.py
> index b94a24214e59..f0630844f023 100644
> --- a/tools/testing/selftests/drivers/net/lib/py/feat.py
> +++ b/tools/testing/selftests/drivers/net/lib/py/feat.py
> @@ -33,3 +33,11 @@ def set_ethtool_feat(dev, current, feats, host=None):
> # If ethtool printed something kernel must have modified some features
> if eth_cmd.stdout:
> ksft_pr(eth_cmd)
> +
> + if not check:
> + return
> +
> + current = ethtool(f"-k {dev}", json=True, host=host)[0]
> + for name, state in feats.items():
> + if current[name]["active"] != state:
> + raise KsftXfailEx(f"{name} was not set to {s2n[state]}")
[Severity: Medium]
Should the private copy of this helper in
tools/testing/selftests/drivers/net/hw/gro_stats.py be converted as well?
After this series the tree carries two copies of the same ethtool -K helper
with different semantics. _set_ethtool_feat() in gro_stats.py still ends
with no read-back:
eth_cmd = ethtool(" ".join(new))
defer(ethtool, " ".join(old))
# If ethtool printed something kernel must have modified some features
if eth_cmd.stdout:
ksft_pr(eth_cmd)
and it raises KsftSkipEx for fixed features where the shared helper raises
KsftXfailEx.
_setup_hw_gro() in gro_stats.py repeats the gro_lib.py "hw" logic including
the XDP generic workaround, and its final request is unverified:
_set_ethtool_feat(cfg, feat,
{"generic-receive-offload": True,
"rx-gro-hw": True,
"large-receive-offload": False})
so the HW GRO qstats assertions that follow can run with rx-gro-hw
inactive, and the resulting delta mismatch gives no hint about the real
cause. drivers/net/hw/lib/py/__init__.py already imports and re-exports
the shared set_ethtool_feat, so is there a reason the consolidation done in
the earlier "selftests: drv-net: Move _set_ethtool_feat() into lib" patch
stops short of this file?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260918112529.96039-1-ovidiu.panait.rb%40renesas.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 12:04 ` Nicolai Buchwitz
@ 2026-09-22 12:01 ` netdev-bot+sashiko
1 sibling, 0 replies; 11+ messages in thread
From: netdev-bot+sashiko @ 2026-09-22 12:01 UTC (permalink / raw)
To: ovidiu.panait.rb
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb,
linux-kernel, netdev, linux-kselftest
Thank you for your contribution! Sashiko AI review found 5 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] New configuration knobs VLAN_LOCAL_V4 / VLAN_REMOTE_V4 in
tools/testing/selftests/drivers/net/hw/vlan.py (lines 48-49) are read…
- [Medium] _setup() reprograms RX VLAN stripping via set_ethtool_feat()
(tools/testing/selftests/drivers/net/hw/vlan.py:91) and then…
- [Low] Concern (assessed as a false positive, retained for policy
combination): in _setup()…
- [Low] The only traffic validation in test()
(tools/testing/selftests/drivers/net/hw/vlan.py:115) is 'ping -c 1 -W…
- [Low] Documentation/implementation mismatch: the commit message and the
module docstring…
--
selftests: drv-net: Add VLAN test
This adds drivers/net/hw/vlan.py, which builds 802.1q, 802.1ad and QinQ
VLAN stacks on the device under test and its remote endpoint, then pings
across them with hardware RX VLAN stripping enabled and disabled. Six
variants are registered, and the test is added to TEST_PROGS along with
CONFIG_VLAN_8021Q in the hw config.
No Link: tags present in the commit header.
> diff --git a/tools/testing/selftests/drivers/net/hw/vlan.py b/tools/testing/selftests/drivers/net/hw/vlan.py
> new file mode 100755
> index 000000000000..00c90b930f67
> --- /dev/null
> +++ b/tools/testing/selftests/drivers/net/hw/vlan.py
> @@ -0,0 +1,127 @@
[ ... ]
> +OUTER_DEV = f"vlout{os.getpid()}"
> +INNER_DEV = f"vlin{os.getpid()}"
> +
> +OUTER_VID = 100
> +INNER_VID = 200
> +
> +LOCAL_IP = os.environ.get("VLAN_LOCAL_V4", "198.51.100.1")
> +REMOTE_IP = os.environ.get("VLAN_REMOTE_V4", "198.51.100.2")
[Severity: Medium]
Are VLAN_LOCAL_V4 and VLAN_REMOTE_V4 reachable when the harness is
configured through net.config?
These two lookups run at module import time against os.environ, but
NetDrvEnvBase._load_env_file() in drivers/net/lib/py/env.py merges
net.config entries into a copy and exposes them as cfg.env only:
env = os.environ.copy()
...
env[pair[0]] = pair[1]
return ksft_setup(env)
os.environ is never updated, so a VLAN_LOCAL_V4/VLAN_REMOTE_V4 line in
drivers/net/hw/net.config is silently ignored and the hard-coded
198.51.100.1/198.51.100.2 defaults are used instead. Would reading these
from cfg.env inside the test body work better, given that
drivers/net/README.rst states "The variables can be set in the
environment or by creating a net.config file in the same directory as
this README file"?
The two new variables are also missing from the "Variables" section of
drivers/net/README.rst, which lists NETIF, LOCAL_V4/V6, REMOTE_V4/V6,
LOCAL_PREFIX_V6, REMOTE_TYPE and REMOTE_ARGS. Should they be documented
there as well?
[ ... ]
> +def _setup(cfg, outer_proto, inner_proto, hw_strip):
> + """Configure VLAN stripping and create the VLAN interfaces."""
> +
> + names = ["rx-vlan-offload"]
> + if outer_proto == "802.1ad":
> + names.append("rx-vlan-stag-hw-parse")
[Severity: Low]
The commit message and the module docstring say the "sw" test variants
"disable all of them", referring to rx-vlan-offload and
rx-vlan-stag-hw-parse. Here rx-vlan-stag-hw-parse is only appended when
outer_proto is "802.1ad", and the same list is used for both directions.
For the 8021q_sw variant on a device where rx-vlan-stag-hw-parse is
active, the feature is left as-is, so the "all HW RX stripping off"
baseline the docstring promises is not established. Should the wording be
narrowed, or should names include every supported RX stripping feature
when hw_strip is False?
> +
> + feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> + feats = {}
> + for name in names:
> + # hw: skip the features the device does not support
> + # sw: request all of them off
> + if hw_strip and feat[name]["fixed"] and not feat[name]["active"]:
> + continue
> + feats[name] = hw_strip
> +
> + if hw_strip and not feats:
> + raise KsftXfailEx("Device does not support RX VLAN stripping")
[Severity: Low]
This isn't a bug, but on a device where rx-vlan-offload is changeable and
rx-vlan-stag-hw-parse is fixed-off, 8021ad_hw and qinq_hw run with only
C-tag stripping enabled and report "ok", with nothing in the output
saying which features were actually applied.
The skipping itself matches what the docstring describes, and genuinely
impossible requests still xfail through set_ethtool_feat() in
drivers/net/lib/py/feat.py:
if current[name]["fixed"]:
raise KsftXfailEx(f"Device does not support {name}")
Would it be worth printing the resulting feats dict via ksft_pr() so the
reported pass records which stripping path was exercised?
> +
> + set_ethtool_feat(cfg.ifname, feat, feats)
> +
> + _vlan_setup(cfg.ifname, LOCAL_IP, outer_proto, inner_proto)
> + _vlan_setup(cfg.remote_ifname, REMOTE_IP, outer_proto, inner_proto,
> + host=cfg.remote)
[Severity: Medium]
Can toggling rx-vlan-offload here make the following ping flaky on
hardware that re-initialises the datapath?
Some drivers implement ndo_set_features for NETIF_F_HW_VLAN_CTAG_RX with
a full down/up. e1000_set_features() in
drivers/net/ethernet/intel/e1000e/netdev.c keeps CTAG_RX in its changed
mask:
if (!(changed & (NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_RXCSUM | NETIF_F_RXHASH | NETIF_F_RXFCS |
NETIF_F_RXALL)))
return 0;
...
if (netif_running(netdev))
e1000e_reinit_locked(adapter);
so the call chain is set_ethtool_feat() -> e1000_set_features() ->
e1000e_reinit_locked() -> e1000e_down() (carrier off) + e1000e_up() with
PHY re-autoneg. _setup() then creates the VLANs and test() sends a single
echo request without waiting for carrier, so ARP plus the 5 s reply
window can expire inside the re-link. The deferred feature restore
between variants has the same exposure for the next variant.
Would a carrier wait (as drivers/net/lib/py/env.py does on
/sys/class/net/<dev>/carrier) or a retry loop like the one in
drivers/net/hw/rss_ctx.py be appropriate here?
> +
> +
> +def _vlan_variants():
[ ... ]
> +@ksft_variants(_vlan_variants())
> +def test(cfg, outer_proto, inner_proto, hw_strip):
> + """Run a single VLAN test"""
> +
> + _setup(cfg, outer_proto, inner_proto, hw_strip)
> +
> + cmd(f"ping -c 1 -W 5 {REMOTE_IP}")
[Severity: Low]
Is route selection guaranteed to send this ping out of the VLAN device?
_vlan_setup() installs the address with "addr add {addr}/24 dev {dev}" on
the innermost VLAN, and this ping is not bound to an interface. If
cfg.ifname or any other interface on the DUT already carries an address
inside 198.51.100.0/24, two connected routes for the same prefix exist
and the pre-existing one can win, in which case the ICMP exchange leaves
untagged and the test still reports "ok" without exercising VLAN
tagging or stripping at all.
The reverse case is that installing 198.51.100.1/24 on the VLAN hijacks
the prefix used by a REMOTE_TYPE=ssh control channel living in it.
drivers/net/macsec.py does the same VLAN-on-top-of-an-offload-device
dance with the same addresses and binds explicitly:
cmd(f"ping -I {vlan_name} -c 1 -W 5 {remote_ip}")
Would adding -I for the innermost VLAN device here be preferable?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260918112529.96039-1-ovidiu.panait.rb%40renesas.com
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
` (2 preceding siblings ...)
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
@ 2026-09-24 15:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-24 15:30 UTC (permalink / raw)
To: Ovidiu Panait
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, nb,
linux-kernel, netdev, linux-kselftest
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 18 Sep 2026 11:25:26 +0000 you wrote:
> This series adds a selftest that pings over 802.1q, 802.1ad and
> QinQ VLAN interfaces with RX VLAN stripping offloads enabled
> and disabled.
>
> This series contains only the selftest part of [1].
>
> [1] https://lore.kernel.org/all/20260908164309.59282-1-ovidiu.panait.rb@renesas.com/
>
> [...]
Here is the summary with links:
- [net-next,v2,1/3] selftests: drv-net: Move _set_ethtool_feat() into lib
https://git.kernel.org/netdev/net-next/c/d3630df401a8
- [net-next,v2,2/3] selftests: drv-net: Check the features set by set_ethtool_feat()
https://git.kernel.org/netdev/net-next/c/a57ddd899004
- [net-next,v2,3/3] selftests: drv-net: Add VLAN test
https://git.kernel.org/netdev/net-next/c/efc7f4646c1d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-09-24 15:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Ovidiu Panait
2026-09-18 11:51 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 12:04 ` Nicolai Buchwitz
2026-09-18 22:12 ` Jakub Kicinski
2026-09-19 21:43 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-24 15:30 ` [PATCH net-next v2 0/3] " patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®