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/poZVvjssO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d51d6 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))