Re: [PATCH v2 1/1] Added additional callback to ptp_clock_info:

From: Josh Cartwright
Date: Mon Jul 06 2015 - 16:45:30 EST


On Thu, Jul 02, 2015 at 06:14:48PM -0700, Christopher Hall wrote:
> * getsynctime64()

Hello Christopher-

A couple comments below.

>
> This takes 2 arguments referring to system and device time
>
> With this callback drivers may provide both system time and device time
> to ensure precise correlation
>
> Modified PTP_SYS_OFFSET ioctl in PTP clock driver to use the above
> callback if it's available
>
> Added capability (PTP_CLOCK_GETCAPS) for checking whether driver supports
> precise timestamping
>
> Signed-off-by: Christopher Hall <christopher.s.hall@xxxxxxxxx>
> ---
[..]
> @@ -196,19 +197,31 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
> break;
> }
> pct = &sysoff->ts[0];
> - for (i = 0; i < sysoff->n_samples; i++) {
> - getnstimeofday64(&ts);
> + if (ptp->info->getsynctime64 && sysoff->n_samples == 1) {
> + ptp->info->getsynctime64(ptp->info, &ts, &systs);
> + pct->sec = systs.tv_sec;
> + pct->nsec = systs.tv_nsec;

It's difficult to make too many judgements without seeing how a driver
might implement this; is there another patchset that shows how a driver
implements this?

[..]
> diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h
> index f0b7bfe..421b637 100644
> --- a/include/uapi/linux/ptp_clock.h
> +++ b/include/uapi/linux/ptp_clock.h
> @@ -51,7 +51,9 @@ struct ptp_clock_caps {
> int n_per_out; /* Number of programmable periodic signals. */
> int pps; /* Whether the clock supports a PPS callback. */
> int n_pins; /* Number of input/output pins. */
> - int rsv[14]; /* Reserved for future use. */
> + /* Whether the clock supports precise system-device cross timestamps */
> + int precise_timestamping;

Perhaps now is a good time to add an unsigned int 'flags' member instead,
and start allocating bits.

Josh

Attachment: signature.asc
Description: PGP signature