From patchwork Fri May 31 16:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13681923 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6344616A360; Fri, 31 May 2024 16:50:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174241; cv=fail; b=XVO8l8oXQ6nqJuri4xvor5363AsOiYGYtKyNFeU/ul1ygi+hhRTPwrBELkAmJ/8XC3aCF/Zn/IQDSuQYUbiomsFUJBUiHH3g1qF8agGJcw14XpSMT3BKeR2mUeOQflNMWtxpWmkpWrbr4uvllDoY05UCqCKqdYZTHMVngEmRhz0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174241; c=relaxed/simple; bh=znHkGDGAd2wKa/zwhgRsuq4KoHrinPDFQ3gAC8Iedew=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Y0dgVz27lT+4jfffASTZSTwJuSHQoRT/lTtqwi0Lhb3B8eKFSW58Y7mSXehA9yoyfZgSaRAtv1u09oJu0/i3DHOoUHtlSBzucSDrOz+92/mWPvwtSLeLGGAclQylywp/SPD8EwqJ2NzsO0lWo9D8UHWpXD3xw8+8I5mxQ5cwPt0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=cD4TE2vr; arc=fail smtp.client-ip=40.107.22.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="cD4TE2vr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PYckeTFKa0YJrB9tNrZjLgyPSh78OHEFZfDoe3tRKbsTkMFKjt8hEDwJs+sQE+UXecR6kgYU5pzA5TI+1fvnjsro0PNy3ocJHxaYfDS83Y6gzAbqzLBrZQShVGvnDH4YnXV8DdRGCb7QGq5sgTj3v+o0m3YriWtdVid0uZw5U5VYpVnuHY2eyhYq2XOVrzW6ARutitVD+5z+3NAnuFB0vrRh/1vbzMbKi3jEe5u7Wg6/lkwu/NgnvbFPIyf0ZPmuQE2S17bjfY0SDPzVVTXo5ll6qAyxxaDcy5AnacvPSObi4SGf/aotDN2wJZiWkMuePU2X1WQVojrOqi3phnWwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bmY1o+LEREUeqyvixFHgYYetL1+HS65155+MSCAYiNM=; b=I1NhbWb2cZPwOEUeiu8EZZv+tf2Cfy+B3TQL/LKIUAeyVwOs7ksjvDpOWbjUYX5U4xiL4nNSabU597i05utblgsD0MuSQlzFz6pTqXfReSMMtYLY69SpC/45dbol0izKJoTMrcZ+BcyM0p8VvVpJIj4kMbZ3tZGpObO1FqkCTQOe3E5q8aKK8r8zC0+HXTXBSbaHGwwavQnqRqfbdgA5I4C2Iqzs+qT1gOsDGvlaUwKIST7wNGie0wcPig+ob6I5CUWGga0dwKOK6EJGRNtmbLfIdZDOadwzRUVPYLFxtxnlOHbKGk2V/EjI5GapxbiWghWX2uBtKE78ufLF3QYS6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bmY1o+LEREUeqyvixFHgYYetL1+HS65155+MSCAYiNM=; b=cD4TE2vr1224uf8QVEWZWEr7fASwW3uL2vg8jZhQfiM7uVIzr2CjfGks+r//T74kvvIdvbR4OZhxbmr0K5GB+36X840QrCEXGA/nE6IerSkYdX8WiBV8uD42rbHfKD6y1w5ZjBz+4oRsdp6MaF6DNBctgUbNOxxcgpKKzdEId/E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) by AM8PR04MB7233.eurprd04.prod.outlook.com (2603:10a6:20b:1df::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Fri, 31 May 2024 16:50:35 +0000 Received: from DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a]) by DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a%7]) with mapi id 15.20.7611.030; Fri, 31 May 2024 16:50:35 +0000 From: Vladimir Oltean To: stable@vger.kernel.org, Sasha Levin , Greg Kroah-Hartman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Simon Horman Subject: [PATCH stable-5.15.y 1/2] net: dsa: sja1105: always enable the INCL_SRCPT option Date: Fri, 31 May 2024 19:50:15 +0300 Message-Id: <20240531165016.3021154-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240531165016.3021154-1-vladimir.oltean@nxp.com> References: <20240531165016.3021154-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR10CA0093.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::22) To DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) 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: DB7PR04MB4555:EE_|AM8PR04MB7233:EE_ X-MS-Office365-Filtering-Correlation-Id: e037b366-8f13-4d19-10d7-08dc8191cad5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|52116005|7416005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: d5WshqA8wVFMZyOmU7NRGu4XWpgaK3JTNjsgtu6Uu9NFpQHqkD8gWSuNZ9Lm5RVX0HD9mHGVInwO4IqX5ms505bv4RrZ4Fc3OzrMKrsDtgS3AQt4D5YUTgwgyZ7/utRXDSXObC6WRhjW7Fs2V6yzg6lqQO13QnS55lH+3a/F1YynFqqR4ob9B9qesrliuBzrBUp5MYKKnVu0iX3Jc+8CTrPjBqUTj7ylLxaSk23NA2d9Djy9dUAkQa5fhVsBjrHSUgfdtwyKhUzTH3KmafJc/w8EEhn5b+o1PidUO7r7wKppppEQGNtiBapn95RDXaLZXwK8SvFaxKYgKxH1CXyzT9dwLkRAIHR+aj77p4Y1FY+6ReyC7qx3aL8t3az6BDT0IL/ERWZoiR6MpmXD8Xw27uId45095HOP077e82nesB8WnsdIEuXf/BafOYMLkE9c/ZmB49xLih+PeaKopE/7ZJtio4qFWQaeL5u0J0TAaHbJym7J5vzOeVWXnSt9vz9/IVitfGXclxNDeEhL5HcgteKyCnvpX6tIsS9N+Wx3i/o4ZvVggJPbGPqmfYt+xHU4MiICivslcMfQNv1DDcHiQlD33DS7W4Lht5I31UfwDEvyeSwEZbr3ZyCrdgH+74YyDNx6pzCWM7cOMSjHZkUV1n9XiGUH/hN06zkbq7c8TAqZxmNYCpZeFuBoBSGMu6MtVrfCpCCNncWMb/+zvdJ8iAqA5Q5zfHQJNwCVcwasn4+L6M9ng4Mehafg9oA26dmIrz8bUJQEYRjW0sNp3lFlBnccUtH1hnVsrpr6yzJFu7FIyO2sK/LvzxqqbXI9lwK8aiAs1npefub+mwClWoahiqbyLpGKoDRB5kDou4mrb6Jx6nMpTXLA1o8nq2XVPKth4JqdeWqFp5Gxi9qhos9aIopHwhrt7A+2CBHm4wxhpD4yU69wc5g0F7Wj3jTOFamXjUWeGaRiX4TeaX+Xp2O9DC41R02eTe1kHJdz4aIGeTHCMI3g87cujZjU4LdsYeBLqDOXZ7Di5N18APXg8bT4s/PhP/6yww5OAa92yfS959hzTaXVr+539sK+wrhmwTflghgBWx/Thj7zXJwKH1sqZMPTbsxz1hQYCydy1/N1gCK9Ilyf5Z2PVOYegUajGjFD6khwjAnxgYb2YokDWT3lxPBz/0UieVY2jU2O2AjEEBkvRtfzKcdADwy6Z+RW64ZksiXiU+G01xY1kOtZ1fJ4fdVpiDoPJapAQ5k2l+joPIQcd6knMUaDZ696iJZAS3K1V7dD1Dl+gEIHExejrkIxUoMSh5zUpmOoNlPQBy4713zEb+094LoOj91PEwzIDlH20B0lvHuXk+j3ecV2270gfQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(52116005)(7416005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l1e2arjndqCP6+L3I7jaFtf24U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GuhpJSaLX0YNI34tBLZfUdjPWpw+pSfHkUx6M4Qtv7Dl9ibQXQugFA1RSc3DPjh8SxzBlVyIihoWv5cybaLXId+b+Gb7C4cRdBGmZR7n2J9FhZky52+fPNNqjgPQet8ZgClMjCEomc6MnUX1cKOhGwZrd5eS2+IxIZj96RSoLwtXLHD1U88K/MiKGI3QdhJGvmZ1nsNzi7RJkn+hL3r2q6zQ6+WJaLrYCSgv4V1Qzdj39/NQIUSLYYTfsfgXuR3axnnkg+pHH2dpK9XV8sNU719GYok1pOpiP/8QnBuZidBbHs1umFtSZzGSu+iRVeKGqTZizLpzrXwuzxro1sRyWOkyOaDgpbCz+SUdUogA5grtsgWofeDM6ntFZG5q6Tk8dJvnbIkA0zy+5MpphZ8A6W4ucluRwjLiufpbqFqYUGbeACpndUUl0t3S9iSc79rXIVV8xfQObsCPN4NVHdAPro1OC8KtVmlzSsBI5l1cP3Z4QJ3EmEmeRNYniikw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e037b366-8f13-4d19-10d7-08dc8191cad5 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 16:50:35.4195 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T76d/Xm25i+Qn1m1GDMdLMhDG83tj5ZnPFWgfvBylX8JaeCZbE2gIw1wvby5Ap/J02F92YKiNdz4KFrpTjTh7g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7233 X-Patchwork-Delegate: kuba@kernel.org commit b4638af8885af93cd70351081da1909c59342440 upstream. Link-local traffic on bridged SJA1105 ports is sometimes tagged by the hardware with source port information (when the port is under a VLAN aware bridge). The tag_8021q source port identification has become more loose ("imprecise") and will report a plausible rather than exact bridge port, when under a bridge (be it VLAN-aware or VLAN-unaware). But link-local traffic always needs to know the precise source port. Modify the driver logic (and therefore: the tagging protocol itself) to always include the source port information with link-local packets, regardless of whether the port is standalone, under a VLAN-aware or VLAN-unaware bridge. This makes it possible for the tagging driver to give priority to that information over the tag_8021q VLAN header. The big drawback with INCL_SRCPT is that it makes it impossible to distinguish between an original MAC DA of 01:80:C2:XX:YY:ZZ and 01:80:C2:AA:BB:ZZ, because the tagger just patches MAC DA bytes 3 and 4 with zeroes. Only if PTP RX timestamping is enabled, the switch will generate a META follow-up frame containing the RX timestamp and the original bytes 3 and 4 of the MAC DA. Those will be used to patch up the original packet. Nonetheless, in the absence of PTP RX timestamping, we have to live with this limitation, since it is more important to have the more precise source port information for link-local traffic. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Signed-off-by: Paolo Abeni Cc: stable@vger.kernel.org [ dropped Fixes: tags for patches not in linux-5.15.y ] Stable-dep-of: c1ae02d87689 ("net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 493192a8000c..888f10d93b9a 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -853,11 +853,11 @@ static int sja1105_init_general_params(struct sja1105_private *priv) .hostprio = 7, .mac_fltres1 = SJA1105_LINKLOCAL_FILTER_A, .mac_flt1 = SJA1105_LINKLOCAL_FILTER_A_MASK, - .incl_srcpt1 = false, + .incl_srcpt1 = true, .send_meta1 = false, .mac_fltres0 = SJA1105_LINKLOCAL_FILTER_B, .mac_flt0 = SJA1105_LINKLOCAL_FILTER_B_MASK, - .incl_srcpt0 = false, + .incl_srcpt0 = true, .send_meta0 = false, /* Default to an invalid value */ .mirr_port = priv->ds->num_ports, @@ -2346,11 +2346,6 @@ int sja1105_vlan_filtering(struct dsa_switch *ds, int port, bool enabled, general_params->tpid = tpid; /* EtherType used to identify outer tagged (S-tag) VLAN traffic */ general_params->tpid2 = tpid2; - /* When VLAN filtering is on, we need to at least be able to - * decode management traffic through the "backup plan". - */ - general_params->incl_srcpt1 = enabled; - general_params->incl_srcpt0 = enabled; /* VLAN filtering => independent VLAN learning. * No VLAN filtering (or best effort) => shared VLAN learning. From patchwork Fri May 31 16:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13681924 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2043.outbound.protection.outlook.com [40.107.22.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5366176220; Fri, 31 May 2024 16:50:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174244; cv=fail; b=WBvJXTwOt1H/4y7UpfIxTzUb1V1MOpZnzUwzgnhifqwiWdX07QEyEQg4lEy5erV+8oBloZbL69PdNNAXJhKJzkEdUOEwGCAHm00v792g5oOKwsaKD+YqUNz3wlnoLg2rMVG7jaVKTHOKzkoAWMlOmsFuKPl9+9whq2Q/jL0X0dU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717174244; c=relaxed/simple; bh=0K2ngxY90rYCqbqMZNurw8oLJ9D39JP+SMdsqQRMKxs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=l5y5/qal34IIfoTPFMgwMjQkAHDalEhcAFWiDjt9EEBTynaZo9IOxp9PkwmZXuV+xFtRwhChzMytrXGpPRTLNcd+V+XfdTZ+2HCBKYrPS0pcof6rtH6j7MoXVbuxXaWJ4a4qY3TlOn6XDl1PTrhDUY+d57XFSpz7EV9bP5NL1zU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=fwlWT/OV; arc=fail smtp.client-ip=40.107.22.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fwlWT/OV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k5Cl22wIT+WhAnVNbdI8kaHlAZM4Ax2C/HYduN0lnF5DW5FxK4Pchm3PMJx7gHaG9Bz2nzuf+7hwp5fVpMplbKcf1jOi3iJ4md3BBpt3N5hIMHl1ElnyVXG3gyyKPqbN0a/8Cpk9r969PV9xz+TuOJthkcqMu5V8KhrTnm0GRVWaUZuOqqKIgPD9j4OUtauy4DloyXTCpF4XAGS/s177gk/Pk6ie6kmTXU3aniHxhdvYjRBknaAzZkKuD3FjOxSaGjosddr9jr/e/cLmRAo9NY44jVl6G0iilDHuRQdD1wBXeUAhZ9KansD0rifC91MOBnUKWc+LbuRqxK9h1j0g6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=k1GLL22PJtQ9uo6lVy0+SUqwdLR5lFOu5hKmhM+Dzrk=; b=gqbVz/fCB9SOaRlYKYfv+2fFtnjwfY5GebK0DHxbqghHwrNvAeGAxRdy1FFAd2nHjASaS9TwUeD0jeDVJ/WOgWjjYR3TUfQTfRsUQvfO6oZ43qvoncO6v8RXO1n0ZEwlD/sds/EI2cqZtaEXRZPiQrTsY+McrTMEof05VuyX3Z2VxTByYIywcQ6YEf4377CfXy6eAbCNcGj/y+R9LAOI0HPgJOSBuLiha/y5fJ54rVm6l4qr6q0zdCwosqRZ5/MjHWIiJ5AwERcMli+F/S5FZHXqUKIaNcXkd7m43TyvU1WoVBIALg7lYBTvCCTUapJezYM6TjGcHBJdTWYYIQGKOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k1GLL22PJtQ9uo6lVy0+SUqwdLR5lFOu5hKmhM+Dzrk=; b=fwlWT/OVECIGKlBGy0uIHTep8ilytyyzOL5s+b2m4GuIsOHPjLayn0q1MW8Fd5QyJvAvj3TDMbfw3egEkcBPLLp+c7tZxKEPXjBS5WSy2BJ3PqEMIn75RZceeZkUJW4P/aro5O5vhsjB/NDLI9XPCX7t4AKi1DgQzYC4az7+0FE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) by AM8PR04MB7233.eurprd04.prod.outlook.com (2603:10a6:20b:1df::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.22; Fri, 31 May 2024 16:50:36 +0000 Received: from DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a]) by DB7PR04MB4555.eurprd04.prod.outlook.com ([fe80::86ff:def:c14a:a72a%7]) with mapi id 15.20.7611.030; Fri, 31 May 2024 16:50:36 +0000 From: Vladimir Oltean To: stable@vger.kernel.org, Sasha Levin , Greg Kroah-Hartman Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Simon Horman Subject: [PATCH stable-5.15.y 2/2] net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT Date: Fri, 31 May 2024 19:50:16 +0300 Message-Id: <20240531165016.3021154-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240531165016.3021154-1-vladimir.oltean@nxp.com> References: <20240531165016.3021154-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR10CA0093.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:28::22) To DB7PR04MB4555.eurprd04.prod.outlook.com (2603:10a6:5:33::26) 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: DB7PR04MB4555:EE_|AM8PR04MB7233:EE_ X-MS-Office365-Filtering-Correlation-Id: 59850258-b716-455b-bbde-08dc8191cb8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|366007|376005|52116005|7416005|1800799015|38350700005; X-Microsoft-Antispam-Message-Info: f89sr7RxieAuSJKmNEe2eiIZhVQgvw7OZUQ/GQX1wIsrgpy8gkGU7sgV3ErMkzW11v5PhvSlIDsBkpb6X+RVaScNhdOTkYeQVKmURfQJrclGGjkHqyYBW5sQ8emtlKNIjWkAmB2FiT3yqzaEvc12+Vb0pkfP5nIiVI1rFbuHSFaJzbAhwaOc6K7rBcXg2b1FIGS8/DeHQG83UJxejp5iF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X/4gW0a+x46Xa5qoZC++olyG2ByzL7omo/wWlrwGFjBbeY78OnBWUOR2KFPL+TxYoMgkg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(52116005)(7416005)(1800799015)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tQ4Sgc8LXnbUYhnv2d7kyz6y5HOJEM9aofsUmWPb306YVz/15PlAhMNRPWFe+/Es1PXG1CZS0B+YApNBhvlp+rKEOnshATQQ05wFPHEGVobOn1utNei+tvV3pbAEHO6hEwnZvFVRwTk9uoeR/luZL7cSKLTdvQxnp3pWgrsfh/tshrPeTDUTcNlzXlQiw2RqYYD2c2gI0qHjz/6R+esZixBQYklBqvNvW3mbGKo7vV5ST2KE3FFFhw+azWZAcWe0aCWCMNVs+5cjzLcMpC1uvN9kGNuebMv8PXfjpfD3Z4kdHlwPmOLsZMxKK3z60WVzNEmoiJT/192rD643YK68hmUHdPX0tcxSEAuc1IhT6keZn3EM00D8eF/hH5gwxlA48i1gIxNJgjL1WzLmah8cipvkNbtQuxcf2Br6OtTXVlPfzmnoWnoamjzyxE0TwTHSdfjlj1k2JE/V8sCpoZxRUtQtTHEWELj+kpMCRyjbA3hhuLogZXq8DdCxsHCDZRF1RL49fd7NmAN3WBuDNHdCKFKedeZ9aNRaCS7pG8ypqE1LzPwhePhkEyNfODeiETR/acXX11loCqEoowdKzY7J1LGbrpIo+CM+SZQV+ZQscW53woG0kH7am0xDRM9QaoXxBEo3fZk2Sr8rC6ndraZ7uTh0dLMla1jAsdgDD3ayc4PaXyUYqwVuO2VvoQ/+PEaT0KBuRRNo4NmleY77M2QqhYbE/2Gazt6qTMj/Hdnga+y9ZT9MCDNbVqn+7ZwzQtlLdy9plRJ2Ybob5HcjV2HbO2OD5dZ5zajeBNqPgli0V6wt2BRet2yogAVF05PRtyxy5s8Ciiz3Tr0JHNdRcRgIZPresbQkSDJxzESg+ZFNzjfJjKk5faU88rNoOqn/1VTuS763HgVZsdFoO6XqjpKnm3It7CDtrDWsSvW53Hwye7Fcbw/Ng5S8Val3TflQkOZEUBD5udBiAsooQll0WTlitVxCOz1cBTEOpvGAiPBR6c25ewor8zjbvsOCI9YZjRglDJSMjCQ0VOBBhIYu2SgZskNOZlHMxftEhZPgwM7Bka4r+m3vS9VPhCoW8UCB5Bi2dN9LNkY8PoEmhINbCAPRpzqyalcAw7RPt7FR2uMlYzROGNfp22Z3q6LpHVW28wF3x+xY9BwVc1m3MjAw/iaGqw4oSHP1I1RyEryLizfwf6r4jWsBJXCriUUDdp6xqIno0936m2g5WV3bC/EbUDzpN1N6HA/PPwSsAwivxugUrDzyZEGMuSWLpRqMuS7bvPafLf8sow1DU611W5+8G/HZXofF0OCsfMO0Oe+gsyqXiRHU1qpLb+ndWEbqFwCtVi8TqA6GFwkCzoYlcFSjQsfMCuv1qZXIDesx6GfPjIOkHX2X/X3a1+zmFV03yh3fEMJ5G3P/YGw4ujlp2wBfwQUxgqieAy7PEilOMRqKgva/Rwqg6T9s0oWRCrT9gyFh14EkeeN0G3Pglfo8ZXG2kysyEQGc6O3Q70WgYTyH8nXUIiBje5LEj0KhIAiTKc5ASmbLk6SoFMetdrNg22rNc4zfx6LzK+THuItxuheTABFXB+SjQEjVZwySwOrQhwoBBz3QFJFrQpt+IiddP+RYS2EiNg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59850258-b716-455b-bbde-08dc8191cb8f X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 16:50:36.6520 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qQ4qPEqZ8lFofsQdZ2QI4NPZGT1+jhHBLeFATFeewSlNOCkOsD9QL4q2LC8b2m9lk6WjOkvmQAyK15k4bcvx9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7233 X-Patchwork-Delegate: kuba@kernel.org commit c1ae02d876898b1b8ca1e12c6f84d7b406263800 upstream. Currently the sja1105 tagging protocol prefers using the source port information from the VLAN header if that is available, falling back to the INCL_SRCPT option if it isn't. The VLAN header is available for all frames except for META frames initiated by the switch (containing RX timestamps), and thus, the "if (is_link_local)" branch is practically dead. The tag_8021q source port identification has become more loose ("imprecise") and will report a plausible rather than exact bridge port, when under a bridge (be it VLAN-aware or VLAN-unaware). But link-local traffic always needs to know the precise source port. With incorrect source port reporting, for example PTP traffic over 2 bridged ports will all be seen on sockets opened on the first such port, which is incorrect. Now that the tagging protocol has been changed to make link-local frames always contain source port information, we can reverse the order of the checks so that we always give precedence to that information (which is always precise) in lieu of the tag_8021q VID which is only precise for a standalone port. Fixes: 884be12f8566 ("net: dsa: sja1105: add support for imprecise RX") Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman Signed-off-by: Paolo Abeni Cc: stable@vger.kernel.org [ Replaced the 2 original Fixes: tags with the correct one. Respun the change around the lack of a "vbid", corresponding to DSA FDB isolation, which appeared only in v5.18. ] Signed-off-by: Vladimir Oltean --- net/dsa/tag_sja1105.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index a163f535697e..aa5d234b634d 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -489,10 +489,7 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, is_link_local = sja1105_is_link_local(skb); is_meta = sja1105_is_meta_frame(skb); - if (sja1105_skb_has_tag_8021q(skb)) { - /* Normal traffic path. */ - sja1105_vlan_rcv(skb, &source_port, &switch_id, &vid); - } else if (is_link_local) { + if (is_link_local) { /* Management traffic path. Switch embeds the switch ID and * port ID into bytes of the destination MAC, courtesy of * the incl_srcpt options. @@ -506,14 +503,35 @@ static struct sk_buff *sja1105_rcv(struct sk_buff *skb, sja1105_meta_unpack(skb, &meta); source_port = meta.source_port; switch_id = meta.switch_id; - } else { + } + + /* Normal data plane traffic and link-local frames are tagged with + * a tag_8021q VLAN which we have to strip + */ + if (sja1105_skb_has_tag_8021q(skb)) { + int tmp_source_port = -1, tmp_switch_id = -1; + + sja1105_vlan_rcv(skb, &tmp_source_port, &tmp_switch_id, &vid); + /* Preserve the source information from the INCL_SRCPT option, + * if available. This allows us to not overwrite a valid source + * port and switch ID with zeroes when receiving link-local + * frames from a VLAN-aware bridged port (non-zero vid). + */ + if (source_port == -1) + source_port = tmp_source_port; + if (switch_id == -1) + switch_id = tmp_switch_id; + } else if (source_port == -1 && switch_id == -1) { + /* Packets with no source information have no chance of + * getting accepted, drop them straight away. + */ return NULL; } - if (source_port == -1 || switch_id == -1) - skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid); - else + if (source_port != -1 && switch_id != -1) skb->dev = dsa_master_find_slave(netdev, switch_id, source_port); + else + skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid); if (!skb->dev) { netdev_warn(netdev, "Couldn't decode source port\n"); return NULL;