From patchwork Thu Aug 29 14:42:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gal Pressman X-Patchwork-Id: 13783338 X-Patchwork-Delegate: kuba@kernel.org Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2050.outbound.protection.outlook.com [40.107.223.50]) (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 693281922F1 for ; Thu, 29 Aug 2024 14:43:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.50 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724942621; cv=fail; b=pfFFyIQGykCqghsqrZYtRfO/dWRugHK0/r/DsX5oweSjNVR8STugiOx8TEX7GFHBVT9uOyb9lzwy0I+cJhTEOIyIFNCWXk6Br+3gLP3fcT+lLQYK3q6Z6tzivvdaNPh104uhZ2n2FsQr01OU8+5wyEJQFwva8YR+HssO48IGaqY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724942621; c=relaxed/simple; bh=Ys8m9gZ6sA2Ku2UEyravFLz8ADsA3BBd5mQq5Uy90Yo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Z038ieYUe5m4bPWsg11P2EVootCLmJSxfJ0E70a0bLkVWjtwDQqQy9lue7MJDC9JMoopRAdxWFmU6SGFgwf7AH7mSzKJeUfssixd35kq+Avx1UHtkO6CGKhsAbHPNtaVChwZRHTDU2VEDrGYNRDosmYVziDUYNN8mlg9lSARCDA= 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=fTotIStx; arc=fail smtp.client-ip=40.107.223.50 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="fTotIStx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kH/atzbZcwyTLgEYIo5AExdblixQcF27SNnOWNn7kz+Nq7EKLgP280V6LdhiRThF/8QzurrQIrbaloPB4uzDqyL+JqbCDFBaQyEw+3qW++1FzKLpDKYDsVXVPLTlQWAfZLLG2cFWyx2wv7GPPBGFmQFju660RSNAjtaenZeepnWu5/dYS9JrRr82yF1SC33WOaqtmDI51NY0Fn9o9NGwiyTRPtrihizE1hS2ju04UyxdyyipdGpxGsu5CRxhaGJt+LN+YAsoPSiiFbVBAcvaqXYlsIUAi7pgf4NXYxfIKU+s1ufQRvAlnYEgmhfhEnE6x2YSxt8/q1dYp4nAiefSmg== 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=D3Og62sQfKyraH9d8fODuEg8puYx4Xf2cJlfvEWg2I4=; b=UYoXZHWqID4PfI/idyN4nqBicMaOYwDqZQied5Z3yyW+Tk/nNXWh1mLekRYaDwLqMgppSm4xWnwUBlSIhATdbQJqhm+q3WLWHLSsRWVUOmEOpe4xzhRlgIhrop0BQIQkFxoiAU2gYux2zOvkfWYB9Wjns4Pd7UNThNv2hf6brrjvAQcEjvJqLKad5uMKCEJnOJVw9aAh7QAYu5caZCa/tnR68QAAl625xoMJBxBD0mh4MbAoncSTxumnHEcGg0RTRIWAb+hkIZEysbByOJwR7v4zvQgBViaNRzDWxQdElrER7C3/Qw32z6ntIpZuZZWGq8sG/sYvTBIDWtmVMCTQDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) 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=D3Og62sQfKyraH9d8fODuEg8puYx4Xf2cJlfvEWg2I4=; b=fTotIStxjlPt5crwWRFmxkmxQ80kOYUr5wsKajA++bhPaEZSwuokjRzm6zECEan3YwHiexXkzLUltUQ//hjFmXvEyPwTN9j2QyrKEiuuJMUNsWzqEwpJU+e1ACmMxN8qIgz66j/0x8xZ5jUDstycBDt5X7rj2wXCRhqVg0pQyBigSCNK57rFVQ/VhS8aUUPtZ3uzZI1aSMGpnl7ulR5buJiGQzFOKzWUE6DMWGRjF2f4m+/XXyV+ZFLs5bzBSzcqJWzHpRb1wBoih8s5IjMaBnmcs60k6fGN8bZoQ6XpdfC4wFXUsiV/Mr9U8fE/DdYpcaNU98gDOLUFv8QsS+/j9g== Received: from BN9PR03CA0868.namprd03.prod.outlook.com (2603:10b6:408:13d::33) by DM4PR12MB6183.namprd12.prod.outlook.com (2603:10b6:8:a7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.27; Thu, 29 Aug 2024 14:43:35 +0000 Received: from BN2PEPF000055DD.namprd21.prod.outlook.com (2603:10b6:408:13d:cafe::96) by BN9PR03CA0868.outlook.office365.com (2603:10b6:408:13d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.23 via Frontend Transport; Thu, 29 Aug 2024 14:43:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) 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.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by BN2PEPF000055DD.mail.protection.outlook.com (10.167.245.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.2 via Frontend Transport; Thu, 29 Aug 2024 14:43:32 +0000 Received: from drhqmail203.nvidia.com (10.126.190.182) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 07:43:20 -0700 Received: from drhqmail201.nvidia.com (10.126.190.180) by drhqmail203.nvidia.com (10.126.190.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Thu, 29 Aug 2024 07:43:19 -0700 Received: from vdi.nvidia.com (10.127.8.12) by mail.nvidia.com (10.126.190.180) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Thu, 29 Aug 2024 07:43:07 -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 Subject: [PATCH net-next 1/2] ethtool: RX software timestamp for all Date: Thu, 29 Aug 2024 17:42:52 +0300 Message-ID: <20240829144253.122215-2-gal@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240829144253.122215-1-gal@nvidia.com> References: <20240829144253.122215-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: BN2PEPF000055DD:EE_|DM4PR12MB6183:EE_ X-MS-Office365-Filtering-Correlation-Id: b0e2a516-c0fe-46e7-fb11-08dcc838f470 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: yWhZCe5F4DoAQR6xObrUGf0u5oRWpNRAT2CFSMR1P0UjHbptQ6t9x9hcX38Nf875LqOv+f3KhlFPmuC1GcbuAKNFfvh0ghZHJUqiCqw9CBtjShxfTAKSIiocyY55KiUKGXmGuJaNGkJb0e4O/l56kk8klLkFv8EKj48/lKD+A7uY4j+0fLN9b94brm6Bq3qE6MT0j2pq4Z5evs5Lfd/mCEBO6oB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Bnj34V2YkMVsf9ty2yfxQNBOhl7BovtwjQPw+fCsQuWXnr88uWZhfn8QzZHP4sGz9TH7RI/ChKwKGPz9JgOsg5F6dPGpVso3DZRDNUx5jFwtD0xptqAXymDGMk/Qn20ROGU8tmMqrAHjVGb5lMJ3zRcNgtSCuZ4vFM7/Ci+FvqBHKy4 X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 14:43:32.2817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0e2a516-c0fe-46e7-fb11-08dcc838f470 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000055DD.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6183 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)