diff mbox

[net-next] dp83640: Adjust ptp event timestamps

Message ID 1404901343-19445-1-git-send-email-stefan.sorensen@spectralink.com
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Sørensen, Stefan July 9, 2014, 10:22 a.m. UTC
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(+)

Comments

Richard Cochran July 9, 2014, 5:41 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Richard Cochran July 10, 2014, 5:34 p.m. UTC | #2
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



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Richard Cochran July 10, 2014, 5:35 p.m. UTC | #3
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>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Richard Cochran July 10, 2014, 5:38 p.m. UTC | #4
You forgot davem on CC.

Maybe post this again, with the ack?

Thanks,
Richard
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;