Re: [PATCH net-next] ptp: add vclock timestamp conversion IOCTL

From: Richard Cochran
Date: Mon Sep 27 2021 - 16:23:11 EST


On Mon, Sep 27, 2021 at 06:00:08PM +0200, Sebastien Laveze wrote:
> The "typically" was more a reference to this possible implementation of
> AS-2020 using a common CMLDS layer and several domains using a single
> socket.
>
> So, without this IOCTL the design would be 1 socket for CMLDS layer
> and 1 socket for each domain plus some specific filtering for each
> socket to avoid processing the unwanted traffic.
>
> With this IOCTL, the design would be 1 socket and 1 conversion for the
> sync messages in the appropriate domain.

The ioctl solution is gross. A program with eight vclocks should call
recvmsg and parse the CMSG, then go and call ioctl seven times? Yuck.

What you really want is the socket to return more than one time stamp.
So why not do that instead?

Right now, the SO_TIMESTAMPING has an array of

struct timespec ts[3] =
[0] SOFTWARE
[1] LEGACY (unused)
[2] HARDWARE

You can extend that to have

[0] SOFTWARE
[1] LEGACY (unused)
[2] HARDWARE (vclock 0)
[3] HARDWARE (vclock 1)
[4] HARDWARE (vclock 2)
...
[N] HARDWARE (vclock N-2)

You could store the selected vclocks in a bit mask associated with the socket.

Hm?

Thanks,
Richard