On Wed, Jul 08, 2020 at 12:58:27AM +0000, Keller, Jacob E wrote:
> 
> 
> > -----Original Message-----
> > From: Vladimir Oltean <olte...@gmail.com>
> > Sent: Tuesday, July 07, 2020 9:08 AM
> > To: Keller, Jacob E <jacob.e.kel...@intel.com>; richardcoch...@gmail.com
> > Cc: linuxptp-devel@lists.sourceforge.net
> > Subject: Re: [Linuxptp-devel] [PATCH] ts2phc_phc_master: specify start time 
> > to
> > PPS master as 0.000000000
> > 
> > What modification do you think should be done to the kernel ABI?
> > This is what is currently in place:
> > 
> > struct ptp_perout_request {
> >     struct ptp_clock_time start;  /* Absolute start time. */
> >     struct ptp_clock_time period; /* Desired period, zero means disable. */
> >     unsigned int index;           /* Which channel to configure. */
> >     unsigned int flags;
> >     unsigned int rsv[4];          /* Reserved for future use. */
> > };
> > 
> > Most interesting to me would be the "flags" field. The v2 of the ioctl
> > can currently only have:
> > 
> > #define PTP_PEROUT_ONE_SHOT (1<<0)
> > 
> > Maybe something like this?
> > 
> > #define PTP_PEROUT_RELATIVE_START_TIME (1<<1)
> > 
> > with the meaning of 'just set up the clock generator to start ASAP (with
> > an unspecified definition of ASAP) with this phase offset in
> > nanoseconds, relative to 0 which corresponds to the closest integer
> > multiple of the period in the PHC time base'.
> > 
> > What would be the valid range of 'start' in the case where (flags &
> > PTP_PEROUT_RELATIVE_START_TIME) is set?
> > 
> 
> What would start even be used for? We have a period already, and it sounds 
> like relative start wouldn't even use a start value?
> 

For phase, as I said? A rectangular function generator (without an
absolute start time) should be completely described by a phase, a period
and a duty cycle. And I'm proposing to reuse the 'start' field for that.

Also note that I have no real idea how I could shove the duty cycle
("pulse width") into the existing struct ptp_perout_request without
breaking binary compatibility.

> > - Zero to $('period' - 1) nanoseconds, or
> > - Zero to infinity, with a modulo performed by somebody (probably the
> >   PTP core)?
> > 
> > Also, there's the question of what to do about the sysfs ABI. Currently
> > you can't pass the flags through that:
> > 
> >     cnt = sscanf(buf, "%u %lld %u %lld %u", &req.perout.index,
> >                  &req.perout.start.sec, &req.perout.start.nsec,
> >                  &req.perout.period.sec, &req.perout.period.nsec);
> >     if (cnt != 5)
> >             goto out;
> > 
> > Do we want to permit another sscanf for optional flags at the end? Would
> > the flags be textual or numbers (0, 1, 2, 3)?
> 
> I don't know how stringent the sysfs interface needs to be on avoiding ABI 
> breakage, but we probably want to be careful here. Personally I really 
> dislike this interface as I constantly have to lookup what order each thing 
> is in. I'd rather see it replaced with something more akin to "name=value" or 
> "name value" pairs.. though in practice if we simply make the current 
> userspace tools better then it wouldn't be that relevant since those would be 
> easier to use overall anwyays...
> 

I could probably leave the sysfs interface untouched for now.

> > 
> > Thanks,
> > -Vladimir

-Vladimir


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

Reply via email to