From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A035A42C53; Wed, 7 Jun 2023 20:29:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7AFE0427E9; Wed, 7 Jun 2023 20:29:18 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2051.outbound.protection.outlook.com [40.107.100.51]) by mails.dpdk.org (Postfix) with ESMTP id BAD1441611 for ; Wed, 7 Jun 2023 20:29:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fWOogPvfCGmhTq7c134X10Axhf3JI+FjXgAwZP0j4mbeXsMdcTjL0Lp73qdfx3LBru35djb2spn+xXWY1M0xYiDnZcH+DLuUDkQxpKVKBMsd+w9WOPPaeI34z8WgLhDyXnpwdX4ynEkBvzI1+J1+HhVnpncwtj+OVKjwFo2rKfMbjlpysbJdsDmaYt3bp7LgwJUYaBYEG+I1wMQ06liVpOhFRKcFVWW+D6MURuE0qm2pkd3UNv9LNyS0QT+yaI/qBj06b68/0tv87t61QevFnk/rmqC1If0IlBmC+4IAwvJohbo5RUpnhaf33uNMeRdCT/Jtj82ZZvZZfs+G/PFD0w== 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=KvUx8vBPF9kQkHf14H626Gq+FKa6R+Bw8dlFYOaFy+4=; b=GbAD3d0hOKScCyg7oI180Z83RcJon7ob45/MZ35ywkD+XYnbzebz2M5DhBVxxuQoRFvkHqqF2UsaE+knFjUNEAQIz5oA+Ast8NAuJnt2kXWMIR4nXu1KD6kdmWRwhkzM9pLDD0GrEB236pV3lxVmtlVin2I52x2QDT8eIsBhrs8BVKICOax5aPnC4C0sMZnxGL7I7jjmFoNeuMoAQX604IXJtru2PrJ37Rk4GWVAw3gwarP//WhzU+2SlBDFfa6lnS78MZGhILQmgpqCYZy7N3SRAwL2KA2fozMxvY7OQJyPySxKrjNftHZKf29Xgxft87OLEcrHXirZEmXaOmUSjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KvUx8vBPF9kQkHf14H626Gq+FKa6R+Bw8dlFYOaFy+4=; b=eA5M5DD2U7LnZBpNyQhSc9PoOhEg6FV0dK7810XaCkgQfuQBk3JZ4P+jjc6C5Dt3poobMQf0Fe1WK4nJR2a2iJ8dNdR3Do9hFmbHkR7wV7IsM8rjS7h/L/c3myyIcZxJ68JLg3OzhKLSCE3MmUNKtTsoLSiVn/aI7uT1Faz9i/o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by IA0PR12MB8351.namprd12.prod.outlook.com (2603:10b6:208:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 18:29:14 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::16e3:326c:5c2a:be42]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::16e3:326c:5c2a:be42%3]) with mapi id 15.20.6455.037; Wed, 7 Jun 2023 18:29:14 +0000 Message-ID: <7dcff833-e921-8ee9-b821-25bd6c7cc980@amd.com> Date: Wed, 7 Jun 2023 19:29:07 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Content-Language: en-US To: "Su, Simei" , "thomas@monjalon.net" , "andrew.rybchenko@oktetlabs.ru" , "Rybalchenko, Kirill" , "Zhang, Qi Z" Cc: "dev@dpdk.org" , "Wu, Wenjun1" References: <20230403092248.81551-1-simei.su@intel.com> <20230522132332.102030-1-simei.su@intel.com> From: Ferruh Yigit Subject: Re: [RFC v3 0/3] add frequency adjustment support for PTP timesync In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO0P265CA0015.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:355::6) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|IA0PR12MB8351:EE_ X-MS-Office365-Filtering-Correlation-Id: 911a5746-cd2b-434c-1a09-08db678518b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eAHhhOLFoyDFwoDFk9+X+MUrfrCoQW9XiKjOBUbMcA6yly9F0CU8O+Ebtg+Jl83Vn2S4Ex4VYr7f6jjqBrlMgorfSjmXN1zpnWkxw6tqfK+68Cb19HROkiHjaUbviQ0rXA2WLccFXAp9CWyKMCnTzg7wWcSZL7YsogKWPJmlbHR0gFc0qYlcn19u7MmOMLmUDCR7682tsqlgK/yx+pDHJNsjikrz+rvJ8X2HPtR4XyieY4jkzZgBp3Yp9JmzmS8z/juoLrisxW2NctVr+KTeiAzjfw6hfKz6rKwusTFxKfFFhkekx1deRuOdEtRw6b2FPJMlmNLz+qdwOKlYmNEN+2ECFUuQRNqhbm0BpMyGkXPupBP98RAaAVQvyGNTs8z0pczAhDMTGevE5R4H+Ee+TWQEsrW/QseZ20x5dMnG9Mvxd4ESwGW0A6reUmNtR0XJiSakHu88eqsxn1GYKPggJEPtXSCObsLj1h9EEV89KxxJ0XDfrK2VOqOyKKGQd5siAtwtMNH98sulvvtcvxc6jzYeqwQRW1QViaCTGVQb6A7X4XtO4p4TkFEb8CAPYm44FFBGf05Fb8VRZDZMcTj7D0qzhrIQMR2IZeMSQ4awy/9UqGz5h7rRyTTBv/fb9Uxfvld3AZAUahdK3N9mJ2NfGQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(366004)(136003)(346002)(376002)(396003)(39860400002)(451199021)(54906003)(110136005)(478600001)(5660300002)(8936002)(8676002)(44832011)(4326008)(2906002)(31696002)(36756003)(86362001)(66476007)(66556008)(66946007)(316002)(6506007)(38100700002)(41300700001)(2616005)(53546011)(6512007)(26005)(186003)(83380400001)(6486002)(6666004)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QWZnK2pMYXNIYmpQeEY1RXVmZlVXMnhRV1RSb1hxck9EM2JIVlRPUXBjR21u?= =?utf-8?B?TnhsWWNaRVo4NkpOMWk3anFkYVFUVW4xRUkrcXRhV25td3FOT1ludTkveE8r?= =?utf-8?B?VkdTUkVFMHV1M0hGTHNSZDJIVGt6Zkt5K3I2Rkl5OEVBQ21SdThXNlUyWHJr?= =?utf-8?B?Q0FFMzlFczFhTmRuNDE2cFFqam5oQzJlUFZncVdDdVdFNC9tUm4zdUtVY29a?= =?utf-8?B?b2dETzE5ejVNNldGNC9LZFQ1TXdURktFWDc4UVZzNUJtV3JneGRXSmd1NWxY?= =?utf-8?B?RnppMU1hNjEzbElPcTBHVXVNeDJYRGxYaDdhYnU5U083UkcwdGJlVjdPU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ginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 911a5746-cd2b-434c-1a09-08db678518b6 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2023 18:29:14.8085 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: L2m4DBT981wY2Ik7FfbbxcxRzsdGBZDi2o0lITKU7r3v43J9hGORoycRpop1yoCz X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8351 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 6/7/2023 9:19 AM, Su, Simei wrote: > Hi Ferruh, > >> -----Original Message----- >> From: Ferruh Yigit >> Sent: Saturday, June 3, 2023 3:44 AM >> To: Su, Simei ; thomas@monjalon.net; >> andrew.rybchenko@oktetlabs.ru; Rybalchenko, Kirill >> ; Zhang, Qi Z >> Cc: dev@dpdk.org; Wu, Wenjun1 >> Subject: Re: [RFC v3 0/3] add frequency adjustment support for PTP timesync >> >> On 5/22/2023 2:23 PM, Simei Su wrote: >>> This patchset cover below parts: >>> (1)Introduce a new timesync API called "rte_eth_timesync_adjust_freq" >> that >>> enables frequency adjustment during PTP timesync. This new API aligns >> with >>> the kernel PTP which already supports frequency adjustment. It brings >> DPDK >>> closer in alignment with the kernel's best practice. >>> >> >> Hi Simei, >> >> I am not expert on PTP, so please help me understand, >> >> I can see there is a new API to update device frequency by updating device >> clock, 'rte_eth_timesync_adjust_fine()', that part is OK. >> (Although I have some reservation with the API name, we can visit it later.) > > Yes, this API is to adjust the frequency in a finer granularity, so naming it as 'rte_eth_timesync_adjust_fine()'. > Can existing 'rte_eth_timesync_adjust_time()' API also used to adjust the device clock frequency? If so, since 'fine' is subjective, how user can decide to use one or other, and why we can't use existing API? >> >> PTP doesn't enforce any specific sync method, right? >> Like adjusting by adding/subtracting or adjusting by updating clock frequency. >> As far as I understand updating device clock frequency is HW capability to >> adjust time, perhaps in a finer grain, is this correct? > > Yes, it's correct. > >> >> If so, is this HW capability should be exposed to user with a new API? >> If this is a generic HW capability, I think it is OK to have single responsibility >> API, but if this is a vendor specific feature it should be behind a generic API. > > It's a generic HW capability instead of vendor specific feature. > >> >> >> Or should we hide this capability behind existing >> 'rte_eth_timesync_adjust_time()' API, and HW/driver use best possible >> method for synchronization, so this can be transparent the user. >> What is the benefit to make user selected explicitly one option or other? >> > > In general, 'rte_eth_timesync_adjust_fine()' is used in conjunction with > 'rte_eth_timesync_adjust_time()' at different moment to do more precise time control. > If I understand this is not defined by PTP control, so how user can do distinction between two? Or same argument again, can user call same existing API and this detail can be hidden behind implementation? Meaning driver/HW selects that moment to call one or other. >> >> >>> (2)Refine the ptpclient application by applying a PI algorithm that leverages >>> the new API to further improve timesync accuracy. These changes >> doesn't break >>> original solution and creates a more accurate solution for DPDK-based >> high >>> accuracy PTP. We have provided significant improvements for timesync >> accuracy >>> on e810 and we believe these improvements will also benefit other >> devices. >>> >> >> What is "PI algorithm"? and what PI stands for? > > Proportional-integral-derivative control is called PID controller. It is widely used in industrial control. > The control deviation is constituted based on the given value and the actual output value. > The deviation produces control quantity based on proportional, integrated and differentiated linear combination, thereby controlling the controlled object. > > 'P' means proportional controller. It changes the magnitude only. > 'I' means integral controller. It lags the output phase. > 'PI' means proportional Integral controller. It changes the magnitude as well as laging the output. > > Proportional-Integral(PI) controller is used to produce a fractional tick-rate adjustment that coordinates the local clock with > master clock time. The PI controller corrects both the time and rate of the local clock. The proportional term tracks and > corrects the direct input, which is the time difference between two clocks. The integral term tracks and corrects steady-state > error, which is the rate difference between two clocks. > Thank you. > Thanks, > Simei > >> >>> The original command for starting ptpclient is: >>> ./build/examples/dpdk-ptpclient -a 0000:81:00.0 -c 1 -n 3 -- -T 0 -p >>> 0x1 >>> >>> The command with PI algorithm is: >>> ./build/examples/dpdk-ptpclient -a 0000:81:00.0 -c 1 -n 3 -- -T 0 -p >>> 0x1 -- controller=pi >>> >>> [RFC v3 1/3] ethdev: add frequency adjustment API. >>> [RFC v3 2/3] examples/ptpclient: refine application. >>> [RFC v3 3/3] examples/ptpclient: add frequency adjustment support. >>> >>> v3: >>> * Refine commit log in patch. >>> * Add more description for the new API. >>> >>> v2: >>> * Remove the ice PMD part from the RFC. >>> * Add description in cover letter. >>> * Refine commit log in patch. >>> >>> Simei Su (3): >>> ethdev: add frequency adjustment API >>> examples/ptpclient: refine application >>> examples/ptpclient: add frequency adjustment support >>> >>> examples/ptpclient/ptpclient.c | 222 >> +++++++++++++++++++++++++++++++++------ >>> lib/ethdev/ethdev_driver.h | 5 + >>> lib/ethdev/ethdev_trace.h | 9 ++ >>> lib/ethdev/ethdev_trace_points.c | 3 + >>> lib/ethdev/rte_ethdev.c | 19 ++++ >>> lib/ethdev/rte_ethdev.h | 38 +++++++ >>> 6 files changed, 265 insertions(+), 31 deletions(-) >>> >