Subject: Re: [net-next 03/15] net/mlx5: Add adjphase function to support hardware-only offset control

From: Rahul Rameshbabu <[email-masked]>
Date: Sun, 22 Jan 2023 18:48:49 -0800

On Sun, 22 Jan, 2023 18:22:58 -0800 Richard Cochran <[email-masked]> wrote:
> On Sun, Jan 22, 2023 at 01:11:57PM -0800, Rahul Rameshbabu wrote:
>
>> The way NVIDIA devices internally handle adjphase is to adjust the
>> frequency for a short period of time to make the small time offset
>> adjustments smooth (using some internal calculations) where the time
>> offset "nudge" is applied but frequency is also adjusted to prevent
>> immediate drift after that time adjustment.
>
> Whatever floats your boat.
>
>> However, we aren't sure if
>> this is the only approach possible to achieve accurate corrections for
>> small offset adjustments with adjphase,
>
> Typically one would implement a PI controller.
>
>> so I would suggest that the
>> documentation be updated to state something discussing that adjphase is
>> expected to support small jumps in offset precisely without necessarily
>> bringing up frequency manipulation potentially done to achieve this.
>
> Sorry if the docs aren't clear.  (However, the use of NTP timex
> ADJ_FREQUENCY and ADJ_OFFSET really should be clear to everyone
> familiar with NTP.)
>
> Bottom line: PHC that offers adjphase should implement a clock servo.

adjphase/ADJ_OFFSET is a servo implemented in the kernel space/offloaded
to the device. That makes sense.

Another question then is can adjtime/ADJ_SETOFFSET make use of this
servo implementation on the device or is there a strict expectation that
adjtime/ADJ_SETOFFSET is purely a function that adds the offset to the
current current time? If adjphase is implemented by a driver, should
ADJ_SETOFFSET try to make use of it in the ptp stack if the offset
provided is supported by the adjphase implementation?

This question was asked earlier in the mailing thread.

> Thanks,
> Richard