Thread Links | Date Links | ||||
---|---|---|---|---|---|
Thread Prev | Thread Next | Thread Index | Date Prev | Date Next | Date Index |
Jouni
From: Jouni Korhonen [mailto:jouni.korhonen@xxxxxxxxxxxx]
Richard, See inline From: Richard Tse [mailto:Richard.Tse@xxxxxxxx]
Jouni: 1.
For the timestamps, it looks like the 31 on-the-wire timestamp resides in positions [47:16]. So, are you assuming the least significant 16 bits are fractional nanoseconds?
Is this the error that you said you found in your mask values? [JiK:] Yes. The masks are wrong.. they should be shifted 16 bits to right. 2.
While we don’t mandate the use of PTP time, it will almost certainly be used for RoE applications. Perhaps we should also include a similar example with PTP time. [JiK:] It is likely to be very similar but with a bit more lines of code.. The PTP time stamp structure is not too “binary
friendly”. [RTse]
It’s not too bad if we just use the nanoseconds portion of the PTP timestamp format. a.
On this point, I do not recall why we chose to use a straight binary nanosecond value for the timestamp instead of just using the least significant bits of the PTP time format.
Then, no conversion would be needed and the multiply and divide operations would not be needed. [JiK:] Just cutting & pasting the lowest bits does not work if there is jitter in the network and/or the local vs presentation
time fall to different sides of the “wrap boundary” – but I can be proven wrong. You don’t need multiply/division in your implementation. The example was for informational purposes. I could implement the “internal clock” as a flat counter and adjust it then
based on the PTP measurements etc. [RTse]
Yes, both sides should be aware of the wrap-around condition associated with the timestamp. However, I don’t see this as an issue in practice.
·
The generator of the message should give a presentation timestamp that has sufficient margin to account for the expected maximum network packet delay,
packet delay variation, and PTP time-of-day misalignment at the destination node. This margin guarantees that the message will get to the destination a little before the presentation time occurs. ·
The jitter and maximum PTP ToD misalignment between the nodes would be much smaller than the network delay. ·
The network delay is much smaller than the wrap-around size of the timestamp. ·
If the above three conditions are true, I don’t think there would be any confusion related to the wrap around boundaries of a PTP-based presentation timestamp. 3.
Finally, do you think the presentation time needs to reach beyond 1, 2, or 4 seconds from the current time? It seems unlikely so, perhaps, just a 30, 31, or 32-bit local
time (not counting fractional nanoseconds) should be sufficient. [JiK:] Even 1s is a lot.. but I had no better use for the excess bits. [RTse]
Yes, 1 second is a lot. This is why I think using the 30-bit integer nanoseconds portion of the PTP timestamp format (which wraps around at 1 second) would be a good
option to use for the RoE timestamps. Despite the non-power-of-two wraparound value, this is still a fairly easy binary implementation. - Jouni Rich From:
stds-1904-3-tf@xxxxxxxx [mailto:stds-1904-3-tf@xxxxxxxx]
On Behalf Of Jouni Korhonen Folks, We had the discussion today during the call how the 32-bit on-wire timestamp in the RoE header actually relate to PTP time stamp and why the example algorithm is using 64-bit
timestamps instead of e.g. PTP timestamps. (nb. the mask values seem to have a bug now that I looked at it again ;) First, 1904.3 is not mandating PTP, so I did not want to refer PTP timestamps explicitly. Thus, a 64-bit timestamp for my time of day/local time and for simpler math. So,
the algorithm assumes that the e.g. the PTP "local time" is converted to 64-bit nanosecond number. The conversion is rather straight forward but may lose some years from the possible time scale e.g. in a case of PTP time stamp (since PTP time stamp has 48-bit
seconds field). Anyway, 64-bit time stamp in nanoseconds from EPOCH (1 January 1970 00:00:00 TAI) still runs without overflow till mid 2554. Should be enough for few generations to come.
Below is some mock up pseudo code that would do the conversions. (nb. for illustration purposes only – i did not *run* the code ;) After I have the 64-bit time of
day, I tune my “presentation time” maximum distance so that it fits into 32-bit field that I have in RoE header. That’s what the Appendix example algorithm basically does. // PTP timestamp struct Timestamp { uint48_t secondsField; uint32_t nanosecondsField; }; // PTP timestamp to 64-bit nanoseconds uint64_t ptp_tstamp_2_ts64( const struct Timestamp* ts ) { return ts->secondsField * 1000000000LL + ts->nanosecondsField; } // 64-bit nanoseconds to PTP timestamp void ts64_to_ptp_tstamp( struct Timestamp* ts, uint64_t ts64 ) { ts->secondsField = ts64 / 1000000000LL; ts->nanosecondsField = ts64 % 1000000000LL; } --
Jouni Korhonen, CTO Office, Networking, Broadcom Corporation O: +1-408-922-8135, M: +1-408-391-7160 |