RE: [PATCH net-next v3 1/2] ptp: introduce PTP_CLOCK_EXTOFF event for the measured external offset

From: Min Li
Date: Thu Dec 14 2023 - 16:59:50 EST



> On Thu, Dec 14, 2023 at 11:36:24AM -0500, Min Li wrote:
> > diff --git a/include/uapi/linux/ptp_clock.h
> > b/include/uapi/linux/ptp_clock.h index da700999c..66f4dd73a 100644
> > --- a/include/uapi/linux/ptp_clock.h
> > +++ b/include/uapi/linux/ptp_clock.h
> > @@ -32,6 +32,7 @@
> > #define PTP_RISING_EDGE (1<<1)
> > #define PTP_FALLING_EDGE (1<<2)
> > #define PTP_STRICT_FLAGS (1<<3)
> > +#define PTP_EXT_OFFSET (1<<4)
>
> This isn't going to work.
>
> If user space enables time stamps twice, once with PTP_EXT_OFFSET and
> once without, it won't be able to differentiate the two when it reads a
> ptp_extts_event.
>
> Thanks,
> Richard

Hi Richard
Would it be Ok if I use the flags to differentiate extts events from extoff?

struct ptp_extts_event {
- struct ptp_clock_time t; /* Time event occured. */
+ union {
+ struct ptp_clock_time t; /* Time event occurred. */
+ __s64 offset_ns; /* Offset event occurred. */
+ };
unsigned int index; /* Which channel produced the event. */
unsigned int flags; /* Reserved for future use. */
unsigned int rsv[2]; /* Reserved for future use. */