From patchwork Tue May 23 20:54:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252918 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 7B9DAA958 for ; Tue, 23 May 2023 20:55:14 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2059.outbound.protection.outlook.com [40.107.94.59]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 465FCE5 for ; Tue, 23 May 2023 13:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nmizB8PzprMtwQek5lsFJicpQaxypozt7F9Ok4ODuStt9o1D0bxgJ80GB0HvBI+g8GYQmraTf01E2eOKMlOaZHl6bkziDv/1y9DKP6L7MBAr5SZGuNhaWfKEF4+msYr2h8AFASyhL8TkvowSp0HM0q0OXIUWmVMdfOXz731Iq0366VJnsxy2fhxAuetRLHM7jh8890ArvQHaUSl2RLPJkE42dzz4fidIXw8ww1LEZduwNoZPZ6QhqUMMzT3DVqy1hDwkeOe3LqQO4C7J/69BTOgv13o54smaGiu5UyfFbtpJMcJPDwobI7wxVA8VyZGZc74e4a6nis7oCUNC0QuGYA== 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=nuW+8GDzhKm+uvzXEiSt8SjmiMeH5IZgtMXefVoz6zw=; b=fG6yGqvTi9QbfbW8aCzalvN24ipUcUFNhTUuxnHiqn6XM/RBGrciBEnyxd+sI9P8YTCt0YhHa5P8HfanQu54HcJd9o2wS6zKyUbaaA6WBflsNiBFQFbbftiApQBJYoWhlK7+UljYP7LAX9YW4J3kklHHxNlPT3kyPBOJ+3xs5eIJBnYNgUpn5eBq2NJundJZZcqCWJsByEJIm7QK+bDz+fRt0A/0zm0x7R9TsaOURgnMkq1tZetjSBKigqwuUXJINp+BoLpcx4UR6UEW6boXHn08nL33xitlcHk2t299HQd9tinxIe77eYhXqNvCD6ucHQ1nO8iuHQnQjd+dKSyt6Q== 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=nuW+8GDzhKm+uvzXEiSt8SjmiMeH5IZgtMXefVoz6zw=; b=nOABk86ahpThi4OWjqT531bBN4j5qgrqclLL8l35vUZ8dQ2Xkk7RySqZfYt/yxzxqC3NgdN7CmY+SJv641NyjI25/rpwTk1nC11ZaPrh6Eydb0eAXPpfyPRBx0CqB6Mn2wt5iwlrGVzyBP5bbv4MBa+8j9+Rzb14o0vTd3U+Tata5EyKTOYBbXUcqqQ31v9IVpPqgiSuOP+YiuUsEtEv0bdUaqpOunxL/5jdMwA+++HgCQxY3mm1G9MQaTR7Zyyk3jdmiZaSfvRXR3SvlbtB49eUQBX24TU2XqX1/c5+BU/v8pwzCB1s4CHYS8mjgOSiPLv4t/zST+rWukInibmNBA== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:06 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:06 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Jakub Kicinski , Richard Cochran Subject: [PATCH net-next v2 1/9] ptp: Clarify ptp_clock_info .adjphase expects an internal servo to be used Date: Tue, 23 May 2023 13:54:32 -0700 Message-Id: <20230523205440.326934-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR08CA0060.namprd08.prod.outlook.com (2603:10b6:a03:117::37) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b856ce6-3ec6-4f2a-5d88-08db5bcffcb4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RsuDI0s9rpmnpCsBzhEQwrbqfmU0Wn1Ueg1wwENh8q5WlojF42RzYqrdjLiNnTE0XFMyE2oV/kBdAdFTpl3qnqIDhMJ/dYUywX2G5QG3YmFrFq1G+47wLWf6/13nfgX3JRqxKByBwOM8CroU3lBozvZz0rD5OY7pz40wXUGFF1VYaAiAMjYYdqTIeveIOgIQISxtBv+lQ1MZiQI7uqC0FRzzBaPr0tROLPDL4sC0IRpOVwodJt431QObs3iX+H2pn12+LRHqFVkqpBB1mGyv/IiEVJuysrMNZvwFa0KqVQaS6wWSkkjgBaaojicGFgOD1coknQVFW/Uacl2eGSqG63ixe6J+yWSLf56xp/0QSN/CvQVrzaipCMz/of5dHBHIo3/qHZzJcbHGFG5DTVuAE5YTrMqB2vsLO0zK/f9tHUH88JRaoNi8Y6JpFHTUyHJASBe2vHK+R8HPHlFQQJYETzSt8hT45hXsISFOS0vuG0idzqazmeKFA15BzBK66uBgIseJiAsjZx0dRK/ePJ5ruUAbmdGeZ2pQPc/y8kl4wA+jC0o7CjsY32POJVsUnR9PLMTPhljpjvJMQWQwi/jPD5Mcqyf364mNQWnvdUzYxZ5ORUC7lmwJCN0moCsTmWAl 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(6666004)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1Nkz0c8rCHK9iavRvSqeF/0jLb+qRkud0mzmh+JIy/TBi/Cq+PX6I1/0HEsPW+M+nECU9wIBDXBlsgPY6/nbfkhxMcRGIj9rZ5tP6EHpt0TueRN23oUJX601UKeVi+c4PN/uJRTnNuXQu19YM+xM18sqEqVRWk1L/olvvRPJqv2EoHfGYHK5acPJWlCH7TbN0i6j4PSzMFfThMRBdxfwO+vSCmCBNMRxRMUQS5bNroLwvhN3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PHwjbBDNYXJ7WT0xpU1sCQ/V33HehXCPkYZGZxDtwjZY9N5ugMzSVecVj3/3eCNDhfvmadtIAf1AaTbyAYkg23DmNu+37fuixNC3JufqpKk0ZB+xEQWGziu+ls8PqWpOoPsslpfGZujB66zXTzAJt7cGnZUTIFOn90npsYtJeBdDTzSSGzaq9Fb8g0+/ySQQv+2yGvROL2ytR6dojT3mS+iPIPjtjMzYh/glOp0MGEHKmi0GVJCBuvLQOt0VCT81SKGedhqzYvGT8heXEujpOa34+YrpjmZAFrdpEsRgdDQTyai4URuSMQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b856ce6-3ec6-4f2a-5d88-08db5bcffcb4 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:06.1057 (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: goCMKcSjoImaaMBwFUzZHRxz6v1fdabBM+MUSN5MVqbNZVlVgj7J0OAvaERYqzo/++OAStUSDZGRAyn9+Ixsww== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org .adjphase expects a PHC to use an internal servo algorithm to correct the provided phase offset target in the callback. Implementation of the internal servo algorithm are defined by the individual devices. Cc: Jakub Kicinski Cc: Richard Cochran Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- Notes: Changes: v2->v1: * Removes arbitrary rule that the PHC servo must restore the frequency to the value used in the last .adjfine call if any other PHC operation is used after a .adjphase operation. Documentation/driver-api/ptp.rst | 16 ++++++++++++++++ include/linux/ptp_clock_kernel.h | 6 ++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/driver-api/ptp.rst b/Documentation/driver-api/ptp.rst index 664838ae7776..4552a1f20488 100644 --- a/Documentation/driver-api/ptp.rst +++ b/Documentation/driver-api/ptp.rst @@ -73,6 +73,22 @@ Writing clock drivers class driver, since the lock may also be needed by the clock driver's interrupt service routine. +PTP hardware clock requirements for '.adjphase' +----------------------------------------------- + + The 'struct ptp_clock_info' interface has a '.adjphase' function. + This function has a set of requirements from the PHC in order to be + implemented. + + * The PHC implements a servo algorithm internally that is used to + correct the offset passed in the '.adjphase' call. + * When other PTP adjustment functions are called, the PHC servo + algorithm is disabled. + + **NOTE:** '.adjphase' is not a simple time adjustment functionality + that 'jumps' the PHC clock time based on the provided offset. It + should correct the offset provided using an internal algorithm. + Supported hardware ================== diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index fdffa6a98d79..f8e8443a8b35 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -77,8 +77,10 @@ struct ptp_system_timestamp { * nominal frequency in parts per million, but with a * 16 bit binary fractional field. * - * @adjphase: Adjusts the phase offset of the hardware clock. - * parameter delta: Desired change in nanoseconds. + * @adjphase: Indicates that the PHC should use an internal servo + * algorithm to correct the provided phase offset. + * parameter delta: PHC servo phase adjustment target + * in nanoseconds. * * @adjtime: Shifts the time of the hardware clock. * parameter delta: Desired change in nanoseconds. From patchwork Tue May 23 20:54:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252919 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 9B517A931 for ; Tue, 23 May 2023 20:55:18 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2077.outbound.protection.outlook.com [40.107.94.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E68DD for ; Tue, 23 May 2023 13:55:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SGala80z8cAMfUAncHqIp2N1LCwH/rMWisqArQUeufqgbfGPyXQgxdKteTS7Parvdyak4ehWK9pz83rzluFGw/guinWjntQAoQKO1rS7safam2hWZOhZdiNOvHWrbTDzwZ+awxAfVlluSJAeIkPiwJp59YgTKJYIUcz4F0yiSjEUsTMMYR9gwaNhUaCjkMtiQ3uqQQERRYtEaiXKqDjMvymrDO93w1Nsx3Yzzf7OBI0BZnEbKCmSPpqZL3cSFfuBK8cvyH22YutIxeStRp0Yjq3GsXFGJSwuXOdKNGlxKx5OucViOVpf6v7MEVzr+oKUx3jL5r/QwPDe138E6WIn6g== 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=ty9mkvvjFKBmgWKPfp3rJr22NgV7k2uezaoTKNF0Y2U=; b=kMsYU6hvRV/CVCc4ErflyioIFAKWZQxLs/RBTACwyvnFr9XiDjPtdF55gbpfSZK723Hzhd6A4CBB2xTeso+s9R4KzyHwerDxTiL12kQQXLVTfqM2fbHVxzDPNi73teNvkuqyiDraJ1JDNzJ1lo0KNwsdtgyrKXhmjcFIPbDJksi/mLilN21WVWFRfK+UZgvRgsDWeH33FtWdRtKEgzxLInfnvgl8ED0IcxKRLQhrilozkTVRerXf6rjZaLzFtwfmiZb9PgJl1L0LyXrReJLoH4jwyo+k39euOubK5tmZ0YkwIYMOMQNXTi6B4En+rIXOygFUY6nxlVoWfmzAcbWNNg== 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=ty9mkvvjFKBmgWKPfp3rJr22NgV7k2uezaoTKNF0Y2U=; b=G9o+3RAIBJ9+TS5VDGRwfAff20h5n0KMm7zAPFsZfmejJotRH+71CmE4IK6m7WxgbwRS31czbnqxr91y6AhhmheG7AQbx5pNFjuktxbxwQLXSmQg73CEhMtVkQPsJHIzVk5fHUfXmZvJyzdKk4ZGf8FFoAFOZHTKGZMngX47Z15jKETsTMecHlAsVwgiYjTJ949LLR9it6/vjsU+S4cCSpCOKx1kdBWG41Z0WXueNs1OweSi8wpp+Y6sJX3n/UnwPq8k0u+Bl4KfZ5dAzpWXD8Zb5tHy41QlYiiRb9oVLEC9QQ6EXUVOTGgvkw5UygVwGW072zP47qgy7m+kmYzvxw== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:15 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:15 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Richard Cochran Subject: [PATCH net-next v2 2/9] docs: ptp.rst: Add information about NVIDIA Mellanox devices Date: Tue, 23 May 2023 13:54:33 -0700 Message-Id: <20230523205440.326934-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR01CA0047.prod.exchangelabs.com (2603:10b6:a03:94::24) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: f505317a-6c62-49b0-b40b-08db5bd00237 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9N0Mi20fKOKPPaXhcKM6ONDZqi3p3hnIpOmBzqj3C8YW/iLN7q6SZiaDsinPqumd5hXNBme6by2rx5p3qfIzEhPXzNJ0RGqIg8GZ/eB2AkfIKWMpjTHY0zIFt2Ur1KvG/CBStzw5AmreWTV4I6iDNRK2+vfYTg6r5PPQcvtBkgYB0ltpnDW1jWrlHMnCw/cSK7Z4nKxkqArbj3zKx201Bdr8Q9ZexspQI5VLKb2XDDvKmrW83hiNSRay6zWLm8MKvPT4+kJSXsrDI/bsqXLfhKLrqgxfWi82IOpjkCXDHddoVLOCs3c+pBGktnfF1ZU13y9s+MYEWzGr1BxLm9p3s41eCBI01nFsJWH8z1HbP1DRmTK1FXlhFvoRD1qu4FXjN3dMS2AaDt+crAAcKLigptRKnfqovjMwmHShagpwEj/KPRj6obCP6uTBhi27J19DNUY0deH4H8xoh2TfcEU5Sacvqe1YLdW03zA8ddHgtA4Un7TzdlNs1zbZJFC9VGYgxfiIWbfbg3Mcokkm8egaSOOIJvrM+hg6Unwu5PFQr8tHJubIIkifRjzANNPLLR4B 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(6666004)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OLjtwRClZ+D4DSHhPKKuDn+MEhai/KJJZj4VY2Sgemxwh82REGLiLGCQ1Z0/56NnjOuOC8nPsxLJzRLvg+9qYDQX6qogd4QbrPw/fppBDHDE1YZxfyzms8lsr8MKny8FKYMYUJHTqC8kFiRJQhug13ipzPy4c2/lS2wxd7l1mYyC7i43xbC1qxtKmhIKuADzt6yEbjH4dvsi20QxHOYij74nz+2+i7llwl/7HTSAy9812MKKBvn8Ol2HpHktJ27KmQfylQ3zNp8na1SUBkvRTibfRpwAET0fTDV10xr1tJQ4sQR1AH4w1FFyBmy+1hLdTLfnWjwxKAGN51wLkzKjQIHvw/xfLIiYBdbq8MZ2kiiC2vQzs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kUbgw1HhTg3fizh2hK4pcglGeFZ2LTsvOclHsiT5yh3voAWeH674wcNFNNeP9wDNOMO9GLj32AZ8YSnPQDM8dnF7NX2UyM58ADGEQnd5GP/eUPC7owOmd5FLlWKKWhUAyiNkUUb36hbd6aNMT9vPUaDgc5f3isK/l7UqVeC73KPXt3MQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f505317a-6c62-49b0-b40b-08db5bd00237 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:15.3299 (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: eKfQArkt5C5DGFlaRqE4TO3v+HmGoz+gCQtQnSzJCkxO3Xl8pAScNNSRkZX1Ht/INs+3dfQVsCjNN6f36iZc+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org The mlx5_core driver has implemented ptp clock driver functionality but lacked documentation about the PTP devices. This patch adds information about the Mellanox device family. Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- Documentation/driver-api/ptp.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/driver-api/ptp.rst b/Documentation/driver-api/ptp.rst index 4552a1f20488..5e033c3b11b3 100644 --- a/Documentation/driver-api/ptp.rst +++ b/Documentation/driver-api/ptp.rst @@ -122,3 +122,16 @@ Supported hardware - LPF settings (bandwidth, phase limiting, automatic holdover, physical layer assist (per ITU-T G.8273.2)) - Programmable output PTP clocks, any frequency up to 1GHz (to other PHY/MAC time stampers, refclk to ASSPs/SoCs/FPGAs) - Lock to GNSS input, automatic switching between GNSS and user-space PHC control (optional) + + * NVIDIA Mellanox + + - GPIO + - Certain variants of ConnectX-6 Dx and later products support one + GPIO which can time stamp external triggers and one GPIO to produce + periodic signals. + - Certain variants of ConnectX-5 and older products support one GPIO, + configured to either time stamp external triggers or produce + periodic signals. + - PHC instances + - All ConnectX devices have a free-running counter + - ConnectX-6 Dx and later devices have a UTC format counter From patchwork Tue May 23 20:54:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252920 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 0A3F7A948 for ; Tue, 23 May 2023 20:55:24 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2056.outbound.protection.outlook.com [40.107.94.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4531189 for ; Tue, 23 May 2023 13:55:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JvwzicnS2SAapf7OlIdisOvTCmF6yX4Wc50SYXIX6B4oa7uCcqcgBSQ7EmxnNzJ+qITRfWzs9mxqCt240qEN05YVkDhNghXsbDsbeE0uU9vqHim9UB+3KAHKPN6XnyiBO1qkfku/EYwcdXYh2UZKcWb96FJfmyQlopJ+C4S1yRzMrMwWcKyDRSOj+WD9eN+bzbyMDzukeKupsHIkoebUN2+34wzwrFynITyc4TgDLaa5kXg7Pf4TSpn4b/KmTIVSmlM8LWvnKel4RLl39ujzoJVWRUdVxObaPq1jkjcCd7PfhRJO3/kihEUt5o64jPdfo3FuyjjdTXuPtYHfMt0Prw== 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=mN4YuAu4XOLQRKtUn5zAODG8P0tQ3lLj0rh5n6V0F3Q=; b=BfG9ZsBxeiYQHlGe0W9OD5mAgGB0+ZCWflOVgiECt+WU5D5ELvLfAB2HF6zCJ1sKznnZFY+BiYSXPJHJRZaFniPuMQCP+rB7VfptNY1Wpcj4LglDypxoLNaZkdMpsw9tin9sQ6IbiDOBNDywT5o1bdGreY6C+ptYwL6ADX/4878pPA4wxBdvkBjCqQh0TReAqKUzEGoPRRmUhtz1hNP8cnxmERAiaiCALYxvtvhOSobT2Lr2vF398ZPPwwt14Edx81tzG0UH8tubH+eA0yq93I7oUCb0+3IIjbQOqdxAml0HPx2JHV6+CfuHxNY3E1Yi/m7HRO9JxgTt+iAkvJ97Ow== 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=mN4YuAu4XOLQRKtUn5zAODG8P0tQ3lLj0rh5n6V0F3Q=; b=AH5CJSpYS8pSJV0seXpEp8LWTQIYaPmU/WfRzXA+Smi88mGd8t6HZzF1JxP6dZojJNyegmuc3CblUNqklnUeQ5Vy02+hTThBRPrZQn1oP18APcowCZgvWXwZYJz/JJ0jYhSd27NwQNjIv2SXUd6B6VghsONSTUlE/A9iW4xLQ/1w23ks5AFVtbN5BXaP1yOPr1WLdpRD3OWFrEmkwIcmii/KnJc0RYJTn3t/UT1pB8WTVvyKAcb6/xWyg2v3j2Hsz7SiLHkibpC9viYJO+Vce9EOX0EBXco7pPYlZceQ563I5V435sk1/WGR/M2TR8aPBr5BDbPf888xRUhzvYIk8w== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:20 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:20 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Jakub Kicinski , Shuah Khan , Richard Cochran , Maciek Machnikowski Subject: [PATCH net-next v2 3/9] testptp: Remove magic numbers related to nanosecond to second conversion Date: Tue, 23 May 2023 13:54:34 -0700 Message-Id: <20230523205440.326934-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR13CA0186.namprd13.prod.outlook.com (2603:10b6:a03:2c3::11) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: 67cf0fe5-75b5-49c7-bb9b-08db5bd00558 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8z1NNiGHt0NELYvKc6/JWnEKAg3TvTrCsFiVunVpsmrO9o0/3WNZ/VY5UKwAM2S+gFB1eK9rs7ru3b+HQCGppOt17pimAgEQAZ2oHXme/t21jhzFqPbkvDKKKwO8qipG16Z+q+6ee2LWfktRcH1cYwRepOA+E4ZMRt5HQJp5GDNsTRAK9ZYbIUt33YpL1h/yDzGTCNFojA/5uuEf6bAWzAjeR6yrAmvHATibVU9B5c4oBa/u1DZC39YOCAZDycSXNxtWkktHF+loDSRBjWCwTFT5ADLR+Nj3wNAbpwIjDB6zbj0nbypMN0CsoPphRn13niqWrS+bs5tnL15MRVtIjY7Kg5DIAKjPfRSrGxXSNKFigZGjs8boVlEnTRrQ61+PLvpUG/U7O/obHNmhHLRWOZl2wRkH3oGnPQNA1UhwDru20ztbGKDwIwxZMsFh3IcuigredSEtYBKjirnYsLFgUroL2JiTWmwEj9xby5sWGN5ij1vWyPYvkv6OztBHF+PoRn1HkKCWZn8nkdyQL7WWsW7RgZZOcwcJx4C/iWi+Cd5c4ANAWmog320jQt7pCCgm 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(6666004)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 66Ru7ec5hwPD3DXpd2F28u5RC9dAxY6ColODCX2cqGcRQuXRIT1xPeh+krhkbOMKMhOCRvOae/aJpGr7s4zSgFY7/pHG7Y2SgrdP0F2/+ud9d1GO55TLkq5GhET4Ao76vcpqMF5tDliavA/HVMSSCJT4nLu2QAlUlReyiAm5tyTDxrRn/brD/wL2iInEClqqKiOWK8XwVfqQgP7F0F811x2/8yic+11dussEET56ZKWf2b/0drp6mUvZi9QSRuBhrwR1jW0dpjauBVc2Bze3H/T0EowvC33vgR1CPf86+Ew/f6th4pu7M7BAst84yNHeUacF7IhZLvcx4CXeZ6qZXslnE3HMqynImVPrBcTaaVk+y9qDWXEkXDk3oOTFWtjunvJu/Iegp9NF357Z52USnCCMIv52Ovkt+Yv0opwv+RRaPZ/IT66zh9TFQge8zhLsFgFrn0o9DdXd+We3vRq27ox43Y95BNRhe9RUu1Em8K4NvtqLI3qskabaASE+4wNrNQdDjpYEgPlR0UhU+aC5PtncX6ILQr3D98eARrF4VgD/4JPPAdrumj8Q0gvccTUQujtp5ekJTcystKXzziPb8uAK9kCimfR41ip6mFZfS8zpUoV8Wg+EQ2iKHkb/c3vI60+Lds167cgaA1i/LoYRxm91liTOoyXlC9FFEPxs/IptoP4bshB4M6pYRF9Vwyas6IrnYMdhCqsZsNLbNJ62GZNR0/CX4DXqHaKOEXovEIp+0EA4Lc82LBSgDFfCTnW8K2Jcyja4cxBNWfe2WGaQJsjaMn2cBVc51M2xHjMJiAin9fuoZjC9UFBVO1mghyDaVfqQX2fc4Fkmot782rDgyw1O/2fyCYcejkq6HV+mvUDJxR6qbME9dqdW1lnIfis0XyTmeTOH4H8tZ6Nz5qUDVw6FKXDvTibGlZ/qXJyie9zPczwnkgtgvhJAQ5pOxGvK5vAUKvUtm8S1BX23cAPzP47z3hepr39QpULfvcmBUQj+xXhtFgqDNaZ8nYtujalfRZE2Hkx38ZV2Jhqd0jsRGi8fvBp3Un0DxvXkylFVU4t3MvMk843irdNdVPm2riIITXU5KmxkVR5clL1Dozk0b02BA6r3uCq36b3zXUC2Y8ZTx6ecBHZyD5w6zKwXEHc0sz5R5/P2Pa645KiBVNQh0E7tztRPqM5kNBL7dvsiRrGCXzxcjVRnW1WDGc63f18/lUkOvenrPLUWnLeAX2BvVHhCa82qkXUv1YPG7ijCiIhgny3SAQUydISAxzr84h7xGh5uxalH+RdWMJQ9u4+l7m0wagd9TPVJTjuwOd8SoCML4EYvsqYA9Fs6QdBS2Hlqo2Dv1T6BQdoop2LwDknfif6EERo6GQ3dIVtjyfrxtXxZ/XlThhyRYkZ6qNJIlZxm9pHvjBk4swpVEc5OeOvXk58rLH10w535aFLJOsTmLFC/s+FtejKYdXREqU9ptg4fqlO2bfu0tR45kxr88JNYWJhFY3iYzdGVdYvJhqbpsojFBuHsRU9ifcQd71GKnHNxMnkygxxLJJfQc2k59CMEjUocKQqIRsQ32vR12WS8JLBVc5tRFCPMzzwqLh6iDXANLxmPKYifZg2mvb2iLx3iBw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67cf0fe5-75b5-49c7-bb9b-08db5bd00558 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:20.5886 (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: VdFDKJh725erDoWVVhPALiJ9ewA2rbyHWN//DnhpCexRZa2SKokFgy69hTrcsgUqFf8O8/LB65j775urRL/wbQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Use existing NSEC_PER_SEC declaration in place of hardcoded magic numbers. Cc: Jakub Kicinski Cc: Shuah Khan Cc: Richard Cochran Cc: Maciek Machnikowski Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- tools/testing/selftests/ptp/testptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index 198ad5f32187..ca2b03d57aef 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -110,7 +110,7 @@ static long ppb_to_scaled_ppm(int ppb) static int64_t pctns(struct ptp_clock_time *t) { - return t->sec * 1000000000LL + t->nsec; + return t->sec * NSEC_PER_SEC + t->nsec; } static void usage(char *progname) @@ -317,7 +317,7 @@ int main(int argc, char *argv[]) tx.time.tv_usec = adjns; while (tx.time.tv_usec < 0) { tx.time.tv_sec -= 1; - tx.time.tv_usec += 1000000000; + tx.time.tv_usec += NSEC_PER_SEC; } if (clock_adjtime(clkid, &tx) < 0) { From patchwork Tue May 23 20:54:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252921 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 898A0BA24 for ; Tue, 23 May 2023 20:55:42 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DDBF189 for ; Tue, 23 May 2023 13:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxoc2vCyWwsQDGPGxrQcModYjdV0wB2qrBWtYaYdhML6OMS7HE4SuiFqRXMANunWCR2l1yHzZRqygu08E7TPrc9/+j0jIMyo3+A2QM8nSr+efqauM7OG3Ncrn+9+6sYkAvx5MuW0Zj8XZfBJq7qxrcwyBG5mWiKPnSfHVS+6COw8iPpnPwbAUeYu6czbyRE5D0cosZGT7ITeUbj7m24MW3Kkeh2mOovTfnXNsckfIF2R9atYCwl4BPpimgshNNXJAAbf2lXBnstFadiHCv5VFYaNiK0laS9fJh2FYZDaNrk3AyqrQy+sEoXACekuA2D9u+nTRFdeVG+pg/ncdNsnpA== 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=XFNriD/fL6A3uY8KpMkeUL3MZ8nlRVQVzMUOQejOyts=; b=CVwA1usFpjdlOFPg9LJ4njC/LFpQUH64CbHW+uAmxwoAnsR6wZV6EfGdu7Lx+LywHPohC2qDP8BKtCDJ4ub3QGwn9VrLomUcZL14w8AVMtNHMF3zuQjV/6hGcc3IwAcbeym/rm75d38tHTTDDg/j/Nz0H8USA4mB6LgXbmkCHrmz474wnXfonGeDdLD5A4KFjNNKHH4jjHK8v1W3oRavNJvWGNweEF4egPtRwr3JkeLkYQb2i4AyqOWZON6yGTeuQSnlUjJEUqM9QXjc1KqVmX9kyLKW61iUmapSsgl5EXf1QPVkMUEUnm4GRLML9A38rMa67ijeZ5CwR06PObrXwQ== 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=XFNriD/fL6A3uY8KpMkeUL3MZ8nlRVQVzMUOQejOyts=; b=HAHqdaqaki6eusIz1kjstwsMdG/jiErVblcuA5otGW5rOH+lb7F6WfTWQbSY0GrMf9JBNTB10WZtwoxKYpbg/doTHzr0SKXQ9Adm0ce3lSjFYwxN1wtizvoA/AS94mjQhkOFwFjAE7qYG5ad/41NOvy4L6XCsq5dcibP1vQUEMwjcwLbtK8V90Nppjj4+l4DZG2kzmmY2PYJRTmY1HefR8WZuT+4//KQl6fiCnikXBkiFd7Kh3hPAbSHoXRt/0Tiiousw/a/NXbTsQi61KjA8CHcws2AcuyapK/c8O6mfR6Ott0y+XZfJduSqNLVUxGFYFbbd9SJN0GlN/Mtf8yt0A== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:30 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:30 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Jakub Kicinski , Shuah Khan , Richard Cochran , Maciek Machnikowski Subject: [PATCH net-next v2 4/9] testptp: Add support for testing ptp_clock_info .adjphase callback Date: Tue, 23 May 2023 13:54:35 -0700 Message-Id: <20230523205440.326934-5-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0036.namprd03.prod.outlook.com (2603:10b6:a03:33e::11) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: 2f083dcb-134b-4df6-9b5b-08db5bd00ae5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: M10RDJet+orxAfPro4YzoDeHfGv+CpIgn1rsw9mqYXbZpnWgxNJQTMUeiGaPbmWmS+DI6I90iKemmewV4RseHIBdVEuQZ5GGME1RE+bnH2/QMBYZB0urOF3Cax/f2IeneeDUE7WycbWcpZOzaa5SyxiGEEyINR5C6qoW5rKmPszeiwS4S4GTqTZXd8vCbulI5hl9ENNDyYOkLk5jbsoRJzA7fJ6cA+fWFRZ9e3FZIMeiEdt/oLk+4RzkyUexrQBdJwSGlHRBT8ISQ7wnFxgBf+ikjl4eu+WLMN78W2G6PrV6oFe5o4mk5pL0wsLUzPj/Pydk48p+0LEbaO1SJvYgD9+bkDMks3a6qsHjDOPSYo3U+ZOYvOW3s1ALszuYWOgpeqHz7uUEE71VLssPscNGbiT0ShCS73EQNnUlI/ipeXjkOKpcg/hEbzS5CCX7dQTdW9Sw9Jd2b84ghk7GRoOOGhCpTraGgj5UfpgqXnM0ocvjdtsdww3fYv82Nql1xfUAC4QeRw/LjmdzXAfezS1WnjUFwptZKeHEcNfmTtztNLJlRDzAcQzS9gYgYLTRZ3NfZhHqgw+3HYJOJ1kgLzh8ffo2ZljDhWRskKKXk7HYyZ8= 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mmtq9O+S15Rl4b2FY7t97AZurIYsiAh7Nuk3FzVU8Cv/B++KbndmCMRBc4/NPA2iEh8Yu7+c+rBi2RkwGrWkes7JC4wXKCF9/sbvD+7xfFM6d/aWm6SNWlUUuCDf1CKMA/qi7TJoGhBudWwFyDUx8O3DA1s7tQHGERNc9DWr4Fd9HUcf399SAdfusBbtvX/nrq/EIam7IHU8nrfwI3VZGCiIAf8K0frFwrZNKSHb8u6AXm9IYjeYEfMK0SCxuWLf5nx7Ce9P+ItfTF7KCKudNnXjkuN1+7Cf0JDRp4wSe1SaLo2EPoXd8erFuifK03QeHiL4FFEjOfctaN2mV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X6GjF58Xiax6HDtLkB77ZMwi0uhWquEFlfwU65wSp7zQTMhgLjJCuiXhFd49wzaiXJNklqGG0oBJBFBrBpxKxnlBsLiByNZ+Gc01LCtQhrfJbf6Yc//DDPCt1t3CBbaUGpsV+g5cI/tmrmgNkkyIVbzAwSKe5jln3LOPm44lKsqVbxfJfEVOA+uVJAuHEtQK4LXgQ2HoQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f083dcb-134b-4df6-9b5b-08db5bd00ae5 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:29.8643 (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: mXoLH/BETKqz52maobZf/iZyDt5HgvLyRM3l0Zwyo/nFck2m48acLZpv+QjbFWH0wOe2GxoXNuUYKcQR8r0CUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Invoke clock_adjtime syscall with tx.modes set with ADJ_OFFSET when testptp is invoked with a phase adjustment offset value. Support seconds and nanoseconds for the offset value. Cc: Jakub Kicinski Cc: Shuah Khan Cc: Richard Cochran Cc: Maciek Machnikowski Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- tools/testing/selftests/ptp/testptp.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index ca2b03d57aef..ae23ef51f198 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -134,6 +134,7 @@ static void usage(char *progname) " 1 - external time stamp\n" " 2 - periodic output\n" " -n val shift the ptp clock time by 'val' nanoseconds\n" + " -o val phase offset (in nanoseconds) to be provided to the PHC servo\n" " -p val enable output with a period of 'val' nanoseconds\n" " -H val set output phase to 'val' nanoseconds (requires -p)\n" " -w val set output pulse width to 'val' nanoseconds (requires -p)\n" @@ -167,6 +168,7 @@ int main(int argc, char *argv[]) int adjfreq = 0x7fffffff; int adjtime = 0; int adjns = 0; + int adjphase = 0; int capabilities = 0; int extts = 0; int flagtest = 0; @@ -188,7 +190,7 @@ int main(int argc, char *argv[]) progname = strrchr(argv[0], '/'); progname = progname ? 1+progname : argv[0]; - while (EOF != (c = getopt(argc, argv, "cd:e:f:ghH:i:k:lL:n:p:P:sSt:T:w:z"))) { + while (EOF != (c = getopt(argc, argv, "cd:e:f:ghH:i:k:lL:n:o:p:P:sSt:T:w:z"))) { switch (c) { case 'c': capabilities = 1; @@ -228,6 +230,9 @@ int main(int argc, char *argv[]) case 'n': adjns = atoi(optarg); break; + case 'o': + adjphase = atoi(optarg); + break; case 'p': perout = atoll(optarg); break; @@ -327,6 +332,18 @@ int main(int argc, char *argv[]) } } + if (adjphase) { + memset(&tx, 0, sizeof(tx)); + tx.modes = ADJ_OFFSET | ADJ_NANO; + tx.offset = adjphase; + + if (clock_adjtime(clkid, &tx) < 0) { + perror("clock_adjtime"); + } else { + puts("phase adjustment okay"); + } + } + if (gettime) { if (clock_gettime(clkid, &ts)) { perror("clock_gettime"); From patchwork Tue May 23 20:54:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252922 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 73A26A94E for ; Tue, 23 May 2023 20:55:57 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29F9F19D for ; Tue, 23 May 2023 13:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hO6rQp7dCUieaUm7YY8jCOoyzP843OVcivfPEeZXE5zFri8Dald/52A6Vgn3SdSeIaaw6F6FkE8w2seNRfOfuIVvo+QYigzhYrwmsPXYKxk7wVQLAbwl1HLABssW/k6kltJg4vL3b2URnxMvaMBCgOiisoolxD1fpiDV6R4F8EqOXpxIVIHrbKd35qXTW1L86AYpb3+qB3rHzVWk6yfcx+IcT68jPAUAh14OFbewLJhUK+HAvgIbgH8/k+PysktmII3zFnbl+DXpEopC/xEuu0ZQmLJyBKvaiE3iYadF8YXscsop7wSDdckgGXNNPJxxLswJNVCetVE2E+19Tzw6ZQ== 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=9cBH7RXdP2Nj/rOyLXmsBba4KllMs3krtxyZ1Jx6uxY=; b=bqLZezjpyuYsepXNJGsFdog7qU19lZvdTP5u7I7j1u2suGfcStZVsyjkuYr7GTXGWx2DvdVjTxeIA2VGkJJBDM0SQQTC09f6V24ZuwNWlamzBwAxUL3GYW8TWBbNFtbI2Vi3wZl9KSBlAJ60W71J016h83kgXPaaHnG3v3dCmfcSCSyYniDw79GfzFcrkJMTDnY0nh430V4unDhAJt09QMyaT/6nmeLWdi/Opmz61OuSln1zfHQu9rmljkGWvSW4icfmNPy7tJnNGu4gL729PJaOBH5YVsVdHKj5kTT3fXvIX1vODYFTCbXECZYTr1pQ1dnkt6U+Ie5vKq5vdhij4A== 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=9cBH7RXdP2Nj/rOyLXmsBba4KllMs3krtxyZ1Jx6uxY=; b=eSf0Q4qbQ2fPH/uFor2fDVaQm2R6xzd1K4x868SRgfff3igFvjIheqrX22p443Yc+HiWR+hARdf54xy1LE6RuBXKf1sLMYH12iZ4s6MDZATTwN3eiJdEod/t+G2XIYP7uR43W6aDLhh5zrH1++Hc8/lb2pMAe4n0GGARq9RsGkRDAKdBJ4u4BoNzK87Vvzzv0CNLjF5SZK/3t4E1d2G58lIzb/5cddAgbRyPqn9eyKd0EYbeknUnLIexQt8WEb9VoAFEuzWWcFl26YrxUcNbCmirZi4Ag3yYWfoRhMMnwEd9ZF3/KOxZs4BmCIIBDDBssaMd9d3gK1dmseDHCk7z3Q== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:34 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:34 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Jakub Kicinski , Shuah Khan , Richard Cochran , Maciek Machnikowski Subject: [PATCH net-next v2 5/9] ptp: Add .getmaxphase callback to ptp_clock_info Date: Tue, 23 May 2023 13:54:36 -0700 Message-Id: <20230523205440.326934-6-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0055.namprd03.prod.outlook.com (2603:10b6:a03:33e::30) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: 6116bd20-2bd8-432c-7384-08db5bd00d51 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z28mMMgQaGR/yOB2Dlg73XDSbyiX6Yg4z6ngiUDtd3sAQVP8OE7sWNs8bxliV04uPeId4iNt09JlLFsUgOTisjVp0ybkdT60Saml+AfGUN8I5i5bED8Ljy7bIgwPiJxuvryuXPVWNIgRwNPzIZNOU9ro3Jd/UgTXko2WzhKIPGDvRIB8H2NhQ9AXDAgBEMy8snh0lLsaPNqebBecAtzR8KaZw8bJ3SHJl7wEd7eeZLqQG+Z13vIqw1VosMJJKVgET7cwM1cWz7n3s8C3d6Hf9wvWtyeh5QPKzIU/cYnKUsgMBzPxniWTWWMSo96pm4xBwHhD/EcCb0vO4wgJn1xugwZ4KqWWaMw7ZTcQ3qY0+N5d4hbdfFuTVhCP67YPBsr/bJNt/xtYrpuL6kahQ+R6Biwqf/eGFFzeTPVDBjuEKGDB2UVie1xHxb7Bgi29Kwi1op2Hm7sgDuK7FQ80qwrDZ/5qJ0rMp76AvqCiP5M1gmSRjhq7KH+XS4AJuxMQbhH9iAkQZtOxYp8z1JShNsAHTFDVzMpBRCaI9MX/7Gztgeg9DvdfkESkzzBE6sTyF8LMQYLBkP0BcElHJeoXNJWPChQ2bD8xfvu6iA/T6J0YY1e/K3wCjASr04KzhQBm70gx 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UcygJd5eH9sbKR8hMawbtBzisJGHI+GmQXAl8Gs9KGsVORxDdUWSb1BcRw27GWJkKhrdnFeW3ZkcMXgvc18yQ/yo7dT2JpfLK4epWMqxfEptQ1WNZrJxr4xUnS2FTeYG+jAhk7zaxv/Mptu/qmXDaJuqlwsJ1VE+XTETlzneI8zn1h2Uahk5AY9winnFlhbBNrF1ipDdg2A/1fwDM9CBexFLDlK8RmDKAncX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jjItPjjcbxMN3w2b3lhphTngQexUD5WgeeWhH9Nqb2rNIvZCUR1GPFR5VHzW+HwWg1sAehv8abWT4N0ty78vpzRdz4UbpWi9niTP0t09rLn3cJzrwZvzSRNdknVEQuPOvMHwqmkGhyifYlKzOEswUwXG9UDEuzVrCUk7DBaewh3O8epxVZgfBjW9JsPjFsajzlRvP1GR0JFtJyX1m8oUpaqy/+RB4yWIyZb7yX9gjCvkUxKevU8MWvlCThLfYZtwjKY6mOvB+1o0l0PQ2dmhmAkMBOG08rpfi91SxUd7g3MpmqEQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6116bd20-2bd8-432c-7384-08db5bd00d51 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:34.4985 (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: XraXLebJBk6rg91JPVFdDK+P9B4P2iYN4ojAp3h60u/rldfzTeKABYgcng5umQYen5uFMFHSABn34UYoSHFh9g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Enables advertisement of the maximum offset supported by the phase control functionality of PHCs. The callback is used to return an error if an offset not supported by the PHC is used in ADJ_OFFSET. The ioctls PTP_CLOCK_GETCAPS and PTP_CLOCK_GETCAPS2 now advertise the maximum offset a PHC's phase control functionality is capable of supporting. Introduce new sysfs node, max_phase_adjustment. Cc: Jakub Kicinski Cc: Shuah Khan Cc: Richard Cochran Cc: Maciek Machnikowski Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- Notes: Changes: v2->v1: * Removes a macro introduced in v1 for adding PTP sysfs device attribute nodes using a callback for populating the data. drivers/ptp/ptp_chardev.c | 5 ++++- drivers/ptp/ptp_clock.c | 4 ++++ drivers/ptp/ptp_sysfs.c | 12 ++++++++++++ include/linux/ptp_clock_kernel.h | 5 +++++ include/uapi/linux/ptp_clock.h | 3 ++- tools/testing/selftests/ptp/testptp.c | 6 ++++-- 6 files changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index af3bc65c4595..362bf756e6b7 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -136,7 +136,10 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) caps.pps = ptp->info->pps; caps.n_pins = ptp->info->n_pins; caps.cross_timestamping = ptp->info->getcrosststamp != NULL; - caps.adjust_phase = ptp->info->adjphase != NULL; + caps.adjust_phase = ptp->info->adjphase != NULL && + ptp->info->getmaxphase != NULL; + if (caps.adjust_phase) + caps.max_phase_adj = ptp->info->getmaxphase(ptp->info); if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) err = -EFAULT; break; diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 790f9250b381..80f74e38c2da 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -135,11 +135,15 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx) ptp->dialed_frequency = tx->freq; } else if (tx->modes & ADJ_OFFSET) { if (ops->adjphase) { + s32 max_phase_adj = ops->getmaxphase(ops); s32 offset = tx->offset; if (!(tx->modes & ADJ_NANO)) offset *= NSEC_PER_USEC; + if (offset > max_phase_adj || offset < -max_phase_adj) + return -ERANGE; + err = ops->adjphase(ops, offset); } } else if (tx->modes == 0) { diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index f30b0a439470..77219cdcd683 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c @@ -18,6 +18,17 @@ static ssize_t clock_name_show(struct device *dev, } static DEVICE_ATTR_RO(clock_name); +static ssize_t max_phase_adjustment_show(struct device *dev, + struct device_attribute *attr, + char *page) +{ + struct ptp_clock *ptp = dev_get_drvdata(dev); + + return snprintf(page, PAGE_SIZE - 1, "%d\n", + ptp->info->getmaxphase(ptp->info)); +} +static DEVICE_ATTR_RO(max_phase_adjustment); + #define PTP_SHOW_INT(name, var) \ static ssize_t var##_show(struct device *dev, \ struct device_attribute *attr, char *page) \ @@ -309,6 +320,7 @@ static struct attribute *ptp_attrs[] = { &dev_attr_clock_name.attr, &dev_attr_max_adjustment.attr, + &dev_attr_max_phase_adjustment.attr, &dev_attr_n_alarms.attr, &dev_attr_n_external_timestamps.attr, &dev_attr_n_periodic_outputs.attr, diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index f8e8443a8b35..1ef4e0f9bd2a 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -82,6 +82,10 @@ struct ptp_system_timestamp { * parameter delta: PHC servo phase adjustment target * in nanoseconds. * + * @getmaxphase: Advertises maximum offset that can be provided + * to the hardware clock's phase control functionality + * through adjphase. + * * @adjtime: Shifts the time of the hardware clock. * parameter delta: Desired change in nanoseconds. * @@ -171,6 +175,7 @@ struct ptp_clock_info { struct ptp_pin_desc *pin_config; int (*adjfine)(struct ptp_clock_info *ptp, long scaled_ppm); int (*adjphase)(struct ptp_clock_info *ptp, s32 phase); + s32 (*getmaxphase)(struct ptp_clock_info *ptp); int (*adjtime)(struct ptp_clock_info *ptp, s64 delta); int (*gettime64)(struct ptp_clock_info *ptp, struct timespec64 *ts); int (*gettimex64)(struct ptp_clock_info *ptp, struct timespec64 *ts, diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h index 1d108d597f66..05cc35fc94ac 100644 --- a/include/uapi/linux/ptp_clock.h +++ b/include/uapi/linux/ptp_clock.h @@ -95,7 +95,8 @@ struct ptp_clock_caps { int cross_timestamping; /* Whether the clock supports adjust phase */ int adjust_phase; - int rsv[12]; /* Reserved for future use. */ + int max_phase_adj; /* Maximum phase adjustment in nanoseconds. */ + int rsv[11]; /* Reserved for future use. */ }; struct ptp_extts_request { diff --git a/tools/testing/selftests/ptp/testptp.c b/tools/testing/selftests/ptp/testptp.c index ae23ef51f198..a162a3e15c29 100644 --- a/tools/testing/selftests/ptp/testptp.c +++ b/tools/testing/selftests/ptp/testptp.c @@ -292,7 +292,8 @@ int main(int argc, char *argv[]) " %d pulse per second\n" " %d programmable pins\n" " %d cross timestamping\n" - " %d adjust_phase\n", + " %d adjust_phase\n" + " %d maximum phase adjustment (ns)\n", caps.max_adj, caps.n_alarm, caps.n_ext_ts, @@ -300,7 +301,8 @@ int main(int argc, char *argv[]) caps.pps, caps.n_pins, caps.cross_timestamping, - caps.adjust_phase); + caps.adjust_phase, + caps.max_phase_adj); } } From patchwork Tue May 23 20:54:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252923 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C9B15A958 for ; Tue, 23 May 2023 20:56:27 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F590186 for ; Tue, 23 May 2023 13:55:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D8+s654KYOjySusDJ73UM7DQ6afYG32Gcwu/AzXbqJO3Ao/7JMVHsOTczxjmR/vstVDAdBIeuuetcnmZmmG+9q7Fr8x3fElOF19voFBWHSDpi7K+EAPQod6ImeY0kxvLotjqbjtbjWec/zAVQPz4J6/ZMmZ9n6OSafD/Rd08t9+8BI+mKMYOgUoNJX9oUA1fllNIs3s1VNk9Z7CjDEamz024zz685g7+xpD6ZnvwfPQF4KUOTXLhZVD/hEbBEtYokQWj3Igayr1bUxOzhVSounnb+JkzgqS3p9IgvYuQDjdQjUFGSvv++fuDtNzqegWKA6C7Tp/Mv4rbNbsrD0wKAQ== 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=5HJp3wiVtMq4ICjqFWFw/dI7l939iD/xx5s18c8SOg0=; b=YU4PNW3AqNkNn40CLy5Ztn1TA0fAdhBgzSYymPj5QgDfVknkia8RjXsk8u+orNGlsUhkFW6cUUTjkvcIT22DDIgFNRCbB8d5TN3Xk9+eqnb/X27x3mbneTQoCO8zmw08KPbyDWmcs0u/HLygDHfi2lpvbfL2QlxZXuglisdpjKMTZyGnbuk5okvi8yxvunor34lmx9pw/PJvNOzzki0S+YXGVTe6e8SGJnD9e2HkS5tLPLO5RcVKwDI8YQh1cGTDUHsZDd6mvklis9xHum2C1xAxBYnFsYlxzK9+MkInk8AyLyPwPJzUFLnURdBOOVeKAI2V1A15gDuSrlw/VnCZug== 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=5HJp3wiVtMq4ICjqFWFw/dI7l939iD/xx5s18c8SOg0=; b=aihNk0nnMoC1EvUk+sKtASjneV2xx57ZUMTtuDk3VYUsGSevfQuHseV/W4Ovo/R88kMEXWHjPAn94T5QFahNCU5lNkrnJg8FfKmfmkIY65lR6GbPRkgo0447xkkZ7uONlZZck+OaRUIv3W5hA0pv+T3Hd8YES6ERR2Fvj3g6CTgExzcLMp5ymNe+qRNpU6TISk3NI+4aUzTx+eW6CwfZbZAOMYS4BQj1dB1bHl98vbl3pbVmoCF7OZT293wYEKCQ9mwYDiBlkwCSLm9wgR75OkFO8w8GMP9llxUXwT1lw3pQzNkQGWYaTUdXQrHeVYUBPl1CdfbLVdSQgODJmVi/hA== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:48 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:48 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Saeed Mahameed , Richard Cochran Subject: [PATCH net-next v2 6/9] net/mlx5: Add .getmaxphase ptp_clock_info callback Date: Tue, 23 May 2023 13:54:37 -0700 Message-Id: <20230523205440.326934-7-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR02CA0041.namprd02.prod.outlook.com (2603:10b6:a03:54::18) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: c225432a-4cb1-4796-d5a7-08db5bd015b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hy5ZmWlmzYAyHhZg8QD9gb9xK6BHR6nz3BVK+8Ch9ZQej6ctUNTIWBzlU9RSduu2LbNlLGKZ8jZT8SWj9OFAekr4TA+mswnBg/1iX8UK6BEgbfp/debDGmYs6bsF/ktAL1oHejp/MYk0poXKWNUc8yB48Q19rKWsJkbReO8SDFiLdoIPWRckzndP04HE0VrcgDVz3+CEU8DC4y+5zWnEZ4CAIAdhYz+3Vidtrb8vnutoZ1zw4u65a0QT9OhF/GeWlm0qqTQt1lORnWaM2SL0v9wBIHUvrpw3prgEOLNSBX1SLWIEwSx9dvEUL77ibsdi6l3PZME364Pn5ha3W6m8ddjAIUabGwp6J6ttPv+FOS63JgHBue4oD9UejZ9RsBPdE90jk3vvxVZYrtNsd5L9pyyVtdRZu1rBih7gBF3NSiL2VpDwLHLznJSaKZUoyHB5UzAcFTwIFWbQza5XyPjNfN6fWNalCrWbDfEKOt/qlrXzbqlvha2q30bZTwuvZ2IEPF761TMw2YoaDiGQSWRSvCiegx8u+7S/v1mPJhzI/WJkeCEAUH11DQPFfb/5FeFeMNtOgrLEGNpUFK4wk3Am0ndz/ue/SM9FJjYiECZ8WEo= 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(6666004)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mcg30WVo2F7gPsd7no9WVoeyjX5RaL15HnZJmUBdyABbUSx9XAgtC7ll5dnEZNjfZp+bTMJqQ5wQ1rn9M4Xjc2XgSdk/yuea+mn+1gRhhJOC4JqbSd229Sa8QVPp7cK3Xbq8LKnnSCgw+wmVakjLt7/FRx0R40wQLYpQTQBnv+KIrMtUEW5+gg1kiveOqBwrT+OPQCc6f+fqCeZop2VQ/ee+XybiuNxLDah5GZHyYPPUBywAYW6dawogJY412ItRg3IWhpIYlxbFKjaHzSepVKD86g5YFfrKkr3HzTjdYIxjbgp/1d2nMwnm4LQ2l3FIi6UUvNu2NnxDUlgQgHVKz6aO66q8byrO5+KweT4WiZemE0SrM8IUCoGYFOKER/LZftMtsb6xSHp3wAqJ8dzlWCUnIkwrJKHnx3oeTOK9u/ZnkWhLQi45ETfD3YkczWYZe3zVIViUn3+3AozWK7eiPj4chHhdqUFXYSwqYHdR4Wwpy6JIOuTYhNulJMQTRgCZ/RENWQ9YxnnaZFV4ctl/DzyXKFZ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== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c225432a-4cb1-4796-d5a7-08db5bd015b7 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:48.0434 (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: IcROGRs+k426nV4kyfJhPeGYRrdixueJZoPrxksFQC7MusjyhGv9LFIf/4Th7S6StIlTCZ27Zv5qqDaPar5/IA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Implement .getmaxphase callback of ptp_clock_info in mlx5 driver. No longer do a range check in .adjphase callback implementation. Handled by the ptp stack. Cc: Saeed Mahameed Signed-off-by: Rahul Rameshbabu Acked-by: Richard Cochran --- .../ethernet/mellanox/mlx5/core/lib/clock.c | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c index 932fbc843c69..973babfaff25 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c @@ -93,17 +93,23 @@ static bool mlx5_modify_mtutc_allowed(struct mlx5_core_dev *mdev) return MLX5_CAP_MCAM_FEATURE(mdev, ptpcyc2realtime_modify); } -static bool mlx5_is_mtutc_time_adj_cap(struct mlx5_core_dev *mdev, s64 delta) +static s32 mlx5_ptp_getmaxphase(struct ptp_clock_info *ptp) { - s64 min = MLX5_MTUTC_OPERATION_ADJUST_TIME_MIN; - s64 max = MLX5_MTUTC_OPERATION_ADJUST_TIME_MAX; + struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, ptp_info); + struct mlx5_core_dev *mdev; - if (MLX5_CAP_MCAM_FEATURE(mdev, mtutc_time_adjustment_extended_range)) { - min = MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MIN; - max = MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MAX; - } + mdev = container_of(clock, struct mlx5_core_dev, clock); + + return MLX5_CAP_MCAM_FEATURE(mdev, mtutc_time_adjustment_extended_range) ? + MLX5_MTUTC_OPERATION_ADJUST_TIME_EXTENDED_MAX : + MLX5_MTUTC_OPERATION_ADJUST_TIME_MAX; +} + +static bool mlx5_is_mtutc_time_adj_cap(struct mlx5_core_dev *mdev, s64 delta) +{ + s64 max = mlx5_ptp_getmaxphase(&mdev->clock.ptp_info); - if (delta < min || delta > max) + if (delta < -max || delta > max) return false; return true; @@ -351,14 +357,6 @@ static int mlx5_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) static int mlx5_ptp_adjphase(struct ptp_clock_info *ptp, s32 delta) { - struct mlx5_clock *clock = container_of(ptp, struct mlx5_clock, ptp_info); - struct mlx5_core_dev *mdev; - - mdev = container_of(clock, struct mlx5_core_dev, clock); - - if (!mlx5_is_mtutc_time_adj_cap(mdev, delta)) - return -ERANGE; - return mlx5_ptp_adjtime(ptp, delta); } @@ -734,6 +732,7 @@ static const struct ptp_clock_info mlx5_ptp_clock_info = { .pps = 0, .adjfine = mlx5_ptp_adjfine, .adjphase = mlx5_ptp_adjphase, + .getmaxphase = mlx5_ptp_getmaxphase, .adjtime = mlx5_ptp_adjtime, .gettimex64 = mlx5_ptp_gettimex, .settime64 = mlx5_ptp_settime, From patchwork Tue May 23 20:54:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252925 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 C38AB947F for ; Tue, 23 May 2023 20:56:47 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2068.outbound.protection.outlook.com [40.107.94.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7982EE42 for ; Tue, 23 May 2023 13:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JAke74a/QzPL/3uHa+XQuG2hD1YyLoJOHBVPaIfrE8OPuY7crd6aXVVYU/95FakbrR1iYx7BjdnaLdqplbFDvRQL+TClOuSKOMss3UUU+NG3yfi3sdOmb/PZkOw/dj9gPWP1wiuE0ARYjMXZT2R/t2bLBSrpmLrCV5Plq4u/Bg3wSDYiFd3yywp+a19i/8Geyfek30jkHTTg52q5TFln52Wm5BLwYDWKYjIAgZ0Brmx3RPcgCvwvUXGIX2oHNCg3sEN+CJ+4Z8sSbQICrZMj1pm76VsQDUpcKS808kOHcPtN3s6TuxIv9SKfuIBVovPtXCFeZlPG5DbsJ/BBl0Hyzw== 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=CIz6FjYJvU9aKk1zEaIYCJqwEg84tC/Okf7qwQ8z/oI=; b=HM2w6yiQy9bEdgeEB6Ybt98Jtqdk3ZvSF20+URtNKEaaSHuBegTB6kFcWpkR2a/sZJa+RDyEplameg0+S8Z5RuUoQcRDxdnTxHiUNvTAvu4N0EHTAz84hwIRXkPC1wMW8DuZ9duYJEorst/cGf7nNqYqhrjHLsVUCmaNLrd/EoOK3oM9jPq94Sl/lEqVAfjND4SJ4fnAXsN0IIbYVwPa3Otk4sJi2yMRS5mI85+WzOQfvL+NLfsOcFrfFJ2x/9ffwRQcwZ3/1j9eph6kdANvqjnv1aJdjdZc5LGB/H+a0rZEp5fLZ8A3CwyeGlOh1u4zKtfHxBIs/QF5hF18hgbZFA== 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=CIz6FjYJvU9aKk1zEaIYCJqwEg84tC/Okf7qwQ8z/oI=; b=XMDui4oQNZ+Owpd9DUGC3JuOkFh4SAxowLk2X9R2BzZQlKWESdT4UWcaL6KI2A5Ue2Qrb8JW5DksQXT4NOdkFuUy5rIzCW/AdM+FXdz/BH089peUE5WA4cM4p3+VC2UmVxOJR8sl8f/iWffURTkhN313o+w8Vnen0UQUwwC/CJBw8Aimj6CP+XLkYO1FpcGNcezXmh1LKTSAx8T19qedoTRnAMs4nfUQktMMR52YnwM2epzyqlpfrrYInpuvlqZm2meJii2t0MhxOpOSjFWdo8GrhXjGNpHL7yG82O7lC4mUGkNVr5kwqHNEmI0IeSQYTHli886zNRxqaQrqW+G1xQ== 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 DM6PR12MB4337.namprd12.prod.outlook.com (2603:10b6:5:2a9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.29; Tue, 23 May 2023 20:55:55 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:55:55 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Richard Cochran , Vincent Cheng Subject: [PATCH net-next v2 7/9] ptp: ptp_clockmatrix: Add .getmaxphase ptp_clock_info callback Date: Tue, 23 May 2023 13:54:38 -0700 Message-Id: <20230523205440.326934-8-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR07CA0036.namprd07.prod.outlook.com (2603:10b6:a02:bc::49) 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_|DM6PR12MB4337:EE_ X-MS-Office365-Filtering-Correlation-Id: 206c38b3-6e8f-4ca8-2f9b-08db5bd019d3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vhbM8+exY3LDsi/XKF5tu1Jodahn6huAFQFAeOpZwb5e+30UGG+ZknH15oevGimMt7x18J7Y4llS1eK4qZBiJDua88cUILWzbkIehIcSyVyGJzpHuEHr63FOg9xCePYYftwWPvK5Sq165dF0BLVaC9qaPQbc48HP7r+04F2sEtLX7PyBPKIXkeXdNXSD2NPXMBDhl2x3O3ztEvJhR5oNisAL5sVGyHaMyFyRJ4NysrVEQd224LgzmO/WurNuygB/W0y6/QqdkZFEl+WatZjTIUP0XvuB2W/YkoYYIOhpJvIKBo7DkBAmdjPkCbd0G9lEUxu/WFaNg9vYNo4bEoIZI7Uv9dATiNVtWfIV/lrX4CFzA5jZGvPUzU3cgN8Day9xn2Q9QmzAmzQlLiS9Wq+c/PgFs7itOQ0E9wJM3oWgycXkza+aGeqLRtV9dfT1FuVOlsx1ria6IvjvZFzu7mIPuAyO2piuvlZbzL9yXH4S4dwJANjEvXB4ers1FciEJuZYXkqmlIb1Wz8HBvrXZ34UnWHQ9B3r33zSaMvwY6lkT2SPxxb1b/WMc5h7Apmb0ImhuSs9ESJo4xAyyf5+jtdCFhNTCnOT/rRljCbVSSrx26Izo/ftLhFzIrPsHemEj6/M 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:(13230028)(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(451199021)(26005)(186003)(1076003)(6512007)(6506007)(2616005)(36756003)(83380400001)(2906002)(41300700001)(6486002)(316002)(54906003)(6666004)(38100700002)(478600001)(66476007)(66946007)(66556008)(6916009)(4326008)(86362001)(8936002)(8676002)(5660300002)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EY8hPDZf6DliRpvRodulP69xPFde2eB6hGwjM1Jt/N6eEoP9qR0Tb+9hOkIe9WZiBa3Obs9Jz6Pxs6DCTWR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ss6oHgxO5Tj2Lc+I3UiwP+ByK9xnfo5tTK8nFS8I5xl/H2afcw4QUky5w+T0IA2EgHiisS0t3pYALd+NzJnJTCH38tuxI91AgAr19SzmgUb6ZvHUWdlmoQRoMoo1inT+YHc7eaKSjLrmCiCLDu5PSQ0XUHOX2kcevK9ZzBoNf2/dVzqVpm6CqkzePac5fx74YtQ+H98+c9Z3we94G0FHIICOE//ciSib0WV8ODh4twBS1GybWYFzC5k4n/n2Q3GyCC8WFxdpbIflG2FyhWSqjDk9cn2omS/WEKisUqr5WbabJ0t3IHxLwH7gp+pn3XYFtleEKRllpGdBr9i7DUSYqqPwg1gR+90DiFjStnGyFRfGId2YZIbfTBlIiQxiVbbTPvXvvYVbByKea9Urx9TF95sNrFAU3EShoimldBfCo8JiBOi03IxN/adflYREly8vxSHxy47w== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 206c38b3-6e8f-4ca8-2f9b-08db5bd019d3 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:55:54.9222 (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: M7dliFVLI89DRU5dDsIZ+TgqeaQM8135j6GtFQV7fkizDSMvF1ts/DAfmJZ1ekYJYIiMAhHMjIBLViQhd/CWug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4337 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Advertise the maximum offset the .adjphase callback is capable of supporting in nanoseconds for IDT ClockMatrix devices. Cc: Richard Cochran Cc: Vincent Cheng Signed-off-by: Rahul Rameshbabu --- drivers/ptp/ptp_clockmatrix.c | 36 +++++++++++++++++------------------ drivers/ptp/ptp_clockmatrix.h | 2 +- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index c9d451bf89e2..f6f9d4adce04 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -1692,14 +1692,23 @@ static int initialize_dco_operating_mode(struct idtcm_channel *channel) /* PTP Hardware Clock interface */ /* - * Maximum absolute value for write phase offset in picoseconds - * - * @channel: channel - * @delta_ns: delta in nanoseconds + * Maximum absolute value for write phase offset in nanoseconds * * Destination signed register is 32-bit register in resolution of 50ps * - * 0x7fffffff * 50 = 2147483647 * 50 = 107374182350 + * 0x7fffffff * 50 = 2147483647 * 50 = 107374182350 ps + * Represent 107374182350 ps as 107374182 ns + */ +static s32 idtcm_getmaxphase(struct ptp_clock_info *ptp __always_unused) +{ + return MAX_ABS_WRITE_PHASE_NANOSECONDS; +} + +/* + * Internal function for implementing support for write phase offset + * + * @channel: channel + * @delta_ns: delta in nanoseconds */ static int _idtcm_adjphase(struct idtcm_channel *channel, s32 delta_ns) { @@ -1708,7 +1717,6 @@ static int _idtcm_adjphase(struct idtcm_channel *channel, s32 delta_ns) u8 i; u8 buf[4] = {0}; s32 phase_50ps; - s64 offset_ps; if (channel->mode != PTP_PLL_MODE_WRITE_PHASE) { err = channel->configure_write_phase(channel); @@ -1716,19 +1724,7 @@ static int _idtcm_adjphase(struct idtcm_channel *channel, s32 delta_ns) return err; } - offset_ps = (s64)delta_ns * 1000; - - /* - * Check for 32-bit signed max * 50: - * - * 0x7fffffff * 50 = 2147483647 * 50 = 107374182350 - */ - if (offset_ps > MAX_ABS_WRITE_PHASE_PICOSECONDS) - offset_ps = MAX_ABS_WRITE_PHASE_PICOSECONDS; - else if (offset_ps < -MAX_ABS_WRITE_PHASE_PICOSECONDS) - offset_ps = -MAX_ABS_WRITE_PHASE_PICOSECONDS; - - phase_50ps = div_s64(offset_ps, 50); + phase_50ps = div_s64((s64)delta_ns * 1000, 50); for (i = 0; i < 4; i++) { buf[i] = phase_50ps & 0xff; @@ -2048,6 +2044,7 @@ static const struct ptp_clock_info idtcm_caps = { .n_ext_ts = MAX_TOD, .n_pins = MAX_REF_CLK, .adjphase = &idtcm_adjphase, + .getmaxphase = &idtcm_getmaxphase, .adjfine = &idtcm_adjfine, .adjtime = &idtcm_adjtime, .gettime64 = &idtcm_gettime, @@ -2064,6 +2061,7 @@ static const struct ptp_clock_info idtcm_caps_deprecated = { .n_ext_ts = MAX_TOD, .n_pins = MAX_REF_CLK, .adjphase = &idtcm_adjphase, + .getmaxphase = &idtcm_getmaxphase, .adjfine = &idtcm_adjfine, .adjtime = &idtcm_adjtime_deprecated, .gettime64 = &idtcm_gettime, diff --git a/drivers/ptp/ptp_clockmatrix.h b/drivers/ptp/ptp_clockmatrix.h index bf1e49409844..7c17c4f7f573 100644 --- a/drivers/ptp/ptp_clockmatrix.h +++ b/drivers/ptp/ptp_clockmatrix.h @@ -18,7 +18,7 @@ #define MAX_PLL (8) #define MAX_REF_CLK (16) -#define MAX_ABS_WRITE_PHASE_PICOSECONDS (107374182350LL) +#define MAX_ABS_WRITE_PHASE_NANOSECONDS (107374182L) #define TOD_MASK_ADDR (0xFFA5) #define DEFAULT_TOD_MASK (0x04) From patchwork Tue May 23 20:54:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252924 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 7DA189465 for ; Tue, 23 May 2023 20:56:31 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BAC1E5A for ; Tue, 23 May 2023 13:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ckhWOgeWKd9X+bBWSMxY5Pxq4+2J6KOldQSz/dYk3JzP2y4UdPOXru6a+Hb7nxiRys9OV+ChH8XQI5uIsHHcid6p28JZT7wy1bGz88lQ8tjoW2DlsPas5NGMHAMoTtmfwVX8TaFPiL2MZLMmmHOdTlgOM37Am3ueiKyUAoE6m++da9Ltpl88+UDzYbSMcr09v25XBKOCvXXLiGcN1RBpLPZz7NaXOqB3ce7tbnhU5pTYLaX8bk+fQk/eWiJKvmfCcmnLJeWBr2eG54EprtMQI6fLrlrk13IotqcEQENHPoMRZck2/Xon6Lz5XTb/7oWMysQhQlbdHsgyVA5IjHWKzQ== 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=frxpCCCzUClrSmSWVChBKmih7shCvwrrejg/QVAtzKc=; b=mvYelfzgqhe434i/Uj5i0CRGHT8JT0hO7MKWP/cz3bPrLPXZ6Dgyd0MCBzcAZ1MJHP8YoVcFhex13F/bIvZzguPNEpRY+QYBqC9ZJ9wyArSahLuFzq4NfPfR9NXy8ZXFK2VmJORYsERWZKL//Qq79if8t/X3goDMw5GIBU4WF1mCZRA4SMa2Ab4A2CtvBuhQr/eaUQ3WHamzQwSteEdnjjP5rxlPBSdhbzN0evtbnAaezp6DvGCteWzOrnaetrd6SpegxFSQmh2PKPsZJv9Sj7h6vz1eFhr3Kk9kH4VNrnjkO3IWUnb7bxurs0HisHckdNF2k0+IPzt2DUZZA5+M3w== 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=frxpCCCzUClrSmSWVChBKmih7shCvwrrejg/QVAtzKc=; b=tjkFyQgQX/zNqksFFMJfoCDgnWoWRRTEFtIblJcDLVykjmUGarON5TSLnsKUozI9BPYyknPGa3ocfz54pJHDDHWzziuUH93e/xJ4150nmJkEs8XRLbTXKi7nB7La5uct18BmVKmbxJnoZ4ePzPZXtRH4yl6wsrNAw5Ss7I9FyI0z2v1JTHdmU+AuLrNayRyRdMtzQGJuGIML7eNyHj5VASCLoIN2DhXuZN7fQXItLdEg5Znul7AtonooE2N0DOQLP81McmaKEfk7sTrFk0TuPK8SLjDhR5TcDjG79HnGNCAMxg7omu4t6o8p452KTw1qZDtbeIPYLv+LVLQjUb0+iw== 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 CY8PR12MB7193.namprd12.prod.outlook.com (2603:10b6:930:5b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Tue, 23 May 2023 20:56:00 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:56:00 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Richard Cochran , Min Li Subject: [PATCH net-next v2 8/9] ptp: idt82p33: Add .getmaxphase ptp_clock_info callback Date: Tue, 23 May 2023 13:54:39 -0700 Message-Id: <20230523205440.326934-9-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR11CA0092.namprd11.prod.outlook.com (2603:10b6:a03:f4::33) 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_|CY8PR12MB7193:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ab014e7-3245-4494-ae02-08db5bd01cea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZB+uPjXDa8oFpmJAFKOLf0fwRN7YkADq2OKL0M4D15g3xx5yuMVDLtDb4u2jD9xNdGUZJ5pDWKk9BhcmHMa+ggQxXb7z5rSb4NqYJ7xBt2xhEgIMkXIJjVgvvRZk/pJr1h5J8e4AR0m2kuyA2ycRtUofEWDA1ZAp7SmsKXfie9adO1GC0kNKdY8vp+OLyREiqNUXqDRiv3x96CECdbxdLnd4G8/2mhAyC10yjINzFQ6lX+RRvwzlbqxOlQ5VmeAnh10YjkyqQEnBLLvWmnlgdNP+MtZ0YmKwoIa6xexzcXNHI85TWaoXzc7j+b4TRPTWxJSTGCz3q6Sctwea5Zw4zcU5w9k28AVOWjfyhi0rQbVDKicQiO4WnViXzG2ic19zbd2mO28bfmKO5MrgxEaRKATwRa+vEYY4nInr5+1dSa2Mpy7TeCwJAnMpfcxG4+0SbCYaqbVKSHBrj2LjsbImNzl09Bi4qNvTYzhP95BrnUTKVvozVE9zUexgKqu/VWnNBdF1/LS4gzvhpPFkmyHvZIi+ggEBFP6FEthRDKzfcJQW9n5801Ou+iJsTUSqmZ8A0oeVEzJ0+H+Us7HPBokcMmvFaZ05Sp5TppWnF7BP9ncxZ3FSTdnbUxDFziEngRVE 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:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(366004)(376002)(451199021)(316002)(54906003)(66556008)(4326008)(66476007)(6916009)(66946007)(41300700001)(6486002)(6666004)(478600001)(38100700002)(86362001)(5660300002)(8936002)(8676002)(186003)(26005)(6512007)(6506007)(1076003)(36756003)(83380400001)(2906002)(2616005)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DmnGuMH/FjoxUnoFB2DgEUgWPEX9/ORMmlync17mCDCvnp82ktSgtDVe3CjBKZ79yCm78G6G3etkhSmtWyOQ4trPAeXc0zmKnZucG2mri65tbEx9AMcp68Z6JAtaVQ7ZCHx7grHAyurkpJY5u2lf2nphsYWTKRehArlrG+GIF+W4zXNz9N8PDh3W72iDS6jnM+pMslzvIV+GJGBs9JaF5O1Z+T6l7h46bQGBNQarBR6WENbIAw104t9b0duN7KEQUbiI19Y27mXbe8UFig4zVnozP9J0MM0SmXBwaMH7CyBNVJCdvlEMoK46U+RpspNb0+ChTX8TefHlRfo3I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4ixUhAJc9ENkhJCNdrVzkV5N1H8AsXcuFV3j5UAC4iljZgInGmhyx58FYheSzIlP7Ejd1h9tf4eXYBJJFQmlUotgRkjQLhbCbeVjRjBzEGVVjioTkZhHJ4F0cncqUcqc0odaBiUPYPxF5OkEmzJ/Hv85/5BjqcuJKxE8TBqfDaAC5u0eH+GtlvTK9jTqYxcYVTSXA0g0WSyNpNpvlRFM/o/PDCydA+jE6NBJA== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ab014e7-3245-4494-ae02-08db5bd01cea X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:56:00.1210 (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: p4bhIlEeISOdMnZgwZ53VBgT//VEDkhrR2ksqCp5nv9nMRgyfDVNEjatYC/GjFLQgvoLoxNbvvZ2KSCnQaVaoQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7193 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Advertise the maximum offset the .adjphase callback is capable of supporting in nanoseconds for IDT devices. This change refactors the negation of the offset stored in the register to be after the boundary check of the offset value rather than before. Boundary checking is done based on the intended value rather than its device-specific representation. Cc: Richard Cochran Cc: Min Li Signed-off-by: Rahul Rameshbabu --- drivers/ptp/ptp_idt82p33.c | 18 +++++++++--------- drivers/ptp/ptp_idt82p33.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/ptp/ptp_idt82p33.c b/drivers/ptp/ptp_idt82p33.c index afc76c22271a..057190b9cd3d 100644 --- a/drivers/ptp/ptp_idt82p33.c +++ b/drivers/ptp/ptp_idt82p33.c @@ -978,24 +978,23 @@ static int idt82p33_enable(struct ptp_clock_info *ptp, return err; } +static s32 idt82p33_getmaxphase(__always_unused struct ptp_clock_info *ptp) +{ + return WRITE_PHASE_OFFSET_LIMIT; +} + static int idt82p33_adjwritephase(struct ptp_clock_info *ptp, s32 offset_ns) { struct idt82p33_channel *channel = container_of(ptp, struct idt82p33_channel, caps); struct idt82p33 *idt82p33 = channel->idt82p33; - s64 offset_regval, offset_fs; + s64 offset_regval; u8 val[4] = {0}; int err; - offset_fs = (s64)(-offset_ns) * 1000000; - - if (offset_fs > WRITE_PHASE_OFFSET_LIMIT) - offset_fs = WRITE_PHASE_OFFSET_LIMIT; - else if (offset_fs < -WRITE_PHASE_OFFSET_LIMIT) - offset_fs = -WRITE_PHASE_OFFSET_LIMIT; - /* Convert from phaseoffset_fs to register value */ - offset_regval = div_s64(offset_fs * 1000, IDT_T0DPLL_PHASE_RESOL); + offset_regval = div_s64((s64)(-offset_ns) * 1000000000ll, + IDT_T0DPLL_PHASE_RESOL); val[0] = offset_regval & 0xFF; val[1] = (offset_regval >> 8) & 0xFF; @@ -1175,6 +1174,7 @@ static void idt82p33_caps_init(u32 index, struct ptp_clock_info *caps, caps->n_ext_ts = MAX_PHC_PLL, caps->n_pins = max_pins, caps->adjphase = idt82p33_adjwritephase, + caps->getmaxphase = idt82p33_getmaxphase, caps->adjfine = idt82p33_adjfine; caps->adjtime = idt82p33_adjtime; caps->gettime64 = idt82p33_gettime; diff --git a/drivers/ptp/ptp_idt82p33.h b/drivers/ptp/ptp_idt82p33.h index 8fcb0b17d207..6a63c14b6966 100644 --- a/drivers/ptp/ptp_idt82p33.h +++ b/drivers/ptp/ptp_idt82p33.h @@ -43,9 +43,9 @@ #define DEFAULT_OUTPUT_MASK_PLL1 DEFAULT_OUTPUT_MASK_PLL0 /** - * @brief Maximum absolute value for write phase offset in femtoseconds + * @brief Maximum absolute value for write phase offset in nanoseconds */ -#define WRITE_PHASE_OFFSET_LIMIT (20000052084ll) +#define WRITE_PHASE_OFFSET_LIMIT (20000l) /** @brief Phase offset resolution * From patchwork Tue May 23 20:54:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13252926 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 AD412C134 for ; Tue, 23 May 2023 20:56:51 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2042.outbound.protection.outlook.com [40.107.93.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45665E4B for ; Tue, 23 May 2023 13:56:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D2DTPsYY5zh3eQac7d9rHOIJTw4jc4POqz3yzl9BdrH3VJhVawFm0IT9RNCHtn0CIaVxkwA2HGXhdLbBJEts+PjcRNTgvAGzZEuUaXrP9Du3rsz3CQyJpRMcAnsAVA8FFkChih/QZe/JvBVgginrKyrXj3tfJVujb7Kdgq3JmT7qImSO9yShF8YK7OBqwQznViJIXsWQdlhHdu/IxCykQhdHVCbN0jKyeCaJUt41Eh1DEnWa4iCaXDAzmfSkK3nuv5OA5yqreDAVZA0vb0tnVuwD5X0P8G8HEwRuxw4xsBgKWPI4vcDoMMcjnz8ioWeNx4+8lqRsYc1EuzDuHPKyvA== 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=GPmxFngQQgr0kN3qb8mmzaK0A2nMHAgmaVGtoKkoqXU=; b=YMA6GMii/kdFc27+piGU8KR56kkNSGbaJIJme/m99SSNHH0/BrKkx750oJLc0W9xBeVJmtl4jXZ7atNzKOP+Szdsmo0tIIEHpivntkczXTV2FOeH31D0vRVvO8HeW4h1/+Oo4FIKG4TR//0PI75adQ8jCCkl7QioRx2oijmXPrzb2flvbTsATetBroFFLN6Efk8e37goopPncak8OYNhdkn/iMm3Nl1whIbGjZcG/mjmlVumbciCs4UNFq8GjeJ8yPoANUM/Uqvezxh1/Rs0fbFIg1mw8WmPjOmGTeb8f8pyh6fv7pW8qg5hfXfnxBS8cE2du25ofOIlXV/I44V5yw== 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=GPmxFngQQgr0kN3qb8mmzaK0A2nMHAgmaVGtoKkoqXU=; b=LNJrOsdWw3k5ee9tzLv5ExtA2ovhMezvK6lTnjRWi+t0xFxK7NcdHinEersZk6a9C6t+95RlmKU3OeDNuHhcpdOP2VSZcdieDxDpKkEkiM9WxXQdypMYedKCsnRwZFTd1Grihz0GYSaQRMcyBruhEkYk7e38LozQP+MdEOtDLpCBifBqPkuXiyDZ5PIMAy4Jp5roEI1e3LOGido26HyC7N7ZSgk6rIz0dJVqa1JUirruvru4QjRo3tSJpRqyb4da5UBnWGLQ3MIfI5iZ19oUNJT4dUWbLB1I6Iu4h30S0wsrUSFEbsoqG0HOv3PJRFwWQRS3jXo/kQJwnj1fIKqWSQ== 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 CY8PR12MB7193.namprd12.prod.outlook.com (2603:10b6:930:5b::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.28; Tue, 23 May 2023 20:56:05 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::f3d4:f48a:1bfc:dbf1%5]) with mapi id 15.20.6411.019; Tue, 23 May 2023 20:56:05 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: "David S. Miller" , Jacob Keller , Gal Pressman , Tariq Toukan , Saeed Mahameed , Rahul Rameshbabu , Richard Cochran , Jonathan Lemon , Vadim Fedorenko Subject: [PATCH net-next v2 9/9] ptp: ocp: Add .getmaxphase ptp_clock_info callback Date: Tue, 23 May 2023 13:54:40 -0700 Message-Id: <20230523205440.326934-10-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.38.4 In-Reply-To: <20230523205440.326934-1-rrameshbabu@nvidia.com> References: <20230523205440.326934-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR11CA0107.namprd11.prod.outlook.com (2603:10b6:a03:f4::48) 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_|CY8PR12MB7193:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e306b13-2b57-44d1-40d3-08db5bd01ff6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q1AhNeq9NRZngWtZo69KnVl0jrB4pKXRZVDcJwyYYqQBRNADcRphi8KbDpvVvXP91cNMEtsVAfQUyc/ibzLLUv16qV4ktMmA7C1cyFs7UtStewYMDQ1IOTrAWu7YkUkbMs1QhOnOmJbgdMLUu5Tjt20lx2URdQuYzXTJQH+SlwiWxOFNh5wPPIAhRyesbl4lBifJNjjNSpVk2ZJaWcnLcvda3Ag6BOWemUgWCEAkzwtljcZjV6QfN4ap59I9W0e284KaIgrkNkqIE9Ih0Np+/qCBrJF4ZDcMyKLSqNK51KV5+lPSEQSm9lyDmU88o57HlwGxSWKN12/+QyiMywrl0KAgnSpY90fZlXUKjReJTnR8YdfCO+kOgBBbmDZPdkLKQWwKnL7PUA1sEjzJyKFuGkHWm9k3Ak3HXsyhfVRumF0d0KweIf4tiHVM5g/DSHeucwqsIi6td0IOUNic4dkVlcdQvaVmBhBozQs2aDAlxvjXO9ENnpFkItWZzzrhIw3/O8YItF9ZxUdTCkeSJtsZ226NgMdUwc1E12QhqbMW/ojPnb0VeRDxOzDbobf2CwMsbXGvMcwPbSt8TSgI2GCasOCvdXBHJO5RKKlZEwqB8YjKoghIxZ+g/qa2G1fghVFO 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:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(366004)(376002)(451199021)(316002)(54906003)(66556008)(4326008)(66476007)(6916009)(66946007)(41300700001)(6486002)(6666004)(478600001)(38100700002)(86362001)(5660300002)(8936002)(8676002)(186003)(26005)(6512007)(6506007)(1076003)(36756003)(83380400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ul95LylSpUQI9wyjzWDIpcdgHBG+XzHc8m1WFmGki6ZpkF4WAI+Fq9E9UU0hyAi1rFVcM8x/la3F+OhYdAeZLMrCpo9B/NPxEAGfU2mwTeTxbGccRCnSR1OBOvR9bTgY+U4kxkusNHFqRQSIDVUUYKa2KzFAMSP4NpQTW5Ba9vByMskex3rwM2HRwC50jxqtGiGziab+is5oQHZygdo+40k0M5mqoa8amvcwi/xnf1wY7D75ZK9QJVqcOxKoJF3Fpj9ElFYBI7eN2oS8lek0C0akWZkUHkVDHr0fhqfQ/F+SF/R3abPUyE/GZvkvJGYUY/p2Y8AcNKqyEXFtxccRdsbbqS9eq224weWbwlXq+av44oUQSgpTOzbn+MdQMk1lJ6JHw+D1CuOfPd0aM2T2cZtvYmlSUr+MnI9D+7T/0bxehjQcXjTzMAK8/35fab1Tg24KxRBE+SCzEsyC0tlKY6U/cf1cY92fkDJYHbnDEF05Iuymu4SW/hF0PJKvRVA6Xox68z+oM+Nfas5PUl1OhNzRg4qIzgjnfvt63OeMkXK5vg0/qssbqTlrlxlHmcGXAgOKxo2NfO1p/Xb0uL2xR0TPBwDY4dMJAH1knbhGAyzLkHgjVXDMWJcY0asSg6A== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e306b13-2b57-44d1-40d3-08db5bd01ff6 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 May 2023 20:56:05.2254 (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: HDl+XkKBMhVz1wXRMFxFubMs4xMIHWSYLUb9f1/+KzORivSX/r99mtrDtRnRRZJrZN922OzpzqG4sLw4JvC//Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7193 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Add a function that advertises a maximum offset of zero supported by ptp_clock_info .adjphase in the OCP null ptp implementation. Cc: Richard Cochran Cc: Jonathan Lemon Cc: Vadim Fedorenko Signed-off-by: Rahul Rameshbabu Acked-by: Vadim Fedorenko --- drivers/ptp/ptp_ocp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index ab8cab4d1560..20a974ced8d6 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -1124,6 +1124,12 @@ ptp_ocp_null_adjfine(struct ptp_clock_info *ptp_info, long scaled_ppm) return -EOPNOTSUPP; } +static s32 +ptp_ocp_null_getmaxphase(struct ptp_clock_info *ptp_info) +{ + return 0; +} + static int ptp_ocp_null_adjphase(struct ptp_clock_info *ptp_info, s32 phase_ns) { @@ -1239,6 +1245,7 @@ static const struct ptp_clock_info ptp_ocp_clock_info = { .adjtime = ptp_ocp_adjtime, .adjfine = ptp_ocp_null_adjfine, .adjphase = ptp_ocp_null_adjphase, + .getmaxphase = ptp_ocp_null_getmaxphase, .enable = ptp_ocp_enable, .verify = ptp_ocp_verify, .pps = true,