Skip to main content

What is PTP and How does it Work?

written by Asterfuison

March 26, 2024

This article provides a comprehensive overview of the PTP protocol and explains how the Asterfusion SONiC-based open network switch supports PTP in both hardware and software.

Why Need PTP(Precision Time Protocol)?

Ethernet technology is widely used in telecom-grade networks due to its openness, affordability, and ease of use. Over the years, data transmission speeds have significantly increased from 10 Mbps to 800 Gbps. One of the key advantages of Ethernet is its “plug-and-play” feature, allowing Ethernet terminals to effortlessly connect to an IP network and access services at any time. However, for a truly reliable telecommunications-grade network, synchronization of the IP network is crucial to ensure quality for real-time and data services. Currently, the synchronization requirements for telecommunication-level networks are very strict. The backbone network delay should ideally be controlled within 50ms. Unfortunately, the existing NTP (Network Time Protocol) and SNTP (Simple Network Time Protocol) protocols fail to achieve the desired synchronization accuracy or convergence speed.

What is PTP (Precision Time Protocol)?

The IEEE1588 PTP protocol utilizes NTP technology and is known for its simple configuration, quick convergence, and minimal consumption of network bandwidth and resources. The IEEE1588 standard, also known as the IEEE1588 Precision Clock Synchronization Protocol or PTP (Precision Timing Protocol), aims to periodically correct and synchronize the clocks of all network nodes through a synchronization signal. This synchronization enables precise synchronization in Ethernet-based distributed systems and can be applied to any multicast network. The IEEE1588 protocol has evolved to version 2, which features bi-directional channels, nanosecond-level precision, cost-effectiveness, and adaptability to various access environments.

How does PTPv2 Work?

IEEE1588 PTPv2 uses a relative time synchronization mechanism. One participant is selected as the master time clock and it will send synchronization messages to the slaves. The master will send synchronization messages to the network and all the slaves calculate the time delay.

The principle of time synchronization is shown below

The time offset (Offset) and transmission delay (Delay) are calculated from the clock based on T1, T2, T3, T4, i.e.:

T2 – T1 = Offset + Delay

T4 – T3 = Delay – Offset

From this we can calculate:

Delay = (T4 – T3 + T2 – T1)/2

Offset = (T2 – T1 – T4 + T3)/2

Depending on the Offset, the slave can adjust its own clock for precise time synchronization.

The Precision Network Synchronization Protocol defined by the IEEE1588 PTPv2 standard achieves a high degree of synchronization in the network, eliminating the need for dedicated synchronization communications when assigning control jobs, thus achieving the effect of separating the communication time mode from the application execution time mode. Due to the highly accurate synchronization work, the data transmission time fluctuations inherent in Ethernet technology are reduced to an acceptable range that does not affect control accuracy.

PTP Domain

A network that applies the PTP protocol is called a PTP domain.A PTP domain has one and only one synchronized clock, and all devices within the domain are synchronized to that clock.

PTP Port

A port on a device that runs the PTP protocol is called a PTP port. As shown in Figure 2, there are three roles of PTP ports:

  • Master Port: The port that publishes the synchronized time, which can exist on BC or OC;
  • Slave Port: the port that receives the synchronization time, which can exist on the BC or OC;
  • Passive Port: a port that neither receives nor publishes synchronization time, and exists on the BC only

Clock Nodes

  • OC (Ordinary Clock): The clock of only one PTP communication port is an ordinary clock.
  • BC (Boundary Clock): A clock with more than one PTP communication port.
  • TC (Transparent Clock): In contrast to BC/OC, which requires time synchronization with other clock nodes, TC does not synchronize with other clock nodes. TC has multiple PTP ports, but it only forwards PTP protocol messages between these ports and corrects them for forwarding delays, and does not synchronize the time through any of the ports.

Grandmaster Clock

As shown in Figure 2, all clock nodes in a PTP domain are organized in a certain hierarchy, and the reference time of the whole domain is the Grandmaster Clock, i.e., the clock at the highest level.

The time of the Grandmaster Clock, i.e., the highest level clock, will eventually be synchronized to the whole PTP domain through the interaction of PTP protocol messages between the clock nodes, so it is also called the clock source. As shown in Figure 2, this is a typical master clock, slave clock deployment relationship schematic.

Asterfusion SONiC-based Open Network Switches with PTP Support

Currently, the Asterfusion CX series open network switch products offer support for the IEEE1588 PTPv2 standard through both hardware and software. When implemented using hardware, which means the time stamp function is carried out through hardware, we can achieve accuracy up to the nanosecond level. Similarly, when implemented using software, we can usually achieve nanosecond-level accuracy as well.

In terms of hardware, we have integrated a high-precision clock module into the machine to facilitate IEEE1588 and Synchronous Ethernet (SyncE) implementation. The hardware port offers full support for PTP and can be used as boundary clock(BC) or Ttransparent clock (TC). Furthermore, the module can be flexibly disassembled based on customer requirements.

On the software side, Asterfusion leads the community in implementing the PTP function in SONiC and optimizing its performance on our Enterprise SONiC DistributionAsterNOS.

By utilizing hardware acceleration and software algorithm optimization, the PTP protocol achieves a synchronization deviation of only 10ns, significantly enhancing speed and stability in protocol interaction. Additionally, interoperability is greatly improved as it supports configurations such as restAPI, RestConf, Netconf, and CLI. This wider range of protocol compatibility enables seamless integration and application.

Currently, we have 4 model SONiC switches that provide PTP functionality, as the following:

Moreover, the CX102S-8GT-M-SWP, CX102S-16GT-DPU-M-SWP becomes the first open layer2/3 switch in the market to offer PTP support in both hardware and software at the access layer. For more: https://www.linkedin.com/feed/update/urn:li:activity:7177999988809981952

Additionally, we are excited to announce that next week, we will be presenting a detailed teardown analysis on the CX102S-16GT-DPU-M-SWP, which we invite you to explore.

For more:contact bd@cloudswit.ch

Latest Posts