[RFC v3 3/3] examples/ptpclient: add frequency adjustment support
Su, Simei
simei.su at intel.com
Wed Jun 7 12:04:29 CEST 2023
Hi Ferruh,
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit at amd.com>
> Sent: Saturday, June 3, 2023 3:53 AM
> To: Su, Simei <simei.su at intel.com>; thomas at monjalon.net;
> andrew.rybchenko at oktetlabs.ru; Rybalchenko, Kirill
> <kirill.rybalchenko at intel.com>; Zhang, Qi Z <qi.z.zhang at intel.com>
> Cc: dev at dpdk.org; Wu, Wenjun1 <wenjun1.wu at intel.com>
> Subject: Re: [RFC v3 3/3] examples/ptpclient: add frequency adjustment
> support
>
> 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 <simei.su at intel.com>
> > Signed-off-by: Wenjun Wu <wenjun1.wu at intel.com>
> > ---
> > 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.
>
OK, got it. Thanks for your reminder.
> <...>
>
> > @@ -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?
It's my design. In current design, if it's without PI algorithm, it only involves time adjustment for "DELAY_RESP PTP message" which is original framework.
If it's with PI algorithm, it involves time adjustment or frequency adjustment based on output state in PI algorithm for " FOLLOW_UP PTP message" while
for " DELAY_RESP PTP message", it only needs to print clock info.
Thanks,
Simei
More information about the dev
mailing list