From patchwork Mon Jun 12 21:14:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277595 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 6C9F8C8C1 for ; Mon, 12 Jun 2023 21:16:17 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA1E14C23 for ; Mon, 12 Jun 2023 14:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LslPnE8O7CIryg5nE5Ypm5qGCCZNsGKNDZaXvOlIBVGZVBMZXZvln5T8iwM4qQwFQf/86xO9oy28pSKnXlreSZ4bpyEXKIyISlQMVNWRIR6BPZ53eVuEk9s9X3qgTneVO2dBt62BaJoRDVnN5Olrk20LblI/DMigU4xwc1G2p0aZm13wRm7A6QT743Lt6FvUZfyXwHr4Prf69JfN0ofoG1futpxNoXTATBzFDkjL6QnwabApgzxh7NlW3Oz4/EUR9uk4HQgvXdgPwYDagLUQDUX9qUUE60hqEw1FaymwyPTj3VSxchqydWN+Yt+OHAA+wst61iWgTr14yptY+5pfVw== 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=5PvU/sNtMyzXBqHY/rlAIRO2jNajjUo6PrekA5cpv6U=; b=VifSC4uAtshJX3vq42kWDElXAmoYDK+SmPc9tTpvsFTNEsjuJiL423l1gXHiGPk5ji2u4cFr1ILkuwaG3wSPqsnbwCejm45uRzwnvsHpV9iX3bRhg9emy4RtrXRUrsRJndZhAkKlFMnk/nHTFGWG8azRP9YAXavPpYRxi/3y23j2bQkSZR3OqV0XUH6qAmkP+XeoY9H/TZnm6vDJwgIEI100ZTd5aP1ms4V+7OUTTXj4KAkBbqfPch2fD6U/ONdH5g+NTmcdu/Bn1r5z18uI0pwp5F4SKIUm/J5ub538KKxIGijwpAoprbm7MaY8iQ0s7xfYV2JZVJzJj3JfZV13QA== 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=5PvU/sNtMyzXBqHY/rlAIRO2jNajjUo6PrekA5cpv6U=; b=lcbVyXkQ2gT0Td8vi4JDR109Qwy7aW8bcTQJTLhVUAqNoAddyAzokDhFamN+elRVUppCIA32/ggTFnoZMabkqE5hORpoguKudzL5F4mU+MHQPWz+HC3x7GsrpiuUMvfkSqqksinW+W1nsf9JvrT/Z4K5XgghFP1BacT4uyFtLd8Evf7ELFvMEGcdgjR9Q1jgFe+V0uqQEymIX1wMY6oMttU+fvjJhrUwt+2YseNq56DTbEJYTaGnwiJR+wXFaHw0ZqRJlz1wh+PcJZbMTlvGBUIIOb5vpLTSfDTzAzQlJ+Qom8PsZWwE+KJhONdHar0Ay9dypFHzYOcBCa6TnZFkWw== 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 MW6PR12MB8733.namprd12.prod.outlook.com (2603:10b6:303:24c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 21:15:27 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:15:27 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu Subject: [PATCH v3 1/9] ptp: Clarify ptp_clock_info .adjphase expects an internal servo to be used Date: Mon, 12 Jun 2023 14:14:52 -0700 Message-Id: <20230612211500.309075-2-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) 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_|MW6PR12MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: ed3a1de6-0886-4fa5-a18f-08db6b8a2533 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mQi7d9WynrUBSXrOTwQsxtdsCmOMXKyrT0XQJIUH0/jg7gNs29T8NEhhZv9Ys1O9j01GoHbEAjt/HZWo7kxjzMqyQrRFVZ8Of3e9qyct3NrmrOE5ceYA9pt/h+7BzK0AT75lEA3IEo0w67A5gtwRB3E9iI1r59KwAL++uIiW2FcoL7hzNzN090qIxVpbRaWSW5ko4n0vsGnaOb4nPFIY9812AA1JqoFss+qADjPOQ962Najw5NMMkweim6JRHwWC3XOi5RZwBkrhOghk7B+BfZAKOLXS02/RnXWwMLXvfJrFwqFyaVp+aRdFq3VKVy4ZsHP5SGAQvMMumzCFdeQwYq0WV5ul6YMLXCupN/YUDxaFaVwLcJtINqsS9hj3xbA0VR69UQ4twSVIsaw03QA9l6eFQxoy8VI3Nuyqoixbt41ZEeflRFnO0dz8oY3cz9NepA6XlUY5RjVPnrum1/qh2HUCrIbytWWgb8M9ZE75Y+aforc9hT/702uwSu1fnqQlMtndrnSoW3cHp2M8xH3OCbdYxO5AFm1Wx3HxeEKnXsxzApHLu6hae5kJ5wdjakqv7Yx3cuby1QZc5pFyMAl32hYpxtUDrCA9OiCw+CUUEzvZrV+ipKy/Oc/E0FvShNPD 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(451199021)(6916009)(4326008)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(54906003)(2616005)(2906002)(8676002)(316002)(41300700001)(107886003)(86362001)(6486002)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(38100700002)(6512007)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zMd2p2QEUhVA8VL8gfv/GX0Tr8wdmonJbK/GZkvAuP/HKu7AC10HgThGnhWnAOeWlWgKTEx2C1J+OmHhgEVIO/HBX0T2iU8J3ZTlJ+cgagVns/9JXIfk+LLYibzSIXajZi1Hyfg4hzNnW7rLJhSWUyiJSwEelEVgjHWhCuRguaOsPPHUzDK7WOB5OONujAmJ8GXP8Qrn325jZuU3o/2VOk25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N9t9pmdgonz3/S2zxJR/uxtKMy7MQVvDloUELkNkdVUIJdl4sk8uRfZiHDPJ0e1Gmp8pkjyOSw2FmvoSMlZg6T+tymOt/r0IiWfTq47UBCv/5/pGTgwD2E+7vRjnbSF+p861FBBQn9xiDHfsDxMu5NRi2bDmANJr9+kHpnf/lvIOGorMOfhzAC+6Cc7pmclNx1Eifm9bJqI8i3toqsvva6FuWLsCRaHZ+XN+uMWNbenxpcO2WxshZCedJvB+kNDEpgwiVaz9fAMJMml616NdEVb2nVILRkwBZdvTktpxyGZbJQzdwiUAqu13zN2oeSIsP3y/aM05UQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed3a1de6-0886-4fa5-a18f-08db6b8a2533 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:15:27.8160 (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: 5KZ67IQCW5pvH0Cd6ork2v5kfq612fJ7rCRLPLjzxj8m4Eb5dq+BVrA6xzuWIuCQ2Tt3KWFq7BbTwz8u7k/4fw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8733 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net .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 Mon Jun 12 21:14:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277598 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 9A688C8C1 for ; Mon, 12 Jun 2023 21:16:46 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33C245247 for ; Mon, 12 Jun 2023 14:16:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c2c3IgJvgLPMO3js7VQL8cl7Pdf2TMgO6cJcnCor2ugkEsY7IEnDCckzx417Z+h2Mes14vTkHy4HmoyHLpK2nU9fVRL9ZCvuTuzvRTqBbfPXjtUpHqpYDgEH9si+HNdAOFTZoagLckfIT75GNsPdoRE5sA6SdYRov6ZN3TAFcOEpsRTFqrX5sCK9ZeR9ZV5FwI+JkTM+15x4TlVh1Sdi8sTjW+giR41kPk5Y+hAqJ/w+AJCe86mL3ZXpPUzP0TL51J3FBQS+rPef/VvM9aiJxXWVZiwG1KN4HyXCjRH7frdiHA6O3VMSp4VvwrIK99uxTpdpJc5OmvgXcTQHrn5aDg== 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=4p4lCisKZhGltqqTYeqbMUd9BsCO3YBBtYlK2L/W218=; b=JAsChBZZ2w2zlQnvOOP7/+J9ptLtorm8WNbGfeysf4DDsIZbII5tQvOoZjDJvBNKc0lcFaAGZrNMGhDzcEZUOk+HTgM4I8SrSvDDn24fQfiTX6BMNMSQwBNygW1gLbbHDf2/anEbKrE5Z5qQbWIdjupaj9Sf+yl3mqs/dPUNKr7rcf2MkDjDafr8X9NN/cuE8JvCHHTFQ6APLGuOjG992pWMqmnEGRka5I8xVcTSYe/VWIGjI+UGzwOD7bHSeE/XxKqipn6Fck5DE5iZ6Mc9iGRs1+XtIxrFxnQyJzZuYjNuN/dd52adiL+ZpPS6LBv7ovI+/NRfIdFFZQel9YjufQ== 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=4p4lCisKZhGltqqTYeqbMUd9BsCO3YBBtYlK2L/W218=; b=mHAu7FtFkSPjKEuaLgN/gK0aLa1Q645/6hKx31VNSG/7HdrECihNKfSMoZ/dygiNbW0T6gZvqsoQBNtdBjdjqGoO8/ERjqKMZE5lKGFZ4BN3jx+C1E0EiArkJLw+xC4RN3xwlX69KuHNEwBhqPZPaBEoKSLuceX69G312xw/GuzvUQPK+E0ADPK9nyJcHCZ3NIMia2x/ehb9DAjuBoe4sZY0JP7xjwoRnanPW9FhoB4SGDIoK1yND9F+adRs39FS8JhhbAm0o21oCXTAR98Q+HWhcQlcT7j+8JqZvyJyt8sZiyjjYjsHEiyaAnoVHtEEp+U54kJeulP3Dqbc20UBog== 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 MW6PR12MB8733.namprd12.prod.outlook.com (2603:10b6:303:24c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 21:15:59 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:15:59 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu Subject: [PATCH v3 2/9] docs: ptp.rst: Add information about NVIDIA Mellanox devices Date: Mon, 12 Jun 2023 14:14:53 -0700 Message-Id: <20230612211500.309075-3-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ2PR07CA0005.namprd07.prod.outlook.com (2603:10b6:a03:505::29) 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_|MW6PR12MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a52be43-56b4-431a-8c62-08db6b8a2c79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7MOA6S21hmgBTOsmYwa2UjEcc3qsUFJMrWSk2xGodRWYk7oPdJZ6oaEp2933tCuq4K6Pf4oRceNgn/kyKmnIlA1CN9h3IggH1EXV7vcRS6mP9viJ0jc4YX9JE+sOOHyb3qj3FRKbVg0dnf120eLfBkB1ymBzMAkv4nwfZdD02BzbmFgHisiDQjHHL4VUIPvdMrhXi5TzeCLVMoHzgWeqe31zcwyzIgddM+sA/ekne/Ze57rLJfnWDZJ+fuHI+kzulf+OYrllt4V0nWw/HhUe5jYvMqVrhy9+5DHW0tz8pslkbyGeaoObOckf1QBmrJYYORbO8EHRuWjSX8UHDH48xhT8Om6oNibpI7cNww5L2shhk7WLZBTqeX8aLrSRawz3fd8DCcda7+v5IUzhQ+UmwhpwyQHJUukP4pYQXUoWUbcPGn66fT0uVbVvwGacll18xVfwfrzABdlkwidvX3C7aCzvdJvd1Vx9dMlG8NLM3LexZeOHOYmbGwjqPFVGHNJfIhbq6QkCG/9CvsMwf+FnWhU8h+4hUQpgEKcZtZvHG+bNuvRlyt4ZJuuPcvloIH/9 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(451199021)(6916009)(4326008)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(54906003)(2616005)(2906002)(8676002)(316002)(41300700001)(107886003)(86362001)(6486002)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(38100700002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SEYIdMt1A2ShzQHwIxY/fduKXXQOUsYO7d9sE3MG3iY4rryV2qbAkE9azIWo1t7pi5B9wFGokPS/pj8zA5OT7rtzB3wIg6/Rq764k34Ee7+yYik7EBqqey73Tq/UoiECPzKqgsyqDapnIg3pNEk+YbR8ublU4cH0CJhwWltthYr8QQcTf+asF3H95ntZU2RgheVBQBjhz9q/GvVZjr7LCFMi69m5j6LPzLUEbqGNT4tlSM7uJJ6kmzT+v5+tSZfR43CDAIwzIFwoLunB53KqxqODdMLD9qvml873pXhAgAybImtEFfZomaupDzbKmjPo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1+Zbpqq8E6eLh+FHVmi8BuObq1qyfVv1osqKCpTOcMkhZYV7T7XDZcbUYzCdzdInwKU8xJ3ia7B6af0z5EBrM6ATv5wCD6+XxVsYlyitHTLJDVDqrY6INjeCV32Gd6p7qzLzqIaIsXgsVlf96DUd+/wFkKxSdxWl0aN5eNOetyhzP0geznvv1gX19b91JBfBRFoIZbyD6ktqyaUGxCgHYhQ== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a52be43-56b4-431a-8c62-08db6b8a2c79 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:15:40.1114 (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: hFHT7YB8gAs0LHPNcYoF1hFX8Tws3fXF9Y1Pz763iRk/MqaLGBPsXfSx/f2M8i7IngK77hFOP7RlPG/nRVSWVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8733 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Mon Jun 12 21:14:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277600 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 A1647C8C1 for ; Mon, 12 Jun 2023 21:17:16 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5417B5273 for ; Mon, 12 Jun 2023 14:16:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iCmzkFizh6uaU+lCYo5fjvegni2bt2W2GaAc65qbntauM70wK+rNL5NwiH7eOkGUZztOEsr1KSt2EaGieduMxVu+JdlJM6SC4WJ77QvLeAG/ruoaN8i7smb8ed1QvwXPPQcpnIbHvJ8hAuNZzaOhEzhJ6wmVEhCbX5ND5IWRExzI2n+R5yxVAjlqUFlDjOcZzeBRswbkvz1CChLGOmbl09e2YYgP5OsH7VHBU49K25A8IniHjoPPzW9OHqna0xgiaoQz1n/K0cBJbMAvRKabJhJtPmOqpVY3/lRylX+rOM+PZvg5rF7mV/maaXhxWqI4uzN0QDPL1yKAvAy+QwLKUg== 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=35R5oB+HaDMvV5rRIv/nnXEuLvp8BO3QXdvwtOZf8GA=; b=U9Z4jZNqEtjrhEktKKCgPhtwYnaytn35lzfVj+mlEpLLAg/o4v3drgsJmzDEEySZlk8QMv6gscqsVZVyg4SE4mRiOhbyxtbSg5ScoB0llenFAukP53X+tt70dc19H44K3pdcfRFk7hanFLG0nTqca5ps8JEgZG7vd5Qhnj8J3bv90HQk+STz9oPXTXxq4q66SSI0i+E8Vo7C1IMh4Jpmsk2RuPnI7PFiEZYgD+F863j/Zg70gQDJIm6HSaOywY2/UKHhsluf88WrEgZhZjjfCsOFy5RZ/uRgn4tANNaV9GjLggOmf7Vo+Sil5+yqlmZKG+CMTshxstpsO1OZohtoMw== 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=35R5oB+HaDMvV5rRIv/nnXEuLvp8BO3QXdvwtOZf8GA=; b=pqp085Goo4MIkxpKiS2+mN4Yq6T5SogIqQCuBZpJoohUlMGr/gmDVLdbBJNxYJc5S33bp0RCVVzHsPS+iu5gX5LBy8RewRGTBoNIKJWhgY0zKpTacWKK7QSDopJi43QfUD8EGv3dh5AK1ytMXnXgv/rX7BCYofkiPryiBu4vRupMwa32wgY3e58IB/3uZimmQFI5I8LDZUybLYNOKroCaJk3SD7snaFLfXESMGGg4EU1N4vXzidYQ4RiO1wMWd891hlLYdBJx08sJolNvDjjGchOgG8ZqiuFfHgJV2gNVKntoBGhf/i5j1DulQjpC8eAB3k4rH44eEm0Iqd2MFNPzA== 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 MW6PR12MB8733.namprd12.prod.outlook.com (2603:10b6:303:24c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 21:16:00 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:15:59 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Shuah Khan , Maciek Machnikowski Subject: [PATCH v3 3/9] testptp: Remove magic numbers related to nanosecond to second conversion Date: Mon, 12 Jun 2023 14:14:54 -0700 Message-Id: <20230612211500.309075-4-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ2PR07CA0017.namprd07.prod.outlook.com (2603:10b6:a03:505::17) 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_|MW6PR12MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: d6740059-b27b-4df8-87fe-08db6b8a3054 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H/OGN9Wm88xeRXqRH0qgZpvOEO4S8ROVqLQwRB+oOgIu120kdpXHdXxSzRnFbgxHPFVn/QQsbN4Sr9zdEjaTb+YqZn5p0Z9CYYzqCAhJRqxwNZ8b4KQGVYZZmlnbpd8TXC42pholoDmIZQJURExccj6PJuyVKgVrQWymUB1ukM4GJbBDahBYB93mzb042QOYr+PhGvnBAC+XoN+NOoes/NaeVy9GrbGjDAfVSEXWeP//Lngc39DNfSqH/obVYRgK77v8O9cwfVUmHcyEpdOJqknVygOrplXRKezFSQ9YrGrun1Y/6T8oEU0D7fVbX+u5lIH0VMeY3W1hsSTyR8lJ0HoNPL0dNtkSYiSwuIXhzbg4KCfu9KVL3+M6TZEB40yem1W4iEKmhPKsaUXn7ZulMZoVRg2v4UF5AJRRTTvbusHTVxaXjOx2JF3pk4kCCY0fWyevLp9XXyl89ukOT2IjxktZ1Azy9tmmksFR/nTPxSClUP7DU/NtI606nl+tliUS4lQEpFlfwsk2P9dmWiSB6zLP+zE6vFg4A5GP0tsrVzQ9PwuKKGQwu5TIrhEJLOrw 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(451199021)(6916009)(4326008)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(54906003)(2616005)(2906002)(8676002)(316002)(41300700001)(86362001)(6486002)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(38100700002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RY4a/eSXzJmIgMPp4vkJ0zMn8JWiRlVscHHtiztPnovAqcWYO3snrVa2dfc5KPE1/meE4q6J7IiFWoJzzV0Ve8wm7DyHhSLURYDNPt8PVNdLg1bizfQYU7g5YlZjWnTeRd5kKDSc/iayuIbt6/ccDBj0MIjaoxk/go4XFJn0J3yTnaWDj6rONzTPCp7G4neq9JQ+pNhE6yPyMktrRS8Ch59RehQBtNrtAubQNkXSkSv4W+4R03uZHK2l5py9x11XrHdECKefhJu0DbGOQXzLmcmybBvTdJkgsWoroV5xJKsN0K+odav+v86UAz10XJGwno4nko2kJfZRAWSAKGWY6yw/B46R9oZjGmo4vdlimICUdaLNFReJb0fSZapUm9e50ptPFTN321gGWrXa/38xzSnBJs8+a2eP5R+KULEyqdSAJlZLOznoCvKBxaJXOxKKRJetfBTIzwF+RdMeNJtGucLvoBPmcqd617b0lJayIee57AZV718ruOZo2/tO0RwsVr/HRSa9/ilOCssPcpWNLk4VIiLRwC1iskVTrOHy2LiSUk8+ka8OfHaSwlZWgTXGpakmn0Q0dxTp3DCPaoeOSLJmkRazEJmmF7paiZzw897L1ljZXaNbr87iiKLuNhsbfzsemKSztxtED5E4wEqhnzw9sGN9D/3P/SiHpwcwZ7VKBr8al9WtGqj6inTCY8TQKpImdK6MZH7qC//N3CuNESkQ6dTrkCA41YMNo4/vK0rS+OU3WuDffbNZ0zjNxj3sWTTsbOIV8Xfi6bF5OVMC0LsRDEvS7ryhq8ZLEf8LY/g2SgKAcctFKl12b1WcsH1/Ta2W6AFbqNtJwC1ewZEx98C8yQgusAW0NvUSdVujYK64LD9iyQWxMVGWVNS5n3bP++kfX5EmTeR6CEkSF9wBLrnyqFTCMJ6E0urhTIhK+jIYX5WrWLGrrX/GqKKK8wzxyMnkiO10r6t/IrnJQj2utZgjyXnaSTJu+2C5Vhq7SwnnY2OBgla7rHLHzCIYZ3VPK6Rb5OjU5pZ3MOGSVN2Q8cbUtAIwG0CtdGOYbF2aIpFnyGjAqyM9cqrKUMb65g2K34UUDAdY1ljBv1ckNdhIKSDC1oH1O6CgQ4STjJbYlwiwMteRSeu8CIK2/fPsCb7BkN4dKhOYnQDCGi6/4o274GNTdqjVgiypwkOuxY+Y09hkVmW2Axva4JzzcQfrqLOYSEW1hQ5uXo7EREzAgfOZAcpccVWb65oQPYVnucUVeh9/+fAYtOGs4sJX9HPsmt7cnvF4dj+1Zx4TQFUZSN8y3UvCOuRB4ekmrpoGWB6mW87NdzQ3VDjQY18As4rKOQtUTwPZOKo8nLQCPaMPWuWVVqylRYWPNiWbeEDIxzNTXkk4uTgJWliV0YulWGpTlpmPlsy3wEYJl4pD0JNRfrCRGZXqsuH2iyuts8rB+EubY+dahlUQqD18j2h8KWPnDroakNp1cYSysC6A1ZatMnjGdjcCDNegyNt/PVb9FDvaY9YBHGA+/s71SMVqtM5vZF6/teL9NaQFatjyLjs/bq5ooKc+KGVUHYJGa9hEhRnK24lWCJlErbtDSgSqrLVzVXEEn/ua6F2p2BtAQPGJYMMc/Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6740059-b27b-4df8-87fe-08db6b8a3054 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:15:46.4782 (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: INk3Yqdjwe8TeBIrbHpHVOh1Em+0zcJbuD2xgRQrgVFYJOsE7sqzgFHjEp3f0sEACcB9+AMrcVPn8B+Mp9aYZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8733 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Mon Jun 12 21:14:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277602 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 8FD31C8C1 for ; Mon, 12 Jun 2023 21:17:50 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2079.outbound.protection.outlook.com [40.107.244.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41BA9423C for ; Mon, 12 Jun 2023 14:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B3i+bBMiigjjOw78WiajfTqYMuUwmFITXcPF7pufwftaHylGkaJPQf17z72DDmOuTKD1eYUn5+FGmz/KwvOqNGaNpchIew0Wb83XebOB9BBBVNZWuN/Gw5JF1KO0pn3W4sdDVRpbRiFhU/CeHpmjT/jZ36/0UqFkvJ1vwS0Q6jjTEKmYb/4zXmC3zCfL3G5tqvEQVsCfxqpnH0sE0oOz9lmCpnShRJT4Fsfgtd684igsyUsGvrFBBLrHAos54WJ75yTWRRxVwa1sNBYGrMWPP2ocBFtdLcajjnZYHDLmohP6YfsNz83Yuo5X+sBIgIN+J/ijrXjcGRkJHcGwqBNL1A== 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=boXwxr35ZnW42dvcysS/GCarnpxMcc8wKvTFXRvnoHk=; b=R+6fXEaNcThtaG+ORxW+aSOvY1zkiP6tYot+4OZ2gX0dJ4PmIOMb6NHunCgPNVZgOekanwHc5SkGlh5Sz6BkIFu2RLlmTjIKbKm5QqyruGBNFeJK8e6rWscp8CbkHrUQofe8/rLls3SWqJoUYbY8kl8tzT7cTd1qH8TXwufy6zDAQeNJghqbrbGgeAkIC3epOmVhzEMUfdXV6zAwgZp488xBoYTwqpHsGXFTZuG/pe1uAjYOUrqmOW8QaFgHaq9r8vt01RYZhEkJfjDlAVX9DvKxkdKtD/XAe+bDQoCJTQcmnwzXp32Qr15qM+NWiUJxQGJfYowV+rQFDlCHs8L6/Q== 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=boXwxr35ZnW42dvcysS/GCarnpxMcc8wKvTFXRvnoHk=; b=uBYGYzmrIxIqZ5022k1/kEoY0S/RA0F2FHvJ4YQ8PtzN1NGIYj3oyGe4B7kq8lkdJLbQzhxCrcj1ja0xAjS0dKn7xyWQhp1XaVO7w/Y7SNOiw3GtrFCiRglQvqEIbO/2CtAyVsTzDp0lZ8hSL+ey4uGrjNt8hySXmilPlue3PC/bOdfJ02OaGZtWS+I1raW/tsQRCHLh+Szueu74OHOaWRX9BtATab0ef7XqhroXcM4bzVaUuS01SuANijJwJIDpmptvq0JwpLgblGnJrkGAF4NS+ggo/wjtWXyRgaUaZ25LXYojvH2OkJRF3LqZs96SAtN6auf/jZ8DAn+SpIQfIA== 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 MW6PR12MB8733.namprd12.prod.outlook.com (2603:10b6:303:24c::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Mon, 12 Jun 2023 21:16:00 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:00 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Shuah Khan , Maciek Machnikowski Subject: [PATCH v3 4/9] testptp: Add support for testing ptp_clock_info .adjphase callback Date: Mon, 12 Jun 2023 14:14:55 -0700 Message-Id: <20230612211500.309075-5-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR04CA0035.namprd04.prod.outlook.com (2603:10b6:a03:40::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_|MW6PR12MB8733:EE_ X-MS-Office365-Filtering-Correlation-Id: 67375a42-cc10-4989-58c3-08db6b8a3466 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Kcqp/4PC3vx+CdPADnizwme90RfrIDy7ni9p7BradOg73srcgTXRzEERBSaqnMlfKGUZY9jO4MTVt6epaY2+XFhsSQ50x6AHj4Zj4mSah3jAY92vvRRHlxss9FIQhWAhfkOqpfvLb8THV9W0VEu2U6H8+rFyZof1Dgicpt860tHaQ0jsf4qhCrK48uOWJyHdtCiHNCNcZ+Z0Qyv6tZOsPNDIFwxH62sXvVWVY3K5PDyzHl4PqGynVHl9jpNxp9tAp37FPMxAWC5ar8luRTu1gs6YviuyM9wd13gVg09Qae6YA3g2iFVwlJGDNraV2edgIua7pDJ+btBCEkBJSNo7cpMFCyafF+oZhX72xAfjDiAHPEl6cJNaUjxhyfRQi5Va1PXt04lzlw/eMJ5FAPBIv++31lplCUgAjClycShoj3GOBb4+ESAG90O8IIhbpCFqXj+4UsqO1E7a9R4AvpHZW2YP3qkwuu+KJ/FEVOfXJRwduCQAeSZoU03PAluCAjlyPWXxq4x6cgjg4b8v4OuaTfmx+sMn3qso6P9b72r0xI0wA/HgYeqiZ8yQKAiaWMk5S9A9egAM/+c6+bZJc8W98i0fkRIVtcwyQpiHg8kK30= 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)(366004)(39860400002)(396003)(346002)(136003)(376002)(451199021)(6916009)(4326008)(66946007)(66476007)(66556008)(36756003)(186003)(478600001)(54906003)(2616005)(2906002)(8676002)(316002)(41300700001)(86362001)(6486002)(6666004)(6506007)(1076003)(8936002)(83380400001)(5660300002)(26005)(38100700002)(6512007)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4HJwMmtd3gk4oAyGVnz1SxT5mxgnFXLBWv2kNBqoqlbQpnhWV0QVpmm5rbc80xOStPQ6AMIzqEqDIW/LJ/vy7lWzBNEVD+hsmuksqq7UmZff+uKsBlulXtmFrtVExXJF46KxhrMGGPamnCZVHBD3a+EYPRn6vl7d4tLriSSvjijdV8vFirTVQo8TWysICECTt7kuFEB7K1rJZz5VZWrKDGahlzerW3P0sxnXuj6Zhtquy4tMnUVDaNWguGZKh0X1PLRgPLRhRJKPlQLmKDQ3G4PVUSPZkzMf3/XfsitZNCseCxJowFqJsEuCh1f8rSjym5NT+loQRp3enyMt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vr43MYZyQAUP2KmxxHNao6DrJxJEOzs9TwJu+jewJwzupoRi6CVSLpr0xJADtXNxN7zJm5ZmUAso1a4PKYkG471FZOADoXkmKq6L+UHlHQ3ajYeR1LhfEuqVmhreW8J9XU9dkkgzOSnBwJVN5jeC0lSrr2x0O6h6dkAGU1Uw92HmK1w66bHjjkDBBcMxbcYupCK+Uq3DOdV87YsIIeTtw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 67375a42-cc10-4989-58c3-08db6b8a3466 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:15:53.3197 (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: fQW7kAdQ9LsH1aAyip9oTFexAtJde1w6xCwRD9BlPJfNV6ELiX3u+0KNoM5XAQpkvvuL1ToMaZa+Ice6QW3/GA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8733 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 Mon Jun 12 21:14:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277596 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 1D534C8C1 for ; Mon, 12 Jun 2023 21:16:24 +0000 (UTC) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED30F4EC1 for ; Mon, 12 Jun 2023 14:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jwJQH9NPaTx8bkZyFYLCeHbjw4EHjbJlU6AjbAP59DjQu1wRssNOTtaKVFVRp44zxJn3nb45HoktWAeMsC2vJi/srM13aRWEjEwNYI2XekBMOXW0ahzOxKJNPtSqYbQBkxonX58cZCUXLmy13yVq7lBxkbJ30OQ9VqGoA+WYtBdLy1tRdfPhxapIi9aIr/DwBiVB5XAlKwPRV3fWyW3qMkSABGWenWAPQdtIjSwGzWCcMk6qsn59y/KzZ+cvW+TJGuHaQmjc6pzYz1J0sO2RKi4DeuV+haVvPOgtwFaN7+0o3uS/P2fHracYfFWHj5PAcKBtaMElzR/ulSEjcA6ujw== 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=7HbNzwUZZkiJJ+8wtBIAoSRv1QC701ryCKWwQa8JQEE=; b=WWSFKN212SFFJjt2FOMOFDCAozFBZZ9zmhNO8poZr5Aqd0k1UpHtxz77kni8miXUuZHiDI5Lv1nu66IGteIdz3gnD8glW4+uyLwL5YcGnb9PN68AoIBPR/iqzmKN6CqefXPnYEYlHiaD0ra1+FnREiuj3KV+i39ah2u+hrmTgHEdsMAR1mUpKTpTC+bQmSL5U4HrCHDz58bnqlFOEOBBbwEEuMT2nVsHHz4v7JtrGyP7Eoe7QOAC6AS/zaN8A2EEoLD0KuFu8BDsrM9zCZFFGB0NTwuL5TWlqPBiflo3tSZKgonnP4rw56LxgZP6vtYpEqRq2apSlnY1X55zXq/oag== 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=7HbNzwUZZkiJJ+8wtBIAoSRv1QC701ryCKWwQa8JQEE=; b=gs33he5IPtKUvVFjY13v6sgz5FqTvPFgDMcATeG7CQwCcsctFrfvg0+U5kVOPvJ75fccjgDmV8SYEBms/Q8fi5xnVyYUirvEyko4dqsib9DU1H0kI80R5ic2kIdkUv6cmvr/+u6f7H9jGNNvPbtXZU9Df+ANzpirFBNo+hNc4vo9GH3fsxAgeNgPnp14pzThpZumaMvazrqdeFf9I5bhVU+6sQV+LlSS3+AANcGxDr2hZOgTlbqPmYIQ7b+GSYR+rYqQisIjXZAmIkDt2OxP19TIohe2tbjAltE9gsI8CtMNmivI0BE7Xfe3bElkmYD7XqteEECwky60pOFyv4+rig== 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 CY8PR12MB8316.namprd12.prod.outlook.com (2603:10b6:930:7a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.44; Mon, 12 Jun 2023 21:16:01 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:00 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Shuah Khan , Maciek Machnikowski Subject: [PATCH v3 5/9] ptp: Add .getmaxphase callback to ptp_clock_info Date: Mon, 12 Jun 2023 14:14:56 -0700 Message-Id: <20230612211500.309075-6-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BY5PR17CA0004.namprd17.prod.outlook.com (2603:10b6:a03:1b8::17) 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_|CY8PR12MB8316:EE_ X-MS-Office365-Filtering-Correlation-Id: 00300aee-2fba-482c-9fa8-08db6b8a3744 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: C228oZ7r942PDBVwMxLTg3WyCxlLKoKAol8HOR/BaqXSsXoHz6ItWd0x90/wcfi3/CAYA7MU6f6Ze9IECaFVxnRUH/6E7V3gLORmRLE9YI2OfrSN3qBQ7dCk+0XlWCvS4RB2oK5xMiWVQZEWYbA3UJdg23jiX8uKQHTzJQq8pkGdKrUDJDQjNdv74mTDGyc3b/xfVk+r+WRQEIZaWbRBXcpRstm1cTiRYeHAYSGN1eej9JKOSs8Bmpc5p3SycZR3Kue8lR/X7BeRrNFiUjP2/nduD9JUji8mcEGDgjR8bC9MlufWxbjanhGoIFoG3gZzBwMXTQw0QoK+yOvJ4+ZbNbHhHvDRyUjSBbK1xYq1Q4Z8REtpP8u8arg8Gl0Jl2qiqDdhT79sNLwly9OQHu9YKQHPmNuANj5pkybB6Zm8VuRpcfa+9zZMTvjSGFl+GkuOXP7Sdp8+XTbOAVzNx+V46qkkW/Cw1UGO0rwzXB6WXmI0TTi5MeIVoHaWlOxE7Y/TBk+gdA7G0NEjg41BMiZyat5k+646JJtcWwmEtl8uDcMXg1PLLRkkgxzqzN++IYwSjv0Ns1Del7xHfwX26zXZc5NDn5xZ9VcRQ9qII0GfXekY0fpV0FAGlTKzS0Xf21+8 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)(136003)(396003)(366004)(376002)(39860400002)(346002)(451199021)(6486002)(6666004)(36756003)(83380400001)(38100700002)(2616005)(86362001)(6506007)(6512007)(1076003)(26005)(186003)(6916009)(2906002)(5660300002)(54906003)(8676002)(8936002)(316002)(41300700001)(4326008)(66946007)(66556008)(66476007)(478600001)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GfpJwoxAz0dFzcuU4hgh1kRV6kj0r1C474fBlIllbd3SwT/6o3qt+sUdgIMKTW+e9MEumy95oGQS4CLf44L9CH4jeRuSOWCf0vU+BkR3buoP6ilpPW1iTkUjwwuLJvkkcdmRR5Wr0xTsmMPK1u5LXmhhXEfCDPH43O7PLjIrNBFiLTIqmJdCQ9YmMF7VuIOuytT57kZEVm1nLgphtdHKQtiUBT0W6rWw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EcL7oTa4Tlr+hLl1UOz/zo7EpVnrlyDZaXgl9uZqF20XyBkdnURaLeJxjHK+m1Ce6tpHnCoZjEYM0WlDqawsq8DZAFxFKowFc2WixAxK8r9dconjqUOR6m13307bhe4O0byuY7Y1U6hiS2wBcnbio7NJJ4g2IvBMBG+3M31H0cNpFzu4sRDfNDsxqPEUpRX/0I5hgn9PGCJt/gDgksh7OlhrDEtqAvrzRNiafF5j3FuY4WCEpuPfSPTx57X8KL12R+zQY+48GULKaSN/QlYr5KyRzfwTFWgeyv/g0PKljEwWMoE+DCx73vEPDybznNJ2IOdVKy8oiw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 00300aee-2fba-482c-9fa8-08db6b8a3744 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:15:58.1601 (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: sOP+ZAugpFfN1r/HDQrJfMeQ+S/fUWWbEXsvpt2ByHrkS5PCcFe3eYE6G2q0di1FOFTZSM2rH40Hogz/Yl1R7Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8316 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 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 Mon Jun 12 21:14:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277597 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 ADB7EC8C1 for ; Mon, 12 Jun 2023 21:16:24 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A3E4EC2 for ; Mon, 12 Jun 2023 14:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gWBtKc+0FK68Hqg7KUtmdEIYZNN7f0L4ciZMjplUlvH8iJ2f4waLqfTugqYtVvhcjpsJ1w011MCK+BE9rpt23uBivsPRgbtIne3dewPbesNNdHUmNcYzv91DQCyzDTlfzBmdtPlszA45TSpc8RBOO4nIDGMusGJKwFRufOv6xvF4qnyxfUJ2oPZLsKMzOKRIjJwnuI7jruuDcNrq1zM7H9jwgtJ3stuCXJsM9T8q+CL+ebZjgKLagUhJE3lwr1Jw9nJEUVkKwRjLMKJYXoirdQBQ72yb5hAngjCvoXjOlH58kcaWX35xSB/GKSyORtalG7ucJBilUtebDwkzucCg1g== 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=KpPFD7TiIrwKK2gu8iRaUxgs28ouw1CuUUH5mmbGia4=; b=MT2kZdP1w9KMHOLmClBz/YjoQDBdmM34YqiVW//tmaOD9G/0zgdvHulpmJtjdICUZlmTmtZ50zfBznczsnlCYxA3M57XqyyCXHnohQjIzBuKWHpmQZy4v0iMIUMaGwopLaks5lEHNBOlIptkqRaNi5IeqOOO56CZ3u5hvRPom7MahUcNtWFFURF6ekefJGMItURSCMd0XUZERXBPqHe7rcSaeD2Q7HKgOyHJ3ZxiriEinh700k/K/DmIR19NM/c7cttARNVD8W/k+NAhOWOY22yF4PZWJy1sSZHfqRP6+fU5zxREEBzNLWK7qqJfOAFWqi1Sk8jwodTeJ69Tz6b2+g== 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=KpPFD7TiIrwKK2gu8iRaUxgs28ouw1CuUUH5mmbGia4=; b=PjIoLx33V70xAsjTU1RE/Je0k+b5tyB0CyLyb57q7swt1gJbhGb2nnmLJV5l8pu/IpNbDFXdHRWae1Cqw9o5z4L6Lv+2yqg6Ov2UehvsEUe6aTOjx2f/enA1lAuT2zrYzkegetUP38a9q5+atfwVy2ftYG7vzDeIR/e5AuosRPeP4ZZeB88yblMJkB5oYOXfr+m26usDk+O84DY1TrLPqZfooY8n5dn1A77oZgqqoWbJd+Ot1VdiD9tHPcS23sn5wS2TvpeUDm4+06jAr3potugetUAJbay9/hueGnQ0UW1QcfYMUwWBY/9S+3hh0m5e7uJlHntaU08nNCt9+4+HCA== 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 CO6PR12MB5441.namprd12.prod.outlook.com (2603:10b6:303:13b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 21:16:02 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:01 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Saeed Mahameed Subject: [PATCH v3 6/9] net/mlx5: Add .getmaxphase ptp_clock_info callback Date: Mon, 12 Jun 2023 14:14:57 -0700 Message-Id: <20230612211500.309075-7-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR02CA0052.namprd02.prod.outlook.com (2603:10b6:a03:54::29) 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_|CO6PR12MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: e6538b21-7955-43e8-de13-08db6b8a3974 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8pGwc/r1OJmlkQ9Ot2odmzRpTRfku4hfnRk0OfxbTAYWIb7tn0+PEmabBfaRXijwP921ZQoNEmof4t5aUTQnLqy8OvfGvVWXiWDBwZP30y+pi28HlMG0+MAc5kHVs5/1Wix9WRsMCb3CnxNS48VgkGrdaEFbV+sxLNRGkRL/Isdj0SvBAQ/SlcU2ig/lYj9c/OECnOgDNNzMMCDUM1ZGOujyYZgMPS4Smtt+YhIevWPGzSWVVDxAaMTnpUYZ1O+Wmy/6SZ4ZRxK48PU649X7JO7Z7esaA6fbKB3Hse5HFmVcNk1MU2F3CeFAj3oyy8jTd9BT4UIrmwrUyndP1OIEL2uJFDYAh40OfdCbmyR8ylEpjJ5sFDieZp5+3v2NuGJV8B3jPoq0+zBox85kDlEHucipnKdD9z4g5L7E52UXIDocrd0Ulp6zj/TJs/a/mWeMyqf67GOUXrrc8YJOA/rqHx6AhugcIq+z3v9b4qKLK3GzJY1gcEiydlO7oTqQtqGH+TdOH4Ro6h4Zc1PARvdz0VAMkQcazc50SRXXNY0pFVoq68JeF1ZcAlR2DLg+AWRGlpdTcqhSj4G47zzbv2jxGJ4FeA/jBAaN6xzLYGaR7T8= 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)(366004)(39860400002)(396003)(376002)(136003)(451199021)(36756003)(2906002)(86362001)(5660300002)(186003)(83380400001)(6666004)(6512007)(107886003)(1076003)(6506007)(26005)(6486002)(54906003)(66946007)(66556008)(66476007)(4326008)(2616005)(316002)(38100700002)(6916009)(478600001)(8936002)(8676002)(41300700001)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jiiaEPVbTc8CsEexgAJ9/9/uFGzM4Na4Q6Vv/heiN6CxbXZqFflz/sjcgwMqg/HZmoHBgXZTcqfSxdgTYFRl19+wNOnmxuPWLDR708Mk85vEadoOLmKefZtlMqQWsTucbhVBSZ4/LbwDY7/38faxi0mziqS2Phi/lOxXmC1oAHngMdnohkEphVa2+UOSwescpS85vFogcw5WiBcKSXFmd6TyRk7KBg3qkEi4912Izpc2qU1ao1fYhAhPEoK3gKVklAfl1rD09mg6xy8ieyesK9iDifc/pm0HDTQk26J4xQcqjxx7UAd+97dUSOZVxq2tAm1ErAb5zOE2cEXf65DqsWoqHZlqwpTvlM+Tz88bmjb2bGw8VNzjyLHU+p9WMh2ix8nrmEz4M/s906ng6GLZRnwUTb/jRtsaYyf7M2e9ZpURIWGDq5X205421Y1tPjvXUN7bmlyZcoFEAFIhmDIjBIjsYuxcnYjtbRugm8IRa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FcWWEpa+M5TthXmTLgTU6ICrLzqgaUIEIvAkonjw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6538b21-7955-43e8-de13-08db6b8a3974 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:16:01.8420 (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: Zik1uUt46jUcG9Zh+X7lhu3c6Y9ieNug8XdA9yamTMAi/CHNFwlUrvHldJDHpZxEh/h16ywQ/+SkqcT3zFFjSQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5441 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 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 Mon Jun 12 21:14:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277599 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 9EC35C8C1 for ; Mon, 12 Jun 2023 21:16:57 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6650B83E3 for ; Mon, 12 Jun 2023 14:16:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mX5nG8CcQu1236bgYBlJhf1D5REpMUTsRszC6EoyuK5PymO6CNOYvT5FNDBBswEc/MidIaVwzTMlVOOzwPLC2ZDDfrwZPACqD1iexzW/rVLiGmwjEYoRe8SZMll9VMN80B9quBd9/Z+ico4Z6TcZFy7isN9yVfQZwiVzHT44jRxBu4oDOuwAzfPGyUxukUQKWJ2nLM19utOH8COWEI48CdHFZFHOCScj5jFl2NDtcIG44PE+Db0GiRYj6vtp11LZVApZhqAydzaZIbNN4zIoakY5xeYM1JAptxlZ9qIABygQjDAQa6pozZmdvuDW3rMokjKFhiPV8csfwnEGjbdwcA== 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=OAlMhxjK3o1Oa8Uw2BkEhaakSrNFPvbihuYAYiLEtyg=; b=P0Bgc91JhBslE7q+rCP8gpNyR5O6j7bQAviaLqfWznkNEHPcRO/J0tzEM427Nsa+9c6bDBA5Q5UOI8nFKsuq7I/WxNvvD/07jhxhxCztLJLooCWwBtvPDn9yj3VSuyR7Ug0t8hyI8NwkZBU+xcxhhnkCtyBL8qnfOIFHBzgUKXYz10GBasNwON28r6Bs3ZYhARDMXUqQw0Ow0aREn0Nh48wKfKKgazvHdTIL8QBx/RNat+Q95nhGYTxRDqi7L1JZgCWhD1Mey10IY95pbvfJTvaJTySyfT045qZMcYOfTA63xHnqhVaUcF9+hQvA6hhT5z3R1ek+czveEN/AgOusiw== 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=OAlMhxjK3o1Oa8Uw2BkEhaakSrNFPvbihuYAYiLEtyg=; b=udiIHtMORFxaHLgTqbxM2XgadfRQMIbq0pAUL1peacgERVAidDxGhCedQ98ko4FpuOx6jXG/0zUhv0mtHC04ApyOT1SWGMYUZgXrp3+JDr1cOdmn8OuWV04Yus9sZC2CBPkIw4sQFmNSMEKvW+hcGVcznB6waMTjknpId9dZXuWsqtE1OfjsOoBhqi6G41J4mNoJF64nPa5ooc6kFMeg+lfq/NowWDHugw8K6i4KwBspKIhJi8mR3ESXfPE0DlymLSU2KCaa6DbKZrvDm4uBxpE2Cx/ux3VSm2YQNaNQQ9lZ6Z5JBtPERYP7DJRIumCuSnFxu5oyvFa/x7IO7WrdMw== 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 CO6PR12MB5441.namprd12.prod.outlook.com (2603:10b6:303:13b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 21:16:05 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:05 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Vincent Cheng Subject: [PATCH v3 7/9] ptp: ptp_clockmatrix: Add .getmaxphase ptp_clock_info callback Date: Mon, 12 Jun 2023 14:14:58 -0700 Message-Id: <20230612211500.309075-8-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: BYAPR04CA0012.namprd04.prod.outlook.com (2603:10b6:a03:40::25) 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_|CO6PR12MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f854348-ae69-47fc-e326-08db6b8a3b8a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NUeXsZas/mvmoRZVym+RxCFe2lJfFdTxUiL6aKK6sF3Y41Qjz0cSRZfnlSpE8bNF/unEpSM3FaD+eKpIdy9omcmXOjefRR7uYObmQo9ZpsiKzbeT8tlsJ9SlkuTHQBl78u2QHQ5LW1ZNpBlJqU0g1JpLmWS2HcShPgW5k5ly5FOkn7QqctY2+Ng9Ha/r/j5a3Q+NMOBrKk5fq6jXxmfLIabdUpr1av5IRO28J9LA0dNKrYV6BDobRc1clT6A2TZrZQ4O24/7X4KMgwpL38TCmhoJv6CeH4ARVGLZhBl0vwIMfGIUiSlrSJW1GHx/NjgfsAQmc8OcoZuwIloCjS2QOPvMGuA68Tzq0jXTfYCSO9Q3KNnRqI3nVR5Z9TX6j3o9sajBf5/EmsVlkeQUs+3c9kwjpDd0szAcgxM5KcD1VW9t1k4CXQApjZYQq1nRdNiN1sv/QXYI4huqUZzCU3M/v0RMyG8iwXpVtP4M6Cto8UpPUiyTUMpQn3aBrzdn/xKWhEEpA8orvdb8ewFNvyShqYnTz71S5vlYfCvoma7AHZEcz9bWPhVLtP560G3B1Cgho+Uh8jdFMOc3DM2yRQZ1TlvjKkStqDRAcuCEc8YZqXFG1rufUPJI4PAIPVaAn3WV1YVIMId9CNoPzPYMch+pFw== 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)(366004)(39860400002)(396003)(376002)(136003)(451199021)(36756003)(2906002)(86362001)(5660300002)(966005)(186003)(83380400001)(6666004)(6512007)(1076003)(6506007)(26005)(6486002)(54906003)(66946007)(66556008)(66476007)(4326008)(2616005)(316002)(38100700002)(6916009)(478600001)(8936002)(8676002)(41300700001)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Py9SS/o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maOyJErvQBKRSEyRoHvhgt+usvqC80EvCALC1GJ+3vK1CXJo9ohGXOmTp2t/kB9GegOB0372kjKy3rD/yj0/NvpirG+Emjvd8ssEwTeBj8kXgbWs3Gd5qEqzRjNXMdGf1PiexT8hq57UKC+KusNlIZVrP79S/z2oMTlARN+MogjhB69nrOsqIt+Yo4CphCYM8XvWaG9FzWEh7Z+8ywRR1L1cupu1IgESpun7foAHoPlTH0XOagCmdxCi2kcMznOg3s0KJ1rhCvwezcSxG6rjqV/2BNDTIQB2WWrn5K5YUnVYrxe4OF3kXFOAh9/xKb4TqMnK+NXKjMzurZWgM0BS5z4Hte6+S4+nOF+TQXsoNHDl3GE+VVkzN8akA+knSNBeRQVSYPrVAf+dMKWk7uBj8nUHNTb/dcxK99hLnpDdg0asuIVF6i9MqhLYcdHul5ZR8nz0EGzGlHA0ne1iOWUbtpkcDBuCodiY7oKqOhyDtjCTPb1p+N13jiHiGjUJPQJZt/exDchtN5c/jqUwblbouo2JA5RzOR8Q== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f854348-ae69-47fc-e326-08db6b8a3b8a X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:16:05.3341 (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: hw3kvwWwz/JWqALqa2DzY3LHb4FpiiuepnPPQSFRT6RPzViwNiCdTJLXtp1DmYOhp2yz6EFYG683BMrhMe+W8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5441 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 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. Depend on ptp_clock_adjtime for handling out-of-range offsets. ptp_clock_adjtime returns -ERANGE instead of clamping out-of-range offsets. Cc: Richard Cochran Cc: Vincent Cheng Signed-off-by: Rahul Rameshbabu --- Notes: Changes: v3->v2: * Add information about returning -ERANGE instead of clamping out-of-range offsets. Link: https://lore.kernel.org/netdev/13b7315446390d3a78d8f508937354f12778b68e.camel@redhat.com/ 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 Mon Jun 12 21:14:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277603 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 B3D4AC8C1 for ; Mon, 12 Jun 2023 21:18:18 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20604.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::604]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E91146BB for ; Mon, 12 Jun 2023 14:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S76IplY+B88HacOi++smVibnzV0Tgv9CIVGphoR4eLYSF21WrvNPLlVRBSI4CpeYG5/KO1Vfy61VKzzxeeSboYDPwVt6zed5YHKjRet7Qm9G0v3tN9wn+3Db+WW+828lGDOfJivUNNPVmXyi38NFg03rwuS0womTyR98YKJ4UDYHchkLqqQJcC/sJaj7PHMyu9maxTTF0RJ9EGr7dt+1YX9WBIUlQwhJLKtgjqmx+lhPXm9mgpNRUNxvBmfFtM3xNoy+t77SVvyPTtmnqHRzoWSf2tYTCS6mrGhJFGLomuByRTYuO3eERWKcEwzWhabvY5J6CfnfDwJ4t6M7WdHavQ== 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=bNCiEoM0WlNI/JCgxPNHkzrynywp9Y5oBNOO/8l1mtM=; b=LTc1/eXiWykE9w285A72gDob9qYroJAoanUwJR9H+ZGqAYwghYUYi8YSWI3UUR8QKU6cpKKZSD1NcLmXFSiQounUpn7nxt8tTYGPY4adgJ2cC4iZ93Rmkb7w1QTR/4bQN6zUxnSXEJUkdNPujoDtlK6rDd75WcQnVOv6JxVZnrP1r9/qkC0pWJfKdtjEa2u+mA8g0+Hiamtb97Z/EW/EbS4WDmhp3y8UsG+Uo1leAuK+3PdWMc/VxRuF3LQ5BYQ0JZt0PW3Kx2Tisw1D22OQBJry0wZeAdz8o6thNCQGqNqZ8A1D3GNmC+gH+rjzbQWhUdAUh6Z3z7HZ0qtELwFF/A== 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=bNCiEoM0WlNI/JCgxPNHkzrynywp9Y5oBNOO/8l1mtM=; b=eYmIReuSd5qK097GENfYI/u/IgKU2kHCkGTsn1joAYKqG3gI7Z2ccQY1/8M2WdeKGo9sEe8MIDgQD5OkMDYCtoQlLpRnlqEv87AqSaPZscg8bYfTl06Qd7dFYCJUgHC0eyz2UCfTL23oIF7UG1NccclcjVC/8+UQ3MdxIxPj1LFng+5UBe/6TqZgzes1j5407cfVnF2oVg34LJ6Dwy7qPkmDOMehIWfOHa9kpnUiihJpkuLl7dtwZcU3NrcNOfUeIQdlvwDyYwRJVTgBdVX+U6vyoQ5vtQhR6q3ST2i+4EUEg7Y9wlNFuW5kXE2a3gIjVoUTH987grQqpErpIruftg== 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 CO6PR12MB5441.namprd12.prod.outlook.com (2603:10b6:303:13b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 21:16:08 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:08 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Min Li Subject: [PATCH v3 8/9] ptp: idt82p33: Add .getmaxphase ptp_clock_info callback Date: Mon, 12 Jun 2023 14:14:59 -0700 Message-Id: <20230612211500.309075-9-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0159.namprd03.prod.outlook.com (2603:10b6:a03:338::14) 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_|CO6PR12MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: c74ac752-aba4-4191-89e6-08db6b8a3d60 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0vS7PqiKBiaeJM9oV/BN4bkB2CTWfiRWYXktPpj+IBA6e22GQjNwfV42XN2yxHr2IIYygm5unZHK12BVNzEhTxgrRxbEfnTNg8ELbMwlTFpYc3X7m9jBykpZs6Lpfhpg5ZVTKkqk7EZMeN2mSBBm2AfK8+Lg3dVbTA9D9zYNeT6zU8Pq/m0RR5w1WfBW/098TqA6pP3wsQmeRnhMZc3EuGfXAO/V1ntWZ/cvjExjLG0nrZ94+d5oAqJRumzO22IeZ4dHP8Z/iLfhrL+aJTnwufH0UXs7NoRODoH8I4dRzmNvOste1B5wzK37ykK8sJtBoDsPfY+hbpYoMCY1TZyriyW0/3TXYfRFg+/AMc5gGJR+IQ9ccfw7ZzIF3NZA08Y87ZmWSk+mhdDKCimLWYKdzgRpflAFndjo5X0qvBx+CMOiMBchkhZ9moPSdwNzhvN+Gb79o39lcBiu9VtYfFkcTfHM7iJSW3gqt6j/3SCXkhT0JHMR4lxJMPIoRxCG+sWW1rgID3LxvgQ3B2j0sFNDb82LeMVyJnup8t94DBSHRCs6Y1zxDwYlxhsDUoDbPFKLsRTenFvK17Og/h347Bea/Z1R4tpvbgEW9j/stYdr3dHHtQW/TnLgbMK9r3p8s1EqV5Ttnwu+Ze9kXIJYHlEo6Q== 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)(366004)(39860400002)(396003)(376002)(136003)(451199021)(36756003)(2906002)(86362001)(5660300002)(966005)(186003)(83380400001)(6666004)(6512007)(1076003)(6506007)(26005)(6486002)(54906003)(66946007)(66556008)(66476007)(4326008)(2616005)(316002)(38100700002)(6916009)(478600001)(8936002)(8676002)(41300700001)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Message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jHDZyETKNXFj4MnmGp1jfir/+HiW5AzXwjOaNX3ARdbpurvX8o1payA13Vr1rIkmb19jXqKAPnboi0NGm5MjqFGJKj6ZlXdL6Fw6nCjDxuA1OyP/79cZQfuhcyHPTv7YVXNqb6m1w/FvOEA30UT56tBF1XhtoMgLLGvKn3DSg6uk6B6dNlW8rRdg0qKVCrO5goG4Rl9CX4OQfp2wBBoWmWyqAZOgpQizZNgKgUgfW614VYzhgj5HI8l4+Sb/1rqv5+e+7/Ag8DzKFLvirBrFWbkFayt0uNFi+ABsAe80Xk5g3UwokThkD/LnSWVhuL5VV84BZVulurhpDetw0fWf8B8GCx/40fVhuIaGtUcKTLDv43alkubqhx0lvNxCRQTL/osFkWQkFkdHFz/ocGHwwutfggm6ApRt2Wrz7RkXinlimP76cE0qb0elJ3pgKbPAViEMHSa21EEWRzvZWAdsKzHkXx+cxETJJXL08vxwBusd0m/kBos1OASyEc8dnOoRx5rkeM3uwkjp4Y043L6cQYaRu7xPiaiw== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: c74ac752-aba4-4191-89e6-08db6b8a3d60 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:16:08.4043 (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: nGlpIVzuoI4ZFVBeGd9ZBsdxXoT+vXW26UGwhhFeqWJwzoqxmy7qWwAhdYc11z47QzU/y5gdPpFgsvNx6hJH0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5441 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, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE 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. Refactor the negation of the offset stored in the register to be after the boundary check of the offset value rather than before. Boundary check based on the intended value rather than its device-specific representation. Depend on ptp_clock_adjtime for handling out-of-range offsets. ptp_clock_adjtime returns -ERANGE instead of clamping out-of-range offsets. Cc: Richard Cochran Cc: Min Li Signed-off-by: Rahul Rameshbabu --- Notes: Changes: v3->v2: * Add information about returning -ERANGE instead of clamping out-of-range offsets. Link: https://lore.kernel.org/netdev/13b7315446390d3a78d8f508937354f12778b68e.camel@redhat.com/ 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 Mon Jun 12 21:15:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Rameshbabu X-Patchwork-Id: 13277601 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 D7780C8C1 for ; Mon, 12 Jun 2023 21:17:28 +0000 (UTC) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2045.outbound.protection.outlook.com [40.107.94.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586E519A8 for ; Mon, 12 Jun 2023 14:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JS8oDFlfGrnPETkZucq2QeFdltRNUe1JH43jz6xpGGcL+KJj3o+b5Rx8rB0UDJZKQ+Omq2VNfQFKUHbqPNC1hoIn9be93GX4Eo6+HBiiz/BdGuoX6u2HX8tFItpZNzzXMsqJDLN4WAma/lmUOwOIafN2wO7Vg8GrdRksI/t5uAyVV86G5P9/kZPZHCAvK5liPcT8yUWxV3JIac1yaUgrzH/IWD0qgUWFP2lH8SzOs6hAMtYvW1K8xmF/6fiu9MOeVW2UEZhlN8m+yu7AAqKUp2Mq9KIRsz+yufjJHXi/vbe+jFnFIwat6o2n5rrNwbyJBrgUTb7AkE0263VCDxpWyQ== 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=PFM1f92U9hdT0xdRvZRhlkBEasPPgOajlyfZvpJoMLU=; b=MGaS5sBok6/lqaNP+SMq14BjTeMlI/a/oAAtKBqXYPo9B7I2Z9X9sZFkDnjShxBnHuZTICL2rWwyalw402xFhkHln1GJrqB6ioEOyEwp+QW/YQSNoK8GaXzxKyQd6Zfd/QezBi+RClPKFTa7uGdiMFphtb+p8yWY0DdLmXPcKm3kZrAQeS3iHl2AH16N6h/pEBk/lvVMlld3h/zGnIrM51SpZl7apTH72ufGtynVg2uvQJoINNz5BHq+NBuaw0EbkvGlmP5oYv2mHgpwKfqQmCWQouLP696DzJhNiDFeraiBaFT03LUX5MICWh8mNOaJX0402M6rMUdKusePmQvlvg== 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=PFM1f92U9hdT0xdRvZRhlkBEasPPgOajlyfZvpJoMLU=; b=O4ckKA6l9tL2bKKIUCHKxh1qJazmXYosItP3tGD59W3Zyy4r4FPRdHkko9sBIMzTGhdv8j+YrVeghpO5Lv6eaRJ8etCC/n/Op6kc94t2uIl7rbHdrp8bsZTfvRxBvoKa2VDCIcIrrDa3w1GoAH5JS7j3RX/xFclXPgTy2MXrvfeT/M6jUZkfswnwfpehztVdM/ow5Ww+F9b+lawMco6/N9Tmavtp2J+/LNamlOtL/BKv2Jc0qqjVdpETORUfY+Dtze46D5aZF4TLr2ooc0iqmS4vpdhK6Uic7jXkJuICKylkOL4HF+82pf4byjQ1F23Ihfy2yFpiXLH53jQz6iAw/g== 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 CO6PR12MB5441.namprd12.prod.outlook.com (2603:10b6:303:13b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.46; Mon, 12 Jun 2023 21:16:14 +0000 Received: from BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471]) by BYAPR12MB2743.namprd12.prod.outlook.com ([fe80::ecb0:2f8e:c4bf:b471%6]) with mapi id 15.20.6455.030; Mon, 12 Jun 2023 21:16:14 +0000 From: Rahul Rameshbabu To: netdev@vger.kernel.org Cc: Gal Pressman , Saeed Mahameed , Tariq Toukan , Jakub Kicinski , Richard Cochran , Jacob Keller , Paolo Abeni , "David S. Miller" , Rahul Rameshbabu , Jonathan Lemon , Vadim Fedorenko Subject: [PATCH v3 9/9] ptp: ocp: Add .getmaxphase ptp_clock_info callback Date: Mon, 12 Jun 2023 14:15:00 -0700 Message-Id: <20230612211500.309075-10-rrameshbabu@nvidia.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230612211500.309075-1-rrameshbabu@nvidia.com> References: <20230612211500.309075-1-rrameshbabu@nvidia.com> X-ClientProxiedBy: SJ0PR03CA0275.namprd03.prod.outlook.com (2603:10b6:a03:39e::10) 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_|CO6PR12MB5441:EE_ X-MS-Office365-Filtering-Correlation-Id: 129afd0b-396d-43dc-9bf6-08db6b8a4110 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: awLyTozg4nrKUQAUNBiutFq+AeSijhTGlRGbt+xsJ5Tnyq+mxb2UkoO6AboFaGTBNhoe8lcQ4Ud6/y0Qx53aZLI75gn5VopRju4PrgHpSUJ/eR4PJvTgdfwwSHyWUx3lbpMS3WMOjRsPUZwOt2bKKDvQZFYTaTv26WYPGfDMa2bgXDnhki7prHuvmupvVr+Fcm0tstj4c/n6/Py5zVSGQUhOkLpQifbxFAgprKacYhgB7U6HNoOTW3D8swMy5cCwdHDqIeYOK6161YZ4B9StW1sLXi3rKIrPRz7SS6DsGmyfrZp4c5Cbboh+w3+5R29QWNIor6fsrx+ImmhH2KA43iufswdzE8tk6J9gNXMCjxmi0EiYcKeBPIbkDLb1Gsand0lKH236Up2mS+b6NGVFRt4ptRnAkWCQEKkDTP/FyCL4XyxU4IlwQOPGqPzvJ8ulfJNF1Vem9Y4UW1ViI+suL777U+DS0RhkG+a3Dx7fq0dyC0xSzQsXZeHMtuxSgoRkn1jQK6Zc20PS5jXdhJr6MaLcSi8QVhD/KF0FAqLGnHR2UARPP0ItRtg9x2iF4b110TOIfGZch+wN44UKrAUYPwOeLqdyYhkJK/Gy/sA3mC+0RetXUpy6+urnAeq89q4P 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)(366004)(39860400002)(396003)(376002)(136003)(451199021)(36756003)(2906002)(86362001)(5660300002)(186003)(83380400001)(6666004)(6512007)(1076003)(6506007)(26005)(6486002)(54906003)(66946007)(66556008)(66476007)(4326008)(2616005)(316002)(38100700002)(6916009)(478600001)(8936002)(8676002)(41300700001)(142923001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I1JbeS3tgGKGWr7m/+DJjLdrYbXPnym+a6/GsocR+ee/XvObtsYF6946+ri7mSzhno3Sq2nn6zugQnUywMG0lr4JaWB1a/hsr0l3zO8Hte7lTsBqPvFZhdXKrajRLwRij6OEcGirY47TEKg6isBOu+DGY9w3vt7HQjut9BiL/ZV8jM8tk2AZfGAu5ncFVGiQlu9I5oY1UOWFemNzz10pbNBOCHbtBXPSuUcBm+wDciceDlKWfvj2WNBbU+e2orRgrLPDzTj5qwmqiCKywBgE9xHnfdhqjO6QyJs/fCe1pGhotCKdOwsy3rTAmgGR3PxLlccIZ2GNKBXchRcGVuXLxVnlIi0KUQ/0At6JduL+N9338IS841eCYmlh4UDp61C+w0c9Lt/m2DSs27T6PNzZ22D8U6niMHXI9oABfdf2tUbjbCqpC8dZLRkrPx0cLUbUqlwFLRU4wnj+63ITaE6OsvWUoETzCc7HbOGnLUDetimwo28GIuMlX0DiOIAkFz8qXgL49YpOuwPFGUwYuRkhq2rxKHTBrSvNKPk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S-Exchange-CrossTenant-Network-Message-Id: 129afd0b-396d-43dc-9bf6-08db6b8a4110 X-MS-Exchange-CrossTenant-AuthSource: BYAPR12MB2743.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2023 21:16:14.5548 (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: 25FwI7/GLh6W9y/a/Dphq2nLryRtIK5yvZ+WqbeCKmCZKCXl3s1YZeuGvCM2KB4btXwRn81KDCRLKD2GhtLPRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5441 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 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,