]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ENGR00288342 net:fec_ptp: fix the potential issue for storing timestamp
authorFugang Duan <B38611@freescale.com>
Mon, 18 Nov 2013 02:17:03 +0000 (10:17 +0800)
committerFugang Duan <B38611@freescale.com>
Mon, 18 Nov 2013 02:17:03 +0000 (10:17 +0800)
commit54181c1d83e04b18e63c7723ac80f974b760e019
tree202eb258f1f5c0e43e28996b6259b9c1cd0bd710
parenta08c436c12b2cb2478f0afd8978c41d414ad0ccc
ENGR00288342 net:fec_ptp: fix the potential issue for storing timestamp

The timestamps generated in the i.MX drivers are generated by the
nanoseconds part coming from the 1588 clock. But the number of seconds
are maintained in a private structure of the interface. Those are
updated in a 1588 clock rollover interrupt.

The timestamp is generated right before a rollover of a second and the
timestamp value is constructed afterwards. Therefore the bigger part of
the timestamp is wrong (the second).

Suggested solution (pseudo-code):
If( actual-time.nsec < timestamp.nsec )
Timestamp.sec = fpp->prtc -1;
Else
Timestamp.sec = fpp->prtc;

Signed-off-by: Fugang Duan <B38611@freescale.com>
drivers/net/ethernet/freescale/fec_ptp.c