From patchwork Mon Jun 26 15:51:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 113022 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7595048vqr; Mon, 26 Jun 2023 09:15:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4rXEZ1k0NSDekZL2SOO7iH20StbWyJPxAtOreChBeUOIx0MJtDsUYU5FiFLTsvcporM+yl X-Received: by 2002:a17:907:26ca:b0:98d:fc51:b3dd with SMTP id bp10-20020a17090726ca00b0098dfc51b3ddmr6757985ejc.41.1687796139773; Mon, 26 Jun 2023 09:15:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687796139; cv=pass; d=google.com; s=arc-20160816; b=Dtl6hSQxyfNuTAexOh1a7nfeKMuhS7I/eK/jDmE2gwWmVy0tnIKt7UI2Z4bB2DY6X7 8TyONxML22BINprkJJMdFCGjGxenv8QTHMwx7LPickF6YSKi528nwcbDb0m77M00u3JC y+8YhS8SaHpeTYcrz3FoLlFBVfTXJVX+AUgYW0pPpJU0v6yKrc4MpSGhkCmBGoAb9QTZ aPUuCXnTSlE4Z+LVEGL+5XFbtqGQNzxn42fjd5rn3T4KIzWn77e2Pq4+JWNT5brOME7d HxUwG61yR7tCHIgUuibb1ZyazBzz7vfdcHkGp0diJ61RCinIHKIb266SqLcEg6Pz1kfS bguQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=31N/a26VP6Op0BEowgQqMdG4BNE/nqcH5Cbyd5rgUVk=; fh=9p/1aqzINVh8DO/zPcykqNKgLrhLVZ/UEQZMM3tSbYQ=; b=IauAociPrEUKotGVdq1fWQy9BtJ5uBX+vz1phFROVVYL6t5Hc8Ct5BdLOi3RMrMCRS CZclR+q7WyH78GpTm0EICG8iJh4JUgCO3VPlBPGRD7ByBo7DmfvkzsrlqHyZlnICrdT+ i13KUj4oO0lKwyDHgnqJEOTAnocANJ2RW2DtCF41I8mGY9yBHoMXOnPF9PsYaVRHi9VM jg9Q2pR2M+B6vxVzJ+ZzjFP4fs6Yw+skvdwXJzzHxlpIchhHv4kQ9VON6viIi6QGTIj/ GKoybMzFSby3ngARGnYhDn8Yn+j0qjqF4H+7tGIb2OF/sqDXlq3mV3VP/h9/T8tbOj9S Nk3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=IcWScJNr; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a170906948e00b0098889bf7f86si3190946ejx.315.2023.06.26.09.15.14; Mon, 26 Jun 2023 09:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=IcWScJNr; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231506AbjFZPw0 (ORCPT + 99 others); Mon, 26 Jun 2023 11:52:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231484AbjFZPwW (ORCPT ); Mon, 26 Jun 2023 11:52:22 -0400 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2044.outbound.protection.outlook.com [40.107.247.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05F17125; Mon, 26 Jun 2023 08:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2EdbOObkKr+RBpRrzrjOkRG9c0cq/JCTfN4Wa0SfyjRuSYUnnPJJD06Y9GQ+gMgYwjdefPPKG+qtR7dddLSjI5Bp4Lhd6Vv3VpXF0eghBdiZwaA3Llh7azF+cr1ERrBmLdfD9nRQvMKbVDmbWtDleUuymuaWhmq/fPVNc7Z3hbiP0z9HP+8NP1WLKrF7Po3wPm25qR5nSEnSli5pFbeyPkW+fnwtCgO9FNK9mvWKrEWOaETDjwKfzECZcoTx6WM8y+y2Tne7pw5AUyriYiJvHGcH+4HTETdpiUrRMIi03RYVcNbUiKYaL1gFLiFzMYm9w6C7mNeIZrrxEm/CpVUWw== 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=31N/a26VP6Op0BEowgQqMdG4BNE/nqcH5Cbyd5rgUVk=; b=kil036e0JIvnE9/TpQZTb5yPv7kbFw+bwB98rptcLoigxOOYXk57Y1Ob0BBL8Q7VKGgkGK2P6PU7xe4X6znXfhpqHGguZTsrNNYAXb6uA3nRpRYfwo5BVwMxzlQZpzbwP7ShgZpyPDVcGgrRCqIENZutF0GZQeJ/WHfmM6WTEvYkN+0H1xXInBRqQJG79VAQvFvmm6epRIKDus4Tz4tGJKQy5wWa1dovoBgmw/fecSKVUEe66AaW+SuId5wOyU5TvAKXLzH+Yk5kndNj987aHH7aMn2O9hzyTAqICQfI1MHHttRBkNeM5mNOtg1PKbybBsNT8wX0dZ8z5Uf8HG6gnQ== 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=31N/a26VP6Op0BEowgQqMdG4BNE/nqcH5Cbyd5rgUVk=; b=IcWScJNrBqNSP/z7bKuyLwdZ/zU2XU/QAlfPy7bqyk5t4tKQU0Ri+VibzvCS/Sqnvod/eKwKaBsMqsCf+eg0/HVsaeSXIpApqoDAuvFbcAYzG2bdftVAt6HRXrIkzI65OIHk2hzVv4iZy1HjsDX939g2buaGyRyAcT/yq67O9e4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DB9PR04MB9475.eurprd04.prod.outlook.com (2603:10a6:10:367::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 15:52:18 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%5]) with mapi id 15.20.6521.026; Mon, 26 Jun 2023 15:52:18 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: dsa: sja1105: always enable the INCL_SRCPT option Date: Mon, 26 Jun 2023 18:51:11 +0300 Message-Id: <20230626155112.3155993-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626155112.3155993-1-vladimir.oltean@nxp.com> References: <20230626155112.3155993-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4PR0302CA0003.eurprd03.prod.outlook.com (2603:10a6:205:2::16) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DB9PR04MB9475:EE_ X-MS-Office365-Filtering-Correlation-Id: bc132ff2-4448-4301-428c-08db765d51d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lo5Jrl3MNX0Cg3qwadIQXWKj24DBAGq2cHitXpCSA0nfEPfFb/8O/C9S9+F9C07GOf7WD9Lfww8AKbDH6S/wQXsZf/gOR09eDr1hjApbU4yK+zYz/UYKcUkQzUnrfPQHydzDqY6K1MWbwB91tfgeJ8DJaJ21fFMTnl7+rrl9+C505wq5fVAf41EiPMiXcADImygv8/fPu8hlcrb8iSIVH7KDj78lWyoD5SU3QLh/fFiTRCRTgYNed9RcNyJ/Gjt6h/WucLjdkulLuFIw8DheSMycgnH+kTtg75mg0C45CuMK/Wf0F/4IGHEpi4dLbqpcDC9tf2mnTs1n56sP6UoKmSHMwvuJPsalrd3NlAqhT5iu3Z8NldSYDUmbY5cTrmjjXGR/rxFr+TR6FpIkGAWM2t9k4IwWFz3bU57FJj2uv/cSQqrNehM9X7lzMhX1XjumK3FEyqqDdMT0ZKi2LsGFJZXQVMLxLlqroNjLT/imdytMPEL9NlhJUqBIKYiXwXUcM9so0lylX6DISSNKO2rtR8vhaa7rh12QE1Lc/oxyh/HpR+fdQ0EuzoA+6A4Aq3kkxvtcPsmYn0xBTFzZDafKHewxlXOJ+zllWt4fiUOO0cV12UgqHquo3b3PM0nYVA7/ X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(366004)(376002)(346002)(136003)(396003)(451199021)(26005)(2906002)(186003)(1076003)(38350700002)(38100700002)(2616005)(6512007)(6506007)(44832011)(5660300002)(83380400001)(8936002)(41300700001)(66556008)(66476007)(66946007)(36756003)(8676002)(6666004)(52116002)(54906003)(478600001)(4326008)(316002)(86362001)(6486002)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xw9AGW42WcyRhWs+jO+0pIVxzv08hQODM5WYijGFInENblFkmtLjBb5rDVhp4nojZqaJiBGdmbTv9N4v17769gA27tAYZel4Jx2XobWWgolrLgM7RC4RlKrPDnTByv4LGACrV9AMi9ff6UhaH4kSJH+bwBFGWhbEuyNRy/R0hGv9p3jggc6AUQwIITBbRxSpHaRwspqKIsuzLqwuJoIO3OXDvOUGTGELCa2GoRpdAQTCWpgxcfHe2lUvwRx3HEmgPracz8MgWNSHyDi6Rz90y9e/XzgxTdfjelHeCUgJw1Yoblz94xbfG4PwQH16OjLZ+4FsU9EkmrQ71cPvamLqm1toog6lRu4suH5JbiEnzQbNKxWbvL69fmAdbaaOSPDIsknpEBnK/lyoQwpuRMlDKFROWJSXJxXiVFUTs8Y6z4zJDvVbWMj6+Gaccd+nmaQtgn6XdCgFjLxnCwQU4Mn2QW4wpZfHPgzWqr9F5Da45p1WDAy1eD9FitNpTlq+pkUyIealz9FHTE1gyg7cQsucuwXbck7UIgI0kS2VQNEQbhlQKNBAUNswZxDItRxbELNmHPdLBnIXTdrs+ZS5Lbx8+wpPpB0wgO1U/poZVvjssOPl6WYQX0mR3KNlLHvPwecfSrSgxugXyXWf1h74Trs6pzldyJC1w3GMPTjGqXum/Q10xrkIDSSEoajLqw45cCoP8HpzaQX4OZQQrpaSROY1h0mZuLXgLoPcZBBvAB0BmDpnUyw27EXhA05x10C9NfHrdNEPRh5dQ5Wv4ZNUtLPz8/tm24a4AZo7i+NrlDYGM7DwsbAfxk2Xm1PbrtwBQEFXme0tIav3BiM484sXT4de+NGw0zcGJ3DpoRuXdVzOv/uFXUcSybwvgLSdcSjG9QnnyJg3Pgus1mZfUL/hkNedZT7OLukv0Br6WAUNUbudFmvXqLJKye+LjJPmD5dKGF75QzqXPW1FnBBI/b9X4gKC1Q2wEcFz0vvRmf0j8PfZNafCdeWkzmjD2ja1idT8ENNN3HcBcXpBqCY1p8vRr2IP7q7ZgaIkOk2fL/dDFfqYFwQEeKLwvS6hYF+36NTLnu4Kh+T/ZwyIQ6M5uYfBY26MyN6Hz/TATplnUJY8mL8XsbYpk5G1w2QOCRnrmqhatc7H/TtN0cs+Qx0nWfzfgNuzRuL8wzv+DWAKIR3jM0IWiBysHLA3HbUQyeTiNYl7zOJfHSMIsJ00Oo055l7QWqaUC6+RUbW2/25l9vr9KUJP/eFuYZDe1UnanOKroCZRThkAiJ/xqPYyAkUhQ3Bb0KA5xR07fm4ybdP0eIUNDchbgq7Npbmb/ugTxokaakazwBRrH1ZIsoyPhHEspWmkEPdasqLfHqrnbBLguU+cCRWzhf8vsLysjRXomO61RG6JqFRBIR57VOpaHQn1obGDtLAxvW65ZbQhpU8AMr9XOOBwJtFxu0ynBrLt3/CtwE4L4gDpnSLME0zxgTehI1qt/Z249+yw+8u1PS0ANqyY2GTHazXa6WcwDQcsLBldrBV9CLF5atuMOaD4LPY7oE0Oy7exM1unvmEPYR1mkz+BBnkg7Sa+VJGpevHVQYrUAzqM99PB9VK7svdE2pH8kXL4ViUFAw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc132ff2-4448-4301-428c-08db765d51d6 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 15:52:18.2281 (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: uU+0k4rqWRwPoxSxQzO6YqhiqIn5wVHCYRr82U7x6i3L2phkiicI2mcljVatts5XTZJjieTHtbZ/Fj/wtEC7TA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9475 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769782524897791515?= X-GMAIL-MSGID: =?utf-8?q?1769782524897791515?= 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. Fixes: d7f9787a763f ("net: dsa: tag_8021q: add support for imprecise RX based on the VBID") Fixes: 91495f21fcec ("net: dsa: tag_8021q: replace the SVL bridging with VLAN-unaware IVL bridging") 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 a55a6436fc05..dd154b2b9680 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -866,11 +866,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, @@ -2405,11 +2405,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; for (port = 0; port < ds->num_ports; port++) { if (dsa_is_unused_port(ds, port)) From patchwork Mon Jun 26 15:51:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 113023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7595090vqr; Mon, 26 Jun 2023 09:15:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52gGyRZk+/KPdWnQkgOKGgeadgVqx6zRVTKEdpjXc7rpHZgMZUid+n0BfyGLsHydDu3I4r X-Received: by 2002:a05:6402:546:b0:51b:e8c5:2a1 with SMTP id i6-20020a056402054600b0051be8c502a1mr10210740edx.24.1687796142687; Mon, 26 Jun 2023 09:15:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687796142; cv=pass; d=google.com; s=arc-20160816; b=xTNUUy24Kz+3A2RhZE7Gq3ChanVDwWv1+CrGBI6ugwZv5X7ySYBQjXPYzOQ+kHYPPU u3JRgf1BCdr0fanrvb3A48dfkQrex9z541PfhWxZCY3dVSRrg67t1wt1/Q01t9fpUEos gPP+qETbwd5LBWRDSrQS9IZtpFVqG0Z9efiL0EC2KCe3iuVbLGuMsj+bUXhbTiEeCpFA jph2jD5ta7gu5BEgbq+kPs/4Da5Oc50Cj84CXhS7t61C5izdUXwtnDomV6Ec4Ijo2jhX ZwwltkI2XRZsaEuvdNpnJ4KDchn9+wevWWuWZI2vewYFDIWmT4km8+rPtcBgnupBKKJq VJBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g0KaiIPfpfV1xAF/VGQzXR9ExTOsU7bKLyM7oUho40w=; fh=9p/1aqzINVh8DO/zPcykqNKgLrhLVZ/UEQZMM3tSbYQ=; b=lqlNWkUmx58w39CsO5F8wYc/VOeQx30oYSoOCJDd8JKAP50bDKUTYhhgaJZmzKxpPt 7UM9gDHKeJYIJy5GVAvAmYBd8OoqIEE4enDD7itk5mljswQU5QaB9DtMT3gu/OP0Awbm wKRuX4gJv4L/SXj/kyzIRGbLtM/Mi0QNJAy/xY9Bj36RpxdS9rJ9Up2JakvOgN9LJeIE CrI1w02fe3qhpBiAcdMn00MokwwDbu9Tw2EVc/zlDWiibmPPyicBL+DplnZxnpJYhMCJ s4G7P7DnfYq3ohIKq54JXExpm0LmcCFap49QXXkhFvC9enAsg4mzPDj/GzQJJe2nCbdG LQfg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="m/A/lRdl"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x18-20020aa7dad2000000b0051d9a7c1d1asi1206812eds.505.2023.06.26.09.15.16; Mon, 26 Jun 2023 09:15:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b="m/A/lRdl"; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231522AbjFZPwa (ORCPT + 99 others); Mon, 26 Jun 2023 11:52:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjFZPwX (ORCPT ); Mon, 26 Jun 2023 11:52:23 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90BFD186; Mon, 26 Jun 2023 08:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ie8eyV9NNzpxQM0GEibbnzfZI8GwX10vMj8wSyJlDjW6FE89i+1loh6jvmvI3tae2O1fmvmBxugRu3+sGY0DtFf3CjirMuZgqypxhLwwoW8iio5Q8xh4BH8LXCKxr/iTme7nS+4PgMU0oOXdQHZ6Li5ZVi+yh4WijZFieT3KUZ4XDDiA1ejuu3ueejNG3giuN0soo38E65adj24N3+16o37Vda30BD/yiVSlruIFWj6NFW4c4/iSBYIHaaGZ/eNrkfJjlDe0susilOPVeAm6L6Y13M/zAc+LEaUVvfUmGq+I32zchEZgysUoVV0b+O9ip/DHVIpIoy1IWtgNnpfhRg== 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=g0KaiIPfpfV1xAF/VGQzXR9ExTOsU7bKLyM7oUho40w=; b=MICj82q/T+oSFfS79eZNdiKbGX3tdqrX2i605WGLUvTYOGH1iALgeKJh9VeNkc2Q+2fGt1W4rY3XArZIAm3QHrRtjtZU8EdhphpucgHaEqGsfF661R5Yrqn0oS4M9gflVK/vco/sl2akEjP3vokqXmYrSxEFYf8tsVmUh3PFjc8fmubFaVAkEAeoBzS90kaxDaO/1+yQC0xXJ1cmbuA4v+51eUCbunPsggq4HCsartn9fmJwD76Zgb2k+RZMRDEwFaSoyFlJGrlziBCYBooOLMFkSgFW5RqgxcD9P1oqA/cPkVAZ/KP2eirZ1nDKh/zz9s9LN9SsRpEUR9fYWS93bw== 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=g0KaiIPfpfV1xAF/VGQzXR9ExTOsU7bKLyM7oUho40w=; b=m/A/lRdluPFvd6Rq4lGg1eeB4yAKMiVUASV0UjGy2Coxoprt2EBmsNayfFcOhChW7HDQBxo7g+fipyeN4Yk+tdVGCgeYBvBn6HSlpEBxT5e5ONC3LpjFZXlu/8Dvc4C0ftqZqzRV15VkAFF8kyiwr/AO2AyPSdvNCK8jJ0qNUCo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DU2PR04MB9522.eurprd04.prod.outlook.com (2603:10a6:10:2f5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Mon, 26 Jun 2023 15:52:19 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%5]) with mapi id 15.20.6521.026; Mon, 26 Jun 2023 15:52:19 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net 2/2] net: dsa: tag_sja1105: always prefer source port information from INCL_SRCPT Date: Mon, 26 Jun 2023 18:51:12 +0300 Message-Id: <20230626155112.3155993-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230626155112.3155993-1-vladimir.oltean@nxp.com> References: <20230626155112.3155993-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4PR0302CA0003.eurprd03.prod.outlook.com (2603:10a6:205:2::16) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DU2PR04MB9522:EE_ X-MS-Office365-Filtering-Correlation-Id: a0f56860-cb38-4738-9d8c-08db765d5254 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XHiHw/ppspfsGmcqma9iCwgGyxhu1o4T5tHCzoy9CyHJqwWnx1yAsM2vrTG7Uot5PjVrs7zfbh0kF5TiongWPYhCvv/3+gHHPvFEGtoD+itFvYzfwEOEsgNH3RVAoh8BW48K27wwWCer9VZTmj3SIVgfYbUk5snX1/PR9nzq9q/8xra4APbLW2gpmjxkNz+WYjT4IdVXb4EO2WN5tP4OMrQ8UhCbewF2wjHPcboqIzCAKSsDr/0pna0R8juR2TEAMToQcaFhQtnwilftQ1LVi7mMgnJI//K4xVcK6sZHrS4pPe7d/BdWmkCoQjqlaYQA4hyk62++ZWRf/sWpXECoV39UdfHE4Wo4uSEg3K4MEl73MMfQ6Tu4++0Ul/nmcYc16Z+C2UX094KmDecO7UoUxuZmsPWWaDAIp9l9LTm+SD1a3Mk1BlWWY7t4vGCoLWOEH0fkEu5VWM0cn6xUUC8o/ZdXedYRFYInVzoUnFZrPFad/Xt5mE+ardg76PPu9CcK1IHfSPJhPZDycaV8BctGCas2+WA3eLXA33Ls9ZnQLn+IZUXGmQ8sRjUH0Ng/KP01C8NSKBG74mBVbmHdXUJF8lnLH/HAQvZ3+7VA2zlspNlZvuTDaG86ehSgMifTcgaV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(376002)(346002)(396003)(366004)(451199021)(6512007)(1076003)(44832011)(66556008)(6916009)(66946007)(66476007)(4326008)(316002)(478600001)(8936002)(36756003)(8676002)(5660300002)(2906002)(86362001)(54906003)(41300700001)(6486002)(52116002)(6666004)(186003)(6506007)(26005)(38350700002)(38100700002)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: saSwCaqu6a2bGZJcCdItKJAlR4i8FZoh45JWY11LMykZZ1tGJNUvq8t1Jw3xZ4kt+HN20wnDKhe6G9cxzigvjMb6L7enubBsyBaWmK46XX2z29p80bakStOgAhzt3isyRdorh7uVVzze2p7ndO5scaAmBASAVAGZfoNNbgL0SHA0qmJ0Br1rsT10zJ2zviugsb1HAurom94MlfgLoYdGEa6WPCSbXk5GKBIKmF1/oCRUa6yB9o3DAStC3FLM0tYZq8jiwMW44KGCwPAhuG/1GAJxD9l9cyNKg7STBQkxQ0IoJwEH63taRd9YyyDVIuiQ1Ku3Nas42v8zWJQekDpNG5haDyWC4aV0oARm3+CXQa2YTauAl3v61Y8IVKopgq8pxaYf+zpVBxIMJapbsfpfaa0rSYhUAklPieLH0sahPqTJWDsI8DLPePQt40rlruMX3dE0tDQafp93RbWkzcf+VTyrLvtI0J2XNML4B4q+tNon7RjGcFHOZpQJt67zK4Q/wKW+4NiQf50dFvSaoVYKE8SNbfAxT01v6xKFnGAsbKBZNAEIrfFnlTMLNoaJH5AznlDzpVu+4LkPnT7dQaPClMEzl8uFPPCLrCcJ/w4yTzAemuSEwrDRcRtL+SM9zxYzvBqbTWcsOuhHE6N25X20fCWA526+6fRybeiG+dRIXFzFfAQWhUsz57L7MG7LRrCLNOD1yXLGYXf4DjsQaZXfygIcURopsggJmSvuGxIEc+i9ixVHprQ6rvqroeYI/WXlMKYIfc/83FKYLACCkVff4CAYJmRoii0PDmhdlWqqd9yNsX31RUgWoNkBwBBMPm79+K1pEpd0gKNDZ1yrmOqEZGe9iwI9XR0ttpa1qQjW5i4Hwteak8X6tW707oVd9Da6k7Z+5+Keld1DIMtJ6bZcPH9edgQDDzUxN1hnhNmXLmBZOoY/QY9FDub1MerBZEiGir/9yTpbfb4qg12NGAFZXyIGpncVa5FkRrNmMlNT0D0wuCaijxKPa29XyRD4brMFVRBlp0I4mnrFevpju3lDlYEUx3b2WBLOe/aKQii/O2hRmOHE5l0K8CMjyDE4wSZNnBSl4ZGpB/edogTpYO7g2fOms6LVRA0gBfq43a5jQOxfXMXauWB7M925/+xIJBtzxrNmr8hf7UvZXpCVuUBQ81vQWp75TrzPwsHsAzKqoJnJhheneLzl1zxPWa0W2aX1k4IPDF8IItStPSXu8nHxj2aHCs+f4gb5Hhn5UNuSKhG4r4wd68HdwmwOd0k/oHXOUrPzBAQHhi5oWPPBLod5UZ+oZ1JebJNo3CExh+CzbIPMs4Yc6ZUQhdNkym43lfEVrtYvUESYLDthKBi2BvbMlAbl8SRuiy56lgtMBIGJbKNFvgqxifnPgqfHnK2A+A+2zfQoAu1waKiqxa5hDMDRCqIg/hJ6wpvu3O1gY6/xxb42QCeO7UwAh9eozcmmkA+CftVCuba7PHuim6rNLqQq+gWm3V12czK5tI0X8kfEoLbltWU5DS+p3uX2KdqK8Cf1Av5vI1svDsM8j0trzr5WbhEwcRdMpu82tVVX4iBIeL2Vw7OgVQJEGTLaslL5rlxf/b11SHEmeoyDtT/Ea8Ssbg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0f56860-cb38-4738-9d8c-08db765d5254 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2023 15:52:19.5593 (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: MQgKCwcyAIDReFYOzhsGh72XGPht5VyexFWrV/LPbqiEYeylliz3V6lvGpNNAvLJHX503HFNi21Ecmc4NiKWUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB9522 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769782528381847123?= X-GMAIL-MSGID: =?utf-8?q?1769782528381847123?= 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: d7f9787a763f ("net: dsa: tag_8021q: add support for imprecise RX based on the VBID") Fixes: 91495f21fcec ("net: dsa: tag_8021q: replace the SVL bridging with VLAN-unaware IVL bridging") Signed-off-by: Vladimir Oltean --- net/dsa/tag_sja1105.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/net/dsa/tag_sja1105.c b/net/dsa/tag_sja1105.c index a5f3b73da417..0e62eab8f251 100644 --- a/net/dsa/tag_sja1105.c +++ b/net/dsa/tag_sja1105.c @@ -545,10 +545,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, &vbid, &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. @@ -562,16 +559,34 @@ 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 { - return NULL; } - if (vbid >= 1) + /* 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, &vbid, + &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-unaware bridged port (non-zero vbid) or 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; + } + + if (source_port != -1 && switch_id != -1) + skb->dev = dsa_master_find_slave(netdev, switch_id, source_port); + else if (vbid >= 1) skb->dev = dsa_tag_8021q_find_port_by_vbid(netdev, vbid); - else if (source_port == -1 || switch_id == -1) - skb->dev = dsa_find_designated_bridge_port_by_vid(netdev, vid); else - skb->dev = dsa_master_find_slave(netdev, switch_id, source_port); + 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;