[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <70504065-9d1e-4305-b798-992d608dd449@lunn.ch>
Date: Wed, 8 Jan 2025 19:32:01 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Jiawen Wu <jiawenwu@...stnetic.com>
Cc: "'Keller, Jacob E'" <jacob.e.keller@...el.com>, andrew+netdev@...n.ch,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, richardcochran@...il.com, linux@...linux.org.uk,
horms@...nel.org, netdev@...r.kernel.org, mengyuanlou@...-swift.com,
'linglingzhang' <linglingzhang@...-swift.com>
Subject: Re: [PATCH net-next 1/4] net: wangxun: Add support for PTP clock
On Wed, Jan 08, 2025 at 03:26:20PM +0800, Jiawen Wu wrote:
> > > > > > > > +/**
> > > > > > > > + * 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.
Lets see if i understand this correctly....
"done" means the full packet is on the wire, and so the descriptor
status bits have their final meaning, so the host can read them, and
then reuse the descriptor?
The TX timestamp is however added earlier to the descriptor? Maybe
after the Ethernet header is on the wire? So it could be ~1400 bytes
at line speed before 'done' is set? So 'done' is too late?
But then i have to wounder how many descriptors you have? If you only
have one descriptor, then 1400 bytes could be significant. If there
are 100 packets in the queue waiting to be sent, 1400 bytes is
insignificant. For real world traffic, does polling make a difference?
Andrew
Powered by blists - more mailing lists