Time synchronization method and apparatus

By adding a timestamp write location and PTP message processing field to the stack header, the PTP protocol is run only on the master device, which solves the problem of high software complexity in the stacking system, realizes full-port clock synchronization, reduces costs and expands the application scope.

CN116418439BActive Publication Date: 2026-08-25SUZHOU CENTEC COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111660534.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2026-08-25
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

When deploying the PTP protocol in a stacked system, existing technologies suffer from high software complexity or the inability to provide full port support for time synchronization, which limits the widespread application of PTP in stacked systems.

Method used

By adding three preset fields—timestamp write position and PTP message processing behavior—to the stack header, any port of the entire system can be used as a clock synchronization port to achieve time synchronization with upstream and downstream devices simply by running the PTP protocol on the master device.

Benefits of technology

It reduces the complexity and design cost of PTP time synchronization schemes in stacked systems, achieves full-port clock synchronization, and expands the application scope of distributed rack PTP clock synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116418439B_ABST
    Figure CN116418439B_ABST
Patent Text Reader

Abstract

A time synchronization method and device, wherein the time synchronization method comprises: writing, by a slave device, a first preset field in a PTP message stack header sent to a master device, a receiving time stamp t2 of a received Sync message of the slave device; acquiring, by the master device, the receiving time stamp t2 and writing, in a second preset field in a Delay_Req message stack header, an operation identifier recording a time of sending the Delay_Req message; acquiring, by the slave device according to the operation identifier, a sending time stamp t3 of the Delay_Req message sent by a port through a hardware interrupt to inform a CPU; and sending, by the CPU of the slave device, the sending time stamp t3 to the master device. Through the device and method, the problem of high software complexity or inability to provide full-port support time synchronization in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to network communication technology, and in particular to a time synchronization method and apparatus. Background Technology

[0002] Precision Time Protocol (PTP), based on the IEEE 1588 standard, utilizes underlying hardware and the PTP protocol to support nanosecond-level accuracy. PTP stands for Precision Clock Synchronization Protocol in the IEEE 1588 standard. Its principle is to obtain timestamp pairs {t1, t2, t3, t4} by exchanging PTP messages between the slave clock and the master clock, thus calculating the time difference between the slave and master clocks and achieving clock synchronization. In applications, PTP can support Ethernet, V4 UDP, V6 UDP, MPLS, and other message types.

[0003] Implementing PTP solutions using stacked and rack-mounted devices is more complex than implementing them with a single box-type device. A stacked system, as a single device, requires each port to support clock synchronization. Current technologies typically require running the PTP protocol on each device or designating a specific device for time synchronization. Both methods have their own problems. Running the PTP system on each device increases software complexity; while designating a specific device for time synchronization prevents all ports from supporting clock synchronization, limiting practical deployment. This becomes a technical obstacle to the further widespread adoption of PTP in stacked systems. Summary of the Invention

[0004] The technical problem to be solved by the embodiments of the present invention is how to solve the problem in the prior art that deploying PTP in a stacked system has high software complexity or cannot provide full port support for time synchronization.

[0005] To address the aforementioned technical problems, this invention provides a time synchronization method applied to a stacking system, where the role of the stacking system is defined as an OC / BC Slaver. The time synchronization method includes: when a slave device receives a Sync message from a peer device, it writes a first preset field in the PTP message stack header destined for the master device to a receive timestamp t2 of the received Sync message; the master device obtains the receive timestamp t2 and writes an operation identifier recording the time the Sync message was sent into a second preset field in the Delay_Req message stack header; based on the operation identifier, the slave device notifies the CPU via a hardware interrupt to obtain the send timestamp t3 of the Sync message sent from the port; the CPU then sends the send timestamp t3 to the master device.

[0006] The aforementioned time synchronization method further includes: in a two-step synchronization environment, the slave device sends a Follow_up message carrying the timestamp t1 sent by the peer device to the master device.

[0007] This invention provides a time synchronization method applied to a stacking system, wherein the role of the stacking system is defined as OC / BC Master. The time synchronization method includes: in single-step synchronization, the master device writes an operation identifier to update the timestamp of the PTP packet transmission to the timestamp position in the Sync packet in a first preset field of the stacking header of the Sync packet sent to the peer device; and identifies the offset of the timestamp in the Sync packet in a second preset field of the stacking header; the slave device updates the timestamp t1 of the transmitted Sync packet to the timestamp position in the Sync packet according to the second preset field; the slave device writes the received timestamp t4 generated when receiving the Del_Req packet sent by the peer device into a third preset field of the stacking header and sends it to the master device; when the master device receives the Del_Req packet, it writes the received timestamp t4 into Delay_Resp and sends it to the peer device via the slave device.

[0008] This invention provides a time synchronization method applied to a stacking system, wherein the role of the stacking system is defined as OC / BC Master. The time synchronization method includes: in two-step synchronization, the master device writes an operation identifier recording the time of sending a PTP message into a first preset field in the stacking header of the Sync message sent to the peer device; the slave device, based on the operation identifier, notifies the CPU via a hardware interrupt to obtain the sending timestamp t1 of the Sync message sent by the port when sending the Sync message to the peer device; the CPU sends the sending timestamp t1 to the master device; the master device includes the sending timestamp t1 in a Follow_up message and sends it to the peer device via the slave device; after the slave device recognizes that the Del_Req message received from the peer device is a PTP message, it writes the receiving timestamp t4 generated when receiving the Del_Req into a second preset field in the stacking header and sends it to the master device; the master device sends the Del_Resp message carrying the receiving timestamp t4 to the peer device via the slave device.

[0009] This invention provides a time synchronization method applied to a stacking system, wherein the role of the stacking system is defined as TC. The time synchronization method includes: master devices and slave devices in the stacking system completing time synchronization via TOD / IPPS; when a receiving device in the stacking system receives a PTP Sync message, it generates a receiving timestamp t and records it in a first preset field of the stack header; and writes an operation identifier for updating the CF field of the PTP message into a second preset field of the stack header; and when a transmitting device in the stacking system sends a PTP Sync message, it subtracts the receiving time from the sending time according to the operation identifier and adds the difference to the CF field.

[0010] This invention provides a time synchronization method, which includes the time synchronization method described above.

[0011] This invention provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as an OC / BC Slaver. The time synchronization device includes: a first processing module for a slave device, configured to, upon receiving a Sync message from a peer device, write a first preset field in the stacking header of a PTP message destined for a master device to a receive timestamp t2 of the received Sync message; a master device processing module, configured to obtain the receive timestamp t2 and write an operation identifier recording the time of sending the Sync message in a second preset field in the stacking header of a Delay_Req message; and a second processing module for a slave device, configured to, based on the operation identifier, notify the CPU via a hardware interrupt to obtain the sending timestamp t3 of the Sync message sent from the port, and the CPU sends the sending timestamp t3 to the master device.

[0012] The aforementioned time synchronization device further includes: a third processing module for the slave device, used to send a Follow_up message carrying the timestamp t1 sent by the peer device to the master device in a two-step synchronization environment.

[0013] This invention provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as OC / BC Master. The time synchronization device includes: a master device first processing module, configured to, during single-step synchronization, write an operation identifier to update the PTP message sending timestamp to the timestamp position in the Sync message in a first preset field of the stacking header of the Sync message sent to the peer device; and to identify the offset of the timestamp in the Sync message in a second preset field of the stacking header; a slave device first processing module, configured to update the timestamp t1 of the sent Sync message to the timestamp position in the Sync message according to the second preset field; a slave device second processing module, configured to write the receiving timestamp t4 generated when receiving the Del_Req message sent by the peer device into a third preset field of the stacking header and send it to the master device; and a master device second processing module, configured to, when receiving the Del_Req message, write the receiving timestamp t4 into Delay_Resp and send it to the peer device via the slave device.

[0014] This invention provides a time synchronization device applied to a stacking system, wherein the stacking system is defined as an OC / BC Master. The time synchronization device includes: a master device first processing module, configured to, during two-step synchronization, write an operation identifier recording the time of sending a PTP message into a first preset field in the stacking header of a Sync message sent to the peer device; a slave device first processing module, configured to, according to the operation identifier, notify the CPU via a hardware interrupt to obtain the sending timestamp t1 of the Sync message sent by the port when sending the Sync message to the peer device, and the CPU sends the sending timestamp t1 to the master device; a slave device second processing module, configured to, after recognizing that the Del_Req message received from the peer device is a PTP message, write the receiving timestamp t4 generated when receiving the Del_Req into a second preset field in the stacking header and send it to the master device; and a master device second processing module, configured to send the Del_Resp message carrying the receiving timestamp t4 to the peer device via the slave device.

[0015] This invention provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as TC. The time synchronization device includes: a first processing module for master and slave devices in the stacking system to complete time synchronization via TOD / IPPS; a second processing module for receiving devices in the stacking system to generate a receiving timestamp t when receiving a PTP Sync message and record it in a first preset field of the stack header; and to write an operation identifier for updating the CF field of the PTP message into a second preset field of the stack header; and a third processing module for transmitting devices in the stacking system to subtract the receiving time from the sending time when sending a PTP Sync message according to the operation identifier, and to accumulate the difference in the CF field.

[0016] This invention provides a time synchronization device, including the time synchronization device described above.

[0017] This invention addresses the problems in existing technologies by adding three preset fields to the stack header: timestamp writing location, timestamp writing position, and PTP message processing behavior. By running the PTP protocol on the master device, any port in the entire system can be used as a clock synchronization port to synchronize time with upstream and downstream devices. This achieves an overall solution for OC / BC master or slave and Transparent Clock in the stacked system. The stacked system of this invention only needs to run the PTP protocol on the master device, rather than on each device, to complete time synchronization between the stacked system and upstream and downstream devices, thereby reducing the complexity and design cost of PTP time synchronization schemes in stacked systems. In terms of implementation, since widely used distributed racks also utilize stacking technology, this invention can also be extended to distributed rack PTP clock synchronization schemes. Attached Figure Description

[0018] Figure 1 This is a topology diagram of a stacked system using a time synchronization method according to an embodiment of the present invention;

[0019] Figure 2 This is a schematic diagram of the stacked header field structure of a time synchronization method according to an embodiment of the present invention. Detailed Implementation

[0020] In existing technologies, implementing PTP solutions using stacked and rack-mounted devices is more complex than implementing them with a single box-type device. A stacked system, as a single device, requires each port to support clock synchronization. Current technologies typically require running the PTP protocol on each device or designating a specific device for time synchronization. Both methods have their own problems. Running the PTP system on each device increases software complexity; while designating a specific device for time synchronization prevents all ports from supporting clock synchronization, limiting practical deployment. This has become a technical problem hindering the further widespread application of PTP in stacked systems.

[0021] The embodiments of the present invention can be applied to stacked systems or distributed rack switch equipment in network environments that require clock synchronization and have high accuracy requirements.

[0022] To address the technical problems in existing technologies, this invention adds three preset fields to the stack header: timestamp writing location, timestamp writing position, and PTP message processing behavior. By running the PTP protocol on the master device, any port in the entire system can be used as a clock synchronization port to synchronize time with upstream and downstream devices. This achieves an overall solution for OC / BC master or slave and Transparent Clock in the stacked system. The stacked system of this invention only needs to run the PTP protocol on the master device, rather than on each device, to complete time synchronization between the stacked system and upstream and downstream devices, thereby reducing the complexity and design cost of the PTP time synchronization scheme in the stacked system. In terms of implementation, since widely used distributed racks also utilize stacking technology, this invention can also be extended to distributed rack PTP clock synchronization schemes.

[0023] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0024] One time synchronization method according to an embodiment of the present invention is specifically applied in a stacked ASIC (Instrument Design Automation) system. For example... Figure 1As shown, switching devices SW1 / 2 / 3 form a simple stacked system, interconnected via stacking ports. In this system, SW1 is elected as the master device, and SW2 / 3 as slave devices. Master device SW1 handles control plane protocol distribution, while slave devices SW2 / 3 only need to forward data on the data plane. Communication between devices in the stacked system occurs via the Stacking Header. The format of the Stacking Header is proprietary to the switching chip manufacturer and typically includes information such as the device's ingress port (src_Port), forwarding instance (fid), and egress port (dest_Port).

[0025] like Figure 1 In this setup, SW1 and SW2 are interconnected via stacking ports Port 2 and Port 3. A unicast forwarded packet enters through Port 1 on SW2 and exits through Port 4 on SW1. When a packet exits through Port 2 on SW2, a Stacking header containing the dest_Port is added. When SW1's Port 3 receives the packet, it first parses the Stacking Header field, retrieves the dest_Port, and forwards the packet directly based on the dest_Port.

[0026] In this embodiment, timestamp t1 is defined as the timestamp captured the instant the Sync message leaves the Master clock device port; timestamp t2 is the timestamp captured the instant the Sync message arrives at the Slave clock device port; timestamp t3 is the timestamp captured the instant the Delay-Request message leaves the Slave clock device port; and timestamp t4 is the timestamp captured the instant the Delay-Request message arrives at the Master clock device port.

[0027] like Figure 2 As shown, this embodiment adds three preset fields to the stack header for writing timestamps, writing timestamp positions, and PTP packet processing behavior:

[0028] (1) Ts: Timestamp of receiving PTP messages from the device;

[0029] (2) Ts offset: The position of the timestamp in the PTP packet when different encapsulations are sent by the protocol stack. For example, when EtherNet, V4 UDP, V6 UDP, MPLS, etc., carry PTP, the position of the timestamp in the PTP packet is different. At the exit of the slave device, it is necessary to update the timestamp of the packet transmission according to this Ts offset;

[0030] (3) Operation type (Oper_type): On the clock port, there are different operation instructions for PTP messages. There are mainly three types: capture, replace, and correction.

[0031] A.Capture: Records the time when a PTP message is sent from the device port, and then reports it to the CPU via an interrupt.

[0032] B.Replace: Sends a time update from the device port to the position of the PTP message timestamp.

[0033] C.Correction: Updates the CF field of the PTP message.

[0034] Example 1

[0035] In this embodiment, the stacking system is defined as the Slaver in an Ordinary / Boundary Clock (OC / BC) system, implementing time synchronization via a one-step process. This embodiment defines two preset fields: a first preset field Ts and a second preset field Opera_type, and specifically includes the following steps:

[0036] Step S101: When the slave device receives the Sync message from the peer device, it writes the first preset field Ts in the stack header of the PTP message sent to the master device into the receiving timestamp t2 of the received Sync message.

[0037] The peer device sends a Sync message carrying a timestamp t1 to SW2 Port 1. Upon receiving the Sync message, SW2 Port 1 generates a receive timestamp t2. Simultaneously, SW2 recognizes that the received message is a Sync message under the PTP protocol and therefore forwards it to the PTP protocol stack of the master device SW1 (in a stacking system, the master device manages other slave devices, such as the synchronization of forwarding tables. Generally, network protocol stacks run on the master device, as is the case with the PTP protocol stack in this embodiment). The first preset field ts in the Stacking header of the Sync message exiting from Port 2 will carry the receive timestamp t2.

[0038] Step S102: The master device obtains the received timestamp t2 and writes the operation identifier of the time when the Delay_Req message was sent into the second preset field Opera_type in the Delay_Req message stack header.

[0039] SW1 sends the Sync message from SW2 to the PTP protocol stack, at which point the PTP protocol stack obtains timestamps t1 and t2. When SW1 sends a Delay_Req message to the peer device, the Stacking header of the message sent through SW1's port 3 will carry the operation instruction of oper_type (capture).

[0040] In step S103, the slave device, based on the operation identifier, notifies the CPU via a hardware interrupt to obtain the sending timestamp t3 of the Sync message sent from the port, and the CPU sends the sending timestamp t3 to the master device.

[0041] SW2 will report t3, which was sent from Port1 via Delay_Req, to ​​SW2's CPU via an interrupt. SW2's CPU will then send t3 to SW1's PTP protocol stack. At this point, SW1 has obtained t1, t2, and t3.

[0042] When the peer device receives the Delay_Req message, it generates a timestamp t4 and then sends it to SW2 via a Delay_Resp message. SW2 receives the Delay_Resp message and then forwards it to SW1. Upon receiving the Delay_Resp message, SW1 obtains t1, t2, t3, and t4. At this point, the PTP protocol stack on the master device has completed time synchronization. Simultaneously, time correction is performed on SW2. The time on SW2 at this point is the same as the time on the upstream device.

[0043] SW2 synchronizes its time with SW1 via ToD / 1PPS, and SW1 then synchronizes its time with SW3 via ToD / 1PPS. At this point, the entire stacking system has completed time synchronization.

[0044] Example 2

[0045] Example 2 proposes another time synchronization method. The stacked system is defined as the Slaver in Ordinary / BoundaryClock (OC / BC). However, the difference from Example 1 is that the time synchronization process is implemented using two-step synchronization. Similarly, this example defines two preset fields, including a first preset field Ts and a second preset field Opera_type, and includes the following steps:

[0046] Step S201: After the peer device sends a Sync message, it sends a Follow-up message.

[0047] The peer device sends a Sync message to line card n and generates a timestamp t1. The peer device then sends a Follow_up message carrying the timestamp t1 to SW2.

[0048] Step S202: When the slave device receives the Sync message from the peer device, it writes the first preset field Ts in the stack header of the PTP message sent to the master device into the receiving timestamp t2 of the received Sync message.

[0049] Step S203: The master device obtains the received timestamp t2 and writes the operation identifier of the time when the Delay_Req message was sent into the second preset field oper_type in the Delay_Req message stack header;

[0050] Step S204: The master device obtains the timestamp t1 through the Follow-up message sent by the slave device;

[0051] SW1 sends the Follow_up message from SW2 to the PTP protocol stack, and the PTP protocol stack receives t1.

[0052] In step S205, the slave device, based on the operation identifier, notifies the CPU via a hardware interrupt to obtain the sending timestamp t3 of the Sync message sent from the port, and the CPU sends the sending timestamp t3 to the master device.

[0053] Steps S202, S203, and S205 in this embodiment are similar to those in Embodiment 1, and can be referred to the relevant content of Embodiment 1, which will not be repeated here.

[0054] Example 3

[0055] In this embodiment, the stacking system is defined as the Master in the Ordinary / Boundary Clock (OC / BC) system, meaning the entire rack equipment acts as the OC / BC Master, and time synchronization is achieved through a one-step synchronization process. This embodiment provides a time synchronization method that defines three preset fields: a first preset field Opera_type, a second preset field Ts_offset, and a third preset field Ts. The specific steps include:

[0056] Step S301: The master device writes the operation identifier that updates the PTP packet sending timestamp to the timestamp position in the Sync packet in the first preset field oper_type in the stack header of the Sync packet sent to the peer device.

[0057] The PTP protocol stack of SW1 sends a Sync message to the peer device. The Stacking header of the message sent through port 3 will write the operation identifier oper_type (replace) into the preset first field oper_type, which is used to indicate the position of the transmission time on the port updated to the PTP message timestamp by the slave device SW2.

[0058] Step S302: The master device identifies the offset of the timestamp in the Sync message in the second preset field Ts_offset in the stack header;

[0059] Additionally, SW1 will also specify the offset of the timestamp in the PTP Sync message, i.e., the position of the timestamp in the message, in the second preset field Ts_offset in the stack header. In this way, after receiving the stack header, SW2 can replace the timestamp t1 of the message leaving SW2's Port1 port with the timestamp t1 of the message leaving SW1's Port3 port.

[0060] Step S303: The slave device updates the timestamp t1 of the Sync message to the timestamp position in the Sync message according to the second preset field;

[0061] After receiving the message, SW2 will update the timestamp of the transmission to the ts_offset of the Sync message, and at the same time send the message to the peer device on Port 1.

[0062] After receiving the Sync message, the peer device will generate a timestamp t2, resulting in timestamps t1 and t2.

[0063] Step S304: The slave device writes the receive timestamp t4 generated when it receives the Del_Req message sent by the peer device into the third preset field Ts of the stack header and sends it to the master device.

[0064] The peer device sends a Delay_Req message to SW2 and generates a timestamp t3. At this time, the peer device obtains timestamps t1, t2, and t3.

[0065] SW2 receives the Delay_Req message, generates a receive timestamp t4, and simultaneously detects that the received message is a PTP protocol message. Therefore, SW2 will forward this message to the protocol stack of the master device SW1. The Stacking header of messages leaving port 2 will carry the timestamp t4.

[0066] In step S305, when the master device receives the Del_Req message, it writes the received timestamp t4 into Delay_Resp and sends it to the peer device via the slave device.

[0067] After receiving the Delay_Req message from SW2, SW1 sends it to the PTP protocol stack running on it. The protocol stack then sends a Delay_Resp message, which carries a timestamp t4, to the peer device through SW2's Port 1 port.

[0068] After receiving the Delay_Resp message, the peer device parses out the timestamp t4, and then obtains all timestamps t1, t2, t3, and t4, thus completing time synchronization.

[0069] Example 4

[0070] In this embodiment, the stacking system is defined as the Master in the Ordinary / Boundary Clock (OC / BC), meaning the entire rack equipment acts as the OC / BC Master. In contrast to Embodiment 3, Embodiment 4 uses a two-step synchronization process for time synchronization. This embodiment defines two preset fields: a first preset field, Opera_type, and a second preset field, Ts. The specific steps include:

[0071] Step S401: The master device writes the operation identifier of the time when the PTP message was sent into the first preset field of the Sync message stack header sent to the peer device;

[0072] During dual-step synchronization, SW1, which runs the PTP protocol stack, needs to send a Sync message carrying a transmission timestamp t1 to the peer device. However, the actual transmission timestamp is generated by the slave device SW2. Therefore, SW1 needs to carry the first preset field oper_type (capture) in the stacking header of the message going out from Port 3 to record the time when SW2's port Port1 sends the PTP message. Then, it reports to the CPU via an interrupt and sends it back to the master device SW1, which then transmits it to the peer device in the Follow_up message.

[0073] Step S402: When the slave device sends the Sync message to the peer device according to the operation identifier, it notifies the CPU to obtain the sending timestamp t1 of the Sync message sent by the port through a hardware interrupt. The CPU then sends the sending timestamp t1 to the master device.

[0074] SW2 will send the Sync message from Port 1, and at the same time, the sending timestamp t1 will be reported to the CPU of SW2 via an interrupt. SW2 will then send the sending timestamp t1 to the PTP protocol stack on SW1.

[0075] Step S403: The master device sends the sending timestamp t1 group into a Follow_up message to the peer device via the slave device;

[0076] SW1 sends a Follow_up message with timestamp t1 to SW2, which then forwards it to the peer device from port 1. Upon receiving the Sync message, the peer device generates timestamp t2, and upon receiving the Follow_up message, it obtains timestamp t1. The peer device then obtains both timestamps t1 and t2.

[0077] Step S404: After the slave device identifies the Del_Req message received from the peer device as a PTP message, it writes the receive timestamp t4 generated when the Del_Req is received into the second preset field in the stack header and sends it to the master device.

[0078] The peer device sends a Delay_Req message to line card n, and generates a timestamp t3. The peer device will then receive timestamps t1, t2, and t3. The peer device also sends a Delay_req message to SW2, generating a timestamp t3. The peer device will then receive timestamps t1, t2, and t3.

[0079] When SW2 receives a Delay_Req message, it generates a timestamp t4. Simultaneously, SW2 decapsulates the message and discovers it is a PTP protocol message, so it sends this message to the protocol stack of the master device SW1. The stacking header of the message exiting from Port 2 will carry the timestamp t4 in the preset field Ts.

[0080] In step S405, the master device sends a Del_Resp message carrying the received timestamp t4 to the peer device via the slave device.

[0081] After SW1 receives the Delay_Req message from SW2, it sends it to the PTP protocol stack. The protocol stack then sends a Delay_Resp message, which carries the timestamp t4, to the peer device through Port 1 of SW2. After receiving the Delay_Resp message, the peer device will obtain all timestamps t1, t2, t3, and t4, and the peer device will complete time synchronization.

[0082] Example 5

[0083] In this embodiment, the stacking system is defined as an Ordinary / Boundary Clock (OC), meaning it does not terminate PTP packets upon receipt. The stacking system has an internal dwell time bridge to calculate the packet's dwell time within the system and uses this to correct the timestamp before propagating it downwards. This embodiment defines two preset fields: a first preset field Ts and a second preset field Opera_type, specifically including:

[0084] In step S501, the master and slave devices in the stacking system complete time synchronization via TOD / IPPS;

[0085] Assuming the PTP Sync message is received by slave device SW2, passes through master device SW1, and is then sent out by slave device SW3, the devices within the system first need to complete time synchronization through tod / 1pps (a format defined by CMCC).

[0086] Step S502: When the receiving device in the stacking system receives the PTP Sync message, it generates a receiving timestamp t and records it in the first preset field of the stack header.

[0087] When Port1 on SW2 receives a PTP message, it generates a timestamp t. This timestamp is carried to the output device SW3 of the stacking system through the first preset field Ts in the Stackingheader.

[0088] Step S503: The receiving device in the stacking system writes the second preset field of the stack header into the operation identifier of the CF field of the PTP message.

[0089] SW2 writes the second preset field, Opera_type, in the Stacking header to indicate that an operation to update the CF field in the PTP message is to be performed.

[0090] In step S504, the transmitting device in the stacking system, based on the operation identifier, subtracts the receiving time from the sending time when sending a Sync message to PTP, and adds the difference to the CF field.

[0091] When the stacking system is sent out from the port of SW3, SW3 will subtract the receiving timestamp t in Ts in the Stacking header from the sending time, and then add the difference (i.e. the residence time of the entire stacking system) into the CF field of the PTP event message to complete the entire process.

[0092] In summary, this invention optimizes the switching chip (ASIC)'s ability to handle timestamps (TS), timestamp offsets (Ts_offset) in PTP, and PTP message processing in stacked scenarios. It provides a simple and highly accurate time synchronization solution for device stacking. Compared to existing technologies that require running the PTP protocol on each device or specifying a fixed device for time synchronization, this invention perfectly solves the problems existing in the prior art by adding three fields to the stacking header: timestamp (ts), timestamp position (ts_offset), and PTP message processing (oper_type). Regardless of whether it performs OC / BC or TC, the stacked system can participate in clock synchronization as a whole device, reducing the complexity of the PTP time synchronization scheme in the stacked system and lowering design costs. Furthermore, since widely used distributed racks also utilize stacking technology, this invention can also be applied to distributed rack PTP clock synchronization schemes, enhancing the versatility of deployment.

[0093] Corresponding to the foregoing method embodiments, this aspect also discloses corresponding apparatus embodiments, including:

[0094] Example 6

[0095] An embodiment of this aspect provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as an OC / BC Slaver, and the time synchronization device includes:

[0096] The first processing module of the slave device is used to write the first preset field in the stack header of the PTP message sent to the master device into the receiving timestamp t2 of the received Sync message when it receives the Sync message from the peer device;

[0097] The main device processing module is used to obtain the received timestamp t2 and write the operation identifier of the time of sending the Sync message into the second preset field in the Delay_Req message stack header;

[0098] The second processing module of the slave device is used to obtain the sending timestamp t3 of the Sync message sent by the port through a hardware interrupt according to the operation identifier, and the CPU sends the sending timestamp t3 to the master device.

[0099] Example 7

[0100] One time synchronization device according to this embodiment further includes, based on embodiment 6:

[0101] The third processing module of the slave device is used to send a Follow_up message carrying the timestamp t1 of the peer device to the master device in a two-step synchronization environment.

[0102] Example 8

[0103] An embodiment of this aspect provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as an OC / BC Master, and the time synchronization device includes:

[0104] The first processing module of the master device is used to write an operation identifier that updates the timestamp of the PTP message to the timestamp position in the Sync message in the first preset field of the stack header of the Sync message sent to the peer device during single-step synchronization; and to identify the offset of the timestamp in the Sync message in the second preset field of the stack header.

[0105] The first processing module of the device is used to update the timestamp t1 of the Sync message to the timestamp position in the Sync message according to the second preset field;

[0106] The second processing module of the slave device is used to write the receive timestamp t4 generated when the Del_Req message sent by the peer device is received into the third preset field of the stack header and send it to the master device;

[0107] The second processing module of the master device is used to write the received timestamp t4 into Delay_Resp when it receives the Del_Req message, and send it to the peer device via the slave device.

[0108] Example 9

[0109] An embodiment of this aspect provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as an OC / BC Master, and the time synchronization device includes:

[0110] The first processing module of the master device is used to write an operation identifier that records the time of sending the PTP message into the first preset field of the stack header of the Sync message sent to the peer device during two-step synchronization.

[0111] The first processing module of the slave device is used to notify the CPU to obtain the sending timestamp t1 of the Sync message sent by the port when sending the Sync message to the peer device according to the operation identifier, and the CPU sends the sending timestamp t1 to the master device.

[0112] The second processing module of the slave device is used to identify that the Del_Req message received from the peer device is a PTP message, write the receiving timestamp t4 generated when the Del_Req is received into the second preset field in the stack header, and send it to the master device;

[0113] The second processing module of the master device is used to send the Del_Resp message carrying the received timestamp t4 to the peer device via the slave device.

[0114] Example 10

[0115] An embodiment of this aspect provides a time synchronization device applied to a stacking system, wherein the role of the stacking system is defined as TC, and the time synchronization device includes:

[0116] The first processing module is used for time synchronization between master and slave devices in the stacking system via TOD / 1PPS.

[0117] The second processing module is used to generate a receiving timestamp t when the receiving device in the stacking system receives a PTP Sync message and record it in the first preset field of the stacking header; and to write the operation identifier of the CF field of the PTP message into the second preset field of the stacking header.

[0118] The third processing module is used by the transmitting device in the stacking system to subtract the receiving time from the sending time when sending a Sync message to PTP according to the operation identifier, and to accumulate the difference into the CF field.

[0119] Those skilled in the art will understand that the time synchronization device of this embodiment and the aforementioned time synchronization method are based on the same inventive concept. Therefore, the content of the relevant embodiments can be referred to the corresponding content above, and will not be repeated here.

[0120] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include ROM, RAM, disk, or optical disk, etc.

[0121] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.

Claims

1. A time synchronization method, characterized in that, This is applied to a stacking system, where the role of the stacking system is defined as OC / BCSlaver. Devices in the stacking system communicate via a stacking header, which is a private header for the switching chip, carrying inbound port information, forwarding instance, and outbound port information. The stacking header includes a first preset field for carrying a timestamp and a second preset field for indicating the operation type of the PTP message. The time synchronization method includes: When the slave device receives the Sync message from the peer device, it writes the first preset field in the PTP message stack header sent to the master device into the timestamp t2 of the received Sync message. The master device obtains the received timestamp t2 and writes the operation identifier of the time when the Delay_Req message was sent into the second preset field in the Delay_Req message stack header; Based on the operation identifier, the slave device notifies the CPU via a hardware interrupt to obtain the sending timestamp t3 of the Sync message sent from the port, and the slave device's CPU sends the sending timestamp t3 to the master device.

2. The time synchronization method as described in claim 1, characterized in that, Also includes: In a two-step synchronization environment, the slave device will send a Follow_up message carrying the timestamp t1 sent by the peer device to the master device.

3. A time synchronization method, characterized in that, This is applied to a stacking system, where the role of the stacking system is defined as OC / BCMaster. Devices in the stacking system communicate via a stacking header, which is a proprietary header of the switching chip that carries inbound port information, forwarding instance, and outbound port information. The stacking header includes a first preset field for carrying a timestamp and a second preset field for indicating the type of operation on PTP packets. The time synchronization method includes: In single-step synchronization, the master device writes an operation flag in the first preset field of the stack header of the Sync message sent to the peer device to update the timestamp of the PTP message to the timestamp position in the Sync message; and identifies the offset of the timestamp in the Sync message in the second preset field of the stack header. The device updates the timestamp t1 of the Sync message to the timestamp position in the Sync message according to the second preset field; The slave device will write the receive timestamp t4 generated when it receives the Del_Req message sent by the peer device into the third preset field of the stack header and send it to the master device; When the master device receives the Del_Req message, it writes the received timestamp t4 into Delay_Resp and sends it to the peer device via the slave device.

4. A time synchronization method, characterized in that, This is applied to a stacking system, where the role of the stacking system is defined as OC / BCMaster. Devices in the stacking system communicate via a stacking header, which is a proprietary header of the switching chip that carries inbound port information, forwarding instance, and outbound port information. The stacking header includes a first preset field for carrying a timestamp and a second preset field for indicating the type of operation on PTP packets. The time synchronization method includes: In two-step synchronization, the master device writes the operation identifier of the time when the PTP message was sent into the first preset field of the stack header of the Sync message sent to the peer device. When the slave device sends a Sync message to the peer device according to the operation identifier, it notifies the CPU to obtain the sending timestamp t1 of the Sync message sent by the port through a hardware interrupt. The CPU then sends the sending timestamp t1 to the master device. The master device will include the sending timestamp t1 in the Follow_up message and send it to the peer device via the slave device; After the device identifies the Del_Req message received from the peer device as a PTP message, it writes the receive timestamp t4 generated when the Del_Req was received into the second preset field in the stack header and sends it to the master device. The master device will send a Del_Resp message carrying the received timestamp t4 to the peer device via the slave device.

5. A time synchronization method, characterized in that, This method is applied to a stacking system, where the role of the stacking system is defined as TC. Devices in the stacking system communicate via a stacking header, which is a private header for the switching chip, carrying inbound port information, forwarding instance, and outbound port information. The stacking header includes a first preset field for carrying a timestamp and a second preset field for indicating the operation type of the PTP message. The time synchronization method includes: Master and slave devices in the stacked system synchronize time via TOD / 1PPS; When the receiving device in the stacking system receives the PTP Sync message, it generates a receiving timestamp t and records it in the first preset field of the stack header; and writes the operation flag for updating the CF field of the PTP message into the second preset field of the stack header. In the stacking system, the transmitting device, based on the operation identifier, subtracts the receiving time from the sending time when sending a Sync message to PTP, and adds the difference to the CF field.

6. A time synchronization method, characterized in that, Including the time synchronization method as described in any one of claims 1 to 5.

7. A time synchronization device, employing the time synchronization method of claim 1, characterized in that, Applied to a stacked system, where the role of the stacked system is defined as an OC / BC Slaver, the time synchronization device includes: The first processing module of the slave device is used to write the first preset field in the stack header of the PTP message sent to the master device into the receiving timestamp t2 of the received Sync message when it receives the Sync message from the peer device; The main device processing module is used to obtain the received timestamp t2 and write the operation identifier of the time of sending the Sync message into the second preset field in the Delay_Req message stack header; The second processing module of the slave device is used to obtain the sending timestamp t3 of the Sync message sent by the port through a hardware interrupt according to the operation identifier, and the CPU sends the sending timestamp t3 to the master device.

8. The time synchronization device as described in claim 7, characterized in that, Also includes: The third processing module of the slave device is used to send a Follow_up message carrying the timestamp t1 of the peer device to the master device in a two-step synchronization environment.

9. A time synchronization device, employing the time synchronization method of claim 3, characterized in that, Applied to a stacked system, where the role of the stacked system is defined as OC / BC Master, the time synchronization device includes: The first processing module of the master device is used to write an operation identifier that updates the timestamp of the PTP message to the timestamp position in the Sync message in the first preset field of the stack header of the Sync message sent to the peer device during single-step synchronization; and to identify the offset of the timestamp in the Sync message in the second preset field of the stack header. The first processing module of the device is used to update the timestamp t1 of the Sync message to the timestamp position in the Sync message according to the second preset field; The second processing module of the slave device is used to write the receive timestamp t4 generated when the Del_Req message sent by the peer device is received into the third preset field of the stack header and send it to the master device; The second processing module of the master device is used to write the received timestamp t4 into Delay_Resp when it receives the Del_Req message, and send it to the peer device via the slave device.

10. A time synchronization device, employing the time synchronization method of claim 4, characterized in that, Applied to a stacked system, where the role of the stacked system is defined as OC / BC Master, the time synchronization device includes: The first processing module of the master device is used to write an operation identifier that records the time of sending the PTP message into the first preset field of the stack header of the Sync message sent to the peer device during two-step synchronization. The first processing module of the slave device is used to notify the CPU to obtain the sending timestamp t1 of the Sync message sent by the port when sending the Sync message to the peer device according to the operation identifier, and the CPU sends the sending timestamp t1 to the master device. The second processing module of the slave device is used to identify that the Del_Req message received from the peer device is a PTP message, write the receiving timestamp t4 generated when the Del_Req is received into the second preset field in the stack header, and send it to the master device; The master device's second processing module is used to send the Del_Resp message carrying the received timestamp t4 to the peer device via the slave device.

11. A time synchronization device, employing the time synchronization method of claim 5, characterized in that, Applied to a stacked system, where the role of the stacked system is defined as TC, the time synchronization device includes: The first processing module is used for time synchronization between master and slave devices in the stacking system via TOD / 1PPS. The second processing module is used to generate a receiving timestamp t when the receiving device in the stacking system receives a PTP Sync message and record it in the first preset field of the stacking header; and to write the operation identifier of the CF field of the PTP message into the second preset field of the stacking header. The third processing module is used by the transmitting device in the stacking system to subtract the receiving time from the sending time when sending a Sync message to PTP according to the operation identifier, and to accumulate the difference into the CF field.

12. A time synchronization device, characterized in that, Includes the time synchronization device as described in any one of claims 7 to 11.

Citation Information

Patent Citations

  • Time synchronization method for stacking system, stacking system and member equipment

    CN102195996A

  • PTP realizing method and device adopted under chip stacked mode

    CN105207734A