From nobody Mon Sep 28 06:35:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010064.outbound.protection.outlook.com [52.101.229.64]) (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 46BC32931F5; Tue, 25 Aug 2026 16:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676379; cv=fail; b=Lp4dFUeHw8bQdZ5hEAO4PmR7YbM0rzhDtMBcwlKE9VDXoucMzRlOrraKVDYKbC7l1B9giRSzsM7iwpcmZXuvxPr3vl+0sptaG/VBXUsdjthdpp48kBRVfm171gh1xR+7ZenznBDU7W7WAXi1TihSJKiPf8gU0joEpF5zE6gFuXA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676379; c=relaxed/simple; bh=VTxojgoVBJlBMHHQEnAG4xdAA2ENp/FwlwqsWI9nsdI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=btpPMYukIJBnn+hbFDns5MlJ0d0j0Ck1wkflRuGAzsYB/XnVA2RH+ymy4b393PQE4bunJTcmJ+gOCK9QXpw2jtey5ibgdPE+U5myCcIyyztTSPCQlRq0+gfl42thhKTP217zFBeOz8A9UqSmcQ1DyJhpOFNOvDouzIp0hKDZu94= 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=WZc0O3rG; arc=fail smtp.client-ip=52.101.229.64 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="WZc0O3rG" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lY6a3UT/JgIb5oWrBiTK084koG2D/VRGrNU8VDKEdJFguKtv9hgyw+awdY3VDfzDdaCjP/agXmWuXsRgSLu5rT/Wi0Q8j9wnSMG85mgxkzegFLTpTX1byCz7O8rYrm/XtWjEOcFpw3xfk6+9wStqNsSNE9T3t6hgIWsBJpnKC9pWahmLKAkZh0ymLz+Ck4G7F/3P6lA/MamTz63HcFa/WJBwnM96XR+mZzT3gkQec2geMPQqfKLGudi9cevgqy/17F+AfraIFJXuc/wSWjy5WHcn0YOTJXssTaJiUXCA8kfHSJVBSb0AfSQgLz4Na5lA9z9iANYQfXDaLwrdAhDKwA== 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=yNCjUhefoBpAluzPAVyMabIzwWCLiuDCKhXuni5gct4=; b=WnwzqytpADBnX9aJAfBl4t53fSlF3CVwCgrGakCSruZ316HbaIMSzPtDpNzoXr/tNO/xENdZk+s0xQ/1fQJgU6VUjtFAQ5TIEzA4Ru3z6ZnCtEO3V2YXVSBKhahTP1nT+MWBtXvOPxp0YSbqoJ+7PoO5jfhqkQ7OPlpQTKk2PJ4iSgc6xf/t+Jj2VU+6yK9yIhM/LctWPFV94+WfReEDiFnIiedVmtYrUKUtT/KTXd4IMz3ST6rE4B0GUt49UENJa5mieIih2NMil76+tJ6RL6V3vEJXy8tNmhv9Z1+9FSPKuahNETi9b/d9euidZcFTHJhdqFgXREQelIa/neVoqw== 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=yNCjUhefoBpAluzPAVyMabIzwWCLiuDCKhXuni5gct4=; b=WZc0O3rGFy5i1QQ1LJytGYJ9WZJY5LUqQs6a09s4W+tkj3cbwYQKJetNIsbfJ6YmWUOCKyV/NtggrMXvZZgKy7vSBpdp0ORrFrspLyKJ365zHX4CxUXf+3/WL7PSdOGmBlS6kR5ad45lkfu+zteRZgxsB2gZHM4qd8Ln4zpfxOw= Received: from OS0P286CA0135.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:16b::20) by TY4PR01MB17209.jpnprd01.prod.outlook.com (2603:1096:405:334::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Tue, 25 Aug 2026 16:46:13 +0000 Received: from OS1PEPF0000D216.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:16b:cafe::86) by OS0P286CA0135.outlook.office365.com (2603:1096:604:16b::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.7 via Frontend Transport; Tue, 25 Aug 2026 16:46:13 +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 OS1PEPF0000D216.mail.protection.outlook.com (10.167.240.23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 16:46:12 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.185]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 525C330001CB; Wed, 26 Aug 2026 01:46:06 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.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, jun.ann.lai@intel.com, yi.fang.gan@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 v3 1/5] net: stmmac: Remove VLAN perfect matching dead code Date: Tue, 25 Aug 2026 16:45:18 +0000 Message-ID: <20260825164522.4244-2-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825164522.4244-1-ovidiu.panait.rb@renesas.com> References: <20260825164522.4244-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: OS1PEPF0000D216:EE_|TY4PR01MB17209:EE_ X-MS-Office365-Filtering-Correlation-Id: 695bef9b-70bf-495f-6b1a-08df02c85f1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|23010399003|36860700016|7416014|1800799024|376014|921020|11063799006|10067099003|56012099006|22082099003|18002099003; X-Microsoft-Antispam-Message-Info: hbOJjgd19VR19P+Qg7Y65Zr3x5bAE8ikpe6p+zilpID0/c8buaZ0YeLXxtue4aGtCsa3xCtF9xfpPXBQQb8Ghn26t+3pBreb24rfmNaOk5flek/pBO8sHZhtyMUDfO0DmhUFVoed0Xg5ua9rWTAwrqhS+yYIzQDkYyQ/uBjJMJRUuhKWMKzyOYi8rLexgW4yiQx+jzmbhs4A0pwoxRQC1O8jTMRvgu43zzefiPY/Bx1LcCkQz1pbeH3Ax5z9KQnJZ7u9MzH5PldzcXbBMjkDfy/YtnOu3RDHOP1rjldILU3PUoUCwQhGsDYkZtnscUHAVgDV4vFz2WUj27i70Nwj85FtF2eY/vVRrajg5+Q3G7eKEHBHiBVrNrMD05yTq66Yz/FlLOSMH2ZuvtFdecs0MmLC5uFqEVRUHOpa8CZu73WHLIMPi2Hx3r7I2cSZzoaio7JAwCTlD50AhZ/VCreD2ky6nhCwVQYNuh4urRE161sPuzhIexgIv1nFTeR/po7PHTLr3cW2YTntZMbWCCJcTz0bfdOGpInz/c5taH1+x9NIGGCr3GFl97LqfL9iAZZZ/DpSE8DPUagWGVvVi3U+s/IOdq3G50KgfnICHPjsDO8e8hGPIAqEqnl9jyA6NsDgqXKDgx5Z+DqYm19VyMKNm3ByO75YBytC7govJBOtSgVQPNx3sf6QUCPCn8PKi5f0d6K6GAmnN/XRFLXqPGD0NQBjtMobaFgj4aLLm6eznM6xqpUFOtRTA7KFHdbuo83H 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)(23010399003)(36860700016)(7416014)(1800799024)(376014)(921020)(11063799006)(10067099003)(56012099006)(22082099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eNx+g/BVxbKX55N2GWAEWMWj3CxMgCVFufREHpnK7Jtiv10wWqHuuztw/ymXAbFOnmoUmQe5BfN86cJy/NvRJ0GJxtCWjQ5WWJq0PhW44zipLopQaLzGPj4R8U4RYAFtH9RRg8dgHTgV202HOmVkB7x39nU0HiDKLobGzYsCL2Zv/a+BlCZ2tS4yaj3V1VB24+qROFMvNHZcBtdh2sYvjMh5V7xfVSblvOMJ+mbg9of1Ch3A1TdjZOCmKpBXyAFc4JRbpcqYWVBvEBcvvS9F9/4G6efTqEN6b1tS0ENnr3KhPnltO5VOFSgCOH/5JAOkVMALce9qn3OoVQ9ksxkhah4GPvwvSubN7zMMzzjjke5fx+NJGmqcmrJjlUQDwmQSVq6MvNQCpddBE0dSB5EgFWsonX/NEfyVHMpIlmLDS0TE770vyBxdPjv5oTecSFzt X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 16:46:12.1868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 695bef9b-70bf-495f-6b1a-08df02c85f1f 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: OS1PEPF0000D216.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY4PR01MB17209 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 --- 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 b2b7d0242dd3..16fe56a1f617 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6809,29 +6809,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 Mon Sep 28 06:35:39 2026 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011023.outbound.protection.outlook.com [52.101.125.23]) (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 C29B0383C83; Tue, 25 Aug 2026 16:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.23 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676390; cv=fail; b=b40JwwDCida8qK+zaTIQGoDO5hoKjCoIEjsPRh2A0gChwyDcx03+g9iBRl7IXZga0H8NJt8/c1+b2ijKqsKtf5q5txDMoBwvOpuZXVls9ZkNEhut8lz9tQ3/6vqyyuAdss99ftrVECnv4o5+uyBqGX/EborhRrMry1UNcrhAXNo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676390; c=relaxed/simple; bh=JzTust4gedoUs6WCQzgElpORrTpcI4ljTzxjoNG9UaI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k57zreXiJ/r40HZN1LMtggnFUBwOfsFGaAdyji7TPPOYjTscF3ekdpEHxx+dsgtZ+HmegXKg4gJx6U1XRPaA/pwFScRtLeEP8YmL+xA5UAWHe9dGlJNKP7zQNoy7Qt7CNe9Bu8luFfSC3hvBcef11vWKyIDtN2xrVxsLClk1cDM= 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=Up8vUiKc; arc=fail smtp.client-ip=52.101.125.23 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="Up8vUiKc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZbqZLsFR6q8IwZnI4RDQEIXRanApZvYj9kp/exH/qtZaYgBL6WcbfNHNQ77kljTla21RJMef9BTsBMcBP8didehUSi5gU+5Ocsilo3ipn7xi+OeiG7GjHNbUXdjF81qiRJ/TQYFpCVUk7LqXnQptm/EyH0LRH93qdBaOz/bEueVA6gFu+l11OzV+piwsvYQglZPbgIBECPD5Hu1/a31dAA8cXt+Jo/YN7K7te3DKVUouNqsBjjPGYP9ucX1TGTj9+/zdpaTTaDxYoObxcigdtCUjCLk8k3o60NjQGRLHa/ZL8DrW1bwI35QFn0Zpy4CZuPPf8SsiVcBHcinTsqlhuw== 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=7DbbL2ptfkQyCFOAtwfIdRZAHeTGITuogdBaiB787SQ=; b=mBoPq0vnfYVM7F9Z2yoKXQV6032LX5dyvuYBsb0+xFGPyVfGeJGVbkMqhnFcuh+uLbt77wmZQYCY3wHfxpSyUsKigSqQadyySxDgahYtQA8goGEr6PjuOcmkojPvfoX72u08ORvjOjqoADfGW6NwbvMOVts4+Hn05KWnGYwzegLS0BbXhSCuj57NY3zZexkMJ4Udq6yyvZKoj38IzFZw0c4NVxT9YjIITLaxL3m5PMOA+LSB7ZApJwm9NA6gQJTT0F39JZtBOgtdPy2OnKzvDrQr/Jz+AZhujDxwNhjG425evMQr17MCPpxJ5YLPhIvvRQmkPm0Uj1Vj2jXp2CrsdA== 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=7DbbL2ptfkQyCFOAtwfIdRZAHeTGITuogdBaiB787SQ=; b=Up8vUiKcU43ufk0KA7ktttGS7yfE8vlhKef+uE77e1kZW4+VN8owtkgoqbuL9q9FrxO4P+vqFT4wJ12Yyc5FVrRiah3SRHZBWcq2N3eJVvPcW+Cq1oCPbrKh+DZ726/u4mzdpMX8ATSQ2AnO0fX7ZL+yiLiW35rtD7hr3fRKSq0= Received: from OSTPR01CA0056.jpnprd01.prod.outlook.com (2603:1096:604:222::20) by TYVPR01MB10815.jpnprd01.prod.outlook.com (2603:1096:400:2aa::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.7; Tue, 25 Aug 2026 16:46:18 +0000 Received: from OS1PEPF0000D20E.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:222:cafe::7c) by OSTPR01CA0056.outlook.office365.com (2603:1096:604:222::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.7 via Frontend Transport; Tue, 25 Aug 2026 16:46:18 +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 OS1PEPF0000D20E.mail.protection.outlook.com (10.167.240.37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 16:46:18 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.185]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 77F8E30001CA; Wed, 26 Aug 2026 01:46:12 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.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, jun.ann.lai@intel.com, yi.fang.gan@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 v3 2/5] net: stmmac: Move double VLAN handling to a dedicated op Date: Tue, 25 Aug 2026 16:45:19 +0000 Message-ID: <20260825164522.4244-3-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825164522.4244-1-ovidiu.panait.rb@renesas.com> References: <20260825164522.4244-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: OS1PEPF0000D20E:EE_|TYVPR01MB10815:EE_ X-MS-Office365-Filtering-Correlation-Id: 97ee0ac6-8d6a-4093-539b-08df02c862b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|7416014|376014|23010399003|921020|18002099003|22082099003|10067099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: ueBvlJendqFYxS5yU18NxHH8B0aGP1AUAEW3yo3JgOM/VcBrJsTXw41uNGzvPvHjn4nZbdb5jURI8uxZem6e3hRQq8WYWUaXCDONyce7pdrZlrasqcAtRd4UFLMk0mhVl0pReNwH9PGPDly+EDl1h4l7aWnVXfSf0qkK1ao0Q1UIyPzL8HT1QZnQ5pX6MaVCTtL4WNwUhbnQA9OysprbuesZZhTvn86cWe3pKQQJC4VUoMxss+nE6Q9XzViL6hKnsLwOQhfCpsgP5ZHx4zIDBQ5h1+HaKvXYRILtK/9oEh/hyBgtZgtkp4uhbk71iaIjBPaC12zgSxkq2SEO3UzYe9sR4pTkvofAmhnZVrQ3FJkEoeIPUcvs7hj2Mwp9AK58guEJ6+joBAwhUaNQtMlGxkof/NP1A9n9sL9mSsyqff8FfHhFmKFsWEui0RIuSqFSovTKRsgBekIb3RHBlmUrch0mjNrcij2GkTY7bepTFsn6syL6NwTMMY25eQhA6De3+d+QW3IvLcKUYk+anZNc2aSZp54AD5TiiGpQy26WNDbvyDpdiWGhgAfslNVefXUK0FuKjiDPFaXlB0pMoh+5FFqQN0bTdZzJ1T+tlCaODz5YbD8WLMggnYqB1kdKZRNG7D5u0g1Nrikj3Faz6H1g/2340NU6kbjRJWko31hhAm79xNRN6UwI+Sj9UJiy0T8qYk7XJoTDZ1zV1eC1oQqPe4Nfgqm42Q6/RnegWMnY13j6dru0tO4Ime9ud3oMsIqy 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)(36860700016)(82310400026)(7416014)(376014)(23010399003)(921020)(18002099003)(22082099003)(10067099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B9EBrKKmwuxWnecd8jJHZn+ucV/FVsdXAMO9HsV+Yqyuha2u7l6umU5dA1mccsHtTx4ihIgnSMOjW1BmV8TIHQ8757UfQ6xqpPg9wx6XAJcaXJF+xTMZDndg05o2CP6IFRTJ5jBfi9YOzuIvFLSP/2BHhnb7zZy0faTsNQgoB60dZYQxmsujVLAdOEA57uj29a52u+A8vt/X7TdvRWlW9v9KhiecMMAGAIEeaNcQnaCmbtTUozV/ARIqefFOrzavTNZLFGnT/l2HycNr2cHAvAoc6MF32ysiLC88Ejr+mrq9jg3UCkQLJdreZKhf/Ydk4K63wrSuf3nzkmC6npvuIIHpO+/Ne0wyy3Mh0yhP3E8c0JhHros+6Vk9TB7vSA16+wPUO5W+fiZx4KO4UkeQgb5Anqk97FSMqH4H/DILJuNNxrpSa7jXGyc/7PPncnYz X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 16:46:18.2028 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97ee0ac6-8d6a-4093-539b-08df02c862b5 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: OS1PEPF0000D20E.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYVPR01MB10815 Content-Type: text/plain; charset="utf-8" The double VLAN bits (EDVLP, ESVL, DOVLTC) are currently handled inside update_vlan_hash(). This ties the double VLAN state to the hash filter update, even though the two features are independent: hash filtering is controlled by dma_cap.vlhash and double vlan by dma_cap.dvlan. In preparation for removing double vlan support from dwmac4, move the double vlan logic into a separate update_dvlan_state() VLAN operation. Signed-off-by: Ovidiu Panait Reviewed-by: Maxime Chevallier --- v3 changes: - Rebased after dropping the dma_cap.dvlan patch. - Added "Reviewed-by" tag from Maxime. v2 changes: None. drivers/net/ethernet/stmicro/stmmac/hwif.h | 6 ++- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +- .../net/ethernet/stmicro/stmmac/stmmac_vlan.c | 45 ++++++++----------- 3 files changed, 25 insertions(+), 30 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ether= net/stmicro/stmmac/hwif.h index 6f26dbf95ce1..66837caafa84 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -632,8 +632,8 @@ 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 (*update_dvlan_state)(struct mac_device_info *hw, bool enable); 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); @@ -650,6 +650,8 @@ struct stmmac_vlan_ops { =20 #define stmmac_update_vlan_hash(__priv, __args...) \ stmmac_do_void_callback(__priv, vlan, update_vlan_hash, __args) +#define stmmac_update_dvlan_state(__priv, __args...) \ + stmmac_do_void_callback(__priv, vlan, update_dvlan_state, __args) #define stmmac_enable_vlan(__priv, __args...) \ stmmac_do_void_callback(__priv, vlan, enable_vlan, __args) #define stmmac_rx_hw_vlan(__priv, __args...) \ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index 16fe56a1f617..e79b37fc716c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6820,7 +6820,9 @@ 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); + stmmac_update_dvlan_state(priv, priv->hw, 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 diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_vlan.c index 983a90cb9767..1e47ae62093e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -161,8 +161,20 @@ 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_dvlan_state(struct mac_device_info *hw, bool enabl= e) +{ + void __iomem *ioaddr =3D hw->pcsr; + u32 value; + + value =3D readl(ioaddr + VLAN_TAG); + if (enable) + value |=3D VLAN_EDVLP | VLAN_ESVL | VLAN_DOVLTC; + else + value &=3D ~(VLAN_EDVLP | VLAN_ESVL | VLAN_DOVLTC); + writel(value, ioaddr + VLAN_TAG); +} + +static void vlan_update_hash(struct mac_device_info *hw, u32 hash) { void __iomem *ioaddr =3D hw->pcsr; u32 value; @@ -173,21 +185,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_EDVLP; - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_EDVLP; - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } - writel(value, ioaddr + VLAN_TAG); } else { value &=3D ~(VLAN_VTHM | VLAN_ETV); - value &=3D ~(VLAN_EDVLP | VLAN_ESVL); - value &=3D ~VLAN_DOVLTC; value &=3D ~VLAN_VID; =20 writel(value, ioaddr + VLAN_TAG); @@ -236,8 +236,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 @@ -253,15 +252,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_EDVLP; - value |=3D VLAN_ESVL; - value |=3D VLAN_DOVLTC; - } else { - value &=3D ~VLAN_EDVLP; - value &=3D ~VLAN_ESVL; - value &=3D ~VLAN_DOVLTC; - } =20 value &=3D ~VLAN_VID; writel(value, ioaddr + VLAN_TAG); @@ -275,8 +265,6 @@ static void dwxgmac2_update_vlan_hash(struct mac_device= _info *hw, u32 hash, value =3D readl(ioaddr + VLAN_TAG); =20 value &=3D ~(VLAN_VTHM | VLAN_ETV); - value &=3D ~(VLAN_EDVLP | VLAN_ESVL); - value &=3D ~VLAN_DOVLTC; value &=3D ~VLAN_VID; =20 writel(value, ioaddr + VLAN_TAG); @@ -285,6 +273,7 @@ static void dwxgmac2_update_vlan_hash(struct mac_device= _info *hw, u32 hash, =20 const struct stmmac_vlan_ops dwmac_vlan_ops =3D { .update_vlan_hash =3D vlan_update_hash, + .update_dvlan_state =3D vlan_update_dvlan_state, .enable_vlan =3D vlan_enable, .add_hw_vlan_rx_fltr =3D vlan_add_hw_rx_fltr, .del_hw_vlan_rx_fltr =3D vlan_del_hw_rx_fltr, @@ -295,11 +284,13 @@ const struct stmmac_vlan_ops dwmac_vlan_ops =3D { =20 const struct stmmac_vlan_ops dwxlgmac2_vlan_ops =3D { .update_vlan_hash =3D dwxgmac2_update_vlan_hash, + .update_dvlan_state =3D vlan_update_dvlan_state, .enable_vlan =3D vlan_enable, }; =20 const struct stmmac_vlan_ops dwxgmac210_vlan_ops =3D { .update_vlan_hash =3D dwxgmac2_update_vlan_hash, + .update_dvlan_state =3D vlan_update_dvlan_state, .enable_vlan =3D vlan_enable, .add_hw_vlan_rx_fltr =3D vlan_add_hw_rx_fltr, .del_hw_vlan_rx_fltr =3D vlan_del_hw_rx_fltr, --=20 2.34.1 From nobody Mon Sep 28 06:35:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010008.outbound.protection.outlook.com [52.101.229.8]) (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 1D31538F654; Tue, 25 Aug 2026 16:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.8 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676390; cv=fail; b=PiLuGuL9xQ3PnmP/aKgalpsuELe7j0DYrDANSU9pjL5JLofJW4yN719AcPlCi4SNPcix+ZbL73SN+U+caKDD8pb7aClaHCloHX5O8QE9ernXUvvIMAb51qnDQ20FfJNtjWmTe9padw0jAAf64NF81bx8qWIvqd+e9so9F2aW2tY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676390; c=relaxed/simple; bh=kSVHRJLBBZRqCDXW7q7iay5fjsC/vrRHi61LOfeioRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jt02f0KeyfYAr2a7Eexr7umvde4/mGdsfRuhmL722aHzKYwXnGx4LN/wESW61DAoABj6cmYvlNbJgIJo5tdWA2N5WWEcGyIxCvqIGm7Y6v37or/hypLHej1P+mWZWOF6AhX01Xs0ko5vpfsdbptNcR7HZY1TSR2bV9LLUjPdtLc= 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=bGze9fNg; arc=fail smtp.client-ip=52.101.229.8 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="bGze9fNg" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DbYSzgnIS3X7zXYoJUWo6WrRf1iH8Xs/EIiViskuLNh0QbrKoEu1O2cfIiZy2dLEYfR8k1ijYGXQE2ZxdBFxwVNfuOwdW3umZtNT2gRRtUA+0yX65QNEG1fbkwtKYTig76cOXvQO2LxOcTHD0MlD1JsUPxTD7Kh+/YS6YpkPzGVgB6trBt+NVz3HKuQc41MjvadV3MZEOYTE2vxfYMHKcNA/VY1q+8DXv1Tztu6j00bNWCEkrnXWXNXs32sXGEd9wtno1HS67dsLiAcu1wxN2gMbeETND/mZggjWOrunLXqwYOWX7xxZnTIZgBvIw/DaW8Sp54SAsFFzLXKUsWo0Ng== 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=05mJRjY1JUUjSpegvBbOPfDw/0kw/pGkSEaFy07e+yU=; b=ApzEuo2CPRywj1GUSXmhE8mbloFwfY/G0TdfNnBVGHU/SbdcSrEKGnmIXWkGIakzQjlPDLaUFBQUsDZ3WnZqQRtISZ+ODVH/lS1XXJcoODtWtHi68Toypuo7V6NBh4+NRIhr0jmlKiYFDbrdguOtAWVAyJ9CmrWvt+rkyChgTrDfqyzkuJu1N75n04V5o1yTzZE9pqoXxUWXVTqXlBYYIUNCfGOyF+y5SwwgvFPcYjz4V7hH0eSJS92b1uiM5zAPIWtxaqdhdtJn7kNYGbkPfDSJNZZOWMfSBNuWf7cV/X0iRuT5NagPx1YUrx2kylwe4E7k2Esmb4gJrXdebsNycw== 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=05mJRjY1JUUjSpegvBbOPfDw/0kw/pGkSEaFy07e+yU=; b=bGze9fNgtVUOFhkzSh1IoYx2oq1ONqBs94k3Xh3wpmBnB94fEjqWJLwOWJgubNAORHjrpHfgMInOsx9h4S/CmNEWEaTOuL7/jvUS1twvzsPyEgJJ2dwxQr+mfaMjbbJBPfVPdCghN1G5Vq68XCPdre+v4req7jl+nkrEp30UcI8= Received: from TY4P286CA0007.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:26d::16) by TY4PR01MB14667.jpnprd01.prod.outlook.com (2603:1096:405:209::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.7; Tue, 25 Aug 2026 16:46:25 +0000 Received: from TY1PEPF0000BAD9.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:26d:cafe::72) by TY4P286CA0007.outlook.office365.com (2603:1096:405:26d::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.7 via Frontend Transport; Tue, 25 Aug 2026 16:46:25 +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 TY1PEPF0000BAD9.mail.protection.outlook.com (10.167.240.38) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 16:46:24 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.185]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 97F1030001CA; Wed, 26 Aug 2026 01:46:18 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.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, jun.ann.lai@intel.com, yi.fang.gan@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 v3 3/5] net: stmmac: Disable double VLAN handling on dwmac4 Date: Tue, 25 Aug 2026 16:45:20 +0000 Message-ID: <20260825164522.4244-4-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825164522.4244-1-ovidiu.panait.rb@renesas.com> References: <20260825164522.4244-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: TY1PEPF0000BAD9:EE_|TY4PR01MB14667:EE_ X-MS-Office365-Filtering-Correlation-Id: a3c21756-f51b-4cd2-3cfe-08df02c86661 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|7416014|376014|23010399003|921020|18002099003|22082099003|3023799007|10067099003|56012099006|11063799006; X-Microsoft-Antispam-Message-Info: pwIa+ib+lXTa74KvaouN8f0/VZpoPTjpA6Cea99+lBcd876FFHWBY/RW0qXXX1l8gaNmYw7kljYU9qCY0HQX8oPVLUqiRFy6zZG6lUOaWjuP9DmfIIBLRDvrphVxjRWuXE3npL6S2zpUS1gDMJ3aAo9zo9eiGa1eAj7tGFzSFMKajaFi8T60ymUQl/9ACrzdCQaoNdkZVHtYVEVy+yKdwFQkutq70vSuW2kQl0DUxcbS5YHxuIfXhfAE1DzBEEmQSa6XPzsf8GsB+CP/XMkmGV1ql8lyhAUFGx7d/E0d49huZk3r/OJiJUC4fgU8fi59UF/sqoOHZV4rFlBAJysOmx/wsJZIOR0THD6W8yrtTJEV3eAXwrZU5ryHES1Er6tKt8tGzMmRl/WQ7GQIGoCBmS/V8KGx/6muQNgSFi1rtTqJkqRj0pHZtkjLfQ7moP4vkUf3dl9dQik0tax8DMhqbxhZd4sLBDRn2aYmyIFpKwwE7O0ASb+zv0W/q8yY9IDAcSuKX3aFbREu5UEUp6zcW1EHkMas6Oc7ze1QKgUaui6nYbuwDiygvC3tG7KuZpWBJhFB9ps8XWscwMWPc5OGDaH/V8K/VsjhLtfNZlqhWsZF4N2g+NO9HoE5sFUkq51AhOx2DmsJ8gsJqOpCKLAaMAyXkg6R30/mCcXltnBUsnT73asvdF3g4vkSKkKBf2paMlQv4BHP0DccpjgsV5+lsuhwU7Oga4BVhsMDnZQyE1sR0/LvxIrmRuqlcFYLjxFf 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)(36860700016)(82310400026)(7416014)(376014)(23010399003)(921020)(18002099003)(22082099003)(3023799007)(10067099003)(56012099006)(11063799006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Fj64wJq4HJyTkH88s5jqwFYNgfXp5d2fSclxv3EsY86ejorOFIbJVHih8zye9VEQWRl8ZBecVdYRtzt37Wp2c5ZAuIIMBFTpP4FINMMc0Yza29tPo4XTmvIF1ZnZdqK4mQyN1jLavJUhXij3NC7T1vbnTn/4x0kpXD9zo4B1iDLuoqnXC1W8cO4Qn7da8nKA1r/udChGAKeOD21JcmfF8yrPeag5CI6S+P/m/EfA1RJhT61Ytj2YyrFU0szU+vsSjXBvkbYZkRREmZbtNNvYiPUqm7qqBFWqJLwGinDnJ8JCI/Ls8H/haS6evGknTMtq4xD1Yuy/ao72oLRHF6vHaI1lAAUaQipLrqx4KVsq8hNy8VKC/1/XsyjqcQ7aV7tIwJQaEoIObUVXVg3Rk7vT7fUz86nekyFBy1phTQpjhqMA5Dk51z/w8MtYMdv632Jp X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 16:46:24.3738 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3c21756-f51b-4cd2-3cfe-08df02c86661 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: TY1PEPF0000BAD9.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY4PR01MB14667 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 double VLAN stripping correctly. Disable it by dropping update_dvlan_state from dwmac_vlan_ops. With this, 802.1ad tags are left in place and handled by the software VLAN path. Also, restrict the NETIF_F_HW_VLAN_STAG_RX and NETIF_F_HW_VLAN_STAG_FILTER advertisement to dwxgmac2. Fixes: 750011e239a5 ("net: stmmac: Add support for HW-accelerated VLAN stri= pping") Signed-off-by: Ovidiu Panait --- 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 | 8 ++++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c | 1 - 2 files changed, 6 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 e79b37fc716c..7b6a506ce4c1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7956,14 +7956,18 @@ 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; + 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; + 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; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_vlan.c index 1e47ae62093e..9b5b3f11f699 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c @@ -273,7 +273,6 @@ static void dwxgmac2_update_vlan_hash(struct mac_device= _info *hw, u32 hash) =20 const struct stmmac_vlan_ops dwmac_vlan_ops =3D { .update_vlan_hash =3D vlan_update_hash, - .update_dvlan_state =3D vlan_update_dvlan_state, .enable_vlan =3D vlan_enable, .add_hw_vlan_rx_fltr =3D vlan_add_hw_rx_fltr, .del_hw_vlan_rx_fltr =3D vlan_del_hw_rx_fltr, --=20 2.34.1 From nobody Mon Sep 28 06:35:39 2026 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11011055.outbound.protection.outlook.com [52.101.125.55]) (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 8C0C938DC72; Tue, 25 Aug 2026 16:46:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.125.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676400; cv=fail; b=VFR8M/xGmmE3874NGKA+4aztSeDukW3t2WdNuXGygBMPjCPeW9t6dpXMzPSfgX/RzDCFM+nvEjcYiiQkZxU9ZBg0pWdqr7rVcIhLn7LaKJZGRfOkkpIx0TdX7ggUDVCGQqNwjdHAMsYlNcYEeDzNx0vUNiQplvIWfNP8IVbb5tM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676400; c=relaxed/simple; bh=5h5FvXA+UxgLS0/+DGOJZbW/sT2HqlT/5JX+eRL9Vls=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Sgam95ySOiRI4VnVhLncJqrZS0SIVGJVJy/V3iEqPwgSSgvKg8Bo+Vz2p05PpY9fNgWbbJAb6VxrxNPwlC4tj0IBbwc/p2cAWoTodeSZWL9jRtZL5iZFBbglptBaaQFYvpvzla66r94XbW1xeYuNjs8lC/FnxZITJcwDg7xZ2/E= 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=Seg/CloC; arc=fail smtp.client-ip=52.101.125.55 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="Seg/CloC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U+TxYjSySrZAtLLJZj8u6Tkc4bPlx6Te3Z4axGOG8zYgBRqjq8gD3AHEBhfvwNUWAeB7QctSrMx2mxpfJrb77ZCEmR9Jn/UZvaMW46ks/1yRPng0i/q4q/5s32HxqwsqVB21Z22Nu5tbkYGp1XU6ovWtiRVDlgfML21qtv1VF4feNMDhp+5uAvZySVz614EHyTo/DU6IRzS8yhGHHMUGYzOizbg4QLS6knWPeQzFJwuYgaJtWea+B2cFRl+179fhHulOyG3FEb06vezyRXZg90uI/LDuyey8h5mLbGWN918dBWZrUWxi0bvuIpZeCxvqCYle/glnEwDsBN23xVAl5Q== 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=4yN0oMMVZ6d1L75Tt7a/vpPtRu0nikbw6SOMWFjR4Ks=; b=f+IPheJB0jPLsBLUM45Z9WEJYj5TwjvG/apb/JWeAjO7XZmafIJlrZ9jeMkAGSMZ7W8NsJiu2wW6RNmk00REDS+3AlfbfKo8edu3bCWWIQW3v1j1rFFVtRn9eI1cUt723qj2iuzWiFpGII5DFwnlokFn5QOAd4EO7YMZymJ24MJJS4zstXPTSXZXh8iNx0MawLfLx11o1G3soEWz8B7g9JuGfMdjFPffuGJtjItwB453cyvjCjcfWuNmYyoIPFTXhnRxTDbC/QAGNiW3HWnZDQ9DLjN7IhCkMrSHePzxpl37JQkQsSJ2PJuExOoWBKKmTE/PF2Vb8roO1LmvyooaYg== 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=4yN0oMMVZ6d1L75Tt7a/vpPtRu0nikbw6SOMWFjR4Ks=; b=Seg/CloCOeNmc7qy8qVtP/roIzbTmNGJPOnTzhBbPw/R4IKmtYv4Q/kou98Jb1YxdlYcpoDDY98TD0BpW0sVXDPd5rDLLz4AuKfvz8SyDXLdCOjCwcNNDjP6G2eIleojS6DcC/5/++eYz+WVGzbS1qKUJ2tXPSE4b4RdT8J4Ptc= Received: from TY4P286CA0090.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:369::17) by TYYPR01MB7736.jpnprd01.prod.outlook.com (2603:1096:400:118::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.339.12; Tue, 25 Aug 2026 16:46:32 +0000 Received: from TY2PEPF00005622.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:369:cafe::91) by TY4P286CA0090.outlook.office365.com (2603:1096:405:369::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.7 via Frontend Transport; Tue, 25 Aug 2026 16:46:32 +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.360.3 via Frontend Transport; Tue, 25 Aug 2026 16:46:30 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.185]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id D1C7930001CB; Wed, 26 Aug 2026 01:46:24 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.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, jun.ann.lai@intel.com, yi.fang.gan@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 v3 4/5] selftests: drv-net: Move _set_ethtool_feat() into lib Date: Tue, 25 Aug 2026 16:45:21 +0000 Message-ID: <20260825164522.4244-5-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825164522.4244-1-ovidiu.panait.rb@renesas.com> References: <20260825164522.4244-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_|TYYPR01MB7736:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c558dcc-e576-43df-105d-08df02c86a11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700016|1800799024|82310400026|376014|7416014|23010399003|18002099003|22082099003|11063799006|56012099006|6133799003|10067099003|921020; X-Microsoft-Antispam-Message-Info: lnQG2pn8PXTXNmf88ldkNxV6YPE4jZpPGQhbEOPY68EMGVTHiw/02TwfYdWPgzi4OIXrKQyz/CYZMgL21p2W9ddNf9vxkjaxK55Iupyd9yuQ7WHmfdOP1c5MV43+F/jqRXMLQ1Mvxuc+BCq5vFeZFDedtryhEEDi/myvnIvZpeQdvfeJGRK61fS1Pk/28Ff5Tpo31osGDHZK+cDcaSe5VcmF54mf4D9w2NT9ch+Vq5o6KyJpWcHic4wLu4gKY5PV9wHFS/0h30yleGkVXDOKw2fxdSV+4f0KHUl+47QJduGOI03p5hxNy+M6v0ub9X6qxBlq6nxkNPTznKOnrEB3HKMFDftfdp0S27f8rfjZI+jbxjt15WcfR6+sZNxZh0FU8VLgIYwVMowqeSjTofvAcWQyrpzSd9xzq2P9Ol+QKGQiGIt0MKaJmOkgUXQqe5evLkWOc6UZzOAD03lxjkUdbeUPwzyy+87iKKk2JYhjs93jXuGN3IkrtlI/rjotnDUPFM3RR2bUX0kChXgNLuERd4f/ZRBesvN36GD+EquFU96q4JItyOexvK+3Lv7kIP97sT3uwryEr3qOjqcWc8wAFizoopRboPuELaD7qTANYu4sC+FwElzwPq8E90yfYl4i+TztQJr5XatAZdi2IO4so4li+F6KyIMK8dzjrT0PpEW23vLIkgjfeDAwQ66rMi7qi/nTP6462f+7FdvEbXTDn/c4U29QfIHSkR+5wQ/YRl43N977BB0+qjOTZv10dJ5U 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)(1800799024)(82310400026)(376014)(7416014)(23010399003)(18002099003)(22082099003)(11063799006)(56012099006)(6133799003)(10067099003)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F1BzNOxZM2IAXitJR6jx7Om08Z9sZEldGzE4zVSqICioUcy6s+G8BcWGb8ntVwYWTGC3o498MEZITlbtE/+1e09/1AbL98CtPqhlUlH57BNXWLvOJxkWCMsRrOaXThDyhqocYmJlH2l9uoM8oAtQ51iOs2k/hr5AO8VOspjbZC4lefiFEw8jUzdDiRoxH6dOML5Ixrg+18R9Z81qi6qaJMbA0KcPcNmHz55VGI0yio1AHl+z7JsaSmLCTzn0zxyFfWX7OBNVq/yuu20AJQbp9oH1WTw1rpVyQzrBmIvM2BF1GjcP7inSTm4KTCXYhsR5BfrET1D/Aps/uRd2ck8juxkmmXIwGiKpM/iGfJDqvqWzQw9AZXtQSg5m01iOe/PvkcnXmyTMD5VcBqtde+kI+RnNFBx7ehoWdPn/ne1+WVT01cFmLTaByNVvFdrj8e57 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 16:46:30.5618 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1c558dcc-e576-43df-105d-08df02c86a11 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: TYYPR01MB7736 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 --- 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 Mon Sep 28 06:35:39 2026 Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazon11010023.outbound.protection.outlook.com [52.101.229.23]) (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 82D2D485CFB; Tue, 25 Aug 2026 16:46:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.23 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676403; cv=fail; b=C10OKWBCT93pGlDlB0mehF9G2KorZ7iG2H2TuM51gUbIgqChl73p/QmyO8MeMqf3frbei3HaTveb6PbyQqclHCOpEcrPv1kHDkhpy1EAxH/3khgrWsvyMtwfkFSZ5AB+BiA091ijZtXwuuZy8DLnnP3STvPetJgsAyyM+t7e8f0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787676403; c=relaxed/simple; bh=vbbhoet2hdeThONBd0NsAn/oWev45M5GsErQwx0rWRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QUnm9mEwhJ6XCcGyMGbah3UpXzutRA0qOVEFPRK+JKwowslpkjVt2DL8D5j2bMkPPRYt9GppX4COVGMAM43zjDHUzDStv6Et2HGjh5XKzw0EHstmhu7IO9ibNgFY9AIIqF8yncfkZ5/L4RBy6Z0u0JOAbUz1DP+wNDQgKmHCPnA= 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=m+B65xyF; arc=fail smtp.client-ip=52.101.229.23 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="m+B65xyF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=L4YNRqErBR4xO1+M+kPzN+diVA+8NfXALsB7p44L1bYPAbCVwFXpYAY7+Q6FgJtPNXt9Yot/qF9iAqMnEFTq2NTmfKkzmkz5qk30+3pZJRgda9AVzwTkHgs8l34QTcOsruriu+i2kTocTi9CUiLSEiwivcQnDwqcuD9Re1CNhu2ieMtB0+2Mix9Na4xCbARkIaZ9GuXwq43eF1KrIil15i/llE2+jqzg6gSEfGmG9P87G+nq8sE5HHFLVbJAb8Tzyw0Osaqp+fbDLca8KUYHiYy+OhAB7kf4DMUM+4hPBGAiaGpl9048Yq+xVamxRHrxYW3x/SnhuWUz+6Xo6skF6A== 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=aYqgbyshNrIQMzdImSiiaRk3PvyrtMkxhCV7N7JyhFw=; b=Jxr1WHJRqy2IZ1zeUdIbN3RSyuI3o+WF9Od20uT6xx9+PBqpkBP0fT0tFvCqIqtglRmuDqzzsalVy94NZXjETkWtkdA9GEw24GsZGYrfg8Ta7cKHaPv87k10am3IVVRbWcP0VAaNSOPMDINddvR67EXi0mFb78tiElIs0GRMpMiG+Qz7Mq2U3DvSI7mS3aX4BbKMba/PZkR6SnzMY2ILnGkTuXD2CvsCTYHcPXpv4ZYtP33u7prBzpCo6fk5MjTXPQI7mys3S8kOLbp/4NXkXASkqwvnSr7ndBfH9ez3jnfAV43o2wjav12zL63jMn1Ll8Tqt4MD1SmN6ho2qI8Fgg== 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=aYqgbyshNrIQMzdImSiiaRk3PvyrtMkxhCV7N7JyhFw=; b=m+B65xyFWknUfVOZlURXCVecYwLGm/+CplR8bQlQgXLClAAa4ZFqyeT0tWhtlquoH8HZNHUVZ6B2GP0xe0OPycU+zbG7OYthQe51JX3xmfIccjlGUuaUSs0WvJVhLbEokvJv6UVECz4Dh7yc0Goqrio0F722T3XAsXpnczQnzUM= Received: from TY4P301CA0041.JPNP301.PROD.OUTLOOK.COM (2603:1096:405:2be::15) by OSOPR01MB18027.jpnprd01.prod.outlook.com (2603:1096:604:476::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.360.7; Tue, 25 Aug 2026 16:46:37 +0000 Received: from TYO1EPF00005022.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:2be:cafe::97) by TY4P301CA0041.outlook.office365.com (2603:1096:405:2be::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.8 via Frontend Transport; Tue, 25 Aug 2026 16:46:37 +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 TYO1EPF00005022.mail.protection.outlook.com (10.167.240.7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.360.3 via Frontend Transport; Tue, 25 Aug 2026 16:46:36 +0000 Received: from vm01.adwin.renesas.com (DEU-5CG20946WF.adwin.renesas.com [10.226.92.185]) by ejcrelay005p.adwin.renesas.com (Postfix) with ESMTP id 13D5A30001CD; Wed, 26 Aug 2026 01:46:30 +0900 (JST) From: Ovidiu Panait To: maxime.chevallier@bootlin.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, jun.ann.lai@intel.com, yi.fang.gan@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 v3 5/5] selftests: drv-net: Add VLAN test Date: Tue, 25 Aug 2026 16:45:22 +0000 Message-ID: <20260825164522.4244-6-ovidiu.panait.rb@renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260825164522.4244-1-ovidiu.panait.rb@renesas.com> References: <20260825164522.4244-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: TYO1EPF00005022:EE_|OSOPR01MB18027:EE_ X-MS-Office365-Filtering-Correlation-Id: ce172165-142d-4966-4582-08df02c86dc3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|7416014|376014|23010399003|921020|18002099003|22082099003|3023799007|10067099003|56012099006|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: v/7Q2BBjfiF7VaNaCDjAt5P2+CoSIaIwKOTyU5M5ina02ZbQ4YkS/pa4cCSQmDLZDn65l+rA3vwl/nz/e1eqt0nKooas/KbsYMdc4br9z8/a0KY23NXUnz94otehfT5ud3/my69iMkQrhVCppIBf2vSKov+SuT2RdNr8XuhJ2cASrOfWozOEbwEJpYEApH+fM486KX1+4iMtG/jqrrU0ZgdvqYVTq37BnqKcl7VZR+BsvADokDjBytdCudotW1IAuHKBA0PcrU2voO/8jSrhnTkcHcNPHNI4cOdmS3e0XgDsvOsNCxNs3FI37mAfBtV8X85IUqaaIdRCWW0xYmdsP057j189vD7BEvqDrnkxsmyjKWGWA4LkjCQeRUoxXz0+7VjyiKAWRvs1WmpApyCwWHHP5t2KFathDWlcM1+F/9ZHDbIvXV7h2b3OEzpjpgX+LX/ynVUhUP4711EqSPeNcHvZqKuH61+0ixyjxS4jpFlI2eDuvubQfPMXYKLKYze53eCX5U//Tf5rVHqT+rXn+9eCYcoilJJhvY76n3OxBP14FCqo/+MgHEyhEGPBti6ONRSrU+yjPkK355FDpI1SqaWOiASedR5AMGkm9gMbW9a0F1vC5GGn/imbRFeUEgIxTP4aja1MeHrn+FKgNrZm2nstqXxcIpxJz67Ye4e2+vIBRI95ky3CAN3qxtiRcYRGMBhS4D4TGHsJWspDJ6OB4FzyYwxHuv9nwBygPvFxdN8Cs99oWBgJr4FlXZmlyap8 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)(36860700016)(82310400026)(7416014)(376014)(23010399003)(921020)(18002099003)(22082099003)(3023799007)(10067099003)(56012099006)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UOUJCQtsDageNl1zuY7ewdHCboyNgwqGijMsys+19lBptVcbRNAH/H80oyZmhLFW+DCfbK4slUTFINg1uIA60wtbgZt+aQjjvnp0doDPC4R/z4CtJvWGbxwXkPL2L2PaPXFVsxbOWtAfJL9zioTwX35yDynu+azQd0x7Ojc1DgAYPbQQvo3DxR50h3sliYiuVEl+3UlZSJxY/cu25gj7EKLwIRgf1kSVbjzeeunErTF/mx3QK32HLgv6aJI03xZ6db2sdABnEx+h8abMBne8GUWnOBsmncZWQLicjypBoKIi/IJBKMzXO1th4XxdtgIj8xeqfSPFAHoAl/2zsuXIIADma4jx3PJLVqZvaGsnoUA79svoNDlP7W7SgEjTdLQufdcRWYlWoH0cEgYPutLr7Mo2rAZZx003PUlVleoLjM/Df6u2rN27jfwSi1uCQS48 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2026 16:46:36.7634 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce172165-142d-4966-4582-08df02c86dc3 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: TYO1EPF00005022.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSOPR01MB18027 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 VLAN stripping enabled and disabled: - a single 802.1q VLAN interface - a single 802.1ad VLAN interface - an 802.1q VLAN stacked on top of an 802.1ad interface 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 # ok 4 vlan.test.8021ad_sw # ok 5 vlan.test.qinq_hw # ok 6 vlan.test.qinq_sw # # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 1 selftests: drivers/net/hw: vlan.py # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Ovidiu Panait --- 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 | 109 ++++++++++++++++++ 3 files changed, 111 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..79eec655973b --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/vlan.py @@ -0,0 +1,109 @@ +#!/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 VLAN stripping enabled and +disabled. + +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] + set_ethtool_feat(cfg.ifname, feat, {"rx-vlan-offload": hw_strip}) + + _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