netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] dp83640: Adjust ptp event timestamps
@ 2014-07-09 10:22 Stefan Sørensen
  2014-07-09 17:41 ` Richard Cochran
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Stefan Sørensen @ 2014-07-09 10:22 UTC (permalink / raw)
  To: richardcochran; +Cc: netdev, Stefan Sørensen

From the dp86340 Software Development Guide:
  Event timestamp values should be adjusted by 3*reference clock period +
  11 ns = 35 ns to compensate for input path and synchronization delays.

So subtract 35ns from event timestamps.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
---
 drivers/net/phy/dp83640.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 53bd1af..76fbd39 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -755,6 +755,9 @@ static int decode_evnt(struct dp83640_private *dp83640,
 	event.type = PTP_CLOCK_EXTTS;
 	event.timestamp = phy2txts(&dp83640->edata);
 
+	/* Compensate for input path and synchronization delays */
+	event.timestamp -= 35;
+
 	for (i = 0; i < N_EXT_TS; i++) {
 		if (ext_status & exts_chan_to_edata(i)) {
 			event.index = i;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-09 10:22 [PATCH net-next] dp83640: Adjust ptp event timestamps Stefan Sørensen
@ 2014-07-09 17:41 ` Richard Cochran
  2014-07-10  9:13   ` Sørensen, Stefan
  2014-07-10 17:35 ` Richard Cochran
  2014-07-10 17:38 ` Richard Cochran
  2 siblings, 1 reply; 8+ messages in thread
From: Richard Cochran @ 2014-07-09 17:41 UTC (permalink / raw)
  To: Stefan Sørensen; +Cc: netdev

On Wed, Jul 09, 2014 at 12:22:23PM +0200, Stefan Sørensen wrote:
> From the dp86340 Software Development Guide:
>   Event timestamp values should be adjusted by 3*reference clock period +
>   11 ns = 35 ns to compensate for input path and synchronization delays.
> 
> So subtract 35ns from event timestamps.

I have avoided adding this kind of thing into drivers because I think
people will want to make the correction in the delayAsymmetry field of
their user space stack. After all, this is exactly what that value is
supposed to cover.

Some parts have fixed delays (or at least they claim to) and some have
variable delays that can depend on link speed or other factors. So my
gut feeling tells me to be consistent and leave all such corrections
out, because in that way the end user will not have to research
whether a particular driver is "pre-correcting" or not.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-09 17:41 ` Richard Cochran
@ 2014-07-10  9:13   ` Sørensen, Stefan
  2014-07-10 17:34     ` Richard Cochran
  0 siblings, 1 reply; 8+ messages in thread
From: Sørensen, Stefan @ 2014-07-10  9:13 UTC (permalink / raw)
  To: richardcochran@gmail.com; +Cc: netdev@vger.kernel.org

On Wed, 2014-07-09 at 19:41 +0200, Richard Cochran wrote:
> On Wed, Jul 09, 2014 at 12:22:23PM +0200, Stefan Sørensen wrote:
> > From the dp86340 Software Development Guide:
> >   Event timestamp values should be adjusted by 3*reference clock period +
> >   11 ns = 35 ns to compensate for input path and synchronization delays.
> > 
> > So subtract 35ns from event timestamps.
> 
> I have avoided adding this kind of thing into drivers because I think
> people will want to make the correction in the delayAsymmetry field of
> their user space stack. After all, this is exactly what that value is
> supposed to cover.

This is not adjusting the packet timestamps but the gpio event
timestamps - the ptp protocol is not involved here. Without this
adjustment, looping back a pps signal from one gpio to another will
result in a ~35ns offset.

> Some parts have fixed delays (or at least they claim to) and some have
> variable delays that can depend on link speed or other factors. So my
> gut feeling tells me to be consistent and leave all such corrections
> out, because in that way the end user will not have to research
> whether a particular driver is "pre-correcting" or not.

Then the end user will have to figure out what delay corrections need to
be made and configure the applications(s) to adjust for this. But I
don't see any good solution to this either. 

Stefan


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-10  9:13   ` Sørensen, Stefan
@ 2014-07-10 17:34     ` Richard Cochran
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Cochran @ 2014-07-10 17:34 UTC (permalink / raw)
  To: Sørensen, Stefan; +Cc: netdev@vger.kernel.org

On Thu, Jul 10, 2014 at 09:13:51AM +0000, Sørensen, Stefan wrote:
> This is not adjusting the packet timestamps but the gpio event
> timestamps - the ptp protocol is not involved here. Without this
> adjustment, looping back a pps signal from one gpio to another will
> result in a ~35ns offset.

Oops, sorry.
 
> Then the end user will have to figure out what delay corrections need to
> be made and configure the applications(s) to adjust for this. But I
> don't see any good solution to this either. 

Yep, not so easy. I think it is only practical in a highly controlled
environment.

Thanks,
Richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-09 10:22 [PATCH net-next] dp83640: Adjust ptp event timestamps Stefan Sørensen
  2014-07-09 17:41 ` Richard Cochran
@ 2014-07-10 17:35 ` Richard Cochran
  2014-07-10 17:38 ` Richard Cochran
  2 siblings, 0 replies; 8+ messages in thread
From: Richard Cochran @ 2014-07-10 17:35 UTC (permalink / raw)
  To: Stefan Sørensen; +Cc: netdev

On Wed, Jul 09, 2014 at 12:22:23PM +0200, Stefan Sørensen wrote:
> From the dp86340 Software Development Guide:
>   Event timestamp values should be adjusted by 3*reference clock period +
>   11 ns = 35 ns to compensate for input path and synchronization delays.
> 
> So subtract 35ns from event timestamps.
> 
> Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>

Acked-by: Richard Cochran <richardcochran@gmail.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-09 10:22 [PATCH net-next] dp83640: Adjust ptp event timestamps Stefan Sørensen
  2014-07-09 17:41 ` Richard Cochran
  2014-07-10 17:35 ` Richard Cochran
@ 2014-07-10 17:38 ` Richard Cochran
  2 siblings, 0 replies; 8+ messages in thread
From: Richard Cochran @ 2014-07-10 17:38 UTC (permalink / raw)
  To: Stefan Sørensen; +Cc: netdev

You forgot davem on CC.

Maybe post this again, with the ack?

Thanks,
Richard

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next] dp83640: Adjust ptp event timestamps
@ 2014-07-11  6:18 Stefan Sørensen
  2014-07-11 21:05 ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Sørensen @ 2014-07-11  6:18 UTC (permalink / raw)
  To: davem; +Cc: richardcochran, netdev, Stefan Sørensen

From the dp86340 Software Development Guide:
  Event timestamp values should be adjusted by 3*reference clock period +
  11 ns = 35 ns to compensate for input path and synchronization delays.

So subtract 35ns from event timestamps.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
---
 drivers/net/phy/dp83640.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
index 53bd1af..76fbd39 100644
--- a/drivers/net/phy/dp83640.c
+++ b/drivers/net/phy/dp83640.c
@@ -755,6 +755,9 @@ static int decode_evnt(struct dp83640_private *dp83640,
 	event.type = PTP_CLOCK_EXTTS;
 	event.timestamp = phy2txts(&dp83640->edata);
 
+	/* Compensate for input path and synchronization delays */
+	event.timestamp -= 35;
+
 	for (i = 0; i < N_EXT_TS; i++) {
 		if (ext_status & exts_chan_to_edata(i)) {
 			event.index = i;
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next] dp83640: Adjust ptp event timestamps
  2014-07-11  6:18 Stefan Sørensen
@ 2014-07-11 21:05 ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2014-07-11 21:05 UTC (permalink / raw)
  To: stefan.sorensen; +Cc: richardcochran, netdev

From: Stefan Sørensen <stefan.sorensen@spectralink.com>
Date: Fri, 11 Jul 2014 08:18:26 +0200

> From the dp86340 Software Development Guide:
>   Event timestamp values should be adjusted by 3*reference clock period +
>   11 ns = 35 ns to compensate for input path and synchronization delays.
> 
> So subtract 35ns from event timestamps.
> 
> Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
> Acked-by: Richard Cochran <richardcochran@gmail.com>

Applied, thank you.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-11 21:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-09 10:22 [PATCH net-next] dp83640: Adjust ptp event timestamps Stefan Sørensen
2014-07-09 17:41 ` Richard Cochran
2014-07-10  9:13   ` Sørensen, Stefan
2014-07-10 17:34     ` Richard Cochran
2014-07-10 17:35 ` Richard Cochran
2014-07-10 17:38 ` Richard Cochran
  -- strict thread matches above, loose matches on Subject: below --
2014-07-11  6:18 Stefan Sørensen
2014-07-11 21:05 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).