RE: [PATCH net-next RFC 2/9] net: dsa: mv88e6xxx: expose switch time as a PTP hardware clock

Brandon Streiff
2017-09-29T15:17:02Z

> From: Andrew Lunn [mailto:andrew@lunn.ch]
> Sent: Thursday, September 28, 2017 12:03 PM
>
> > + bool timeout = time_is_before_jiffies(chip->last_overflow_check +
> > + MV88E6XXX_TAI_OVERFLOW_PERIOD);
> > +
> > + if (timeout) {
>
> Why do you need this timeout? Do you think the kernel will call this
> more often than required?
>
> Also, if it did call this function early, you skip the read, and
> reschedule. There is then a danger the next read is after the
> wraparound.....

That was, conceptually, a copy-paste from ixgbe_ptp.c as I was looking for how to implement the overflow accounting; that driver has a similar time_is_before_jiffies check in ixgbe_ptp_overflow_check.

Although now that I'm looking it over again, I'm also not certain of the need. Even if we're called more frequently than we expect, that doesn't seem to be harmful with regard to timekeeping. Hmm.

-- brandon