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 4563A42C12; Fri, 2 Jun 2023 21:52:54 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F18F940ED8; Fri, 2 Jun 2023 21:52:53 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) by mails.dpdk.org (Postfix) with ESMTP id 83D50406B8 for ; Fri, 2 Jun 2023 21:52:52 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lCSq0ynI9NkZwE1bkECB/UNH7iue9+rPs8nrpjfkA2ErdAsA/k+zkrd1BbcRt2LiJsegDgNvhZvstbDtMh1fMZtINmaeVhmgCEveUvSWaIlB6jUxIRV2pmrlJL+jYd1o5j/VepAG887tmAGpvj9cm2cwG4q6NpSmXk6fXBiERG1+KGdv/MpEihhjW0KucrD2S7oiS3veGcbz+JFpAOSHLn2leXDJUn2zAemcaxgf5vK9oFAggyRu1vqcjkadbMNMmXrBkmDwZ87zc6J1dtDfJMS8HDF+OgkT+ZNEAMvXmMaWuVLzz1NCYCTnud+phsJoBlE+19mvfFUDNZ6GsFz5QA== 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=ORS+zhG2MQ34trVPybmFS6rd6W8w4k+kUkPML0xHPF8=; b=VUnV/iompLmceHwTayjTTANK4MWhztYGC9BSzI92/gsQJ9Yhbdka0G/YrFvIFAHDRTzZQfwpgZd1a4kqnUVIcsRy3Mwl/Km9/c5/cOyxcCNLiADFj+E/qxUAX5Cb1BqWgMM+yzmKD4eiD7AMlcKO94xegKwjSnP0HC95rwc0/DZpkFE4Llf8dRbtYTC58rm4OyKpuhlPigNwiz9/m4WaNc8Vm8fNAvQoWbsumVeNH3GBomYb5Uv8eX+jQpc2gj+677piSdEOrP3Wb1YAt7gLowsa0Awhz0dUqVf6F0i01nfGVZVMdI72TMw9OqEcwLuldZwa4OsozwKu2+l/1Vc/9w== 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=ORS+zhG2MQ34trVPybmFS6rd6W8w4k+kUkPML0xHPF8=; b=JbWtPgeVjVckU4GWbX4lXPDBwDcaTX5cC/+j3nbPrvWilmLhXGWkr2H3xPfZNppNZSfo92C/IdJMSQKw7qniH8pg7pmL3HBBPH32XoQurHFGLPzj1VURu2+DXQZIn2my/GhWXA8CTo13ONJDOwXKb5w4ag+p8B+oPD5Pi0RoMnQ= 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 IA0PR12MB8714.namprd12.prod.outlook.com (2603:10b6:208:488::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Fri, 2 Jun 2023 19:52:49 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6433.022; Fri, 2 Jun 2023 19:52:49 +0000 Message-ID: <383a5e6e-8b71-90ae-f7f6-bc1ea53f1aa8@amd.com> Date: Fri, 2 Jun 2023 20:52:43 +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: Simei Su , thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, kirill.rybalchenko@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, wenjun1.wu@intel.com References: <20230403092248.81551-1-simei.su@intel.com> <20230522132332.102030-1-simei.su@intel.com> <20230522132332.102030-4-simei.su@intel.com> From: Ferruh Yigit Subject: Re: [RFC v3 3/3] examples/ptpclient: add frequency adjustment support In-Reply-To: <20230522132332.102030-4-simei.su@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0542.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:319::7) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|IA0PR12MB8714:EE_ X-MS-Office365-Filtering-Correlation-Id: d1246ad7-2284-46c2-13ec-08db63a2f14c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4uVCNPFWPVLc/P9MOTJMgIIfSi1STg2oXkmloLCeAsSB6mlvY989GuFikvqW1gBUjRDuJJCxuuTAYy+1MFhpHsu1HejeRicSJ84vJ0AvUt/Gv7Xg3PLr6EQOTOtndLJ8RMs1fzalDxt44KxJaHKX1+zCmWV7229CcN03kjmfkETMXwxCDADJROry9Xf4vsvR/qilumE8ZnKI6YsT3D8OknXPeLDIItwQUTlBrvm9mZAQ6T9w7YCUkDoDTVwTtSzyHIWR7cFGLOl2ANyPjhuXzbHIWFaH1GpA4jCyohNygraZbH6htjL/hAcmYSA28UhXLe0eeaJY4ypJtggGQReaqWvBB2m9ArRyU5yWbdYQkfDAQpAM6V8JbAvyGskA87Fm3281U5/OArRv/NNYyGTofMXqxYoS3SaDBNAcE/0y3cQsmWnXDWOCv0vG5uCsQpW0jztZeDvBp8E2AHqIL6RDbXJ5ZQQb9r9/YIJPJ6nQ+TIuaE4jJv4719cVu8HSReyAc5kJT4jgq8hTm+rZ6dH5jG12auWNz7hZdsOwZTTcR+VLnqNo26YZ951QhXRCcSuCnRMH8CgdF4vV4HL7wOvZsVPmgaLsbpUyC1EE85rPFsdmPZL0nHDdbtoSsIZyM3s+vRR2nz67JZwfmCZVGxsTAg== 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)(39860400002)(366004)(136003)(376002)(346002)(396003)(451199021)(186003)(6506007)(6512007)(53546011)(26005)(6666004)(478600001)(2616005)(83380400001)(41300700001)(8936002)(5660300002)(44832011)(2906002)(8676002)(316002)(66946007)(66556008)(66476007)(86362001)(4326008)(36756003)(31696002)(6486002)(38100700002)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Nm9XL2h0NXIyVjZpM2FTeC9DVTN6SlcwQnNPSnFGRzZOTWx3RFVNWDNyenFi?= =?utf-8?B?bDkxK0w4YTl3bGlZRGtHWitQZGkxTzB3TWpUVW1wYUZxNHovM2tWeXRQVnFw?= =?utf-8?B?LzR2Mjl4WFljSlpoNFdudzllZ2YzNmNhaGlyZ09jWDRYQnFWWUIybFM3K2hE?= =?utf-8?B?VEdvM1d1S3d0czdMa1dDVmRrL2dUWVhGeTNIbTF6S0dkRTQ5RTF6K2RnY043?= =?utf-8?B?VlJmUG0zaFFIVXUyRFRvQ0gzSlZ3cTZ3UHhPT1pTcHVPR0NpenpobmtmRnk0?= =?utf-8?B?anYyb2F5K2EvbDhyRj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BTWJiVWZoZVVERXkraEsvQjNXdzBO?= =?utf-8?Q?J4bhrNPAdlVZXcnJNTP3kw59P?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1246ad7-2284-46c2-13ec-08db63a2f14c X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 19:52:48.9774 (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: ZiZBcJzhaKEZcsMNHZIe2Zsur8hNJWasnOCDlAfzL9yPPB/FOcc+D7tYlStCeaUR X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8714 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 5/22/2023 2:23 PM, Simei Su wrote: > This patch applys PI servo algorithm to leverage frequency adjustment > API to improve PTP timesync accuracy. > > The command for starting ptpclient with PI algorithm is: > ./build/examples/dpdk-ptpclient -a 0000:81:00.0 -c 1 -n 3 -- -T 0 -p 0x1 > --controller=pi > > Signed-off-by: Simei Su > Signed-off-by: Wenjun Wu > --- > examples/ptpclient/ptpclient.c | 178 +++++++++++++++++++++++++++++++++++++---- > 1 file changed, 161 insertions(+), 17 deletions(-) > <...> > + > +enum controller_mode { > + MODE_NONE, > + MODE_PI, > + MAX_ALL > +} mode; > + Better to have 'mode' variable as 'static', can be good to split enum and variable declaration. <...> > @@ -608,11 +729,14 @@ parse_ptp_frames(uint16_t portid, struct rte_mbuf *m) { > break; > case FOLLOW_UP: > parse_fup(&ptp_data); > + if (mode == MODE_PI) > + ptp_adjust_freq(&ptp_data); > send_delay_request(&ptp_data); > break; > case DELAY_RESP: > parse_drsp(&ptp_data); > - ptp_adjust_time(&ptp_data); > + if (mode == MODE_NONE) > + ptp_adjust_time(&ptp_data); > print_clock_info(&ptp_data); > break; > default: > Why with FOLLOW_UP PTP message only frequency adjustment done, and with DELAY_RESP PTP message only time adjustment done? Is this related to he PTP protocol, or your design decision?