Ethernet time synchronization method and device

By time stamping the AM signal in the physical layer of the Ethernet and carrying it in the 1588 event message, the low accuracy problem caused by the uncertainty of the delay in the Ethernet 1588 synchronization method is solved, and higher time synchronization accuracy is achieved. Meets the synchronization requirements of 5G wireless communication.

CN112910588BActive Publication Date: 2024-08-27SANECHIPS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911136134.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-19
Publication Date
2024-08-27
Estimated Expiration
2039-11-19

AI Technical Summary

Technical Problem

The existing time synchronization method based on Ethernet 1588 has delay uncertainty, resulting in low synchronization accuracy and cannot meet the synchronization requirements of 5G wireless communication within 10 nanoseconds.

Method used

At the interface between the physical coding sublayer PCS and the physical media additional sublayer PMA inside the physical layer PHY of Ethernet, timestamp the alignment mark AM signal, and carry these timestamps in the 1588 event message for time synchronization , replacing the traditional 1588 event packet header with timestamp to eliminate the impact of PCS internal delay differences.

Benefits of technology

It improves the time synchronization accuracy, meets the high-precision requirements of 5G wireless communication, reduces the time delay difference, and achieves higher synchronization accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112910588B
    Figure CN112910588B
Patent Text Reader

Abstract

The present invention provides an Ethernet time synchronization method and device, the method comprising: at the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet, time stamping an alignment mark AM signal; carrying the AM timestamp in the corresponding 1588 event message; performing time synchronization according to the AM timestamp carried in the sent and received 1588 event message. In the present invention, by time stamping the fixed period AM signal at the interface between the PCS and the PMA inside the PHY, the influence of the internal delay error of the PCS is eliminated, thereby improving the time synchronization accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to an Ethernet time synchronization method and device. Background Art

[0002] With the development of communication technology, the synchronization accuracy requirements for existing time synchronization technology are getting higher and higher. Especially with the development of 5G wireless communication, the synchronization accuracy of network equipment is required to be within 10 nanoseconds. Generally, the traditional GPS synchronization method is limited by the environment and cost, while the existing synchronization method based on Ethernet 1588 is limited by the bottom layer and the uncertainty of delay, which can generally only reach the level of tens of nanoseconds to microseconds. Summary of the invention

[0003] The embodiment of the present invention provides an Ethernet time synchronization method and device to at least solve the problem of uncertain delay and low synchronization accuracy in the synchronization method based on Ethernet 1588 in the related art.

[0004] According to an embodiment of the present invention, there is provided an Ethernet time synchronization method, comprising: timestamping an alignment marker AM signal at the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet; carrying the AM timestamp in a corresponding 1588 event message; and performing time synchronization according to the AM timestamp carried in the sent and received 1588 event messages.

[0005] Optionally, adding a timestamp to the AM signal includes: adding a sending timestamp to the AM signal or adding a receiving timestamp to the AM signal.

[0006] Optionally, adding a sending timestamp to the AM signal includes: when the AM passes through the PCS and PMA interface along with the sending data stream, the AM detection logic detects the presence of the AM and notifies the 1588 timestamp function module to record the sending timestamp of the AM; the 1588 timestamp function module returns the AM sending timestamp to the MAC; the MAC carries the AM sending timestamp in the corresponding 1588 event message sent.

[0007] Optionally, before the AM passes through the interface between the PCS and the PMA along with the transmitted data stream, the method further includes: the MAC sensing the generation time of the AM.

[0008] Optionally, before the MAC carries the AM sending timestamp in the sent 1588 event message, it also includes: the MAC takes the perceived AM generation time as the starting point, obtains the time window for sending the 1588 event message, and sends the 1588 event message within the time window.

[0009] Optionally, the starting point of the time window is the moment when MAC senses that the current AM passes through PCS, and the AM signal detected by the PCS and PMA interface is timestamped by the 1588 stamping function and returned to MAC after the AM timestamp, and the end point of the time window is the moment when MAC senses the next AM.

[0010] Optionally, after the 1588 time stamping function module transmits the AM sending timestamp back to the MAC, it also includes: caching the AM sending timestamp; when receiving the next AM sending timestamp, updating the AM sending timestamp in the cache.

[0011] Optionally, the MAC carries the AM sending timestamp in the sent 1588 event message, including: caching the 1588 event message sent by the high-level protocol; sending the cached 1588 event message within the sending time window, and taking out the AM timestamp in the sending AM timestamp cache and inserting it into the timestamp field of the 1588 event message when sending.

[0012] Optionally, adding a receiving timestamp to the AM signal includes: when the AM passes through the PCS and PMA interface along with the received data stream, the AM detection logic detects the presence of the AM and notifies the 1588 timestamp function module to record the receiving timestamp of the AM; the 1588 timestamp function module transmits the AM receiving timestamp to the MAC; the MAC associates the AM receiving timestamp with the corresponding received 1588 event message and reports it to the high-level protocol.

[0013] Optionally, the PCS is a multi-channel PCS or a single-channel PCS. When the PCS is a multi-channel PCS, only the AM signal in one channel is time-stamped.

[0014] According to another embodiment of the present invention, an Ethernet time synchronization device is provided, including: a timestamp function module, used to timestamp an alignment marker AM signal at the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet; a physical coding sublayer module, used to carry the AM timestamp in a corresponding 1588 event message; and a high-level protocol function module, used to perform time synchronization according to the AM timestamp carried in the sent and received 1588 event messages.

[0015] Optionally, the AM timestamp includes an AM sending timestamp and an AM receiving timestamp.

[0016] Optionally, the device also includes: AM detection logic, which is used to notify the timestamp function module to record the sending timestamp of the AM when the AM is detected when the AM passes through the PCS and the PMA interface along with the sending data stream; the timestamp function module is also used to return the AM sending timestamp to the MAC; the MAC module is also used to carry the AM sending timestamp in the corresponding 1588 event message sent.

[0017] Optionally, the MAC module is also used to sense the AM generation time.

[0018] Optionally, the MAC module is further used to obtain a time window for sending the 1588 event message based on the perceived AM generation time as a starting point, and send the 1588 event message within the time window.

[0019] Optionally, the starting point of the time window is the moment when MAC senses that the current AM passes through PCS, and the AM signal detected by the PCS and PMA interface is timestamped by the 1588 stamping function and returned to MAC after the AM timestamp, and the end point of the time window is the moment when MAC senses the next AM.

[0020] Optionally, the device further comprises: a timestamp cache module, configured to cache the AM sending timestamp, and update the AM sending timestamp in the cache when receiving the next AM sending timestamp.

[0021] Optionally, the device also includes: a 1588 event message cache module, used to cache the 1588 event message sent by the high-level protocol; a timestamp insertion module, used to send the cached 1588 event message within the sending time window, and when sending, take out the AM timestamp in the sending AM timestamp cache and insert it into the timestamp field of the 1588 event message.

[0022] Optionally, the device also includes: AM detection logic, which is used to notify the timestamp function module to record the reception timestamp of the AM after detecting the presence of the AM when the AM passes through the PCS and the PMA interface along with the received data stream; the timestamp function module is used to transmit the AM reception timestamp to the MAC; the MAC module is also used to associate the AM reception timestamp with the corresponding received 1588 event message, and report it to the high-level protocol.

[0023] Optionally, the PCS is a multi-channel PCS or a single-channel PCS. When the PCS is a multi-channel PCS, only the AM signal in one channel is time-stamped.

[0024] According to yet another embodiment of the present invention, a storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0025] According to yet another embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0026] In the above-mentioned embodiment of the present invention, based on the 1588 synchronization method, the fixed-period AM signal is timestamped at the PCS and PMA interface inside the PHY to replace the 1588 event message header timestamp, thereby eliminating the influence of the internal delay error of the PCS and improving the time synchronization accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0028] Figure 1 is a flow chart of an Ethernet time synchronization method according to an embodiment of the present invention;

[0029] Figure 2 This is a schematic diagram of timestamping the message header of a 1588 event message on boundaries A, B, and C according to an embodiment of the present invention;

[0030] Figure 3 is a schematic diagram of the relationship between the boundary AA and various functional modules according to an embodiment of the present invention;

[0031] Figure 4 is a schematic diagram of the time relationship between sending and receiving the same 1588 event message on the boundary A and the boundary AA at the sending side and the receiving side according to an embodiment of the present invention;

[0032] Figure 5 The figure is a schematic diagram of sending a 1588 event message according to an embodiment of the present invention.

[0033] Figure 6 is a schematic diagram of the structure of an Ethernet time synchronization device according to an embodiment of the present invention;

[0034] Figure 7 FIG. 4 is a schematic diagram of the structure of an Ethernet time synchronization device according to another embodiment of the present invention. DETAILED DESCRIPTION

[0035] The present invention will be described in detail below with reference to the accompanying drawings and in combination with embodiments. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.

[0036] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0037] In order to overcome the problem that the 1588 event message header is used for timestamping at the interface between MAC and PHY in the prior art, and the PHY internal delay error causes the synchronization accuracy to be reduced, an embodiment of the present invention provides a time synchronization method. In this embodiment, based on the 1588 synchronization mode, the PCS AM mark is used for timestamping inside the PHY to replace the existing 1588 event message header timestamping solution, thereby improving the time synchronization accuracy.

[0038] Figure 1 is a flow chart of an Ethernet time synchronization method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0039] Step S102, at the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet, a timestamp is added to the alignment marker AM signal;

[0040] Step S104, carrying the AM timestamp in the corresponding 1588 event message;

[0041] Step S106: performing time synchronization according to the AM timestamp carried in the sent and received 1588 event messages.

[0042] The above embodiment is described in detail below from the transmission direction and the reception direction.

[0043] For the send direction:

[0044] 1. MAC senses the time when each AM is generated. In this embodiment, the PCS can generate the AM internally and notify the MAC, or the MAC can help the PCS generate the AM and send it to the PCS;

[0045] 2. When AM is processed in the PCS along with the data stream and passes through the interface between the PCS and the PMA (called the AA point), the AM detection logic sent at the AA point will detect the presence of AM and notify the 1588 time stamping function module to record the AM sending timestamp;

[0046] 3.1588 time stamping function module sends the timestamp sent by AM back to MAC;

[0047] 4. MAC uses the time perceived by each AM as the starting point to obtain the time window in which the 1588 event message can be sent. The 1588 event message is controlled to be sent within this window. When the message is sent, the timestamp field carried in the message is changed to the latest AM sending timestamp currently received.

[0048] For receiving direction:

[0049] 1. The AM detection logic at the AA point will detect the presence of AM. When the detection occurs, the 1588 time stamping function module will be notified to record the AM reception timestamp;

[0050] 2.1588 time stamping function module transmits the AM receiving timestamp to MAC;

[0051] 3. When MAC receives the sent 1588 event message, it takes the latest received AM receiving timestamp, establishes the association between this 1588 event message and the receiving AM timestamp, and reports them together to the high-level protocol function module.

[0052] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0053] The embodiment of the present invention also provides an Ethernet time synchronization device, which includes the following modules: a high-level protocol function module, a 1588 time stamping function module, a PMA module, a MAC module, a PCS module, and a sending and receiving AM detection function module.

[0054] Among them, the high-level protocol module, PMA module and 1588 time stamping module are basically the same as the existing technology, mainly the functions of the MAC module and PCS module are modified accordingly, and the sending and receiving AM detection function module is a new function.

[0055] The functions of each module and the data interaction between modules are described in detail below.

[0056] MAC processes the data packets sent by the upper layer into frames and sends them to the PCS sending channel. It processes the frames received by the PCS receiving channel and sends them to the upper layer protocol module. Data packets include non-1588 event service packets and 1588 event packets. For 1588 sending event packets, MAC needs to update the latest sending AM timestamp sent by the 1588 timestamp function module to the message field. For 1588 event packets identified by the MAC receiving side, MAC will associate the latest receiving AM timestamp sent by the 1588 timestamp function module with the current 1588 packet and notify the upper layer.

[0057] After receiving the transmission frame from MAC, PCS performs encoding and sends it to PMA. PCS receives data from PMA and decodes it before sending it to MAC. If MAC provides AM generation function, PCS will skip AM generation logic and do subsequent encoding. If PCS generates AM by itself, it needs to feed back AM generation time to MAC. In addition, PCS can provide some auxiliary information to help external send and receive AM detection function modules as needed.

[0058] The sending and receiving AM detection function module detects the AM information in the sending and receiving data interacting between the PCS and PMA at the boundary AA, and notifies the 1588 time stamping module to stamp the sending and receiving AM timestamps when AM is detected.

[0059] When the 1588 time stamping module receives the two-way sending and receiving stamping request when the sending and receiving AM detection function module detects AM, it uses the 1588 clock to record the timestamp information and then transmits the two-way timestamp information to the MAC.

[0060] Compared with the prior art, in the above embodiment, the underlying delay error is reduced, thereby achieving the effect of improving the time synchronization accuracy.

[0061] The embodiments of the present invention are further described in detail below with reference to the accompanying drawings:

[0062] like Figure 2 As shown in the figure, the existing 1588 technology timestamps at the boundary C, boundary B, and boundary A from the top layer to the bottom layer. Boundary A is the bottom boundary, that is, the boundary between MAC and PHY. The trigger point for timestamping at the boundary is the 1588 event message header. If timestamping is performed at the bottom boundary A, there is still a delay error inside the PHY that affects the time synchronization accuracy.

[0063] like Figure 3As shown in the figure, a boundary AA is set at a lower level than the original boundary A, that is, between the PCS layer and the PMA layer in the PHY, and timestamps are added at the boundary AA. Since the 1588 event message is already random data and difficult to identify at this boundary, the AM identifier that exists and can be identified in the PCS itself can be used to add timestamps at this boundary to replace the 1588 event message header stamp. The original 1588 event message uses the same message header data when sending and receiving to trigger the timestamp behavior, but now the same AM is used to trigger the timestamp behavior when sending and receiving.

[0064] The AM used in the embodiment of the present invention is a special code type added to the PCS protocol. When sending, it is generated at a fixed period and carried in the PCS processing data stream for sending. When receiving, the AM in the data stream is used for PCS receiving synchronization alignment. Figure 4 As shown, AM is a periodically generated mark with a fixed period P AM MAC on the sending side senses AM0, which is then output to the boundary AA after PCS encoding. When the sending / receiving AM detection function module detects AM0 at the boundary AA, it notifies the 1588 time stamping function module to add a timestamp T. AM0-TX , the 1588 time stamp module then transmits this timestamp back to the MAC. The round-trip transmission time is t AM-delay Because the PCS transmission path delay is uncertain, t AM-delay It is an uncertain value. MAC needs to ensure that after the timestamp corresponding to AM0 is transmitted to MAC, the time window W before the next AM1 is generated msg The 1588 event message can only be sent within t. Otherwise, the AM bound to the current 1588 event message may not be the same AM. Assume that the 1588 event message exceeds the upper boundary of the time window corresponding to AM0, that is, less than t after sensing AM0 AM-delay When the event message is sent, the latest AM sending timestamp is required. At this time, the sending timestamp of AM0 has not been returned yet, so the historical value, that is, the sending timestamp of the previous AM, is obtained. At this time, the sending AM bound to the sending side of this 1588 event message is the previous one, and the receiving side is bound to the current AM0. Assuming that the 1588 event message exceeds the lower boundary of the time window corresponding to AM0, that is, after sensing AM1, the 1588 event is sent when the sending timestamp of AM1 is not updated, the sending side is still bound to AM0, but the receiving side may be bound to AM1.

[0065] like Figure 5 As shown, the sending side 1588 event message is sent at the boundary point A in the AM0 sending window. At this time, the internal timestamp field of the sending event message is updated to the timestamp T of AM0 sent at point AA. AM0-TXAfter the sending event message passes through the AA point on the sending side, it arrives at the AA point on the receiving side through the underlying transmission. At this time, AM0 has already arrived at the AA point on the receiving side before the sending event message passes through, and is detected by the receiving AM detection function module. Receive AM0 timestamp T AM0-RX It is recorded by the 1588 timestamp function module and arrives before the receiving side A receives the 1588 event message. Therefore, when A receives the corresponding 1588 event message, the latest receiving AM timestamp bound to it is the receiving AM0 timestamp T AM0-RX .

[0066] Since the high-level protocol does not know the low-level window time, and the delay from the high-level to the MAC is not fixed, the time when the MAC receives the 1588 event message is random. The 1588 event message has a sending time window limit, and the 1588 message cannot be forwarded immediately. Other messages do not have this limit, so the MAC sending path has additional control here. Its structure is as follows Figure 5 shown.

[0067] After the message sent by the high-level protocol function module is identified and distributed, the 1588 event message is separated and written into the 1588 event message cache module. If there is a message entering the 1588 event message cache module, the cache status is sent to the time window control module. When the time window control module sees that the cache status is not empty within the time window obtained and the message identification and distribution module does not detect the message sending, the output message temporarily requests the source not to send the packet, and then notifies the 1588 event message cache module to read the message, and at the same time switches the data selection module to select the 1588 time message output. When the 1588 event message cache module outputs the message to the timestamp insertion module, the timestamp insertion module reads the timestamp from the sending AM timestamp cache and inserts it into the internal field of the message, and finally selects it for output through the data selection module.

[0068] For the AM timestamp cache module, after each AM is sent, the AM timestamp will be input to the AM timestamp cache module, and the old value will be updated to the latest input value each time.

[0069] After the 1588 event message is sent when the sending AM timestamp is entered, the cache status of the 1588 event message cache module is empty, the time window control module retracts the message sending pause, and retracts the event message reading indication and the 1588 event message data selection control, and the non-1588 event message sent passes through the message data selection module for output.

[0070] The above technical solution provided by the embodiment of the present invention is applicable to all systems that use AM in PCS, including multi-lane PCS and single-lane RSFEC (Reed Solomon Forward Error Correction Coding) scenarios. For multi-lane scenarios, only one physical lane's AM needs to be timestamped. Especially for complex multi-lane scenarios, since the delay of each lane is different, the PCS delay uncertainty is greater, and the time synchronization accuracy benefit for such systems is greater.

[0071] In this embodiment, an Ethernet time synchronization device is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0072] An embodiment of the present invention provides an Ethernet time synchronization device. Figure 6 1 is a block diagram of the structure of an Ethernet time synchronization device according to an embodiment of the present invention. This embodiment is different from the device embodiment in the above text in terms of the division of module functions. Figure 6 As shown, the device includes: a time stamping function module 10, a physical coding sublayer (PCS) module 20 and a high-level protocol function module 30.

[0073] The timestamp function module 10 is used to timestamp the alignment mark AM signal at the interface between the physical coding sublayer and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet. The physical coding sublayer module 20 is used to carry the AM timestamp in the corresponding 1588 event message. The high-level protocol function module 30 is used to perform time synchronization according to the AM timestamp carried in the sent and received 1588 event messages.

[0074] Figure 7 is a structural block diagram of an Ethernet time synchronization device according to an embodiment of the present invention. Figure 7 As shown, the device includes Figure 6 In addition to all the modules shown, the system also includes an AM detection logic 40 , a MAC module 50 , a timestamp buffer module 60 , a message buffer module 70 and a timestamp insertion module 80 .

[0075] The AM detection logic 40 is used to notify the time stamping function module to record the sending timestamp of the AM when the AM is detected to be present when the AM passes through the interface between the PCS and the PMA along with the sending data stream.

[0076] The time stamping function module 10 is further used to transmit the AM sending timestamp back to the MAC module 50. The MAC module 50 is further used to carry the AM sending timestamp in the corresponding 1588 event message sent.

[0077] The MAC module 50 is further configured to obtain a time window for sending the 1588 event message based on the perceived AM generation time as a starting point, and send the 1588 event message within the time window.

[0078] The timestamp cache module 60 is used to cache the AM sending timestamp, and when receiving the next AM sending timestamp, update the AM sending timestamp in the cache.

[0079] The message buffer module 70 is used to buffer the 1588 event message sent by the high-level protocol function module 30 .

[0080] The timestamp inserting module 80 is used to insert the sending AM timestamp in the buffer into the timestamp field of the 1588 event message.

[0081] The AM detection logic 40 is also used for notifying the timestamp function module to record the sending timestamp of the AM when the AM passes through the interface between the PCS and the PMA along with the received data stream, after detecting the presence of the AM;

[0082] The timestamp function module 10 is further configured to transmit the AM receiving timestamp to the MAC.

[0083] The MAC module 50 is further configured to associate the AM reception timestamp with the corresponding received 1588 event message, and report the associated information to the high-level protocol function module 30 .

[0084] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0085] An embodiment of the present invention further provides a storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps in the above method embodiment when running.

[0086] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0087] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in the above method embodiment.

[0088] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0089] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. An Ethernet time synchronization method, characterized in that: include: At the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of Ethernet, the alignment marker AM signal is timestamped; Carrying the AM timestamp in the corresponding 1588 event message; Time synchronization is performed based on the AM timestamp carried in the sent and received 1588 event messages; Wherein, the step of timestamping the AM signal comprises: Adding a sending timestamp to the AM signal or adding a receiving timestamp to the AM signal; The step of stamping the AM signal with a receiving timestamp comprises: When the AM passes through the interface between the PCS and the PMA along with the received data stream, the AM detection logic detects the presence of the AM and notifies the 1588 time stamping function module to record the receiving timestamp of the AM; The 1588 time stamping function module transmits the AM receiving timestamp to the MAC; The MAC associates the AM reception timestamp with the corresponding 1588 event message received, and reports it to the high-level protocol.

2. The method according to claim 1, characterized in that Adding a sending timestamp to the AM signal includes: When the AM passes through the interface between the PCS and the PMA along with the transmitted data stream, the AM detection logic detects the presence of the AM and notifies the 1588 time stamping function module to record the transmission timestamp of the AM; The 1588 time stamping function module transmits the AM sending timestamp back to the MAC; The MAC carries the AM sending timestamp in the corresponding 1588 event message sent.

3. The method according to claim 2, characterized in that Before the AM passes through the interface between the PCS and the PMA along with the transmitted data stream, the method further comprises: The MAC senses the AM generation time.

4. The method according to claim 3, characterized in that Before the MAC carries the AM sending timestamp in the sent 1588 event message, the MAC further includes: The MAC takes the perceived generation time of the AM as a starting point, obtains a time window for sending the 1588 event message, and sends the 1588 event message within the time window.

5. The method according to claim 4, characterized in that in, The starting point of the time window is the moment when MAC senses that the current AM passes through PCS, and the AM signal detected by the PCS and PMA interface is timestamped by the 1588 stamping function and returned to the MAC after the AM timestamp. The end point of the time window is the moment when MAC senses the next AM.

6. The method according to claim 4, characterized in that After the 1588 time stamping function module transmits the AM sending timestamp back to the MAC, it also includes: Cache the AM sending timestamp; When the next AM sending timestamp is received, the AM sending timestamp in the cache is updated.

7. The method according to claim 6, characterized in that The MAC carries the AM sending timestamp in the sent 1588 event message including: Buffering the 1588 event message sent by the high-level protocol; The cached 1588 event message is sent within the sending time window, and when sending, the AM timestamp in the sending AM timestamp buffer is taken out and inserted into the timestamp field of the 1588 event message.

8. The method according to claim 1, characterized in that The PCS is a multi-channel PCS or a single-channel PCS. When the PCS is a multi-channel PCS, only the AM signal in one channel is time-stamped.

9. An Ethernet time synchronization device, characterized in that: include: The time stamping function module is used to add a time stamp to the alignment mark AM signal at the interface between the physical coding sublayer PCS and the physical media attachment sublayer PMA inside the physical layer PHY of the Ethernet; A physical coding sublayer module, used for carrying the AM timestamp in a corresponding 1588 event message; A high-level protocol function module is used to perform time synchronization based on the AM timestamp carried in the sent and received 1588 event messages; Wherein, the AM timestamp includes an AM sending timestamp and an AM receiving timestamp; AM detection logic is used to notify the time stamping function module to record the receiving timestamp of the AM after detecting the presence of the AM when the AM passes through the interface between the PCS and the PMA along with the received data stream; The time stamping function module is used to transmit the AM receiving timestamp to the MAC module; The MAC module is further used to associate the AM reception timestamp with the corresponding received 1588 event message and report it to the high-level protocol.

10. The device according to claim 9, characterized in that Also includes: AM detection logic, used for notifying the time stamping function module to record the sending timestamp of the AM when the AM is detected when the AM passes through the interface between the PCS and the PMA along with the sending data stream; The time stamping function module is also used to transmit the AM sending timestamp back to the MAC module; The MAC module is also used to carry the AM sending timestamp in the corresponding 1588 event message sent.

11. The device according to claim 10, characterized in that The MAC module is also used to sense the AM generation time.

12. The device according to claim 11, characterized in that The MAC module is further used to obtain a time window for sending the 1588 event message based on the perceived AM generation time as a starting point, and send the 1588 event message within the time window.

13. The device according to claim 12, characterized in that in, The starting point of the time window is the moment when MAC senses that the current AM passes through PCS, and the AM signal detected by the PCS and PMA interface is timestamped by the 1588 stamping function and returned to the MAC after the AM timestamp. The end point of the time window is the moment when MAC senses the next AM.

14. The device according to claim 12, characterized in that Also includes: The timestamp cache module is used to cache the AM sending timestamp and update the AM sending timestamp in the cache when receiving the next AM sending timestamp.

15. The device according to claim 14, characterized in that Also includes: A 1588 event message cache module, used for caching the 1588 event message sent by the high-level protocol; The timestamp insertion module is used to send the cached 1588 event message within the sending time window, and when sending, take out the AM timestamp in the sending AM timestamp buffer and insert it into the timestamp field of the 1588 event message.

16. The device according to claim 9, characterized in that The PCS is a multi-channel PCS or a single-channel PCS. When the PCS is a multi-channel PCS, only the AM signal in one channel is time-stamped.