From patchwork Sun Dec 15 16:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hodaszi X-Patchwork-Id: 13908815 X-Patchwork-Delegate: kuba@kernel.org Received: from outbound-ip24b.ess.barracuda.com (outbound-ip24b.ess.barracuda.com [209.222.82.221]) (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 DEB73101DE; Sun, 15 Dec 2024 16:34:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.221 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734280492; cv=fail; b=ZDrHUGBd2PTZtHgdL4rHUj5K480AwRmLd0O7Daoco8xmeBYR0fM3mFN8jvbopMioywJtWZBThHZWXHAlvgd+ZPO+WDZeqK0Q9+dn4x5RdIcJaYXJx1zT+v5w1BR04l0khCD+NxJKvFy8BbhsMYyEWRWYktEnAi5OBA4bzhrwTWo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734280492; c=relaxed/simple; bh=noyQ5T0abW8WM/vCOPFZVNuQMSGqldlEu2Eqm+V+crg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=rIg11anyuGYqfX1ODl2gGXo+AlfODQDK1RY+kxANJk9dr9l+e4ttJHxoAp4lzZkhoMpwnfhszoj2i1lFy1DT/NpAT0Shb+1DWv5eEfnEqRAX26messCtoV1EXQWNQ0O837PdwpXxw190tJ1SaK9/S4GnowZdsvdql3TobTTdhwA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=digi.com; spf=pass smtp.mailfrom=digi.com; dkim=pass (2048-bit key) header.d=digi.com header.i=@digi.com header.b=klcAfcBx; arc=fail smtp.client-ip=209.222.82.221 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=digi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=digi.com header.i=@digi.com header.b="klcAfcBx" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2048.outbound.protection.outlook.com [104.47.73.48]) by mx-outbound20-179.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 15 Dec 2024 16:34:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VlEcLgmvNHLNaV0E5NrJE58nuKrsJe5sHw6/g3uLoBaDTgGC/Wm3MGYEhXXYR6x+RjRdA/rhuC5eflPqe5MwLMiCOJcGWBznsFtqwtxI50U192Cbi+1fU+ZnFSPoe4GZrFAd0vCSL4IwQ2Jm+hRu2MEouMvmtluGmm4qXobr8phYXU8TeE8LsEY+I0hVPl/PUgF9TUo3CohYJFj1lq6h+90wkNfcxnTiJ8MSbFr4RlNR8rNoT9yrrBWgBUywetyvqYq0EiV20dt1l0rC92nuvJxdNmQ/8m59qPom1AuS3ScfHCKHkj0NzCGhUj32rN6zWwMClTdlpzL3htl3tS5SIQ== 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=WcSPKTWzWDKr0w9EpSo/PTdCsaHd4haggABnV4hy9bg=; b=t1Kln8Jn+CNOjfzYPGvejaLYzIu2Svq40j+r3jgHF1iA3us1wrkVyiqX4js8a/P+rq65IW4F8sTy5ZHoY+s+mBGt674lrD4d5BoaNMaKLDgVzrXBQPTcSQFMClDpizA0538hfWMElAtfJ72zSJ0V1bwbNRErej26CeVP8rsYxUAe1D5OHhR8Ok2gbWUX6eplB2qI5HNU6wFuen3+mNrFUoORiYDFvIdqTWzMYrtSTYcqHH7EN468IfmeGFFmbv8A9BW1DUpDf7eC2XD8XOKOBaw8FgHBWWVVqedI7HQ1wQ/1XZzwCVDq5SFd9JubpQq7b/S+S3IyBFmAiEM3F2a0Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WcSPKTWzWDKr0w9EpSo/PTdCsaHd4haggABnV4hy9bg=; b=klcAfcBxz4d/s2JiWgeXS+uIHAKDSLyuHIXyshMWAgwn2sF8W3hJl41p9pyK6wPOijOm+qBj+hn34J+iTnQKRaSZ474hvcZGZBWrP0omBV5EscitEH29H5hwk9bh2RzsjJI3W6Ckat7s/E0btxY6iXoBQjkc3akplvjP6OaWmGdrAHhS7U/o0yF8M48PSGhmyOiN8MJ+uykgFjCuMI2DsmoigDc2jz+RcB6yKxIguCl+b9A2if8tnGGpiMMOwuS8vNlWaD0hsWxpE1gGwMtncEouvW2ePpyt9VwrMTolhNeGl006oWI0r9m0Em/66UzlYvnCTqFN5z4jYefERNHWJg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=digi.com; Received: from CO1PR10MB4561.namprd10.prod.outlook.com (2603:10b6:303:9d::15) by SA2PR10MB4570.namprd10.prod.outlook.com (2603:10b6:806:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.20; Sun, 15 Dec 2024 16:34:12 +0000 Received: from CO1PR10MB4561.namprd10.prod.outlook.com ([fe80::ecc0:e020:de02:c448]) by CO1PR10MB4561.namprd10.prod.outlook.com ([fe80::ecc0:e020:de02:c448%4]) with mapi id 15.20.8251.015; Sun, 15 Dec 2024 16:34:12 +0000 From: Robert Hodaszi To: netdev@vger.kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-kernel@vger.kernel.org Cc: Robert Hodaszi Subject: [PATCH RFC net 1/2] net: dsa: provide a way to exclude switch ports from VLAN untagging Date: Sun, 15 Dec 2024 17:33:33 +0100 Message-ID: <20241215163334.615427-2-robert.hodaszi@digi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241215163334.615427-1-robert.hodaszi@digi.com> References: <20241215163334.615427-1-robert.hodaszi@digi.com> X-ClientProxiedBy: MI2P293CA0011.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:45::11) To CO1PR10MB4561.namprd10.prod.outlook.com (2603:10b6:303:9d::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4561:EE_|SA2PR10MB4570:EE_ X-MS-Office365-Filtering-Correlation-Id: c939d207-af05-4441-fe2f-08dd1d264ed8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|7416014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: 8p5qMO7C5EsOFGlPFMq5nC51el0d8UWh0fC8S+TMQyO/H5Y/TtsmjPOFaGLRhemuPSx2SCi85SBqquWUFH2f90qppOU3BiSqxT2i3uAJMScurKzSU8mZcPh5rOG44Mj/y7foQW29ecbbESVRuA2QAG3i13NlOTMnBvZcWB9ysyJgxfdc9dOweNHyTYyyfI5zMI13JGnvE3LKaoUwFe7YF8UhFhZFgjwymjzAQJVOw7wSS1QWf2+bRqyqEEW7Ks8L5+0LAkXiLk/7AecHRaKORDhVSJiW57MRKNZDA8vmEvuNsiUN8u5Jl6TGgJDPLbr9DrWcDYYCGuLkfwd35RKbLnDGOuc9U/xfQETqK/ikNH5Ib3uTLS8M9xso/sigvmolWXogYG3zUK6ceenV7cHEQfUBTNJ1pVAXKIvg6LLTyQPOkfYpNpRb04QwOKEzzXgApQ+Kg1r2iBzCWc2gL8y1CvVa3QHhL1Y3p3WnoI25G8q5WsBP3FCO1/8ZCEJ/wKAkT8IR73JK/6vjdjamemZMcOA/fyZ4YUCHfvjrUNOi6ijlRx11B4N4ynB5T1HMPi+3t6F4ijcCLNSOHdS5k/LGwIQPHWrIHRF0ySlKUvp48oVjv4wPaFaSYIlVFzMQi8yKLEt8vPSbJ1dDBZTYwXUnIo2GIuUYCROHi682dH8VjRNYSv0L7X84OdTpx1Nb8TrNw+XDXiV6SJgb9JeOAHeLXMV1harZZZMCk+stuGvZ23KlFKoXXFivPqEipHY4geC5VBmLaTuWD5TXjcAklO9E9CkRyX7no2f6F41nYdTzgUYJELLeu0D/o9BpMyZlMRoeKYkqWBwq+XJz5c/tbNDk/0jqJjB88f9kfXXlTXf+Kl/fBCJsWEQH2s29bBMp020FqyW4SDK2YXEAc8tvqmDa0qzrw9iqh4xBZgCtOnzEZZlRugff17ThriwzQW6pOwWiOVRobatFX2vcfyfn2jGg13SR2lfbmIlw0OtNE0KgQwtywD8nQvCeIqfXcuCAWdjFaoWV/stRAOJk1ZPUa//VJKhcnkK5cvVoGCJQZHZuPfMmWtongCTW+vs2RDhfBUvGm4EhBGbbM8T7nw8de7oKf5g/RekbC7iZy3wxr/zuBmEd1sAWosYHLL4RB8xEGvcp4x4qr/OBiL4ziw9GjQfD0qD5N/346V7bgd0IvWfW2/FP3uNwvn4m/ofPPGHAYwNRe8aSa0KuryDPB7Dj83iZjiDkeBnTNWWT7VMeJYXB1KtoMPhIaMdUpUoPlqkByTLY657wSQB8zapF7e79N9cXGoQqYk+1kQMGHUJHStI2EvBxbOY9E9UQTTNW9Kj09PFLrNsdx9nJjklbd6n8YYz/08S/aV/AamFUQXQpMKkiTmKp8wx+/3j3aBIuk2E0A2DVFNDPBa4BomQW9Se8VKWrQSlfiM+cZZ7dnAd7WHMbTcG/84OnPRm59d5yYUW/5WUy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4561.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(7416014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QyNhdNjlG7YvhZwM6aObyzjePgihiuHKIVFXnpAteFLAU5m+7mDE29jkXd0mNg0ZMyjbnP4wJJ6CkxxF56VsIqiTagSAvC1kIyQNTyV+wVYuiJnZ2jSferkYwCBA4b1BBhzOMCtqvk9nQeXDBBZySVTyZDTd/7S/n/MhGhTw4oQBawWCWDQMybIfpDUHqJ2hlNrUMC2I4rIrpIpR3MU2vC4k2keVCJMGOTdnk9yoFySE3g52rRLgfB91FREkGfuAqQ/fBaxgZZEmV719s8IuTsgvluE5v+1T8rgPLhE8L0BZFnZdUnmRuJoqQShyde8l+kBwhBFUam+s8gO9No1+154t2G0CnbwPhTenlK+qs3uYAtPohIC25OK0iRffnltDBRpBoPeKrnCbdBkQc8vMyS2nho5wR6Arb2OEUPHEFNrxa6tiSK9FLc7RH7J6TuVpd4ZyuRQSIS8TP38vYDAbQY9ECstpr9JnCs4pvVVMxkQd3hQx9NtPL32JDP1DMoowMp7SgpFRKlea2pg8kRZezZRi1BgBUm6iPJgpSUffj70UHtVnPovJvIgLf28BNroURmHt6j8Q6UigHdCN8AdQv1UNYi321FXiD2MfxnoMqitaGKUpaxzy0HsuD1DCQhQJfGWrmOUgRoDOT1lIiKWCnq+Hz/+rrnhHW6Z39VJDS5XvEXLTbUsGn5M+eqDB7qOntiXKTiOYIYmtvxNGHMyrxhKlA5eGQGjz8HkUyx5rQAFCWOVmml5W3PpoZX0ADfKNq/+F0GkypR8fllU4Gi8HDxfDVXSvf7AoCYK+vtMgFKnnjSTQvNUVWGNvDSKRj12CRnWOkkQMKIASwTeGjies6PNzuY0xP5TyrF5eh/6CdLHzfYPu6qODSGffgXYnvUToMI00DzEVlXkxvCDTsRyylsSiP631WnGAIC6BSPxY22cTEZPQZ2OX/JdVHwdokzo50fTK4lsU8j69kXHTFibZ0WwFOdrvVg8VYfekDvHakWuC22Bfitn10VYvUikw8dcYCwLqgeW2icJ9MwkbV0+VVD3BLDOwxkxHqtvDLn2X5jrn6fXXGzghF6GnzBw6dIcoENTVE27hj3JMV3DxnmhP5Kdv51YfwJmDPqAxvnvc3EIqe6t6rJXLMazO7vEiIjJO4H2jQzvMMExJELgjLNsAy6zVysWmD8wvVyiY5PyRXW+mXpxehRJyRw+9rF7y22udrqb4KSL8RTo33GWCiFH5bwdd6BWHDSigooS2Q61WFJUspCHeKKY7ewwBsCxAqy1NFJ7Zuym4nrJIVgBccfvxTajwMW5dHWYDHxbljiXhI9Fd007TsW+5qK80j6jeC7emK702sD4hq6lhZFi1lzFdt977NLLMnK7sdpw6eOeDpZn49H8uuhbz5wGfi8CLwCtnjcNskcpyQ0zr0KtfvSEX1eFLwMewBvdUzwmsJl6Z2bDw4K27ifcisuI+8N/Ctork/39n4Td8QFweX5djFyy1mot6wwL4S6rI653Nz6lh9huCHGY4RDKrrJ5SirRMYMay5zPfGCqFwuwY/Wn3Ylxt8kntONxRBXbdR3T8nWigA2kApk1KyPzRCnMnZBl4dUAG X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: c939d207-af05-4441-fe2f-08dd1d264ed8 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4561.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2024 16:34:12.6423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x9nF5twY/pC9D7FrS0t/IMv2F6uGkYNFwZCF8EZpqcjF6I3gOwofzpgaOJ+GfJHHkt5INHytZTv2eQkD9qrcnw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4570 X-BESS-ID: 1734280449-105299-13407-1828-2 X-BESS-VER: 2019.1_20241212.2019 X-BESS-Apparent-Source-IP: 104.47.73.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYWxpZAVgZQ0DjVMM3MyMgk1d DAwNgwyTzNxNLC0CAp0TTZ0MgoycBcqTYWAIVrWzdBAAAA X-BESS-Outbound-Spam-Score: 1.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261133 [from cloudscan19-218.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.50 BSF_RULE_7582B META: Custom Rule 7582B 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=1.00 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, BSF_RULE_7582B, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Even if a switch driver sets 'untag_vlan_aware_bridge_pvid' or 'untag_bridge_pvid', it may not enable tagging on one or more ports (VLAN-unaware port). Without a way to exclude these ports, dsa_software_vlan_untag() untags packets it shouldn't, and so it corrupts the packet. That happens currently with the felix driver. The driver always sets 'untag_vlan_aware_bridge_pvid', but enables inner tags (push_inner_tag=1) only when VLAN-filtering is enabled. To exclude a port from untagging, set dp->not_tagged=1. The inverse logic is to keep backward compatibility, and avoid the need to potentially change currently working users. Fixes: f1288fd7293b ("net: dsa: felix: fix VLAN tag loss on CPU reception with ocelot-8021q") Signed-off-by: Robert Hodaszi --- include/net/dsa.h | 7 +++++++ net/dsa/tag.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 72ae65e7246a..99b1267f0c46 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -289,6 +289,13 @@ struct dsa_port { u8 setup:1; + /* Use this to mark a switch port as "untagged", to avoid + * dsa_software_vlan_untag() do a VLAN untagging on it if + * ds->untag_bridge_pvid or ds->untag_vlan_aware_bridge_pvid is set to + * true + */ + u8 not_tagged:1; + struct device_node *dn; unsigned int ageing_time; diff --git a/net/dsa/tag.h b/net/dsa/tag.h index d5707870906b..c3d76a49b1c6 100644 --- a/net/dsa/tag.h +++ b/net/dsa/tag.h @@ -155,6 +155,10 @@ static inline struct sk_buff *dsa_software_vlan_untag(struct sk_buff *skb) if (!br) return skb; + /* This switch port is not tagged, no need for untagging */ + if (dp->not_tagged) + return skb; + /* Move VLAN tag from data to hwaccel */ if (!skb_vlan_tag_present(skb)) { skb = skb_vlan_untag(skb); From patchwork Sun Dec 15 16:33:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Hodaszi X-Patchwork-Id: 13908816 X-Patchwork-Delegate: kuba@kernel.org Received: from outbound-ip8b.ess.barracuda.com (outbound-ip8b.ess.barracuda.com [209.222.82.190]) (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 CC0FB18FC75; Sun, 15 Dec 2024 16:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=209.222.82.190 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734280525; cv=fail; b=qUanbbLJMjHwgUEN6ozdc2r7R4c4TpjPmQO77woDhcSMQ88TNF+9e/K5tF6Ej3pv2m5l45ezdC5hEchCR6xZzLI0OSN/gWc2VAkdFTttTuFjGFrjn/p367GKFjOU/+t+heOjJy7qIWhEICyjpUrUdyIIq1WNlj/VgSLzNXQur94= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734280525; c=relaxed/simple; bh=QspOdM4fMq9kvTrp/t/6naVvalvooUZLGtxWLo4ze9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=otE92t0ZUEJPcOv6CWL4L8RmfHYl9Hb5j/hVkvpZbZGsRUjqNleT58jsF5o7PK8V4PWK2MdVPmo3sl2t33TdRCGOTavZ1IOdEUMK+woNT3Rj19GqFeDjF9KXyRoKgckiguI078yZRMLuq8Vuamtsn8PsqK8iX8EpirwAd9A5mDs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=digi.com; spf=pass smtp.mailfrom=digi.com; dkim=pass (2048-bit key) header.d=digi.com header.i=@digi.com header.b=R3CjxVGv; arc=fail smtp.client-ip=209.222.82.190 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=digi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=digi.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=digi.com header.i=@digi.com header.b="R3CjxVGv" Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2048.outbound.protection.outlook.com [104.47.73.48]) by mx-outbound20-179.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 15 Dec 2024 16:34:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MbDcYY8sYdfqJz/MJPaEkFL2S613zneJ/TOVDN8jTQoJ6Kvhnf2t1bN2CjIbgQro4A/3+dbYwIWvG+tNvok+NJiPZM+apwiGWdkJ/br1h3a1k1ZGPq7Ij8xeuQXQLeMwMR444XjefR2+s2vrKdxRi0HcGMAvVSMRA5B5979yor+GCIq70vK3KwODRLui6GCpEXx6Isn6YauXWNqhJhp703rmEqk5K0P2zn0h0+enZ40D4Tco1j3YP+0Wh96knv9wwGPdImPl98IjRGhzF0Emf3wWs8EoJlhZS4zLnAV4A9x6xVPKo9OobA+9Ea/9slcHPkHd5xD8aUlITuRVyftCvA== 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=wzZRIhVAGbEnB8JGGuIOIW9EHP59lbSwAl7pQ5Vx0Fk=; b=UCj1Bo945kGGFtfi6b3bWeSQdZj8wFVRcvukTfQCXPIE89vWxSB2mwrtnfNLwHgFS6YfWP+eKWoqxV75yeYbhaidzeNskbCySSW1u2edzXmjYXbeR4qH8l4lh7yy1UKEtQTmqBCd4oA6zePZQWp9w5jrC7hGeR8RgXG6hA0xtFNLFs4dA/0Sgyog+Qus3sOsIVZQOmoauE05F1ZwAGQpdRy7BJ6Hnq6evE8saGrCnIfLded8HZkPGdji8a/T4PgU4NAZdpFtaeNshtV6oBgAGy7jgfH/CWdA+ln9xRvSDwbkbzpkAZDYQ5/gREUPuZEiKJ5OAp/ezO4YpuWh25FwrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wzZRIhVAGbEnB8JGGuIOIW9EHP59lbSwAl7pQ5Vx0Fk=; b=R3CjxVGv+gx86uveUWqb6XYVXVE+NwNaB+HFPQbPAVg+Jmqt/1bplqeZa66w/7XIx+LDFnBm8Rae+qo4jMAuY9k3gq395+mRCVglw6qEDPRAmCfoTrfDQMjZgg3n8CCqjnBvUhgkvaLD8zvA/U/BMXvLD4NgpXv5RTagKExCUj62ROtYJjHSZo7ClVBYkMGb0g4nVqG12z9lNsnd+nUELHn3SCvpTh1Eb8wHv6Z2wkl+kCTFVaYFxUIaC7jyx/SrrpreUW1OvI5bJQ7cL048mYVxsJq19g8hH8r5TJ3+IteUOR2kuuVHzIbS6fbHFgrT+XG0Vc7pN1xTJmOMFZVo3Q== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=digi.com; Received: from CO1PR10MB4561.namprd10.prod.outlook.com (2603:10b6:303:9d::15) by SA2PR10MB4570.namprd10.prod.outlook.com (2603:10b6:806:11e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.20; Sun, 15 Dec 2024 16:34:16 +0000 Received: from CO1PR10MB4561.namprd10.prod.outlook.com ([fe80::ecc0:e020:de02:c448]) by CO1PR10MB4561.namprd10.prod.outlook.com ([fe80::ecc0:e020:de02:c448%4]) with mapi id 15.20.8251.015; Sun, 15 Dec 2024 16:34:16 +0000 From: Robert Hodaszi To: netdev@vger.kernel.org, vladimir.oltean@nxp.com, claudiu.manoil@nxp.com, alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com, andrew@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, linux-kernel@vger.kernel.org Cc: Robert Hodaszi Subject: [PATCH RFC net 2/2] net: dsa: felix: fix reception from VLAN-unaware ports Date: Sun, 15 Dec 2024 17:33:34 +0100 Message-ID: <20241215163334.615427-3-robert.hodaszi@digi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241215163334.615427-1-robert.hodaszi@digi.com> References: <20241215163334.615427-1-robert.hodaszi@digi.com> X-ClientProxiedBy: MI2P293CA0011.ITAP293.PROD.OUTLOOK.COM (2603:10a6:290:45::11) To CO1PR10MB4561.namprd10.prod.outlook.com (2603:10b6:303:9d::15) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR10MB4561:EE_|SA2PR10MB4570:EE_ X-MS-Office365-Filtering-Correlation-Id: d79cd75a-fa17-4428-5b2b-08dd1d265136 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|7416014|366016|38350700014|921020; X-Microsoft-Antispam-Message-Info: RSOIwfmpdDcXpg1HSyHfZTvv5Jou+SKSI6+/MVOK+rTs2jYkBFMWilGiK4al4mVzCaymU1FIzHEgWLrg8KMUMEJYt436671xM/h+JLeBnA2li3vK2TXZGgXpUipmyZ+gpXXVHig4ymuQ5TKiZUOCCJOGrJftEDEMkHiPNgyKXihC7P/3cGgFS+jGXxLOoKz1DfDpn+SCxGLL+cPw6pWMfSARCDutycBCovODzUHph6Sspzm4o+JaFW86/vu3YgyKHL/rixB+QpI/XEQe9JPw1/p3UO6kXmLXiEJjhJsn5ZsFeYg6aQ0Ab4Ix1YJW507Nj58UwYjd1OGhPuUhf8WdGozmRjnr9Xqn51T+ISEZ7O5J3vC0Rv0Bhz++VtSL/ngG/SpHNaTF5VK70T92Si3hxwRGwj7U3mkWfW/mIVGeb1GT/J2q7TmIdBTKNtsZ+aTBrY1jLs9JUOHNyhMM0COTumqd6fnHG0Z+Wcqf4UNOK27y1ECJHG8MsEnmDHIfbC2GYGsHXB4Ieaou1HcOEpxKqSZvxujTSWMavJcICtL+nlGNg8WuH6BQ4IiKmUlrmXflz8PI1BEm8Ue1ZVIfmyUXznXoSrR7PIOzptk0azocduENePwNT57ZEmUnsLyEsrabz78qE3r4aQv9Q6yW92HsKMXNtsVCIxuRXf5xLek5JFwMxsN1oxIJTGO3pHI4cinc6GmtjUbCFzVYXnb0I4mg1sxfDKo5d95XwOUk77Iwn0sxtA18MFzcIy19eE/WvPi76Zznpszo3kqBLKpLVO2gFvDPfdyCLSh+gj684hphh3M/ROd9pJ2HaI/hHTt6eIrk1WG01Tr8UrAjgFCCFf7Yya7QsyEhx6lvHTbMGYJziqRP5hRRukoAZMuxmSKBc6V+EDQDcD0K4yMEU2sjc+VkgWqAEKpGmruO/pbmtv9w60gCQ0Run1rYMoSaONbVZmHdzzPZt/63UD7xoC1dWkNooLdH7vQJVZmABFX0KZbBvJ2e8DW+iC/QadCSVVAfiYbtb2aY6w9CyMbgPY73nzU3EPPmL400KABCjR36CQHJD4IaBLfGK7lD2RKlMu4h+KH5igW2KfTuVkGRkNtKEWwXEKcMYTXlValUObSbG2pvDljPBn0ofmNLfVn5R5Io+G+rymNUy1Yaz5cwtpc7QjyTxFDHoC0YUlF0mqlBaNvwv7FeogTch4qOvyMZic1cGjcRgA4Kk4UGHsqDRshVlrVM+3Y4Tv2VDwshDuGBWspOvu5orRHQKpk8mb/+B+GoVmpiKWOm13qMtwQJAM8u7AEDnRGIHlOoydVZkIUZ2phKG6OwxhcbdfN2qcBoxHBg52hhaD6aEcwaSoz/FnfHLtB/lF+1aUszEeq/SQdVXsgFMPx+Yr5hA7QbRCDgoI6TTIoycWgP985Z5yvfn+ANecedQi3e8xt6OZzBiQxkCiVa4Dt/dLMfNtz8O982VWoeUuyF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CO1PR10MB4561.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(52116014)(376014)(7416014)(366016)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GN1SGeTtKqPZXyyhbBOct7zujHG84UtMck2O8qZUBs8TZMq68XN0DjgqPS/wJLd3Be7cj+ywuji4EZmR0p6m0miV8na/pWCJK98Rgbsd7OfaqHhUPS9JgwW+3gw6RKPTFrbqNkVAX4PiSzHsJLCQKygHEXvxHhld/YNjbcURiv4M0UuZu9BgxUxu+qlFxnsx042x94npKHtyCFWUE2HwozzCREEy+WSQnyVjhxQ/2lEmCVJuK5rlo8cRoXnQB9ZDyCS9S6+aheUfsVMiUleDiiHQS5wjAtTXmWo5tVX8k4BvAgXVdEtIzrRLY9G+YzJ+xCtfDZZxhJ2fQxdtUWHGJTSkv4FJ9oCFYi0SVzP9/g6H6jTHGZ+9O1Kpa8/jPNExeSJCasaQ2j/ivJY8OJ9NP3zzZV0Z8ED54gbaNgRMes5RF9MfdUQuWCM6dCgJsbGqdJT9fkZeFjVqauvSHW+gy9qLuV4JoznWiBEDbjgipq4SLFwbRaaRkdDkd5nVO3LST44EsegREgVYPvAn3Yr+Nl4+MbQnl686olTD16TQqe0pHt5zQFlDES5RlUs3MVqYMwQ3CyRxpLIuErRN7/IanecFVC71tglOoTkiQ25KUYOh+IlGj3Z3q5OF4Q5f56Pye981cCZphreCC5GOgqr5nEl1VjkD6qjCwWURn/8vwsynB3xak9awlHn8Xshb8WpEw7CwbfMGOUsmg38BhkSxw22snhmUhYixYWwFMNvzkgHQvi8Vm8QmZx2Pvywcyi54rRB3YljJGDug6CDP/GZ7ByrHRe7MprHNglyO9H0Sm4cJcIbV4o+pAS60F4aznNyVXnjJv5goe0KZ6Mgx5CYESWIjbMs+vZUf78ayPg24MyV7GA2Gyxb6mw7tr/1aqp5g9E3vu2lr9Auk7yEq0wVxcje8YW+ZUlC7ZCAoY/BSgiR1vb3y1l56d0xWiZbj+jNujz0Vyp9sJqxu1j1D4CQRPeZhvbKoLIdenwttip7xYK9AxIPsei0ooz+nEhIfxP9Z36O/PXZaGKG22QR9VoAoAJY9ocveYDnUgAXRx9LAUo6yE2jP4Mh4kBNZvNxU6k6qJZd/qta5epOKwYplvf4CSIQeLq71t/ADJlu8J4QuEO/lBdg3pwffpmhBcUWz1bAs4+vxWKfsjPPnBZAy6SfoPJ+Jn6vTdPBIlhGGM+M9LjrfAawxCAgZoGQS7yVHGej4n01S21rEvH6eLbL4eszxG9IS+cFe5QZwLk2lMvFAJfGrucNmCGKuZN2jpTvqbcPg4jFqM9t4dY5JHNuIxKbk6+RqiUFEdxSzhl2778dBXZLEzxQR6Yw9JSGU+HMRTTL5i/RnBLlt921tehqAgWCOoordPT2wUiElofJ2iNf97shq/9stPdczj5cSJ0V1faTyZsMmI7tKydBnPSmRb4u27dEbYyFGQ9NGzDEXy/M0SpMZnlREvLs9v3kZrcusLZdsB+z9mMNxvzKPgFS6f8EAhPYp7AGrMG2IUtJXD7r13/lzPZxUyDpl+LBWSaOAyeg6MvTj2zTCg/4S0GV2eVnmadHaWWiWahVlmn/AdSnL5ikbl8zXY/CBXFl/pxPlfSka X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: d79cd75a-fa17-4428-5b2b-08dd1d265136 X-MS-Exchange-CrossTenant-AuthSource: CO1PR10MB4561.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2024 16:34:16.6302 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fg9hD8TaDcgwTSz8CvUTHSa/Ggokryyge4DMnh+/tPhFKkDR/8cH9VZPW1ufIkEBbbQ3bXOYy3oyo8DHkKK6iQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4570 X-BESS-ID: 1734280449-105299-13407-1828-3 X-BESS-VER: 2019.1_20241212.2019 X-BESS-Apparent-Source-IP: 104.47.73.48 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoaWxqZAVgZQMDHJOC3N1NjI3N zUIs002TTZ0iApzRJIJSanmAGRUm0sAPScAnVBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.261133 [from cloudscan16-190.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC In ocelot-8021q mode, the driver always enables 'untag_vlan_aware_bridge_pvid' to do software VLAN untagging, no matter if tagging is enabled on the port (VLAN-aware) or not (VLAN-unaware). That corrupts packets on VLAN-unaware ports. Exclude the port from VLAN untagging by setting the 'not_tagged' port flag on VLAN-unaware ports. Fixes: f1288fd7293b ("net: dsa: felix: fix VLAN tag loss on CPU reception with ocelot-8021q") Signed-off-by: Robert Hodaszi --- drivers/net/dsa/ocelot/felix.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 3aa9c997018a..8a2650a428ec 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -273,6 +273,7 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid, struct dsa_port *dp = dsa_to_port(ds, port); struct dsa_port *cpu_dp; int err; + bool tagging_enabled; /* tag_8021q.c assumes we are implementing this via port VLAN * membership, which we aren't. So we don't need to add any VCAP filter @@ -281,9 +282,11 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid, if (!dsa_port_is_user(dp)) return 0; + tagging_enabled = dsa_port_is_vlan_filtering(dp); + dsa_switch_for_each_cpu_port(cpu_dp, ds) { err = felix_tag_8021q_vlan_add_rx(ds, port, cpu_dp->index, vid, - dsa_port_is_vlan_filtering(dp)); + tagging_enabled); if (err) return err; } @@ -292,6 +295,8 @@ static int felix_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid, if (err) goto add_tx_failed; + dp->not_tagged = !tagging_enabled; + return 0; add_tx_failed: @@ -320,6 +325,8 @@ static int felix_tag_8021q_vlan_del(struct dsa_switch *ds, int port, u16 vid) if (err) goto del_tx_failed; + dp->not_tagged = 0; + return 0; del_tx_failed: