Re: [PATCH net-next v2 2/2] net: micrel: Schedule work to read seconds for lan8841

From: Horatiu Vultur
Date: Wed Jun 14 2023 - 05:20:23 EST


The 06/13/2023 21:49, Richard Cochran wrote:

Hi Richard,

>
> On Tue, Jun 13, 2023 at 11:45:26AM +0200, Horatiu Vultur wrote:
> > @@ -3840,6 +3847,12 @@ static void lan8841_ptp_enable_processing(struct kszphy_ptp_priv *ptp_priv,
> > LAN8841_PTP_INSERT_TS_32BIT,
> > LAN8841_PTP_INSERT_TS_EN |
> > LAN8841_PTP_INSERT_TS_32BIT);
> > +
> > + /* Schedule the work to read the seconds, which will be used in
> > + * the received timestamp
> > + */
> > + schedule_delayed_work(&ptp_priv->seconds_work,
> > + nsecs_to_jiffies(LAN8841_GET_SEC_LTC_DELAY));
>
> Why not do this in the PTP kworker thread?

I presume you mean the work of reading the second part to be done in the
PTP kworker thread and not scheduling the seconds_work.
Because then it make sense to me and I think is a great idea.
>
> The thread's scheduling can be easily tuned with chrt to give it
> appropriate priority, but work can't.

Nice, I didn't know about this.

>
> Also, If you have seconds thread, then you don't have to defer the
> received frames.

Exactly, the PTP kworker thread will cache the seconds value while
lan8841_rxtstamp will read this value, so no need to defer these frames.

In this way I can get rid of seconds_work.

>
> Thanks,
> Richard
>

--
/Horatiu