Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1211507

Re: [PATCH v3 3/4] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl

From Richard Cochran <richardcochran@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3 3/4] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl
Date 2015-08-22 23:20 +0200
Message-ID <q0omJ-5Ao-1@gated-at.bofh.it> (permalink)
References <q06ga-4Gw-3@gated-at.bofh.it> <q06ga-4Gw-11@gated-at.bofh.it> <q0nK1-4zp-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Aug 22, 2015 at 10:33:48PM +0200, Thomas Gleixner wrote:
> > @@ -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 &&
> 
> The number of samples should be irrelevant for this sampling method.

Chris had send me a preview of this before he posted, so I can explain
that test for one sample.

User space requests N (1 to 25) samples of the two clocks.  The kernel
is supposed to deliver that many samples.  This has always been the
documented behavior.  From ptp_clock.h:

  struct ptp_sys_offset {
	unsigned int n_samples; /* Desired number of measurements. */
	unsigned int rsv[3];    /* Reserved for future use. */
	/*
	 * Array of interleaved system/phc time stamps. The kernel
	 * will provide 2*n_samples + 1 time stamps, with the last
	 * one as a system time stamp.
	 */
	struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1];
  };

So the kernel cannot simply change n_samples to 1.

I would prefer to have a new system call that compares any two posix
clock_t, but that is of course more work.

Allowing n_samples=1 as a special case is a kind of overloading of the
ioctl to support the new capability.  At least it preserves the
behavior of the interface from the user's perspective.

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 3/4] Add support for driver cross-timestamp to PTP_SYS_OFFSET ioctl "Christopher S. Hall" <christopher.s.hall@intel.com> - 2015-08-22 04:00 +0200
  Re: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl Thomas Gleixner <tglx@linutronix.de> - 2015-08-22 22:40 +0200
    Re: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl Richard Cochran <richardcochran@gmail.com> - 2015-08-22 23:20 +0200
      Re: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl Thomas Gleixner <tglx@linutronix.de> - 2015-08-23 10:20 +0200
        Re: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl Richard Cochran <richardcochran@gmail.com> - 2015-08-23 13:30 +0200
          RE: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl "Hall, Christopher S" <christopher.s.hall@intel.com> - 2015-08-24 22:20 +0200
            Re: [PATCH v3 3/4] Add support for driver cross-timestamp to  PTP_SYS_OFFSET ioctl Richard Cochran <richardcochran@gmail.com> - 2015-08-25 09:40 +0200

csiph-web