From nobody Fri Sep 25 20:48:39 2026 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011024.outbound.protection.outlook.com [52.101.125.24]) (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 08CD858495C; Tue, 8 Sep 2026 16:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.24 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885833; cv=fail; b=SaooXBoObGNAx1BdG7YKtNQM69OLiA2AokeEKxvjVyUcxm/kG0UL9wZvDOmuq+Y8VNg01RXJWpngVV/IWCDIIyO6OYkXwfzg2AoR6dd5p5VZ1WEE00PdVal6QVLwUmi3JBgWqDEehSc8HtFkTVLGbFCd6eKKgK4By6OZPfDZtTc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885833; c=relaxed/simple; bh=2DUR8jEJOa0J9Y0sP3MP9mucpDsOQMeNYOenPUD74Fk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VIEZD/MVO0bP11FuLNgMU2bVGAfuKURzbhN9NKGLY6UYvhIaAwi861P/YMZUX4nq28/KYAkGYhRTPxnJNADTMG7u6JEp5cf4QcmS9ExuqOuOQy+RSozMfh+VAMiHH46Of/KkSrx2F9nhFrp+wc9MLTfwDSXE6MqeTTWTAhOpTKI= 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=FHGPD+gX; arc=fail smtp.client-ip=52.101.125.24 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="FHGPD+gX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cxZEwUXgLNXrQEdqsgj+1RtR56U6dKND7Lf9tl45sc/Rlh9xtvPSWNg6IRh9c7YvJWJULnNjQ0R/S62XwA8KyyC7FL78vv3BCle7RAKUK+BkjjK3m35n++XLWU9UXLKSeaO3hh+4WNfdV/btKh/syj2t1vfbq+WmRNLfsC2a+3GDDePDlOJN2/KTcV4kwhtAQaKekGT34ryZ4gf9ebRcQagH3TTZ3geRc0n/OPYCbbyUX0BJmHbKtwwGPxF9G93zSUiymDs4LBdsgIm5PGBSy+Pbw+ZsfBR9B8PqB5h+1zxCmPzOa9/SWVbDahIldJEnV3WEn9U3zy4Y1HT0r2ZXyw== 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=2aSXtDt9EoSHV9oqRxmAEQ6s/2hllLlhJ9iHM9G143k=; b=AuW12w6I44TD/JNUX5UQ/hYR4l4pVSPg8NRnMWnW/NEcbi7tvtpB+Xea5Lfma+5++cRPwt6F0Onjj6/vHeyIA2zyZThp6S+igt1p1AEmNls1pVPts6c9MdwJa4ofxEUZLeQfi7ZtB4XMOm8PJ33jiO41sWlnLhknuI6cFWeqSAtFrV1PCJm1FWhVViMRuKc/+qDIef/VI+wETl4fGEyHdnnSpFPIN/FXsE6wv3xo0IW5JP9DEG2vPhkdWzIFA5gPvYoiZ+GTnK+ny3YslrToFhBIOhB4zxXfthul9d4lQs/NJoric4dmBWcJMO7BGCU3Zjl7rdbwHsEYYhKz5NRJBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=2aSXtDt9EoSHV9oqRxmAEQ6s/2hllLlhJ9iHM9G143k=; b=FHGPD+gXZvKo/bI9Ixct/WbPKXOdwQ8kaj/KwsHQoCHQ55OZWVM4gf1y8PXJAaOwS88aEUHo3IAsq1XOvEK4ZmNZWjUmYJ5M601kH/D3+dNZaOC+HSnF3Ki0sJbgMIPOHXF8T+efI5s35NB6b009s4zow5xjqhEGNsiaq+lUTVo= Received: from TYCP301CA0061.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::6) by TYWPR01MB9308.jpnprd01.prod.outlook.com (2603:1096:400:1a4::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.382.15; Tue, 8 Sep 2026 16:43:45 +0000 Received: from TY2PEPF00005622.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:7d:cafe::9) by TYCP301CA0061.outlook.office365.com (2603:1096:405:7d::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.7 via Frontend Transport; Tue, 8 Sep 2026 16:43:45 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by TY2PEPF00005622.mail.protection.outlook.com (10.167.240.53) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:43:44 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id C2FBB300044D; Wed, 9 Sep 2026 01:43:38 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 1/7] net: stmmac: Remove VLAN perfect matching dead code Date: Tue, 8 Sep 2026 16:43:03 +0000 Message-ID: <20260908164309.59282-2-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: TY2PEPF00005622:EE_|TYWPR01MB9308:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d5dc80c-cd37-4225-c245-08df0dc858dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|23010399003|82310400026|1800799024|36860700016|921020|10067099003|56012099006|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: 5PUiuMIwCRA5qjqurf4YmfD8Qvy7aRMt3kXhgqk4Xpj7zCl2MYFuXoJlyDi9mZ+7Bv9+VzYCgfN1KVUA/R9c10u3KVHk4EZnrrBAV0Xv2PJ9EI7hZGQ+gwrr957RviyVOoQi0yuEDRlIM6hVZveOHhiCNqRXb+FkRmnkiuBmzUn0LYACbpR95KxrOxjx3bbBMvdzlwnJzwaLkocTRF19uyuhsXb5i3VAbpV21yAuku5FpSc7QPh7ycMxvzhKrr913JLDaSFGIoy5rW1JNR+1FFf2TvQxGZXDqnaTyZ43nrHHTIelo9ZCvAGpUAfy/1XXcp1U0cdgFDNuqeMnXXpJ7TjwNpYnet5KrA3iJKO9AwVrlWqGMCHNbJK5bod+HtNGwJYBRW3wsMHjF8eudeYf6KAsLVCLhz5koL6nJ3tnNgPAVQfGzZEq7jm545lET8/K8fU9RNmacBgdVU2cCQ9sXsQ3aPnCcKsQMtH+HfQg+0x2fo6h01iHg6K4sz/ljEiPYTX+df3V0iK5uOF/gOXmC+4YYOXjWFYXjstelE7Pe9gzfTYLfGcHfoJTp6l6tQctiulb9binGSTwGcbJGKEp0sg8WaeCrWul3teInjfevo5+dNaDPm/FemNVJ50XhrucD+b8ntUgwS5bJuTvaq56EOkqAkactoz/vMMhwxDG5vpWX8DuNKL6x6CezyNWt9wQGWH0OOWcxKFyJTliHbGEmAtUn1snADhm93lYv2Nu6Wsg9u/po7jQnEDgjc/FAy/K X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(7416014)(376014)(23010399003)(82310400026)(1800799024)(36860700016)(921020)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cgtqEOKBJwMku86xiT+OPv1uUhj4k+6WZzBRLjzMcSTcFVIBTMt6HhS9+VTftxRq0WcX/sVlm8epxniIzNZO/bbQ/AoIdx53UK/bB1kcCrhdEQe22iluz38dy0KaHCIkLkW7PI0WPO4hsM7lsRRLTGPUVvWLa2+OoWO6NQgPU4uzsm90k/arjYyhwUdJaVm94IKqy66vtgtmNpy6Qacfr2xgNQPyFZdsxlARTrvUiRRYK9h8miVJztQIlXlHVWclcFzcId7hp9Aw9COYHfl3qL4U4uEbRnwQigLLkRsuENeAEy6jbWOI1QIY5bGqbY+5tdQ0dYnlSWgD6QdqNttiZXIF866Hm3NtpVOTNhmc7HZflYwrFTHMBGUHizKcuUIXoP/37evGB74QTH01fqaSI/z6N+CQiS0B2vmD4wAS1EM6pumWMA7MHUTo+hpw2mtc X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:43:44.4890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d5dc80c-cd37-4225-c245-08df0dc858dc 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: TY2PEPF00005622.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB9308 Content-Type: text/plain; charset="utf-8" stmmac_vlan_update() falls back to "perfect matching" when the VLAN hash filter is unavailable (!priv->dma_cap.vlhash). This fallback has been unreachable in normal operation since its introduction in commit c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available") because the NETIF_F_HW_VLAN_{CTAG,STAG}_FILTER features are advertised only when priv->dma_cap.vlhash is true. The fallback is also duplicating the code in vlan_add_hw_rx_fltr(), which is always available since stmmac_get_num_vlan() returns at least 1. Therefore, remove it. Fixes: c7ab0b8088d7 ("net: stmmac: Fallback to VLAN Perfect filtering if HA= SH is not available") Signed-off-by: Ovidiu Panait Reviewed-by: Maxime Chevallier --- v4 changes: None. v3 changes: - Added "Reviewed-by" tag from Maxime. v2 changes: None. drivers/net/ethernet/stmicro/stmmac/hwif.h | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +----- .../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 41 +------------------ 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ether= net/stmicro/stmmac/hwif.h index 04dafec021b4..6f26dbf95ce1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -633,7 +633,7 @@ struct stmmac_est_ops { struct stmmac_vlan_ops { /* VLAN */ void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash, - u16 perfect_match, bool is_double); + bool is_double); void (*enable_vlan)(struct mac_device_info *hw, u32 type); void (*rx_hw_vlan)(struct mac_device_info *hw, struct dma_desc *rx_desc, struct sk_buff *skb); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 24656b35350b..24d64cce1d87 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6816,29 +6816,18 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le) static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double) { u32 crc, hash =3D 0; - u16 pmatch =3D 0; - int count =3D 0; u16 vid =3D 0; =20 for_each_set_bit(vid, priv->active_vlans, VLAN_N_VID) { __le16 vid_le =3D cpu_to_le16(vid); crc =3D bitrev32(~stmmac_vid_crc32_le(vid_le)) >> 28; hash |=3D (1 << crc); - count++; - } - - if (!priv->dma_cap.vlhash) { - if (count > 2) /* VID =3D 0 always passes filter */ - return -EOPNOTSUPP; - - pmatch =3D vid; - hash =3D 0; } =20 if (!netif_running(priv->dev)) return 0; =20 - return stmmac_update_vlan_hash(priv, priv->hw, hash, pmatch, is_double); + return stmmac_update_vlan_hash(priv, priv->hw, hash, is_double); } =20 /* FIXME: This may need RXC to be running, but it may be called with BH diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_vlan.c index e24efe3bfedb..983a90cb9767 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -162,7 +162,7 @@ static void vlan_restore_hw_rx_fltr(struct net_device *= dev, } =20 static void vlan_update_hash(struct mac_device_info *hw, u32 hash, - u16 perfect_match, bool is_double) + bool is_double) { void __iomem *ioaddr =3D hw->pcsr; u32 value; @@ -184,20 +184,6 @@ static void vlan_update_hash(struct mac_device_info *h= w, u32 hash, } =20 writel(value, ioaddr + VLAN_TAG); - } else if (perfect_match) { - u32 value =3D VLAN_ETV; - - if (is_double) { - value |=3D VLAN_EDVLP; - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_EDVLP; - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } - - writel(value | perfect_match, ioaddr + VLAN_TAG); } else { value &=3D ~(VLAN_VTHM | VLAN_ETV); value &=3D ~(VLAN_EDVLP | VLAN_ESVL); @@ -251,7 +237,7 @@ static void vlan_set_hw_mode(struct mac_device_info *hw) } =20 static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, - u16 perfect_match, bool is_double) + bool is_double) { void __iomem *ioaddr =3D hw->pcsr; =20 @@ -279,29 +265,6 @@ static void dwxgmac2_update_vlan_hash(struct mac_devic= e_info *hw, u32 hash, =20 value &=3D ~VLAN_VID; writel(value, ioaddr + VLAN_TAG); - } else if (perfect_match) { - u32 value =3D readl(ioaddr + XGMAC_PACKET_FILTER); - - value |=3D XGMAC_FILTER_VTFE; - - writel(value, ioaddr + XGMAC_PACKET_FILTER); - - value =3D readl(ioaddr + VLAN_TAG); - - value &=3D ~VLAN_VTHM; - value |=3D VLAN_ETV; - if (is_double) { - value |=3D VLAN_EDVLP; - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_EDVLP; - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } - - value &=3D ~VLAN_VID; - writel(value | perfect_match, ioaddr + VLAN_TAG); } else { u32 value =3D readl(ioaddr + XGMAC_PACKET_FILTER); =20 --=20 2.34.1 From nobody Fri Sep 25 20:48:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010001.outbound.protection.outlook.com [52.101.229.1]) (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 E4AD4582BA4; Tue, 8 Sep 2026 16:43:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.1 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885841; cv=fail; b=GN+CF50qlDUSFLrEH00mEkWvqygf6M/JhVIdypurTkN7wsjYzfmxZaCOYe5i5DxEgEuoHEZiBfByRrIWpgRYPfjbk1bGYVpjy3K4PM2Ul0MrKDQ6RayIG00dK6U4SXLK6Je0nYJDkdnpYvAAPB58RwkfhSmk21qbMY6LjFW4zuc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885841; c=relaxed/simple; bh=gcO88G0eCIoWVIuyI3fTGIOyY8wY+0fFMbErkN52Bog=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bXKKJPiKHwHT4k+//dttmztvYK4V5nUkxzptnxerQPy9467XEhhZSye7DV9+dr4KLhO37Iddrn6+/OwbJGn/j1uLgHn1orINLJ7OeIAdYIpODKs67sz16wNPg1WhwL/5R/0kl4Eux4MXZaRvvzPnzi7YpYzP13ynLiL9QGCh3YI= 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=fjJe3sdG; arc=fail smtp.client-ip=52.101.229.1 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="fjJe3sdG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fWWCYgjm98cbUsMzzYMAMk1eF2AtF9BOc7bJvQdUALw2laiGavS0CHWwOkuSGCaFX6d99oXrlT0dwyttlNkYvK7vDyKRDuMbOILVUZVM0xPaJUwAo3+uuFtwFqUiDL/YTAKP6hoqVbOXnIQXaHu7yICO5iuShcztPp2OuSbsrPBfLQZNBLXT0xzlMrU8W8/RNhBJuNDJ+lLCZDyWqzYlUbI7KKA/W5z/3+8LxoHDp93a8ldsoEHA/xslcVUZ3H8x+FVGaxxlbe22H6Ho59gj1ZpeRu/zZD0wyFU57yadl09ZP8CkQIydvUbOfRl1/Xm5i9gLUnjv9n7qoM6p0+QW9g== 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=hUbDH/ZLw3gCQh8hLEflFD+nCbuDOKX0lc4242CRbGI=; b=et5iv8OnK3KdEPhmGKN61ypi7UFb8DA/LQ6gLihlLhGMFG37KRQ5hW6ZzqZsTAeq2b24i7cvw/NY/BtbIbvu02iYR/BE4IUEY/tw75R+anD2BXnnEmMk6PkiJCfOaQU4NfGBOxSGqh/PI5JWCJ5FsEcXCn4QznmcmWgyYvv2B6Qn6iv11NpqwzZP1dMmE1ATk31TRbZAcyo9+hkleC3oi6zgqfapuziQdWx2IN/PIPKcLmc+glsOHddA3pDBdZriFfZjn+KSPnW0YLiJ9JDyDZ+Z1SDH9l1o+f7lT1oHnhdBQ9Obyqe+6336DHbW2/WitnVeScJqrco+LvgXvrv+FQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=hUbDH/ZLw3gCQh8hLEflFD+nCbuDOKX0lc4242CRbGI=; b=fjJe3sdGd5QqqQPwcG1CrzK2chV6a2o4eiu94Jpw/5z7fUpG18D36mqSvagSruuPpbMXOp4nV3irtJEuxhJ8i5ELXQeOgGJj9sq0g26T6iUxI5fYZqSpM6oSYKmzNBBVE+WyelHuywQssfkzT28e1oI8x6COt5SuLJ916jWjnSM= Received: from OS7PR01CA0002.jpnprd01.prod.outlook.com (2603:1096:604:251::11) by TYCPR01MB10651.jpnprd01.prod.outlook.com (2603:1096:400:293::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.7; Tue, 8 Sep 2026 16:43:51 +0000 Received: from OS1PEPF0000D210.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:251:cafe::8b) by OS7PR01CA0002.outlook.office365.com (2603:1096:604:251::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.6 via Frontend Transport; Tue, 8 Sep 2026 16:43:51 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by OS1PEPF0000D210.mail.protection.outlook.com (10.167.240.39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:43:50 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id F42213000450; Wed, 9 Sep 2026 01:43:44 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 2/7] net: stmmac: Stop toggling the EDVLP bit Date: Tue, 8 Sep 2026 16:43:04 +0000 Message-ID: <20260908164309.59282-3-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: OS1PEPF0000D210:EE_|TYCPR01MB10651:EE_ X-MS-Office365-Filtering-Correlation-Id: f47e976f-d4b0-4ff6-f7da-08df0dc85c93 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|23010399003|36860700016|82310400026|921020|10067099003|56012099006|11063799006|5023799004|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: qTrFH5faIrWlvmTi6OyoFvvu75BkqcxBoBAmWz4HlxnIVQcQ9JQ9EsrvTcBgBopqfDNukvIo6TQwwrIDsmsJaFIypP8lRorxQeTUtRKMwWGFFPEWWnUks3KVzSKLj1jM30x2R5+bUBQmtXy+9lkJ8Y0X4HL0xdr+0K55IOvMlGqlA/1mtDdY6wnmZbEXfNN1W+jDUkY49BxYY4dxLdtPP0lXXHruakN9L4PSJVfSYwN5fMG3xcNCASJNcu/CQnnRZ82ECvXWzjgX76a45JC7jQDBUcM6IpgCoV+UWfRHfhBxGGyf3iaj5AYqYICFLulGqjghwOulE7MYc/uqoXOVVr1he52J3r6eEJasgMtYTI4nJGi9rq7WOA27w1E8HlnRDY8t1OLYT83d1Jyaq4Pkzs1x/2OTnqnVbYajrSuhtxKXZHoNTcZgRBRFmyK4bKBsQS7VcY4mENMatGqEbJfCm0JroSympAwRkyAppkwRB07nvOO9hRl40b84MC+psuo82ME0IvQUBuiz7iGVGnIu87FvtFCvLPbKIxqKjomjLxl06nVqTJMCFRpx+GNMJfVXlL/xikMXM5SVIIG+Z9A05ldbBYKVaTPgYVrjmiEJybwouG89we/KY9MBh/x6wWAHGBPHEZ1KCED1RnV/OZF9puKUXZegoTjeK9pxYrHv0PJA7cP5ectgkQOIgt3OYbp+kyhUDdwYSqaOKu5tpVpLLsz6XlBBj5EdKOI/yU7ppQ8EnVJs98XRxEbU8RDZA6gd X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(23010399003)(36860700016)(82310400026)(921020)(10067099003)(56012099006)(11063799006)(5023799004)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zjTa/mfX5yC3aYO+/VqOfywA8KLT/++i3PttQSNhPbYOsvsIH1dNqurfnNabAWTtF7Kg11/vn9XtcK5naFNm94yAg9X+0VizgLSGXuYFCSikszCpMFncVihn18dJuPvAE8gpHOak9e5P8iH3A4ZlfSy6aqM87iXrlMg16tcEZsPFnkqaOM1ne2Rrm+j5jr5Uz7SFzTmQUPpGB9Kt5jck6RjvozODvc0a83b92Za7ll9hNx5/UjC1h0onD6zmeOyl7EbduqEbokdNi9oiM4pjwSTXCxX6JIIohhr7X4KCmznDn7OOrnkkkgRPDueu76R+pkezEAPBNskonZYBnWJh65JHgyuSpJGaj3gn7UI5om8568zzKLEpKG5e0f7J8SIY2voMKRQy18AFSYMkqt7sYIV1UXmMvpVLCiRftqrCyPYLCvKsA0Ewn+OCTRPXEBwE X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:43:50.7092 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f47e976f-d4b0-4ff6-f7da-08df0dc85c93 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS1PEPF0000D210.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB10651 Content-Type: text/plain; charset="utf-8" Currently, the EDVLP bit is toggled whenever an 802.1ad VLAN is registered. This bit enables the double VLAN feature, which provides a way to insert, extract and filter an additional inner VLAN tag, and has nothing to do with S-Tag handling. Move EDVLP handling into vlan_set_hw_mode() instead, and keep it always enabled, so that COE can work for packets with an inner VLAN header. Add a dedicated callback for dwxlgmac2, as it doesn't implement the set_hw_vlan_mode callback, like the other cores. Suggested-by: Joseph Steel Signed-off-by: Ovidiu Panait --- v4 changes: - New patch. .../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_vlan.c index 983a90cb9767..200b34588c7f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -174,19 +174,16 @@ static void vlan_update_hash(struct mac_device_info *= hw, u32 hash, if (hash) { value |=3D VLAN_VTHM | VLAN_ETV; if (is_double) { - value |=3D VLAN_EDVLP; value |=3D VLAN_ESVL; value |=3D VLAN_DOVLTC; } else { - value &=3D ~VLAN_EDVLP; value &=3D ~VLAN_ESVL; value &=3D ~VLAN_DOVLTC; } =20 writel(value, ioaddr + VLAN_TAG); } else { - value &=3D ~(VLAN_VTHM | VLAN_ETV); - value &=3D ~(VLAN_EDVLP | VLAN_ESVL); + value &=3D ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); value &=3D ~VLAN_DOVLTC; value &=3D ~VLAN_VID; =20 @@ -222,6 +219,7 @@ static void vlan_set_hw_mode(struct mac_device_info *hw) void __iomem *ioaddr =3D hw->pcsr; u32 value =3D readl(ioaddr + VLAN_TAG); =20 + value |=3D VLAN_EDVLP; value &=3D ~VLAN_TAG_CTRL_EVLS_MASK; =20 if (hw->hw_vlan_en) @@ -254,11 +252,9 @@ static void dwxgmac2_update_vlan_hash(struct mac_devic= e_info *hw, u32 hash, =20 value |=3D VLAN_VTHM | VLAN_ETV; if (is_double) { - value |=3D VLAN_EDVLP; value |=3D VLAN_ESVL; value |=3D VLAN_DOVLTC; } else { - value &=3D ~VLAN_EDVLP; value &=3D ~VLAN_ESVL; value &=3D ~VLAN_DOVLTC; } @@ -274,8 +270,7 @@ static void dwxgmac2_update_vlan_hash(struct mac_device= _info *hw, u32 hash, =20 value =3D readl(ioaddr + VLAN_TAG); =20 - value &=3D ~(VLAN_VTHM | VLAN_ETV); - value &=3D ~(VLAN_EDVLP | VLAN_ESVL); + value &=3D ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); value &=3D ~VLAN_DOVLTC; value &=3D ~VLAN_VID; =20 @@ -283,6 +278,14 @@ static void dwxgmac2_update_vlan_hash(struct mac_devic= e_info *hw, u32 hash, } } =20 +static void dwxlgmac2_set_hw_vlan_mode(struct mac_device_info *hw) +{ + void __iomem *ioaddr =3D hw->pcsr; + u32 value =3D readl(ioaddr + VLAN_TAG); + + writel(value | VLAN_EDVLP, ioaddr + VLAN_TAG); +} + const struct stmmac_vlan_ops dwmac_vlan_ops =3D { .update_vlan_hash =3D vlan_update_hash, .enable_vlan =3D vlan_enable, @@ -296,6 +299,7 @@ const struct stmmac_vlan_ops dwmac_vlan_ops =3D { const struct stmmac_vlan_ops dwxlgmac2_vlan_ops =3D { .update_vlan_hash =3D dwxgmac2_update_vlan_hash, .enable_vlan =3D vlan_enable, + .set_hw_vlan_mode =3D dwxlgmac2_set_hw_vlan_mode, }; =20 const struct stmmac_vlan_ops dwxgmac210_vlan_ops =3D { --=20 2.34.1 From nobody Fri Sep 25 20:48:39 2026 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011043.outbound.protection.outlook.com [52.101.125.43]) (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 27EC45803B3; Tue, 8 Sep 2026 16:44:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885847; cv=fail; b=iIBkIsVNv4cPosrxc0W8QY0+Qt3ev/MdCp/QBWjMdCDIcQ/TyCwp6Xf3/F6e6gq/rY7GB/pHXtbwuCedEdlFp+94Fkht0JhydFPdbMHLc1o1P3+hi3A4P1B1tXLdMl/axhf10t9GJ9Nzk9S7h9BXvYR1aRjceSvOEYG+hfFq1u4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885847; c=relaxed/simple; bh=ylXYyGFl1LTRzsBzz+hrNzFxqq+epmw/QYT5qytw/F8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kZKXvdX2s6cbp9tCBYdugblFoekTIjyLixOWcitOY+1iW6cRzQfQ2ueOXCufDAINTSPs2X9phaPDw/GVEK3/GrpnqJL70pYj8kES1ldCPK3wRCnvql2olya6HlB97WL0+CH7iseQGNk3NZv/F9x/K5wxCZMkc87qqtEhu15mOMA= 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=Jqjw+6LU; arc=fail smtp.client-ip=52.101.125.43 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="Jqjw+6LU" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DzbrfZFeaVUBM7T4ogCeuEcx3Uky3CageHKv9DJWVDvO9jbVGJXiJu65fqOs29i8QiTB/ssdv9oyyJcAwZo5DDzi1aXwxMH0ZujaSqT8QBYfpx9tettqDMklnF/ZC7mM8Z3h/ExYf0ji22SuWMeUz3dr1zTdZHR+pmy21BknaKHxhRnortunzrncAbXGza3BsCQrxiEGqtDb3ASxWu48IoUa47k1WR5B1qtKSTIZqLUMxYCZGBim/WzJ7aIU62xWP8O8W4tWfia89iMZm5yBjLNN52ZHZNR95lhhKB62ktMDsGH09zXzJi5k7Ue0m1wberblO4JWoT3xunOy6t83dA== 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=KKOcdk4qfPRMVDojHfBBJvOqIpO6BscH97bq+M+iybg=; b=mA/6B2wW3dYxZfBWx4MkFtbq5E4O5sjk9/ilXTvEM/m0GWgeW3/3rAjnREjnkC1lI3IQGPEIFVzZ03faPCb6awyoPZBrH77w6S+4FF7lC910U3p0gsyhf3ZgZgb016kU72IOlhzbtV4lpZO02kxtOzDAhiLXLMJrtQF/DtnzXnWD3MfjLcHvvIqbF+28oZ2k3fWA07VGQjqrpWfQIEw1woyjvGPgpuQwn3BY38HpeE6heFvMDMhZOk2JUnj3sLDSyNRkZbpQppinss1HyHn6zGqHmb8Nn6vjdEnYg2gL0xMXi8NqcJ0v4pyqBoOIPFsa/qhz8XBQ2s/L+7abhP6Qkw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=KKOcdk4qfPRMVDojHfBBJvOqIpO6BscH97bq+M+iybg=; b=Jqjw+6LUwLwX8Mp4+DuM/OKAheXWdZaOIG/PMegC1GDenRcfeXm0TXqcOhrbl25irae0ZP6uXE+wK1MlzL6AGkIAtY/SqBJr48qTYMG2EJwhdhJjXL2cQAz/pEYEzJP2tfGtJ+RnhG77MdoTP+tdnij00Twmj9gPBYWFZzgtBhA= Received: from TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) by OS7PR01MB14821.jpnprd01.prod.outlook.com (2603:1096:604:39b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.6; Tue, 8 Sep 2026 16:43:59 +0000 Received: from TY1PEPF0000BADA.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c:cafe::5) by TYCP286CA0015.outlook.office365.com (2603:1096:400:26c::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.7 via Frontend Transport; Tue, 8 Sep 2026 16:43:58 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by TY1PEPF0000BADA.mail.protection.outlook.com (10.167.240.39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:43:56 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 2802B300044D; Wed, 9 Sep 2026 01:43:50 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 3/7] net: stmmac: Rework S-VLAN handling Date: Tue, 8 Sep 2026 16:43:05 +0000 Message-ID: <20260908164309.59282-4-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: TY1PEPF0000BADA:EE_|OS7PR01MB14821:EE_ X-MS-Office365-Filtering-Correlation-Id: 4928c1dd-4af5-4495-7300-08df0dc8603d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|82310400026|23010399003|376014|7416014|1800799024|56012099006|11063799006|5023799004|10067099003|921020|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: XtQdkqDh+Kopc8/o//2ig7LuiXu3RCS6qHllgT9FEZIxSsxVPx7MZFSNUDiaLPR7Lh2LWb5uneMc0PQ68w6hV0LpSkIViqQgOUg6HhPBO5DBarH45kTQwUygN/oFILJgG3TONLlRdnotWPqiWiJEobkMHc3SSC4JMSpC37xiEq6EOse6z0+G4MCWRsJvvWkh7Mae/dgUJwMjKLyyXNcL0jFNy1LprfYrl00tcu6hue4UHDcUTVrRWExU/Z9uUgeHSc+gOsm3IEAkBqlv8PA0vWDXCyHJQ1XopaDHluZHsHKty3CZPjhSIxZQBhCg6bA6CN+alrGgiDUygvq3DVel/ie3FyL9x68d+TUTFvutU3brOeKqFJV2AjZW46bdJnIAPpl3o22MXmIGKZk1pmNayVT78B5TCksjNHo5uv3GMHSkC3+P+L9wPrit78JU8ONDQiW+Oi61hXsIstg7yxvfG7m5LZwt+qyFngcOiHiKfiH5QI1omQrfT3N1+1OAau7BVdHH1Zy7mM0MWwbJMZx66cvWSDABFx3srMCxFxOyzdb5NJrxFgeUi/iFu7EYYs+VlC+3d/rfLtWQADpOKEI8MC3OOL+SXTm6R5HomFjTrfQyX/kmfSHHFtxY+LANyrZo2w16lWJ7qu+3ipl8u4TDkliryqNhKtpi+kmtBXMQXWNQp5Re9GmBC5n6FnCTCkg7oC8B6Kxx0IGjqBdpEPeDFLrs+i1m7tsH4/vkfDssOKh2mV5uxHoHnDzQkdkW4mPq X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700016)(82310400026)(23010399003)(376014)(7416014)(1800799024)(56012099006)(11063799006)(5023799004)(10067099003)(921020)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4jPyQXQgyKrZlJzZV4OEoZ+EZOqa6LTSbb+/pHfhL66Jrsp70omZeKm/i8G/xgtBru1S7zPEjuAuldfoySvfkgLbLSxLWNpZDzZE82Nd/YMsEgl3RBH3sol2VBS3YpkgTbZQ2iplG917dD+6qlHlyu/8ctYrazkFSCImlgefl1JzQRcqkG+/1Ead68gHvXPAOI09HGr7GG9PzEOyMZ4POT3TFF3v8fZHc80zOGITRK7jayj3ELD1QPmdI65fjdVjEVhgzy0M0jgcOpBxh1l3aEcWsqhIbfF4JzuhrW571TVGASXeFbCtK5To5pjbzBk4VcPcaFGt8sVGqqjZkpjPPMFAjkxSufQWE6hjE7lCfi2Bi+XJLDPDwmhmmZD7wrKoccjQgXt6zjG0xlfKIEeaN/PT8hlKLL0T48RrDaj1SoOAA5BuaIxHXje/MhRA43/u X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:43:56.8664 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4928c1dd-4af5-4495-7300-08df0dc8603d 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: TY1PEPF0000BADA.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB14821 Content-Type: text/plain; charset="utf-8" The ESVL and DOVLTC bits control S-VLAN tag processing and have nothing to do with the double VLAN feature, which only provides a way to process an additional inner VLAN tag. However, the driver code that handles them always refers to "double VLAN", which is unrelated and makes the implementation confusing. The driver does not use any of the inner VLAN tag features, and the networking core does not support offloads for the inner tag anyway. To simplify the logic and to reduce the confusion regarding S-Tag vs double VLAN handling, drop the is_double logic and add a hw_svlan_en flag that is set when S-Tag hardware handling is enabled. Suggested-by: Joseph Steel Signed-off-by: Ovidiu Panait --- v4 changes: - New patch. drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 3 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - .../net/ethernet/stmicro/stmmac/stmmac_main.c | 31 ++++---------- .../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 42 ++++++++----------- 5 files changed, 28 insertions(+), 50 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/eth= ernet/stmicro/stmmac/common.h index 927ea6230073..1dd4fc7e7a96 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -634,6 +634,7 @@ struct mac_device_info { bool vlan_fail_q_en; u8 vlan_fail_q; bool hw_vlan_en; + bool hw_svlan_en; bool reverse_sgmii_enable; =20 /* This spinlock protects read-modify-write of the interrupt diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ether= net/stmicro/stmmac/hwif.h index 6f26dbf95ce1..bfd68f8460c8 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -632,8 +632,7 @@ struct stmmac_est_ops { =20 struct stmmac_vlan_ops { /* VLAN */ - void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash, - bool is_double); + void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash); void (*enable_vlan)(struct mac_device_info *hw, u32 type); void (*rx_hw_vlan)(struct mac_device_info *hw, struct dma_desc *rx_desc, struct sk_buff *skb); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/eth= ernet/stmicro/stmmac/stmmac.h index 7582fca63741..7520bdcb7c6b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -344,7 +344,6 @@ struct stmmac_priv { void __iomem *ptpaddr; void __iomem *estaddr; unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; - unsigned int num_double_vlans; int sfty_irq; struct stmmac_msi *msi; =20 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 24d64cce1d87..cd9671493b41 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6813,7 +6813,7 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le) return crc; } =20 -static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double) +static int stmmac_vlan_update(struct stmmac_priv *priv) { u32 crc, hash =3D 0; u16 vid =3D 0; @@ -6827,7 +6827,7 @@ static int stmmac_vlan_update(struct stmmac_priv *pri= v, bool is_double) if (!netif_running(priv->dev)) return 0; =20 - return stmmac_update_vlan_hash(priv, priv->hw, hash, is_double); + return stmmac_update_vlan_hash(priv, priv->hw, hash); } =20 /* FIXME: This may need RXC to be running, but it may be called with BH @@ -6836,20 +6836,14 @@ static int stmmac_vlan_update(struct stmmac_priv *p= riv, bool is_double) static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u= 16 vid) { struct stmmac_priv *priv =3D netdev_priv(ndev); - unsigned int num_double_vlans; - bool is_double =3D false; int ret; =20 ret =3D pm_runtime_resume_and_get(priv->device); if (ret < 0) return ret; =20 - if (be16_to_cpu(proto) =3D=3D ETH_P_8021AD) - is_double =3D true; - set_bit(vid, priv->active_vlans); - num_double_vlans =3D priv->num_double_vlans + is_double; - ret =3D stmmac_vlan_update(priv, num_double_vlans); + ret =3D stmmac_vlan_update(priv); if (ret) { clear_bit(vid, priv->active_vlans); goto err_pm_put; @@ -6859,13 +6853,11 @@ static int stmmac_vlan_rx_add_vid(struct net_device= *ndev, __be16 proto, u16 vid ret =3D stmmac_add_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid); if (ret) { clear_bit(vid, priv->active_vlans); - stmmac_vlan_update(priv, priv->num_double_vlans); + stmmac_vlan_update(priv); goto err_pm_put; } } =20 - priv->num_double_vlans =3D num_double_vlans; - err_pm_put: pm_runtime_put(priv->device); =20 @@ -6878,20 +6870,14 @@ static int stmmac_vlan_rx_add_vid(struct net_device= *ndev, __be16 proto, u16 vid static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, = u16 vid) { struct stmmac_priv *priv =3D netdev_priv(ndev); - unsigned int num_double_vlans; - bool is_double =3D false; int ret; =20 ret =3D pm_runtime_resume_and_get(priv->device); if (ret < 0) return ret; =20 - if (be16_to_cpu(proto) =3D=3D ETH_P_8021AD) - is_double =3D true; - clear_bit(vid, priv->active_vlans); - num_double_vlans =3D priv->num_double_vlans - is_double; - ret =3D stmmac_vlan_update(priv, num_double_vlans); + ret =3D stmmac_vlan_update(priv); if (ret) { set_bit(vid, priv->active_vlans); goto del_vlan_error; @@ -6901,13 +6887,11 @@ static int stmmac_vlan_rx_kill_vid(struct net_devic= e *ndev, __be16 proto, u16 vi ret =3D stmmac_del_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid); if (ret) { set_bit(vid, priv->active_vlans); - stmmac_vlan_update(priv, priv->num_double_vlans); + stmmac_vlan_update(priv); goto del_vlan_error; } } =20 - priv->num_double_vlans =3D num_double_vlans; - del_vlan_error: pm_runtime_put(priv->device); =20 @@ -6922,7 +6906,7 @@ static void stmmac_vlan_restore(struct stmmac_priv *p= riv) if (priv->hw->num_vlan) stmmac_restore_hw_vlan_rx_fltr(priv, priv->dev, priv->hw); =20 - stmmac_vlan_update(priv, priv->num_double_vlans); + stmmac_vlan_update(priv); } =20 static int stmmac_bpf(struct net_device *dev, struct netdev_bpf *bpf) @@ -7962,6 +7946,7 @@ static int __stmmac_dvr_probe(struct device *device, #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ ndev->features |=3D NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; + priv->hw->hw_svlan_en =3D true; if (dwmac_is_xmac(priv->plat->core_type)) { ndev->hw_features |=3D NETIF_F_HW_VLAN_CTAG_RX; priv->hw->hw_vlan_en =3D true; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_vlan.c index 200b34588c7f..fbb99b70ac27 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -161,8 +161,7 @@ static void vlan_restore_hw_rx_fltr(struct net_device *= dev, vlan_write_filter(dev, hw, i, hw->vlan_filter[i]); } =20 -static void vlan_update_hash(struct mac_device_info *hw, u32 hash, - bool is_double) +static void vlan_update_hash(struct mac_device_info *hw, u32 hash) { void __iomem *ioaddr =3D hw->pcsr; u32 value; @@ -173,18 +172,9 @@ static void vlan_update_hash(struct mac_device_info *h= w, u32 hash, =20 if (hash) { value |=3D VLAN_VTHM | VLAN_ETV; - if (is_double) { - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } - writel(value, ioaddr + VLAN_TAG); } else { - value &=3D ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); - value &=3D ~VLAN_DOVLTC; + value &=3D ~(VLAN_VTHM | VLAN_ETV); value &=3D ~VLAN_VID; =20 writel(value, ioaddr + VLAN_TAG); @@ -220,6 +210,12 @@ static void vlan_set_hw_mode(struct mac_device_info *h= w) u32 value =3D readl(ioaddr + VLAN_TAG); =20 value |=3D VLAN_EDVLP; + + if (hw->hw_svlan_en) + value |=3D VLAN_ESVL | VLAN_DOVLTC; + else + value &=3D ~(VLAN_ESVL | VLAN_DOVLTC); + value &=3D ~VLAN_TAG_CTRL_EVLS_MASK; =20 if (hw->hw_vlan_en) @@ -234,8 +230,7 @@ static void vlan_set_hw_mode(struct mac_device_info *hw) writel(value, ioaddr + VLAN_TAG); } =20 -static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, - bool is_double) +static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash) { void __iomem *ioaddr =3D hw->pcsr; =20 @@ -251,13 +246,6 @@ static void dwxgmac2_update_vlan_hash(struct mac_devic= e_info *hw, u32 hash, value =3D readl(ioaddr + VLAN_TAG); =20 value |=3D VLAN_VTHM | VLAN_ETV; - if (is_double) { - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } =20 value &=3D ~VLAN_VID; writel(value, ioaddr + VLAN_TAG); @@ -270,8 +258,7 @@ static void dwxgmac2_update_vlan_hash(struct mac_device= _info *hw, u32 hash, =20 value =3D readl(ioaddr + VLAN_TAG); =20 - value &=3D ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); - value &=3D ~VLAN_DOVLTC; + value &=3D ~(VLAN_VTHM | VLAN_ETV); value &=3D ~VLAN_VID; =20 writel(value, ioaddr + VLAN_TAG); @@ -283,7 +270,14 @@ static void dwxlgmac2_set_hw_vlan_mode(struct mac_devi= ce_info *hw) void __iomem *ioaddr =3D hw->pcsr; u32 value =3D readl(ioaddr + VLAN_TAG); =20 - writel(value | VLAN_EDVLP, ioaddr + VLAN_TAG); + value |=3D VLAN_EDVLP; + + if (hw->hw_svlan_en) + value |=3D VLAN_ESVL | VLAN_DOVLTC; + else + value &=3D ~(VLAN_ESVL | VLAN_DOVLTC); + + writel(value, ioaddr + VLAN_TAG); } =20 const struct stmmac_vlan_ops dwmac_vlan_ops =3D { --=20 2.34.1 From nobody Fri Sep 25 20:48:39 2026 Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010034.outbound.protection.outlook.com [52.101.228.34]) (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 B947A5867D0; Tue, 8 Sep 2026 16:44:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.228.34 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885850; cv=fail; b=inpi4JVupyGL/+h5ue4Dic6kq4gzI7HG8mqOCjogL7i2osfWysOBPTNuJgR6o7a2hYHxwA5uOD2gCRANRis43mO7a/2cNJ/E0dTww0/pWWj0l52pG4elcf+C/0D3UVdTMRGj7FjiPfMGgHAl0eIYQzp8xqx/5gfVofnV3NRgaC8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885850; c=relaxed/simple; bh=1Qy8+0JI7IJR37teFERD8Zqmwlz7UYbx8E9tLG5QvuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OEyQdV1I2qWFM4bjsf8K7XBiMuHnFatlLokEPvzY/FBJod0cp0LRBQ/zlS/DM+KiKXy1zMXHbPM/bjVqbtUzgwQhcwfe7r9MK9eucvO3Tb4hLnyK3wl3CnaXrC07Nw/uxz7HAzXJzkVh9RvEL6Q5rByPSBiZcYArL6csmftmUEU= 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=RTsiHcis; arc=fail smtp.client-ip=52.101.228.34 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="RTsiHcis" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nwVqrWCJvRn7cuNyw2Mmhc7nolT7EhfgC/PZTYm23Vms9xlSXdd07yS/a8mNo3ioNioqXcHOkVJKpY6Lwqz85q8Ll59i/XDucYb+8IWjnLJ8oQ5f0iSCgt8ktjFWfKdTrG4e/YxmlncF7W/TBfeqkVmrlIoySygFi94c9sobVmvEBzRuOHmkvuVml73rMCWZq/TVukQDBXKBwcxMUsGmHZZpsxGoNVplL3DqnPLGu0wktRDhJT2GVtRtqae2QJuEnBWk3ah47Pa2YeQ5RwomS0rxNDcOiImBQLlBBGukozTpqvcmKc/ekFpkhHwD1USuEvigU8gZkfiYsqLVX3ttiw== 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=ov6fQnvfOis0YFvqGAJx3mfAjOeOZHNcRy0Qvmw9kgc=; b=IFEBMQvIF0UNwnjyzfS09qtZGoVKkmQDE+1Ko8o+HhgQ0j3Y39roaoF1oCpsi14hCCEXoyr0KHAu9MLyu4QaOjN7wY2lugSB/zE4HBjgjaAauIosTgSDCXQU3FpXAwJSY+sfQbcdlFrbyTtfpAcZfhG2WcZi8oJAEsSFujDWTWnIQrHyIgr/IYvWX64InYKliYnDj3umNIrpTAYrzD/dMQPDICuHHkiidO6Gi7NKVpARh/pOhR+CUwvA1QikbpUcjykti1I0yoUmOA+TTWD2NHyJc8RjaOsxxSBqX4IVsI0jbbzuz1NxZ/CwIbeXc2e4Sx2Ix2OxVXxCPtwaUouYnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=ov6fQnvfOis0YFvqGAJx3mfAjOeOZHNcRy0Qvmw9kgc=; b=RTsiHcismwh208N+KYgcnWQVNsImbUUs0N38oJYj5ch6/ZtzLiWXMBZNWmvcOzcWhYPcWJZVEl7PL727in5z2NwdwkttW2xMx2LmWjXIV9jt8E+3kDKJhcnMUZTgKMXTwfXRpg1OAVIlgaq3LJZ5aHljQqcZp48g2TXidRQDmqM= Received: from TY4P301CA0078.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:36f::16) by OS9PR01MB16470.jpnprd01.prod.outlook.com (2603:1096:604:406::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.6; Tue, 8 Sep 2026 16:44:05 +0000 Received: from TYO1EPF0000501F.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:36f:cafe::30) by TY4P301CA0078.outlook.office365.com (2603:1096:405:36f::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.382.15 via Frontend Transport; Tue, 8 Sep 2026 16:44:04 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by TYO1EPF0000501F.mail.protection.outlook.com (10.167.240.4) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:44:03 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 5A56C30001C0; Wed, 9 Sep 2026 01:43:57 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 4/7] net: stmmac: Do not advertise S-VLAN stripping when it is disabled Date: Tue, 8 Sep 2026 16:43:06 +0000 Message-ID: <20260908164309.59282-5-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: TYO1EPF0000501F:EE_|OS9PR01MB16470:EE_ X-MS-Office365-Filtering-Correlation-Id: 441ae7c5-1d9b-470a-b401-08df0dc863e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|23010399003|36860700016|82310400026|921020|10067099003|56012099006|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: Y5if2dVJbgLL7OUpli4d45+m4j6PlFLJO0W/FPE+/SMg7xVl3tbsdlqUivoepFjHFFbE2uGLLErg1hzV4UzzEsHRUA2QymbppIIerWnDcxu93Uyb8ferSsNPueSqXeO/er5x1pZneCP7bH4w9ZWtzEpOokD0mtX7x+8bwKiRL/ZD1sDYqC7KEW0j/wHO81P5lDL3jRWOBql6enk3z96s2H4/ryigQYvY/Ia1T7NqLh1s43rhP6AOQdBOIW0SR2yHQWip9W36BfpB3nYbvH/xLZWcTaGS0ic2Jka3WaePnL5aIaZ3+XtLnGQEDZFnkuiIf7pE2e4RY7jatNw0E1aMJcS5RmtJCdkAhThfP2z5E5BsIqFugMd3TIpwHP8eFsYyfYPqBMa5BuAWYxLF1Hv5BX9KJLBrRsoLu80K4Ub4HYH2pbM4btiRCDjrjuT4guGgi0+WdlSePO1UWga4vmiYaiMX3/EC4fYjrl+ur+5zsYSkl0PbjkqGLMD5EtmG7tEAbauw0u9bUIIyjgLOeFunJ3E7QHyrFFywHWkZdDuu2WNIEHjaavxwhNrTeA6LOyzT0yvQnBz5MeTChoIXBNxOCoFO15wqUuCRAm0sJXtS1U2ZYgQVDjxQhiN8NbHdlcEwoiqtvV7YOB2cKk3PEd9cfpBe5YA4P6vMBcfnpdQIzHOI1E7fGr0zY3m3xu66xITEQa15wcgnacSUDI2nESTtvvE/vZxAvOnW+8Wd9FTzJpB4Tp8t6Rt5O4aSsADZdBuo X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(23010399003)(36860700016)(82310400026)(921020)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aNYAY7BIs9hj1bqfPd/uU/guS3L87yiSKuoploKhw9EpyWUJZE9v0/LRgKFd/flSzf7dJ05Z2bdVY4C9wYpzq3z6Pv2t8KaHHquoFSXwqJtw+izbUzLWG8thCB0/ihTZbYOinB9z6K+PTolibpuvZ7196itIs7+A2T5VGARwazP6SobUYXJrC1GxbqmmbZYtQD1PF4Hd3bWP2N2zUHBNM+b3Stz2sYnKfcjIM9SdvyRvRt7Ur110D8V5+kOHPNRSNS298X7LV5KbSipYKPkY3WvlRwMkulxRm0EsLv4NwnnWmrau1LAJL1XzXuxgwyi5sRZfky3peYZ1bucvywD2frmSapSq254X+sbeMpoNzbyJH5cpc1MJQYsbiFvetGfUH2GuE+I99iTD3y0O2ybADyDasIFL0LdN9UmbRw8NySfp+RzkJI69twhqsQTgCcEt X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:44:03.0226 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 441ae7c5-1d9b-470a-b401-08df0dc863e8 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: TYO1EPF0000501F.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS9PR01MB16470 Content-Type: text/plain; charset="utf-8" C-VLAN and S-VLAN tag stripping are both controlled by the EVLS bit, so disabling rx-vlan-offload also disables S-VLAN tag stripping. However, rx-vlan-stag-hw-parse keeps being advertised as enabled: root@rzv2h-evk:~# ethtool -K end1 rx-vlan-offload off root@rzv2h-evk:~# ethtool -k end1 | grep -i vlan rx-vlan-offload: off tx-vlan-offload: off [fixed] rx-vlan-filter: on [fixed] vlan-challenged: off [fixed] tx-vlan-stag-hw-insert: off [fixed] rx-vlan-stag-hw-parse: on [fixed] rx-vlan-stag-filter: on [fixed] Fix this inconsistency by making NETIF_F_HW_VLAN_STAG_RX follow NETIF_F_HW_VLAN_CTAG_RX. Fixes: 750011e239a5 ("net: stmmac: Add support for HW-accelerated VLAN stri= pping") Signed-off-by: Ovidiu Panait --- v4 changes: - New patch. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index cd9671493b41..c81c5bb5b075 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6189,6 +6189,13 @@ static netdev_features_t stmmac_fix_features(struct = net_device *dev, if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN)) features &=3D ~NETIF_F_CSUM_MASK; =20 + if (priv->hw->hw_svlan_en) { + if (features & NETIF_F_HW_VLAN_CTAG_RX) + features |=3D NETIF_F_HW_VLAN_STAG_RX; + else + features &=3D ~NETIF_F_HW_VLAN_STAG_RX; + } + return features; } =20 --=20 2.34.1 From nobody Fri Sep 25 20:48:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010043.outbound.protection.outlook.com [52.101.229.43]) (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 5EF57583AC5; Tue, 8 Sep 2026 16:44:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885857; cv=fail; b=enjZUCtba2SuIFLKn1qOj7d/qPe/ODeirwC8cIl+coL8+Lz4CPWQN1QAZ6RvruPb8l+aa17MEcHcV5HzV6PsKjJOM7pCGJoDNQofltwzMjcaQx8LU9pyjgt+0ZI08KxnQ/w9ezHz47gyDHXvcOq/oKp2yZ0IBbYNE0g6NkwZRSk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885857; c=relaxed/simple; bh=WVrisA8ldkCcq1wkHsc4UG9LaL89lQGqJCkwus+UdSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oS+XOm09rrgU0cmD+HOSg4F8SOK2Lx3SjzTNWpyVxPcm3Ma3dcUPEH9fAHWmhDlOCTj2AgWAMVt/zoK3z6sXfBqcyi/+/DQYz5rQzgg/ZJcjTZE/h/K2lEcMVITl4Tt3BylmjsEj+FuwxQEI0L9otrB193SsBl8qParYujgYz1I= 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=DIMnjo+F; arc=fail smtp.client-ip=52.101.229.43 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="DIMnjo+F" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MOdGgx1Fmb5qfUDzYzgfba1ei5AIlNW/4TCzadC+D/NoXoDpJvR4kllGSHe2i+p5XKfsLCcfMidYvmgm+vObue+eg5IAE7+rEoiZg6d572lAOQv3NtTF0pmmJkLhkX49V8Ye1yWMksmjoB+8OgeiCzVnZmchV1lj5Ky+mztfXAbxHPV3IS97YgzCudqprHGaikYlHo+324dnkcowys+rVsQ1TC4BeYQTlEL442fDYLvTknwc/pNRAtQA1yYVlIqBagWw4/ieohTUIpKjDgnMvn/7IpFks8MiUEeiJVzTGghA9cE2KcFt73b/eXet4p9JYWaiPl5OF3hU0kA/PvP7NA== 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=6M8TLynPB5paPt1Rc97LWiuVcY02hlRWqntN84IBe7c=; b=LZxakMAFjZMWa/RDTKux3xzvNFDg9/Ln4ByF4QNj4CXS/cYTfYGpBfPrXVMxJQ5YBBirqHXcBEe0QIemjpa/1NQ4zSgrf7MQ1sdaiQY5/ShdhPNOXKTZGkcndnLtCLKQhJZUNTN0uvIFa3chAyrhyq5zrANSZ2cApNBsxZWiz94VV/zuD7ImLURtSVhC+R8dd0Cp+xZuWqTcNGRYVMPvOCRiBXcKIieuJW5iVKIA41conAStFv5+Gy96x5V4qgmHoWMAqD6T1pDtcACBbyP8g35GTz6KfZ756lKaodM2tkg84iw+iZIT9Qr+G5Vmszxi7mwoXgDQREnLTiHxsYkBww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=6M8TLynPB5paPt1Rc97LWiuVcY02hlRWqntN84IBe7c=; b=DIMnjo+Fw3g57fagygEU3hb1EtS00bvimweLAqrPsxwTyj0cqGWG8/xnjReRk9ZP15LbIseouAPwQOkO3bxBxr/lfdtnvZnvV5wo6dfy6YtXbPfxZxK9RobLkYMtrKA2OuxZoISEsNjGWcAV3MpDHt/98HdBAq4wTZT7ERrjls4= Received: from OS7PR01CA0069.jpnprd01.prod.outlook.com (2603:1096:604:253::15) by TY7PR01MB14778.jpnprd01.prod.outlook.com (2603:1096:405:256::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.7; Tue, 8 Sep 2026 16:44:11 +0000 Received: from OS1PEPF0000D213.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:253:cafe::ae) by OS7PR01CA0069.outlook.office365.com (2603:1096:604:253::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.6 via Frontend Transport; Tue, 8 Sep 2026 16:44:11 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by OS1PEPF0000D213.mail.protection.outlook.com (10.167.240.20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:44:09 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 806EF300044D; Wed, 9 Sep 2026 01:44:03 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 5/7] net: stmmac: Disable S-Tag processing on dwmac4 Date: Tue, 8 Sep 2026 16:43:07 +0000 Message-ID: <20260908164309.59282-6-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: OS1PEPF0000D213:EE_|TY7PR01MB14778:EE_ X-MS-Office365-Filtering-Correlation-Id: 84e77392-f440-40e3-3d68-08df0dc867a6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700016|376014|23010399003|7416014|1800799024|921020|18002099003|22082099003|3023799007|56012099006|11063799006|10067099003; X-Microsoft-Antispam-Message-Info: /1VtCMF37G2QaMlwOuMhUo4RT1obft2C2fh7lsrNATCPnSJNgsFma8iCtDXB3eUxnQVBO0BekISmAqtaE+9lK+OoZiFSs1vZIYrFCFtplhNdOkTHOhkt7kXAIdCwuHHI9LtrKbF1D5RNz4zzGFyEsQcUh3dnBaOJ54ywklx0MtYIDcdFxMkSnkZc8mIa0IP2kr1oxowjM5rtfg1l6D467RzuxnJ+lo6cqjKfQM9hV1ecd/+//AfV055UZE/5225sYPfuLGecJzZOlhMNMk6cHePxTqHXRlGql7RnPDN7ywpg1VEY0vRpUTxc+0av1M6/9lF1nKfVWM2SNjgsWvDuVfiLhZGjAH6SJ31WG4iXh2nFYm9qAgfhnRU3IePBqvdq7MFRYiiqwwtFFfu8C9R0iJxyAT70CjiLRXuEhP15uzBhswwZjtA07gfQLsREobJLrgi+KNSlgzVsNJPVBxRg5WzIjuB2aXk1nRfSmA6XuA3uhfCfKQ8gsBmsoDiNS+hLwiTxd7vG72xD6Dxv0Ktbo1IRI6+1plfsaHOEOptKdcvypHnOSzEky75qtf0Xb0ZCSh/g59rk9RSaeDPuCRtQYm8T3lKQk/fWWC67UNY8TtJBQTEhaWALb96pYrWvkbu6SaGUr0kQ3RNjvj5vcMrnqmV4EDTLCxX+uzRS0wC5RHNNj6CDiyAwG+hDV1Wt3S7g5OglMn0oKpw1bRO54WdIxDVY7R1EHrQRTGZnSL0ABwPRynQiZvsOYVrYkwMqElax X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700016)(376014)(23010399003)(7416014)(1800799024)(921020)(18002099003)(22082099003)(3023799007)(56012099006)(11063799006)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1aSsMjnwYA1qZDhEbsPrjKVeE2Ka41RFg/CzDHUdwNQd9p5aSPukNbY4bZaMHz86VwJyD9Ur8lPZLaZooysMzutXiht58SwfGNY2xB3swSYd8xGz3QC7SfhtecgTQ9xAJ57pdC5LkjedWkgbc2TmhjRYcrwGPAXoscauiss6e54WXZI/aynqz9uzZiFkeyn3peuF8KGo5gHyIQztPu6BvCmnjCA253riW++FQWQPPllncPdWawb/Sqj6B6+4i50usOzJQyzHUFnGWyZPokaoybEPHEjz+q+8bPYUH8Y60gVhexFMyVyJQ6xrPOsp5Q0x5v5zSNljnMeMIxxp5ZuNimdz3YSHqkdiDA9FC9J0WlSOgLV+du5r54/vFrDFDAnUgeuhw/Y4FmVn7mj9Vc6u74w/T596/QUzCrvoL0pHQzIGDxvdADs5DflSbPV1EaME X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:44:09.2828 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84e77392-f440-40e3-3d68-08df0dc867a6 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS1PEPF0000D213.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY7PR01MB14778 Content-Type: text/plain; charset="utf-8" Currently, hardware VLAN stripping is broken for 802.1ad tags. vlan_rx_hw() hardcodes ETH_P_8021Q when putting the hardware tag into the skb, rather than using the actual protocol from the packet. Because of this, packets that contain a 802.1ad outer tag are incorrectly passed up the stack as having an 802.1Q tag. This causes QinQ ping between two hosts to fail. vlan_rx_hw() is shared by dwxgmac2 and dwmac4: on dwxgmac2 the tag type is available in the RDES3 write-back descriptor (the ET_LT field), so the outer tag type can be determined based on that info. However, dwmac4 doesn't seem to provide the tag type. The Length/Type field in RDES3 only indicates whether the packet is single or double-tagged, not which tag type was stripped. Since dwmac4 cannot report the stripped tag type, it cannot support hardware S-Tag stripping correctly. Therefore, restrict the NETIF_F_HW_VLAN_STAG_RX and NETIF_F_HW_VLAN_STAG_FILTER advertisement to dwxgmac2 only. With this, 802.1ad tags are left in place and handled by the software VLAN path. Fixes: 750011e239a5 ("net: stmmac: Add support for HW-accelerated VLAN stri= pping") Signed-off-by: Ovidiu Panait Reviewed-by: Maxime Chevallier --- v4 changes: - Dropped all "double VLAN" references from the commit title/message. - Rebased on top of the S-VLAN rework. v3 changes: - Rebased after dropping the dma_cap.dvlan patch. v2 changes: - Advertised NETIF_F_HW_VLAN_STAG_RX and NETIF_F_HW_VLAN_STAG_FILTER only for XGMAC (reported by Sashiko). drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index c81c5bb5b075..eab2903a66e4 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7952,15 +7952,20 @@ static int __stmmac_dvr_probe(struct device *device, ndev->watchdog_timeo =3D msecs_to_jiffies(watchdog); #ifdef STMMAC_VLAN_TAG_USED /* Both mac100 and gmac support receive VLAN tag detection */ - ndev->features |=3D NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; - priv->hw->hw_svlan_en =3D true; + ndev->features |=3D NETIF_F_HW_VLAN_CTAG_RX; + if (priv->plat->core_type =3D=3D DWMAC_CORE_XGMAC) { + ndev->features |=3D NETIF_F_HW_VLAN_STAG_RX; + priv->hw->hw_svlan_en =3D true; + } + if (dwmac_is_xmac(priv->plat->core_type)) { ndev->hw_features |=3D NETIF_F_HW_VLAN_CTAG_RX; priv->hw->hw_vlan_en =3D true; } if (priv->dma_cap.vlhash) { ndev->features |=3D NETIF_F_HW_VLAN_CTAG_FILTER; - ndev->features |=3D NETIF_F_HW_VLAN_STAG_FILTER; + if (priv->plat->core_type =3D=3D DWMAC_CORE_XGMAC) + ndev->features |=3D NETIF_F_HW_VLAN_STAG_FILTER; } if (priv->dma_cap.vlins) ndev->features |=3D NETIF_F_HW_VLAN_CTAG_TX; --=20 2.34.1 From nobody Fri Sep 25 20:48:39 2026 Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010037.outbound.protection.outlook.com [52.101.228.37]) (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 31D6C585960; Tue, 8 Sep 2026 16:44:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.228.37 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885862; cv=fail; b=HLEgtL20VBAV7UiAunkU/DyuSm1XDjpgpDd410MU0p8SfkMnhvUe7fHSWoP1X7CqAlb2kyEtE7EMiKoW7T0Scc70BDNpEKG3Cjcbahe0mAlMVW7VwzcUDZIjsT/sJLaWjdB3AiwHJlZzT+RKz7THns9EaWNyS/k0H98w84yoEt0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885862; c=relaxed/simple; bh=bWUXbarXNzT6hBpdmRQdP1TfLYdeHstzoOfB0tC5nkI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IB5LTDMhmcNeb5r3caJY+bVABes3mQU0aRlM0DzocAJRmRkXmHSg/sxCFuQl73Hu0HMWs1Uupmir6CSliEpQaiBE2sZxEFQeNMfIhyfzvSX9nxHX7bZcTTP6+A90abxwxim/a5VLUji2mm+9cDsAAAqT7QT6J7b+rKElJw9pl0s= 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=Zr8YpSSk; arc=fail smtp.client-ip=52.101.228.37 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="Zr8YpSSk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L1eUFVUdiGAJ8XcPfzRxOk5is4lSlAMP8Aytdp2yvafPiz4HHnO/68sAjbTGCkr5PF6AqOLbOYMrScJsBbQNciNoIwC9xHIeMwiIxGKt2vg8WBYaVcaAKWY3AKfAX6O+A33gkhlK9E7t3EZ4GxDS050tXF6vcfXepcapAkz6Qz7naZNx28keVupmizxIcAgdohgZss8oiTzo0ooEk8MROaxz8FXet0saUx+suG316zhITxInZ6aMzaRqPM24Kxjsd4VV7V20JNQ1tmXVbTVP/KheMoRk9T4zd6u4r/RwFIZ4I+dUJ4FMV1YbQGtbIHdWOGqw+S5eGy3V6+iQa1aL/w== 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=gWAD8qw5BaN/waNwxRr5RIrv8DsM0KLGkweaYwneCbg=; b=aYoBTJCJdx2XDgpYRgzmvFgqQJ3MGqNi1a8AqwZYgpiszIq2uwWjTx/oSfARWyO//u5QpeWaL9kWFWaF+9P2bKsK7ON/irRQaA9telF7t4qnLu1ciz1rx8eStFDMkRGHZrEqIfoOmRqDkBWZpN6DYBLbWNFVscwiBTCgzvCC0gFelecCH+O/BroH0PcYT5K4nmdbfMkZS0JdLi+inK1faXPuZN488AuZUO8i34EQAz540JTNUC8SAmzRm1GCWBTwWL6ThHSg7rCe05UpjmqoJT3zoMbJPyRVy2PD6/E8Zzom/lNWXyCnPqLeHQGjOOXue8eQV5Fq+pFg+MwxZ3abgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=gWAD8qw5BaN/waNwxRr5RIrv8DsM0KLGkweaYwneCbg=; b=Zr8YpSSkZ33tj/BERxtY/LG7zVR6uhHO+zmQNXj5D8XUzxhaIZ9w354eGpiZGmY//72c9nnOqYbdbKVxektuGeEAcUiRJipsoY9PpAShhn+ZhchQfP1ECS+2FFalYh8gArfL9KPiU21NP0xi2OLA3pyry+aMYqPfn91f2R6kgfo= Received: from TYCP301CA0063.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:7d::8) by OS7PR01MB17560.jpnprd01.prod.outlook.com (2603:1096:604:443::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.6; Tue, 8 Sep 2026 16:44:16 +0000 Received: from TY2PEPF00005622.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:7d:cafe::8d) by TYCP301CA0063.outlook.office365.com (2603:1096:405:7d::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.7 via Frontend Transport; Tue, 8 Sep 2026 16:44:16 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by TY2PEPF00005622.mail.protection.outlook.com (10.167.240.53) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:44:15 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id B178B30001C0; Wed, 9 Sep 2026 01:44:09 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 6/7] selftests: drv-net: Move _set_ethtool_feat() into lib Date: Tue, 8 Sep 2026 16:43:08 +0000 Message-ID: <20260908164309.59282-7-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: TY2PEPF00005622:EE_|OS7PR01MB17560:EE_ X-MS-Office365-Filtering-Correlation-Id: 832820ef-ad43-443c-3b56-08df0dc86b52 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|23010399003|36860700016|82310400026|921020|6133799003|10067099003|56012099006|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: WXQwnaIArYSnWPaUGzZuTDsmzoCf05kh2zDFj9WRlhzAYnDtOLvtM+AurXP7mc9kU4L//tJGmMDFv71Ny8nAo4F1lsdlc85Z3fS3sPui04QYJeUDoZNE89CKpb+BiuTeDO6QCErzzdKgAsdPpSp+8q79vtbFjWn1yUXF1ogqcSqUSMQzSEBSkGa/YAXX7APILCU4ENSvotTS9Xq8IO/DVyxX9hyThE3+LvcsZuQKYP3s4WV5O9SM0tRot86cltstu4iyBbtoxVOZhw5FQlX6hKdYI2gFwr+H9t1uFqRtJZVQ1fFEE6f9KH13WeMthlUlF/gp/ShbecgBZRJ1kdTMXsNGxkWr6dd2m3DngUwj3KryjqdHxPITsHSC6IJ76QmSEVlO8jMzQglwKFw3CC3Z0jucD0AIFptTVwNRCXFlADu8jdpJ0UVbVW/K9Ak55fqbMk+LlTL9z2QOO0OIWaiGdpAsCKVQuW7ZE9HIkvEXvGtyvtfQr0yZLCAJhqV/3OGK7nvMIkyUncGH6De1htqfcRMgaf2Bnk/diS5IZh/GrYnksxlay+IUnZ8aXQI3TQoSXDbVICHcqOFHGdnJJ6qklZd28z0kevVT4rSIOxJUYNPi+8lTQ9oz/dJJY9Q49nom7ilr7athuxIeCFq01aW3OdS6yeDrN2M+8NVeP7w6F6d3PQvnFe6xJEjt9wqs//cMzsd7DChmoSRhosvyX3PBhHFcwOI1nsfzPF0WsVqOffS2YDgnHjPH69vx8VEtxYyO X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(23010399003)(36860700016)(82310400026)(921020)(6133799003)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fDanfeSoWNgSSnsrVvigQ0+HlGiugkeAW2jG4CR/CdkXDAre/T1z/dtjIgK42VeJLUPtKmMQ7Sy7sN/Wa51XrmNf+Qi+dial5eVZr1/26erDWFFYNbYhHI55fPkKMKz8kAgRj+c7ceo1VttabZY2aryrzSawmgPbCFsr8S6n6GAM8R1LRnNHEO0XdDz6Gi7pgW0vgjCKCVR/NieN38HrL5ZNj0TdgOWSA1oF83ZEMobr/7TpwIx3ht/nBceRfvNLPX2yIZqNeBHiHDWF9yUEvfB8Kv4PS5o18KvZjmMnBWYPMr9hnPMYo115FGlZ6FdCXd7jGHLgkGD4Ozj5BNoB1eeFhNCdHHs28jnBhA/2yCLV0FYOzKknVqXaHeE1x/dSByM2BoEZOTEoMdIi3jiknd7tahL3R5wHukfAWXjCqF6fvLkkZSHPb0W4JBB4D3Wp X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:44:15.4572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 832820ef-ad43-443c-3b56-08df0dc86b52 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: TY2PEPF00005622.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS7PR01MB17560 Content-Type: text/plain; charset="utf-8" Move the _set_ethtool_feat() helper from gro.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 --- v4 changes: None. v3 changes: - Fixed "ruff check" and "pylint --disable=3DR" warnings reported for tools/testing/selftests/drivers/net/lib/py/feat.py. v2 changes: - New patch. tools/testing/selftests/drivers/net/gro.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.py b/tools/testing/sel= ftests/drivers/net/gro.py index 6ab8c97880d1..051a3b2d0ead 100755 --- a/tools/testing/selftests/drivers/net/gro.py +++ b/tools/testing/selftests/drivers/net/gro.py @@ -42,7 +42,7 @@ import re from lib.py import ksft_run, ksft_exit, ksft_pr from lib.py import NetDrvEpEnv, KsftFailEx, KsftXfailEx from lib.py import NetdevFamily, EthtoolFamily -from lib.py import bkg, cmd, defer, ethtool, ip +from lib.py import bkg, cmd, defer, ethtool, ip, set_ethtool_feat from lib.py import ksft_variants, KsftNamedVariant =20 =20 @@ -96,31 +96,6 @@ def _set_mtu_restore(dev, mtu, host): defer(ip, f"link set dev {dev['ifname']} mtu {dev['mtu']}", host= =3Dhost) =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() @@ -247,15 +222,15 @@ def _setup(cfg, mode, test_name): _write_defer_restore(cfg, flush_path, "200000", defer_undo=3DTrue) _write_defer_restore(cfg, irq_path, "10", defer_undo=3DTrue) =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 @@ -270,27 +245,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 8a58cb17cc06..eea45d01cf7b 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 ee903bcf3207..c261aac2b976 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..014971c82b4b --- /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 lib.py 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 Fri Sep 25 20:48:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010058.outbound.protection.outlook.com [52.101.229.58]) (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 6552257EDAF; Tue, 8 Sep 2026 16:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885869; cv=fail; b=HL+gUaTgyoVHLmHh1F4BfVXATg06iPbXFyRI0+j5WdpImj3niZrtZ0EhhW9OWENuQMn/rNLdoWbGPPmTRnDnin83m7tATRyay/wr9YuUedF+9+uxcUiHOVjVxAWSu87FI83n9GkvWiOq3+ct45496eEsVH2a3Kf7sSCxycaCQ8w= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788885869; c=relaxed/simple; bh=09dp8X3AJMYPBZ7VW0mJTIq50woDDof0FDOA42klLqE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Zxuy8m1MRHWv0vGLFqOizLuG/g2qNYlqkVD9jkXyN08u8CzTcTns2BOxyDvUmbc9rjMegDqRDMnZH1R9a1uDb7jekeLHX1NKVOPC1FPY/MbCx9jd9V49odpXWsOTnMrOeg/7uks8u7KxmXNP4JyeF+exFPPoXO6jk5LwMcflnzs= 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=HcdixOQX; arc=fail smtp.client-ip=52.101.229.58 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="HcdixOQX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LyKF2ahna5YVrgPA/zZHdJJ27TCCuCwSOevqy16fY3GJmcgHH4jy3SZuSTwin1mSzQIayAbaI8IPlJSAuWRYU3xcz7ZrJegQ4oXf8MtLhZgBC+A/KzuBChHY23eYTfjnR4EBqV+stmc7AADLT4CTo4AucUmdy7laL6JImsw4LzMurc8aguQuFfjx/EU0B64MCjvUTy5WebC/cVvMCSOfSCdHETz57Zza1xOuawPjJVnEiHr8KQdk8b+ul0hFtah7KfjcwZV0RnTLOnoxryicxePdlEly18koO6NzNOHJMldqaBGsGSd9eLQ05hlz4tQmpPJB11ZjCJp/+av1W9wr4A== 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=rAICVZ4NbDIwbfYPAkXbmJvoFZIDSnBoGcO7k7jyk9U=; b=kgc+SD3BUxX5ALiHh19wrEeq6WmBSOEP174MYEx2TnI6fwWdQfoSeGYA/AxcvJemfsxZRbNt/c2Me0dvxUB/+2JIFnxagNdT8VG+59iianCBOkHq6CC8POJ51LqrgcczvHVdyhNrwuyDRbtRaV9SGoShTGgXrkl3Mia6nzd642toViNyLYPcq8kJwz9JDt+bidixhc5F1FBhca1SGGB6/bqUIT1IAXLG+Q/rXV/gdMdYiDo5edQEqfwd7nyor2hzsICw7CvFgLFcWO1tMN4gBq1dHNAGoIQDWfK37TwTKGn4jxShy/dm7Eg260rII6E42yg0RhOcMGd5x37kPr7REw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 8.62.32.50) smtp.rcpttodomain=bootlin.com 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=rAICVZ4NbDIwbfYPAkXbmJvoFZIDSnBoGcO7k7jyk9U=; b=HcdixOQXrelVAmviumiAr2iw7tgmwDxHbOw/HIsl71vo47lb+Ev8MUO6rURiI0iq+1vjZ/i26XdD4Ugya9lg9qsGAFaWfKzYCTqUL7XWZQeG4VuwdPm98D052LIPbUn7Ui09WN0TLgFzIBcYmz75pzQ1GKk0/y492BeMaXcDW2c= Received: from OS7PR01CA0280.jpnprd01.prod.outlook.com (2603:1096:604:259::14) by OSCPR01MB14484.jpnprd01.prod.outlook.com (2603:1096:604:3a1::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.406.7; Tue, 8 Sep 2026 16:44:23 +0000 Received: from OS3PEPF0000003C.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:259:cafe::17) by OS7PR01CA0280.outlook.office365.com (2603:1096:604:259::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.7 via Frontend Transport; Tue, 8 Sep 2026 16:44:23 +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=ejcrelay005p.adwin.renesas.com; pr=E Received: from ejcrelay005p.adwin.renesas.com (8.62.32.50) by OS3PEPF0000003C.mail.protection.outlook.com (10.167.240.5) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.406.5 via Frontend Transport; Tue, 8 Sep 2026 16:44:21 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.55]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id E7F05300044D; Wed, 9 Sep 2026 01:44:15 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.com, recv.jo@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, shuah@kernel.org, joabreu@synopsys.com, yi.fang.gan@intel.com, jun.ann.lai@intel.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kselftest@vger.kernel.org, Ovidiu Panait Subject: [PATCH net v4 7/7] selftests: drv-net: Add VLAN test Date: Tue, 8 Sep 2026 16:43:09 +0000 Message-ID: <20260908164309.59282-8-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260908164309.59282-1-ovidiu.panait.rb@renesas.com> References: <20260908164309.59282-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: OS3PEPF0000003C:EE_|OSCPR01MB14484:EE_ X-MS-Office365-Filtering-Correlation-Id: 6c588b0e-839b-4310-f279-08df0dc86f1a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|23010399003|36860700016|82310400026|921020|6133799003|3023799007|10067099003|56012099006|11063799006|18002099003|22082099003; X-Microsoft-Antispam-Message-Info: yRV7CizHD6mG0YbmnqILp67ZM8Zi9OnWoaZvDFHUJJfu44necKYtTlFn96Wn6d8RNeIdRFY0ltvE4vGlXN+pPj6L64TaqmS4vPQAS/0DbzibBTTrH02ibHHGSHvCfBzQGsB/xyn1OjAFurQ7TY3Kj8vC3aJG7xSrSls2oy79SmBK2RaU9oGMyVHomRutudXdM1GKhLPVBbZp9EzL1BeQVun3LaUFBPynDFFK5osJrVSpYBfBUrBFbUGAz7VEr7xXqnhPexGZJ11t0CB0o+OaYgWUPxUrzRQhHKUVOph5Jcvxsyg5JSbXz1Pjp3iU3HKa4jV9SH73g+CdDVX/y4JNE8m0Noyx6wppcrdWRnd9OpnAtp/bBh09Q1qz5p7OnmkfJvUZYaPIELmTLvFtFnTZwP/RsXHzu6x3XrE3i0jA7T7ZmdZ4gqCpcN55ekHl7xL8ct8VNJW1iENPgG6hFe9tkM9qkiAWFZZmMycteRyzuFMNI3fRT6vv4OFcpNkp1ejuKFMtAu3EnKCdNhXk8HbHakj3P5UgY4m3BblpijM6dGPE5XBHutTF8TGPFC9nL5cYj2aLSLS1/JIGs8yTc+ZTdI8T4UEU/QXq1+2Y6eVVIIRvBUayfLyWeikIxJ1Z7uyerQYIkY57X6Y4EZCsSS63ti8cF778Xzra+UekBcK66OHtqItFy2ObnfCWmjADKXC/wbyvpKd9vavv0zmzPuVhtjVVFQQ8bDc1NPXl/dL6prnDmLsnRNqdzZMyqiI8YrOj X-Forefront-Antispam-Report: CIP:8.62.32.50;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ejcrelay005p.adwin.renesas.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(23010399003)(36860700016)(82310400026)(921020)(6133799003)(3023799007)(10067099003)(56012099006)(11063799006)(18002099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: odys+Z66v5DznPavNkLCNpsol97t9HMcFLE3NX1U5JhyjQbjYq1i7TnPO4SScR2oaDjqwT1vBUcJws3KQOR9rkEIVLcG9ccrZ6SvKH9VPIIK7Y/tFc84ks4YHMlC623ixoZGQ6gCgWu5b+AHKaQUX8HrFKsw9jRfQFd4N2926WcGwHc+GLpvjwZki4SYpN0GGpnD9lp8Ud5uIDcJT62ZKagtepdaw60Fr2V9mMMxuho0rMQPwbM46CJPye3Hrd0wAU0clTPRRHN4yWIwccaWCf+dmKA5hR6heYpeNfAXd7LDLRW/ZSWoV2Ar+GAXsr64oCNRbI63XxQi/8mWqJdDiSpsDDC/43UXN/o/ZZyI6yQICb132cwL1fKl7x8Ni85UxPCUjm3MceFNOOejBA81dXKHduYatOxxM0I5jOXshCYyrIsy+sugAqbDI5OHyIrF X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2026 16:44:21.7934 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6c588b0e-839b-4310-f279-08df0dc86f1a 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=[ejcrelay005p.adwin.renesas.com] X-MS-Exchange-CrossTenant-AuthSource: OS3PEPF0000003C.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSCPR01MB14484 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 test is xfailed when a specific feature cannot be changed. VLAN insertion offloads are not tested for now. NETIF=3Dend1 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: end1, 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 # XFAIL Device does not support rx-vlan-stag-hw= -parse # ok 4 vlan.test.8021ad_sw # ok 5 vlan.test.qinq_hw # XFAIL Device does not support rx-vlan-stag-hw-p= arse # ok 6 vlan.test.qinq_sw # # Totals: pass:4 fail:0 xfail:2 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 --- v4 changes: - Toggle rx-vlan-stag-hw-parse for the 802.1ad and QinQ variants. - Updated the commit message and docstrings. v3 changes: - Moved the selftest to drivers/net/hw, as the _hw variants couldn't run under netdevsim. - Fixed "ruff check" and "pylint --disable=3DR" warnings. - Added CONFIG_VLAN_8021Q=3Dm to configs file. v2 changes: - New patch. .../testing/selftests/drivers/net/hw/Makefile | 1 + tools/testing/selftests/drivers/net/hw/config | 1 + .../testing/selftests/drivers/net/hw/vlan.py | 112 ++++++++++++++++++ 3 files changed, 114 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 78bb0169350b..886a4222c6cf 100644 --- a/tools/testing/selftests/drivers/net/hw/Makefile +++ b/tools/testing/selftests/drivers/net/hw/Makefile @@ -49,6 +49,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..61fa452b95bd --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/vlan.py @@ -0,0 +1,112 @@ +#!/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. + +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, + 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 "198.51.100.1" +REMOTE_IP =3D "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.""" + + feat =3D ethtool(f"-k {cfg.ifname}", json=3DTrue)[0] + feats =3D {"rx-vlan-offload": hw_strip} + if outer_proto =3D=3D "802.1ad": + feats["rx-vlan-stag-hw-parse"] =3D hw_strip + 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""" + + cfg.require_ipver("4") + + _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