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+gpXXVHig4ymuQ5TKiZUOCCJOGrJftEDEMkHiPNgyKX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Tv2VDwshDuGBWspOvu5orRHQKpk8mb/+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/IanecFVC71tglO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ossTenant-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: