Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-07 Thread Richard Cochran
On Tue, Aug 03, 2021 at 02:31:25PM +0300, Aya Levin via Linuxptp-devel wrote:

> I would like  to push an infra structure hook to the ptp4l. This hook allows
> vendors to estimate the HW time-stamp closer to the actual transmission and
> reach better accuracy. The hook will receive the HW timestamp as an input
> and will be able to manipulate it.

In fact we already have a "hook" to send time stamps to an external
application.

See TLV_SLAVE_RX_SYNC_TIMING_DATA and TLV_SLAVE_DELAY_TIMING_DATA_NP.

You can enable this using option:

  slave_event_monitor
 Specifies the address of a UNIX domain socket for event monitor-
 ing.  A local monitoring client bound to this address  will  re-
 ceive  SLAVE_RX_SYNC_TIMING_DATA  and SLAVE_DELAY_TIMING_DATA_NP
 TLVs.  The default is the empty string (disabled).

Just run ptp4l with --free_running and then let your application
receive the time stamps, "manipulate" them, and then discipline the
clock.  I think that covers your use case exactly.

HTH,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-05 Thread Grygorii Strashko via Linuxptp-devel




On 05/08/2021 16:44, Richard Cochran wrote:

On Thu, Aug 05, 2021 at 06:40:35AM -0700, Richard Cochran wrote:

Of course you are welcome to hack it into ptp4l for your research.


And once you have the AI algorithm perfected, simply code the result
into the device driver as Jacob suggested.



and there is egressLatency/ingressLatency parameters and actually PHYs which 
can do time-stamping.

--
Best regards,
grygorii


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-05 Thread Miroslav Lichvar
On Thu, Aug 05, 2021 at 06:44:00AM -0700, Richard Cochran wrote:
> On Thu, Aug 05, 2021 at 06:40:35AM -0700, Richard Cochran wrote:
> > Of course you are welcome to hack it into ptp4l for your research.
> 
> And once you have the AI algorithm perfected, simply code the result
> into the device driver as Jacob suggested.

I'm not sure if it's written anywhere or enforced, but there is an
expectation that from the clock's point of view RX timestamps should
never be before start of the reception and TX timestamps should never
be later than start of the transmission.

If this algorithm that is being researched cannot keep the error on
the right side, I think it shouldn't be implemented in the driver, or
at least it should be disabled by default, as it would break
assumptions in applications that try to estimate the maximum error
(e.g. NTP). I'd prefer to keep things like that in the application, or
maybe as a library, if it could be useful to multiple applications.

Is this about mlx5 NICs?

-- 
Miroslav Lichvar



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-05 Thread Richard Cochran
On Thu, Aug 05, 2021 at 06:40:35AM -0700, Richard Cochran wrote:
> Of course you are welcome to hack it into ptp4l for your research.

And once you have the AI algorithm perfected, simply code the result
into the device driver as Jacob suggested.

Thanks,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-05 Thread Richard Cochran
On Thu, Aug 05, 2021 at 10:50:40AM +0300, Aya Levin wrote:

> These AI algorithms frequently tuned and improve over time, hence we don't
> think they belong in the driver. Implementing them here allows immediate and
> frequent updates of the logic without the heavy operation of driver upgrade.

Using AI to get a time stamp?  Hahaha, now *that* is funny.

Seriously, this is not something that is generally needed by real
world products, save the one that you are working on.  It has the
character of a creative yet bizarre research project.

Of course you are welcome to hack it into ptp4l for your research.
However, it is not generally useful, and so I won't include it.

Good luck,
Richard


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


Re: [Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-03 Thread Richard Cochran
On Tue, Aug 03, 2021 at 02:31:25PM +0300, Aya Levin via Linuxptp-devel wrote:
> PTP accuracy is increased when the HW time-stamp is taken as close to the
> network wire as possible. In an effort to improve the time-stamp accuracy,
> we consider extending the ptp4l. I would like to receive your feed-back on
> the suggested below:

This idea doesn't make any sense to me.

> I would like  to push an infra structure hook to the ptp4l. This hook allows
> vendors to estimate the HW time-stamp closer to the actual transmission and
> reach better accuracy. The hook will receive the HW timestamp as an input
> and will be able to manipulate it.

Why don't the vendors simply provide ONE time stamp, the one which is
most accurate?

Nobody wants less accurate time stamps.

Thanks,
Richard



___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel


[Linuxptp-devel] [RFC] ptp4l: improved-accuracy hook

2021-08-03 Thread Aya Levin via Linuxptp-devel

Hi,

PTP accuracy is increased when the HW time-stamp is taken as close to 
the network wire as possible. In an effort to improve the time-stamp 
accuracy, we consider extending the ptp4l. I would like to receive your 
feed-back on the suggested below:


I would like  to push an infra structure hook to the ptp4l. This hook 
allows vendors to estimate the HW time-stamp closer to the actual 
transmission and reach better accuracy. The hook will receive the HW 
timestamp as an input and will be able to manipulate it.


I am no expert in ptp4l source code, but from a quick look in the source 
I think the below point is a good place for the hook.


int sk_receive(int fd, void *buf, int buflen,
   struct address *addr, struct hw_timestamp *hwts,
   int flags)
{
...
 if (addr)
 addr->len = msg.msg_namelen;

 if (!ts) {
 memset(>ts, 0, sizeof(hwts->ts));
 return cnt < 1 ? -errno : cnt;
 }

=> Add hook here

switch (hwts->type) {
 case TS_SOFTWARE:
 hwts->ts = timespec_to_tmv(ts[0]);
 break;
 case TS_HARDWARE:
 case TS_ONESTEP:
 case TS_P2P1STEP:
 hwts->ts = timespec_to_tmv(ts[2]);
 break;
 case TS_LEGACY_HW:
 hwts->ts = timespec_to_tmv(ts[1]);
 break;
 }
...
}

Thanks,
Aya


___
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel