Subject: RE: [PATCH net-next 1/4] net: wangxun: Add support for PTP clock

From: Jiawen Wu <[email-masked]>
Date: Wed, 8 Jan 2025 15:26:20 +0800

> > > > > > > +/**
> > > > > > > + * wx_ptp_tx_hwtstamp_work
> > > > > > > + * @work: pointer to the work struct
> > > > > > > + *
> > > > > > > + * This work item polls TSYNCTXCTL valid bit to determine when a Tx
> > hardware
> > > > > > > + * timestamp has been taken for the current skb. It is necessary,
> > because the
> > > > > > > + * descriptor's "done" bit does not correlate with the timestamp event.
> > > > > > > + */
> > > > > >
> > > > > > Are you saying the "done" bit can be set, but the timestamp is not yet
> > > > > > in place? I've not read the whole patch, but do you start polling once
> > > > > > "done" is set, or as soon at the skbuff is queues for transmission?
> > > > >
> > > > > The descriptor's "done" bit cannot be used as a basis for Tx hardware
> > > > > timestamp. So we should poll the valid bit in the register.
> > > >
> > > > You did not answer my question. When do you start polling?
> > >
> > > As soon at the skbuff is queues for transmission.
> >
> > I assume polling is not for free? Is it possible to start polling once
> > 'done' is set? Maybe do some benchmarks and see if that saves you some
> > cycles?
> >
> > 	Andrew
> >
> 
> Agreed, I would try to benchmark that. Timestamps need to be returned
> relatively quickly, which means the polling rate needs to be high. This costs a lot
> of CPU, and so any mechanism that lets you start later will help the CPU cost.

May not. We should notify the stack as soon as we get Tx hardware timestamp.
But descriptor's "done" bit may hasn't been set yet.