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

From: Richard Cochran
Date: Sun Oct 08 2017 - 08:08:02 EST


On Fri, Sep 29, 2017 at 03:17:02PM +0000, Brandon Streiff wrote:
>
> 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.

Just keep it simple and drop the extra logic. It doesn't hurt to
over-sample the clock. Here is what I did:

/* Covers both a 100 or a 125 MHz input clock. */
#define MV88E635X_OVERFLOW_PERIOD (HZ * 16)

static void mv88e635x_overflow_check(struct work_struct *ws)
{
struct timespec64 ts;
struct mv88e6xxx_chip *ps =
container_of(ws, struct mv88e6xxx_chip, oflow_work.work);

mv88e635x_ptp_gettime(&ps->ptp_info, &ts);
pr_debug("mv88e635x overflow check at %lld.%09lu\n",
ts.tv_sec, ts.tv_nsec);
schedule_delayed_work(&ps->oflow_work, MV88E635X_OVERFLOW_PERIOD);
}

Thanks,
Richard