From nobody Sun Sep 27 03:51:37 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010071.outbound.protection.outlook.com [52.101.229.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6AA9E4E36FD; Fri, 18 Sep 2026 11:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730771; cv=fail; b=aratMZ8K+1R67DpbW/xXGV92XioWwCtqiKL2XCQXvFoTiTO5CvqirWLJ5+M3QW0Zm6+JpaBDCr2uZXAoOliCbRCSaqvqpkoOTg++xEr5fdapv0MEdEVHqsi338X0/eULzPd/sZJdhdTVrkLpQcDowY6nwArcpdXt897nq6tAUNM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730771; c=relaxed/simple; bh=63ulAEY5zmqHf/1ysTSILankCcdi8v1QZ4kr4PFCEXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mpLR1juH25KJqg2CeJ88YFbpObI94TBnBY+UsHCI/ULUiRxWW6lcPKCSYUTMSLn4yQcLL7BXtUhUwj6A1aNssK1FY1r6mmForgdPOXwBrzz0ZpE3OwnnG3uyjLhzSgg6o+oLl/VoftrDI/tC1LRsKaOqUmH9vreZG/EokC8CApA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=H6Y62k+S; arc=fail smtp.client-ip=52.101.229.71 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="H6Y62k+S" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=stXy4UG38vgncAqE3v9HvHEYw9YHMgBgCnYSgu10S3Xzvl9slPFA5Q8YlMy0Ml7hl2LeXM6LrKyTBLp3veC0Uok6hdaUg5137tGOTUsRJiwLyNcA2i/ud3hyReYHGuMRCBE/1AgFJtXJ5lrf5j283Zz+e6dh+SKOS+g+KFcv2S4lyPqb+vIydbw/tEM03L9ge9NYWsrk7cS6U4wcj4a4VJx/wotFel47al/P/QmKDNE+Z5js9C9RWfSYnDKpNU2AxUL157xvLol9kjFBe3NdVu83EMZMovXro9OpoHc60Sp35KE3rWAP6T0y76u7kx81WmuISktFTZ5lWY1UDHBn1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JXERstsBxEe4Zlbv2ZU0QcdRtn3gocp8QaUWNSeik5E=; b=ggLJKSP7wY0dyvP0iNdWKuKo4f1jitnahL4Wxsm3WHWWimLk0IpQefhCMq/I5CevtjKYrZ0++K45GrNQnmuFeN1kftPOQZoEhm8L6Koo0rIFyIbWuvNbxBIiBNXJp+nJESSrVI7Csabw5B4f5Vrl/jLNF8brOxWnxp7hEDNRhUl9ORHRgNB2bRdSBYLa+B5mv1kHlBX6MbrG0TUOwCctrFjcSxgDM2VoPPrzsyFmwGAJVh7f2TIQck3drJn1tF3gtR9yP4itwlNtvMrzD+J9rvcUXV64kCEXEHcnFPnQ+ezhOMG2em7vIfAYQIFbbVcbOURNknBrBRTxy0IYsXyPWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=davemloft.net smtp.mailfrom=renesas.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=renesas.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JXERstsBxEe4Zlbv2ZU0QcdRtn3gocp8QaUWNSeik5E=; b=H6Y62k+SDLh9x2eiQvkyCYG6iEEJlLPeuFHkGbW42Xh3xcTvsyca+SeUzJLGosvxytd9CnUNODzSsTJoJ5fLmHQGW0Mnc7IJPei83bqTgfvLXRh6ttmYn6KoElR5LRv/NwWwP1o4v9FC0GO8arEisbYKJXeFURfHHGGkukUxDI0= Received: from OSTPR01CA0023.jpnprd01.prod.outlook.com (2603:1096:604:221::18) by TYCPR01MB8141.jpnprd01.prod.outlook.com (2603:1096:400:102::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.13; Fri, 18 Sep 2026 11:25:58 +0000 Received: from OS3PEPF0000003B.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:221:cafe::3a) by OSTPR01CA0023.outlook.office365.com (2603:1096:604:221::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.13 via Frontend Transport; Fri, 18 Sep 2026 11:25:57 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 8.62.32.50) smtp.mailfrom=renesas.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=renesas.com; Received-SPF: Pass (protection.outlook.com: domain of renesas.com designates 8.62.32.50 as permitted sender) receiver=protection.outlook.com; client-ip=8.62.32.50; helo=ejcrelay004p.adwin.renesas.com; pr=E Received: from ejcrelay004p.adwin.renesas.com (8.62.32.50) by OS3PEPF0000003B.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Fri, 18 Sep 2026 11:25:56 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.165]) by ejcrelay004p.adwin.renesas.com (Postfix) with ESMTP id F033F30001E4; Fri, 18 Sep 2026 20:25:52 +0900 (JST) From: Ovidiu Panait To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, nb@tipi-net.de Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Date: Fri, 18 Sep 2026 11:25:27 +0000 Message-ID: <20260918112529.96039-2-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> References: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PEPF0000003B:EE_|TYCPR01MB8141:EE_ X-MS-Office365-Filtering-Correlation-Id: 660765c9-ecd0-4ba0-51a1-08df15779ba3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|23010399003|7416014|376014|36860700016|1800799024|82310400026|6133799003|11063799006|10067099003|56012099006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: PPcIXNsVW8qvqs+YPtFFBHcNVVHOX7Qco98p3oxD06yJAvpBZe/S/AXcGKy9JX3A1Ardef5gnGN8O0h81Q0AYfsfB6NCMvhWVLwTBgEyCl5psmgewnaSBLKPj4VIRxcmgaQR6NHItxwBPUgz1OSE+ehOMlV/AfIsf3c/4OIyFTqU934lj87YCheYFjf9fvVOVRgyJPs/xI5A7fkfj93B4+XE0OPfHOUp2AvxpzpvA5evStv9PAXeuhzrsZQ98bzSakPCag06w7qOUKvqJtYz8DshYphqOTC/ScExzdo2nVE7nVXAfXWPMw5SiqFbAdbEr3y5GgwoNU48rrOe8G6q5oxO3uYn6qIMh3n/heRKtbv/gj354c5ZuLU9t6PxpzeNT7QXBFDaY5FtygTDHl66egcOBFXAT1wX4bsh+iCyVNCkalnfPaR0i3fNs1J4mlLejwvEPgvI0xVepBWOdCwP3wWLnY4bNbCAQ6tMhQj1tj1ji6JO23vfVnimikkkVO23UyjW6o9Aq0RjPVSW+c4yZB3uDOaDNSResimZaQVNPdtgMdwUby7yICkiybFAVLgEmQEtvvrEq9j0YZPq1AlQIQTf+82s5T/u4UNuH6i6DEVeO49c9xeCPYmzMl8a58b1WT4s+3EsKmE2mMVv/Tt+DcGRpm7suyLlJMuvhmMOh9VQ3DXFDOi1Qir5qBSbID52SlneNpcG6aPjLwjE2HabIg== X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay004p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(23010399003)(7416014)(376014)(36860700016)(1800799024)(82310400026)(6133799003)(11063799006)(10067099003)(56012099006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0t3NNcxJv1FWsd8fu8m7evawLAdvwybjifTGytQc4QIRwN/9VDmDED7+zUpkL6pjBJiHSHczrxiXIJwon5k+7lao2rrQS/SJ2TWGpCPE6JhUBoLE65vijsGAaEMCspv/0SBgGPBqW3E52WkoOPJuu3/+jSyNr4Es05bDZ/PXjRLshExNLqGFpS/ScbUIrTzrtYTDwjF7m9OPO3cxSCT5OF1CrsqbjMBlsTELU36/ZH+r72WDUwZP779s3GVqxPFaY+FG6/HLur9IpfjB8I4P8MOv9SspSs6BpkZ7Z0O1SrWIlj6FL9zAimS9iJBd/1Bu+psfh5QrVwRMVtZWz1uKZ1NyO8YKV4cuNvLz7u9YrMOJH7joq4btXNrfNk/1h/D1k4As0/4H3ZCiQkHIRcYRlHfO4gzSV+ortWHORYXcht3s7f1Ni5/Z9dJOwTvwy04s X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2026 11:25:56.5729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 660765c9-ecd0-4ba0-51a1-08df15779ba3 X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=53d82571-da19-47e4-9cb4-625a166a4a2a;Ip=[8.62.32.50];Helo=[ejcrelay004p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS3PEPF0000003B.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB8141 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Nicolai Buchwitz --- 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_ethto= ol_feat from lib.py import ksft_variants, KsftNamedVariant =20 =20 @@ -125,31 +125,6 @@ def _set_gro_size_restore(cfg, size): comment=3D"gro_ipv4_max_size not applied") =20 =20 -def _set_ethtool_feat(dev, current, feats, host=3DNone): - s2n =3D {True: "on", False: "off"} - - new =3D ["-K", dev] - old =3D ["-K", dev] - no_change =3D True - for name, state in feats.items(): - new +=3D [name, s2n[state]] - old +=3D [name, s2n[current[name]["active"]]] - - if current[name]["active"] !=3D state: - no_change =3D False - if current[name]["fixed"]: - raise KsftXfailEx(f"Device does not support {name}") - if no_change: - return - - eth_cmd =3D ethtool(" ".join(new), host=3Dhost) - defer(ethtool, " ".join(old), host=3Dhost) - - # 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") =20 - _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 =3D=3D "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}) =20 # 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 =3D ethtool(f"-k {cfg.ifname}", json=3DTrue)[0] =20 - _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 =3D=3D "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=3DFalse) =20 - _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}) =20 try: # Disable TSO for local tests cfg.require_nsim() # will raise KsftXfailEx if not running on nsim =20 - _set_ethtool_feat(cfg.remote_ifname, cfg.remote_feat, - {"tcp-segmentation-offload": False}, - host=3Dcfg.remote) + set_ethtool_feat(cfg.remote_ifname, cfg.remote_feat, + {"tcp-segmentation-offload": False}, + host=3Dcfg.remote) except KsftXfailEx: pass =20 diff --git a/tools/testing/selftests/drivers/net/hw/lib/py/__init__.py b/to= ols/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_no= ne + 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 =20 @@ -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", "GenerateTraff= ic", - "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"] =20 from .env import NetDrvEnv, NetDrvEpEnv, NetDrvContEnv + from .feat import set_ethtool_feat from .load import GenerateTraffic, Iperf3Runner from .remote import Remote =20 __all__ +=3D ["NetDrvEnv", "NetDrvEpEnv", "NetDrvContEnv", "GenerateTr= affic", - "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/tes= ting/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=3DNone): + """Set ethtool features with defer to restore original state.""" + s2n =3D {True: "on", False: "off"} + + new =3D ["-K", dev] + old =3D ["-K", dev] + no_change =3D True + for name, state in feats.items(): + new +=3D [name, s2n[state]] + old +=3D [name, s2n[current[name]["active"]]] + + if current[name]["active"] !=3D state: + no_change =3D False + if current[name]["fixed"]: + raise KsftXfailEx(f"Device does not support {name}") + if no_change: + return + + eth_cmd =3D ethtool(" ".join(new), host=3Dhost) + defer(ethtool, " ".join(old), host=3Dhost) + + # If ethtool printed something kernel must have modified some features + if eth_cmd.stdout: + ksft_pr(eth_cmd) --=20 2.34.1 From nobody Sun Sep 27 03:51:37 2026 Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010021.outbound.protection.outlook.com [52.101.228.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DF664E2F0B; Fri, 18 Sep 2026 11:26:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.228.21 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730771; cv=fail; b=loEfsNh3xGyofcfiHJCsO7dFdIg95ft/1W/c1K9F0AY18auWVF2PLEiqfX7sIKCHIJIprmZ7U1rS0iyLuLL7t+pRmvwMZiWlduBvjpFPSSylIOJDBhjEsPGp0YFB0eoNncZqD4jQBIL4qMDmpk6jAR2Hk3gT/DHbgwJI4gaZ6rw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730771; c=relaxed/simple; bh=cUGgf8LPypAr1XMUlkyUdri2rq8kvZ0aEoRZhlOg5hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=vBsGFDNnH38BJoWCrMYFQvoV0Y71XbHPGgdLVTGq/DEiuelCjYx0UffFlh987eOGF4jhKIO8160Vanc01tRvXErM5VZnlpdcYk9joCY4ZUYhOezTFfimetlmA3h0AXQODmXsRIQkVNcMQOGUgCFsxLD6O7lfZ2cplfi1NofezaQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=KQM+OCix; arc=fail smtp.client-ip=52.101.228.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="KQM+OCix" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bXgvao8hd5sEQMzfJcF8BP9wP+TVuKnFxt0SgavbO6xx8oFQpwcF6EZbYMag+eu4kL6vXbXJInvTKm+e5VErPXpkiLVKGZXSn0mLN2TTRKogI4DEBLDk9MJLJNdGD/DSNfl2g9BuLrBZ1Gmf64tAg1lWiW2gdA/N8XvJEZLB6Wxz48+Alz/cgThNaRXeCetUtHx1TMe6+oxhtlY3AGzVxvk0Par5hhwkPBeHyFYstWkbSrQ7cd3mYphmaVp3gkm6CQ/6cd42hEm8SP6GhOwso5rPo/NYzqwAinvK7tJMs5CR3YgQABMAt40LBPeQasSTPxThjzWOYe2XlYxBgDtwaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EVV1PSaHZAImjWliS9DQHZ415jYj8QX1DFqDPMHLqLg=; b=J5W2zTloddV0/OHjU+0MIJ+7ibadYS9WTmWRqrXrU3yZ8mSvdcrUmz23b5brMW8T45arhj4wsiuR9YB2ERyezIEk9Bv/zZs2vJm7gMIoT8itcFJszz97PBtm9HHfy8/Gn8aRlThdESNKvXe0R0L0G4046yo2z7x5GoM5LzW5znvkni0JA5NP+BwQgpap5ySRDSxkUYLQHWwP8u/m4dUeabHgw9jzTz6XixqFMsFO2m0oN+idMg//qXg26maAWAkKP+YY7jafLD4FR3EGoc77OOb6An8KJqN6bjMGNLrz4AV82o9Dpfv4XkaeRITwckStaV001Q7p6+Bb2kqq2Fz6UQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=davemloft.net smtp.mailfrom=renesas.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=renesas.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EVV1PSaHZAImjWliS9DQHZ415jYj8QX1DFqDPMHLqLg=; b=KQM+OCix1eUIpAAl7IiZERcNOemgW3eBHyNwD0Mz9i3bGs++FuNC3fyGBU7Mp6dfCXPO6Fv78EEVci3a+saNB8Hx4u3ICSHpfgBmuZ9kVqxtSBI6six56aCo9sqULmItriKOD2R5aS/nd4RsGvvqKoBd7eCGrh+B70N+BtPXrf8= Received: from OSTPR01CA0016.jpnprd01.prod.outlook.com (2603:1096:604:221::8) by OS9PR01MB15824.jpnprd01.prod.outlook.com (2603:1096:604:3d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.13; Fri, 18 Sep 2026 11:26:00 +0000 Received: from OS3PEPF0000003B.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:221:cafe::52) by OSTPR01CA0016.outlook.office365.com (2603:1096:604:221::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.13 via Frontend Transport; Fri, 18 Sep 2026 11:26:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 8.62.32.50) smtp.mailfrom=renesas.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=renesas.com; Received-SPF: Pass (protection.outlook.com: domain of renesas.com designates 8.62.32.50 as permitted sender) receiver=protection.outlook.com; client-ip=8.62.32.50; helo=ejcrelay004p.adwin.renesas.com; pr=E Received: from ejcrelay004p.adwin.renesas.com (8.62.32.50) by OS3PEPF0000003B.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Fri, 18 Sep 2026 11:26:00 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.165]) by ejcrelay004p.adwin.renesas.com (Postfix) with ESMTP id 090AE300027D; Fri, 18 Sep 2026 20:25:56 +0900 (JST) From: Ovidiu Panait To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, nb@tipi-net.de Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Date: Fri, 18 Sep 2026 11:25:28 +0000 Message-ID: <20260918112529.96039-3-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> References: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PEPF0000003B:EE_|OS9PR01MB15824:EE_ X-MS-Office365-Filtering-Correlation-Id: 01620f7c-4bcf-421b-4c52-08df15779e0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|1800799024|82310400026|23010399003|36860700016|18002099003|22082099003|6133799003|10067099003|11063799006|56012099006; X-Microsoft-Antispam-Message-Info: TvBi8YD6vRfhWwE9WR//DBF/i/AdD37gzLeI1Fl0vMHTNfnrrFENZuSx2K4yqmwzJ4GbqpQfuvtG4WibufFIHHjvTWFRRAwYZgEy0P0ogfwxVQdACn8BOXlYoh5cmGNv2fASsRXOEdCOF7IGuHFDKUcjYLTtGb5AMsConTY9F6nYd8sbOTDbd8Xv+icPQofk4W795m3miq4nHkkxRtv+Jig7bPiOtE0RKIo6xRi6xLIGOmTJEvrzzAerXqKdEft0GDSHw5fo9ZngFVOPYojIidBtPoa2tArI1tiOPuKuJiwPjB+bGpYovfnU5zqmo4SYvz4MEqpVN6MsB2uR4i6TPWoJI+8aBQvsRf+8y25GZpZeQkuCD93WkXJhpOA4GW/XWw2g/nSFXnT/54tChRkvNkDEGurLM+Ehoj3TM5Jp346f3X2cgrZB7q7OShVIIljXiPgXNW+doRPEmmaMxaHpdnAI39sadPCQ5Y6Vw+q9CNbQaBdT8iKaJIyAs7TAQ4Zza5vDwNfRZK3Jp0YbHIhDKQ7PxzdatDf1Mn1PaNT+GWl+rVUPbZS0m/oE4ch5TXe11C2hO0yOiQpug1oq+QsDDVAc7DN3eLWrl1tw22YmURaX8Bk/qBtouQsweswsakYfOBuFwKfKgRBsg6wceUBb6SP52THVLADZvrwLSBXA9iUX/K4jkDf6xNget2/Fo3cg8DLBe1hpsimJhF2ybkfytg== X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay004p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(7416014)(1800799024)(82310400026)(23010399003)(36860700016)(18002099003)(22082099003)(6133799003)(10067099003)(11063799006)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0FpafoDs4x8qkrhswX7m6OYLcdWaDQXXPiMHGedSPlLiGWdF3uaIXSneod1WcGCBUnH7EA9Z5gUI52uYJLE0ghJtw8B3WoW/Ofc9zcfXKDbazFf0Ikt0yFV9Igx/zHP5nOsGIQt9GQavYqUzjJvRIZNBFpQ4fVlcUkVEreVp3QsSJ4OND0lU2Lqk+/AvlchWZYyOlmjEi5yR1yriy+n2qHwvrCnKkIuNxgM+BU6T4lgJYyeZwtg9VM8Rpfhv2Qz5GsOdPasoSboYzPjduRnMP7hqF/jZzqA8bG/lWyyGu9Q6f+HugimGd3Zg6J+cgeNqQXdPiXANe9X47Jy4NGNFTDXvSy3sMII5gpqS9gkA7JgJelTqe8mJC+qENGA+FLAdx/WJl/nRMFmRqTnaWoj25HRI8J+WO67bYRxJ9RtTpFYx1xspPfG6DrCpVZWzR7En X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2026 11:26:00.6106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01620f7c-4bcf-421b-4c52-08df15779e0b X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=53d82571-da19-47e4-9cb4-625a166a4a2a;Ip=[8.62.32.50];Helo=[ejcrelay004p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS3PEPF0000003B.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS9PR01MB15824 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Nicolai Buchwitz --- 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=3DFalse) =20 # 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/tes= ting/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 =20 =20 -def set_ethtool_feat(dev, current, feats, host=3DNone): +def set_ethtool_feat(dev, current, feats, host=3DNone, check=3DTrue): """Set ethtool features with defer to restore original state.""" s2n =3D {True: "on", False: "off"} =20 @@ -33,3 +33,11 @@ def set_ethtool_feat(dev, current, feats, host=3DNone): # If ethtool printed something kernel must have modified some features if eth_cmd.stdout: ksft_pr(eth_cmd) + + if not check: + return + + current =3D ethtool(f"-k {dev}", json=3DTrue, host=3Dhost)[0] + for name, state in feats.items(): + if current[name]["active"] !=3D state: + raise KsftXfailEx(f"{name} was not set to {s2n[state]}") --=20 2.34.1 From nobody Sun Sep 27 03:51:37 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010067.outbound.protection.outlook.com [52.101.229.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB73A4E3EF6; Fri, 18 Sep 2026 11:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730779; cv=fail; b=IalsBmw9jEhJRvhP6u2AYzLLXFuuecX0nZTjt2UW2Qx4aKiPYLJ/7I9BKkzLlMEBw/awRO04dVUFGsQyG1MBntsz/Eth/IcLeXhYxVMX+s2+PERdug79F7cVQCe8+wEuvQrEJz3uQXjFPXIA3yqaOI5YBcfOygqilZF/Fbgc6c8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789730779; c=relaxed/simple; bh=lKseDOBRDqZ9NgiovEm4kMGQmXu3xhXAWzNveKj0SS8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h53DdP4xxAkquYpXutcWN0mO5YBcrE5CaYk5erU8uGxT4jy9eLNw6FnhJwKkG9HE2CUPtfNc0URFbn8F6xsmHnL/Z3K82t9MCKx3ZI4BE4n6c9msGA/1/8iIVDUBwop2v4cnIxwSuw6z9+/d2L2xcIHNcD6jaWG30zle6JWHkf4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=Mhf0md/e; arc=fail smtp.client-ip=52.101.229.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="Mhf0md/e" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fyj1vU6sTt3waQm3BkIEsLctu2Qic3y6XgOuDuru9zgq8pB0GYN/JF7OVj9TPsNdl8gPBjTj4rVYPHkzlBfaUIs3BoKq2Gh5o/pnNYGlqX4lnz3jcZlGPer/3Jizt+4NPbop/PSszB7n2rNAPzyjC6RM9AiUY/o7kFbBIZNiIrO7qQQlccE/OOGiZA4dww6/VsrUTHOAKzIJDtrJBm+ZaEZu0RpfTKvbgUFKJPYnPdbYt5U4ldA7Q9ToEIAh4NB0U+ZkiqWiEnjAJaynwkdB//VHMJJ3P5rJ/TQSFGC/oKiKhmWWn7KczeZmU497kFyos2ShaOh8HPn+YKtEOpnFeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=F+FwqjY7AYLHTgWr3uEmetH+SF/TY2YRUVQfnWf7jyo=; b=DSlqxk+mDws9ce7VXbqci4NKC/usHNWFU55yjDzJoLkCkiRohGoxMQkTAr6sPheb1q+VgvfVm8D44sHoL7qv3rjzGEKWWQBOSctxJRfIXh/46dN+HQnHDdqwsB6ISN2wjihI0hNtdkZqzDQ85hDHOpRd4PpEatX+kMShfYuwzuWrs3lkV4fpwrIz+d/simqQM3c5KUm7y1/eXnJVh/MmkLW1CvL1esbzhyZsKdUTy7hSuASBIF7u2kDcmURnBhFdxVs1HtnmSjYx3c4Yn1BlTUpwvU6vtHOPWIo8lQxyPYLo5U4N6LgfSs9bId1jnSshCvbwnfZZBM9TQGBLFPVmmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=davemloft.net smtp.mailfrom=renesas.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=renesas.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=F+FwqjY7AYLHTgWr3uEmetH+SF/TY2YRUVQfnWf7jyo=; b=Mhf0md/eHNEaygylFTDlnZ+QsYbGC0cBnrRZxpQJdSJavGx4hmabCzAYzGmGK5DhRImRtsrug9N7O/m3slknrFua4279OQWqfyLqiZFFpLglznWzpXkk0WMtk6lYB218tEX9EdHz+wPWZ2fuFsfVLrvAOUdtYKNS4+TkAkJgZt4= Received: from OSTPR01CA0067.jpnprd01.prod.outlook.com (2603:1096:604:21a::14) by TYYPR01MB6827.jpnprd01.prod.outlook.com (2603:1096:400:d2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.428.13; Fri, 18 Sep 2026 11:26:05 +0000 Received: from OS3PEPF0000003E.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:21a:cafe::9d) by OSTPR01CA0067.outlook.office365.com (2603:1096:604:21a::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.13 via Frontend Transport; Fri, 18 Sep 2026 11:26:05 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 8.62.32.50) smtp.mailfrom=renesas.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=renesas.com; Received-SPF: Pass (protection.outlook.com: domain of renesas.com designates 8.62.32.50 as permitted sender) receiver=protection.outlook.com; client-ip=8.62.32.50; helo=ejcrelay004p.adwin.renesas.com; pr=E Received: from ejcrelay004p.adwin.renesas.com (8.62.32.50) by OS3PEPF0000003E.mail.protection.outlook.com (10.167.240.7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Fri, 18 Sep 2026 11:26:04 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.165]) by ejcrelay004p.adwin.renesas.com (Postfix) with ESMTP id 1211E300027D; Fri, 18 Sep 2026 20:26:00 +0900 (JST) From: Ovidiu Panait To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, nb@tipi-net.de Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Date: Fri, 18 Sep 2026 11:25:29 +0000 Message-ID: <20260918112529.96039-4-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> References: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PEPF0000003E:EE_|TYYPR01MB6827:EE_ X-MS-Office365-Filtering-Correlation-Id: e72cb495-f897-429b-e426-08df1577a07d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700016|23010399003|376014|7416014|10067099003|3023799007|6133799003|11063799006|18002099003|22082099003|56012099006; X-Microsoft-Antispam-Message-Info: 2HbPRB+KsSh/U8qzvkKa+4ka6TtxMuJiVHBYq5TDe3dueb/3VLQqXiRnKeRpAenS0PycBjkKvymVutb6hISVat3XVi6AOMm3YaLjcaDFdo8qQF5NWQW9kj4VIuBaGPh1uQQxMO5a3zF+A2aLKZBp7fTSpyfs9EFjB7iv2N6lIHBIoGs/EgklGJLQfmXBU5MhmOADjFDN36ZO990wZoQ7zFZBQhDIZhJfeUekUb2cmNnAZWYTy0do3IXzQ4JdQ5Z/70giHP2oNVSfGOSam8RTz8u1n7IKE2fdB8XjHG0RlwdmcmcVOVaMwSc3QOxN1nUdGmWaQafyi3WKbiGRj40vxR9TU7036hv6ZPEL27ssIbyVnPhr6bHmIEUAyr0Fcxb2qdxOXk96vFNXLcyOqPoxxGnPTPn8OGlGV07KR4CuFa1tMLJV5jA1O32wyUQKlZkKhEi450gCRaecX3Zkm0NWwt4kOF8A+FVVu6Q3PdReV3/JnWOWma8UJf0ZFO1fATJQBhqhszYcmTH10vyJg4Kvlmpsn3QMRblQiySJjDTMVXUsE64eFh3M8VIa3gaQRTA7Oe/66sVVLZUZtKurju4WWweWAeWv4VW0du7G/m2JW4Kztul47fbJT3s5NK5o3Qglj6ejcvmBreFFw+EhCX+JJ2tithTHn4KyJkrP3c7EcFtBJQ+FjUfVe8JAfBX3yUrb8/1hcGjy/+ABlyr1vFd20Q== X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay004p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(36860700016)(23010399003)(376014)(7416014)(10067099003)(3023799007)(6133799003)(11063799006)(18002099003)(22082099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cewKlApdSQlW3KCzgWTBqfUu2m/bhih1ykpMH4u+eNoMrUm6o7pqDbDmvGCM81v/KVh7T5Dq4ULondx2DwChWXmWjrbHMVJc4hI93xrPSObqQO0Aq2ubyYP89yyuzrw3I3beUoYDSbsuLdxK7VsgzYhgXs2Y4C6XKloPjBqSFZcxlBtk0VMRxRTs8b5bIJs/nvW8eDKxJX7ObFLNxK+eVpnfDxbv0jff4RweOxmUw/0KG1cZicBveOoL2VjlS+nsvWYuxX3VqmClKWwXH6aul4m0oojRRAmtJqvUeE779OxEe7p3xX6feZmhKwl0cPC0BqM7YST4HOReqYcxcgPI+ItDHEUjMPc8Q/g50z1Z3xePtJDpJyAEzQQ31FmcUyVkvquLJFkwXcj6nZED4VGcoD2uBC5yWjZcy7bwDafVY3MdIM4F2r2O0T3bnodUtCoh X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2026 11:26:04.7162 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e72cb495-f897-429b-e426-08df1577a07d X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=53d82571-da19-47e4-9cb4-625a166a4a2a;Ip=[8.62.32.50];Helo=[ejcrelay004p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS3PEPF0000003E.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYYPR01MB6827 Content-Type: text/plain; charset="utf-8" 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=3Dend0 LOCAL_V4=3D172.16.0.2 REMOTE_V4=3D172.16.0.3 \ REMOTE_TYPE=3Dssh REMOTE_ARGS=3Droot@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 Reviewed-by: Nicolai Buchwitz --- 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/testin= g/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 =3D \ 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=3Dy CONFIG_SYNC_FILE=3Dy CONFIG_UDMABUF=3Dy CONFIG_USER_NS=3Dy +CONFIG_VLAN_8021Q=3Dm CONFIG_VXLAN=3Dy CONFIG_XFRM_USER=3Dy 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 =3D f"vlout{os.getpid()}" +INNER_DEV =3D f"vlin{os.getpid()}" + +OUTER_VID =3D 100 +INNER_VID =3D 200 + +LOCAL_IP =3D os.environ.get("VLAN_LOCAL_V4", "198.51.100.1") +REMOTE_IP =3D os.environ.get("VLAN_REMOTE_V4", "198.51.100.2") + + +def _vlan_add(base, name, proto, vid, host=3DNone): + """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=3Dhost) + defer(ip, f"link del {name}", host=3Dhost) + ip(f"link set {name} up", host=3Dhost) + + +def _vlan_setup(base, addr, outer_proto, inner_proto, host=3DNone): + """Create VLAN interfaces on base and set an IP on the innermost one."= "" + + _vlan_add(base, OUTER_DEV, outer_proto, OUTER_VID, host=3Dhost) + if inner_proto: + _vlan_add(OUTER_DEV, INNER_DEV, inner_proto, INNER_VID, host=3Dhos= t) + + dev =3D INNER_DEV if inner_proto else OUTER_DEV + ip(f"addr add {addr}/24 dev {dev}", host=3Dhost) + + +def _setup(cfg, outer_proto, inner_proto, hw_strip): + """Configure VLAN stripping and create the VLAN interfaces.""" + + names =3D ["rx-vlan-offload"] + if outer_proto =3D=3D "802.1ad": + names.append("rx-vlan-stag-hw-parse") + + feat =3D ethtool(f"-k {cfg.ifname}", json=3DTrue)[0] + feats =3D {} + 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] =3D 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=3Dcfg.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=3D[test], args=3D(cfg, )) + ksft_exit() + + +if __name__ =3D=3D "__main__": + main() --=20 2.34.1