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

From: Richard Cochran
Date: Fri Dec 15 2023 - 09:46:43 EST


On Thu, Dec 14, 2023 at 09:59:32PM +0000, Min Li wrote:

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

That makes sense to me. We can return the relevant
ptp_extts_request.flags. Something like:

#define PTP_EXTTS_FLAGS_VALID PTP_ENABLE_FEATURE

Then you can return

ptp_extts_event.flags = PTP_EXTTS_FLAGS_VALID | PTP_EXT_OFFSET;

Later on, other drivers can indicate PTP_[RISING|FALLING]_EDGE, if
they can tell which one happened.

> 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. */

BTW, please don't make a union here. Instead just add text to the
comment of `struct ptp_clock_time t`.

The `struct ptp_clock_time t` can be a postive or a negative value
(see comment at the top of the file), and so you can put an offset in
there as well.

Thanks,
Richard