From patchwork Sun Sep 1 11:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 13786391 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2044.outbound.protection.outlook.com [40.107.244.44]) (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 D9EE6165F11 for ; Sun, 1 Sep 2024 11:28:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.44 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725190109; cv=fail; b=BIh9QeKMVoPml6pdYWOXz1K18jRgKuR6DOflwo+iFZl22Wvn+206hw3YsNVgnxTsbMvfYQ912WsvsJ/6QTKgDJRvNvK1EyPP3AW/xoTkfqMAusl8MVOm29CIqk6RvY067uj7Npp7RuvRGoicrjke9jdzb8VExPsTvMaZDxOh0To= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725190109; c=relaxed/simple; bh=Y1em4mmNlGqgtp+VUCwvHRYtqzpAu7AIQcSdMPERJSI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=IoeYHQ7X1512264w9vsJRZFxFjtraTlQY1ufUT3gUqFn1EIwnFmpAUh6Xd4k23f6bb/N6bSHYH6hvnbI0aTsv4auNFf1GebdyxHXFcQVWcbBomPsZyhzopwQDO1uVR2BUVKO2ftmITPkWEDITnJqk+LU1NhZYclj4PSvsoL1kfQ= 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=NhXTABaA; arc=fail smtp.client-ip=40.107.244.44 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="NhXTABaA" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sFbMuY7ibF+yL3WB8+Fr7lyOQ3VyjwJlkDd84hjrW+wIjtR61iioPE2D0dJWuSyg3kNVn2DXuvMhMJvogicZjIPGYrqCouYUFilPkieNGQbf3H7jw/S8mDte7CbuGLulGb+W0sMF258YOyiAXkYbgWZP4akR5YzcXv7bfvhH1+2k79IIBRqoyH327h0cvkbQ9VwRUsQ4ZuBrgr9jl7A4Um58mbiapU2KVK7HLdz3yse+TWp48aTcbEQGOLlgjqBO3NFSNjma+SIZhElUURAfpPwjsBff//QfCarjGBjgkv1fSKFCGUyQWqnQURcOyP1Dkr0JRTOU43ta/mPQc/7f3A== 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=QrXgOaLSTJVwh9UtymSvMc+fz07VtXGxt9/EIBW9558=; b=HSzj8PZTc3qLQNSxTT2v/ZcBJHJ8fa6sVQR40se9WB0aKqwa/o3kXkcSaBhjjPSLTq40bo1dOixIq+Zt+d+FJ79rQ5Qy3Nen/ZPs50rLOd73JbfkGlmzs5yrn4lO0sksNfEvOSAcRFa1OFUdRltAk6FEYNOIEzJNiqrqrIcsv+e8HpHcuKoyeMWL4bfFe9oMjorY5L/rPmmMu41sVUEPCuX7cJrs/yEEqMHh9Tk9KMrqQ2VxOVQUtvxTsmCNTeBJfTfM75dUM8tZ7RYFdpK1tS+H6IlQt/b3pjpJQIHil5/84q0ePuNYFOWWC3XoiPXPFg3hqxeLYtqYOuO9DipqOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=davemloft.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) 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=QrXgOaLSTJVwh9UtymSvMc+fz07VtXGxt9/EIBW9558=; b=NhXTABaA6yDPCahB5gplzXUjrbXH6yor6j0FD3lw28ZcmPfXzpECxKhcQN9QTsrCdmY/b49pKNqUJWPLtZK3jcyDzhgMR//ICW6IropLTIjuan5t53YGcXD4yeb08+EIo3nwqEOpmh2h+gzx5PD8WHVVZqBtPq4rhSR/HH8k+ebfHvT0iLL5pfM7exkcxJqOQeeWJwpyMowgXmp6MX8yrC8gU5cI5RGnud2ZSKFkqrUlwcyuC8RMIyX4l6wIDHswYmHiRVwBIBy0B8l5jzFcmklkA7JOz26BN0K1uhO7KuXc7vOj+sK+E1GsiVn6JUEnhyFPyCuvQaDYq1+1PXssfA== Received: from BN9PR03CA0072.namprd03.prod.outlook.com (2603:10b6:408:fc::17) by PH8PR12MB6794.namprd12.prod.outlook.com (2603:10b6:510:1c5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23; Sun, 1 Sep 2024 11:28:22 +0000 Received: from BN1PEPF00005FFC.namprd05.prod.outlook.com (2603:10b6:408:fc:cafe::b5) by BN9PR03CA0072.outlook.office365.com (2603:10b6:408:fc::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.23 via Frontend Transport; Sun, 1 Sep 2024 11:28:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN1PEPF00005FFC.mail.protection.outlook.com (10.167.243.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Sun, 1 Sep 2024 11:28:21 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 1 Sep 2024 04:28:10 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Sun, 1 Sep 2024 04:28:09 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Sun, 1 Sep 2024 04:27:56 -0700 From: Gal Pressman To: "David S. Miller" , Jakub Kicinski CC: , Jay Vosburgh , Andy Gospodarek , Marc Kleine-Budde , Vincent Mailhol , Shyam Sundar S K , Sudarsana Kalluru , Manish Chopra , Michael Chan , Pavan Chebbi , Nicolas Ferre , Claudiu Beznea , Sunil Goutham , Potnuri Bharat Teja , "Christian Benvenuti" , Satish Kharat , "Claudiu Manoil" , Vladimir Oltean , Wei Fang , Shenwei Wang , Clark Wang , Dimitris Michailidis , "Yisen Zhuang" , Salil Mehta , "Jijie Shao" , Tony Nguyen , Przemek Kitszel , Marcin Wojtas , Russell King , "Geetha sowjanya" , Subbaraya Sundeep , hariprasad , Ido Schimmel , "Petr Machata" , Bryan Whitehead , , Horatiu Vultur , Lars Povlsen , Steen Hegelund , Daniel Machon , Alexandre Belloni , Shannon Nelson , Brett Creeley , Sergey Shtylyov , Yoshihiro Shimoda , =?utf-8?q?Niklas_S?= =?utf-8?q?=C3=B6derlund?= , "Edward Cree" , Martin Habets , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Siddharth Vadapalli , Roger Quadros , MD Danish Anwar , Linus Walleij , "Imre Kaloz" , Richard Cochran , "Willem de Bruijn" , Gal Pressman , Rahul Rameshbabu , Willem de Bruijn Subject: [PATCH net-next v2 01/15] ethtool: RX software timestamp for all Date: Sun, 1 Sep 2024 14:27:49 +0300 Message-ID: <20240901112803.212753-2-gal@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240901112803.212753-1-gal@nvidia.com> References: <20240901112803.212753-1-gal@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFC:EE_|PH8PR12MB6794:EE_ X-MS-Office365-Filtering-Correlation-Id: 3969a38c-3794-4940-5f0d-08dcca792f4d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|7416014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: rv9j5QcCTrLuP+qpgWD0ThnebX4pNIvw6LvJaj/WfnLT2GTWZXNHwGBbxIUlU5XoiQS43kLHdeftIyU+WMjhKAN52LqbZzTGVPIqkCflqJjW9/vv9LVhwvMFO1rsGgUdXdEaPeIUsZq7hv5zVP4oKQYSKCGDFZNedD43jubn1T1DIv/tOOGiCQE/V4txWR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/iyxsQ25Dfny4Mp0VwPWS41MFAl9jt8xcMZVAHk9pdwF5JjNX4fxRNIMqDt9t6PGUYL3cujb8+eOjaoZxW/HdcnyJ1ZAYrDNTIdU30ndF7tdrtcVwO6I9lFkgWXBemkDQVaAe/3YMYhTGBOB/TqwQ4U+UVasUSiUXiU6Qfy8V4TmNa6GYiU0hpIM4E0n0gRXcR X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230040)(82310400026)(376014)(7416014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Sep 2024 11:28:21.1346 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3969a38c-3794-4940-5f0d-08dcca792f4d X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN1PEPF00005FFC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6794 X-Patchwork-Delegate: kuba@kernel.org All devices support SOF_TIMESTAMPING_RX_SOFTWARE by virtue of net_timestamp_check() being called in the device independent code. Move the responsibility of reporting SOF_TIMESTAMPING_RX_SOFTWARE and SOF_TIMESTAMPING_SOFTWARE, and setting PHC index to -1 to the core. Device drivers no longer need to use them. Suggested-by: Willem de Bruijn Link: https://lore.kernel.org/netdev/661550e348224_23a2b2294f7@willemb.c.googlers.com.notmuch/ Co-developed-by: Rahul Rameshbabu Signed-off-by: Rahul Rameshbabu Signed-off-by: Gal Pressman Reviewed-by: Marc Kleine-Budde Reviewed-by: Willem de Bruijn --- net/ethtool/common.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 7257ae272296..aa7010f97152 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -695,20 +695,21 @@ int __ethtool_get_ts_info(struct net_device *dev, struct kernel_ethtool_ts_info { const struct ethtool_ops *ops = dev->ethtool_ops; struct phy_device *phydev = dev->phydev; + int err = 0; memset(info, 0, sizeof(*info)); info->cmd = ETHTOOL_GET_TS_INFO; - - if (phy_is_default_hwtstamp(phydev) && phy_has_tsinfo(phydev)) - return phy_ts_info(phydev, info); - if (ops->get_ts_info) - return ops->get_ts_info(dev, info); - - info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE | - SOF_TIMESTAMPING_SOFTWARE; info->phc_index = -1; - return 0; + if (phy_is_default_hwtstamp(phydev) && phy_has_tsinfo(phydev)) + err = phy_ts_info(phydev, info); + else if (ops->get_ts_info) + err = ops->get_ts_info(dev, info); + + info->so_timestamping |= SOF_TIMESTAMPING_RX_SOFTWARE | + SOF_TIMESTAMPING_SOFTWARE; + + return err; } int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index)