From patchwork Thu Jan 16 10:46:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13941565 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2048.outbound.protection.outlook.com [40.107.103.48]) (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 498B91DDA00 for ; Thu, 16 Jan 2025 10:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024408; cv=fail; b=N4bcNBBcFVC6xtKqJjSL0jDEcRC7dtOtooTo4A4uh3SlPP3DqU2/S8GC6pbAX56IRvMeG46jbcI80mfk0sYsh7F2bSE0RH7CXnVIB42wqei4CZTaiJlzytrMQPNUUiSKZRdMlhJDBsS+B5zM6ktjHZiSyhLtCteCmuL3tBfynr4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024408; c=relaxed/simple; bh=A0G1H39jf8gruX399WWti7z/lw8jpyOUSkfbHpOliSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=ce9oAnvcE43q4kDiUUQtWK//zf15abBjkTj6NpGXwg9T00oNjGUZYX5bmWrFtAaykmMXOKD2TQsr/UNGFx2x0VHrEHkC9vIwABpq3mI+mfWXnUvgkAgTjKANVGvWtPwF+ZHhzNoD7Q94B421Sg6JeAugTys8rcx3+G3doP/8gLk= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=ls3RWKYT; arc=fail smtp.client-ip=40.107.103.48 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="ls3RWKYT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ObvzJj9tYn7lHZt4vyliSt2sm73ql4zkZR5VLpKZ7swHR9p8dUCVL6XbiDV7fglnLp2lTPt3zBaI0lPGZm9yJsU3Lp5jJsBaQASt0srWQzCrh1N/qfE3jVZq7eX91AkMDKvAGyka33vGKW9xtssf7aOoO2tMNGXkJhla0YBbn8UIoyGls5Aydvl3VQ3Kh0H6x6r/gagGV03+BTjYIg06N+5vJTKb54K96ApbmqNkui9A//yyLyF9x1c0nKPxS6Z0aMZI0WcIlxTg6K0Nf+/myuYRM5xRyQdB+5xWgnZM+1Gtpg2JCEanktk+/zrOcmkNjjPX9/nU0LAVr0Drmen15Q== 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=iThzukZnWfxIQ5uMxxj4lb0iPwQP10emQKZh9pa+0x0=; b=j5U/ZBDzxN2Fw81ayxu4mfz9hoOaaEvxftLqw0X0qMSLFw6r2OWxPr5AO5Lhv9H7fmzMrYCR6T04gHirFkheIxftGz2G/Ya0EkzWGOikSo4bR8+wC3xMs806x0nz93A9I9EO7D5AaozD0Y+ZBjSktaXFPkpc/klQbZQgvquxiApoo5T/zQYNzZzmmsgVfmXcLg6TsV5lmt1KVTLbu4Nu3knVRnvg/FIRn5caOupReCxXHxU/ITjvOt09IqgZiweYA7eUAyXYIJuRO61hriNv5wdsdJcwsF+o7uh9QZp88USHLdGmmGNzdHhIiwFUvr9vxqvQc/rEPZKhb5ft+4VhPA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iThzukZnWfxIQ5uMxxj4lb0iPwQP10emQKZh9pa+0x0=; b=ls3RWKYTg+vXrg+Zr/+wjY44IXxU85JoTMkrX6u+xT/H7LaeTiMdXE0nrwtT7MITkBKGz1uR1bCT8VrXHNOrbQiQk1jj4Md+OtNuw/fiXf/Z4/9vfsrKTOqbBnOP9od0SGgllHHZDH21FdShKPSVnkHpAjWGGrW3pQ2k8t3WTZ3WiTt8lo03yVIZE2KY8E6NpAoLbqW5Hnh5MJ3eeYiz1sQrk/pCsCSqHCzPLLMMPgy3SMYg6iOZFyPyG8Prwd0mT9FpjuVei6A4RgkJAOXcNGAE31Up/OFfpVgvgZkD51wNO/i6qquMjkWiMzSBCNJL4zs57J+PSKP46tC2CiyIlw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by DB9PR04MB9675.eurprd04.prod.outlook.com (2603:10a6:10:307::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 10:46:42 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8356.010; Thu, 16 Jan 2025 10:46:42 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Claudiu Manoil , Alexandre Belloni , Horatiu Vultur , Daniel Machon , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Yangbo Lu , Richard Cochran Subject: [PATCH v2 net-next 1/4] net: ethtool: ts: add separate counter for unconfirmed one-step TX timestamps Date: Thu, 16 Jan 2025 12:46:25 +0200 Message-ID: <20250116104628.123555-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250116104628.123555-1-vladimir.oltean@nxp.com> References: <20250116104628.123555-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0136.eurprd04.prod.outlook.com (2603:10a6:803:f0::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) 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: AM8PR04MB7779:EE_|DB9PR04MB9675:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ded4eab-cfd6-4177-c729-08dd361b0ff4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: N4Iuf3SZTDwwkPe53Tvyj0u18xXBelLwX3ZBjDX9xxawjdBMv8H+jVcV0iOQZDYLHrakL6i+yvhKemh2OlV/jK5Kk+v51RzgUDMZ6zicWZEFH9QySHmT/wToH6MisXR2DlO8duQaqKCIMM2mBkndYNzDDwKpRcUpIlW6zXQ1HCl3hgOgEE/iEYQg36eIwQ8xvfvo1zgW3Og9RjZ2JgzGt2Hb8lGE+k4TnNc1ZixJ+XEzkntQ+EqbJusmF0QSFT+nIn/UD+Bp6dNJBSHkRnMDKcC/zyXDG8/Y5zic6E+yg6HrozidMMWoB78YfqTwfHOpHWAM6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ZWljL/8gxdwr/Jo9YGJMD9JIhUX+0q0MdWD1cmoxzbcMcXd05mnhEjbg0YXQdNl+i X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: F1zoGR+qSQn1uKLDIUQjDD4fKYbZO1Lf1DjebVQXE3fQjG0EZyIN2kHyqoeu2NYslaS3s0JiyEkMwK/lUa7Lllp8K/qn7zU1n7EGJJaVyxVOQN9jMRA/ji0ZdOwE2MLcaL5bYavM09i2pT5cDDse95ucGWi7g8UU/Pb0Hu84BWymPNK1JpO/87jt3HCg55LTZligNHTgwbXpMpe+Lsgd3sEX0/oKLn72arvGwf51a5C8UAimWuToniysKfMkK8lxjrIglQt/YmfSXZyx6j69dPJIhJW4QBTUHmdHnm8+NV6FX3KYOKffZAlgLaQfVidu6zDPfyppYRE3unV828nAoG1bMQKVBQpZvB//LBnY/CWXz7soypzwN02gOulI+mBTzBtL5S2PJCDEaAOvmUFEQjmAdAy3nrUNtZiyrjTgWYI0E2sSvhbgwaHOiePZmTNZ3G/ZlnzAAtQprsoYMRY8oeN7tT9UvS/0G+5xH+4WkTe0On99v3oHw/+ksywV+84Hpol7kvmT8qKGcW2ufrZ3Cl0Ce/4cRR1kAWxdWc4SSvq8PBQ/oTkWI9OPHcpPYUCCk7a0CFGHe5+d8RjqRyofEondRURxW6ZXh94odj7MVDBAWKnukyhTTEQQuRZumxCMLjrVM3W6xd6D8ea8nf3sVek/jMniH6JbmFAwKrGJuERg3wspUP6ZsySef2k3S8TwOdfsbEOv7nuAtg6OU2CKqzoSBwrgQAWqxqzKv96csBOpoFeSnnIIo+CUdvzZqWSk2pgNb5VETqCaGDNkeyerf74LNhHGjEy4ZeEwi+l3M8TkZAdZJg3+L3WNdscLHxTQkFsD4jvvFVW0HIbIMXtyqFGuBbRkuJkrizZkM93poEYUeZ3x/1VxP0pv0OVTVzt7/YIvrXaz8HOLlK+P25BaXyzJXV580bCMdJxXab+TzcZCJipY6bg1mtyJx6akcz/0h472TtzsZJjRem4LzaDsjjLG8KMjxc2T2JqU7vx84I6H3evclJiZ92+pde5Vo1oFiVOJIZAdkISBdVQ9yU107Yh7zmJmETVOBZIvymAT6VzMIbUXYyKT2z4KmOHQJW16EzYa0wJ7itteo4oo/tyXWXSkfGSrIgZstXU5LsKJnzcWew/lMNHiEWWWRdBBSfSFP/G9tVKjRp0Fvoqm3hk1i0nKeD1/GDD+q6O2nj7Wo9ZHhoXtEjzmvfzg04qxsgaWNOH6fKyADjNSu5s2/AHYoXs6odeWw6zW1Dkcwvi1x5Z9J7ymESD75SBBKGgK0G2zkzSVO8nazOINZUAfX+5pLMv8lHZM844Hz+ACrZo9HaP/Q9lprm+PPNU3M3ZOyi5R/8tTxIuVR2oBUVOxvbE7FW0HxELRwU0XpA4p/Fn5WDDTZbjAV0JEaHdp1JKUDKGTJGPQPz0G6ihq2rsJuhB7m0KomdLlLVZVv/PPMkWtKBqUqlWO5TXtagaxuxoOBNw7sQcTK0I24FZuG9wfhxDMA8KfSd6bY9a+1BlG6ascv+Xk4hnQ0RILD7yaYuOXEgqUIieZCqXos0Lhp89jaHqHQ8NMgC4FiHIeMt6jJ77fDOYuiSfCXUO9thkgQ7mnolDNrktc4i2EF4Q1BFFWG8SqlQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ded4eab-cfd6-4177-c729-08dd361b0ff4 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 10:46:42.0500 (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: Rk+xYzbEoZpqG+GmdxdRaQlzYdrGRJU7m2NcRdUEJzrmpZPL9zdlSoibEZ3wMfRVMMv4aUJWzL8Mk9MUZXKDIg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9675 X-Patchwork-Delegate: kuba@kernel.org For packets with two-step timestamp requests, the hardware timestamp comes back to the driver through a confirmation mechanism of sorts, which allows the driver to confidently bump the successful "pkts" counter. For one-step PTP, the NIC is supposed to autonomously insert its hardware TX timestamp in the packet headers while simultaneously transmitting it. There may be a confirmation that this was done successfully, or there may not. None of the current drivers which implement ethtool_ops :: get_ts_stats() also support HWTSTAMP_TX_ONESTEP_SYNC or HWTSTAMP_TX_ONESTEP_SYNC, so it is a bit unclear which model to follow. But there are NICs, such as DSA, where there is no transmit confirmation at all. Here, it would be wrong / misleading to increment the successful "pkts" counter, because one-step PTP packets can be dropped on TX just like any other packets. So introduce a special counter which signifies "yes, an attempt was made, but we don't know whether it also exited the port or not". I expect that for one-step PTP packets where a confirmation is available, the "pkts" counter would be bumped. Signed-off-by: Vladimir Oltean Reviewed-by: Jakub Kicinski --- v1->v2: rebase Documentation/netlink/specs/ethtool.yaml | 3 +++ Documentation/networking/ethtool-netlink.rst | 16 +++++++++++----- include/linux/ethtool.h | 7 +++++++ include/uapi/linux/ethtool_netlink_generated.h | 1 + net/ethtool/tsinfo.c | 2 ++ 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Documentation/netlink/specs/ethtool.yaml b/Documentation/netlink/specs/ethtool.yaml index 66be04013048..259cb211a338 100644 --- a/Documentation/netlink/specs/ethtool.yaml +++ b/Documentation/netlink/specs/ethtool.yaml @@ -842,6 +842,9 @@ attribute-sets: - name: tx-err type: uint + - + name: tx-onestep-pkts-unconfirmed + type: uint - name: ts-hwtstamp-provider attr-cnt-name: __ethtool-a-ts-hwtstamp-provider-cnt diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index f70c0249860c..3770a2294509 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -1281,11 +1281,17 @@ would be empty (no bit set). Additional hardware timestamping statistics response contents: - ===================================== ====== =================================== - ``ETHTOOL_A_TS_STAT_TX_PKTS`` uint Packets with Tx HW timestamps - ``ETHTOOL_A_TS_STAT_TX_LOST`` uint Tx HW timestamp not arrived count - ``ETHTOOL_A_TS_STAT_TX_ERR`` uint HW error request Tx timestamp count - ===================================== ====== =================================== + ================================================== ====== ===================== + ``ETHTOOL_A_TS_STAT_TX_PKTS`` uint Packets with Tx + HW timestamps + ``ETHTOOL_A_TS_STAT_TX_LOST`` uint Tx HW timestamp + not arrived count + ``ETHTOOL_A_TS_STAT_TX_ERR`` uint HW error request + Tx timestamp count + ``ETHTOOL_A_TS_STAT_TX_ONESTEP_PKTS_UNCONFIRMED`` uint Packets with one-step + HW TX timestamps with + unconfirmed delivery + ================================================== ====== ===================== CABLE_TEST ========== diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index e4136b0df892..64301ddf2f59 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -559,6 +559,12 @@ struct ethtool_rmon_stats { /** * struct ethtool_ts_stats - HW timestamping statistics * @pkts: Number of packets successfully timestamped by the hardware. + * @onestep_pkts_unconfirmed: Number of PTP packets with one-step TX + * timestamping that were sent, but for which the + * device offers no confirmation whether they made + * it onto the wire and the timestamp was inserted + * in the originTimestamp or correctionField, or + * not. * @lost: Number of hardware timestamping requests where the timestamping * information from the hardware never arrived for submission with * the skb. @@ -571,6 +577,7 @@ struct ethtool_rmon_stats { struct ethtool_ts_stats { struct_group(tx_stats, u64 pkts; + u64 onestep_pkts_unconfirmed; u64 lost; u64 err; ); diff --git a/include/uapi/linux/ethtool_netlink_generated.h b/include/uapi/linux/ethtool_netlink_generated.h index 2e17ff348f89..fe24c3459ac0 100644 --- a/include/uapi/linux/ethtool_netlink_generated.h +++ b/include/uapi/linux/ethtool_netlink_generated.h @@ -382,6 +382,7 @@ enum { ETHTOOL_A_TS_STAT_TX_PKTS, ETHTOOL_A_TS_STAT_TX_LOST, ETHTOOL_A_TS_STAT_TX_ERR, + ETHTOOL_A_TS_STAT_TX_ONESTEP_PKTS_UNCONFIRMED, __ETHTOOL_A_TS_STAT_CNT, ETHTOOL_A_TS_STAT_MAX = (__ETHTOOL_A_TS_STAT_CNT - 1) diff --git a/net/ethtool/tsinfo.c b/net/ethtool/tsinfo.c index 7e495a41aeec..691be6c445b3 100644 --- a/net/ethtool/tsinfo.c +++ b/net/ethtool/tsinfo.c @@ -186,6 +186,8 @@ static int tsinfo_put_stats(struct sk_buff *skb, if (tsinfo_put_stat(skb, stats->tx_stats.pkts, ETHTOOL_A_TS_STAT_TX_PKTS) || + tsinfo_put_stat(skb, stats->tx_stats.onestep_pkts_unconfirmed, + ETHTOOL_A_TS_STAT_TX_ONESTEP_PKTS_UNCONFIRMED) || tsinfo_put_stat(skb, stats->tx_stats.lost, ETHTOOL_A_TS_STAT_TX_LOST) || tsinfo_put_stat(skb, stats->tx_stats.err, From patchwork Thu Jan 16 10:46:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13941566 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2048.outbound.protection.outlook.com [40.107.103.48]) (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 A461C1DE2C0 for ; Thu, 16 Jan 2025 10:46:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024410; cv=fail; b=PH3Uvz/qmRoNJHkRHu5d1XGn8X/JZCVmcMs4uqrKfvNG2hUlyUY+HXyJ7t6wXoDTsb1PPhdJgz9ZBQpU1ynAzNAdqPPlCchnC512Xz5vf4f3zeV8X4fe50ON1J6DhKE/COgzRHFTlvOoFKBzCAAoNBPBktaML5SBRgXmUVl1pKk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024410; c=relaxed/simple; bh=VyXE3Tl/IQsLvR/FQ0lQU9J40w7WfdlzxF3enZNGzps=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=nlr2RkQrNvkMNUijITZiQXFWlw2XihPIni8qTPfeQDgUTkCo3w8/hNEYkcKhPAh70f0TrZmgV7lNKCgyslynVLEHOOYXJiUFjvdn8pNNI/2UtLGYxrWTF8i52KBptqMbB0990BsviwXRQ4NJCUZiCp3UqsU+dHf9nkSpWU5Ffhw= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=iDLZrTbo; arc=fail smtp.client-ip=40.107.103.48 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="iDLZrTbo" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=pgmeyfKQOkaV5v0JGBcWzsBXi/4Zu/xJYNvDu5euTlg37dpwKfCF5yq6aasLfUzmKyk37tKJ/7/mSvHZNf6RXcj3dsD6qfrmqRMDJwjufzOLYf7h7X/abebfIsnGsoTCQUZ6Sk8MUSfz8zxxBUlfINji0HDSrfHjj0dI2Y8KoX83zlVUcvCnAxmofk2q6eAdx3ucs9IvEyh75OAwWi4uom5xJWNV0U56QQAsBKNvIRlPCrciV/YYyNoNMLb5h3wZ1cgmRHThbpZQeaC9QvkscTVC1/K0QV8pXlLyrbwHn7eSPbXNFgDbVhBHgqbsBsxRQq/+v/PgHK4iIqzXJri11g== 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=CSlhLIJNWCPrvXAQzL2o8wT7Tqiy2uMdyVLTS3B28kw=; b=j07G0Fc+RtdPpj+7srgOhivem0umwHdfm+RrreO3QBsxPGcYV1yP1zXx+fnZmhVJ4lhi3Fj+scB0VVW75cExMS4Miv/JysfURIg+kJOtCZeXHv/YSMtNUtXuyQb+dRvTisAb1BCV7U0pVlE9R9FYpR3oHii+vYBgplG1mAzqnDcKiuDp7CkRrf8J+aowma/RYomfUFp+GLUr70fgpeyZrTfc9JFo0vFxg/OaR6u6B3iRXfpFlPMLcQPcO8lCarl71Dl6ODy/4bTGTEZY+opuGx6Z+TLujszwTuZWo4HFuvQ/7YzCqt3V2CbPvZrQlD+Ar+QsB1OPwqh8Fk5WHhEXiw== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CSlhLIJNWCPrvXAQzL2o8wT7Tqiy2uMdyVLTS3B28kw=; b=iDLZrTbodrV1qppJt+ZaAXN4g84DC2ODQWaOtPFYhHLiFSYbef2siJrfYUVKxujTOuP4usGmElzGZ/Malzu61hd08XBzUaMb5jQR4kMXjz/ztaOpAYsNmuHc+xj32JQoYlS2bc2JeCiOMFXxIXF8ozfQI7WK+jKhbwTK9IWk5VI/I5UTEgNK8Nt2doGC6o+NaL8i2rLYhkvgMbsScQ4XpJmX7Cm2rna3AeJ0ejXUxqZnG3zOCXarOKuzkMJEYPJFEPeqshRoI5zbL3yPh0K+FDrmj3FHPdaCa6325ewN16qfXLhZYYnpqY5c/LhCD6uHcDKT2Rz3AEq+PfvFRyPL6w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by DB9PR04MB9675.eurprd04.prod.outlook.com (2603:10a6:10:307::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 10:46:43 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8356.010; Thu, 16 Jan 2025 10:46:43 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Claudiu Manoil , Alexandre Belloni , Horatiu Vultur , Daniel Machon , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Yangbo Lu , Richard Cochran Subject: [PATCH v2 net-next 2/4] net: dsa: implement get_ts_stats ethtool operation for user ports Date: Thu, 16 Jan 2025 12:46:26 +0200 Message-ID: <20250116104628.123555-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250116104628.123555-1-vladimir.oltean@nxp.com> References: <20250116104628.123555-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0136.eurprd04.prod.outlook.com (2603:10a6:803:f0::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) 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: AM8PR04MB7779:EE_|DB9PR04MB9675:EE_ X-MS-Office365-Filtering-Correlation-Id: 782a339e-a6bf-4765-fcf1-08dd361b10ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: ivxzciYcRLMQ3fWcHgYYoWK6dmRbNpInVXD4ssB1Ga8u0yI4z7sc89g7lV99SC161WWBQGCQ8+nwAuWf4JGGb/i/O7cqZH66nqUB6YHsY1hTk2/ieaS4lcR5i6YRlAPdQFZQPEbMdOz2S0vuIyJRJ3vD8v9sW0q6UZbJSSTVIVDHFcWcigpEMPY7eGw5roHlZT/zpiyasQUFKHM0a+G5mN37H3K4CRY636v/LR8YJaCG7yBtTaTXvtkFoDDgMtiC9tLu2OI7UjVZmHtNrySxbXL1GZbCP7Zi+lg1rXoUQZGHonv06gITJO/CsOwMdXlWx+eIkKLYgPJz2R8rl9WYbTp4tlxZGqCGMoVfrrTOILvQTwxRX06p6tcl5ZZyHxHvB678VMmMPpClIZ5EMooxfFSX85QV1BQulhzWkxeIDRSe0od+k2CwUtKUvE/Z6T4VC81j+khweUA5UYBSla6QVmNIl62EDpkJXb6GdXk8dlixqOtVYBJkXSaMhUXVJQhBBfu6UM+jlenHGzidUNvmz0HaeTMTDU/RHqUcDTIQHfTP73mXgWbxif1QV9q7J3J1UOUUZbeEHiHAB5KV+Elb0rONfpYmby3kGVSGtCaTo0Ovp8IIHRDLzl6NxGuJEiSVXEXqn1zTgkwe69MVFUk6Do7ZboGnh1OxHnifF5/cOvMOLA69AX0kAgumBZvM+vCzB58RrLZf47UPDhHPJeebDE9UyvRd2t/GJgNuXxu5rjkRYIm1Yx5Z7gcQt+JQhTC4TCKzuG48H1q6uK4qwfmobYIq2MAyY91th3VdvUHIYSSQUI56FnuE/eX2jTBSMZzKIcKk7uzeHDsoIcGFIUiskx56t80B5SflNUOdcKPRj6atFrezQ43ze5CB7j0crFUwBTSOgEXNQmMOQK9coZ6pFyZTonOkRDQKiomq5+iBo38QTx3rvKZDAOonxdF1VmVV+38iQ4y8OgKnWxGu/bXAq0QxaaDfg8uJsuz4JxNVgnzu5JPhLQyB0EyfMfhouYnK6E6gquAgjgCKlDC3TVyQVUx7rh9ghUQvuagJA+X3MzriwBF05NO3X5no6pM5GZrdUTiQLGdXeF6wDTO4pKx2mQOf67TE1tSEI15M+2M9drh4yEe/I96CMtA6idHtXftWjUuWp8jaeFddkKDh9lHKvKXP+qEETd7nPeQDvRru32KOf2F1TNXeyfyC2pcW7Qdnl2zUp0z9I8rRTE1lBq159pLpA78qilYuBESQbWeFNqUaGK/SzfUXAW6nyexgci7DnntS5+lsgCFwNtbw8wVY2YKOOAwzrkL/WWQmq1sVZHjCewq9ioXSfKsVMz87nZDRc136QY8MCvidMyPBbcBYTZWKDyoh5PRSf1y6NuoXo3z9usXiqinss9iqjX+7rNGG0FME2gV9Lz34oO0AbGILPl/rZxEG9mgzLH0pEcNW1hh8JL8g0G81vwRJG0tFIBQ2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: r8nXtGfsEneM/xG7c6gUWm8TVEREWGStluq4J0EGiIjUCnpOLU973QiEmnTqBVpcxwRi6fcTmbUyz5Ves8GCvjlO3KfI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D1e090fYzqJogDsfUlZ4t8kqTCUXmSYuHOC5/5RarI5PQgttSWYtdM6GEKlZGEItmfCBLILUqO+x6ER2Np21FjiDdfRSCueiYMFb6RI+F1i2eT7m1bbjG2suPmlyZ1qHjznGjObqf5RTdHC9I14CKOrZHaBm/mi6Sl9PST1vgPVW5A1ovlbKHlQf8//8jISz6z+btciXS8rL7tdG2s26pxfNZT7WK1QyEjT1pKn0p16M2b9HgXF6N013UmA/2vVtqCvtSRCyDL3JhhWt/v7i3K7ybLsQjyswvrySFK0MCgOP+hB+NwmV7ur8Y8P4VqA7zDjWVwzjbViFnKyeH//QBsnqrlpF0CAjymObVbeP6WPdPLbPpVu406lPa+7TjsNRpFNQHcBlkDUNocYQjXkc6CiLYQWUj1HmM70b1afhnTjbQB/ln/Ezm6kWzKNJmdY3AhiuvAIYEw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 782a339e-a6bf-4765-fcf1-08dd361b10ed X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 10:46:43.4671 (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: yS29T+hBdEyzLS2P19LuUeppl9NMacxHbFWLJRZ/QZZWHDXgig6ZozxEO+atKUH99Bdop0b4LEaiPaQL5NE+ow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9675 X-Patchwork-Delegate: kuba@kernel.org Integrate with the standard infrastructure for reporting hardware packet timestamping statistics. Signed-off-by: Vladimir Oltean Reviewed-by: Jakub Kicinski --- v1->v2: none include/net/dsa.h | 2 ++ net/dsa/user.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 9640d5c67f56..a0a9481c52c2 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -906,6 +906,8 @@ struct dsa_switch_ops { void (*get_rmon_stats)(struct dsa_switch *ds, int port, struct ethtool_rmon_stats *rmon_stats, const struct ethtool_rmon_hist_range **ranges); + void (*get_ts_stats)(struct dsa_switch *ds, int port, + struct ethtool_ts_stats *ts_stats); void (*get_stats64)(struct dsa_switch *ds, int port, struct rtnl_link_stats64 *s); void (*get_pause_stats)(struct dsa_switch *ds, int port, diff --git a/net/dsa/user.c b/net/dsa/user.c index c74f2b2b92de..291ab1b4acc4 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1150,6 +1150,16 @@ dsa_user_get_rmon_stats(struct net_device *dev, ds->ops->get_rmon_stats(ds, dp->index, rmon_stats, ranges); } +static void dsa_user_get_ts_stats(struct net_device *dev, + struct ethtool_ts_stats *ts_stats) +{ + struct dsa_port *dp = dsa_user_to_port(dev); + struct dsa_switch *ds = dp->ds; + + if (ds->ops->get_ts_stats) + ds->ops->get_ts_stats(ds, dp->index, ts_stats); +} + static void dsa_user_net_selftest(struct net_device *ndev, struct ethtool_test *etest, u64 *buf) { @@ -2501,6 +2511,7 @@ static const struct ethtool_ops dsa_user_ethtool_ops = { .get_eth_mac_stats = dsa_user_get_eth_mac_stats, .get_eth_ctrl_stats = dsa_user_get_eth_ctrl_stats, .get_rmon_stats = dsa_user_get_rmon_stats, + .get_ts_stats = dsa_user_get_ts_stats, .set_wol = dsa_user_set_wol, .get_wol = dsa_user_get_wol, .set_eee = dsa_user_set_eee, From patchwork Thu Jan 16 10:46:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13941568 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2048.outbound.protection.outlook.com [40.107.103.48]) (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 2804D1DDC28 for ; Thu, 16 Jan 2025 10:46:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024415; cv=fail; b=knuMa6yvWr+xT9SsmZNhjyyZ9pN4fGqIh1hlZT9KhUtpwZOw4AHMDOpz9KV9hZ9kO6YxnY+J8CCKnBbIPNfCRTsF416xavEQoEeqfnuM+LTazyc8rDMhU+Lf1jOxEhtjm4SFWehxtKpR/XSNFY2UI/Bhk6inmCK3fQd/MYe6AME= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024415; c=relaxed/simple; bh=qbaHkQRmofEg4awn9NyC6StmCVCFVB96Cs/AHFQfhMI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=TL+2eSElL+s/Ru+07AgYpYrEpgS6MAHMfxdolX0XkUHnh6MZeDjfs7hI4W686x4fq3C3RczVmRSr6FQOXDOZHcgSFx075JXjiTYZc3Lou2m6eGITJ0JIWEd89z97OtIbeEH/q4uY1rKZSGDsSmWPSeCEZSqg6IKue5LCYbggcsU= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jcFsgjAk; arc=fail smtp.client-ip=40.107.103.48 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jcFsgjAk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YTOdnvDVwR6nfSc3+qIrSOCff7CkiKfJO9+SKLfdn1enruWU1PgwHAREGFAPhr6aUBJgmRN9YpYieslVX0H54KoxsPZN8x6KHso1RZ1ZN1Uzfo8nwXh4hjrxu3o4owynalT9z13VBzJ1nhmEyYg8enMCG/dGfu1HHueCj1LdmYI4eo+Bf0T1xOrelIcQ0v1sUk+BIJBOdM9iOc1ftzaFr3l+X0G0we+5BuzdJ11U/M1wHqHCWWfURTiA5ZcqSSabVN61BAqE5rgh8VMHJ+4Gk3n1AYd6Ke/BOVwdicBiz3Ii/toHUiD99ZYlhCpeY0f/gN0bxytd3PWAEoMlRCI++g== 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=w8VXBLzPSasIchTcZn6SpSIMzNcxSuD9y8MRI6fhNZk=; b=CfSTJplgaFnxk0cdlHvp3iFk+VrrNJnqJg8nHkxEOHhuAHjuPPm/mtIrha5nJyO5T1d+uqzePeVrMIXMEcdJ2AxJpINkEm7lljfSzYKk66ox4EFCZV6dyi1O889xAWungKF4Cqcnmp6Dxe/1annkxPj+9bUtLvicZ+rjs84CmJfkZrKy4QtdMdCRod3Uu2vlMYsPys6hFE7DJU2oRPXdQl7u8pNVb6x5pMt3P34UsM2+kXNu6D5HzgPA8ZGlQ7hjNmVCul6tHwI1pMP3HMRKhK4M5SCaPlBOyiaiMhkHYfykQwbg9jefPyKnNqqNQ0iNZV9PjkdHO7KCghrhSjoCoQ== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=w8VXBLzPSasIchTcZn6SpSIMzNcxSuD9y8MRI6fhNZk=; b=jcFsgjAko35CCmpyRRHYtK378nVInrM5rkq9IRsO4Fqq99XdMeS48miRg/LHNS3ccHN9AKmdLkODsBCZ6gbDDyDrpv9yJx5xyYjH3hrLZ63rVAVKnoNddm2b84bNIeMx4Y2Iem7KOkHI1LaR6GfPBR2NZZTy8Y0sp+W5WxKY5x2BEC2Atah2cY7yfP8A4MDi0QXq347rv2G0iGvrkMijZuP7c4Cp5BaHuN12rWqyQqb1qt1G23ScfG4S/8wTFT+X9DVMkw5liJOSDkDKsTTun/AQ2Cs36cNd//QgHxsD/Sc7jCeGWZBWvv8fNCXU6fkf1II9oZz436HcfhBfujxGRg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by DB9PR04MB9675.eurprd04.prod.outlook.com (2603:10a6:10:307::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 10:46:46 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8356.010; Thu, 16 Jan 2025 10:46:46 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Claudiu Manoil , Alexandre Belloni , Horatiu Vultur , Daniel Machon , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Yangbo Lu , Richard Cochran Subject: [PATCH v2 net-next 3/4] net: mscc: ocelot: add TX timestamping statistics Date: Thu, 16 Jan 2025 12:46:27 +0200 Message-ID: <20250116104628.123555-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250116104628.123555-1-vladimir.oltean@nxp.com> References: <20250116104628.123555-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0136.eurprd04.prod.outlook.com (2603:10a6:803:f0::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) 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: AM8PR04MB7779:EE_|DB9PR04MB9675:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f7f7bdd-ccd4-4fc7-f641-08dd361b11a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: a5ZI5S6zUibL3DjPr5Sj/aG5hjlQMSOhMht6ebqZe/BuGKA+21QOFI/5TdIxlrlK605OvXh3vJ4Sil1Kj46AMJvi1EesOIMSv3NJz15j7JGntpQJxiT/vUzLMfCJ+ZkcT3JLwwPZuAF5JgUmqHFtOMkmh+HR2UtvQKZ/dIursubH2tqxvEhCehjOUlf8/197mWT+TfW+pBI986MbkGID78+TeOBpsy5o0Rvr6xihDVcbFr6QjTKg8cYlgXLxfUYCl1cl1EnkGNsZ67+1vpSu1rydgXsFYYYF/zTjvZPocNBXWCDU07Q5YGoCy/qmNc+Nue1HSJCubwPQ0/j5pLdIMHc41ZRgArk4hLO1OX37l/zCs112fEvSWuLlrhuCcgnIi9ae3XUORlMlMFfo7Rym2nhRQBdoFXGUkeOPZv6f76CGY4+puziOVQnZ/E5S6UjtC7Z5FpjfJyHivn0uxleSlLX87HxHFEU9M0AI72Q4uwL1iPpfsoOlr9HVyeD/I21Ri7gJgY0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eQEsQ1fK8L+P5xdarYIXs0OxCvYOxw/oGsPifpcTXU0GXTWS2uxIKCE7Qfnvn9QfxO8eVqU3VMKO9EFOoiVW9TkrZjOrDs+BQg6+6jfuaVkLva3k7Rjo4gsXPTKAgRd1yAxncL3tBaG64+v0aYTyaUWzAPqfUuqz1461Yc/8+ksKtPahFaPBxQbkvHxXUmlC/dfPI07Dv4mdjKLijJL+HuGPoQBvoMOc0HL81Vfbx40oqp0poOaw3qPWxXHMMZOK8RTFRnYUrJc+WRg6qPZnONeSHdvocwP+knHLb964bKStf04O3LGYIs5W1zXG3VlKtVw9ZThxrwg4Jr6vi2loq7xBL7VfpLa4355taBROYmCHhbpQ2N5ivh87ZECCKoACRVxEvE5gY+dePU5EkG4DVvT0oCA8ztNQUDMk+SpWHc1zOkCiDgbcKqp3sOWLzi/nw5t1rUCQalxeW3HEdJwZUjM2b7LMEApLeP0Dq4/pNZYRh+uuULoUxOh85pSgZWKncRtNnREuUdFL/xaqmQSi82CJusuFcw5QCo/Z8bWFMgOj5+VN/hefW0tpv6Gw7yA/M/Op97FX7B84uiilQj3bQFK8vTHaiiFrJkF128+hkJqAxpOmkcUiq/H5s4TM1FzrGtlEj65n1i6XjbNM+jRNGelnbg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f7f7bdd-ccd4-4fc7-f641-08dd361b11a7 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 10:46:44.7180 (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: Vv/W/sVd1z9o7R2bbW46Qwn/bKLLRw+iSdkuh9GSW2MNk+LktvH3JxdSyuQ9LscADutqCI0QqRif+8boVQ5OJw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9675 X-Patchwork-Delegate: kuba@kernel.org Add an u64 hardware timestamping statistics structure for each ocelot port. Export a function from the common switch library for reporting them to ethtool. This is called by the ocelot switchdev front-end for now. Note that for the switchdev driver, we report the one-step PTP packets as unconfirmed, even though in principle, for some transmission mechanisms like FDMA, we may be able to confirm transmission and bump the "pkts" counter in ocelot_fdma_tx_cleanup() instead. I don't have access to hardware which uses the switchdev front-end, and I've kept the implementation simple. Signed-off-by: Vladimir Oltean Reviewed-by: Jakub Kicinski --- v1->v2: none drivers/net/ethernet/mscc/ocelot_net.c | 11 +++++ drivers/net/ethernet/mscc/ocelot_ptp.c | 53 +++++++++++++++++++----- drivers/net/ethernet/mscc/ocelot_stats.c | 37 +++++++++++++++++ include/soc/mscc/ocelot.h | 11 +++++ 4 files changed, 101 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c index 8d48468cddd7..7663d196eaf8 100644 --- a/drivers/net/ethernet/mscc/ocelot_net.c +++ b/drivers/net/ethernet/mscc/ocelot_net.c @@ -993,6 +993,16 @@ static int ocelot_port_get_ts_info(struct net_device *dev, return ocelot_get_ts_info(ocelot, port, info); } +static void ocelot_port_ts_stats(struct net_device *dev, + struct ethtool_ts_stats *ts_stats) +{ + struct ocelot_port_private *priv = netdev_priv(dev); + struct ocelot *ocelot = priv->port.ocelot; + int port = priv->port.index; + + ocelot_port_get_ts_stats(ocelot, port, ts_stats); +} + static const struct ethtool_ops ocelot_ethtool_ops = { .get_strings = ocelot_port_get_strings, .get_ethtool_stats = ocelot_port_get_ethtool_stats, @@ -1000,6 +1010,7 @@ static const struct ethtool_ops ocelot_ethtool_ops = { .get_link_ksettings = phy_ethtool_get_link_ksettings, .set_link_ksettings = phy_ethtool_set_link_ksettings, .get_ts_info = ocelot_port_get_ts_info, + .get_ts_stats = ocelot_port_ts_stats, }; static void ocelot_port_attr_stp_state_set(struct ocelot *ocelot, int port, diff --git a/drivers/net/ethernet/mscc/ocelot_ptp.c b/drivers/net/ethernet/mscc/ocelot_ptp.c index 808ce8e68d39..cc1088988da0 100644 --- a/drivers/net/ethernet/mscc/ocelot_ptp.c +++ b/drivers/net/ethernet/mscc/ocelot_ptp.c @@ -680,9 +680,14 @@ static int ocelot_port_queue_ptp_tx_skb(struct ocelot *ocelot, int port, skb_queue_walk_safe(&ocelot_port->tx_skbs, skb, skb_tmp) { if (time_before(OCELOT_SKB_CB(skb)->ptp_tx_time + OCELOT_PTP_TX_TSTAMP_TIMEOUT, jiffies)) { - dev_warn_ratelimited(ocelot->dev, - "port %d invalidating stale timestamp ID %u which seems lost\n", - port, OCELOT_SKB_CB(skb)->ts_id); + u64_stats_update_begin(&ocelot_port->ts_stats->syncp); + ocelot_port->ts_stats->lost++; + u64_stats_update_end(&ocelot_port->ts_stats->syncp); + + dev_dbg_ratelimited(ocelot->dev, + "port %d invalidating stale timestamp ID %u which seems lost\n", + port, OCELOT_SKB_CB(skb)->ts_id); + __skb_unlink(skb, &ocelot_port->tx_skbs); kfree_skb(skb); ocelot->ptp_skbs_in_flight--; @@ -748,13 +753,20 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, return 0; ptp_class = ptp_classify_raw(skb); - if (ptp_class == PTP_CLASS_NONE) - return -EINVAL; + if (ptp_class == PTP_CLASS_NONE) { + err = -EINVAL; + goto error; + } /* Store ptp_cmd in OCELOT_SKB_CB(skb)->ptp_cmd */ if (ptp_cmd == IFH_REW_OP_ORIGIN_PTP) { if (ocelot_ptp_is_onestep_sync(skb, ptp_class)) { OCELOT_SKB_CB(skb)->ptp_cmd = ptp_cmd; + + u64_stats_update_begin(&ocelot_port->ts_stats->syncp); + ocelot_port->ts_stats->onestep_pkts_unconfirmed++; + u64_stats_update_end(&ocelot_port->ts_stats->syncp); + return 0; } @@ -764,14 +776,16 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, if (ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) { *clone = skb_clone_sk(skb); - if (!(*clone)) - return -ENOMEM; + if (!(*clone)) { + err = -ENOMEM; + goto error; + } /* Store timestamp ID in OCELOT_SKB_CB(clone)->ts_id */ err = ocelot_port_queue_ptp_tx_skb(ocelot, port, *clone); if (err) { kfree_skb(*clone); - return err; + goto error; } skb_shinfo(*clone)->tx_flags |= SKBTX_IN_PROGRESS; @@ -780,6 +794,12 @@ int ocelot_port_txtstamp_request(struct ocelot *ocelot, int port, } return 0; + +error: + u64_stats_update_begin(&ocelot_port->ts_stats->syncp); + ocelot_port->ts_stats->err++; + u64_stats_update_end(&ocelot_port->ts_stats->syncp); + return err; } EXPORT_SYMBOL(ocelot_port_txtstamp_request); @@ -816,6 +836,7 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) while (budget--) { struct skb_shared_hwtstamps shhwtstamps; + struct ocelot_port *ocelot_port; u32 val, id, seqid, txport; struct sk_buff *skb_match; struct timespec64 ts; @@ -832,17 +853,27 @@ void ocelot_get_txtstamp(struct ocelot *ocelot) id = SYS_PTP_STATUS_PTP_MESS_ID_X(val); txport = SYS_PTP_STATUS_PTP_MESS_TXPORT_X(val); seqid = SYS_PTP_STATUS_PTP_MESS_SEQ_ID(val); + ocelot_port = ocelot->ports[txport]; /* Retrieve its associated skb */ skb_match = ocelot_port_dequeue_ptp_tx_skb(ocelot, txport, id, seqid); if (!skb_match) { - dev_warn_ratelimited(ocelot->dev, - "port %d received TX timestamp (seqid %d, ts id %u) for packet previously declared stale\n", - txport, seqid, id); + u64_stats_update_begin(&ocelot_port->ts_stats->syncp); + ocelot_port->ts_stats->err++; + u64_stats_update_end(&ocelot_port->ts_stats->syncp); + + dev_dbg_ratelimited(ocelot->dev, + "port %d received TX timestamp (seqid %d, ts id %u) for packet previously declared stale\n", + txport, seqid, id); + goto next_ts; } + u64_stats_update_begin(&ocelot_port->ts_stats->syncp); + ocelot_port->ts_stats->pkts++; + u64_stats_update_end(&ocelot_port->ts_stats->syncp); + /* Get the h/w timestamp */ ocelot_get_hwtimestamp(ocelot, &ts); diff --git a/drivers/net/ethernet/mscc/ocelot_stats.c b/drivers/net/ethernet/mscc/ocelot_stats.c index c018783757fb..545710dadcf5 100644 --- a/drivers/net/ethernet/mscc/ocelot_stats.c +++ b/drivers/net/ethernet/mscc/ocelot_stats.c @@ -821,6 +821,26 @@ void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port, } EXPORT_SYMBOL_GPL(ocelot_port_get_eth_phy_stats); +void ocelot_port_get_ts_stats(struct ocelot *ocelot, int port, + struct ethtool_ts_stats *ts_stats) +{ + struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct ocelot_ts_stats *stats = ocelot_port->ts_stats; + unsigned int start; + + if (!ocelot->ptp) + return; + + do { + start = u64_stats_fetch_begin(&stats->syncp); + ts_stats->pkts = stats->pkts; + ts_stats->onestep_pkts_unconfirmed = stats->onestep_pkts_unconfirmed; + ts_stats->lost = stats->lost; + ts_stats->err = stats->err; + } while (u64_stats_fetch_retry(&stats->syncp, start)); +} +EXPORT_SYMBOL_GPL(ocelot_port_get_ts_stats); + void ocelot_port_get_stats64(struct ocelot *ocelot, int port, struct rtnl_link_stats64 *stats) { @@ -960,6 +980,23 @@ int ocelot_stats_init(struct ocelot *ocelot) if (!ocelot->stats) return -ENOMEM; + if (ocelot->ptp) { + for (int port = 0; port < ocelot->num_phys_ports; port++) { + struct ocelot_port *ocelot_port = ocelot->ports[port]; + + if (!ocelot_port) + continue; + + ocelot_port->ts_stats = devm_kzalloc(ocelot->dev, + sizeof(*ocelot_port->ts_stats), + GFP_KERNEL); + if (!ocelot_port->ts_stats) + return -ENOMEM; + + u64_stats_init(&ocelot_port->ts_stats->syncp); + } + } + snprintf(queue_name, sizeof(queue_name), "%s-stats", dev_name(ocelot->dev)); ocelot->stats_queue = create_singlethread_workqueue(queue_name); diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 2db9ae0575b6..6db7fc9dbaa4 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -759,6 +759,14 @@ struct ocelot_mm_state { u8 active_preemptible_tcs; }; +struct ocelot_ts_stats { + u64 pkts; + u64 onestep_pkts_unconfirmed; + u64 lost; + u64 err; + struct u64_stats_sync syncp; +}; + struct ocelot_port; struct ocelot_port { @@ -778,6 +786,7 @@ struct ocelot_port { phy_interface_t phy_mode; + struct ocelot_ts_stats *ts_stats; struct sk_buff_head tx_skbs; unsigned int trap_proto; @@ -1023,6 +1032,8 @@ void ocelot_port_get_eth_mac_stats(struct ocelot *ocelot, int port, struct ethtool_eth_mac_stats *mac_stats); void ocelot_port_get_eth_phy_stats(struct ocelot *ocelot, int port, struct ethtool_eth_phy_stats *phy_stats); +void ocelot_port_get_ts_stats(struct ocelot *ocelot, int port, + struct ethtool_ts_stats *ts_stats); int ocelot_get_ts_info(struct ocelot *ocelot, int port, struct kernel_ethtool_ts_info *info); void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs); From patchwork Thu Jan 16 10:46:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13941567 X-Patchwork-Delegate: kuba@kernel.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2048.outbound.protection.outlook.com [40.107.103.48]) (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 DB76F1DE2DF for ; Thu, 16 Jan 2025 10:46:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.48 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024412; cv=fail; b=ubopdkfCU/0tWV3y7tbGpFeyO+VGARFLBY+XryK2f/F1NU4YcDMONG67+OBv8D6bJIXBdc/OQAXOkLcS3Qb+tV7SDGzQzUhL0cZsFheJW8ZE/2+ZQl5yVq3takDS6h6tVLuEWZ7o9e8wu8+PeN2Y0yKAXDNmb1PekjAFATxs5AA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737024412; c=relaxed/simple; bh=IHA8fp4Q4gV/MIhj+R35cm6aFt+NwEdVCzjfSkMlfhA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=uEvaof42mfIPMxdjgo5ay8Fdrxdm/fe2Au/JRyxQn/zMIm8CgBm2h7w7A2k8m28MxtxMiuzdTH1xl8Zh4qIVyp0WqlBsaEflhJDKY44tBWzOJP76XhnPiu6wDK9qIQOo0i44sLKPXIyxfg2UPhwMBf3YTVaomaYdmksFXQ9P5tI= 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=niW6nHke; arc=fail smtp.client-ip=40.107.103.48 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="niW6nHke" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YMZ+nSJjWgqajrJrwzh7cTJsqzcJ6eyMTyMOIInhXuf2goNISnjO3zej5LYeagvYzLNQ9xCgvDNHdJ2hycFJat/Z6dcMgLlw6n7svPD7yhocdLcbBBUNuayHZNShFdzobnU2b/gdDjsOIfBPl5IREgWGYqur4/LLFWq3+W2hds5fAXUbtIASUJfPV0oCCj2LhLVhu2LsEnpVk/XkvHAGyEzLbMzq5/0/z3bO83JmCOy57qQaT7tGaPWOhD+nGpOQe3cZwJqfQviU7kN1THTsICl6AwaRgriMHfbvMHmty9BNJQ40dFlmgxpnUeI0U3g5Rj4rlmFaPieOQizgGGR0EQ== 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=bbfSZfFsWDu/8wKhUUuOt9WHsnnWhpVMhVScY+sz1q4=; b=mhs2+OaA/H5mPJEZC205dSiV3pgdjoeRmLVsVy1F6eYO3fKuRWf/89h34BL3g919PRpGmqxOvNf21JKny3FK9ithE3Ks2xe0LI9G1a8gN7sXNqT4z6QPjL8HHbZnXqd1B/GxUY4k1Sm/g0Dfmu3wZAHqfKCod0e+n2OX56ShB7bmT2xMaF8K6fkn+4mHqeBreyPz07NPVH8l6/IGg/5ecHpLcqD/pVjvvvuJDeR3iwI81SMFxQQh1JUtC7uF8ZGO3vDxXdqOVpUVWVupgqBVPkl6ZJCbWJSL+XUod8ckwXv0KxL5tEpmjtNJz++wBBHVnrWSkmD8o8RkUn6rs/IMQw== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bbfSZfFsWDu/8wKhUUuOt9WHsnnWhpVMhVScY+sz1q4=; b=niW6nHkezFLTuqJKkBIEMAQcDYNxjVFo9Aa6Zjmg6zLOQUyh4DdsucH+OnEKP+lzjVsGGHbJjVMqB4zFfx8QM++7xx49ghCgeQq/oNorr5gDDQgLEMaxFJWyMR4LkfkmvcH+chwnzfaR9hMoALkf8axN7A94lOzB1GHcaribZ+HjWoU4fKVewv6i7lAdpyDqD9/QYZYsGsi458o5SnPxQzmJ3s5KhriUtpS7A8JEf8mKd3r04CWcc3VURLtcDgBFrWea0c8bGVrKEVLDRC8GqiEJEE+ubrwoETaeWCvxJcFMKFuz6p5/gpoX7njzFqDgAIm4d2/c2OspWnTOeFOtIQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) by DB9PR04MB9675.eurprd04.prod.outlook.com (2603:10a6:10:307::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.14; Thu, 16 Jan 2025 10:46:48 +0000 Received: from AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2]) by AM8PR04MB7779.eurprd04.prod.outlook.com ([fe80::7417:d17f:8d97:44d2%6]) with mapi id 15.20.8356.010; Thu, 16 Jan 2025 10:46:47 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , Claudiu Manoil , Alexandre Belloni , Horatiu Vultur , Daniel Machon , UNGLinuxDriver@microchip.com, Xiaoliang Yang , Yangbo Lu , Richard Cochran Subject: [PATCH v2 net-next 4/4] net: dsa: felix: report timestamping stats from the ocelot library Date: Thu, 16 Jan 2025 12:46:28 +0200 Message-ID: <20250116104628.123555-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250116104628.123555-1-vladimir.oltean@nxp.com> References: <20250116104628.123555-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR04CA0136.eurprd04.prod.outlook.com (2603:10a6:803:f0::34) To AM8PR04MB7779.eurprd04.prod.outlook.com (2603:10a6:20b:24b::14) 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: AM8PR04MB7779:EE_|DB9PR04MB9675:EE_ X-MS-Office365-Filtering-Correlation-Id: a9590bc9-1576-4b66-1982-08dd361b1371 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014; X-Microsoft-Antispam-Message-Info: sFTCjvUoBjAAJLBinJEySafGfwYi9W9BhQGcZ8LMrUsXDorJT7bFv2QgQMBKS/QNNw9gkzIX+zsqdcLABjG7FEeY+nT7Iu/fcyzi3NILYh68LjNCpJYkA4sNp/6sxk+r3YYLfL4MXeA+g6ZmwQGXE0W8NJTIdOYV8tzFl7Wn20zF5cFLPlIQC6mFLJDopRt5O0BCj7kJFMKfYv8drNvPG6J8bc020iCWRTcpym6TS8YLnsE2lnRUPQoFfUqIv9MiGBEWwGUGg+bdShYQa9ULzw+/WT6gO+m+i//SEEk1XIVpkxvdOAQ5Y0AnbZ9t6uDko0LaswqKqg+NAnbK7Al/39eoPjQ4tzgMpCj3TVjxXyN6IThNKzsVSWVg2EwdmXxTcyHZAyK4jL19XWiVp3FG2Td6RGCeR88Mn7cwISKQjhsvH8GyJF8KCPw2+rG/YC/AlHI7Fr6DUY63Qncp8rB2UVAEL+N2DUfqIwzJvxHCXWWNctUqGmHsGgbfrNhucSXmSvy4vYX0HZsoz/NK6Vr3F7yqCWAoC5+5R7vmPKJtD0u0i8CLWADioO2+QT2TMLSzkX4YF4EXrFQF30Gy1l25KsCMLHlcz4+niVXr+oatG1fImvYXm+ZYhNWKzlO47FL1tilY2k2kDkI14MPfPaXof4e/sJRG/+X6BlHCFNCqmSzMMg4BfrfnCnyQnLl9RiZgR0Zu6/+J2K3OaDivq2nJDslvAKsmQcOKwofRHDBsWOaeJDdEiS3qfj7rWcssT16L0SygG7xNMzf2KRhdhnyTUVn7Qli1jyo3vuvex/pS+qTceNzX57mGaT+ptrsX1cVP+rpQ4oebraFnVAcYxS+erkaxDsnZ000C7PONC3PNpbBwRgwwV81nj1ykI1mzEl9LBtLTlw+l0qO0ZZdAD9EETeFnxvDANyChyme9uNWMJ/VQctrR7n25CribWPDqd+sBVEHOZxSB4YKyKhOeAq4zyj/4FFweqVjUZ4loUa3l9OyLQtW+tg5CtFre2i+3aiR/eXSLg1QBiYyogA0lXWEq+TD/3VODW97V/3kTqcOVt5peqxl1hn2s4oOgXNNhBDCYusbIwUbTwWWD24jcumvrGft8tDbJuCeqMSE24h9+QvJ+YANVaiQ9F8VcebZW25AmXeKXqcvEP+vg5p9SJ6Fa8VxDdH+iuKKL4RqoMsMa/gsn/dt3XSwWuy2CDMNbmb3CkN/WlYmmEktyftkLYYnNUTdIn+wMUa11OodNNi5O8Ugx0SY/hueAd7/G+cB1kr3ocFe++67z9RqqRSUvtBrCvy0A1QIDfIkfuWy3MHjviL4nSIqNaiNEHEfBAk5r6TIec6IZ/IsA7EjWyihw257Q8c/jVMRmK0ChnOEJmu4ePTymJRwTG+I2E+lmwlynJqJvREP/y4REBzCjiG+aU5keysh21QQktkvg2flXu20xhRSyGyx21yZK1lh93TXUwhPG X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR04MB7779.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(7416014)(52116014)(376014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dhHFNbbQNSoOSBmBRnZxtq+CvkI/iIi2fa98zV+xbbkcd3pknuV5aI2vUY1JKpEdC2NrTUwFJ/67P6N8gduMzt2G1kx30tYC9wmJFCZYiaO7KE2X7QnrfJbYyV7ruhH6+pxdVPS+ZpOu8DMnFgDjLWRQPDkl+VCxVzn03xPioM1UWg/Zv9Nwgqm7tDXI/moVaN5kQ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//GuB5KQ1BDjtgVam5XhNtaML8iGK6ckz83sEpkPHP0/9AHV1qbvHW43PyB4u2bGGyze0MAcq7X8TrLXmNUFpnBuYnYZLEGKHLdczgkyud6KzJaMATPcnz+mG6L1FqsFItt6RRUSrIs0PFn1tmhGg7oaDLSHsqFZlGjIdzfLRZIMhBCGgbElnN5TMompZVt+nJHfJXZXpUgy6t2iBp3Dxw9ARvbvgMDPrM+f8ByR0c19UylqQqj6SNv0hhYjLiMXSGsgk/arqFWzV2acPdjhUUq+lLMRucSqPTHlvnap6zs2hA/WVToS0wflK6QJXgfoKXgnm1/S5AWRfuwYPrYvna2gRfTw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9590bc9-1576-4b66-1982-08dd361b1371 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7779.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2025 10:46:47.6160 (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: p2H2DKmgcVQM58bniQYgeoaO2YyE4xD0vA3TB25kQsR2L8JPiZaazDOnVMBEaKOEQT605OlZyB7t1x/b1H6Drg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9675 X-Patchwork-Delegate: kuba@kernel.org Make the linkage between the DSA user port ethtool_ops :: get_ts_info and the implementation from the Ocelot switch library. Signed-off-by: Vladimir Oltean Reviewed-by: Jakub Kicinski --- v1->v2: none drivers/net/dsa/ocelot/felix.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 3aa9c997018a..0a4e682a55ef 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1316,6 +1316,14 @@ static void felix_get_eth_phy_stats(struct dsa_switch *ds, int port, ocelot_port_get_eth_phy_stats(ocelot, port, phy_stats); } +static void felix_get_ts_stats(struct dsa_switch *ds, int port, + struct ethtool_ts_stats *ts_stats) +{ + struct ocelot *ocelot = ds->priv; + + ocelot_port_get_ts_stats(ocelot, port, ts_stats); +} + static void felix_get_strings(struct dsa_switch *ds, int port, u32 stringset, u8 *data) { @@ -2237,6 +2245,7 @@ static const struct dsa_switch_ops felix_switch_ops = { .get_stats64 = felix_get_stats64, .get_pause_stats = felix_get_pause_stats, .get_rmon_stats = felix_get_rmon_stats, + .get_ts_stats = felix_get_ts_stats, .get_eth_ctrl_stats = felix_get_eth_ctrl_stats, .get_eth_mac_stats = felix_get_eth_mac_stats, .get_eth_phy_stats = felix_get_eth_phy_stats,