From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A49160A2610 for ; Thu, 19 Nov 2026 03:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4rBw6w8F; dkim=pass (2048-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector1-NXP1-onmicrosoft-com header.b=RtIIU4IW DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=8nmjXJD5/za3LN8wxhZ0o2lnHlvy8a7k/R/h45WNJbs=; b=4rBw6w8FQiD3US62r6jQ7ptMrc noDk0XOxwAx/UB6SZCIwsNv0KDUlp8MvhPwi5N94ARJ2GaA/WsvDfyROkSCSmXsvqM7ANVlBwXA3O RKiydzExfaopJXyUXi/lcg5v1cHzL+mrlUXFRtV8Sa2M2RazaekeJJZajBxv/Pst61q6FdDr/qTqM TQC+ERH23JyaY/TKK9/s68wiK0wyO5JHVlQCpWwnqwoLFSBBETZO3bJg8J+Uki7PeNzS9RF6ihBd4 jI+NoHwvMK5NuNMMcRT9bqbEarhkPQu3kj9shWbNWO672JrBE6agSyuuZ5yfsXNT6QRIIP89jPIYc zpR2RQsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTsOJ-0000000Aj4k-1lfV; Thu, 19 Nov 2026 03:00:51 +0000 Received: from mail-norwayeastazlp170130007.outbound.protection.outlook.com ([2a01:111:f403:c20f::7] helo=OSPPR02CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xTsOG-0000000Aj3u-2jy3 for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2026 03:00:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Vp7SSySIQbBqbWwIwhfqg9FUarLxY+0OnTyLfHMgB0TTA4FlUb3LdLJU6v8I3DLO1qoYAIpVQqYu4ABnAvIVNdWx8MF7s+NPc35t5Dyr8ylEv0BPb7YfmvW/sAgGDaxGuSj7r33+7kQq9wKE8/n7lwfzFXZ9CL/y0nClECGBj7sse+4ElAS8FX8r3FfoAnULW96K3nR33q2oSUr6kFcpGn5MQ0CR/nsgis/xn1wCKZzytdJg7TbABjDfevr8f6ZxA7mnSJef25hrN7zoatlPrzvG6S71QnFLMohsPFdRMQmpCn373McgSiWtpCkNKmUzBLHlfEYfb7v7QtrI+vnlLg== 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=8nmjXJD5/za3LN8wxhZ0o2lnHlvy8a7k/R/h45WNJbs=; b=mcPFJzpFadnWvfCncv7iBNsB7TBDaLRwey+mIFyD+lb3u43YrYk6c4qvz3srNT0ApwPmuoEsUJepKBjFeiOpG8IxpTLHb78YUPLyR0ZV70lhoWSX5wZzbiTfimueFIpS8lV+j/T6DjjQL+wFks4O0y6nQZN6ObifsvO19akxR3h3wue6juQ0d+OIwYKoSyGTshKz8pEW3UIIlRs+aDJtVj16SuTnVHldlSAYz1sigDXJsP1UgxkpQ9p3+niAjDuQ4zDzFoCfFFrWutyVpfPfXFgmEMmK7lyFOYEzN6QGvnDajI2U+zdmPtXpDCYJacs7XLJ/B6pnfTRAp52urLW/rA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector1-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8nmjXJD5/za3LN8wxhZ0o2lnHlvy8a7k/R/h45WNJbs=; b=RtIIU4IWuW76J1fWlmTKrHmNMeA7+OINZdlfDocitAq1Lbuq2avDcYt6gKAMlgToQeNY9CS3qz8gTWwW4GGKUMYJfqAvMpZ/80bHGqHt3bVvTHpo5k8Y2RSbglNT6+rLwrLI7hQQHBNPdF02qBjCiowOJ4ovDsaxj5YtMGV1Jkpsg23pZGlk0VmY6TVM3KVBCNXTAdy7tCDsfaZTAnesY4Wpx7+IVAmr1MY6xF4oJmf6Sz1Dm6ZUfVxRezPr4XGMREEP4Vt8WdFElrqqUo1nMoaXxmOtQg53aXPXIi+P9U98r3Y/cM7USVUe51JXUGKN7+V/6eb7Uu7npieqp1KuQw== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VE1PR04MB7216.eurprd04.prod.outlook.com (2603:10a6:800:1b0::22) by AM0PR04MB11880.eurprd04.prod.outlook.com (2603:10a6:20b:6fe::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.615.16; Thu, 19 Nov 2026 03:00:41 +0000 Received: from VE1PR04MB7216.eurprd04.prod.outlook.com ([fe80::a9a5:cf83:dbe8:1f74]) by VE1PR04MB7216.eurprd04.prod.outlook.com ([fe80::a9a5:cf83:dbe8:1f74%6]) with mapi id 15.21.0639.010; Thu, 19 Nov 2026 03:00:40 +0000 From: wei.fang@oss.nxp.com To: xiaoning.wang@nxp.com, andrew@lunn.ch, olteanv@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, richardcochran@gmail.com, linusw@kernel.org, linux@armlinux.org.uk Cc: wei.fang@nxp.com, imx@lists.linux.dev, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v8 net-next 0/9] net: dsa: netc: add PTP support for NETC switch Date: Thu, 19 Nov 2026 11:05:25 +0800 Message-Id: <20261119030534.1892935-1-wei.fang@oss.nxp.com> X-Mailer: git-send-email 2.34.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI2PR01CA0011.apcprd01.prod.exchangelabs.com (2603:1096:4:191::6) To VE1PR04MB7216.eurprd04.prod.outlook.com (2603:10a6:800:1b0::22) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7216:EE_|AM0PR04MB11880:EE_ X-MS-Office365-Filtering-Correlation-Id: f6163275-1743-4b12-9f00-08df45e94b1e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|23010399003|19092799006|7416014|376014|1800799024|18002099003|6133799003|261009223027099003|921020|11063799006|56012099006|261102130727099003|261102123227099003|261026121527099003|261028144727099003|261026140227099003|261021123027099003|261021121427099003|261022075727099003|261022105027099003|10067099003; X-Microsoft-Antispam-Message-Info: VPjpZt8u9+2LBFhxPa0xmGlILugOKT/nJc0o+XoM9degIBCve+391Z/NxF/4XTmCbnKObrw+CQ0myWqneyiGu2pJ9P0VJBQ7Gs2gE9bhq+65ta6PgQC9ODtXYIN65op4W/Adbw9BuIe6LHxCzirACY8k9NQBqQLWV5rPw8ohos9Y5KgZBPFfaKUmi9HLjKf3SoiCKRBVTrr9Udj8GlP8ou0+n1kl9dYQuE71TczkLgZ3yYCXWg99JOUz2rdiMTBcvvPuct4MZunH2Z+N2pHKc4AhTXBhfI1M1kqIWnxVcyyYAzYK0LWiafYwFcOcvrvMuB5UiPoQNnslc7QDXq97Ia9FcErSybErJJk940l7oEGPuIVucqN0zngf7Wciq7EGJx1jOBW7jHHx77zMgSuXIJkMrfnHcOYdaGe0J4cF0EnacLB8Pm8GSdnvtmbNd+jwjVJQN+xeX2QF8o78RC+cY+q8/B8sn5tHb3lfWkfHHwT4g2gSSEqaVoqvqdg+UAVLdMMhyH03RybGIA1jsrX5ZhPTEpGqSEKUgiEuwmKSorDThAmCsJHgbiZ0QmEKBRt/WfB/Yd4tTikcawlTRuj+zYYXd+xYGkhpSu/H3IDyk1z40YyaZt1trWWO6PZyRXLfjdSc7xcqvGu0ViImuICjyAGJDGSavP9IKkOmoBe9bDQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7216.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(23010399003)(19092799006)(7416014)(376014)(1800799024)(18002099003)(6133799003)(261009223027099003)(921020)(11063799006)(56012099006)(261102130727099003)(261102123227099003)(261026121527099003)(261028144727099003)(261026140227099003)(261021123027099003)(261021121427099003)(261022075727099003)(261022105027099003)(10067099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?xzvAUOzntyjc6HlBrYPOjgLn+5LQGI9wT9zzHsaKwi7ljDWGJyntq5DdcHYl?= =?us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Y3nfb8NzK1j09X5qrAdn?= =?us-ascii?Q?C53X2CpEiG6A0TmHYQH7GgFExTxVqJ/Gq15Uing6hYuanYjeE0kHyL+i/n2B?= =?us-ascii?Q?lrslSOLcePqCHUcSwakay+Z9oScLNb4Usb7VhZOrKCw6ibjomds91DoGSCp1?= =?us-ascii?Q?u3K2t6qMto4fOcwQw56GIgFi4uYhoNm0jjcTso6UYsjWT/08O+P6yzqOYz1U?= =?us-ascii?Q?0Byiq2dYpmq1+wStzBayQgsouQDqXV6kO5NOcMn0bT8XncpSkA7it9Sb53tt?= =?us-ascii?Q?eK0nONSJopjisdAPfr6mvgpyZGs2dctWZwMojzKNUxLEH1pAltETP2pQwzVY?= =?us-ascii?Q?hymENV9KcySwyKj4EoM8TgWFmFznmQ0pkIVolGF9dfgTMyLf+MB47pOzgx3B?= =?us-ascii?Q?BKf8yTjU9KQL6q5UrMWqYTIyG4lGHZd8fyWTdATzsl4OdKUgbbAm5fXHWdJN?= =?us-ascii?Q?JoyXsSL5XWz86qUg8mJ8HQB+cLujTTcXsEEVCEHZkCUkROe0Xppo/aOz6GFD?= =?us-ascii?Q?ns6Xs0Ic16OnD5F57MRkQmwObQlq6gGZB8W4MYJiPfFrOU8976F0yfN+S5Xc?= =?us-ascii?Q?WknEPHVflIRENreNmDingD0WLFkHJAJXA5oDvEa16viHvrHp8OIwhRVXbbG5?= =?us-ascii?Q?/lTooeV0XIUGRRPSUnCLy4kz7GfHM7+Ty7rsNv6/6JlYe5DJBuCntVK/zzxU?= =?us-ascii?Q?bE9ZYfSO5cprIhENbekZo4Rp7b2Fz9XWwvSHQ9yQVVPBL/Sm+2PuLJ/7VhT+?= =?us-ascii?Q?SxZ3qM91psWDKYfMXQg6WZKN6g2eje+p0WEqq95CgwL0FAFlOBitrh7Ppso8?= =?us-ascii?Q?o38uMQdkiiM21t6v5Gpxyfu8OXCg6+jQWuWyJJkBukaLfyqWW+p9?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6163275-1743-4b12-9f00-08df45e94b1e X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7216.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2026 03:00:40.5378 (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: w1tLN+wPu8w24OIn/YTE7Q/WvC8j5Kz07yugQeQ6o8aTkhQMZQXN9vR5rsw7+0UNeI9Cdcx/h4QoIQslVh6WfwGBntaO5X92ELBkYXuthl7NT6yJx2omUMiEmhrteRcB X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB11880 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261118_190048_726217_AF4A293E X-CRM114-Status: GOOD ( 16.99 ) X-Spam-Score: 0.0 (/) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 From: Wei Fang This patch set adds PTP timestamping support to the NETC switch, so that the switch ports can be used for IEEE 1588 PTP synchronization. The NETC switch has no time registers of its own and instead shares the PTP time of the NETC Timer, which is a separate PCIe function driven by its own driver. The first 3 patches prepare the Timer driver for this role: tidy up its 64-bit register access, drop an ineffective reset, and export netc_timer_get_current_time() so the switch driver can read the current PTP time across the driver boundary in a race-free way. The switch redirects PTP frames to the CPU through the ingress port filter table (IPFT). A few patches harden and simplify the existing IPFT and host flood handling first, then enable the ingress port filtering lookup by default so PTP filter rules take effect without extra software tracking. On top of that groundwork, the switch driver gains RX timestamping and both flavours of TX timestamping. Timestamps are carried between the hardware and the driver through dedicated switch tags: the ingress and transmit timestamps ride in To_Host tags, and per-frame requests ride in To_Port tags. Two-step TX matches a queued skb clone against the timestamp response echoed back by the hardware. One-step TX defers the Sync frame to a per-port work, where the driver reads a fresh PTP time and writes it into the Sync frame's timestamp field, then programs the single-step register and transmits the frame so the hardware can add the residence time to the correction field on the wire. Together these changes let standard user-space PTP stacks drive hardware timestamping on the NETC switch ports. --- v8 changes: 1. Rebase patch 4 due to the code base has been changed 2. Check the return value of pcie_flr() in netc_switch_pci_init() 3. Remove retry in netc_port_set_host_flood() 4. Add IPFT_FAF_L4_CODE mask to frm_attr_flags_mask v7 link: https://lore.kernel.org/imx/20261111062753.1397582-1-wei.fang@oss.nxp.com/ v6 link: https://lore.kernel.org/imx/20261103021024.3121936-1-wei.fang@oss.nxp.com/ v5 link: https://lore.kernel.org/imx/20261012095924.1129312-1-wei.fang@oss.nxp.com/ v4 link: https://lore.kernel.org/imx/20260918072852.501420-1-wei.fang@oss.nxp.com/ v3 link: https://lore.kernel.org/imx/20260831082335.1184605-1-wei.fang@oss.nxp.com/ v2 link: https://lore.kernel.org/imx/20260808032146.2335723-1-wei.fang@oss.nxp.com/ v1 link: https://lore.kernel.org/imx/20260728104548.3301214-1-wei.fang@oss.nxp.com/ --- Wei Fang (9): ptp: netc: use ioread64_lo_hi/iowrite64_lo_hi for 64-bit register access ptp: netc: remove unnecessary pcie_flr() call in probe ptp: netc: export netc_timer_get_current_time() for cross-driver use net: dsa: netc: tie setup resources and reset to DSA setup/teardown net: dsa: netc: use entry ID instead of pointer to track host flood rule net: dsa: netc: check return value of ntmp_ipft_delete_entry() net: dsa: netc: enable ingress port filtering lookup by default net: dsa: netc: add PTP two-step timestamping support net: dsa: netc: add PTP one-step timestamping support drivers/net/dsa/netc/Kconfig | 2 + drivers/net/dsa/netc/Makefile | 3 +- drivers/net/dsa/netc/netc_main.c | 398 +++++++++--- drivers/net/dsa/netc/netc_platform.c | 1 + drivers/net/dsa/netc/netc_ptp.c | 890 ++++++++++++++++++++++++++ drivers/net/dsa/netc/netc_switch.h | 67 +- drivers/net/dsa/netc/netc_switch_hw.h | 5 + drivers/ptp/ptp_netc.c | 136 ++-- include/linux/dsa/tag_netc.h | 38 ++ include/linux/fsl/netc_global.h | 10 + net/dsa/tag_netc.c | 228 ++++++- 11 files changed, 1610 insertions(+), 168 deletions(-) create mode 100644 drivers/net/dsa/netc/netc_ptp.c -- 2.34.1