From patchwork Fri Feb 23 19:24:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13569877 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2080.outbound.protection.outlook.com [40.107.92.80]) (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 7B5BE179A8; Fri, 23 Feb 2024 19:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708716445; cv=fail; b=YSVxlogg9PBBYfSLSpFKaK9jDILE4ij5HN0iFqmQLYQC0cj3Syfy6LI64tq6Gl4R03dwJl7GGJcZcjORzVP1pj2r3FGO+H0E96O/VqFffjku1B1llYlY3bmYXLUPQEOYvtRoypTDcfnXJPK1yDIdS2prnW08AwgrSi9oVyQFkw4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708716445; c=relaxed/simple; bh=8W589ri+hg4bSEhsGN1GWaMawF0HzHN+vcIADygJG4Q=; h=From:To:Cc:Subject:Date:Message-ID:Content-Type:MIME-Version; b=FurAfAleOvM9AWQEsq7Oq0cUZaWYSdU+k2OkFyVCoUT+LN21363RqDsGa5vB7mPNivKsyiXR3IDtLtPCx69rM/0qdprzSiOmXqD9Wm/79rN0/pFs4qjw9X7OP64ENrlMO6wrl/TZuQdAilXFo251qYS+zk6LulhP8mfsbI72Jr4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=TRQwUfLL; arc=fail smtp.client-ip=40.107.92.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="TRQwUfLL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i+DfZq3AoLYhIpdgNMUABMOFpVZWemuUoizblm7iBWbX7pRhVW/Hslufo+uM9ju3nscEglDK/9yRUn5tLLTRnzjUwQnKga3RvVnFwbUkDOJRsg7PZ+iTt8etTSW1ibMW6SAUPEMVor7vTTQa+1bF+u1qAmP1D9u9dnV1YKynUV7S5cw/oVaF8QKYfOSJ49AAlJuU+YuBHOv1elo3G0B9sPg0nD2QatQBSUFQeGj63Nn2pLn4dYfZxFGdtmZDFLLsMAh76s1CS6iY/8COEbXTCgaQwNUj7bsGqpbSqhb9mpgym15YRCj4q4NYpC3imsrjFfyAOrJnCwkEPWQBI+ogAQ== 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=mouP0gvIb4s+6MbwsNs5eNh76gKqMtlZGkqIh5E0dW4=; b=ArB9FQRg2QDf9CLo5j1g5dKjxhEqaEOicfM+ajHiCe6qDaXaC/aUGJGlTDIHOsk9W67onpmZLUhiWB9EDbLfK28spxMtb7uXt7lulVgN0Z87XzEIOGYuPHbVqJHS3o2OL4/8KdDpZrCcCfBZQgw1AdCmUXIZQpWvr192goercu3h0XpybMKST81N/3x96hHt+8Veyfrf/duxpt6+GfkIzuy0E5pIsLT/9amcuy0dmg6Qc3aR5WlUO/ZxMbrXpS2BhsJT+yFMn/fYPKrxIrRxv5CX/+t6iXIGXiKMM8kZXJUMVgGgeBgkBbPsH4ss0duFdfc+PjfvPfKldIO9uiYQRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mouP0gvIb4s+6MbwsNs5eNh76gKqMtlZGkqIh5E0dW4=; b=TRQwUfLL1fxDWgI/P0y6M6XA/uCZwuhPnULkVD5DfxHYbIXOdMjc8sbWD5W0I7SAYeZrxXHMcMKD+GpKhGc8VZ3UoDrUk4orfikez5seRmBFgUNPjb0odkFeguIcHXua2HXSWE2RX9U999qmaxtkhGRsYhd19QcP1OuCrVwvv14NhW9dehDnEKRGuG8aBNnM47IQatrmBoAL8tpSJ6CQvH4FwHaHOEiQpewu+998UZa+6kx8P55HFwLg//6/aVx1XhlmebVIqZkQ0w0wg+W6gJDdOwudJ0G+lg4rgT7WJnF8AS153QIgFk0fKQq4C5A7IAjYRWybkyx1RyHwxVXCRg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) by SJ0PR12MB6831.namprd12.prod.outlook.com (2603:10b6:a03:47d::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.20; Fri, 23 Feb 2024 19:27:16 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::459b:b6fe:a74c:5fbf%6]) with mapi id 15.20.7316.023; Fri, 23 Feb 2024 19:27:16 +0000 From: Rahul Rameshbabu To: Saeed Mahameed , Leon Romanovsky , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Richard Cochran , Tariq Toukan , Gal Pressman , Vadim Fedorenko , Andrew Lunn , Heiner Kallweit , Przemek Kitszel , Ahmed Zaki , Alexander Lobakin , Hangbin Liu , Paul Greenwalt , Justin Stitt , Randy Dunlap , Maxime Chevallier , Kory Maincent , Wojciech Drewek , Vladimir Oltean , Jiri Pirko , Jacob Keller , Alexandre Torgue , Jose Abreu , Dragos Tatulea Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Rahul Rameshbabu Subject: [PATCH RFC net-next v1 0/6] ethtool HW timestamping statistics Date: Fri, 23 Feb 2024 11:24:44 -0800 Message-ID: <20240223192658.45893-1-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.42.0 X-ClientProxiedBy: SJ0PR05CA0063.namprd05.prod.outlook.com (2603:10b6:a03:332::8) To BYAPR12MB2743.namprd12.prod.outlook.com (2603:10b6:a03:61::28) 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: BYAPR12MB2743:EE_|SJ0PR12MB6831:EE_ X-MS-Office365-Filtering-Correlation-Id: 254eabe1-6fd9-474c-065e-08dc34a571e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5ulbHuysk3E5TzVgqF9U8y0FxCzFQEawfWl3JiwEIGvhmr0FwrLbIlcka/I4Ae67wjoURnRBX5yRJih4KPRIDuuQFuH659oxFZg4H3ar7D3Sfj5ermBtyD5uBdrQyxwMoegw15PC32qLskvB7nA8hGz7l+nCMBMhyO2MEFtJ7OzVNXMIjrku0w9HU2eDzIBVbHJ5r7Tlqz1SLPY4107vx+XBQDeWuAsRb5C9J0m96XiIcTu+iuQ2gMRbdgx3JBfVpT4c/5GOTvmInQ6TDs4X3tbOxZbZ/CySmg7MfkeWIR4q6/LsWs/bWN9R7r7DBbMPJVW3RCUO3c7Ry/apThrHhIFFoBKLUd0wYDJ7qGXXRQby+4jr3JpdPseYbFBvv4jSP+2SnCuqXZcTsGrFgZ3Zapl29wHTYzibwv7hsHvZsRXBLqUbuyxyqVJr31xT28P1BxWJa0Itz/P8kFb3Pt1qvAlvs2eBBAd26/qBdfLBxT8QMJky5zPGiAf8VhY+huaq/H14a46/rBvPiX2ButahQ678NLF9L5DJqSjtdTrJhmM11A4Xxoccka0ZaeqjUBYJlQBZnQeIPbcMlleH2Ql4g52hJD1DSwLLaejtk/V3Fmw5gqCzYLG44jHmocvIkuVSC9D4pYbqhCeTuNEK3cofwg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR12MB2743.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: iN5tfHKmMuwsY2ShOo/4oDSyqbQ7vOefQFoy+YEOGv+zd4F5jpREyr6Ql40ik37q5aQUpCuBs5HAgaONPktJUVieBnizSbYVqAXz27UUMsZkd7rSroWbLPxqvQ2gPeq3w3x9avFHInXrhhNQM7fZAZWVHfal7s861Zofc8BagM0k1kyipVf4H3ukmsOH0A5Im1jCFCMsi3ASFNfKOqbnE/r+rGDxv337nrCqklIIFqNZGu0nPJWOPI6WG1rI5qdXL9K3/71bCct5kIPy87KAp+iMLE5p8pxNFX9hgsf2XkUQ8sSoSIiT055IYkeJuu+SoFhsPWNpkHGHaOfI1c6sYciFikYc5QZo9iMNc9bKIItge+7s51S4UYMAsyLxf+XSVa79BRZCvx2uve90xwQU3EHjJhj+wJHSJt+CJ2uRkq85By72M8sRSEhUUjU/ELM0TnTOVvTSPUv19/4XUERl7rOIHnsbupm+ZKSX+y0V1ZOCdF1X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OJtRjXe6NbPdhAHibRkwyz95E2lyLjDAqo5YB4aj5QqdtsyEu6Yqb7WIlw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 254eabe1-6fd9-474c-065e-08dc34a571e8 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Feb 2024 19:27:16.6697 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F+oftdCWq11IlHkFIBPhNtiN+n/mfCcZPPZLS5aFBKMq6MEbk3Jjv4VqHgS5OYMu2E4smiKG6l23GODezTnJrA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6831 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC The goal of this patch series is to introduce a common set of ethtool statistics for hardware timestamping that a driver implementer can hook into. The statistics counters added are based on what I believe are common patterns/behaviors found across various hardware timestamping implementations seen in the kernel tree today. The mlx5 family of devices is used as the PoC for this patch series. Other vendors are more than welcome to chim in on this series. Statistics can be queried from either the DMA or PHY layers. I think this concept of layer-based statistics selection and the general timestamping layer selection work Kory Maincent is working on can be converged together [1]. [1] https://lore.kernel.org/netdev/20240216-feature_ptp_netnext-v8-0-510f42f444fb@bootlin.com/ Signed-off-by: Rahul Rameshbabu --- Rahul Rameshbabu (6): ethtool: add interface to read Tx hardware timestamping statistics net/mlx5e: Introduce lost_cqe statistic counter for PTP Tx port timestamping CQ net/mlx5e: Introduce timestamps statistic counter for Tx DMA layer net/mlx5e: Implement ethtool hardware timestamping statistics tools: ynl: ethtool.py: Make tool invokable from any CWD tools: ynl: ethtool.py: Add ts ethtool statistics group .../ethernet/mellanox/mlx5/counters.rst | 11 +++ .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 1 + .../ethernet/mellanox/mlx5/core/en_ethtool.c | 9 +++ .../ethernet/mellanox/mlx5/core/en_stats.c | 71 +++++++++++++++++++ .../ethernet/mellanox/mlx5/core/en_stats.h | 4 ++ .../net/ethernet/mellanox/mlx5/core/en_tx.c | 6 +- include/linux/ethtool.h | 28 ++++++++ include/uapi/linux/ethtool.h | 20 ++++++ include/uapi/linux/ethtool_netlink.h | 17 +++++ net/ethtool/netlink.h | 3 +- net/ethtool/stats.c | 53 ++++++++++++-- net/ethtool/strset.c | 5 ++ tools/net/ynl/ethtool.py | 9 ++- 13 files changed, 227 insertions(+), 10 deletions(-)