From version 2.9.2,Pica8 switch support PTP(Precision Time Protocol).
On a modern communications network, most telecommunications services require that the frequency offset or time difference between devices be within an acceptable range. To meet this requirement, network clock synchronization must be implemented.
Network clock synchronization includes phase synchronization and frequency synchronization.
Phase synchronization, also called time synchronization, refers to the consistency of both frequencies and phases between signals. That is, the phase difference between signals is always 0.
Frequency synchronization refers to constant phase difference between signals. It ensures that signals are sent or received at the same rate at a moment so that all devices on the communications network operate at the same rate.
Figure 1 Difference between time synchronization and frequency synchronization
PTP (Precision Time Protocol) is a time synchronization protocol, which itself is only used for high-precision time synchronization between devices, but can also be used to synchronize the frequency between devices. Compared to the existing time synchronization mechanism, PTP has the following advantages:
1.Compared to NTP (Network Time Protocol), PTP can meet the more accurate time synchronization requirements, NTP generally can only achieve sub-second time synchronization accuracy, and PTP can reach sub-microsecond.
2.Compared to GPS (Global Positioning System), PTP has lower construction and maintenance costs, and because it can get rid of the dependence on GPS, it has special meaning in national security.
A PTP domain is a logical grouping of clocks that synchronize to each other using the protocol IEEE 1588v2, but that are not necessarily synchronized to clocks in another domain. Each PTP domain is an independent PTP clock synchronization system and has only one clock source.
Clock nodes are nodes in a PTP domain. PTP defines the following types of clock nodes:
1.Ordinary clock (OC) device: provides only one physical port to participate in time synchronization in a PTP domain. An OC device uses this port to synchronize time with an upstream device or to send a downstream device.
2.Boundary clock (BC) device: provides two or more physical ports to participate in time synchronization in a PTP domain. One port synchronizes time with an upstream device, and the others send the time to downstream devices. A clock node is also a BC device if it functions as the clock source and sends time to downstream devices through multiple PTP ports.
3.Transparent clock (TC) device: forwards PTP messages between its PTP ports and measures the link delay of the messages. Different from an OC device and a BC device, a TC device does not synchronize time with other devices through ports.
- E2ETC (End-to-End Transparent Clock): forwards packets of non-P2P (Peer-to-Peer, point-to-point) types directly on the network and participates in the calculation of the entire link Time.
E2ETC calculate the residence time of the device, which is the time it takes the event message from ingress port to egress port, then add the calculated residence time to the correctionfield of the event message.
- P2PTC (Peer-to-Peer Transparent Clock): forwards only Sync messages, Follow_Up messages and Announce messages, and terminates other PTP packets. It is involved in calculating the entire link on the entire link. The delay of a link.
A PTP port is a port running PTP. PTP ports are classified into the following types based on roles:
1.Master port: The port is the source of time on the path served by the port, located on a BC or OC device.
2.Slave port: The port synchronizes to the device on the path with the port that is in the MASTER state, is located on a BC or OC device.
3.Passive port: The port is not the master on the path nor does it synchronize to a master.is an idle port on a BC device and does not receive or send synchronization clock signals.
Nodes in a PTP domain establish the master-slave hierarchy for clock synchronization. Master nodes send synchronization clock signals, while slave nodes receive synchronization clock signals. A device may receive synchronization clock signals from an upstream node and then send the synchronization clock signals to a downstream device.
If two clock nodes synchronize time with each other:
1.The node that sends synchronization clock signals is the master node, and the node that receives synchronization clock signals is the slave node.
2.The clock on the master node is the master clock, and the clock on the slave node is the slave clock.
3.The port that sends synchronization clock signals is the master port, and the port that receives synchronization clock signals is the slave port.
All clock nodes in a PTP domain are organized into the master-slave hierarchy. The grandmaster clock (GMC) is at the top of the hierarchy and is the reference clock in the PTP domain. Clock nodes exchange PTP messages to synchronize the time of the GMC to the entire PTP domain. Therefore, the GMC is also called the clock source. The GMC can be statically configured or dynamically elected through the best master clock (BMC) algorithm.
Nodes exchange PTP messages to establish the master-slave hierarchy and implement time and frequency synchronization. PTP messages are classified into event messages and general messages depending on timestamps:
1.Event message: is tagged with a timestamp when reaching or leaving a port. PTP devices calculate the link delay based on the timestamps carried in event messages. Event messages include Sync, Delay_Req, Pdelay_Req, and Pdelay_Resp messages.
2.General message: is used to establish master-slave hierarchy, and to request and send time information. General messages are not tagged with timestamps. General messages include Announce, Follow_Up, Delay_Resp, Pdelay_Resp_Follow_Up, Management, and Signaling messages. Currently, devices do not support Management and Signaling messages.
Flow chart of delay Request-Response Mechanism
Figure 2 shows the process of calculating the average link delay and time offset between the master and slave devices using the E2E mechanism.
Figure 2 Delay request-response mechanism
1.The master sends a Sync message to the slave and notes the time t1 at which it was sent..
2.The slave receives the Sync message and notes the time of reception t2.
3.The master conveys to the slave the timestamp t1 by:
a) Embedding the timestamp t1 in the Sync message. This requires some sort of hardware
processing for highest accuracy and precision.
b) Embedding the timestamp t1 in a Follow_Up message.
4.The slave sends a Delay_Req message to the master and notes the time t3 at which it was sent.
5.The master receives the Delay_Req message and notes the time of reception t4.
The master conveys to the slave the timestamp t4 by embedding it in a Delay_Resp message.
By exchanging messages with the master device, the slave device obtains t1, t2, t3, and t4, and calculates the average link delay and time offset between the master and slave devices. Then the slave device can adjust the local time according to the calculated time offset to synchronize with the master device. The formulas for calculating the link delay and time offset are as follows:
Average link delay = [(t4- t1) - (t3- t2)]/2
Offset = [(t2- t1) + (t3- t4)]/2
The table below shows the model and the corresponding switch ASIC that support the PTP function, others do not support.
Configure the device interface as the E2ETC node type, enable the PTP function on the interface, and implement the device to forward the PTP packets directly.
By default, PTP is disabled on an interface.
Disable ptp mode on the interface:
- The PTP function can only be configured on the physical interface.
- On the TC device, PTP must be enabled on all the interfaces that receive and send PTP messages. Otherwise, the PTP function will work inproperly.
Configure the port te-1/1/1 that receiving PTP messages and the port te-1/1/2 that sends PTP packets as E2ETC node.
Result:ptp message are forwarded normally and te-1/1/2 receive ptp packets with correction.